mirror of
https://github.com/linux-msm/laptops-kernel.git
synced 2026-08-13 14:19:53 -07:00
Merge tag 'char-misc-4.21-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc
Pull char/misc driver updates from Greg KH:
"Here is the big set of char and misc driver patches for 4.21-rc1.
Lots of different types of driver things in here, as this tree seems
to be the "collection of various driver subsystems not big enough to
have their own git tree" lately.
Anyway, some highlights of the changes in here:
- binderfs: is it a rule that all driver subsystems will eventually
grow to have their own filesystem? Binder now has one to handle the
use of it in containerized systems.
This was discussed at the Plumbers conference a few months ago and
knocked into mergable shape very fast by Christian Brauner. Who
also has signed up to be another binder maintainer, showing a
distinct lack of good judgement :)
- binder updates and fixes
- mei driver updates
- fpga driver updates and additions
- thunderbolt driver updates
- soundwire driver updates
- extcon driver updates
- nvmem driver updates
- hyper-v driver updates
- coresight driver updates
- pvpanic driver additions and reworking for more device support
- lp driver updates. Yes really, it's _finally_ moved to the proper
parallal port driver model, something I never thought I would see
happen. Good stuff.
- other tiny driver updates and fixes.
All of these have been in linux-next for a while with no reported
issues"
* tag 'char-misc-4.21-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/char-misc: (116 commits)
MAINTAINERS: add another Android binder maintainer
intel_th: msu: Fix an off-by-one in attribute store
stm class: Add a reference to the SyS-T document
stm class: Fix a module refcount leak in policy creation error path
char: lp: use new parport device model
char: lp: properly count the lp devices
char: lp: use first unused lp number while registering
char: lp: detach the device when parallel port is removed
char: lp: introduce list to save port number
bus: qcom: remove duplicated include from qcom-ebi2.c
VMCI: Use memdup_user() rather than duplicating its implementation
char/rtc: Use of_node_name_eq for node name comparisons
misc: mic: fix a DMA pool free failure
ptp: fix an IS_ERR() vs NULL check
genwqe: Fix size check
binder: implement binderfs
binder: fix use-after-free due to ksys_close() during fdget()
bus: fsl-mc: remove duplicated include files
bus: fsl-mc: explicitly define the fsl_mc_command endianness
misc: ti-st: make array read_ver_cmd static, shrinks object size
...
This commit is contained in:
@@ -21,6 +21,15 @@ Description: Holds a comma separated list of device unique_ids that
|
||||
If a device is authorized automatically during boot its
|
||||
boot attribute is set to 1.
|
||||
|
||||
What: /sys/bus/thunderbolt/devices/.../domainX/iommu_dma_protection
|
||||
Date: Mar 2019
|
||||
KernelVersion: 4.21
|
||||
Contact: thunderbolt-software@lists.01.org
|
||||
Description: This attribute tells whether the system uses IOMMU
|
||||
for DMA protection. Value of 1 means IOMMU is used 0 means
|
||||
it is not (DMA protection is solely based on Thunderbolt
|
||||
security levels).
|
||||
|
||||
What: /sys/bus/thunderbolt/devices/.../domainX/security
|
||||
Date: Sep 2017
|
||||
KernelVersion: 4.13
|
||||
|
||||
@@ -133,6 +133,26 @@ If the user still wants to connect the device they can either approve
|
||||
the device without a key or write a new key and write 1 to the
|
||||
``authorized`` file to get the new key stored on the device NVM.
|
||||
|
||||
DMA protection utilizing IOMMU
|
||||
------------------------------
|
||||
Recent systems from 2018 and forward with Thunderbolt ports may natively
|
||||
support IOMMU. This means that Thunderbolt security is handled by an IOMMU
|
||||
so connected devices cannot access memory regions outside of what is
|
||||
allocated for them by drivers. When Linux is running on such system it
|
||||
automatically enables IOMMU if not enabled by the user already. These
|
||||
systems can be identified by reading ``1`` from
|
||||
``/sys/bus/thunderbolt/devices/domainX/iommu_dma_protection`` attribute.
|
||||
|
||||
The driver does not do anything special in this case but because DMA
|
||||
protection is handled by the IOMMU, security levels (if set) are
|
||||
redundant. For this reason some systems ship with security level set to
|
||||
``none``. Other systems have security level set to ``user`` in order to
|
||||
support downgrade to older OS, so users who want to automatically
|
||||
authorize devices when IOMMU DMA protection is enabled can use the
|
||||
following ``udev`` rule::
|
||||
|
||||
ACTION=="add", SUBSYSTEM=="thunderbolt", ATTRS{iommu_dma_protection}=="1", ATTR{authorized}=="0", ATTR{authorized}="1"
|
||||
|
||||
Upgrading NVM on Thunderbolt device or host
|
||||
-------------------------------------------
|
||||
Since most of the functionality is handled in firmware running on a
|
||||
|
||||
@@ -0,0 +1,57 @@
|
||||
Intel Service Layer Driver for Stratix10 SoC
|
||||
============================================
|
||||
Intel Stratix10 SoC is composed of a 64 bit quad-core ARM Cortex A53 hard
|
||||
processor system (HPS) and Secure Device Manager (SDM). When the FPGA is
|
||||
configured from HPS, there needs to be a way for HPS to notify SDM the
|
||||
location and size of the configuration data. Then SDM will get the
|
||||
configuration data from that location and perform the FPGA configuration.
|
||||
|
||||
To meet the whole system security needs and support virtual machine requesting
|
||||
communication with SDM, only the secure world of software (EL3, Exception
|
||||
Layer 3) can interface with SDM. All software entities running on other
|
||||
exception layers must channel through the EL3 software whenever it needs
|
||||
service from SDM.
|
||||
|
||||
Intel Stratix10 service layer driver, running at privileged exception level
|
||||
(EL1, Exception Layer 1), interfaces with the service providers and provides
|
||||
the services for FPGA configuration, QSPI, Crypto and warm reset. Service layer
|
||||
driver also manages secure monitor call (SMC) to communicate with secure monitor
|
||||
code running in EL3.
|
||||
|
||||
Required properties:
|
||||
-------------------
|
||||
The svc node has the following mandatory properties, must be located under
|
||||
the firmware node.
|
||||
|
||||
- compatible: "intel,stratix10-svc"
|
||||
- method: smc or hvc
|
||||
smc - Secure Monitor Call
|
||||
hvc - Hypervisor Call
|
||||
- memory-region:
|
||||
phandle to the reserved memory node. See
|
||||
Documentation/devicetree/bindings/reserved-memory/reserved-memory.txt
|
||||
for details
|
||||
|
||||
Example:
|
||||
-------
|
||||
|
||||
reserved-memory {
|
||||
#address-cells = <2>;
|
||||
#size-cells = <2>;
|
||||
ranges;
|
||||
|
||||
service_reserved: svcbuffer@0 {
|
||||
compatible = "shared-dma-pool";
|
||||
reg = <0x0 0x0 0x0 0x1000000>;
|
||||
alignment = <0x1000>;
|
||||
no-map;
|
||||
};
|
||||
};
|
||||
|
||||
firmware {
|
||||
svc {
|
||||
compatible = "intel,stratix10-svc";
|
||||
method = "smc";
|
||||
memory-region = <&service_reserved>;
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,17 @@
|
||||
Intel Stratix10 SoC FPGA Manager
|
||||
|
||||
Required properties:
|
||||
The fpga_mgr node has the following mandatory property, must be located under
|
||||
firmware/svc node.
|
||||
|
||||
- compatible : should contain "intel,stratix10-soc-fpga-mgr"
|
||||
|
||||
Example:
|
||||
|
||||
firmware {
|
||||
svc {
|
||||
fpga_mgr: fpga-mgr {
|
||||
compatible = "intel,stratix10-soc-fpga-mgr";
|
||||
};
|
||||
};
|
||||
};
|
||||
@@ -0,0 +1,29 @@
|
||||
* QEMU PVPANIC MMIO Configuration bindings
|
||||
|
||||
QEMU's emulation / virtualization targets provide the following PVPANIC
|
||||
MMIO Configuration interface on the "virt" machine.
|
||||
type:
|
||||
|
||||
- a read-write, 16-bit wide data register.
|
||||
|
||||
QEMU exposes the data register to guests as memory mapped registers.
|
||||
|
||||
Required properties:
|
||||
|
||||
- compatible: "qemu,pvpanic-mmio".
|
||||
- reg: the MMIO region used by the device.
|
||||
* Bytes 0x0 Write panic event to the reg when guest OS panics.
|
||||
* Bytes 0x1 Reserved.
|
||||
|
||||
Example:
|
||||
|
||||
/ {
|
||||
#size-cells = <0x2>;
|
||||
#address-cells = <0x2>;
|
||||
|
||||
pvpanic-mmio@9060000 {
|
||||
compatible = "qemu,pvpanic-mmio";
|
||||
reg = <0x0 0x9060000 0x0 0x2>;
|
||||
};
|
||||
};
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
Required properties:
|
||||
- compatible: should be "amlogic,meson-gxbb-efuse"
|
||||
- clocks: phandle to the efuse peripheral clock provided by the
|
||||
clock controller.
|
||||
|
||||
= Data cells =
|
||||
Are child nodes of eFuse, bindings of which as described in
|
||||
@@ -11,6 +13,7 @@ Example:
|
||||
|
||||
efuse: efuse {
|
||||
compatible = "amlogic,meson-gxbb-efuse";
|
||||
clocks = <&clkc CLKID_EFUSE>;
|
||||
#address-cells = <1>;
|
||||
#size-cells = <1>;
|
||||
|
||||
|
||||
@@ -13,3 +13,33 @@ EDD Interfaces
|
||||
.. kernel-doc:: drivers/firmware/edd.c
|
||||
:internal:
|
||||
|
||||
Intel Stratix10 SoC Service Layer
|
||||
---------------------------------
|
||||
Some features of the Intel Stratix10 SoC require a level of privilege
|
||||
higher than the kernel is granted. Such secure features include
|
||||
FPGA programming. In terms of the ARMv8 architecture, the kernel runs
|
||||
at Exception Level 1 (EL1), access to the features requires
|
||||
Exception Level 3 (EL3).
|
||||
|
||||
The Intel Stratix10 SoC service layer provides an in kernel API for
|
||||
drivers to request access to the secure features. The requests are queued
|
||||
and processed one by one. ARM’s SMCCC is used to pass the execution
|
||||
of the requests on to a secure monitor (EL3).
|
||||
|
||||
.. kernel-doc:: include/linux/firmware/intel/stratix10-svc-client.h
|
||||
:functions: stratix10_svc_command_code
|
||||
|
||||
.. kernel-doc:: include/linux/firmware/intel/stratix10-svc-client.h
|
||||
:functions: stratix10_svc_client_msg
|
||||
|
||||
.. kernel-doc:: include/linux/firmware/intel/stratix10-svc-client.h
|
||||
:functions: stratix10_svc_command_reconfig_payload
|
||||
|
||||
.. kernel-doc:: include/linux/firmware/intel/stratix10-svc-client.h
|
||||
:functions: stratix10_svc_cb_data
|
||||
|
||||
.. kernel-doc:: include/linux/firmware/intel/stratix10-svc-client.h
|
||||
:functions: stratix10_svc_client
|
||||
|
||||
.. kernel-doc:: drivers/firmware/stratix10-svc.c
|
||||
:export:
|
||||
|
||||
@@ -22,3 +22,4 @@ Linux Tracing Technologies
|
||||
hwlat_detector
|
||||
intel_th
|
||||
stm
|
||||
sys-t
|
||||
|
||||
+3
-1
@@ -958,6 +958,7 @@ M: Arve Hjønnevåg <arve@android.com>
|
||||
M: Todd Kjos <tkjos@android.com>
|
||||
M: Martijn Coenen <maco@android.com>
|
||||
M: Joel Fernandes <joel@joelfernandes.org>
|
||||
M: Christian Brauner <christian@brauner.io>
|
||||
T: git git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/staging.git
|
||||
L: devel@driverdev.osuosl.org
|
||||
S: Supported
|
||||
@@ -1442,6 +1443,7 @@ F: arch/arm/mach-ep93xx/micro9.c
|
||||
|
||||
ARM/CORESIGHT FRAMEWORK AND DRIVERS
|
||||
M: Mathieu Poirier <mathieu.poirier@linaro.org>
|
||||
R: Suzuki K Poulose <suzuki.poulose@arm.com>
|
||||
L: linux-arm-kernel@lists.infradead.org (moderated for non-subscribers)
|
||||
S: Maintained
|
||||
F: drivers/hwtracing/coresight/*
|
||||
@@ -16242,7 +16244,7 @@ F: drivers/vme/
|
||||
F: include/linux/vme*
|
||||
|
||||
VMWARE BALLOON DRIVER
|
||||
M: Xavier Deguillard <xdeguillard@vmware.com>
|
||||
M: Julien Freche <jfreche@vmware.com>
|
||||
M: Nadav Amit <namit@vmware.com>
|
||||
M: "VMware, Inc." <pv-drivers@vmware.com>
|
||||
L: linux-kernel@vger.kernel.org
|
||||
|
||||
@@ -24,6 +24,19 @@
|
||||
#address-cells = <2>;
|
||||
#size-cells = <2>;
|
||||
|
||||
reserved-memory {
|
||||
#address-cells = <2>;
|
||||
#size-cells = <2>;
|
||||
ranges;
|
||||
|
||||
service_reserved: svcbuffer@0 {
|
||||
compatible = "shared-dma-pool";
|
||||
reg = <0x0 0x0 0x0 0x1000000>;
|
||||
alignment = <0x1000>;
|
||||
no-map;
|
||||
};
|
||||
};
|
||||
|
||||
cpus {
|
||||
#address-cells = <1>;
|
||||
#size-cells = <0>;
|
||||
@@ -93,6 +106,14 @@
|
||||
interrupt-parent = <&intc>;
|
||||
ranges = <0 0 0 0xffffffff>;
|
||||
|
||||
base_fpga_region {
|
||||
#address-cells = <0x1>;
|
||||
#size-cells = <0x1>;
|
||||
|
||||
compatible = "fpga-region";
|
||||
fpga-mgr = <&fpga_mgr>;
|
||||
};
|
||||
|
||||
clkmgr: clock-controller@ffd10000 {
|
||||
compatible = "intel,stratix10-clkmgr";
|
||||
reg = <0xffd10000 0x1000>;
|
||||
@@ -537,5 +558,17 @@
|
||||
|
||||
status = "disabled";
|
||||
};
|
||||
|
||||
firmware {
|
||||
svc {
|
||||
compatible = "intel,stratix10-svc";
|
||||
method = "smc";
|
||||
memory-region = <&service_reserved>;
|
||||
|
||||
fpga_mgr: fpga-mgr {
|
||||
compatible = "intel,stratix10-soc-fpga-mgr";
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
@@ -24,6 +24,14 @@ static int acpi_data_get_property_array(const struct acpi_device_data *data,
|
||||
acpi_object_type type,
|
||||
const union acpi_object **obj);
|
||||
|
||||
/*
|
||||
* The GUIDs here are made equivalent to each other in order to avoid extra
|
||||
* complexity in the properties handling code, with the caveat that the
|
||||
* kernel will accept certain combinations of GUID and properties that are
|
||||
* not defined without a warning. For instance if any of the properties
|
||||
* from different GUID appear in a property list of another, it will be
|
||||
* accepted by the kernel. Firmware validation tools should catch these.
|
||||
*/
|
||||
static const guid_t prp_guids[] = {
|
||||
/* ACPI _DSD device properties GUID: daffd814-6eba-4d8c-8a91-bc9bbf4aa301 */
|
||||
GUID_INIT(0xdaffd814, 0x6eba, 0x4d8c,
|
||||
@@ -31,6 +39,9 @@ static const guid_t prp_guids[] = {
|
||||
/* Hotplug in D3 GUID: 6211e2c0-58a3-4af3-90e1-927a4e0c55a4 */
|
||||
GUID_INIT(0x6211e2c0, 0x58a3, 0x4af3,
|
||||
0x90, 0xe1, 0x92, 0x7a, 0x4e, 0x0c, 0x55, 0xa4),
|
||||
/* External facing port GUID: efcc06cc-73ac-4bc3-bff0-76143807c389 */
|
||||
GUID_INIT(0xefcc06cc, 0x73ac, 0x4bc3,
|
||||
0xbf, 0xf0, 0x76, 0x14, 0x38, 0x07, 0xc3, 0x89),
|
||||
};
|
||||
|
||||
static const guid_t ads_guid =
|
||||
|
||||
@@ -20,6 +20,18 @@ config ANDROID_BINDER_IPC
|
||||
Android process, using Binder to identify, invoke and pass arguments
|
||||
between said processes.
|
||||
|
||||
config ANDROID_BINDERFS
|
||||
bool "Android Binderfs filesystem"
|
||||
depends on ANDROID_BINDER_IPC
|
||||
default n
|
||||
---help---
|
||||
Binderfs is a pseudo-filesystem for the Android Binder IPC driver
|
||||
which can be mounted per-ipc namespace allowing to run multiple
|
||||
instances of Android.
|
||||
Each binderfs mount initially only contains a binder-control device.
|
||||
It can be used to dynamically allocate new binder IPC devices via
|
||||
ioctls.
|
||||
|
||||
config ANDROID_BINDER_DEVICES
|
||||
string "Android Binder devices"
|
||||
depends on ANDROID_BINDER_IPC
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
ccflags-y += -I$(src) # needed for trace events
|
||||
|
||||
obj-$(CONFIG_ANDROID_BINDERFS) += binderfs.o
|
||||
obj-$(CONFIG_ANDROID_BINDER_IPC) += binder.o binder_alloc.o
|
||||
obj-$(CONFIG_ANDROID_BINDER_IPC_SELFTEST) += binder_alloc_selftest.o
|
||||
|
||||
+131
-51
@@ -72,12 +72,14 @@
|
||||
#include <linux/spinlock.h>
|
||||
#include <linux/ratelimit.h>
|
||||
#include <linux/syscalls.h>
|
||||
#include <linux/task_work.h>
|
||||
|
||||
#include <uapi/linux/android/binder.h>
|
||||
|
||||
#include <asm/cacheflush.h>
|
||||
|
||||
#include "binder_alloc.h"
|
||||
#include "binder_internal.h"
|
||||
#include "binder_trace.h"
|
||||
|
||||
static HLIST_HEAD(binder_deferred_list);
|
||||
@@ -94,22 +96,8 @@ static struct dentry *binder_debugfs_dir_entry_root;
|
||||
static struct dentry *binder_debugfs_dir_entry_proc;
|
||||
static atomic_t binder_last_id;
|
||||
|
||||
#define BINDER_DEBUG_ENTRY(name) \
|
||||
static int binder_##name##_open(struct inode *inode, struct file *file) \
|
||||
{ \
|
||||
return single_open(file, binder_##name##_show, inode->i_private); \
|
||||
} \
|
||||
\
|
||||
static const struct file_operations binder_##name##_fops = { \
|
||||
.owner = THIS_MODULE, \
|
||||
.open = binder_##name##_open, \
|
||||
.read = seq_read, \
|
||||
.llseek = seq_lseek, \
|
||||
.release = single_release, \
|
||||
}
|
||||
|
||||
static int binder_proc_show(struct seq_file *m, void *unused);
|
||||
BINDER_DEBUG_ENTRY(proc);
|
||||
static int proc_show(struct seq_file *m, void *unused);
|
||||
DEFINE_SHOW_ATTRIBUTE(proc);
|
||||
|
||||
/* This is only defined in include/asm-arm/sizes.h */
|
||||
#ifndef SZ_1K
|
||||
@@ -262,20 +250,6 @@ static struct binder_transaction_log_entry *binder_transaction_log_add(
|
||||
return e;
|
||||
}
|
||||
|
||||
struct binder_context {
|
||||
struct binder_node *binder_context_mgr_node;
|
||||
struct mutex context_mgr_node_lock;
|
||||
|
||||
kuid_t binder_context_mgr_uid;
|
||||
const char *name;
|
||||
};
|
||||
|
||||
struct binder_device {
|
||||
struct hlist_node hlist;
|
||||
struct miscdevice miscdev;
|
||||
struct binder_context context;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct binder_work - work enqueued on a worklist
|
||||
* @entry: node enqueued on list
|
||||
@@ -660,6 +634,7 @@ struct binder_transaction {
|
||||
#define binder_proc_lock(proc) _binder_proc_lock(proc, __LINE__)
|
||||
static void
|
||||
_binder_proc_lock(struct binder_proc *proc, int line)
|
||||
__acquires(&proc->outer_lock)
|
||||
{
|
||||
binder_debug(BINDER_DEBUG_SPINLOCKS,
|
||||
"%s: line=%d\n", __func__, line);
|
||||
@@ -675,6 +650,7 @@ _binder_proc_lock(struct binder_proc *proc, int line)
|
||||
#define binder_proc_unlock(_proc) _binder_proc_unlock(_proc, __LINE__)
|
||||
static void
|
||||
_binder_proc_unlock(struct binder_proc *proc, int line)
|
||||
__releases(&proc->outer_lock)
|
||||
{
|
||||
binder_debug(BINDER_DEBUG_SPINLOCKS,
|
||||
"%s: line=%d\n", __func__, line);
|
||||
@@ -690,6 +666,7 @@ _binder_proc_unlock(struct binder_proc *proc, int line)
|
||||
#define binder_inner_proc_lock(proc) _binder_inner_proc_lock(proc, __LINE__)
|
||||
static void
|
||||
_binder_inner_proc_lock(struct binder_proc *proc, int line)
|
||||
__acquires(&proc->inner_lock)
|
||||
{
|
||||
binder_debug(BINDER_DEBUG_SPINLOCKS,
|
||||
"%s: line=%d\n", __func__, line);
|
||||
@@ -705,6 +682,7 @@ _binder_inner_proc_lock(struct binder_proc *proc, int line)
|
||||
#define binder_inner_proc_unlock(proc) _binder_inner_proc_unlock(proc, __LINE__)
|
||||
static void
|
||||
_binder_inner_proc_unlock(struct binder_proc *proc, int line)
|
||||
__releases(&proc->inner_lock)
|
||||
{
|
||||
binder_debug(BINDER_DEBUG_SPINLOCKS,
|
||||
"%s: line=%d\n", __func__, line);
|
||||
@@ -720,6 +698,7 @@ _binder_inner_proc_unlock(struct binder_proc *proc, int line)
|
||||
#define binder_node_lock(node) _binder_node_lock(node, __LINE__)
|
||||
static void
|
||||
_binder_node_lock(struct binder_node *node, int line)
|
||||
__acquires(&node->lock)
|
||||
{
|
||||
binder_debug(BINDER_DEBUG_SPINLOCKS,
|
||||
"%s: line=%d\n", __func__, line);
|
||||
@@ -735,6 +714,7 @@ _binder_node_lock(struct binder_node *node, int line)
|
||||
#define binder_node_unlock(node) _binder_node_unlock(node, __LINE__)
|
||||
static void
|
||||
_binder_node_unlock(struct binder_node *node, int line)
|
||||
__releases(&node->lock)
|
||||
{
|
||||
binder_debug(BINDER_DEBUG_SPINLOCKS,
|
||||
"%s: line=%d\n", __func__, line);
|
||||
@@ -751,12 +731,16 @@ _binder_node_unlock(struct binder_node *node, int line)
|
||||
#define binder_node_inner_lock(node) _binder_node_inner_lock(node, __LINE__)
|
||||
static void
|
||||
_binder_node_inner_lock(struct binder_node *node, int line)
|
||||
__acquires(&node->lock) __acquires(&node->proc->inner_lock)
|
||||
{
|
||||
binder_debug(BINDER_DEBUG_SPINLOCKS,
|
||||
"%s: line=%d\n", __func__, line);
|
||||
spin_lock(&node->lock);
|
||||
if (node->proc)
|
||||
binder_inner_proc_lock(node->proc);
|
||||
else
|
||||
/* annotation for sparse */
|
||||
__acquire(&node->proc->inner_lock);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -768,6 +752,7 @@ _binder_node_inner_lock(struct binder_node *node, int line)
|
||||
#define binder_node_inner_unlock(node) _binder_node_inner_unlock(node, __LINE__)
|
||||
static void
|
||||
_binder_node_inner_unlock(struct binder_node *node, int line)
|
||||
__releases(&node->lock) __releases(&node->proc->inner_lock)
|
||||
{
|
||||
struct binder_proc *proc = node->proc;
|
||||
|
||||
@@ -775,6 +760,9 @@ _binder_node_inner_unlock(struct binder_node *node, int line)
|
||||
"%s: line=%d\n", __func__, line);
|
||||
if (proc)
|
||||
binder_inner_proc_unlock(proc);
|
||||
else
|
||||
/* annotation for sparse */
|
||||
__release(&node->proc->inner_lock);
|
||||
spin_unlock(&node->lock);
|
||||
}
|
||||
|
||||
@@ -1384,10 +1372,14 @@ static void binder_dec_node_tmpref(struct binder_node *node)
|
||||
binder_node_inner_lock(node);
|
||||
if (!node->proc)
|
||||
spin_lock(&binder_dead_nodes_lock);
|
||||
else
|
||||
__acquire(&binder_dead_nodes_lock);
|
||||
node->tmp_refs--;
|
||||
BUG_ON(node->tmp_refs < 0);
|
||||
if (!node->proc)
|
||||
spin_unlock(&binder_dead_nodes_lock);
|
||||
else
|
||||
__release(&binder_dead_nodes_lock);
|
||||
/*
|
||||
* Call binder_dec_node() to check if all refcounts are 0
|
||||
* and cleanup is needed. Calling with strong=0 and internal=1
|
||||
@@ -1890,18 +1882,22 @@ static struct binder_thread *binder_get_txn_from(
|
||||
*/
|
||||
static struct binder_thread *binder_get_txn_from_and_acq_inner(
|
||||
struct binder_transaction *t)
|
||||
__acquires(&t->from->proc->inner_lock)
|
||||
{
|
||||
struct binder_thread *from;
|
||||
|
||||
from = binder_get_txn_from(t);
|
||||
if (!from)
|
||||
if (!from) {
|
||||
__acquire(&from->proc->inner_lock);
|
||||
return NULL;
|
||||
}
|
||||
binder_inner_proc_lock(from->proc);
|
||||
if (t->from) {
|
||||
BUG_ON(from != t->from);
|
||||
return from;
|
||||
}
|
||||
binder_inner_proc_unlock(from->proc);
|
||||
__acquire(&from->proc->inner_lock);
|
||||
binder_thread_dec_tmpref(from);
|
||||
return NULL;
|
||||
}
|
||||
@@ -1973,6 +1969,8 @@ static void binder_send_failed_reply(struct binder_transaction *t,
|
||||
binder_thread_dec_tmpref(target_thread);
|
||||
binder_free_transaction(t);
|
||||
return;
|
||||
} else {
|
||||
__release(&target_thread->proc->inner_lock);
|
||||
}
|
||||
next = t->from_parent;
|
||||
|
||||
@@ -2160,6 +2158,64 @@ static bool binder_validate_fixup(struct binder_buffer *b,
|
||||
return (fixup_offset >= last_min_offset);
|
||||
}
|
||||
|
||||
/**
|
||||
* struct binder_task_work_cb - for deferred close
|
||||
*
|
||||
* @twork: callback_head for task work
|
||||
* @fd: fd to close
|
||||
*
|
||||
* Structure to pass task work to be handled after
|
||||
* returning from binder_ioctl() via task_work_add().
|
||||
*/
|
||||
struct binder_task_work_cb {
|
||||
struct callback_head twork;
|
||||
struct file *file;
|
||||
};
|
||||
|
||||
/**
|
||||
* binder_do_fd_close() - close list of file descriptors
|
||||
* @twork: callback head for task work
|
||||
*
|
||||
* It is not safe to call ksys_close() during the binder_ioctl()
|
||||
* function if there is a chance that binder's own file descriptor
|
||||
* might be closed. This is to meet the requirements for using
|
||||
* fdget() (see comments for __fget_light()). Therefore use
|
||||
* task_work_add() to schedule the close operation once we have
|
||||
* returned from binder_ioctl(). This function is a callback
|
||||
* for that mechanism and does the actual ksys_close() on the
|
||||
* given file descriptor.
|
||||
*/
|
||||
static void binder_do_fd_close(struct callback_head *twork)
|
||||
{
|
||||
struct binder_task_work_cb *twcb = container_of(twork,
|
||||
struct binder_task_work_cb, twork);
|
||||
|
||||
fput(twcb->file);
|
||||
kfree(twcb);
|
||||
}
|
||||
|
||||
/**
|
||||
* binder_deferred_fd_close() - schedule a close for the given file-descriptor
|
||||
* @fd: file-descriptor to close
|
||||
*
|
||||
* See comments in binder_do_fd_close(). This function is used to schedule
|
||||
* a file-descriptor to be closed after returning from binder_ioctl().
|
||||
*/
|
||||
static void binder_deferred_fd_close(int fd)
|
||||
{
|
||||
struct binder_task_work_cb *twcb;
|
||||
|
||||
twcb = kzalloc(sizeof(*twcb), GFP_KERNEL);
|
||||
if (!twcb)
|
||||
return;
|
||||
init_task_work(&twcb->twork, binder_do_fd_close);
|
||||
__close_fd_get_file(fd, &twcb->file);
|
||||
if (twcb->file)
|
||||
task_work_add(current, &twcb->twork, true);
|
||||
else
|
||||
kfree(twcb);
|
||||
}
|
||||
|
||||
static void binder_transaction_buffer_release(struct binder_proc *proc,
|
||||
struct binder_buffer *buffer,
|
||||
binder_size_t *failed_at)
|
||||
@@ -2299,7 +2355,7 @@ static void binder_transaction_buffer_release(struct binder_proc *proc,
|
||||
}
|
||||
fd_array = (u32 *)(parent_buffer + (uintptr_t)fda->parent_offset);
|
||||
for (fd_index = 0; fd_index < fda->num_fds; fd_index++)
|
||||
ksys_close(fd_array[fd_index]);
|
||||
binder_deferred_fd_close(fd_array[fd_index]);
|
||||
} break;
|
||||
default:
|
||||
pr_err("transaction release %d bad object type %x\n",
|
||||
@@ -2394,11 +2450,15 @@ static int binder_translate_handle(struct flat_binder_object *fp,
|
||||
fp->cookie = node->cookie;
|
||||
if (node->proc)
|
||||
binder_inner_proc_lock(node->proc);
|
||||
else
|
||||
__acquire(&node->proc->inner_lock);
|
||||
binder_inc_node_nilocked(node,
|
||||
fp->hdr.type == BINDER_TYPE_BINDER,
|
||||
0, NULL);
|
||||
if (node->proc)
|
||||
binder_inner_proc_unlock(node->proc);
|
||||
else
|
||||
__release(&node->proc->inner_lock);
|
||||
trace_binder_transaction_ref_to_node(t, node, &src_rdata);
|
||||
binder_debug(BINDER_DEBUG_TRANSACTION,
|
||||
" ref %d desc %d -> node %d u%016llx\n",
|
||||
@@ -2762,6 +2822,8 @@ static void binder_transaction(struct binder_proc *proc,
|
||||
binder_set_nice(in_reply_to->saved_priority);
|
||||
target_thread = binder_get_txn_from_and_acq_inner(in_reply_to);
|
||||
if (target_thread == NULL) {
|
||||
/* annotation for sparse */
|
||||
__release(&target_thread->proc->inner_lock);
|
||||
return_error = BR_DEAD_REPLY;
|
||||
return_error_line = __LINE__;
|
||||
goto err_dead_binder;
|
||||
@@ -3912,7 +3974,7 @@ static int binder_apply_fd_fixups(struct binder_transaction *t)
|
||||
} else if (ret) {
|
||||
u32 *fdp = (u32 *)(t->buffer->data + fixup->offset);
|
||||
|
||||
ksys_close(*fdp);
|
||||
binder_deferred_fd_close(*fdp);
|
||||
}
|
||||
list_del(&fixup->fixup_entry);
|
||||
kfree(fixup);
|
||||
@@ -4164,6 +4226,11 @@ retry:
|
||||
if (cmd == BR_DEAD_BINDER)
|
||||
goto done; /* DEAD_BINDER notifications can cause transactions */
|
||||
} break;
|
||||
default:
|
||||
binder_inner_proc_unlock(proc);
|
||||
pr_err("%d:%d: bad work type %d\n",
|
||||
proc->pid, thread->pid, w->type);
|
||||
break;
|
||||
}
|
||||
|
||||
if (!t)
|
||||
@@ -4467,6 +4534,8 @@ static int binder_thread_release(struct binder_proc *proc,
|
||||
spin_lock(&t->lock);
|
||||
if (t->to_thread == thread)
|
||||
send_reply = t;
|
||||
} else {
|
||||
__acquire(&t->lock);
|
||||
}
|
||||
thread->is_dead = true;
|
||||
|
||||
@@ -4495,7 +4564,11 @@ static int binder_thread_release(struct binder_proc *proc,
|
||||
spin_unlock(&last_t->lock);
|
||||
if (t)
|
||||
spin_lock(&t->lock);
|
||||
else
|
||||
__acquire(&t->lock);
|
||||
}
|
||||
/* annotation for sparse, lock not acquired in last iteration above */
|
||||
__release(&t->lock);
|
||||
|
||||
/*
|
||||
* If this thread used poll, make sure we remove the waitqueue
|
||||
@@ -4938,8 +5011,12 @@ static int binder_open(struct inode *nodp, struct file *filp)
|
||||
proc->tsk = current->group_leader;
|
||||
INIT_LIST_HEAD(&proc->todo);
|
||||
proc->default_priority = task_nice(current);
|
||||
binder_dev = container_of(filp->private_data, struct binder_device,
|
||||
miscdev);
|
||||
/* binderfs stashes devices in i_private */
|
||||
if (is_binderfs_device(nodp))
|
||||
binder_dev = nodp->i_private;
|
||||
else
|
||||
binder_dev = container_of(filp->private_data,
|
||||
struct binder_device, miscdev);
|
||||
proc->context = &binder_dev->context;
|
||||
binder_alloc_init(&proc->alloc);
|
||||
|
||||
@@ -4967,7 +5044,7 @@ static int binder_open(struct inode *nodp, struct file *filp)
|
||||
proc->debugfs_entry = debugfs_create_file(strbuf, 0444,
|
||||
binder_debugfs_dir_entry_proc,
|
||||
(void *)(unsigned long)proc->pid,
|
||||
&binder_proc_fops);
|
||||
&proc_fops);
|
||||
}
|
||||
|
||||
return 0;
|
||||
@@ -5391,6 +5468,9 @@ static void print_binder_proc(struct seq_file *m,
|
||||
for (n = rb_first(&proc->nodes); n != NULL; n = rb_next(n)) {
|
||||
struct binder_node *node = rb_entry(n, struct binder_node,
|
||||
rb_node);
|
||||
if (!print_all && !node->has_async_transaction)
|
||||
continue;
|
||||
|
||||
/*
|
||||
* take a temporary reference on the node so it
|
||||
* survives and isn't removed from the tree
|
||||
@@ -5595,7 +5675,7 @@ static void print_binder_proc_stats(struct seq_file *m,
|
||||
}
|
||||
|
||||
|
||||
static int binder_state_show(struct seq_file *m, void *unused)
|
||||
static int state_show(struct seq_file *m, void *unused)
|
||||
{
|
||||
struct binder_proc *proc;
|
||||
struct binder_node *node;
|
||||
@@ -5634,7 +5714,7 @@ static int binder_state_show(struct seq_file *m, void *unused)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int binder_stats_show(struct seq_file *m, void *unused)
|
||||
static int stats_show(struct seq_file *m, void *unused)
|
||||
{
|
||||
struct binder_proc *proc;
|
||||
|
||||
@@ -5650,7 +5730,7 @@ static int binder_stats_show(struct seq_file *m, void *unused)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int binder_transactions_show(struct seq_file *m, void *unused)
|
||||
static int transactions_show(struct seq_file *m, void *unused)
|
||||
{
|
||||
struct binder_proc *proc;
|
||||
|
||||
@@ -5663,7 +5743,7 @@ static int binder_transactions_show(struct seq_file *m, void *unused)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int binder_proc_show(struct seq_file *m, void *unused)
|
||||
static int proc_show(struct seq_file *m, void *unused)
|
||||
{
|
||||
struct binder_proc *itr;
|
||||
int pid = (unsigned long)m->private;
|
||||
@@ -5706,7 +5786,7 @@ static void print_binder_transaction_log_entry(struct seq_file *m,
|
||||
"\n" : " (incomplete)\n");
|
||||
}
|
||||
|
||||
static int binder_transaction_log_show(struct seq_file *m, void *unused)
|
||||
static int transaction_log_show(struct seq_file *m, void *unused)
|
||||
{
|
||||
struct binder_transaction_log *log = m->private;
|
||||
unsigned int log_cur = atomic_read(&log->cur);
|
||||
@@ -5727,7 +5807,7 @@ static int binder_transaction_log_show(struct seq_file *m, void *unused)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static const struct file_operations binder_fops = {
|
||||
const struct file_operations binder_fops = {
|
||||
.owner = THIS_MODULE,
|
||||
.poll = binder_poll,
|
||||
.unlocked_ioctl = binder_ioctl,
|
||||
@@ -5738,10 +5818,10 @@ static const struct file_operations binder_fops = {
|
||||
.release = binder_release,
|
||||
};
|
||||
|
||||
BINDER_DEBUG_ENTRY(state);
|
||||
BINDER_DEBUG_ENTRY(stats);
|
||||
BINDER_DEBUG_ENTRY(transactions);
|
||||
BINDER_DEBUG_ENTRY(transaction_log);
|
||||
DEFINE_SHOW_ATTRIBUTE(state);
|
||||
DEFINE_SHOW_ATTRIBUTE(stats);
|
||||
DEFINE_SHOW_ATTRIBUTE(transactions);
|
||||
DEFINE_SHOW_ATTRIBUTE(transaction_log);
|
||||
|
||||
static int __init init_binder_device(const char *name)
|
||||
{
|
||||
@@ -5795,27 +5875,27 @@ static int __init binder_init(void)
|
||||
0444,
|
||||
binder_debugfs_dir_entry_root,
|
||||
NULL,
|
||||
&binder_state_fops);
|
||||
&state_fops);
|
||||
debugfs_create_file("stats",
|
||||
0444,
|
||||
binder_debugfs_dir_entry_root,
|
||||
NULL,
|
||||
&binder_stats_fops);
|
||||
&stats_fops);
|
||||
debugfs_create_file("transactions",
|
||||
0444,
|
||||
binder_debugfs_dir_entry_root,
|
||||
NULL,
|
||||
&binder_transactions_fops);
|
||||
&transactions_fops);
|
||||
debugfs_create_file("transaction_log",
|
||||
0444,
|
||||
binder_debugfs_dir_entry_root,
|
||||
&binder_transaction_log,
|
||||
&binder_transaction_log_fops);
|
||||
&transaction_log_fops);
|
||||
debugfs_create_file("failed_transaction_log",
|
||||
0444,
|
||||
binder_debugfs_dir_entry_root,
|
||||
&binder_transaction_log_failed,
|
||||
&binder_transaction_log_fops);
|
||||
&transaction_log_fops);
|
||||
}
|
||||
|
||||
/*
|
||||
|
||||
@@ -939,6 +939,7 @@ enum lru_status binder_alloc_free_page(struct list_head *item,
|
||||
struct list_lru_one *lru,
|
||||
spinlock_t *lock,
|
||||
void *cb_arg)
|
||||
__must_hold(lock)
|
||||
{
|
||||
struct mm_struct *mm = NULL;
|
||||
struct binder_lru_page *page = container_of(item,
|
||||
|
||||
@@ -30,16 +30,16 @@ struct binder_transaction;
|
||||
* struct binder_buffer - buffer used for binder transactions
|
||||
* @entry: entry alloc->buffers
|
||||
* @rb_node: node for allocated_buffers/free_buffers rb trees
|
||||
* @free: true if buffer is free
|
||||
* @allow_user_free: describe the second member of struct blah,
|
||||
* @async_transaction: describe the second member of struct blah,
|
||||
* @debug_id: describe the second member of struct blah,
|
||||
* @transaction: describe the second member of struct blah,
|
||||
* @target_node: describe the second member of struct blah,
|
||||
* @data_size: describe the second member of struct blah,
|
||||
* @offsets_size: describe the second member of struct blah,
|
||||
* @extra_buffers_size: describe the second member of struct blah,
|
||||
* @data:i describe the second member of struct blah,
|
||||
* @free: %true if buffer is free
|
||||
* @allow_user_free: %true if user is allowed to free buffer
|
||||
* @async_transaction: %true if buffer is in use for an async txn
|
||||
* @debug_id: unique ID for debugging
|
||||
* @transaction: pointer to associated struct binder_transaction
|
||||
* @target_node: struct binder_node associated with this buffer
|
||||
* @data_size: size of @transaction data
|
||||
* @offsets_size: size of array of offsets
|
||||
* @extra_buffers_size: size of space for other objects (like sg lists)
|
||||
* @data: pointer to base of buffer space
|
||||
*
|
||||
* Bookkeeping structure for binder transaction buffers
|
||||
*/
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
/* SPDX-License-Identifier: GPL-2.0 */
|
||||
|
||||
#ifndef _LINUX_BINDER_INTERNAL_H
|
||||
#define _LINUX_BINDER_INTERNAL_H
|
||||
|
||||
#include <linux/export.h>
|
||||
#include <linux/fs.h>
|
||||
#include <linux/list.h>
|
||||
#include <linux/miscdevice.h>
|
||||
#include <linux/mutex.h>
|
||||
#include <linux/stddef.h>
|
||||
#include <linux/types.h>
|
||||
#include <linux/uidgid.h>
|
||||
|
||||
struct binder_context {
|
||||
struct binder_node *binder_context_mgr_node;
|
||||
struct mutex context_mgr_node_lock;
|
||||
kuid_t binder_context_mgr_uid;
|
||||
const char *name;
|
||||
};
|
||||
|
||||
/**
|
||||
* struct binder_device - information about a binder device node
|
||||
* @hlist: list of binder devices (only used for devices requested via
|
||||
* CONFIG_ANDROID_BINDER_DEVICES)
|
||||
* @miscdev: information about a binder character device node
|
||||
* @context: binder context information
|
||||
* @binderfs_inode: This is the inode of the root dentry of the super block
|
||||
* belonging to a binderfs mount.
|
||||
*/
|
||||
struct binder_device {
|
||||
struct hlist_node hlist;
|
||||
struct miscdevice miscdev;
|
||||
struct binder_context context;
|
||||
struct inode *binderfs_inode;
|
||||
};
|
||||
|
||||
extern const struct file_operations binder_fops;
|
||||
|
||||
#ifdef CONFIG_ANDROID_BINDERFS
|
||||
extern bool is_binderfs_device(const struct inode *inode);
|
||||
#else
|
||||
static inline bool is_binderfs_device(const struct inode *inode)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _LINUX_BINDER_INTERNAL_H */
|
||||
File diff suppressed because it is too large
Load Diff
@@ -5,7 +5,6 @@
|
||||
*/
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/fsl/mc.h>
|
||||
#include <linux/fsl/mc.h>
|
||||
|
||||
#include "fsl-mc-private.h"
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@
|
||||
*/
|
||||
#include <linux/kernel.h>
|
||||
#include <linux/fsl/mc.h>
|
||||
#include <linux/fsl/mc.h>
|
||||
|
||||
#include "fsl-mc-private.h"
|
||||
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user