hv: fixed compiling warning

removed some unnecessary variables and functions.

v1-->v2:
   Replace div-by-zero with an inline ASM code

Signed-off-by: Mingqiang Chi <mingqiang.chi@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
This commit is contained in:
Mingqiang Chi 2018-08-16 10:31:56 +08:00 committed by lijinxia
parent 40745d90c5
commit bdcc3aef22
12 changed files with 13 additions and 72 deletions

View File

@ -54,7 +54,6 @@ static void cpu_xsave_init(void);
static void set_current_cpu_id(uint16_t pcpu_id);
static void print_hv_banner(void);
static uint16_t get_cpu_id_from_lapic_id(uint8_t lapic_id);
static void pcpu_sync_sleep(uint64_t *sync, uint64_t mask_bit);
int ibrs_type;
static uint64_t start_tsc __attribute__((__section__(".bss_noinit")));
@ -533,7 +532,6 @@ void cpu_secondary_init(void)
static void cpu_secondary_post(void)
{
int ret;
/* Release secondary boot spin-lock to allow one of the next CPU(s) to
* perform this common initialization

View File

@ -310,7 +310,7 @@ static uint32_t get_vmcs_field(enum cpu_reg_name ident)
*/
static uint64_t vm_get_register(struct vcpu *vcpu, enum cpu_reg_name reg)
{
uint64_t reg_val;
uint64_t reg_val = 0UL;
if ((reg >= CPU_REG_GENERAL_FIRST) && (reg <= CPU_REG_GENERAL_LAST)) {
reg_val = vcpu_get_gpreg(vcpu, reg);
@ -363,7 +363,7 @@ static void vm_set_register(struct vcpu *vcpu, enum cpu_reg_name reg,
*/
static void vm_get_seg_desc(enum cpu_reg_name seg, struct seg_desc *desc)
{
struct seg_desc tdesc;
struct seg_desc tdesc = {0UL, 0U, 0U};
/* tdesc->access != 0xffffffffU in this function */
encode_vmcs_seg_desc(seg, &tdesc);

View File

@ -51,33 +51,6 @@ static void enable_msr_interception(uint8_t *bitmap, uint32_t msr_arg)
write_map[(msr>>3U)] = value;
}
/* not used now just leave it for some cases it may be used as API*/
static void disable_msr_interception(uint8_t *bitmap, uint32_t msr_arg)
{
uint8_t *read_map;
uint8_t *write_map;
uint8_t value;
uint32_t msr = msr_arg;
/* low MSR */
if (msr < 0x1FFFU) {
read_map = bitmap;
write_map = bitmap + 2048;
} else if ((msr >= 0xc0000000U) && (msr <= 0xc0001fffU)) {
read_map = bitmap + 1024;
write_map = bitmap + 3072;
} else {
pr_err("Invalid MSR");
return;
}
msr &= 0x1FFFU;
value = read_map[(msr>>3U)];
value &= ~(1U<<(msr%8U));
/* right now we trap for both r/w */
read_map[(msr>>3U)] = value;
write_map[(msr>>3U)] = value;
}
void init_msr_emulation(struct vcpu *vcpu)
{
uint32_t i;

View File

@ -391,21 +391,6 @@ void setup_ioapic_irq(void)
ASSERT(nr_gsi <= NR_MAX_GSI, "GSI table overflow");
}
static void dump_ioapic(void)
{
uint32_t irq;
for (irq = 0U; irq < nr_gsi; irq++) {
void *addr = gsi_table[irq].addr;
uint8_t pin = gsi_table[irq].pin;
union ioapic_rte rte;
ioapic_get_rte_entry(addr, pin, &rte);
dev_dbg(ACRN_DBG_IRQ, "DUMP: irq:%d pin:%hhu rte:%lx",
irq, pin, rte.full);
}
}
void suspend_ioapic(void)
{
uint8_t ioapic_id, ioapic_pin;

View File

@ -8,7 +8,7 @@
static uint32_t notification_irq = IRQ_INVALID;
static volatile uint64_t smp_call_mask = 0UL;
static uint64_t smp_call_mask = 0UL;
/* run in interrupt context */
static int kick_notification(__unused uint32_t irq, __unused void *data)
@ -98,11 +98,3 @@ void setup_notification(void)
dev_dbg(ACRN_DBG_PTIRQ, "NOTIFY: irq[%d] setup vector %x",
notification_irq, irq_to_vector(notification_irq));
}
static void cleanup_notification(void)
{
if (notification_irq != IRQ_INVALID) {
free_irq(notification_irq);
}
notification_irq = IRQ_INVALID;
}

View File

@ -194,7 +194,8 @@ void timer_init(void)
if (pcpu_id == BOOT_CPU_ID) {
register_softirq(SOFTIRQ_TIMER, timer_softirq);
if (request_timer_irq(tsc_deadline_handler, name) < 0) {
if (request_timer_irq((irq_action_t)tsc_deadline_handler, name)
< 0) {
pr_err("Timer setup failed");
return;
}

View File

@ -741,7 +741,6 @@ static void init_guest_state(struct vcpu *vcpu)
static void init_host_state(__unused struct vcpu *vcpu)
{
uint16_t value16;
uint32_t value32;
uint64_t value64;
uint64_t value;
uint64_t trbase;
@ -800,7 +799,6 @@ static void init_host_state(__unused struct vcpu *vcpu)
/* TODO: Should guest GDTB point to host GDTB ? */
/* Obtain the current global descriptor table base */
asm volatile ("sgdt %0":"=m"(gdtb)::"memory");
value32 = gdtb.limit;
if (((gdtb.base >> 47U) & 0x1UL) != 0UL) {
gdtb.base |= 0xffff000000000000UL;

View File

@ -115,12 +115,12 @@ biosacpi_search_rsdp(char *base, int length)
if (strncmp(rsdp->signature, ACPI_SIG_RSDP,
strnlen_s(ACPI_SIG_RSDP, 8)) == 0) {
cp = (uint8_t *)rsdp;
sum = NULL;
sum = 0U;
for (idx = 0; idx < RSDP_CHECKSUM_LENGTH; idx++) {
sum += *(cp + idx);
}
if (sum != NULL) {
if (sum != 0U) {
continue;
}

View File

@ -104,7 +104,7 @@ static void efi_init(void)
vm_sw_loader = uefi_sw_loader;
spurious_handler = efi_spurious_handler;
spurious_handler = (spurious_handler_t)efi_spurious_handler;
save_lapic(&uefi_lapic_regs);

View File

@ -916,7 +916,10 @@ static int shell_trigger_crash(int argc, char **argv)
(void)argv;
snprintf(str, MAX_STR_SIZE, "trigger crash, divide by 0 ...\r\n");
shell_puts(str);
snprintf(str, MAX_STR_SIZE, "%d\r", 1/0);
asm("movl $0x1, %eax");
asm("movl $0x0, %ecx");
asm("idiv %ecx");
return 0;
}

View File

@ -659,7 +659,7 @@ static int charmem(int cmd, const char *s_arg, uint32_t sz, void *hnd)
int vsnprintf(char *dst_arg, size_t sz_arg, const char *fmt, va_list args)
{
char *dst = dst_arg;
int32_t sz = sz_arg;
uint32_t sz = sz_arg;
int res = 0;
if ((sz == 0U) || (dst == NULL)) {

View File

@ -368,15 +368,6 @@ size_t strnlen_s(const char *str_arg, size_t maxlen_arg)
return count;
}
static char hexdigit(uint8_t decimal_val)
{
static const char hexdigits[] = { '0', '1', '2', '3', '4', '5', '6',
'7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
/* Return hex character */
return hexdigits[decimal_val & 0x0FU];
}
int strcmp(const char *s1_arg, const char *s2_arg)
{
const char *s1 = s1_arg;