mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-22 17:27:53 +00:00
hv: move 'setup_io_bitmap' to vm.c
move this api from io_emul.c to vm.c to avoid reverse dependency Tracked-On: #1842 Signed-off-by: Mingqiang Chi <mingqiang.chi@intel.com> Reviewed-by: Jason Chen CJ <jason.cj.chen@intel.com> Reviewed-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
@@ -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
|
||||
*/
|
||||
|
@@ -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
|
||||
*
|
||||
|
Reference in New Issue
Block a user