Module Name:    src
Committed By:   imil
Date:           Tue Jan  7 14:37:09 UTC 2025

Modified Files:
        src/sys/arch/i386/conf: files.i386
        src/sys/arch/i386/i386: i386_mainbus.c

Log Message:
Enable pv(4) for i386


To generate a diff of this commit:
cvs rdiff -u -r1.408 -r1.409 src/sys/arch/i386/conf/files.i386
cvs rdiff -u -r1.7 -r1.8 src/sys/arch/i386/i386/i386_mainbus.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/i386/conf/files.i386
diff -u src/sys/arch/i386/conf/files.i386:1.408 src/sys/arch/i386/conf/files.i386:1.409
--- src/sys/arch/i386/conf/files.i386:1.408	Fri Feb 23 22:10:39 2024
+++ src/sys/arch/i386/conf/files.i386	Tue Jan  7 14:37:09 2025
@@ -1,4 +1,4 @@
-#	$NetBSD: files.i386,v 1.408 2024/02/23 22:10:39 andvar Exp $
+#	$NetBSD: files.i386,v 1.409 2025/01/07 14:37:09 imil Exp $
 #
 # new style config file for i386 architecture
 #
@@ -127,7 +127,7 @@ define	pnpbiosbus {}
 # XXX BIOS32 only if something that uses it is configured!
 device	mainbus: isabus, eisabus, mcabus, pcibus, bios32, acpibus,
 	cpubus, ioapicbus, apmbus, pnpbiosbus, ipmibus,
-	bioscall, hypervisorbus
+	bioscall, hypervisorbus, pvbus
 attach	mainbus at root
 file	arch/i386/i386/i386_mainbus.c	mainbus & !xenpv
 file	arch/x86/x86/mainbus.c		mainbus
@@ -421,4 +421,7 @@ device	glxsb: opencrypto
 attach	glxsb at pci
 file	arch/i386/pci/glxsb.c		glxsb
 
+# PVbus support
+include "arch/x86/pv/files.pv"
+
 include "arch/i386/conf/majors.i386"

Index: src/sys/arch/i386/i386/i386_mainbus.c
diff -u src/sys/arch/i386/i386/i386_mainbus.c:1.7 src/sys/arch/i386/i386/i386_mainbus.c:1.8
--- src/sys/arch/i386/i386/i386_mainbus.c:1.7	Mon Apr 22 22:47:00 2024
+++ src/sys/arch/i386/i386/i386_mainbus.c	Tue Jan  7 14:37:09 2025
@@ -1,4 +1,4 @@
-/*	$NetBSD: i386_mainbus.c,v 1.7 2024/04/22 22:47:00 andvar Exp $	*/
+/*	$NetBSD: i386_mainbus.c,v 1.8 2025/01/07 14:37:09 imil Exp $	*/
 /*	NetBSD: mainbus.c,v 1.104 2018/12/02 08:19:44 cherry Exp 	*/
 
 /*
@@ -32,7 +32,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: i386_mainbus.c,v 1.7 2024/04/22 22:47:00 andvar Exp $");
+__KERNEL_RCSID(0, "$NetBSD: i386_mainbus.c,v 1.8 2025/01/07 14:37:09 imil Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -54,6 +54,7 @@ __KERNEL_RCSID(0, "$NetBSD: i386_mainbus
 #include "pnpbios.h"
 #include "acpica.h"
 #include "ipmi.h"
+#include "pvbus.h"
 
 #include "opt_acpi.h"
 #include "opt_mpbios.h"
@@ -90,6 +91,9 @@ __KERNEL_RCSID(0, "$NetBSD: i386_mainbus
 #endif /* PCI_ADDR_FIXUP */
 #endif /* PCI_BUS_FIXUP */
 #endif /* NPCI > 0 */
+#if NPVBUS > 0
+#include <arch/x86/pv/pvvar.h>
+#endif
 
 void	i386_mainbus_childdetached(device_t, device_t);
 int	i386_mainbus_match(device_t, cfdata_t, void *);
@@ -115,6 +119,9 @@ union i386_mainbus_attach_args {
 #if NIPMI > 0
 	struct ipmi_attach_args mba_ipmi;
 #endif
+#if NPVBUS > 0
+	struct pvbus_attach_args mba_pvba;
+#endif
 };
 
 /*
@@ -240,6 +247,20 @@ i386_mainbus_attach(device_t parent, dev
 	}
 #endif
 
+#if NPVBUS > 0
+	/* add here more VM guests types that would benefit from a pv bus */
+	switch(vm_guest) {
+	/* FALLTHROUGH */
+	case VM_GUEST_GENPVH:
+	case VM_GUEST_KVM:
+		mba.mba_pvba.pvba_busname = "pvbus";
+		config_found(self, &mba.mba_pvba.pvba_busname, NULL,
+			CFARGS(.iattr = "pvbus"));
+		break;
+	default:
+		break;
+	}
+#endif
 	if (!pmf_device_register(self, NULL, NULL))
 		aprint_error_dev(self, "couldn't establish power handler\n");
 }

Reply via email to