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 <minggui.cao@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
Minggui Cao 2018-12-24 21:41:31 +08:00 committed by wenlingz
parent fde0bcc1ce
commit 537adaeb46
4 changed files with 12 additions and 19 deletions

View File

@ -54,22 +54,6 @@ ptirq_lookup_entry_by_vpin(const struct acrn_vm *vm, uint8_t virt_pin, bool pic_
return entry; 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) static uint64_t calculate_logical_dest_mask(uint64_t pdmask)
{ {
uint64_t dest_mask = 0UL; 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 */ /* no remap for hypervisor owned intx */
#ifdef CONFIG_COM_IRQ if (is_vm0(vm) && hv_used_dbg_intx(virt_sid.intx_id.pin)) {
if (ptdev_hv_owned_intx(vm, &virt_sid)) {
status = -ENODEV; status = -ENODEV;
} }
#endif /* CONFIG_COM_IRQ */
if ((status != 0) || (pic_pin && (virt_pin >= NR_VPIC_PINS_TOTAL))) { if ((status != 0) || (pic_pin && (virt_pin >= NR_VPIC_PINS_TOTAL))) {
status = -EINVAL; status = -EINVAL;

View File

@ -408,3 +408,8 @@ void vuart_init(struct acrn_vm *vm)
vuart_lock_init(vu); vuart_lock_init(vu);
vuart_register_io_handler(vm); vuart_register_io_handler(vm);
} }
bool hv_used_dbg_intx(uint8_t intx_pin)
{
return is_dbg_uart_enabled() && (intx_pin == CONFIG_COM_IRQ);
}

View File

@ -75,4 +75,5 @@ struct acrn_vuart *vuart_console_active(void);
void vuart_console_tx_chars(struct acrn_vuart *vu); void vuart_console_tx_chars(struct acrn_vuart *vu);
void vuart_console_rx_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 */ #endif /* VUART_H */

View File

@ -15,3 +15,8 @@ struct acrn_vuart *vuart_console_active(void)
void vuart_console_tx_chars(__unused struct acrn_vuart *vu) {} void vuart_console_tx_chars(__unused struct acrn_vuart *vu) {}
void vuart_console_rx_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;
}