x86, amd: family 0x15 L3 cache features
cover x86, amd: family 0x15 L3 cache features
This patch set applies to tip/x86/amd-nb f658bcfb. It enables L3 cache index disable and adds support for L3 cache partitioning on family 0x15 CPUs.
Andreas Herrmann (1):
x86, amd: Normalize compute unit IDs on multi-node processors
Hans Rosenfeld (3):
x86, amd: Enable L3 cache index disable on family 0x15 x86, amd: Extend AMD northbridge caching code to support "Link
Control" devices
x86, amd: Support L3 Cache Partitioning on AMD family 0x15 CPUs
arch/x86/include/asm/amd_nb.h | 4 ++ arch/x86/kernel/amd_nb.c | 69 ++++++++++++++++++++++++++++++- arch/x86/kernel/cpu/amd.c | 8 +++- arch/x86/kernel/cpu/intel_cacheinfo.c | 73 +++++++++++++++++++++++++++----- arch/x86/kernel/smpboot.c | 1 + include/linux/pci_ids.h | 1 + 6 files changed, 140 insertions(+), 16 deletions(-)
PATCH 1/4 x86, amd: Normalize compute unit IDs on multi-node processors
From: Andreas Herrmann <[email protected]>
On multi-node CPUs we don't need the socket wide compute unit ID but the node-wide compute unit ID. Thus we need to normalize the value. This is similar to what we do with cpu_core_id.
A compute unit is then identified by physical_package_id, node_id, and compute_unit_id.
--- arch/x86/kernel/cpu/amd.c | 8 ++++++-- arch/x86/kernel/smpboot.c | 1 + 2 files changed, 7 insertions(+), 2 deletions(-)
arch/x86/kernel/cpu/amd.c +6 -2
@@ -261,7 +261,7 @@ static int __cpuinit nearby_node(int apicid)#ifdef CONFIG_X86_HT static void __cpuinit amd_get_topology (struct cpuinfo_x86 *c) { -u32 nodes; +u32 nodes, cores_per_cu;u8 node_id;int cpu =smp_processor_id ();
@@ -276,6 +276,7 @@ static void __cpuinit amd_get_topology(struct cpuinfo_x86 *c)/* get compute unit information */ smp_num_siblings = ((ebx >>8 ) &3 ) +1 ; c->compute_unit_id = ebx &0xff ; + cores_per_cu = ((ebx >>8 ) &3 ) +1 ; }else if (cpu_has (c,X86_FEATURE_NODEID_MSR )) {u64 value;
@@ -288,15 +289,18 @@ static void __cpuinit amd_get_topology(struct cpuinfo_x86 *c)/* fixup multi-node processor information */ if (nodes >1 ) {u32 cores_per_node; +u32 cus_per_node;set_cpu_cap (c,X86_FEATURE_AMD_DCM ); cores_per_node = c->x86_max_cores / nodes; + cus_per_node = cores_per_node / cores_per_cu;/* store NodeID, use llc_shared_map to store sibling info */ per_cpu (cpu_llc_id, cpu) = node_id;/* core id to be in range from 0 to (cores_per_node - 1) */ - c->cpu_core_id = c->cpu_core_id % cores_per_node; + c->cpu_core_id %= cores_per_node; + c->compute_unit_id %= cus_per_node; } }#endif
arch/x86/kernel/smpboot.c +1 -0
@@ -417,6 +417,7 @@ void __cpuinit set_cpu_sibling_map(int cpu)if (cpu_has (c,X86_FEATURE_TOPOEXT )) {if (c->phys_proc_id == o->phys_proc_id && +per_cpu (cpu_llc_id, cpu) ==per_cpu (cpu_llc_id, i) && c->compute_unit_id == o->compute_unit_id)link_thread_siblings (cpu, i); } else if (c->phys_proc_id == o->phys_proc_id &&
Signature · 1 line
1.5.6.5
PATCH 2/4 x86, amd: Enable L3 cache index disable on family 0x15
In reply to Hans RosenfeldAMD family 0x15 CPUs support L3 cache index disable, so enable it on them.
--- arch/x86/kernel/amd_nb.c | 3 +++ 1 files changed, 3 insertions(+), 0 deletions(-)
arch/x86/kernel/amd_nb.c +3 -0
@@ -78,6 +78,9 @@ int amd_cache_northbridges(void) boot_cpu_data.x86_mask >= 0x1)) amd_northbridges.flags |=AMD_NB_L3_INDEX_DISABLE ; +if (boot_cpu_data.x86 ==0x15 ) + amd_northbridges.flags |=AMD_NB_L3_INDEX_DISABLE ; +return 0 ; }EXPORT_SYMBOL_GPL (amd_cache_northbridges);
Signature · 1 line
1.5.6.5
PATCH 3/4 x86, amd: Extend AMD northbridge caching code to support "Link Control" devices
In reply to Hans Rosenfeld"Link Control" devices (NB function 4) will be used by L3 cache partitioning on family 0x15.
--- arch/x86/include/asm/amd_nb.h | 1 + arch/x86/kernel/amd_nb.c | 11 +++++++++-- include/linux/pci_ids.h | 1 + 3 files changed, 11 insertions(+), 2 deletions(-)
arch/x86/include/asm/amd_nb.h +1 -0
@@ -15,6 +15,7 @@ extern int amd_scan_nodes(void);struct amd_northbridge {struct pci_dev *misc; +struct pci_dev *link; };struct amd_northbridge_info {
arch/x86/kernel/amd_nb.c +9 -2
@@ -20,6 +20,11 @@ struct pci_device_id amd_nb_misc_ids[] = { };EXPORT_SYMBOL (amd_nb_misc_ids); +static struct pci_device_id amd_nb_link_ids[] = { + {PCI_DEVICE (PCI_VENDOR_ID_AMD ,PCI_DEVICE_ID_AMD_15H_NB_LINK ) }, + {} +}; +struct amd_northbridge_info amd_northbridges;EXPORT_SYMBOL (amd_northbridges);
@@ -38,7 +43,7 @@ int amd_cache_northbridges(void) {int i =0 ;struct amd_northbridge *nb; -struct pci_dev *misc; +struct pci_dev *misc, *link;if (amd_nb_num ())return 0 ;
@@ -57,10 +62,12 @@ int amd_cache_northbridges(void) amd_northbridges.nb = nb; amd_northbridges.num = i; - misc =NULL ; + link = misc =NULL ;for (i =0 ; i !=amd_nb_num (); i++) {node_to_amd_nb (i)->misc = misc =next_northbridge (misc, amd_nb_misc_ids); +node_to_amd_nb (i)->link = link = +next_northbridge (link, amd_nb_link_ids); }/* some CPU families (e.g. family 0x11) do not support GART */
include/linux/pci_ids.h +1 -0
@@ -518,6 +518,7 @@#define PCI_DEVICE_ID_AMD_11H_NB_MISC 0x1303#define PCI_DEVICE_ID_AMD_11H_NB_LINK 0x1304#define PCI_DEVICE_ID_AMD_15H_NB_MISC 0x1603 +#define PCI_DEVICE_ID_AMD_15H_NB_LINK 0x1604#define PCI_DEVICE_ID_AMD_LANCE 0x2000#define PCI_DEVICE_ID_AMD_LANCE_HOME 0x2001#define PCI_DEVICE_ID_AMD_SCSI 0x2020
Signature · 1 line
1.5.6.5
PATCH 4/4 x86, amd: Support L3 Cache Partitioning on AMD family 0x15 CPUs
In reply to Hans RosenfeldL3 Cache Partitioning allows selecting which of the 4 L3 subcaches can be used for evictions by the L2 cache of each compute unit. By writing a 4-bit hexadecimal mask into the the sysfs file /sys/devices/system/cpu/\
cpuX/cache/index3/subcaches, the user can set the enabled subcaches for a CPU. The settings are directly read from and written to the hardware, so there is no way to have contradicting settings for two CPUs belonging to the same compute unit. Writing will always overwrite any previous setting for a compute unit.
--- arch/x86/include/asm/amd_nb.h | 3 + arch/x86/kernel/amd_nb.c | 55 +++++++++++++++++++++++++ arch/x86/kernel/cpu/intel_cacheinfo.c | 73 +++++++++++++++++++++++++++----- 3 files changed, 119 insertions(+), 12 deletions(-)
arch/x86/include/asm/amd_nb.h +3 -0
@@ -12,6 +12,8 @@ extern void amd_flush_garts(void);extern int amd_get_nodes (struct bootnode *nodes);extern int amd_numa_init (unsigned long start_pfn,unsigned long end_pfn);extern int amd_scan_nodes (void ); +extern int amd_get_subcaches (int ); +extern int amd_set_subcaches (int ,int );struct amd_northbridge {struct pci_dev *misc;
@@ -27,6 +29,7 @@ extern struct amd_northbridge_info amd_northbridges;#define AMD_NB_GART 0x1#define AMD_NB_L3_INDEX_DISABLE 0x2 +#define AMD_NB_L3_PARTITIONING 0x4#ifdef CONFIG_AMD_NB
arch/x86/kernel/amd_nb.c +55 -0
67 lines not on this page · raw message
arch/x86/kernel/cpu/intel_cacheinfo.c +61 -12
147 lines not on this page · raw message
Signature · 1 line
1.5.6.5