From 2e7491a8eced4b032b0ae4a094ef93d1303eb480 Mon Sep 17 00:00:00 2001 From: Fei Li Date: Fri, 13 Aug 2021 09:06:45 +0800 Subject: [PATCH] hv: mmiodev: a minor bug fix about refine acrn_mmiodev data structure Rename base_hpa to host_pa in acrn_mmiodev data structure. Tracked-On: #6366 Signed-off-by: Fei Li --- hypervisor/arch/x86/guest/vm.c | 4 ++-- hypervisor/dm/vgpio.c | 8 ++++---- hypervisor/include/dm/vgpio.h | 2 +- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/hypervisor/arch/x86/guest/vm.c b/hypervisor/arch/x86/guest/vm.c index 45a617ddf..4d89f849d 100644 --- a/hypervisor/arch/x86/guest/vm.c +++ b/hypervisor/arch/x86/guest/vm.c @@ -302,8 +302,8 @@ static void prepare_prelaunched_vm_memmap(struct acrn_vm *vm, const struct acrn_ (void)assign_mmio_dev(vm, &vm_config->mmiodevs[i]); #ifdef P2SB_VGPIO_DM_ENABLED - if ((vm_config->pt_p2sb_bar) && (vm_config->mmiodevs[i].base_hpa == P2SB_BAR_ADDR)) { - register_vgpio_handler(vm, &vm_config->mmiodevs[i]); + if ((vm_config->pt_p2sb_bar) && (vm_config->mmiodevs[i].res[0].host_pa == P2SB_BAR_ADDR)) { + register_vgpio_handler(vm, &vm_config->mmiodevs[i].res[0]); } #endif } diff --git a/hypervisor/dm/vgpio.c b/hypervisor/dm/vgpio.c index c58027e7a..09da61c91 100644 --- a/hypervisor/dm/vgpio.c +++ b/hypervisor/dm/vgpio.c @@ -129,17 +129,17 @@ static int32_t vgpio_mmio_handler(struct io_request *io_req, void *data) } /** - * @pre vm != NULL && mmiodev != NULL + * @pre vm != NULL && res != NULL */ -void register_vgpio_handler(struct acrn_vm *vm, const struct acrn_mmiodev *mmiodev) +void register_vgpio_handler(struct acrn_vm *vm, const struct acrn_mmiores *res) { uint64_t gpa_start, gpa_end, gpio_pcr_sz; uint64_t base_hpa; - gpa_start = mmiodev->user_vm_pa + (P2SB_BASE_GPIO_PORT_ID << P2SB_PORTID_SHIFT); + gpa_start = res->user_vm_pa + (P2SB_BASE_GPIO_PORT_ID << P2SB_PORTID_SHIFT); gpio_pcr_sz = P2SB_PCR_SPACE_SIZE_PER_AGENT * P2SB_MAX_GPIO_COMMUNITIES; gpa_end = gpa_start + gpio_pcr_sz; - base_hpa = mmiodev->host_pa + (P2SB_BASE_GPIO_PORT_ID << P2SB_PORTID_SHIFT); + base_hpa = res->host_pa + (P2SB_BASE_GPIO_PORT_ID << P2SB_PORTID_SHIFT); /* emulate MMIO access to the GPIO private configuration space registers */ set_paging_supervisor((uint64_t)hpa2hva(base_hpa), gpio_pcr_sz); diff --git a/hypervisor/include/dm/vgpio.h b/hypervisor/include/dm/vgpio.h index ef6028994..0fdf2d9e9 100644 --- a/hypervisor/include/dm/vgpio.h +++ b/hypervisor/include/dm/vgpio.h @@ -7,6 +7,6 @@ #ifndef VGPIO_H #define VGPIO_H -void register_vgpio_handler(struct acrn_vm *vm, const struct acrn_mmiodev *mmiodev); +void register_vgpio_handler(struct acrn_vm *vm, const struct acrn_mmiores *res); #endif /* MMIO_DEV_H */