Skip to content

Commit 37da905

Browse files
committed
Enable pv(4) for i386
1 parent 93b2532 commit 37da905

File tree

2 files changed

+28
-4
lines changed

2 files changed

+28
-4
lines changed

sys/arch/i386/conf/files.i386

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# $NetBSD: files.i386,v 1.408 2024/02/23 22:10:39 andvar Exp $
1+
# $NetBSD: files.i386,v 1.409 2025/01/07 14:37:09 imil Exp $
22
#
33
# new style config file for i386 architecture
44
#
@@ -127,7 +127,7 @@ define pnpbiosbus {}
127127
# XXX BIOS32 only if something that uses it is configured!
128128
device mainbus: isabus, eisabus, mcabus, pcibus, bios32, acpibus,
129129
cpubus, ioapicbus, apmbus, pnpbiosbus, ipmibus,
130-
bioscall, hypervisorbus
130+
bioscall, hypervisorbus, pvbus
131131
attach mainbus at root
132132
file arch/i386/i386/i386_mainbus.c mainbus & !xenpv
133133
file arch/x86/x86/mainbus.c mainbus
@@ -421,4 +421,7 @@ device glxsb: opencrypto
421421
attach glxsb at pci
422422
file arch/i386/pci/glxsb.c glxsb
423423

424+
# PVbus support
425+
include "arch/x86/pv/files.pv"
426+
424427
include "arch/i386/conf/majors.i386"

sys/arch/i386/i386/i386_mainbus.c

Lines changed: 23 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
/* $NetBSD: i386_mainbus.c,v 1.7 2024/04/22 22:47:00 andvar Exp $ */
1+
/* $NetBSD: i386_mainbus.c,v 1.8 2025/01/07 14:37:09 imil Exp $ */
22
/* NetBSD: mainbus.c,v 1.104 2018/12/02 08:19:44 cherry Exp */
33

44
/*
@@ -32,7 +32,7 @@
3232
*/
3333

3434
#include <sys/cdefs.h>
35-
__KERNEL_RCSID(0, "$NetBSD: i386_mainbus.c,v 1.7 2024/04/22 22:47:00 andvar Exp $");
35+
__KERNEL_RCSID(0, "$NetBSD: i386_mainbus.c,v 1.8 2025/01/07 14:37:09 imil Exp $");
3636

3737
#include <sys/param.h>
3838
#include <sys/systm.h>
@@ -54,6 +54,7 @@ __KERNEL_RCSID(0, "$NetBSD: i386_mainbus.c,v 1.7 2024/04/22 22:47:00 andvar Exp
5454
#include "pnpbios.h"
5555
#include "acpica.h"
5656
#include "ipmi.h"
57+
#include "pvbus.h"
5758

5859
#include "opt_acpi.h"
5960
#include "opt_mpbios.h"
@@ -90,6 +91,9 @@ __KERNEL_RCSID(0, "$NetBSD: i386_mainbus.c,v 1.7 2024/04/22 22:47:00 andvar Exp
9091
#endif /* PCI_ADDR_FIXUP */
9192
#endif /* PCI_BUS_FIXUP */
9293
#endif /* NPCI > 0 */
94+
#if NPVBUS > 0
95+
#include <arch/x86/pv/pvvar.h>
96+
#endif
9397

9498
void i386_mainbus_childdetached(device_t, device_t);
9599
int i386_mainbus_match(device_t, cfdata_t, void *);
@@ -115,6 +119,9 @@ union i386_mainbus_attach_args {
115119
#if NIPMI > 0
116120
struct ipmi_attach_args mba_ipmi;
117121
#endif
122+
#if NPVBUS > 0
123+
struct pvbus_attach_args mba_pvba;
124+
#endif
118125
};
119126

120127
/*
@@ -240,6 +247,20 @@ i386_mainbus_attach(device_t parent, device_t self, void *aux)
240247
}
241248
#endif
242249

250+
#if NPVBUS > 0
251+
/* add here more VM guests types that would benefit from a pv bus */
252+
switch(vm_guest) {
253+
/* FALLTHROUGH */
254+
case VM_GUEST_GENPVH:
255+
case VM_GUEST_KVM:
256+
mba.mba_pvba.pvba_busname = "pvbus";
257+
config_found(self, &mba.mba_pvba.pvba_busname, NULL,
258+
CFARGS(.iattr = "pvbus"));
259+
break;
260+
default:
261+
break;
262+
}
263+
#endif
243264
if (!pmf_device_register(self, NULL, NULL))
244265
aprint_error_dev(self, "couldn't establish power handler\n");
245266
}

0 commit comments

Comments
 (0)