More PCI fixes for 2.6.10-rc2
PATCH 1/1 More PCI fixes for 2.6.10-rc2
Hi,
Here are some more small PCI and PCI hotplug fixes for 2.6.10-rc2.
Please pull from:
bk://kernel.bkbits.net/gregkh/linux/pci-2.6
thanks,
greg k-h
p.s. I'll send these as patches in response to this email to lkml for those who want to see them.
arch/i386/pci/mmconfig.c | 7 +++++++ arch/x86_64/pci/mmconfig.c | 7 +++++++ drivers/pci/hotplug/cpqphp_pci.c | 2 +- drivers/pci/hotplug/pciehp_hpc.c | 3 +++ drivers/pci/hotplug/shpchp_hpc.c | 3 +++ drivers/pci/pci-sysfs.c | 14 ++++++++++++-- 6 files changed, 33 insertions(+), 3 deletions(-)
-----
Andi Kleen:
o PCI: Disable mmconfig on AMD CPUs
o PCI: Add sysfs file to map PCI busses to cpus
Dely Sy:
o PCI Hotplug: Add pci_enable_device() in hot-plug drivers
Greg Kroah-Hartman:
o PCI: fix build warning in pci-sysfs.c
o PCI Hotplug: fix warning compile issue in cpqphp driver
PATCH 1/1 More PCI fixes for 2.6.10-rc2
ChangeSet 1.2223.2.1, 2004/11/24 14:43:45-08:00, [email protected]
[PATCH] PCI Hotplug: Add pci_enable_device() in hot-plug drivers
Here is the patch to add pci_enable_device() to the two hot-plug drivers. In 2.6.10-rc2, the unconditional PCI ACPI IRQ routing has been removed. Without this patch, the drivers won't work in INTx mode with ACPI enabled.
drivers/pci/hotplug/pciehp_hpc.c | 3 +++ drivers/pci/hotplug/shpchp_hpc.c | 3 +++ 2 files changed, 6 insertions(+)
drivers/pci/hotplug/pciehp_hpc.c +3 -0
@@ -1347,6 +1347,9 @@info ("HPC vendor_id %x device_id %x ss_vid %x ss_did %x\n" , pdev->vendor, pdev->device, pdev->subsystem_vendor, pdev->subsystem_device); +if (pci_enable_device (pdev)) + goto abort_free_ctlr; +init_MUTEX (&ctrl->crit_sect);/* setup wait queue */ init_waitqueue_head (&ctrl->queue);
drivers/pci/hotplug/shpchp_hpc.c +3 -0
@@ -1487,6 +1487,9 @@info ("HPC vendor_id %x device_id %x ss_vid %x ss_did %x\n" , pdev->vendor, pdev->device, pdev->subsystem_vendor, pdev->subsystem_device); + +if (pci_enable_device (pdev)) + goto abort_free_ctlr;if (!request_mem_region (pci_resource_start (pdev,0 ) + shpc_base_offset,pci_resource_len (pdev,0 ),MY_NAME )) {err ("%s: cannot reserve MMIO region\n" , __FUNCTION__);
ChangeSet 1.2223.2.2, 2004/11/24 14:44:11-08:00, [email protected]
[PATCH] PCI Hotplug: fix warning compile issue in cpqphp driver
As pointed out by "O.Sezer" <[email protected]> in a patch to 2.4
drivers/pci/hotplug/cpqphp_pci.c | 2 +- 1 files changed, 1 insertion(+), 1 deletion(-)
drivers/pci/hotplug/cpqphp_pci.c +1 -1
@@ -194,7 +194,7 @@static int PCI_ScanBusForNonBridge (struct controller *ctrl,u8 bus_num,u8 * dev_num) { -u8 tdevice; +u16 tdevice;u32 work;u8 tbus;
ChangeSet 1.2223.2.3, 2004/11/29 11:12:54-08:00, [email protected]
[PATCH] PCI: Add sysfs file to map PCI busses to cpus
Add sysfs file to map PCI busses to cpus
Export the information from pcibus_to_cpumask() to sysfs. This is useful for some user space programs who want to optimize their IO using O_DIRECT.
There was some indecision on whether it's more useful to report cpus or nodes here. In the end cpus was chosen because that is what the existing macros report.
drivers/pci/pci-sysfs.c | 11 +++++++++++ 1 files changed, 11 insertions(+)
drivers/pci/pci-sysfs.c +11 -0
@@ -19,6 +19,7 @@#include <linux/kernel.h> #include <linux/pci.h> #include <linux/stat.h> +#include <linux/topology.h> #include "pci.h"
@@ -42,6 +43,15 @@pci_config_attr (class,"0x%06x\n" );pci_config_attr (irq,"%u\n" ); +static ssize_t local_cpus_show (struct device *dev,char *buf) +{ +struct pci_dev *pdev =to_pci_dev (dev); +cpumask_t mask =pcibus_to_cpumask (pdev->bus->number); +int len =cpumask_scnprintf (buf,PAGE_SIZE -2 , mask); +strcat (buf,"\n" ); +return 1 +len; +} +/* show resources */ static ssize_t resource_show (struct device * dev,char * buf)
@@ -71,6 +81,7 @@__ATTR_RO (subsystem_device),__ATTR_RO (class),__ATTR_RO (irq), +__ATTR_RO (local_cpus), __ATTR_NULL, };
ChangeSet 1.2223.2.4, 2004/11/29 11:13:49-08:00, [email protected]
[PATCH] PCI: Disable mmconfig on AMD CPUs.
Disable mmconfig on AMD CPUs.
This patch fixes various problems on PCI Express boards, like the Nforce4. They have a MCFG table in ACPI, but not all devices can be accessed using MMCONFIG. e.g. the CPU builtin PCI devices in the A64 Northbridge can't. Linux happily uses mmconfig for all PCI devices and that cause failures and memory corruption.
Right solution apparently is to get more information from MCFG which is supposed to tell for which busses mmconfig is legal and for which ones not. But that would be a much more complicated patch and I don't have a specification of this enhanced table.
This patch just disable MMCONFIG on all AMD CPUs. This is a kludge, but works around the problem for now.
Patch for both i386 and x86-64
arch/i386/pci/mmconfig.c | 7 +++++++ arch/x86_64/pci/mmconfig.c | 7 +++++++ 2 files changed, 14 insertions(+)
arch/i386/pci/mmconfig.c +7 -0
@@ -102,6 +102,13 @@if (!pci_mmcfg_base_addr) goto out; +/* Kludge for now. Don't use mmconfig on AMD systems because +those have some busses where mmconfig doesn't work, +and we don't parse ACPI MCFG well enough to handle that. +Remove when proper handling is added. */ +if (boot_cpu_data.x86_vendor ==X86_VENDOR_AMD ) + goto out; +printk (KERN_INFO "PCI: Using MMCONFIG\n" ); raw_pci_ops = &pci_mmcfg; pci_probe = (pci_probe & ~PCI_PROBE_MASK ) |PCI_PROBE_MMCONF ;
arch/x86_64/pci/mmconfig.c +7 -0
@@ -78,6 +78,13 @@if (!pci_mmcfg_base_addr)return 0 ; +/* Kludge for now. Don't use mmconfig on AMD systems because +those have some busses where mmconfig doesn't work, +and we don't parse ACPI MCFG well enough to handle that. +Remove when proper handling is added. */ +if (boot_cpu_data.x86_vendor ==X86_VENDOR_AMD ) +return 0 ; +/* RED-PEN i386 doesn't do _nocache right now */ pci_mmcfg_virt =ioremap_nocache (pci_mmcfg_base_addr,MMCONFIG_APER_SIZE );if (!pci_mmcfg_virt) {
ChangeSet 1.2223.2.5, 2004/11/30 11:54:13-08:00, [email protected]
PCI: fix build warning in pci-sysfs.c
drivers/pci/pci-sysfs.c | 3 +-- 1 files changed, 1 insertion(+), 2 deletions(-)
drivers/pci/pci-sysfs.c +1 -2
@@ -45,8 +45,7 @@static ssize_t local_cpus_show (struct device *dev,char *buf) { -struct pci_dev *pdev =to_pci_dev (dev); -cpumask_t mask =pcibus_to_cpumask (pdev->bus->number); +cpumask_t mask =pcibus_to_cpumask (to_pci_dev (dev)->bus->number);int len =cpumask_scnprintf (buf,PAGE_SIZE -2 , mask);strcat (buf,"\n" );return 1 +len;