android_kernel_xiaomi_sm8350/drivers/base
Zhang, Yanmin 69dcc99199 [PATCH] Export cpu topology in sysfs
The patch implements cpu topology exportation by sysfs.

Items (attributes) are similar to /proc/cpuinfo.

1) /sys/devices/system/cpu/cpuX/topology/physical_package_id:
	represent the physical package id of  cpu X;
2) /sys/devices/system/cpu/cpuX/topology/core_id:
	represent the cpu core id to cpu X;
3) /sys/devices/system/cpu/cpuX/topology/thread_siblings:
	represent the thread siblings to cpu X in the same core;
4) /sys/devices/system/cpu/cpuX/topology/core_siblings:
	represent the thread siblings to cpu X in the same physical package;

To implement it in an architecture-neutral way, a new source file,
driver/base/topology.c, is to export the 5 attributes.

If one architecture wants to support this feature, it just needs to
implement 4 defines, typically in file include/asm-XXX/topology.h.
The 4 defines are:
#define topology_physical_package_id(cpu)
#define topology_core_id(cpu)
#define topology_thread_siblings(cpu)
#define topology_core_siblings(cpu)

The type of **_id is int.
The type of siblings is cpumask_t.

To be consistent on all architectures, the 4 attributes should have
deafult values if their values are unavailable. Below is the rule.

1) physical_package_id: If cpu has no physical package id, -1 is the
default value.

2) core_id: If cpu doesn't support multi-core, its core id is 0.

3) thread_siblings: Just include itself, if the cpu doesn't support
HT/multi-thread.

4) core_siblings: Just include itself, if the cpu doesn't support
multi-core and HT/Multi-thread.

So be careful when declaring the 4 defines in include/asm-XXX/topology.h.

If an attribute isn't defined on an architecture, it won't be exported.

Thank Nathan, Greg, Andi, Paul and Venki.

The patch provides defines for i386/x86_64/ia64.

Signed-off-by: Zhang, Yanmin <yanmin.zhang@intel.com>
Cc: Ingo Molnar <mingo@elte.hu>
Cc: Nick Piggin <nickpiggin@yahoo.com.au>
Cc: Greg KH <greg@kroah.com>
Signed-off-by: Andrew Morton <akpm@osdl.org>
Signed-off-by: Linus Torvalds <torvalds@osdl.org>
2006-02-03 08:32:09 -08:00
..
power [PATCH] device_shutdown can loop if the driver frees itself 2006-01-13 11:26:12 -08:00
attribute_container.c [PATCH] drivers/base - fix sparse warnings 2005-10-28 09:52:55 -07:00
base.h [PATCH] drivers/base - fix sparse warnings 2005-10-28 09:52:55 -07:00
bus.c [PATCH] Driver core: only all userspace bind/unbind if CONFIG_HOTPLUG is enabled 2006-01-04 16:18:09 -08:00
class.c [PATCH] driver core: replace "hotplug" by "uevent" 2006-01-04 16:18:08 -08:00
core.c [PATCH] DocBook: fix kernel-doc comments 2006-01-10 08:01:53 -08:00
cpu.c [PATCH] kdump: export per cpu crash notes pointer through sysfs (fix) 2006-01-10 08:01:26 -08:00
dd.c [PATCH] Add bus_type probe, remove, shutdown methods. 2006-01-13 11:26:04 -08:00
dmapool.c [PATCH] gfp flags annotations - part 1 2005-10-08 15:00:57 -07:00
driver.c [PATCH] Add bus_type probe, remove, shutdown methods. 2006-01-13 11:26:04 -08:00
firmware_class.c [PATCH] Unlinline a bunch of other functions 2006-01-14 18:27:06 -08:00
firmware.c [PATCH] drivers/base - fix sparse warnings 2005-10-28 09:52:55 -07:00
init.c [PATCH] memory hotplug: sysfs and add/remove functions 2005-10-29 21:40:44 -07:00
Kconfig [PATCH] driver core: replace "hotplug" by "uevent" 2006-01-04 16:18:08 -08:00
Makefile [PATCH] Export cpu topology in sysfs 2006-02-03 08:32:09 -08:00
map.c [PATCH] drivers/base/*: use kzalloc instead of kmalloc+memset 2005-09-13 08:22:27 -07:00
memory.c [PATCH] move capable() to capability.h 2006-01-11 18:42:13 -08:00
node.c [PATCH] VM: add page_state info to per-node meminfo 2005-09-05 00:05:49 -07:00
platform.c [PATCH] platform-device-del typo fix 2006-01-13 11:26:11 -08:00
sys.c [PATCH] fix missing includes 2005-10-30 17:37:32 -08:00
topology.c [PATCH] Export cpu topology in sysfs 2006-02-03 08:32:09 -08:00
transport_class.c [SCSI] fix transport class corner case after rework 2005-08-28 11:14:06 -05:00