From 537adaeb4617a91ea22de164c68c65251ab42409 Mon Sep 17 00:00:00 2001 From: Minggui Cao Date: Mon, 24 Dec 2018 21:41:31 +0800 Subject: [PATCH] HV: cleanup CONFIG_COM_IRQ related code move CONFIG_COM_IRQ code into vuart, because it is just used for vuart. Tracked-On: #2170 Signed-off-by: Minggui Cao Acked-by: Eddie Dong --- hypervisor/arch/x86/assign.c | 20 +------------------- hypervisor/debug/vuart.c | 5 +++++ hypervisor/include/debug/vuart.h | 1 + hypervisor/release/vuart.c | 5 +++++ 4 files changed, 12 insertions(+), 19 deletions(-) diff --git a/hypervisor/arch/x86/assign.c b/hypervisor/arch/x86/assign.c index 441eeb347..80877f19d 100644 --- a/hypervisor/arch/x86/assign.c +++ b/hypervisor/arch/x86/assign.c @@ -54,22 +54,6 @@ ptirq_lookup_entry_by_vpin(const struct acrn_vm *vm, uint8_t virt_pin, bool pic_ return entry; } -#ifdef CONFIG_COM_IRQ -static bool ptdev_hv_owned_intx(const struct acrn_vm *vm, const union source_id *virt_sid) -{ - bool ret; - - /* vm0 vuart pin is owned by hypervisor under debug version */ - if (is_vm0(vm) && (virt_sid->intx_id.pin == CONFIG_COM_IRQ)) { - ret = true; - } else { - ret = false; - } - - return ret; -} -#endif /* CONFIG_COM_IRQ */ - static uint64_t calculate_logical_dest_mask(uint64_t pdmask) { uint64_t dest_mask = 0UL; @@ -625,11 +609,9 @@ int32_t ptirq_intx_pin_remap(struct acrn_vm *vm, uint8_t virt_pin, uint8_t vpin_ */ /* no remap for hypervisor owned intx */ -#ifdef CONFIG_COM_IRQ - if (ptdev_hv_owned_intx(vm, &virt_sid)) { + if (is_vm0(vm) && hv_used_dbg_intx(virt_sid.intx_id.pin)) { status = -ENODEV; } -#endif /* CONFIG_COM_IRQ */ if ((status != 0) || (pic_pin && (virt_pin >= NR_VPIC_PINS_TOTAL))) { status = -EINVAL; diff --git a/hypervisor/debug/vuart.c b/hypervisor/debug/vuart.c index c904d8b22..9cf396629 100644 --- a/hypervisor/debug/vuart.c +++ b/hypervisor/debug/vuart.c @@ -408,3 +408,8 @@ void vuart_init(struct acrn_vm *vm) vuart_lock_init(vu); vuart_register_io_handler(vm); } + +bool hv_used_dbg_intx(uint8_t intx_pin) +{ + return is_dbg_uart_enabled() && (intx_pin == CONFIG_COM_IRQ); +} diff --git a/hypervisor/include/debug/vuart.h b/hypervisor/include/debug/vuart.h index a53f318b3..a87a00de8 100644 --- a/hypervisor/include/debug/vuart.h +++ b/hypervisor/include/debug/vuart.h @@ -75,4 +75,5 @@ struct acrn_vuart *vuart_console_active(void); void vuart_console_tx_chars(struct acrn_vuart *vu); void vuart_console_rx_chars(struct acrn_vuart *vu); +bool hv_used_dbg_intx(uint8_t intx_pin); #endif /* VUART_H */ diff --git a/hypervisor/release/vuart.c b/hypervisor/release/vuart.c index 989a0721d..74926e615 100644 --- a/hypervisor/release/vuart.c +++ b/hypervisor/release/vuart.c @@ -15,3 +15,8 @@ struct acrn_vuart *vuart_console_active(void) void vuart_console_tx_chars(__unused struct acrn_vuart *vu) {} void vuart_console_rx_chars(__unused struct acrn_vuart *vu) {} + +bool hv_used_dbg_intx(__unused uint8_t intx_pin) +{ + return false; +}