Skip to content

Commit

Permalink
hv:Delete the dead code
Browse files Browse the repository at this point in the history
Delete the dead code get_irq_info(), local_get_irq_info() in io_request.c
and definition in guest.h.

v1->v2
 *the dead code used pointers which not checked before use, therefore it
  causes "pointer not checked for null before use". To make it clearly,
  modify the subject to "delete the dead code" directly.

 *remove dead code local_get_irq_info() in io_request.c and definition
  in guest.h together.

Tracked-On: projectacrn#861
Signed-off-by: Junjun Shan <junjun.shan@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
  • Loading branch information
junjunshan1 authored and lijinxia committed Sep 17, 2018
1 parent c307e1b commit 83d1ddc
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 106 deletions.
102 changes: 0 additions & 102 deletions hypervisor/common/io_request.c
Original file line number Diff line number Diff line change
Expand Up @@ -100,105 +100,3 @@ acrn_insert_request_wait(struct vcpu *vcpu, struct io_request *io_req)

return 0;
}

#ifdef HV_DEBUG
static void local_get_req_info_(struct vhm_request *req, int *id, char *type,
char *state, char *dir, uint64_t *addr, uint64_t *val)
{
(void)strcpy_s(dir, 16U, "NONE");
*addr = 0UL;
*val = 0UL;
*id = req->client;

switch (req->type) {
case REQ_PORTIO:
(void)strcpy_s(type, 16U, "PORTIO");
if (req->reqs.pio.direction == REQUEST_READ) {
(void)strcpy_s(dir, 16U, "READ");
} else {
(void)strcpy_s(dir, 16U, "WRITE");
}
*addr = req->reqs.pio.address;
*val = req->reqs.pio.value;
break;
case REQ_MMIO:
case REQ_WP:
(void)strcpy_s(type, 16U, "MMIO/WP");
if (req->reqs.mmio.direction == REQUEST_READ) {
(void)strcpy_s(dir, 16U, "READ");
} else {
(void)strcpy_s(dir, 16U, "WRITE");
}
*addr = req->reqs.mmio.address;
*val = req->reqs.mmio.value;
break;
break;
default:
(void)strcpy_s(type, 16U, "UNKNOWN");
}

switch (req->processed) {
case REQ_STATE_COMPLETE:
(void)strcpy_s(state, 16U, "COMPLETE");
break;
case REQ_STATE_PENDING:
(void)strcpy_s(state, 16U, "PENDING");
break;
case REQ_STATE_PROCESSING:
(void)strcpy_s(state, 16U, "PROCESS");
break;
case REQ_STATE_FREE:
(void)strcpy_s(state, 16U, "FREE");
break;
default:
(void)strcpy_s(state, 16U, "UNKNOWN");
}
}

void get_req_info(char *str_arg, int str_max)
{
char *str = str_arg;
uint32_t i;
int32_t len, size = str_max, client_id;
union vhm_request_buffer *req_buf;
struct vhm_request *req;
char type[16], state[16], dir[16];
uint64_t addr, val;
struct list_head *pos;
struct vm *vm;

len = snprintf(str, size,
"\r\nVM\tVCPU\tCID\tTYPE\tSTATE\tDIR\tADDR\t\t\tVAL");
size -= len;
str += len;

spinlock_obtain(&vm_list_lock);
list_for_each(pos, &vm_list) {
vm = list_entry(pos, struct vm, list);
req_buf = (union vhm_request_buffer *)vm->sw.io_shared_page;
if (req_buf != NULL) {
for (i = 0U; i < VHM_REQUEST_MAX; i++) {
req = req_buf->req_queue + i;
if (req->valid != 0) {
local_get_req_info_(req, &client_id, type,
state, dir, &addr, &val);
len = snprintf(str, size,
"\r\n%d\t%d\t%d\t%s\t%s\t%s",
vm->vm_id, i, client_id, type,
state, dir);
size -= len;
str += len;

len = snprintf(str, size,
"\t0x%016llx\t0x%016llx",
addr, val);
size -= len;
str += len;
}
}
}
}
spinlock_release(&vm_list_lock);
snprintf(str, size, "\r\n");
}
#endif /* HV_DEBUG */
4 changes: 0 additions & 4 deletions hypervisor/include/arch/x86/guest/guest.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,10 +142,6 @@ int copy_to_gva(struct vcpu *vcpu, void *h_ptr, uint64_t gva,
uint64_t create_guest_init_gdt(struct vm *vm, uint32_t *limit);
extern uint8_t vm0_boot_context;

#ifdef HV_DEBUG
void get_req_info(char *str_arg, int str_max);
#endif /* HV_DEBUG */

#endif /* !ASSEMBLER */

#endif /* GUEST_H*/

0 comments on commit 83d1ddc

Please sign in to comment.