mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-19 20:22:46 +00:00
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
|
static int32_t
|
||||||
vlapic_x2apic_pt_icr_access(struct acrn_vm *vm, uint64_t val)
|
vlapic_x2apic_pt_icr_access(struct acrn_vm *vm, uint64_t val)
|
||||||
{
|
{
|
||||||
uint64_t apic_id = (uint32_t) (val >> 32U);
|
uint32_t apic_id = (uint32_t)(val >> 32U);
|
||||||
uint32_t icr_low = val;
|
uint32_t icr_low = (uint32_t)val;
|
||||||
uint32_t mode = icr_low & APIC_DELMODE_MASK;
|
uint32_t mode = icr_low & APIC_DELMODE_MASK;
|
||||||
uint16_t vcpu_id;
|
uint16_t vcpu_id;
|
||||||
struct acrn_vcpu *target_vcpu;
|
struct acrn_vcpu *target_vcpu;
|
||||||
bool phys;
|
bool phys;
|
||||||
uint32_t shorthand;
|
uint32_t shorthand;
|
||||||
|
int32_t ret = 0;
|
||||||
|
|
||||||
phys = ((icr_low & APIC_DESTMODE_LOG) == 0UL);
|
phys = ((icr_low & APIC_DESTMODE_LOG) == 0UL);
|
||||||
shorthand = icr_low & APIC_DEST_MASK;
|
shorthand = icr_low & APIC_DEST_MASK;
|
||||||
@ -2089,15 +2090,12 @@ vlapic_x2apic_pt_icr_access(struct acrn_vm *vm, uint64_t val)
|
|||||||
if ((phys == false) || (shorthand != APIC_DEST_DESTFLD)) {
|
if ((phys == false) || (shorthand != APIC_DEST_DESTFLD)) {
|
||||||
pr_err("Logical destination mode or shorthands \
|
pr_err("Logical destination mode or shorthands \
|
||||||
not supported in ICR forpartition mode\n");
|
not supported in ICR forpartition mode\n");
|
||||||
return -1;
|
ret = -1;
|
||||||
}
|
} else {
|
||||||
|
|
||||||
vcpu_id = vm_apicid2vcpu_id(vm, apic_id);
|
vcpu_id = vm_apicid2vcpu_id(vm, apic_id);
|
||||||
target_vcpu = vcpu_from_vid(vm, vcpu_id);
|
target_vcpu = vcpu_from_vid(vm, vcpu_id);
|
||||||
|
|
||||||
if (target_vcpu == NULL) {
|
if (target_vcpu != NULL) {
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
switch (mode) {
|
switch (mode) {
|
||||||
case APIC_DELMODE_INIT:
|
case APIC_DELMODE_INIT:
|
||||||
vlapic_process_init_sipi(target_vcpu, mode, icr_low, vcpu_id);
|
vlapic_process_init_sipi(target_vcpu, mode, icr_low, vcpu_id);
|
||||||
@ -2106,10 +2104,12 @@ vlapic_x2apic_pt_icr_access(struct acrn_vm *vm, uint64_t val)
|
|||||||
vlapic_process_init_sipi(target_vcpu, mode, icr_low, vcpu_id);
|
vlapic_process_init_sipi(target_vcpu, mode, icr_low, vcpu_id);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
msr_write(MSR_IA32_EXT_APIC_ICR, (apic_id << 32U) | icr_low);
|
msr_write(MSR_IA32_EXT_APIC_ICR, (((uint64_t)apic_id) << 32U) | icr_low);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return 0;
|
}
|
||||||
|
}
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int32_t vlapic_x2apic_access(struct acrn_vcpu *vcpu, uint32_t msr, bool write,
|
static int32_t vlapic_x2apic_access(struct acrn_vcpu *vcpu, uint32_t msr, bool write,
|
||||||
|
Loading…
Reference in New Issue
Block a user