Add Numachip APIC support
PATCH 1/3 Add Numachip APIC support
Add support for Numascale's NumaChip APIC mapping mechanism to allow booting more than ~168 cores.
v2:
- [Steffen] enumerate only accessible northbridges
- [Daniel] rediffed and validated against 3.1-rc10
--- arch/x86/Kconfig | 12 + arch/x86/include/asm/numachip/numachip.h | 29 +++ arch/x86/include/asm/numachip/numachip_csr.h | 173 +++++++++++++ arch/x86/kernel/apic/Makefile | 1 + arch/x86/kernel/apic/apic_numachip.c | 332 ++++++++++++++++++++++++++ arch/x86/kernel/cpu/intel_cacheinfo.c | 4 + arch/x86/kernel/smpboot.c | 6 +- 7 files changed, 556 insertions(+), 1 deletions(-) create mode 100644 arch/x86/include/asm/numachip/numachip.h create mode 100644 arch/x86/include/asm/numachip/numachip_csr.h create mode 100644 arch/x86/kernel/apic/apic_numachip.c
arch/x86/Kconfig +12 -0
@@ -344,6 +344,7 @@ config X86_EXTENDED_PLATFORM If you enable this option then you'll be able to select support for the following (non-PC) 64 bit x86 platforms: + Numascale NumaChip ScaleMP vSMP SGI Ultraviolet
@@ -352,6 +353,17 @@ config X86_EXTENDED_PLATFORM endif # This is an alphabetically sorted list of 64 bit extended platforms # Please maintain the alphabetic order if and when there are additions +config X86_NUMACHIP + bool "Numascale NumaChip" + depends on X86_64 + depends on X86_EXTENDED_PLATFORM + depends on NUMA + depends on X86_X2APIC + depends on !EDAC_AMD64 + ---help--- + Adds support for Numascale NumaChip large-SMP systems. Needed to + enable more than ~168 cores. + If you don't have one of these, you should say N here. config X86_VSMP bool "ScaleMP vSMP"
arch/x86/include/asm/numachip/numachip.h new file +29 -0
@@ -0,0 +1,29 @@ +/* +* This file is subject to the terms and conditions of the GNU General Public +* License. See the file "COPYING" in the main directory of this archive +* for more details. +* +* Numascale NumaConnect-Specific Header file +* +* Copyright (C) 2011 Numascale AS. All rights reserved. +* +* Send feedback to <[email protected]> +* +*/ + +#ifndef _ASM_X86_NUMACHIP_NUMACHIP_H +#define _ASM_X86_NUMACHIP_NUMACHIP_H + +#ifdef CONFIG_X86_NUMACHIP + +extern int is_numachip_system (void ); +extern void numachip_system_init (void ); + +#else /* X86_NUMACHIP */ + +static inline int is_numachip_system (void ) {return 0 ; } +static inline void numachip_system_init (void ) { } + +#endif /* X86_NUMACHIP */ + +#endif /* _ASM_X86_NUMACHIP_NUMACHIP_H */
arch/x86/include/asm/numachip/numachip_csr.h new file +173 -0
173 lines not on this page · raw message
arch/x86/kernel/apic/Makefile +1 -0
@@ -10,6 +10,7 @@ obj-$(CONFIG_SMP) += ipi.o ifeq ($(CONFIG_X86_64),y) # APIC probe will depend on the listing order here +obj-$(CONFIG_X86_NUMACHIP) += apic_numachip.o obj-$(CONFIG_X86_UV) += x2apic_uv_x.o obj-$(CONFIG_X86_X2APIC) += x2apic_phys.o obj-$(CONFIG_X86_X2APIC) += x2apic_cluster.o
arch/x86/kernel/apic/apic_numachip.c new file +332 -0
332 lines not on this page · raw message
arch/x86/kernel/cpu/intel_cacheinfo.c +4 -0
@@ -354,6 +354,10 @@ static void __cpuinit amd_init_l3_cache(struct _cpuid4_info_regs *this_leaf, node =amd_get_nb_id (smp_processor_id ()); +/* sanity check, in case we haven't allocated enough */ +if (node >=amd_nb_num ()) +return ; +if (!l3_caches[node].nb) { l3_caches[node].nb =node_to_amd_nb (node);amd_calc_l3_indices (&l3_caches[node]);
arch/x86/kernel/smpboot.c +5 -1
@@ -66,6 +66,7 @@#include <asm/apic.h> #include <asm/io_apic.h> #include <asm/setup.h> +#include <asm/numachip/numachip.h> #include <asm/uv/uv.h> #include <linux/mc146818rtc.h>
@@ -513,7 +514,7 @@ wakeup_secondary_cpu_via_nmi(int logical_apicid, unsigned long start_eip)return (send_status | accept_status); } -static int __cpuinit +int __cpuinit wakeup_secondary_cpu_via_init (int phys_apicid,unsigned long start_eip) {unsigned long send_status, accept_status =0 ;
@@ -1094,6 +1095,9 @@ void __init native_smp_prepare_cpus(unsigned int max_cpus)print_cpu_info (&cpu_data (0 )); x86_init.timers.setup_percpu_clockev (); +if (is_numachip_system ()) +numachip_system_init (); +if (is_uv_system ())uv_system_init ();
Signature · 1 line
1.7.5.4
PATCH 2/3 Add multi-node boot support
Fix booting multi-node systems with Numascale's NumaChip.
v2:
- [Daniel] rediffed and validated against 3.1-rc10
--- arch/x86/kernel/cpu/amd.c | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-)
arch/x86/kernel/cpu/amd.c +7 -0
@@ -7,6 +7,7 @@#include <asm/apic.h> #include <asm/cpu.h> #include <asm/pci-direct.h> +#include <asm/numachip/numachip.h> #ifdef CONFIG_X86_64 # include <asm/numa_64.h>
@@ -350,6 +351,12 @@ static void __cpuinit srat_detect_node(struct cpuinfo_x86 *c) node =numa_cpu_node (cpu);if (node ==NUMA_NO_NODE ) node =per_cpu (cpu_llc_id, cpu); +else if (is_numachip_system ()) { +/* fix for multi-node systems: set phys_proc_id and cpu_llc_id +to node number from ACPI SRAT table */ + c->phys_proc_id = node; +per_cpu (cpu_llc_id, cpu) = node; + }if (!node_online (node)) {/*
Signature · 1 line
1.7.5.4
PATCH 3/3 Add NumaChip quirk
In reply to Daniel J BluemanAdd quirk for Numascale's NumaChip to prevent resource conflicts.
v2:
- [Daniel] rediffed and validated against 3.1-rc10
--- drivers/pci/quirks.c | 14 ++++++++++++++ include/linux/pci_ids.h | 4 ++++ 2 files changed, 18 insertions(+), 0 deletions(-)
drivers/pci/quirks.c +14 -0
@@ -2679,6 +2679,20 @@ static void __devinit quirk_hotplug_bridge(struct pci_dev *dev)DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_HINT ,0x0020 , quirk_hotplug_bridge); +/* Clear all resources on NumaChip to avoid conflicts */ +static void __devinit numachip_resource_fixup (struct pci_dev *pdev) +{ +int i; + +for (i =PCI_STD_RESOURCES ; i <=PCI_ROM_RESOURCE ; i++) +memset (&pdev->resource[i],0 ,sizeof (pdev->resource[i])); + +dev_notice (&pdev->dev,"Disabled all PCI resources for NumaChip\n" ); +} + +DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_NUMASCALE , +PCI_DEVICE_ID_NUMASCALE_NUMACHIP0 , numachip_resource_fixup); +/* * This is a quirk for the Ricoh MMC controller found as a part of * some mulifunction chips.
include/linux/pci_ids.h +4 -0
@@ -2400,6 +2400,10 @@#define PCI_VENDOR_ID_AZWAVE 0x1a3b +#define PCI_VENDOR_ID_NUMASCALE 0x1b47 +#define PCI_DEVICE_ID_NUMASCALE_NUMACHIP0 0x0601 +#define PCI_DEVICE_ID_NUMASCALE_NUMACHIP1 0x0602 +#define PCI_VENDOR_ID_TEKRAM 0x1de1#define PCI_DEVICE_ID_TEKRAM_DC290 0xdc29
Signature · 1 line
1.7.5.4
Re: [PATCH 3/3] Add NumaChip quirk
Daniel,
Quoted 6 lines · Daniel J Blueman
Add quirk for Numascale's NumaChip to prevent resource conflicts.
v2:
- [Daniel] rediffed and validated against 3.1-rc10Signed-off-by Steffen Persvold <[email protected]>
So, who wrote that code? If Steffen, then you should put a From:
.... when sending patches.
Quoted 5 lines
Signed-off-by Daniel J Blueman <[email protected]>--- drivers/pci/quirks.c | 14 ++++++++++++++ include/linux/pci_ids.h | 4 ++++ 2 files changed, 18 insertions(+), 0 deletions(-)
Jesse,
can you take that or should I push it through x86 ?
Thanks,
tglx
Quoted 44 lines
drivers/pci/quirks.c +14
-0@@ -2679,6 +2679,20 @@ static void __devinit quirk_hotplug_bridge(struct pci_dev *dev)DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_HINT ,0x0020 , quirk_hotplug_bridge); +/* Clear all resources on NumaChip to avoid conflicts */ +static void __devinit numachip_resource_fixup (struct pci_dev *pdev) +{ +int i; + +for (i =PCI_STD_RESOURCES ; i <=PCI_ROM_RESOURCE ; i++) +memset (&pdev->resource[i],0 ,sizeof (pdev->resource[i])); + +dev_notice (&pdev->dev,"Disabled all PCI resources for NumaChip\n" ); +} + +DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_NUMASCALE , +PCI_DEVICE_ID_NUMASCALE_NUMACHIP0 , numachip_resource_fixup); +/* * This is a quirk for the Ricoh MMC controller found as a part of * some mulifunction chips. include/linux/pci_ids.h +4
-0@@ -2400,6 +2400,10 @@#define PCI_VENDOR_ID_AZWAVE 0x1a3b +#define PCI_VENDOR_ID_NUMASCALE 0x1b47 +#define PCI_DEVICE_ID_NUMASCALE_NUMACHIP0 0x0601 +#define PCI_DEVICE_ID_NUMASCALE_NUMACHIP1 0x0602 +#define PCI_VENDOR_ID_TEKRAM 0x1de1#define PCI_DEVICE_ID_TEKRAM_DC290 0xdc29Signature · 1 line
1.7.5.4
Re: [PATCH 3/3] Add NumaChip quirk
Quoted 20 lines · On Tue, 25 Oct 2011 15:54:29 +0200 (CEST) Thomas Gleixner <[email protected]>…
Daniel,
Quoted 6 lines · Daniel J Blueman
Add quirk for Numascale's NumaChip to prevent resource conflicts.
v2:
- [Daniel] rediffed and validated against 3.1-rc10Signed-off-by Steffen Persvold <[email protected]>So, who wrote that code? If Steffen, then you should put a From:
.... when sending patches.Quoted 5 lines
Signed-off-by Daniel J Blueman <[email protected]>--- drivers/pci/quirks.c | 14 ++++++++++++++ include/linux/pci_ids.h | 4 ++++ 2 files changed, 18 insertions(+), 0 deletions(-)
Quoted 3 lines
Jesse,
can you take that or should I push it through x86 ?
I can pull it in.
Thanks,
Jesse
Re: [PATCH 3/3] Add NumaChip quirk
In reply to Thomas GleixnerQuoted 4 lines · Thomas Gleixner
Daniel,
On Tue, 18 Oct 2011, Daniel J Blueman wrote:
Quoted 8 lines
Quoted 6 lines
Add quirk for Numascale's NumaChip to prevent resource conflicts.
v2:
- [Daniel] rediffed and validated against 3.1-rc10Signed-off-by Steffen Persvold<[email protected]>So, who wrote that code? If Steffen, then you should put a From:
.... when sending patches.
Steffen wrote the code; I reviewed and addressed compliance issues (hence the Signed-off-by ordering).
I'll add the From header and send the patches again.
Thanks Thomas,
Daniel
Signature · 2 lines
Daniel J Blueman Principal Software Engineer, Numascale Asia
Bjorn Helgaas
maintainerRe: [PATCH 3/3] Add NumaChip quirk
In reply to Daniel J BluemanQuoted 23 lines · Daniel J Blueman
Add quirk for Numascale's NumaChip to prevent resource conflicts.
v2:
- [Daniel] rediffed and validated against 3.1-rc10Signed-off-by Steffen Persvold <[email protected]>Signed-off-by Daniel J Blueman <[email protected]>---
drivers/pci/quirks.c | 14 ++++++++++++++
include/linux/pci_ids.h | 4 ++++2 files changed, 18 insertions(+), 0 deletions(-)drivers/pci/quirks.c +3
-0@@ -2679,6 +2679,20 @@ static void __devinit quirk_hotplug_bridge(struct pci_dev *dev) DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_HINT, 0x0020, quirk_hotplug_bridge); +/* Clear all resources on NumaChip to avoid conflicts */ +static void __devinit numachip_resource_fixup (struct pci_dev *pdev) +{
drivers/pci/quirks.c static void __devinit quirk_hotplug_bridge(struct pci_dev *dev) · line 2694
Quoted 10 lines
drivers/pci/quirks.c +10
-0+ int i; + + for (i = PCI_STD_RESOURCES; i <= PCI_ROM_RESOURCE; i++) + memset(&pdev->resource[i], 0, sizeof(pdev->resource[i])); + + dev_notice(&pdev->dev, "Disabled all PCI resources for NumaChip\n"); +} + +DECLARE_PCI_FIXUP_HEADER (PCI_VENDOR_ID_NUMASCALE , + PCI_DEVICE_ID_NUMASCALE_NUMACHIP0, numachip_resource_fixup);
This feels like a band-aid ... what's the background here? I can see that you're disabling PCI resources, and I can read that this avoids conflicts, but what's the underlying cause of the conflict?
I wonder if there's a more generic problem that should be fixed differently. Presumably the NumaChip designers put those BARs there for a reason, and often when we report "conflicts," it's really a clue that we're doing something wrong in host bridge discovery or in generic PCI.
Can you post a complete dmesg log showing the conflict?
Bjorn
Re: [PATCH 3/3] Add NumaChip quirk
Quoted 3 lines · Bjorn Helgaas
Quoted 1 line · Daniel J Blueman
Add quirk for Numascale's NumaChip to prevent resource conflicts.
[]
Quoted 4 lines
This feels like a band-aid ... what's the background here? I can see that you're disabling PCI resources, and I can read that this avoids conflicts, but what's the underlying cause of the conflict?
Quoted 8 lines
I wonder if there's a more generic problem that should be fixed differently. Presumably the NumaChip designers put those BARs there for a reason, and often when we report "conflicts," it's really a clue that we're doing something wrong in host bridge discovery or in generic PCI.
Can you post a complete dmesg log showing the conflict?
Hi Bjorn,
The issue is a bit complicated, but here's the story; NumaChip is a coherent NorthBridge device on AMD systems (i.e part of the coherent fabric) but the BIOS does *not* assign any resources to it, in fact the BIOS skips our device entirely leaving our BAR registers at HW init values (0x00000000). This is in fact by design (AMD AGESA code). This isn't really a big issue for us anyway because we have other means of reaching our CSR logic (not going into detail, but the other patches in this patchset would reveal how we do that).
Linux however, when scanning the PCI buses finds our device (because it is responding to config space requests) it thinks that we got a BAR0 that starts at 0x00000000 which obviously isn't correct. In addition, in the bootloader that we've written for NumaChip systems (to bring them all together as a huge coherent system) we had to use the expansion rom config space register (F0x030) as kind of a "scratch register".
The end result is :
[ 4.636297] pci 0000:00:1a.0: reg 10: [mem 0x00000000-0x000fffff] [ 4.640317] pci 0000:00:1a.0: reg 30: [mem 0x3fff0000-0x3fffffff pref] [ 4.644369] pci 0000:00:1a.1: [1b47:0602] type 0 class 0x000600
Neither of these resources are real, our device will not respond to requests to any of those windows.
The conflict we refer to in the patch is that since Linux thinks we have those windows assigned to us, we get conflicts later on with real devices :
[ 5.887856] pnp 00:0e: disabling [mem 0x00000000-0x0009ffff] because it overlaps 0000:00:1a.0 BAR 0 [mem 0x00000000-0x000fffff] [ 5.899525] pnp 00:0e: disabling [mem 0x000c0000-0x000cffff] because it overlaps 0000:00:1a.0 BAR 0 [mem 0x00000000-0x000fffff] [ 5.911002] pnp 00:0e: disabling [mem 0x000e0000-0x000fffff] because it overlaps 0000:00:1a.0 BAR 0 [mem 0x00000000-0x000fffff]
I guess technically, the Linux PCI bus probing code should check the Command register (offset 0x4) to see if MemorySpace is enabled (which in our case it won't be) before checking the BAR registers.
From my perspective however, it seemed easier and less intrusive to just hook in a quirk for our device since we do not use those BAR settings anyway in any form once Linux is booted.
I hope this clear things up a bit. If you have any other questions don't hesitate to ask.
Kind regards,
Signature · 3 lines
Steffen Persvold, Chief Architect NumaChip Numascale AS - www.numascale.com Tel: +47 92 49 25 54 Skype: spersvold
Bjorn Helgaas
maintainerRe: [PATCH 3/3] Add NumaChip quirk
[+cc linux-pci]
Quoted 33 lines · Steffen Persvold
Quoted 5 lines · Bjorn Helgaas
Quoted 2 lines · Daniel J Blueman
Add quirk for Numascale's NumaChip to prevent resource conflicts.
[]
Quoted 5 lines
This feels like a band-aid ... what's the background here? I can see that you're disabling PCI resources, and I can read that this avoids conflicts, but what's the underlying cause of the conflict?
Quoted 8 lines
I wonder if there's a more generic problem that should be fixed differently. Presumably the NumaChip designers put those BARs there for a reason, and often when we report "conflicts," it's really a clue that we're doing something wrong in host bridge discovery or in generic PCI.
Can you post a complete dmesg log showing the conflict?
Hi Bjorn,
The issue is a bit complicated, but here's the story; NumaChip is a coherent NorthBridge device on AMD systems (i.e part of the coherent fabric) but the BIOS does *not* assign any resources to it, in fact the BIOS skips our device entirely leaving our BAR registers at HW init values (
0x00000000). This is in fact by design (AMD AGESA code). This isn't really a big issue for us anyway because we have other means of reaching our CSR logic (not going into detail, but the other patches in this patchset would reveal how we do that).
Quoted 6 lines
Linux however, when scanning the PCI buses finds our device (because it is responding to config space requests) it thinks that we got a BAR0 that starts at
0x00000000which obviously isn't correct. In addition, in the bootloader that we've written for NumaChip systems (to bring them all together as a huge coherent system) we had to use the expansion rom config space register (F0x030) as kind of a "scratch register".
We do treat zero as a special value when found in BARs, but that's sort of a muddy area. On x86, a zero-valued BAR is not very useful because typically there's RAM at address zero and PCI host bridges don't usually perform address translation. But on architectures like ia64/alpha/parisc/powerpc/etc., where host bridges often *do* translate addresses, zero might be a perfectly valid BAR value.
Quoted 12 lines
The end result is :
[ 4.636297] pci 0000:00:1a.0: reg 10: [mem 0x00000000-0x000fffff] [ 4.640317] pci 0000:00:1a.0: reg 30: [mem 0x3fff0000-0x3fffffff pref] [ 4.644369] pci 0000:00:1a.1: [1b47:0602] type 0 class
0x000600Neither of these resources are real, our device will not respond to requests to any of those windows.
The conflict we refer to in the patch is that since Linux thinks we have those windows assigned to us, we get conflicts later on with real devices :
Quoted 6 lines
[ 5.887856] pnp 00:0e: disabling [mem 0x00000000-0x0009ffff] because it overlaps 0000:00:1a.0 BAR 0 [mem 0x00000000-0x000fffff]
[ 5.899525] pnp 00:0e: disabling [mem 0x000c0000-0x000cffff] because it overlaps 0000:00:1a.0 BAR 0 [mem 0x00000000-0x000fffff]
[ 5.911002] pnp 00:0e: disabling [mem 0x000e0000-0x000fffff] because it overlaps 0000:00:1a.0 BAR 0 [mem 0x00000000-0x000fffff]
Yeah, this is gross, and this is definitely something Linux is doing wrong. We don't have a consistent way of marking PCI BARs as "disabled," so every zero-valued BAR seems to conflict with PNP devices. Typically there are motherboard devices like your 00:0e that reserve regions of low memory.
Lots of machines complain like this, not just NumaChip, and there's no real ill effect. We say we're disabling a PNP device resource, but we don't actually evaluate an _SRS method to tell the BIOS to do anything. So I think we complain about the conflict but don't do anything else.
Quoted 3 lines
I guess technically, the Linux PCI bus probing code should check the Command register (offset
0x4) to see if MemorySpace is enabled (which in our case it won't be) before checking the BAR registers.
The question is how we handle a device with MemorySpace disabled. In most cases, I think we want to assign BAR resources to it so that if a driver claims the device, we can enable MemorySpace and the device will work. If the BIOS leaves MemorySpace disabled and Linux doesn't assign BAR space at boot-time, we may be stuck because in general we can't assign resources dynamically. Dynamic assignment might require moving other devices, enlarging bridge windows, etc., which Linux currently doesn't support.
NumaChip sounds like an exception because you know you never care about using those BARs. But I'm curious -- it looks like Linux didn't even try to assign resources to them. I thought something in the pci_assign_unassigned_resources() path would have tried to do something with them. If we *did* assign resources to those BARs, I assume nothing would break, since there's no driver that actually uses them. Right?
Bjorn
Re: [PATCH 3/3] Add NumaChip quirk
Quoted 2 lines · Bjorn Helgaas
[+cc linux-pci]
[]
Quoted 17 lines
Quoted 10 lines
The conflict we refer to in the patch is that since Linux thinks we have those windows assigned to us, we get conflicts later on with real devices :
[ 5.887856] pnp 00:0e: disabling [mem 0x00000000-0x0009ffff] because it overlaps 0000:00:1a.0 BAR 0 [mem 0x00000000-0x000fffff] [ 5.899525] pnp 00:0e: disabling [mem 0x000c0000-0x000cffff] because it overlaps 0000:00:1a.0 BAR 0 [mem 0x00000000-0x000fffff] [ 5.911002] pnp 00:0e: disabling [mem 0x000e0000-0x000fffff] because itoverlaps 0000:00:1a.0 BAR 0 [mem 0x00000000-0x000fffff]
Yeah, this is gross, and this is definitely something Linux is doing wrong. We don't have a consistent way of marking PCI BARs as "disabled," so every zero-valued BAR seems to conflict with PNP devices. Typically there are motherboard devices like your 00:0e that reserve regions of low memory.
Quoted 5 lines
Lots of machines complain like this, not just NumaChip, and there's no real ill effect. We say we're disabling a PNP device resource, but we don't actually evaluate an
_SRSmethod to tell the BIOS to do anything. So I think we complain about the conflict but don't do anything else.
Ah, ok. I didn't dive into it, so I didn't see if anything bad(tm) really happened when that PNP device got "disabled" resources.
Quoted 5 lines
Quoted 4 lines
I guess technically, the Linux PCI bus probing code should check the Command register (offset
0x4) to see if MemorySpace is enabled (which in our case it won't be) before checking the BAR registers.
Quoted 8 lines
The question is how we handle a device with MemorySpace disabled. In most cases, I think we want to assign BAR resources to it so that if a driver claims the device, we can enable MemorySpace and the device will work. If the BIOS leaves MemorySpace disabled and Linux doesn't assign BAR space at boot-time, we may be stuck because in general we can't assign resources dynamically. Dynamic assignment might require moving other devices, enlarging bridge windows, etc., which Linux currently doesn't support.
Yes, I didn't want to open that can of worms :)
Quoted 9 lines
NumaChip sounds like an exception because you know you never care about using those BARs. But I'm curious -- it looks like Linux didn't even try to assign resources to them. I thought something in the
pci_assign_unassigned_resources()path would have tried to do something with them. If we *did* assign resources to those BARs, I assume nothing would break, since there's no driver that actually uses them. Right?
Correct, the BARs are there and if something sensible were written to them (and MemorySpace was enabled in the Command register) NumaChip *would* respond to mmio accesses to that address range. However, those BARs are only for memory mapped configuration register (CSR) access which can be accessed in a "reserved" address range anyway which is what we refer to as global CSR space. This is what the 2 other sub-patches are using for talking to the NumaChip, and if someone would write any driver at some point it would most likely be tied to that type of access anyway.
The BARs can only be used for "local" CSR space which isn't that useful anyway so we don't bother assigning anything to it (or don't care if anything is). Besides, in a cluster with 1000s of NumaChip nodes all connected together (with different PCI segments etc. etc.) you really don't want to assign BARs anyway since you already have the global CSR space.
With this background, would you agree that it makes sense to still have the quirk or would you go about and solve it in a different way ?
Cheers,
Signature · 3 lines
Steffen Persvold, Chief Architect NumaChip Numascale AS - www.numascale.com Tel: +47 92 49 25 54 Skype: spersvold
Re: [PATCH 3/3] Add NumaChip quirk
Quoted 10 lines · Steffen Persvold
Quoted 8 lines · Bjorn Helgaas
NumaChip sounds like an exception because you know you never care about using those BARs. But I'm curious -- it looks like Linux didn't even try to assign resources to them. I thought something in the
pci_assign_unassigned_resources()path would have tried to do something with them. If we *did* assign resources to those BARs, I assume nothing would break, since there's no driver that actually uses them. Right?
Quoted 3 lines
Correct, the BARs are there and if something sensible were written to them (and MemorySpace was enabled in the Command register) NumaChip *would* respond to mmio accesses to that address range.
A minor point: adjusting the BARs would not strictly speaking be sufficient for the NumaChip to respond, as it would never see these accesses unless the [MMIO address range]->[HyperTransport node/link] registers of the CPU NorthBridges were also updated with the relevant ranges. This is a bit messy, but in a way much the same issue as when secondary southbridges are connected to secondary CPUs in any other HyperTransport-based system.
Perhaps an alternative to this NumaChip-specific quirk would be to special-case BARs belonging to "PCI" devices 00:18 - 00:1f in AMD Opteron systems. These always indicate coherent HT devices and fiddling with the CPU NB maps are going to be required if anything is changed regarding the BAR assignments here.
Signature · 1 line
Arne.
Bjorn Helgaas
maintainerRe: [PATCH 3/3] Add NumaChip quirk
Quoted 15 lines · Arne Georg Gleditsch
Quoted 10 lines · Steffen Persvold
Quoted 8 lines · Bjorn Helgaas
NumaChip sounds like an exception because you know you never care about using those BARs. But I'm curious -- it looks like Linux didn't even try to assign resources to them. I thought something in the
pci_assign_unassigned_resources()path would have tried to do something with them. If we *did* assign resources to those BARs, I assume nothing would break, since there's no driver that actually uses them. Right?Quoted 3 lines
Correct, the BARs are there and if something sensible were written to them (and MemorySpace was enabled in the Command register) NumaChip *would* respond to mmio accesses to that address range.
Quoted 7 lines
A minor point: adjusting the BARs would not strictly speaking be sufficient for the NumaChip to respond, as it would never see these accesses unless the [MMIO address range]->[HyperTransport node/link] registers of the CPU NorthBridges were also updated with the relevant ranges. This is a bit messy, but in a way much the same issue as when secondary southbridges are connected to secondary CPUs in any other HyperTransport-based system.
The [MMIO address range]->[HyperTransport node/link] registers you're talking about are the implementation side of the PCI host bridge abstraction. You should have an ACPI host bridge device (PNP0A03 or PNP0A08) that describes the apertures, and if Linux assigns resources to the BARs, it will only use areas inside the apertures. If there's no available space in the apertures, we just leave the device alone (maybe this explains why we didn't assign anything).
Quoted 5 lines
Perhaps an alternative to this NumaChip-specific quirk would be to special-case BARs belonging to "PCI" devices 00:18 - 00:1f in AMD Opteron systems. These always indicate coherent HT devices and fiddling with the CPU NB maps are going to be required if anything is changed regarding the BAR assignments here.
I don't think there's a need to special-case these AMD BARs. If the BIOS programs them correctly (inside a PCI host bridge aperture reported via ACPI), Linux won't touch them.
Bjorn
Bjorn Helgaas
maintainerRe: [PATCH 3/3] Add NumaChip quirk
In reply to Steffen PersvoldQuoted 72 lines · Steffen Persvold
Quoted 3 lines · Bjorn Helgaas
[+cc linux-pci]
[]
Quoted 21 lines
Quoted 5 lines
The conflict we refer to in the patch is that since Linux thinks we have those windows assigned to us, we get conflicts later on with real devices :
Quoted 9 lines
[ 5.887856] pnp 00:0e: disabling [mem 0x00000000-0x0009ffff] because it
overlaps 0000:00:1a.0 BAR 0 [mem 0x00000000-0x000fffff]
[ 5.899525] pnp 00:0e: disabling [mem 0x000c0000-0x000cffff] because it
overlaps 0000:00:1a.0 BAR 0 [mem 0x00000000-0x000fffff]
[ 5.911002] pnp 00:0e: disabling [mem 0x000e0000-0x000fffff] because it
overlaps 0000:00:1a.0 BAR 0 [mem 0x00000000-0x000fffff]Yeah, this is gross, and this is definitely something Linux is doing wrong. We don't have a consistent way of marking PCI BARs as "disabled," so every zero-valued BAR seems to conflict with PNP devices. Typically there are motherboard devices like your 00:0e that reserve regions of low memory.
Quoted 5 lines
Lots of machines complain like this, not just NumaChip, and there's no real ill effect. We say we're disabling a PNP device resource, but we don't actually evaluate an
_SRSmethod to tell the BIOS to do anything. So I think we complain about the conflict but don't do anything else.Ah, ok. I didn't dive into it, so I didn't see if anything bad(tm) really happened when that PNP device got "disabled" resources.
Quoted 7 lines
Quoted 6 lines
I guess technically, the Linux PCI bus probing code should check the Command
register (offset0x4) to see if MemorySpace is enabled (which in our case it
won't be) before checking the BAR registers.Quoted 8 lines
The question is how we handle a device with MemorySpace disabled. In most cases, I think we want to assign BAR resources to it so that if a driver claims the device, we can enable MemorySpace and the device will work. If the BIOS leaves MemorySpace disabled and Linux doesn't assign BAR space at boot-time, we may be stuck because in general we can't assign resources dynamically. Dynamic assignment might require moving other devices, enlarging bridge windows, etc., which Linux currently doesn't support.
Yes, I didn't want to open that can of worms :)
Quoted 9 lines
NumaChip sounds like an exception because you know you never care about using those BARs. But I'm curious -- it looks like Linux didn't even try to assign resources to them. I thought something in the
pci_assign_unassigned_resources()path would have tried to do something with them. If we *did* assign resources to those BARs, I assume nothing would break, since there's no driver that actually uses them. Right?Correct, the BARs are there and if something sensible were written to them (and MemorySpace was enabled in the Command register) NumaChip *would* respond to mmio accesses to that address range. However, those BARs are only for memory mapped configuration register (CSR) access which can be accessed in a "reserved" address range anyway which is what we refer to as global CSR space. This is what the 2 other sub-patches are using for talking to the NumaChip, and if someone would write any driver at some point it would most likely be tied to that type of access anyway.
Quoted 8 lines
The BARs can only be used for "local" CSR space which isn't that useful anyway so we don't bother assigning anything to it (or don't care if anything is). Besides, in a cluster with 1000s of NumaChip nodes all connected together (with different PCI segments etc. etc.) you really don't want to assign BARs anyway since you already have the global CSR space.
With this background, would you agree that it makes sense to still have the quirk or would you go about and solve it in a different way ?
In this case, I think the only thing the quirk does for you is to get rid of the warning. I don't think it will make anything work better, so my inclination would be to just skip the quirk.
Tangent: I looked at the other patches, specifically
https://lkml.org/lkml/2011/7/22/97, and I see some of the global CSR space stuff. I assume you have ACPI devices that describe the global CSR address space? I don't see anything in the patch that reserves that space in iomem_resource. There should be some mechanism for reserving that space to prevent collisions. For PCI devices, normally that's the BAR. For other devices on x86, normally that's ACPI.
Bjorn