Skip to content

Commit 416f99c

Browse files
committed
Merge tag 'driver-core-6.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/driver-core/driver-core
Pull driver core updates from Danilo Krummrich: "Arch Topology: - Move parse_acpi_topology() from arm64 to common code for reuse in RISC-V CPU: - Expose housekeeping CPUs through /sys/devices/system/cpu/housekeeping - Print a newline (or 0x0A) instead of '(null)' reading /sys/devices/system/cpu/nohz_full when nohz_full= is not set debugfs - Remove (broken) 'no-mount' mode - Remove redundant access mode checks in debugfs_get_tree() and debugfs_create_*() functions Devres: - Remove unused devm_free_percpu() helper - Move devm_alloc_percpu() from device.h to devres.h Firmware Loader: - Replace simple_strtol() with kstrtoint() - Do not call cancel_store() when no upload is in progress kernfs: - Increase struct super_block::maxbytes to MAX_LFS_FILESIZE - Fix a missing unwind path in __kernfs_new_node() Misc: - Increase the name size in struct auxiliary_device_id to 40 characters - Replace system_unbound_wq with system_dfl_wq and add WQ_PERCPU to alloc_workqueue() Platform: - Replace ERR_PTR() with IOMEM_ERR_PTR() in platform ioremap functions Rust: - Auxiliary: - Unregister auxiliary device on parent device unbind - Move parent() to impl Device; implement device context aware parent() for Device<Bound> - Illustrate how to safely obtain a driver's device private data when calling from an auxiliary driver into the parant device driver - DebugFs: - Implement support for binary large objects - Device: - Let probe() return the driver's device private data as pinned initializer, i.e. impl PinInit<Self, Error> - Implement safe accessor for a driver's device private data for Device<Bound> (returned reference can't out-live driver binding and guarantees the correct private data type) - Implement AsBusDevice trait, to be used by class device abstractions to derive the bus device type of the parent device - DMA: - Store raw pointer of allocation as NonNull - Use start_ptr() and start_ptr_mut() to inherit correct mutability of self - FS: - Add file::Offset type alias - I2C: - Add abstractions for I2C device / driver infrastructure - Implement abstractions for manual I2C device registrations - I/O: - Use "kernel vertical" style for imports - Define ResourceSize as resource_size_t - Move ResourceSize to top-level I/O module - Add type alias for phys_addr_t - Implement Rust version of read_poll_timeout_atomic() - PCI: - Use "kernel vertical" style for imports - Move I/O and IRQ infrastructure to separate files - Add support for PCI interrupt vectors - Implement TryInto<IrqRequest<'a>> for IrqVector<'a> to convert an IrqVector bound to specific pci::Device into an IrqRequest bound to the same pci::Device's parent Device - Leverage pin_init_scope() to get rid of redundant Result in IRQ methods - PinInit: - Add {pin_}init_scope() to execute code before creating an initializer - Platform: - Leverage pin_init_scope() to get rid of redundant Result in IRQ methods - Timekeeping: - Implement abstraction of udelay() - Uaccess: - Implement read_slice_partial() and read_slice_file() for UserSliceReader - Implement write_slice_partial() and write_slice_file() for UserSliceWriter sysfs: - Prepare the constification of struct attribute" * tag 'driver-core-6.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/driver-core/driver-core: (75 commits) rust: pci: fix build failure when CONFIG_PCI_MSI is disabled debugfs: Fix default access mode config check debugfs: Remove broken no-mount mode debugfs: Remove redundant access mode checks driver core: Check drivers_autoprobe for all added devices driver core: WQ_PERCPU added to alloc_workqueue users driver core: replace use of system_unbound_wq with system_dfl_wq tick/nohz: Expose housekeeping CPUs in sysfs tick/nohz: avoid showing '(null)' if nohz_full= not set sysfs/cpu: Use DEVICE_ATTR_RO for nohz_full attribute kernfs: fix memory leak of kernfs_iattrs in __kernfs_new_node fs/kernfs: raise sb->maxbytes to MAX_LFS_FILESIZE mod_devicetable: Bump auxiliary_device_id name size sysfs: simplify attribute definition macros samples/kobject: constify 'struct foo_attribute' samples/kobject: add is_visible() callback to attribute group sysfs: attribute_group: enable const variants of is_visible() sysfs: introduce __SYSFS_FUNCTION_ALTERNATIVE() sysfs: transparently handle const pointers in ATTRIBUTE_GROUPS() sysfs: attribute_group: allow registration of const attribute ...
2 parents b1ae17c + 473b9f3 commit 416f99c

74 files changed

Lines changed: 2880 additions & 708 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

Documentation/ABI/testing/sysfs-devices-system-cpu

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -764,6 +764,17 @@ Description:
764764
participate in load balancing. These CPUs are set by
765765
boot parameter "isolcpus=".
766766

767+
What: /sys/devices/system/cpu/housekeeping
768+
Date: Oct 2025
769+
Contact: Linux kernel mailing list <linux-kernel@vger.kernel.org>
770+
Description:
771+
(RO) the list of logical CPUs that are designated by the kernel as
772+
"housekeeping". Each CPU are responsible for handling essential
773+
system-wide background tasks, including RCU callbacks, delayed
774+
timer callbacks, and unbound workqueues, minimizing scheduling
775+
jitter on low-latency, isolated CPUs. These CPUs are set when boot
776+
parameter "isolcpus=nohz" or "nohz_full=" is specified.
777+
767778
What: /sys/devices/system/cpu/crash_hotplug
768779
Date: Aug 2023
769780
Contact: Linux kernel mailing list <linux-kernel@vger.kernel.org>

Documentation/admin-guide/kernel-parameters.txt

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1211,12 +1211,8 @@ Kernel parameters
12111211

12121212
debugfs= [KNL,EARLY] This parameter enables what is exposed to
12131213
userspace and debugfs internal clients.
1214-
Format: { on, no-mount, off }
1214+
Format: { on, off }
12151215
on: All functions are enabled.
1216-
no-mount:
1217-
Filesystem is not registered but kernel clients can
1218-
access APIs and a crashkernel can be used to read
1219-
its content. There is nothing to mount.
12201216
off: Filesystem is not registered and clients
12211217
get a -EPERM as result when trying to register files
12221218
or directories within debugfs.

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -383,7 +383,6 @@ NET
383383

384384
PER-CPU MEM
385385
devm_alloc_percpu()
386-
devm_free_percpu()
387386

388387
PCI
389388
devm_pci_alloc_host_bridge() : managed PCI host bridge allocation

MAINTAINERS

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11821,6 +11821,16 @@ F: include/linux/i2c.h
1182111821
F: include/uapi/linux/i2c-*.h
1182211822
F: include/uapi/linux/i2c.h
1182311823

11824+
I2C SUBSYSTEM [RUST]
11825+
M: Igor Korotin <igor.korotin.linux@gmail.com>
11826+
R: Danilo Krummrich <dakr@kernel.org>
11827+
R: Daniel Almeida <daniel.almeida@collabora.com>
11828+
L: rust-for-linux@vger.kernel.org
11829+
S: Maintained
11830+
F: rust/kernel/i2c.rs
11831+
F: samples/rust/rust_driver_i2c.rs
11832+
F: samples/rust/rust_i2c_client.rs
11833+
1182411834
I2C SUBSYSTEM HOST DRIVERS
1182511835
M: Andi Shyti <andi.shyti@kernel.org>
1182611836
L: linux-i2c@vger.kernel.org

arch/arm64/include/asm/topology.h

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,9 @@ void update_freq_counters_refs(void);
3636
#define arch_scale_hw_pressure topology_get_hw_pressure
3737
#define arch_update_hw_pressure topology_update_hw_pressure
3838

39+
#undef arch_cpu_is_threaded
40+
#define arch_cpu_is_threaded() (read_cpuid_mpidr() & MPIDR_MT_BITMASK)
41+
3942
#include <asm-generic/topology.h>
4043

4144
#endif /* _ASM_ARM_TOPOLOGY_H */

arch/arm64/kernel/topology.c

Lines changed: 0 additions & 101 deletions
Original file line numberDiff line numberDiff line change
@@ -25,107 +25,6 @@
2525
#include <asm/cputype.h>
2626
#include <asm/topology.h>
2727

28-
#ifdef CONFIG_ACPI
29-
static bool __init acpi_cpu_is_threaded(int cpu)
30-
{
31-
int is_threaded = acpi_pptt_cpu_is_thread(cpu);
32-
33-
/*
34-
* if the PPTT doesn't have thread information, assume a homogeneous
35-
* machine and return the current CPU's thread state.
36-
*/
37-
if (is_threaded < 0)
38-
is_threaded = read_cpuid_mpidr() & MPIDR_MT_BITMASK;
39-
40-
return !!is_threaded;
41-
}
42-
43-
struct cpu_smt_info {
44-
unsigned int thread_num;
45-
int core_id;
46-
};
47-
48-
/*
49-
* Propagate the topology information of the processor_topology_node tree to the
50-
* cpu_topology array.
51-
*/
52-
int __init parse_acpi_topology(void)
53-
{
54-
unsigned int max_smt_thread_num = 1;
55-
struct cpu_smt_info *entry;
56-
struct xarray hetero_cpu;
57-
unsigned long hetero_id;
58-
int cpu, topology_id;
59-
60-
if (acpi_disabled)
61-
return 0;
62-
63-
xa_init(&hetero_cpu);
64-
65-
for_each_possible_cpu(cpu) {
66-
topology_id = find_acpi_cpu_topology(cpu, 0);
67-
if (topology_id < 0)
68-
return topology_id;
69-
70-
if (acpi_cpu_is_threaded(cpu)) {
71-
cpu_topology[cpu].thread_id = topology_id;
72-
topology_id = find_acpi_cpu_topology(cpu, 1);
73-
cpu_topology[cpu].core_id = topology_id;
74-
75-
/*
76-
* In the PPTT, CPUs below a node with the 'identical
77-
* implementation' flag have the same number of threads.
78-
* Count the number of threads for only one CPU (i.e.
79-
* one core_id) among those with the same hetero_id.
80-
* See the comment of find_acpi_cpu_topology_hetero_id()
81-
* for more details.
82-
*
83-
* One entry is created for each node having:
84-
* - the 'identical implementation' flag
85-
* - its parent not having the flag
86-
*/
87-
hetero_id = find_acpi_cpu_topology_hetero_id(cpu);
88-
entry = xa_load(&hetero_cpu, hetero_id);
89-
if (!entry) {
90-
entry = kzalloc(sizeof(*entry), GFP_KERNEL);
91-
WARN_ON_ONCE(!entry);
92-
93-
if (entry) {
94-
entry->core_id = topology_id;
95-
entry->thread_num = 1;
96-
xa_store(&hetero_cpu, hetero_id,
97-
entry, GFP_KERNEL);
98-
}
99-
} else if (entry->core_id == topology_id) {
100-
entry->thread_num++;
101-
}
102-
} else {
103-
cpu_topology[cpu].thread_id = -1;
104-
cpu_topology[cpu].core_id = topology_id;
105-
}
106-
topology_id = find_acpi_cpu_topology_cluster(cpu);
107-
cpu_topology[cpu].cluster_id = topology_id;
108-
topology_id = find_acpi_cpu_topology_package(cpu);
109-
cpu_topology[cpu].package_id = topology_id;
110-
}
111-
112-
/*
113-
* This is a short loop since the number of XArray elements is the
114-
* number of heterogeneous CPU clusters. On a homogeneous system
115-
* there's only one entry in the XArray.
116-
*/
117-
xa_for_each(&hetero_cpu, hetero_id, entry) {
118-
max_smt_thread_num = max(max_smt_thread_num, entry->thread_num);
119-
xa_erase(&hetero_cpu, hetero_id);
120-
kfree(entry);
121-
}
122-
123-
cpu_smt_set_num_threads(max_smt_thread_num, max_smt_thread_num);
124-
xa_destroy(&hetero_cpu);
125-
return 0;
126-
}
127-
#endif
128-
12928
#ifdef CONFIG_ARM64_AMU_EXTN
13029
#define read_corecnt() read_sysreg_s(SYS_AMEVCNTR0_CORE_EL0)
13130
#define read_constcnt() read_sysreg_s(SYS_AMEVCNTR0_CONST_EL0)

drivers/base/arch_topology.c

Lines changed: 95 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -823,12 +823,106 @@ void remove_cpu_topology(unsigned int cpu)
823823
clear_cpu_topology(cpu);
824824
}
825825

826+
#if defined(CONFIG_ARM64) || defined(CONFIG_RISCV)
827+
struct cpu_smt_info {
828+
unsigned int thread_num;
829+
int core_id;
830+
};
831+
832+
static bool __init acpi_cpu_is_threaded(int cpu)
833+
{
834+
int is_threaded = acpi_pptt_cpu_is_thread(cpu);
835+
836+
/*
837+
* if the PPTT doesn't have thread information, check for architecture
838+
* specific fallback if available
839+
*/
840+
if (is_threaded < 0)
841+
is_threaded = arch_cpu_is_threaded();
842+
843+
return !!is_threaded;
844+
}
845+
846+
/*
847+
* Propagate the topology information of the processor_topology_node tree to the
848+
* cpu_topology array.
849+
*/
826850
__weak int __init parse_acpi_topology(void)
827851
{
852+
unsigned int max_smt_thread_num = 1;
853+
struct cpu_smt_info *entry;
854+
struct xarray hetero_cpu;
855+
unsigned long hetero_id;
856+
int cpu, topology_id;
857+
858+
if (acpi_disabled)
859+
return 0;
860+
861+
xa_init(&hetero_cpu);
862+
863+
for_each_possible_cpu(cpu) {
864+
topology_id = find_acpi_cpu_topology(cpu, 0);
865+
if (topology_id < 0)
866+
return topology_id;
867+
868+
if (acpi_cpu_is_threaded(cpu)) {
869+
cpu_topology[cpu].thread_id = topology_id;
870+
topology_id = find_acpi_cpu_topology(cpu, 1);
871+
cpu_topology[cpu].core_id = topology_id;
872+
873+
/*
874+
* In the PPTT, CPUs below a node with the 'identical
875+
* implementation' flag have the same number of threads.
876+
* Count the number of threads for only one CPU (i.e.
877+
* one core_id) among those with the same hetero_id.
878+
* See the comment of find_acpi_cpu_topology_hetero_id()
879+
* for more details.
880+
*
881+
* One entry is created for each node having:
882+
* - the 'identical implementation' flag
883+
* - its parent not having the flag
884+
*/
885+
hetero_id = find_acpi_cpu_topology_hetero_id(cpu);
886+
entry = xa_load(&hetero_cpu, hetero_id);
887+
if (!entry) {
888+
entry = kzalloc(sizeof(*entry), GFP_KERNEL);
889+
WARN_ON_ONCE(!entry);
890+
891+
if (entry) {
892+
entry->core_id = topology_id;
893+
entry->thread_num = 1;
894+
xa_store(&hetero_cpu, hetero_id,
895+
entry, GFP_KERNEL);
896+
}
897+
} else if (entry->core_id == topology_id) {
898+
entry->thread_num++;
899+
}
900+
} else {
901+
cpu_topology[cpu].thread_id = -1;
902+
cpu_topology[cpu].core_id = topology_id;
903+
}
904+
topology_id = find_acpi_cpu_topology_cluster(cpu);
905+
cpu_topology[cpu].cluster_id = topology_id;
906+
topology_id = find_acpi_cpu_topology_package(cpu);
907+
cpu_topology[cpu].package_id = topology_id;
908+
}
909+
910+
/*
911+
* This is a short loop since the number of XArray elements is the
912+
* number of heterogeneous CPU clusters. On a homogeneous system
913+
* there's only one entry in the XArray.
914+
*/
915+
xa_for_each(&hetero_cpu, hetero_id, entry) {
916+
max_smt_thread_num = max(max_smt_thread_num, entry->thread_num);
917+
xa_erase(&hetero_cpu, hetero_id);
918+
kfree(entry);
919+
}
920+
921+
cpu_smt_set_num_threads(max_smt_thread_num, max_smt_thread_num);
922+
xa_destroy(&hetero_cpu);
828923
return 0;
829924
}
830925

831-
#if defined(CONFIG_ARM64) || defined(CONFIG_RISCV)
832926
void __init init_cpu_topology(void)
833927
{
834928
int cpu, ret;

drivers/base/base.h

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,18 @@ struct driver_private {
8585
};
8686
#define to_driver(obj) container_of(obj, struct driver_private, kobj)
8787

88+
#ifdef CONFIG_RUST
89+
/**
90+
* struct driver_type - Representation of a Rust driver type.
91+
*/
92+
struct driver_type {
93+
/**
94+
* @id: Representation of core::any::TypeId.
95+
*/
96+
u8 id[16];
97+
} __packed;
98+
#endif
99+
88100
/**
89101
* struct device_private - structure to hold the private to the driver core portions of the device structure.
90102
*
@@ -100,6 +112,7 @@ struct driver_private {
100112
* @async_driver - pointer to device driver awaiting probe via async_probe
101113
* @device - pointer back to the struct device that this structure is
102114
* associated with.
115+
* @driver_type - The type of the bound Rust driver.
103116
* @dead - This device is currently either in the process of or has been
104117
* removed from the system. Any asynchronous events scheduled for this
105118
* device should exit without taking any action.
@@ -116,6 +129,9 @@ struct device_private {
116129
const struct device_driver *async_driver;
117130
char *deferred_probe_reason;
118131
struct device *device;
132+
#ifdef CONFIG_RUST
133+
struct driver_type driver_type;
134+
#endif
119135
u8 dead:1;
120136
};
121137
#define to_device_private_parent(obj) \

drivers/base/bus.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -533,8 +533,7 @@ void bus_probe_device(struct device *dev)
533533
if (!sp)
534534
return;
535535

536-
if (sp->drivers_autoprobe)
537-
device_initial_probe(dev);
536+
device_initial_probe(dev);
538537

539538
mutex_lock(&sp->mutex);
540539
list_for_each_entry(sif, &sp->interfaces, node)

drivers/base/core.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4138,7 +4138,7 @@ int __init devices_init(void)
41384138
sysfs_dev_char_kobj = kobject_create_and_add("char", dev_kobj);
41394139
if (!sysfs_dev_char_kobj)
41404140
goto char_kobj_err;
4141-
device_link_wq = alloc_workqueue("device_link_wq", 0, 0);
4141+
device_link_wq = alloc_workqueue("device_link_wq", WQ_PERCPU, 0);
41424142
if (!device_link_wq)
41434143
goto wq_err;
41444144

0 commit comments

Comments
 (0)