Skip to content

Commit 537adae

Browse files
mgcaowenlingz
authored andcommitted
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>
1 parent fde0bcc commit 537adae

File tree

4 files changed

+12
-19
lines changed

4 files changed

+12
-19
lines changed

hypervisor/arch/x86/assign.c

Lines changed: 1 addition & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -54,22 +54,6 @@ ptirq_lookup_entry_by_vpin(const struct acrn_vm *vm, uint8_t virt_pin, bool pic_
5454
return entry;
5555
}
5656

57-
#ifdef CONFIG_COM_IRQ
58-
static bool ptdev_hv_owned_intx(const struct acrn_vm *vm, const union source_id *virt_sid)
59-
{
60-
bool ret;
61-
62-
/* vm0 vuart pin is owned by hypervisor under debug version */
63-
if (is_vm0(vm) && (virt_sid->intx_id.pin == CONFIG_COM_IRQ)) {
64-
ret = true;
65-
} else {
66-
ret = false;
67-
}
68-
69-
return ret;
70-
}
71-
#endif /* CONFIG_COM_IRQ */
72-
7357
static uint64_t calculate_logical_dest_mask(uint64_t pdmask)
7458
{
7559
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_
625609
*/
626610

627611
/* no remap for hypervisor owned intx */
628-
#ifdef CONFIG_COM_IRQ
629-
if (ptdev_hv_owned_intx(vm, &virt_sid)) {
612+
if (is_vm0(vm) && hv_used_dbg_intx(virt_sid.intx_id.pin)) {
630613
status = -ENODEV;
631614
}
632-
#endif /* CONFIG_COM_IRQ */
633615

634616
if ((status != 0) || (pic_pin && (virt_pin >= NR_VPIC_PINS_TOTAL))) {
635617
status = -EINVAL;

hypervisor/debug/vuart.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -408,3 +408,8 @@ void vuart_init(struct acrn_vm *vm)
408408
vuart_lock_init(vu);
409409
vuart_register_io_handler(vm);
410410
}
411+
412+
bool hv_used_dbg_intx(uint8_t intx_pin)
413+
{
414+
return is_dbg_uart_enabled() && (intx_pin == CONFIG_COM_IRQ);
415+
}

hypervisor/include/debug/vuart.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,4 +75,5 @@ struct acrn_vuart *vuart_console_active(void);
7575
void vuart_console_tx_chars(struct acrn_vuart *vu);
7676
void vuart_console_rx_chars(struct acrn_vuart *vu);
7777

78+
bool hv_used_dbg_intx(uint8_t intx_pin);
7879
#endif /* VUART_H */

hypervisor/release/vuart.c

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,3 +15,8 @@ struct acrn_vuart *vuart_console_active(void)
1515

1616
void vuart_console_tx_chars(__unused struct acrn_vuart *vu) {}
1717
void vuart_console_rx_chars(__unused struct acrn_vuart *vu) {}
18+
19+
bool hv_used_dbg_intx(__unused uint8_t intx_pin)
20+
{
21+
return false;
22+
}

0 commit comments

Comments
 (0)