[tip:x86/hyperv] x86/hyperv: Suppress "PCI: Fatal: No config space access function found"

tip-bot for Dexuan Cui tipbot at zytor.com
Thu Sep 27 19:24:53 UTC 2018


Commit-ID:  2f285f46240d67060061d153786740d4df53cd78
Gitweb:     https://git.kernel.org/tip/2f285f46240d67060061d153786740d4df53cd78
Author:     Dexuan Cui <decui at microsoft.com>
AuthorDate: Tue, 18 Sep 2018 22:29:50 +0000
Committer:  Thomas Gleixner <tglx at linutronix.de>
CommitDate: Thu, 27 Sep 2018 21:19:14 +0200

x86/hyperv: Suppress "PCI: Fatal: No config space access function found"

A Generation-2 Linux VM on Hyper-V doesn't have the legacy PCI bus, and
users always see the scary warning, which is actually harmless.

Suppress it.

Signed-off-by: Dexuan Cui <decui at microsoft.com>
Signed-off-by: Thomas Gleixner <tglx at linutronix.de>
Reviewed-by: Michael Kelley <mikelley at microsoft.com>
Cc: "H. Peter Anvin" <hpa at zytor.com>
Cc: KY Srinivasan <kys at microsoft.com>
Cc: Haiyang Zhang <haiyangz at microsoft.com>
Cc: Stephen Hemminger <sthemmin at microsoft.com>
Cc: "devel at linuxdriverproject.org" <devel at linuxdriverproject.org>
Cc: Olaf Aepfle <olaf at aepfle.de>
Cc: Andy Whitcroft <apw at canonical.com>
Cc: Jason Wang <jasowang at redhat.com>
Cc: Vitaly Kuznetsov <vkuznets at redhat.com>
Cc: Marcelo Cerri <marcelo.cerri at canonical.com>
Cc: Josh Poulson <jopoulso at microsoft.com>
Link: https://lkml.kernel.org/r/ <KU1P153MB0166D977DC930996C4BF538ABF1D0 at KU1P153MB0166.APCP153.PROD.OUTLOOK.COM

---
 arch/x86/hyperv/hv_init.c | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

diff --git a/arch/x86/hyperv/hv_init.c b/arch/x86/hyperv/hv_init.c
index 20c876c7c5bf..7abb09e2eeb8 100644
--- a/arch/x86/hyperv/hv_init.c
+++ b/arch/x86/hyperv/hv_init.c
@@ -17,6 +17,7 @@
  *
  */
 
+#include <linux/efi.h>
 #include <linux/types.h>
 #include <asm/apic.h>
 #include <asm/desc.h>
@@ -253,6 +254,22 @@ static int hv_cpu_die(unsigned int cpu)
 	return 0;
 }
 
+static int __init hv_pci_init(void)
+{
+	int gen2vm = efi_enabled(EFI_BOOT);
+
+	/*
+	 * For Generation-2 VM, we exit from pci_arch_init() by returning 0.
+	 * The purpose is to suppress the harmless warning:
+	 * "PCI: Fatal: No config space access function found"
+	 */
+	if (gen2vm)
+		return 0;
+
+	/* For Generation-1 VM, we'll proceed in pci_arch_init().  */
+	return 1;
+}
+
 /*
  * This function is to be invoked early in the boot sequence after the
  * hypervisor has been detected.
@@ -329,6 +346,8 @@ void __init hyperv_init(void)
 
 	hv_apic_init();
 
+	x86_init.pci.arch_init = hv_pci_init;
+
 	/*
 	 * Register Hyper-V specific clocksource.
 	 */


More information about the devel mailing list