Skip to contentSkip to conversation

PCI support check in pcibios_init()

RFC PATCH Applied Adrian-Ken Rueegsegger 2 participants 3 messages Mar 23, 2016 – Apr 12, 2016

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

Hi,

We are running Linux as a VM on top of the Muen Separation Kernel [1], where we only allow PCI config space access of pass-through devices via MMCONFIG. In this use case the PCI support check in pcibios_init() fails as raw_pci_ops is not set:

int __init pcibios_init(void)

{
    if (!raw_pci_ops) {
        printk(KERN_WARNING "PCI: System does not support PCI\n");
        return 0;
    }
	...
}

As a consequence device resources are not allocated since the following call to pcibios_resource_survey() is skipped. Extending the check to also consider raw_pci_ext_ops (see patch) leads to the proper resource allocation in our use case.

Is the described change the correct solution or is there a particular reason to only check raw_pci_ops in pcibios_init()?

Regards,
Adrian

[1] - https://muen.codelabs.ch/

#1 lore raw

RFC PATCH 1/1 x86/PCI: Refine PCI support check in pcibios_init()

Also consider raw_pci_ext_ops when validating if a system has PCI support. This leads to proper resource allocation via pcibios_resource_survey() in the case where PCI config space is exclusively accessed through MMCONFIG.

---
 arch/x86/pci/common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/pci/common.c +1 -1
index 8fd6f44..50b123d 100644
@@ -517,7 +517,7 @@ void __init pcibios_set_cache_line_size(void)
 
 int __init pcibios_init(void)
 {
-	if (!raw_pci_ops) {
+	if (!raw_pci_ops && !raw_pci_ext_ops) {
 		printk(KERN_WARNING "PCI: System does not support PCI\n");
 		return 0;
 	}
Signature · 1 line
2.1.4
#2 lore raw

Re: [RFC PATCH] x86/PCI: Refine PCI support check in pcibios_init()

Quoted 6 lines · Adrian-Ken Rueegsegger

Also consider raw_pci_ext_ops when validating if a system has PCI support. This leads to proper resource allocation via pcibios_resource_survey() in the case where PCI config space is exclusively accessed through MMCONFIG.

Applied to pci/enumeration for v4.7, thanks!

Quoted 24 lines
---
 arch/x86/pci/common.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
arch/x86/pci/common.c +1 -1
index 8fd6f44..50b123d 100644
@@ -517,7 +517,7 @@ void __init pcibios_set_cache_line_size(void)
 
 int __init pcibios_init(void)
 {
-	if (!raw_pci_ops) {
+	if (!raw_pci_ops && !raw_pci_ext_ops) {
 		printk(KERN_WARNING "PCI: System does not support PCI\n");
 		return 0;
 	}
Signature · 6 lines
2.1.4

--
To unsubscribe from this list: send the line "unsubscribe linux-pci" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html