hv: fix misra-c violations in reused partition mode functions
Fixed violations in vlapic_x2apic_pt_icr_access() - Procedure has more than one exit point; - Value is not of appropriate type; - Narrower init conversion without cast; - Implicit conversion: actual to formal param (MR) Fixed violation in switch_apicv_mode_x2apic() - No space between if, while, for and expresn. Tracked-On: #861 Signed-off-by: Yan, Like <like.yan@intel.com>
This commit is contained in:
parent
7d4ba5d7f7
commit
b038ade21c
|
@ -2075,13 +2075,14 @@ static inline uint32_t x2apic_msr_to_regoff(uint32_t msr)
|
|||
static int32_t
|
||||
vlapic_x2apic_pt_icr_access(struct acrn_vm *vm, uint64_t val)
|
||||
{
|
||||
uint64_t apic_id = (uint32_t) (val >> 32U);
|
||||
uint32_t icr_low = val;
|
||||
uint32_t apic_id = (uint32_t)(val >> 32U);
|
||||
uint32_t icr_low = (uint32_t)val;
|
||||
uint32_t mode = icr_low & APIC_DELMODE_MASK;
|
||||
uint16_t vcpu_id;
|
||||
struct acrn_vcpu *target_vcpu;
|
||||
bool phys;
|
||||
uint32_t shorthand;
|
||||
int32_t ret = 0;
|
||||
|
||||
phys = ((icr_low & APIC_DESTMODE_LOG) == 0UL);
|
||||
shorthand = icr_low & APIC_DEST_MASK;
|
||||
|
@ -2089,27 +2090,26 @@ vlapic_x2apic_pt_icr_access(struct acrn_vm *vm, uint64_t val)
|
|||
if ((phys == false) || (shorthand != APIC_DEST_DESTFLD)) {
|
||||
pr_err("Logical destination mode or shorthands \
|
||||
not supported in ICR forpartition mode\n");
|
||||
return -1;
|
||||
}
|
||||
ret = -1;
|
||||
} else {
|
||||
vcpu_id = vm_apicid2vcpu_id(vm, apic_id);
|
||||
target_vcpu = vcpu_from_vid(vm, vcpu_id);
|
||||
|
||||
vcpu_id = vm_apicid2vcpu_id(vm, apic_id);
|
||||
target_vcpu = vcpu_from_vid(vm, vcpu_id);
|
||||
|
||||
if (target_vcpu == NULL) {
|
||||
return 0;
|
||||
if (target_vcpu != NULL) {
|
||||
switch (mode) {
|
||||
case APIC_DELMODE_INIT:
|
||||
vlapic_process_init_sipi(target_vcpu, mode, icr_low, vcpu_id);
|
||||
break;
|
||||
case APIC_DELMODE_STARTUP:
|
||||
vlapic_process_init_sipi(target_vcpu, mode, icr_low, vcpu_id);
|
||||
break;
|
||||
default:
|
||||
msr_write(MSR_IA32_EXT_APIC_ICR, (((uint64_t)apic_id) << 32U) | icr_low);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
switch (mode) {
|
||||
case APIC_DELMODE_INIT:
|
||||
vlapic_process_init_sipi(target_vcpu, mode, icr_low, vcpu_id);
|
||||
break;
|
||||
case APIC_DELMODE_STARTUP:
|
||||
vlapic_process_init_sipi(target_vcpu, mode, icr_low, vcpu_id);
|
||||
break;
|
||||
default:
|
||||
msr_write(MSR_IA32_EXT_APIC_ICR, (apic_id << 32U) | icr_low);
|
||||
break;
|
||||
}
|
||||
return 0;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int32_t vlapic_x2apic_access(struct acrn_vcpu *vcpu, uint32_t msr, bool write,
|
||||
|
|
|
@ -563,7 +563,7 @@ void init_vmcs(struct acrn_vcpu *vcpu)
|
|||
void switch_apicv_mode_x2apic(struct acrn_vcpu *vcpu)
|
||||
{
|
||||
uint32_t value32;
|
||||
if(is_lapic_pt(vcpu->vm)) {
|
||||
if (is_lapic_pt(vcpu->vm)) {
|
||||
/*
|
||||
* Disable external interrupt exiting and irq ack
|
||||
* Disable posted interrupt processing
|
||||
|
|
Loading…
Reference in New Issue