Page MenuHomeFreeBSD

D27970.1784717581.diff
No OneTemporary

Size
2 KB
Referenced Files
None
Subscribers
None

D27970.1784717581.diff

diff --git a/usr.sbin/bhyve/pci_emul.c b/usr.sbin/bhyve/pci_emul.c
--- a/usr.sbin/bhyve/pci_emul.c
+++ b/usr.sbin/bhyve/pci_emul.c
@@ -33,9 +33,6 @@
#include <sys/param.h>
#include <sys/linker_set.h>
-#include <vm/vm.h>
-#include <vm/vm_param.h>
-#include <vm/pmap.h>
#include <ctype.h>
#include <errno.h>
@@ -48,8 +45,6 @@
#include <stdbool.h>
#include <machine/vmm.h>
-#include <machine/cpufunc.h>
-#include <machine/specialreg.h>
#include <vmmapi.h>
#include "acpi.h"
@@ -71,6 +66,8 @@
#define MAXSLOTS (PCI_SLOTMAX + 1)
#define MAXFUNCS (PCI_FUNCMAX + 1)
+#define GB (1024 * 1024 * 1024UL)
+
struct funcinfo {
char *fi_name;
char *fi_param;
@@ -112,6 +109,7 @@
SYSRES_MEM(PCI_EMUL_ECFG_BASE, PCI_EMUL_ECFG_SIZE);
#define PCI_EMUL_MEMLIMIT32 PCI_EMUL_ECFG_BASE
+#define PCI_EMUL_MEMSIZE64 (32*GB)
static struct pci_devemu *pci_emul_finddev(char *name);
static void pci_lintr_route(struct pci_devinst *pi);
@@ -1122,6 +1120,8 @@
#define BUSIO_ROUNDUP 32
#define BUSMEM_ROUNDUP (1024 * 1024)
+#define ALIGN_VALUE(Value, Alignment) ((Value) + (((Alignment) - (Value)) & ((Alignment) - 1)))
+
int
init_pci(struct vmctx *ctx)
{
@@ -1131,25 +1131,15 @@
struct slotinfo *si;
struct funcinfo *fi;
size_t lowmem;
- uint64_t cpu_maxphysaddr, pci_emul_memresv64;
- u_int regs[4];
- int bus, slot, func, error;
+ int bus, slot, func;
+ int error;
pci_emul_iobase = PCI_EMUL_IOBASE;
pci_emul_membase32 = vm_get_lowmem_limit(ctx);
- do_cpuid(0x80000008, regs);
- cpu_maxphysaddr = 1ULL << (regs[0] & 0xff);
- if (cpu_maxphysaddr > VM_MAXUSER_ADDRESS)
- cpu_maxphysaddr = VM_MAXUSER_ADDRESS;
- pci_emul_memresv64 = cpu_maxphysaddr / 4;
- /*
- * Max power of 2 that is less then
- * cpu_maxphysaddr - pci_emul_memresv64.
- */
- pci_emul_membase64 = 1ULL << (flsl(cpu_maxphysaddr -
- pci_emul_memresv64) - 1);
- pci_emul_memlim64 = cpu_maxphysaddr;
+ pci_emul_membase64 = 4*GB + vm_get_highmem_size(ctx);
+ pci_emul_membase64 = ALIGN_VALUE(pci_emul_membase64, PCI_EMUL_MEMSIZE64);
+ pci_emul_memlim64 = pci_emul_membase64 + PCI_EMUL_MEMSIZE64;
for (bus = 0; bus < MAXBUSES; bus++) {
if ((bi = pci_businfo[bus]) == NULL)

File Metadata

Mime Type
text/plain
Expires
Wed, Jul 22, 10:53 AM (6 h, 59 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
29227049
Default Alt Text
D27970.1784717581.diff (2 KB)

Event Timeline