linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] x86/hyperv: suppress "PCI: Fatal: No config space access function found"
@ 2018-09-18 22:29 Dexuan Cui
  2018-09-19 15:44 ` Michael Kelley (EOSG)
  0 siblings, 1 reply; 2+ messages in thread
From: Dexuan Cui @ 2018-09-18 22:29 UTC (permalink / raw)
  To: H. Peter Anvin, Ingo Molnar, Thomas Gleixner, KY Srinivasan,
	Haiyang Zhang, Stephen Hemminger, x86
  Cc: devel, 'linux-kernel@vger.kernel.org',
	'olaf@aepfle.de', 'apw@canonical.com',
	'jasowang@redhat.com',
	vkuznets, 'marcelo.cerri@canonical.com',
	Josh Poulson, Michael Kelley (EOSG)


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

Signed-off-by: Dexuan Cui <decui@microsoft.com>
Cc: K. Y. Srinivasan <kys@microsoft.com>
Cc: Haiyang Zhang <haiyangz@microsoft.com>
Cc: Stephen Hemminger <sthemmin@microsoft.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 20c876c..7abb09e 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.
 	 */
-- 
2.7.4


^ permalink raw reply	[flat|nested] 2+ messages in thread

* RE: [PATCH] x86/hyperv: suppress "PCI: Fatal: No config space access function found"
  2018-09-18 22:29 [PATCH] x86/hyperv: suppress "PCI: Fatal: No config space access function found" Dexuan Cui
@ 2018-09-19 15:44 ` Michael Kelley (EOSG)
  0 siblings, 0 replies; 2+ messages in thread
From: Michael Kelley (EOSG) @ 2018-09-19 15:44 UTC (permalink / raw)
  To: Dexuan Cui, H. Peter Anvin, Ingo Molnar, Thomas Gleixner,
	KY Srinivasan, Haiyang Zhang, Stephen Hemminger, x86
  Cc: devel, 'linux-kernel@vger.kernel.org',
	'olaf@aepfle.de', 'apw@canonical.com',
	'jasowang@redhat.com',
	vkuznets, 'marcelo.cerri@canonical.com',
	Josh Poulson

From: Dexuan Cui   Sent: Tuesday, September 18, 2018 3:30 PM
> 
> A Generatin-2 Linux VM on Hyper-V doesn't have the legacy PCI bus, and
> users always see the scary warning, which is actually harmless. The patch
> is made to suppress the warning.
> 
> Signed-off-by: Dexuan Cui <decui@microsoft.com>
> Cc: K. Y. Srinivasan <kys@microsoft.com>
> Cc: Haiyang Zhang <haiyangz@microsoft.com>
> Cc: Stephen Hemminger <sthemmin@microsoft.com>
> ---
>  arch/x86/hyperv/hv_init.c | 19 +++++++++++++++++++
>  1 file changed, 19 insertions(+)
> 

Reviewed-by:  Michael Kelley <mikelley@microsoft.com>

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2018-09-19 15:45 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-09-18 22:29 [PATCH] x86/hyperv: suppress "PCI: Fatal: No config space access function found" Dexuan Cui
2018-09-19 15:44 ` Michael Kelley (EOSG)

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).