diff --git a/doc/developer-guides/hld/hv-io-emulation.rst b/doc/developer-guides/hld/hv-io-emulation.rst index fccedf42e..9b674a9e9 100644 --- a/doc/developer-guides/hld/hv-io-emulation.rst +++ b/doc/developer-guides/hld/hv-io-emulation.rst @@ -310,9 +310,6 @@ The following structure represents a MMIO handler. The following APIs are provided to initialize, deinitialize or configure I/O bitmaps and register or unregister I/O handlers: -.. doxygenfunction:: setup_io_bitmap - :project: Project ACRN - .. doxygenfunction:: allow_guest_pio_access :project: Project ACRN diff --git a/hypervisor/arch/x86/guest/vm.c b/hypervisor/arch/x86/guest/vm.c index d3ad6a93a..f5fcb46f2 100644 --- a/hypervisor/arch/x86/guest/vm.c +++ b/hypervisor/arch/x86/guest/vm.c @@ -42,6 +42,21 @@ static inline bool is_vm_valid(uint16_t vm_id) return bitmap_test(vm_id, &vmid_bitmap); } +/** + * @brief Initialize the I/O bitmap for \p vm + * + * @param vm The VM whose I/O bitmap is to be initialized + */ +static void setup_io_bitmap(struct acrn_vm *vm) +{ + if (is_vm0(vm)) { + (void)memset(vm->arch_vm.io_bitmap, 0x00U, PAGE_SIZE * 2U); + } else { + /* block all IO port access from Guest */ + (void)memset(vm->arch_vm.io_bitmap, 0xFFU, PAGE_SIZE * 2U); + } +} + /* return a pointer to the virtual machine structure associated with * this VM ID */ diff --git a/hypervisor/arch/x86/io_emul.c b/hypervisor/arch/x86/io_emul.c index 165acb430..2d4ac857c 100644 --- a/hypervisor/arch/x86/io_emul.c +++ b/hypervisor/arch/x86/io_emul.c @@ -442,21 +442,6 @@ static void deny_guest_pio_access(struct acrn_vm *vm, uint16_t port_address, } } -/** - * @brief Initialize the I/O bitmap for \p vm - * - * @param vm The VM whose I/O bitmap is to be initialized - */ -void setup_io_bitmap(struct acrn_vm *vm) -{ - if (is_vm0(vm)) { - (void)memset(vm->arch_vm.io_bitmap, 0x00U, PAGE_SIZE * 2U); - } else { - /* block all IO port access from Guest */ - (void)memset(vm->arch_vm.io_bitmap, 0xFFU, PAGE_SIZE * 2U); - } -} - /** * @brief Register a port I/O handler * diff --git a/hypervisor/include/arch/x86/io_emul.h b/hypervisor/include/arch/x86/io_emul.h index 5934a55e3..86086d47a 100644 --- a/hypervisor/include/arch/x86/io_emul.h +++ b/hypervisor/include/arch/x86/io_emul.h @@ -91,13 +91,6 @@ int32_t pio_instr_vmexit_handler(struct acrn_vcpu *vcpu); */ void allow_guest_pio_access(struct acrn_vm *vm, uint16_t port_address, uint32_t nbytes); -/** - * @brief Initialize the I/O bitmap for \p vm - * - * @param vm The VM whose I/O bitmap is to be initialized - */ -void setup_io_bitmap(struct acrn_vm *vm); - /** * @brief Register a port I/O handler *