Skip to content

Commit dd27111

Browse files
committed
Merge tag 'driver-core-5.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core
Pull driver core updates from Greg KH: "Here is the "big" set of changes to the driver core, and some drivers using the changes, for 5.9-rc1. "Biggest" thing in here is the device link exposure in sysfs, to help to tame the madness that is SoC device tree representations and driver interactions with it. Other stuff in here that is interesting is: - device probe log helper so that drivers can report problems in a unified way easier. - devres functions added - DEVICE_ATTR_ADMIN_* macro added to make it harder to write incorrect sysfs file permissions - documentation cleanups - ability for debugfs to be present in the kernel, yet not exposed to userspace. Needed for systems that want it enabled, but do not trust users, so they can still use some kernel functions that were otherwise disabled. - other minor fixes and cleanups The patches outside of drivers/base/ all have acks from the respective subsystem maintainers to go through this tree instead of theirs. All of these have been in linux-next with no reported issues" * tag 'driver-core-5.9-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (39 commits) drm/bridge: lvds-codec: simplify error handling drm/bridge/sii8620: fix resource acquisition error handling driver core: add deferring probe reason to devices_deferred property driver core: add device probe log helper driver core: Avoid binding drivers to dead devices Revert "test_firmware: Test platform fw loading on non-EFI systems" firmware_loader: EFI firmware loader must handle pre-allocated buffer selftest/firmware: Add selftest timeout in settings test_firmware: Test platform fw loading on non-EFI systems driver core: Change delimiter in devlink device's name to "--" debugfs: Add access restriction option tracefs: Remove unnecessary debug_fs checks. driver core: Fix probe_count imbalance in really_probe() kobject: remove unused KOBJ_MAX action driver core: Fix sleeping in invalid context during device link deletion driver core: Add waiting_for_supplier sysfs file for devices driver core: Add state_synced sysfs file for devices that support it driver core: Expose device link details in sysfs driver core: Drop mention of obsolete bus rwsem from kernel-doc debugfs: file: Remove unnecessary cast in kfree() ...
2 parents 1785d11 + 76acb5e commit dd27111

File tree

35 files changed

+945
-254
lines changed

35 files changed

+945
-254
lines changed

Documentation/ABI/testing/sysfs-bus-platform

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,3 +18,13 @@ Description:
1818
devices to opt-out of driver binding using a driver_override
1919
name such as "none". Only a single driver may be specified in
2020
the override, there is no support for parsing delimiters.
21+
22+
What: /sys/bus/platform/devices/.../numa_node
23+
Date: June 2020
24+
Contact: Barry Song <[email protected]>
25+
Description:
26+
This file contains the NUMA node to which the platform device
27+
is attached. It won't be visible if the node is unknown. The
28+
value comes from an ACPI _PXM method or a similar firmware
29+
source. Initial users for this file would be devices like
30+
arm smmu which are populated by arm64 acpi_iort.
Lines changed: 126 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,126 @@
1+
What: /sys/class/devlink/.../
2+
Date: May 2020
3+
Contact: Saravana Kannan <[email protected]>
4+
Description:
5+
Provide a place in sysfs for the device link objects in the
6+
kernel at any given time. The name of a device link directory,
7+
denoted as ... above, is of the form <supplier>--<consumer>
8+
where <supplier> is the supplier device name and <consumer> is
9+
the consumer device name.
10+
11+
What: /sys/class/devlink/.../auto_remove_on
12+
Date: May 2020
13+
Contact: Saravana Kannan <[email protected]>
14+
Description:
15+
This file indicates if the device link will ever be
16+
automatically removed by the driver core when the consumer and
17+
supplier devices themselves are still present.
18+
19+
This will be one of the following strings:
20+
21+
'consumer unbind'
22+
'supplier unbind'
23+
'never'
24+
25+
'consumer unbind' means the device link will be removed when
26+
the consumer's driver is unbound from the consumer device.
27+
28+
'supplier unbind' means the device link will be removed when
29+
the supplier's driver is unbound from the supplier device.
30+
31+
'never' means the device link will not be automatically removed
32+
when as long as the supplier and consumer devices themselves
33+
are still present.
34+
35+
What: /sys/class/devlink/.../consumer
36+
Date: May 2020
37+
Contact: Saravana Kannan <[email protected]>
38+
Description:
39+
This file is a symlink to the consumer device's sysfs directory.
40+
41+
What: /sys/class/devlink/.../runtime_pm
42+
Date: May 2020
43+
Contact: Saravana Kannan <[email protected]>
44+
Description:
45+
This file indicates if the device link has any impact on the
46+
runtime power management behavior of the consumer and supplier
47+
devices. For example: Making sure the supplier doesn't enter
48+
runtime suspend while the consumer is active.
49+
50+
This will be one of the following strings:
51+
52+
'0' - Does not affect runtime power management
53+
'1' - Affects runtime power management
54+
55+
What: /sys/class/devlink/.../status
56+
Date: May 2020
57+
Contact: Saravana Kannan <[email protected]>
58+
Description:
59+
This file indicates the status of the device link. The status
60+
of a device link is affected by whether the supplier and
61+
consumer devices have been bound to their corresponding
62+
drivers. The status of a device link also affects the binding
63+
and unbinding of the supplier and consumer devices with their
64+
drivers and also affects whether the software state of the
65+
supplier device is synced with the hardware state of the
66+
supplier device after boot up.
67+
See also: sysfs-devices-state_synced.
68+
69+
This will be one of the following strings:
70+
71+
'not tracked'
72+
'dormant'
73+
'available'
74+
'consumer probing'
75+
'active'
76+
'supplier unbinding'
77+
'unknown'
78+
79+
'not tracked' means this device link does not track the status
80+
and has no impact on the binding, unbinding and syncing the
81+
hardware and software device state.
82+
83+
'dormant' means the supplier and the consumer devices have not
84+
bound to their driver.
85+
86+
'available' means the supplier has bound to its driver and is
87+
available to supply resources to the consumer device.
88+
89+
'consumer probing' means the consumer device is currently
90+
trying to bind to its driver.
91+
92+
'active' means the supplier and consumer devices have both
93+
bound successfully to their drivers.
94+
95+
'supplier unbinding' means the supplier devices is currently in
96+
the process of unbinding from its driver.
97+
98+
'unknown' means the state of the device link is not any of the
99+
above. If this is ever the value, there's a bug in the kernel.
100+
101+
What: /sys/class/devlink/.../supplier
102+
Date: May 2020
103+
Contact: Saravana Kannan <[email protected]>
104+
Description:
105+
This file is a symlink to the supplier device's sysfs directory.
106+
107+
What: /sys/class/devlink/.../sync_state_only
108+
Date: May 2020
109+
Contact: Saravana Kannan <[email protected]>
110+
Description:
111+
This file indicates if the device link is limited to only
112+
affecting the syncing of the hardware and software state of the
113+
supplier device.
114+
115+
This will be one of the following strings:
116+
117+
'0'
118+
'1' - Affects runtime power management
119+
120+
'0' means the device link can affect other device behaviors
121+
like binding/unbinding, suspend/resume, runtime power
122+
management, etc.
123+
124+
'1' means the device link will only affect the syncing of
125+
hardware and software state of the supplier device after boot
126+
up and doesn't not affect other behaviors of the devices.
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
What: /sys/devices/.../consumer:<consumer>
2+
Date: May 2020
3+
Contact: Saravana Kannan <[email protected]>
4+
Description:
5+
The /sys/devices/.../consumer:<consumer> are symlinks to device
6+
links where this device is the supplier. <consumer> denotes the
7+
name of the consumer in that device link. There can be zero or
8+
more of these symlinks for a given device.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
What: /sys/devices/.../state_synced
2+
Date: May 2020
3+
Contact: Saravana Kannan <[email protected]>
4+
Description:
5+
The /sys/devices/.../state_synced attribute is only present for
6+
devices whose bus types or driver provides the .sync_state()
7+
callback. The number read from it (0 or 1) reflects the value
8+
of the device's 'state_synced' field. A value of 0 means the
9+
.sync_state() callback hasn't been called yet. A value of 1
10+
means the .sync_state() callback has been called.
11+
12+
Generally, if a device has sync_state() support and has some of
13+
the resources it provides enabled at the time the kernel starts
14+
(Eg: enabled by hardware reset or bootloader or anything that
15+
run before the kernel starts), then it'll keep those resources
16+
enabled and in a state that's compatible with the state they
17+
were in at the start of the kernel. The device will stop doing
18+
this only when the sync_state() callback has been called --
19+
which happens only when all its consumer devices are registered
20+
and have probed successfully. Resources that were left disabled
21+
at the time the kernel starts are not affected or limited in
22+
any way by sync_state() callbacks.
23+
24+
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
What: /sys/devices/.../supplier:<supplier>
2+
Date: May 2020
3+
Contact: Saravana Kannan <[email protected]>
4+
Description:
5+
The /sys/devices/.../supplier:<supplier> are symlinks to device
6+
links where this device is the consumer. <supplier> denotes the
7+
name of the supplier in that device link. There can be zero or
8+
more of these symlinks for a given device.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
What: /sys/devices/.../waiting_for_supplier
2+
Date: May 2020
3+
Contact: Saravana Kannan <[email protected]>
4+
Description:
5+
The /sys/devices/.../waiting_for_supplier attribute is only
6+
present when fw_devlink kernel command line option is enabled
7+
and is set to something stricter than "permissive". It is
8+
removed once a device probes successfully (because the
9+
information is no longer relevant). The number read from it (0
10+
or 1) reflects whether the device is waiting for one or more
11+
suppliers to be added and then linked to using device links
12+
before the device can probe.
13+
14+
A value of 0 means the device is not waiting for any suppliers
15+
to be added before it can probe. A value of 1 means the device
16+
is waiting for one or more suppliers to be added before it can
17+
probe.

Documentation/admin-guide/kernel-parameters.txt

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -832,6 +832,21 @@
832832
useful to also enable the page_owner functionality.
833833
on: enable the feature
834834

835+
debugfs= [KNL] This parameter enables what is exposed to userspace
836+
and debugfs internal clients.
837+
Format: { on, no-mount, off }
838+
on: All functions are enabled.
839+
no-mount:
840+
Filesystem is not registered but kernel clients can
841+
access APIs and a crashkernel can be used to read
842+
its content. There is nothing to mount.
843+
off: Filesystem is not registered and clients
844+
get a -EPERM as result when trying to register files
845+
or directories within debugfs.
846+
This is equivalent of the runtime functionality if
847+
debugfs was not enabled in the kernel at all.
848+
Default value is set in build-time with a kernel configuration.
849+
835850
debugpat [X86] Enable PAT debugging
836851

837852
decnet.addr= [HW,NET]

Documentation/driver-api/driver-model/platform.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,7 @@ field to hold additional information.
108108

109109
Embedded systems frequently need one or more clocks for platform devices,
110110
which are normally kept off until they're actively needed (to save power).
111-
System setup also associates those clocks with the device, so that that
111+
System setup also associates those clocks with the device, so that
112112
calls to clk_get(&pdev->dev, clock_name) return them as needed.
113113

114114

drivers/base/base.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,7 @@ struct device_private {
9393
struct klist_node knode_class;
9494
struct list_head deferred_probe;
9595
struct device_driver *async_driver;
96+
char *deferred_probe_reason;
9697
struct device *device;
9798
u8 dead:1;
9899
};
@@ -134,6 +135,8 @@ extern void device_release_driver_internal(struct device *dev,
134135
extern void driver_detach(struct device_driver *drv);
135136
extern int driver_probe_device(struct device_driver *drv, struct device *dev);
136137
extern void driver_deferred_probe_del(struct device *dev);
138+
extern void device_set_deferred_probe_reason(const struct device *dev,
139+
struct va_format *vaf);
137140
static inline int driver_match_device(struct device_driver *drv,
138141
struct device *dev)
139142
{

0 commit comments

Comments
 (0)