Changeset View
Changeset View
Standalone View
Standalone View
usr.sbin/bhyve/pci_emul.c
Show First 20 Lines • Show All 1,145 Lines • ▼ Show 20 Lines | init_pci(struct vmctx *ctx) | ||||
nvlist_t *nvl; | nvlist_t *nvl; | ||||
const char *emul; | const char *emul; | ||||
size_t lowmem; | size_t lowmem; | ||||
uint64_t cpu_maxphysaddr, pci_emul_memresv64; | uint64_t cpu_maxphysaddr, pci_emul_memresv64; | ||||
u_int regs[4]; | u_int regs[4]; | ||||
int bus, slot, func, error; | int bus, slot, func, error; | ||||
pci_emul_iobase = PCI_EMUL_IOBASE; | pci_emul_iobase = PCI_EMUL_IOBASE; | ||||
pci_emul_membase32 = vm_get_lowmem_limit(ctx); | pci_emul_membase32 = PCI_EMUL_MEMBASE32; | ||||
markj: This limit is fixed in libvmmapi. Wouldn't it be cleaner to assert that it is using the value… | |||||
Done Inline ActionsDecreasing the lowmem_limit shouldn't hurt. However, bhyve should always use 0xC0000000 as membase32 because OVMF uses it too. corvink: Decreasing the lowmem_limit shouldn't hurt. However, bhyve should always use 0xC0000000 as… | |||||
do_cpuid(0x80000008, regs); | do_cpuid(0x80000008, regs); | ||||
cpu_maxphysaddr = 1ULL << (regs[0] & 0xff); | cpu_maxphysaddr = 1ULL << (regs[0] & 0xff); | ||||
if (cpu_maxphysaddr > VM_MAXUSER_ADDRESS_LA48) | if (cpu_maxphysaddr > VM_MAXUSER_ADDRESS_LA48) | ||||
cpu_maxphysaddr = VM_MAXUSER_ADDRESS_LA48; | cpu_maxphysaddr = VM_MAXUSER_ADDRESS_LA48; | ||||
pci_emul_memresv64 = cpu_maxphysaddr / 4; | pci_emul_memresv64 = cpu_maxphysaddr / 4; | ||||
/* | /* | ||||
* Max power of 2 that is less then | * Max power of 2 that is less then | ||||
▲ Show 20 Lines • Show All 98 Lines • ▼ Show 20 Lines | for (bus = 0; bus < MAXBUSES; bus++) { | ||||
} | } | ||||
} | } | ||||
lpc_pirq_routed(); | lpc_pirq_routed(); | ||||
/* | /* | ||||
* The guest physical memory map looks like the following: | * The guest physical memory map looks like the following: | ||||
* [0, lowmem) guest system memory | * [0, lowmem) guest system memory | ||||
* [lowmem, lowmem_limit) memory hole (may be absent) | * [lowmem, lowmem_limit) memory hole (may be absent) | ||||
* [lowmem_limit, 0xE0000000) PCI hole (32-bit BAR allocation) | * [lowmem_limit, 0xC0000000) Graphics Stolen Memory (may be absent) | ||||
* [0xC0000000, 0xE0000000) PCI hole (32-bit BAR allocation) | |||||
* [0xE0000000, 0xF0000000) PCI extended config window | * [0xE0000000, 0xF0000000) PCI extended config window | ||||
* [0xF0000000, 4GB) LAPIC, IOAPIC, HPET, firmware | * [0xF0000000, 4GB) LAPIC, IOAPIC, HPET, firmware | ||||
* [4GB, 4GB + highmem) | * [4GB, 4GB + highmem) | ||||
*/ | */ | ||||
/* | /* | ||||
* Accesses to memory addresses that are not allocated to system | * Accesses to memory addresses that are not allocated to system | ||||
* memory or PCI devices return 0xff's. | * memory or PCI devices return 0xff's. | ||||
▲ Show 20 Lines • Show All 1,151 Lines • Show Last 20 Lines |
This limit is fixed in libvmmapi. Wouldn't it be cleaner to assert that it is using the value we want, rather than just assuming?