summaryrefslogtreecommitdiffstats
path: root/arch/x86/pci/numaq_32.c
diff options
context:
space:
mode:
authorJan Beulich <JBeulich@novell.com>2011-07-22 08:13:05 +0100
committerJesse Barnes <jbarnes@virtuousgeek.org>2011-07-22 08:25:41 -0700
commitdb34a363b992e0c8063f432607561520d79fbfb8 (patch)
treed57b4e848eeccade7dd81e39832215bdec3f52b7 /arch/x86/pci/numaq_32.c
parent688398bb7b9c6ac115da7749ea808d3ef69e029f (diff)
downloadblackbird-op-linux-db34a363b992e0c8063f432607561520d79fbfb8.tar.gz
blackbird-op-linux-db34a363b992e0c8063f432607561520d79fbfb8.zip
x86/PCI: config space accessor functions should not ignore the segment argument
Without this change, the majority of the raw PCI config space access functions silently ignore a non-zero segment argument, which is certainly wrong. Apart from pci_direct_conf1, all other non-MMCFG access methods get used only for non-extended accesses (i.e. assigned to raw_pci_ops only). Consequently, with the way raw_pci_{read,write}() work, it would be a coding error to call these functions with a non-zero segment (with the current call flow this cannot happen afaict). The access method 1 accessor, as it can be used for extended accesses (on AMD systems) instead gets checks added for the passed in segment to be zero. This would be the case when on such a system having multiple PCI segments (don't know whether any exist in practice) MMCFG for some reason is not usable, and method 1 gets selected for doing extended accesses. Rather than accessing the wrong device's config space, the function will now error out. v2: Convert BUG_ON() to WARN_ON(), and extend description as per Ingo's request. Signed-off-by: Jan Beulich <jbeulich@novell.com> Reviewed-by: Ingo Molnar <mingo@elte.hu> Signed-off-by: Jesse Barnes <jbarnes@virtuousgeek.org>
Diffstat (limited to 'arch/x86/pci/numaq_32.c')
-rw-r--r--arch/x86/pci/numaq_32.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/arch/x86/pci/numaq_32.c b/arch/x86/pci/numaq_32.c
index 5c9e2458df4e..512a88c41501 100644
--- a/arch/x86/pci/numaq_32.c
+++ b/arch/x86/pci/numaq_32.c
@@ -34,6 +34,7 @@ static int pci_conf1_mq_read(unsigned int seg, unsigned int bus,
unsigned long flags;
void *adr __iomem = XQUAD_PORT_ADDR(0xcfc, BUS2QUAD(bus));
+ WARN_ON(seg);
if (!value || (bus >= MAX_MP_BUSSES) || (devfn > 255) || (reg > 255))
return -EINVAL;
@@ -73,6 +74,7 @@ static int pci_conf1_mq_write(unsigned int seg, unsigned int bus,
unsigned long flags;
void *adr __iomem = XQUAD_PORT_ADDR(0xcfc, BUS2QUAD(bus));
+ WARN_ON(seg);
if ((bus >= MAX_MP_BUSSES) || (devfn > 255) || (reg > 255))
return -EINVAL;
OpenPOWER on IntegriCloud