Skip to content

Commit f21e36f

Browse files
shiqinggwenlingz
authored andcommitted
hv: vioapic: clean up HV_DEBUG usage
remove the usage of HV_DEBUG in vioapic.c Tracked-On: #861 Signed-off-by: Shiqing Gao <shiqing.gao@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
1 parent a931229 commit f21e36f

File tree

3 files changed

+58
-63
lines changed

3 files changed

+58
-63
lines changed

hypervisor/debug/shell.c

Lines changed: 56 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -916,6 +916,62 @@ static int shell_show_ptdev_info(__unused int argc, __unused char **argv)
916916
return 0;
917917
}
918918

919+
static void get_vioapic_info(char *str_arg, size_t str_max, uint16_t vmid)
920+
{
921+
char *str = str_arg;
922+
size_t len, size = str_max;
923+
union ioapic_rte rte;
924+
uint32_t delmode, vector, dest;
925+
bool level, phys, remote_irr, mask;
926+
struct acrn_vm *vm = get_vm_from_vmid(vmid);
927+
uint32_t pin, pincount;
928+
929+
if (vm == NULL) {
930+
len = snprintf(str, size, "\r\nvm is not exist for vmid %hu", vmid);
931+
if (len >= size) {
932+
goto overflow;
933+
}
934+
size -= len;
935+
str += len;
936+
goto END;
937+
}
938+
939+
len = snprintf(str, size, "\r\nPIN\tVEC\tDM\tDEST\tTM\tDELM\tIRR\tMASK");
940+
if (len >= size) {
941+
goto overflow;
942+
}
943+
size -= len;
944+
str += len;
945+
946+
pincount = vioapic_pincount(vm);
947+
rte.full = 0UL;
948+
for (pin = 0U; pin < pincount; pin++) {
949+
vioapic_get_rte(vm, pin, &rte);
950+
mask = ((rte.full & IOAPIC_RTE_INTMASK) == IOAPIC_RTE_INTMSET);
951+
remote_irr = ((rte.full & IOAPIC_RTE_REM_IRR) == IOAPIC_RTE_REM_IRR);
952+
phys = ((rte.full & IOAPIC_RTE_DESTMOD) == IOAPIC_RTE_DESTPHY);
953+
delmode = (uint32_t)(rte.full & IOAPIC_RTE_DELMOD);
954+
level = ((rte.full & IOAPIC_RTE_TRGRLVL) != 0UL);
955+
vector = rte.u.lo_32 & IOAPIC_RTE_LOW_INTVEC;
956+
dest = (uint32_t)(rte.full >> IOAPIC_RTE_DEST_SHIFT);
957+
958+
len = snprintf(str, size, "\r\n%hhu\t0x%X\t%s\t0x%X\t%s\t%u\t%d\t%d",
959+
pin, vector, phys ? "phys" : "logic", dest, level ? "level" : "edge",
960+
delmode >> 8U, remote_irr, mask);
961+
if (len >= size) {
962+
goto overflow;
963+
}
964+
size -= len;
965+
str += len;
966+
}
967+
END:
968+
snprintf(str, size, "\r\n");
969+
return;
970+
971+
overflow:
972+
printf("buffer size could not be enough! please check!\n");
973+
}
974+
919975
static int shell_show_vioapic_info(int argc, char **argv)
920976
{
921977
uint16_t vmid;

hypervisor/dm/vioapic.c

Lines changed: 0 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@
4040

4141
#define IOAPIC_ID_MASK 0x0f000000U
4242
#define MASK_ALL_INTERRUPTS 0x0001000000010000UL
43-
#define IOAPIC_RTE_LOW_INTVEC ((uint32_t)IOAPIC_RTE_INTVEC)
4443

4544
/**
4645
* @pre pin < vioapic_pincount(vm)
@@ -574,61 +573,3 @@ void vioapic_get_rte(struct acrn_vm *vm, uint32_t pin, union ioapic_rte *rte)
574573
vioapic = vm_ioapic(vm);
575574
*rte = vioapic->rtbl[pin];
576575
}
577-
578-
#ifdef HV_DEBUG
579-
void get_vioapic_info(char *str_arg, size_t str_max, uint16_t vmid)
580-
{
581-
char *str = str_arg;
582-
size_t len, size = str_max;
583-
union ioapic_rte rte;
584-
uint32_t delmode, vector, dest;
585-
bool level, phys, remote_irr, mask;
586-
struct acrn_vm *vm = get_vm_from_vmid(vmid);
587-
uint32_t pin, pincount;
588-
589-
if (vm == NULL) {
590-
len = snprintf(str, size, "\r\nvm is not exist for vmid %hu", vmid);
591-
if (len >= size) {
592-
goto overflow;
593-
}
594-
size -= len;
595-
str += len;
596-
goto END;
597-
}
598-
599-
len = snprintf(str, size, "\r\nPIN\tVEC\tDM\tDEST\tTM\tDELM\tIRR\tMASK");
600-
if (len >= size) {
601-
goto overflow;
602-
}
603-
size -= len;
604-
str += len;
605-
606-
pincount = vioapic_pincount(vm);
607-
rte.full = 0UL;
608-
for (pin = 0U; pin < pincount; pin++) {
609-
vioapic_get_rte(vm, pin, &rte);
610-
mask = ((rte.full & IOAPIC_RTE_INTMASK) == IOAPIC_RTE_INTMSET);
611-
remote_irr = ((rte.full & IOAPIC_RTE_REM_IRR) == IOAPIC_RTE_REM_IRR);
612-
phys = ((rte.full & IOAPIC_RTE_DESTMOD) == IOAPIC_RTE_DESTPHY);
613-
delmode = (uint32_t)(rte.full & IOAPIC_RTE_DELMOD);
614-
level = ((rte.full & IOAPIC_RTE_TRGRLVL) != 0UL);
615-
vector = rte.u.lo_32 & IOAPIC_RTE_LOW_INTVEC;
616-
dest = (uint32_t)(rte.full >> IOAPIC_RTE_DEST_SHIFT);
617-
618-
len = snprintf(str, size, "\r\n%hhu\t0x%X\t%s\t0x%X\t%s\t%u\t%d\t%d",
619-
pin, vector, phys ? "phys" : "logic", dest, level ? "level" : "edge",
620-
delmode >> 8U, remote_irr, mask);
621-
if (len >= size) {
622-
goto overflow;
623-
}
624-
size -= len;
625-
str += len;
626-
}
627-
END:
628-
snprintf(str, size, "\r\n");
629-
return;
630-
631-
overflow:
632-
printf("buffer size could not be enough! please check!\n");
633-
}
634-
#endif /* HV_DEBUG */

hypervisor/include/arch/x86/guest/vioapic.h

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,8 @@
4646
#define REDIR_ENTRIES_HW 120U /* SOS align with native ioapic */
4747
#define STATE_BITMAP_SIZE INT_DIV_ROUNDUP(REDIR_ENTRIES_HW, 64U)
4848

49+
#define IOAPIC_RTE_LOW_INTVEC ((uint32_t)IOAPIC_RTE_INTVEC)
50+
4951
struct acrn_vioapic {
5052
struct acrn_vm *vm;
5153
spinlock_t mtx;
@@ -104,10 +106,6 @@ void vioapic_process_eoi(struct acrn_vm *vm, uint32_t vector);
104106
void vioapic_get_rte(struct acrn_vm *vm, uint32_t pin, union ioapic_rte *rte);
105107
int vioapic_mmio_access_handler(struct io_request *io_req, void *handler_private_data);
106108

107-
#ifdef HV_DEBUG
108-
void get_vioapic_info(char *str_arg, size_t str_max, uint16_t vmid);
109-
#endif /* HV_DEBUG */
110-
111109
/**
112110
* @}
113111
*/

0 commit comments

Comments
 (0)