diff --git a/hypervisor/dm/vpci/vpci.c b/hypervisor/dm/vpci/vpci.c index ca20da30d..f2777ecbd 100644 --- a/hypervisor/dm/vpci/vpci.c +++ b/hypervisor/dm/vpci/vpci.c @@ -85,7 +85,7 @@ static bool pci_cfgaddr_io_write(struct acrn_vm *vm, uint16_t addr, size_t bytes if ((addr == (uint16_t)PCI_CONFIG_ADDR) && (bytes == 4U)) { pi->cached_bdf.value = (uint16_t)(val >> 8U); - pi->cached_reg = val & PCI_REGMAX; + pi->cached_reg = val & PCI_REGMASK; pi->cached_enable = ((val & PCI_CFG_ENABLE) == PCI_CFG_ENABLE); } diff --git a/hypervisor/include/hw/pci.h b/hypervisor/include/hw/pci.h index d4eb6e47e..dc44ba8af 100644 --- a/hypervisor/include/hw/pci.h +++ b/hypervisor/include/hw/pci.h @@ -49,6 +49,7 @@ #define PCI_FUNCMAX 0x7U #define PCI_BAR_COUNT 0x6U #define PCI_REGMAX 0xFFU +#define PCI_REGMASK 0xFCU /* I/O ports */ #define PCI_CONFIG_ADDR 0xCF8U