PCI: x86 MMCONFIG: introduce PCI_USING_MMCONF
A message that is not in the archive (sent off-list or not yet received): 20071219221746.20362.39243.sendpatchset@dhcp83-188.boston.redhat.com
A message that is not in the archive (sent off-list or not yet received): 20071219221751.20362.23451.sendpatchset@dhcp83-188.boston.redhat.com
Quoted 40 lines · On Wed, Dec 19, 2007 at 05:17:51PM -0500, [email protected] wrote:
commit
d1f2a573ca7083d237cfc354f42e089de9fa0f0bAuthor: Tony Camuso <[email protected]> Date: Wed Dec 19 15:33:53 2007 -0500Introduces a flag bit to
arch/x86/pci/pci.hto indicate that MMCONFIG is the system-wide default PCI config access mechanisim.Function
pci_mmcfg_init()inarch/x86/pci/mmconfig-shared.csets the bit in thepci_probemask when MMCONFIG has been successfully initialized for the platform.Signed-off-by Tony Camuso [email protected]arch/x86/pci/mmconfig-shared.c +2
-1@@ -274,7 +274,8 @@ void __init pci_mmcfg_init(int type)unreachable_devices ();if (known_bridge)pci_mmcfg_insert_resources (IORESOURCE_BUSY ); - pci_probe = (pci_probe & ~PCI_PROBE_MASK ) |PCI_PROBE_MMCONF ; + pci_probe = pci_probe & ~PCI_PROBE_MASK ; + pci_probe = pci_probe |PCI_PROBE_MMCONF |PCI_USING_MMCONF ; }else {/* * Signal not to attempt to insert mmcfg resources because arch/x86/pci/pci.h +1
-0@@ -28,6 +28,7 @@#define PCI_ASSIGN_ALL_BUSSES 0x4000#define PCI_CAN_SKIP_ISA_ALIGN 0x8000#define PCI_USE__CRS 0x10000 +#define PCI_USING_MMCONF 0x20000extern unsigned int pci_probe;extern unsigned long pirq_table_addr;
arch/x86/pci/pci.h enum pci_bf_sort_state { · line 43
Quoted 4 lines
arch/x86/pci/pci.h +1
-0@@ -39,6 +40,8 @@ enum pci_bf_sort_state { pci_dmi_bf, }; +extern struct pci_ops pci_legacy_ops;/* direct.c */
This isn't needed in this patch at all, and might make the compiler confused if you were to build with only this patch present :(
thanks,
greg k-h
A message that is not in the archive (sent off-list or not yet received): [email protected]
A message that is not in the archive (sent off-list or not yet received): [email protected]
Quoted 7 lines · Greg KH
Please do not respond privately, please respond back on the list so that everyone can see. That way I will respond, to do otherwise is rude to the rest of the community...
thanks,
greg k-h
I'm very sorry.
It is certainly not my intention to be rude.
A message that is not in the archive (sent off-list or not yet received): 20071219221756.20362.84805.sendpatchset@dhcp83-188.boston.redhat.com
Re: [PATCH 2/5]PCI: x86 MMCONFIG: add legacy pci conf functions
Quoted 35 lines · On Wed, Dec 19, 2007 at 05:17:56PM -0500, [email protected] wrote:
commit
307e3aecde8060af3802590f8c5bffb5456fe22bAuthor: Tony Camuso <[email protected]> Date: Wed Dec 19 15:38:31 2007 -0500Modifies
arch/x86/pci/direct.cto add the Legacy PCI Config routines that will be made available, even when MMCONFIG is the platform default PCI Config access mechanism. It also provides logic for selecting the correct Legacy PCI Config access mechanism and the corresponding boot log messages.Signed-off-by Tony Camuso [email protected]arch/x86/pci/direct.c +15
-0@@ -175,6 +175,32 @@ static struct pci_raw_ops pci_direct_conf2 = { .write = pci_conf2_write, }; +/* +* Legacy PCI Config read and write routines for buses that can't use +* MMCONFIG accesses in systems where MMCONFIG is the default PCI config +* access mechanism. +*/ +static struct pci_raw_ops *pci_legacy_conf; + +static int pci_ops_legacy_read (struct pci_bus *bus,unsigned int devfn, +int where,int size,u32 *value) +{ +return pci_legacy_conf->read (0 , bus->number, devfn, where, + size, value); +} + +static int pci_ops_legacy_write(struct pci_bus *bus, unsigned int devfn,
arch/x86/pci/direct.c static struct pci_raw_ops pci_direct_conf2 = { · line 202
Quoted 10 lines
arch/x86/pci/direct.c +10
-0+ int where, int size, u32 value) +{ + return pci_legacy_conf->write(0, bus->number, devfn, where, +size ,value ); +} + +struct pci_ops pci_legacy_ops = { + .read = pci_ops_legacy_read, + .write = pci_ops_legacy_write, +};
This whole structure is never used in this patch, why add it now?
Quoted 5 lines
arch/x86/pci/direct.c +0
-0/* * Before we decide to use direct hardware access mechanisms, we try to do some @@ -258,18 +284,28 @@ void __init pci_direct_init(int type) {if (type ==0 )
arch/x86/pci/direct.c void __init pci_direct_init(int type) · line 292
Quoted 10 lines
arch/x86/pci/direct.c +4
-3return ; -printk (KERN_INFO "PCI: Using configuration type %d\n" , type); -if (type ==1 ) +if (type ==1 ) { raw_pci_ops = &pci_direct_conf1; -else + pci_legacy_conf = &pci_direct_conf1; + }else { raw_pci_ops = &pci_direct_conf2; + pci_legacy_conf = &pci_direct_conf2;
Why have two pointers to the same thing? What is pci_legacy_conf going to be used for? Why not just use raw_pci_ops?
thanks,
greg k-h
A message that is not in the archive (sent off-list or not yet received): 20071219221806.20362.25964.sendpatchset@dhcp83-188.boston.redhat.com
Re: [PATCH 4/5]PCI: x86 MMCONFIG: introduce pcibios_fix_bus_scan()
Quoted 23 lines · On Wed, Dec 19, 2007 at 05:18:06PM -0500, [email protected] wrote:
commit
ab28e1157e970f711c8451b66b3f940ec092db9dAuthor: Tony Camuso <[email protected]> Date: Wed Dec 19 15:51:48 2007 -0500Introduces the x86 arch-specific routine that will determine whether a device responds correctly to MMCONFIG accesses. This routine is given the generic name
pcibios_fix_bus_scan_quirk()The comment at the top of the routine explains its logic.
Signed-off-by Tony Camuso [email protected]arch/x86/pci/common.c +3
-0@@ -525,3 +525,64 @@ struct pci_bus *pci_scan_bus_with_sysdata(int busno)return bus; } + +/** +* This routine traps devices not correctly responding to MMCONFIG access.
arch/x86/pci/common.c struct pci_bus *pci_scan_bus_with_sysdata(int busno) · line 540
Quoted 10 lines
arch/x86/pci/common.c +10
-0+* For each device on the current bus, compare a mmconf read of the +* vendor/device dword with a legacy PCI config read. If they're not the same, +* the bus serving this device must use legacy PCI config accesses instead of +* mmconf, as must all buses descending from this bus. +*/ + +#define CHECK_MMCFG_STR_1 \ + "PCI: Device at %04x:%02x.%02x.%x is not MMCONFIG compliant.\n" +#define CHECK_MMCFG_STR_2 \ + "PCI: Bus %04x:%02x and its descendents cannot use MMCONFIG.\n"
Why define these if they are only used in one place?
Also, as you use dev_info(), I think you are duplicating some of the information in the resulting printk(), right?
Quoted 8 lines
arch/x86/pci/common.c +8
-0+ +void __devinit pcibios_fix_bus_scan_quirk (struct pci_bus *bus) +{ +int devfn; +int fail; +int found_nommconf_dev =0 ; +static int advised; +u32 mcfg_vendev;
arch/x86/pci/common.c struct pci_bus *pci_scan_bus_with_sysdata(int busno) · line 558
Quoted 10 lines
arch/x86/pci/common.c +10
-0+u32 arch_vendev; +struct pci_ops *save_ops = bus->ops; + +if (bus->parent !=NULL ) +if (bus->parent->ops == &pci_legacy_ops) +return ; + +if (!advised) { +pr_info ("PCI: If a device isn't working, try \"pci=nommconf\". " +"If that helps, please post a report.\n" );
Post a report where? Who is going to handle these reports?
The last time someone put a line like this in the kernel, I got a ton of email and didn't know what to do with it. If you really are trusting of this patch, please put your email address in this printk(), so that you can properly handle the resulting reports. I sure don't want to :)
arch/x86/pci/common.c struct pci_bus *pci_scan_bus_with_sysdata(int busno) · line 567
Quoted 9 lines
arch/x86/pci/common.c +9
-0+ advised =1 ; + } +pr_debug ("PCI: Checking bus %04x:%02x for MMCONFIG compliance.\n" , +pci_domain_nr (bus), bus->number); + +for (devfn =0 ; devfn <256 ; devfn++) { + bus->ops = &pci_legacy_ops; + fail = (pci_bus_read_config_dword (bus, devfn,PCI_VENDOR_ID , + &arch_vendev));
What's with the extra () around the function?
Quoted 7 lines
arch/x86/pci/common.c +7
-0+if ((arch_vendev ==0xFFFFFFFF ) || (arch_vendev ==0 ) || fail) +continue ; + + bus->ops = save_ops;/* Restore to original value */ +pci_bus_read_config_dword (bus, devfn,PCI_VENDOR_ID , + &mcfg_vendev); +if (mcfg_vendev != arch_vendev) {
arch/x86/pci/common.c struct pci_bus *pci_scan_bus_with_sysdata(int busno) · line 584
Quoted 10 lines
arch/x86/pci/common.c +10
-0+ found_nommconf_dev =1 ; +break ; + } + } + +if (found_nommconf_dev) { +pr_info (CHECK_MMCFG_STR_1 ,pci_domain_nr (bus), bus->number, +PCI_SLOT (devfn),PCI_FUNC (devfn)); +pr_info (CHECK_MMCFG_STR_2 ,pci_domain_nr (bus), bus->number); + bus->ops = &pci_legacy_ops;/* Use Legace PCI Config */
Spelling check for your comments :)
thanks,
greg k-h
Re: [PATCH 4/5]PCI: x86 MMCONFIG: introduce pcibios_fix_bus_scan()
In reply to a message not in the archiveQuoted 18 lines · On Wed, Dec 19, 2007 at 05:18:06PM -0500, [email protected] wrote:
commit
ab28e1157e970f711c8451b66b3f940ec092db9dAuthor: Tony Camuso <[email protected]> Date: Wed Dec 19 15:51:48 2007 -0500Introduces the x86 arch-specific routine that will determine whether a device responds correctly to MMCONFIG accesses. This routine is given the generic name
pcibios_fix_bus_scan_quirk()The comment at the top of the routine explains its logic.
Signed-off-by Tony Camuso [email protected]arch/x86/pci/common.c +0
-0@@ -525,3 +525,64 @@ struct pci_bus *pci_scan_bus_with_sysdata(int busno)
arch/x86/pci/common.c struct pci_bus *pci_scan_bus_with_sysdata(int busno) · line 535
Quoted 10 lines
arch/x86/pci/common.c +8
-0return bus; } + +/** +* This routine traps devices not correctly responding to MMCONFIG access. +* For each device on the current bus, compare a mmconf read of the +* vendor/device dword with a legacy PCI config read. If they're not the same, +* the bus serving this device must use legacy PCI config accesses instead of +* mmconf, as must all buses descending from this bus. +*/
Don't user kerneldoc comments for functions that are not really in kerneldoc format. Just a simple /* at the start will be fine, otherwise the tools get confused.
So what happens today with these "broken" devices? Does simply reading the vendor id not work properly? What specific hardware does not work today that this is trying to fix?
I think this patch set needs a bit of reworking at the very least...
thanks,
greg k-h
Re: [PATCH 0/5]PCI: x86 MMCONFIG
In reply to a message not in the archiveQuoted 6 lines · On Wed, Dec 19, 2007 at 05:17:46PM -0500, [email protected] wrote:
OVERVIEW
=======The patches should be applied in sequence to obviate any possible build problems.
Quoted 7 lines
The patch-set was built against 2.6.24-rc5
Description
===========There exist devices that do not respond correctly to PCI MMCONFIG accesses in x86 platforms.
What devices are these? Do you have reports of them somewhere?
Quoted 4 lines
This patch-set detects the problem by comparing an MMCONFIG read to a Legacy PCI config read of the vendor/device dword of every device discovered during the PCI probing sequence.
Quoted 8 lines
A miscompare means that a device does not correctly respond to MMCONFIG accesses. When the patch code detects this condition, the bus that serves this device, and all subordinate buses, will be programmed to use Legacy PCI Config accesses.
This patch-set DOES NOT detect devices that generate machine checks against MMCONFIG accesses. For such systems, "pci=nommconf" is required in the boot command.
That sounds like this patchset can cause bad side affects on hardware that currently works just fine. That is not a good thing to be adding to the kernel, right?
thanks,
greg k-h