diff options
| author | Linus Torvalds <torvalds@linux-foundation.org> | 2014-12-14 19:10:09 -0500 |
|---|---|---|
| committer | Linus Torvalds <torvalds@linux-foundation.org> | 2014-12-14 19:10:09 -0500 |
| commit | e6b5be2be4e30037eb551e0ed09dd97bd00d85d3 (patch) | |
| tree | 88801365987a0dc64d62d47e8a11f3b44691c37f /drivers/base | |
| parent | 37da7bbbe84fe9e8862940d3f9194fd27dce59bb (diff) | |
| parent | f1c488a78d9f1a22cdb15648c15e70fd82ed229a (diff) | |
Merge tag 'driver-core-3.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core
Pull driver core update from Greg KH:
"Here's the set of driver core patches for 3.19-rc1.
They are dominated by the removal of the .owner field in platform
drivers. They touch a lot of files, but they are "simple" changes,
just removing a line in a structure.
Other than that, a few minor driver core and debugfs changes. There
are some ath9k patches coming in through this tree that have been
acked by the wireless maintainers as they relied on the debugfs
changes.
Everything has been in linux-next for a while"
* tag 'driver-core-3.19-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/driver-core: (324 commits)
Revert "ath: ath9k: use debugfs_create_devm_seqfile() helper for seq_file entries"
fs: debugfs: add forward declaration for struct device type
firmware class: Deletion of an unnecessary check before the function call "vunmap"
firmware loader: fix hung task warning dump
devcoredump: provide a one-way disable function
device: Add dev_<level>_once variants
ath: ath9k: use debugfs_create_devm_seqfile() helper for seq_file entries
ath: use seq_file api for ath9k debugfs files
debugfs: add helper function to create device related seq_file
drivers/base: cacheinfo: remove noisy error boot message
Revert "core: platform: add warning if driver has no owner"
drivers: base: support cpu cache information interface to userspace via sysfs
drivers: base: add cpu_device_create to support per-cpu devices
topology: replace custom attribute macros with standard DEVICE_ATTR*
cpumask: factor out show_cpumap into separate helper function
driver core: Fix unbalanced device reference in drivers_probe
driver core: fix race with userland in device_add()
sysfs/kernfs: make read requests on pre-alloc files use the buffer.
sysfs/kernfs: allow attributes to request write buffer be pre-allocated.
fs: sysfs: return EGBIG on write if offset is larger than file size
...
Diffstat (limited to 'drivers/base')
| -rw-r--r-- | drivers/base/Makefile | 2 | ||||
| -rw-r--r-- | drivers/base/bus.c | 8 | ||||
| -rw-r--r-- | drivers/base/cacheinfo.c | 539 | ||||
| -rw-r--r-- | drivers/base/core.c | 38 | ||||
| -rw-r--r-- | drivers/base/cpu.c | 59 | ||||
| -rw-r--r-- | drivers/base/devcoredump.c | 56 | ||||
| -rw-r--r-- | drivers/base/firmware_class.c | 7 | ||||
| -rw-r--r-- | drivers/base/node.c | 14 | ||||
| -rw-r--r-- | drivers/base/platform.c | 22 | ||||
| -rw-r--r-- | drivers/base/topology.c | 71 |
10 files changed, 709 insertions, 107 deletions
diff --git a/drivers/base/Makefile b/drivers/base/Makefile index 53c3fe1aeb29..527d291706e8 100644 --- a/drivers/base/Makefile +++ b/drivers/base/Makefile | |||
| @@ -4,7 +4,7 @@ obj-y := component.o core.o bus.o dd.o syscore.o \ | |||
| 4 | driver.o class.o platform.o \ | 4 | driver.o class.o platform.o \ |
| 5 | cpu.o firmware.o init.o map.o devres.o \ | 5 | cpu.o firmware.o init.o map.o devres.o \ |
| 6 | attribute_container.o transport_class.o \ | 6 | attribute_container.o transport_class.o \ |
| 7 | topology.o container.o property.o | 7 | topology.o container.o property.o cacheinfo.o |
| 8 | obj-$(CONFIG_DEVTMPFS) += devtmpfs.o | 8 | obj-$(CONFIG_DEVTMPFS) += devtmpfs.o |
| 9 | obj-$(CONFIG_DMA_CMA) += dma-contiguous.o | 9 | obj-$(CONFIG_DMA_CMA) += dma-contiguous.o |
| 10 | obj-y += power/ | 10 | obj-y += power/ |
diff --git a/drivers/base/bus.c b/drivers/base/bus.c index 83e910a57563..876bae5ade33 100644 --- a/drivers/base/bus.c +++ b/drivers/base/bus.c | |||
| @@ -254,13 +254,15 @@ static ssize_t store_drivers_probe(struct bus_type *bus, | |||
| 254 | const char *buf, size_t count) | 254 | const char *buf, size_t count) |
| 255 | { | 255 | { |
| 256 | struct device *dev; | 256 | struct device *dev; |
| 257 | int err = -EINVAL; | ||
| 257 | 258 | ||
| 258 | dev = bus_find_device_by_name(bus, NULL, buf); | 259 | dev = bus_find_device_by_name(bus, NULL, buf); |
| 259 | if (!dev) | 260 | if (!dev) |
| 260 | return -ENODEV; | 261 | return -ENODEV; |
| 261 | if (bus_rescan_devices_helper(dev, NULL) != 0) | 262 | if (bus_rescan_devices_helper(dev, NULL) == 0) |
| 262 | return -EINVAL; | 263 | err = count; |
| 263 | return count; | 264 | put_device(dev); |
| 265 | return err; | ||
| 264 | } | 266 | } |
| 265 | 267 | ||
| 266 | static struct device *next_device(struct klist_iter *i) | 268 | static struct device *next_device(struct klist_iter *i) |
diff --git a/drivers/base/cacheinfo.c b/drivers/base/cacheinfo.c new file mode 100644 index 000000000000..6e64563361f0 --- /dev/null +++ b/drivers/base/cacheinfo.c | |||
| @@ -0,0 +1,539 @@ | |||
| 1 | /* | ||
| 2 | * cacheinfo support - processor cache information via sysfs | ||
| 3 | * | ||
| 4 | * Based on arch/x86/kernel/cpu/intel_cacheinfo.c | ||
| 5 | * Author: Sudeep Holla <sudeep.holla@arm.com> | ||
| 6 | * | ||
| 7 | * This program is free software; you can redistribute it and/or modify | ||
| 8 | * it under the terms of the GNU General Public License version 2 as | ||
| 9 | * published by the Free Software Foundation. | ||
| 10 | * | ||
| 11 | * This program is distributed "as is" WITHOUT ANY WARRANTY of any | ||
| 12 | * kind, whether express or implied; without even the implied warranty | ||
| 13 | * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
| 14 | * GNU General Public License for more details. | ||
| 15 | * | ||
| 16 | * You should have received a copy of the GNU General Public License | ||
| 17 | * along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
| 18 | */ | ||
| 19 | #include <linux/bitops.h> | ||
| 20 | #include <linux/cacheinfo.h> | ||
| 21 | #include <linux/compiler.h> | ||
| 22 | #include <linux/cpu.h> | ||
| 23 | #include <linux/device.h> | ||
| 24 | #include <linux/init.h> | ||
| 25 | #include <linux/of.h> | ||
| 26 | #include <linux/sched.h> | ||
| 27 | #include <linux/slab.h> | ||
| 28 | #include <linux/smp.h> | ||
| 29 | #include <linux/sysfs.h> | ||
| 30 | |||
| 31 | /* pointer to per cpu cacheinfo */ | ||
| 32 | static DEFINE_PER_CPU(struct cpu_cacheinfo, ci_cpu_cacheinfo); | ||
| 33 | #define ci_cacheinfo(cpu) (&per_cpu(ci_cpu_cacheinfo, cpu)) | ||
| 34 | #define cache_leaves(cpu) (ci_cacheinfo(cpu)->num_leaves) | ||
| 35 | #define per_cpu_cacheinfo(cpu) (ci_cacheinfo(cpu)->info_list) | ||
| 36 | |||
| 37 | struct cpu_cacheinfo *get_cpu_cacheinfo(unsigned int cpu) | ||
| 38 | { | ||
| 39 | return ci_cacheinfo(cpu); | ||
| 40 | } | ||
| 41 | |||
| 42 | #ifdef CONFIG_OF | ||
| 43 | static int cache_setup_of_node(unsigned int cpu) | ||
| 44 | { | ||
| 45 | struct device_node *np; | ||
| 46 | struct cacheinfo *this_leaf; | ||
| 47 | struct device *cpu_dev = get_cpu_device(cpu); | ||
| 48 | struct cpu_cacheinfo *this_cpu_ci = get_cpu_cacheinfo(cpu); | ||
| 49 | unsigned int index = 0; | ||
| 50 | |||
| 51 | /* skip if of_node is already populated */ | ||
| 52 | if (this_cpu_ci->info_list->of_node) | ||
| 53 | return 0; | ||
| 54 | |||
| 55 | if (!cpu_dev) { | ||
| 56 | pr_err("No cpu device for CPU %d\n", cpu); | ||
| 57 | return -ENODEV; | ||
| 58 | } | ||
| 59 | np = cpu_dev->of_node; | ||
| 60 | if (!np) { | ||
| 61 | pr_err("Failed to find cpu%d device node\n", cpu); | ||
| 62 | return -ENOENT; | ||
| 63 | } | ||
| 64 | |||
| 65 | while (np && index < cache_leaves(cpu)) { | ||
| 66 | this_leaf = this_cpu_ci->info_list + index; | ||
| 67 | if (this_leaf->level != 1) | ||
| 68 | np = of_find_next_cache_node(np); | ||
| 69 | else | ||
| 70 | np = of_node_get(np);/* cpu node itself */ | ||
| 71 | this_leaf->of_node = np; | ||
| 72 | index++; | ||
| 73 | } | ||
| 74 | return 0; | ||
| 75 | } | ||
| 76 | |||
| 77 | static inline bool cache_leaves_are_shared(struct cacheinfo *this_leaf, | ||
| 78 | struct cacheinfo *sib_leaf) | ||
| 79 | { | ||
| 80 | return sib_leaf->of_node == this_leaf->of_node; | ||
| 81 | } | ||
| 82 | #else | ||
| 83 | static inline int cache_setup_of_node(unsigned int cpu) { return 0; } | ||
| 84 | static inline bool cache_leaves_are_shared(struct cacheinfo *this_leaf, | ||
| 85 | struct cacheinfo *sib_leaf) | ||
| 86 | { | ||
| 87 | /* | ||
| 88 | * For non-DT systems, assume unique level 1 cache, system-wide | ||
| 89 | * shared caches for all other levels. This will be used only if | ||
| 90 | * arch specific code has not populated shared_cpu_map | ||
| 91 | */ | ||
| 92 | return !(this_leaf->level == 1); | ||
| 93 | } | ||
| 94 | #endif | ||
| 95 | |||
| 96 | static int cache_shared_cpu_map_setup(unsigned int cpu) | ||
| 97 | { | ||
| 98 | struct cpu_cacheinfo *this_cpu_ci = get_cpu_cacheinfo(cpu); | ||
| 99 | struct cacheinfo *this_leaf, *sib_leaf; | ||
| 100 | unsigned int index; | ||
| 101 | int ret; | ||
| 102 | |||
| 103 | ret = cache_setup_of_node(cpu); | ||
| 104 | if (ret) | ||
| 105 | return ret; | ||
| 106 | |||
| 107 | for (index = 0; index < cache_leaves(cpu); index++) { | ||
| 108 | unsigned int i; | ||
| 109 | |||
| 110 | this_leaf = this_cpu_ci->info_list + index; | ||
| 111 | /* skip if shared_cpu_map is already populated */ | ||
| 112 | if (!cpumask_empty(&this_leaf->shared_cpu_map)) | ||
| 113 | continue; | ||
| 114 | |||
| 115 | cpumask_set_cpu(cpu, &this_leaf->shared_cpu_map); | ||
| 116 | for_each_online_cpu(i) { | ||
| 117 | struct cpu_cacheinfo *sib_cpu_ci = get_cpu_cacheinfo(i); | ||
| 118 | |||
| 119 | if (i == cpu || !sib_cpu_ci->info_list) | ||
| 120 | continue;/* skip if itself or no cacheinfo */ | ||
| 121 | sib_leaf = sib_cpu_ci->info_list + index; | ||
| 122 | if (cache_leaves_are_shared(this_leaf, sib_leaf)) { | ||
| 123 | cpumask_set_cpu(cpu, &sib_leaf->shared_cpu_map); | ||
| 124 | cpumask_set_cpu(i, &this_leaf->shared_cpu_map); | ||
| 125 | } | ||
| 126 | } | ||
| 127 | } | ||
| 128 | |||
| 129 | return 0; | ||
| 130 | } | ||
| 131 | |||
| 132 | static void cache_shared_cpu_map_remove(unsigned int cpu) | ||
| 133 | { | ||
| 134 | struct cpu_cacheinfo *this_cpu_ci = get_cpu_cacheinfo(cpu); | ||
| 135 | struct cacheinfo *this_leaf, *sib_leaf; | ||
