Skip to content

Commit 5dd6e79

Browse files
lifeixwenlingz
authored andcommitted
hv: vlapic: refine vlapic_enabled to internal function
Since it's only used in vlaic.c Tracked-On: #1842 Signed-off-by: Li, Fei1 <fei1.li@intel.com> Acked-by: Anthony Xu <anthony.xu@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
1 parent e218efd commit 5dd6e79

File tree

2 files changed

+8
-17
lines changed

2 files changed

+8
-17
lines changed

hypervisor/arch/x86/guest/vlapic.c

Lines changed: 8 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,14 @@ static void vlapic_timer_expired(void *data);
101101

102102
static inline bool is_x2apic_enabled(const struct acrn_vlapic *vlapic);
103103

104+
static inline bool vlapic_enabled(const struct acrn_vlapic *vlapic)
105+
{
106+
const struct lapic_regs *lapic = &(vlapic->apic_page);
107+
108+
return (((vlapic->msr_apicbase & APICBASE_ENABLED) != 0UL) &&
109+
((lapic->svr.v & APIC_SVR_ENABLE) != 0U));
110+
}
111+
104112
static struct acrn_vlapic *
105113
vm_lapic_from_vcpu_id(struct acrn_vm *vm, uint16_t vcpu_id)
106114
{
@@ -1879,22 +1887,6 @@ vlapic_receive_intr(struct acrn_vm *vm, bool level, uint32_t dest, bool phys,
18791887
}
18801888
}
18811889

1882-
bool
1883-
vlapic_enabled(const struct acrn_vlapic *vlapic)
1884-
{
1885-
bool ret;
1886-
const struct lapic_regs *lapic = &(vlapic->apic_page);
1887-
1888-
if (((vlapic->msr_apicbase & APICBASE_ENABLED) != 0UL) &&
1889-
((lapic->svr.v & APIC_SVR_ENABLE) != 0U)) {
1890-
ret = true;
1891-
} else {
1892-
ret = false;
1893-
}
1894-
1895-
return ret;
1896-
}
1897-
18981890
/*
18991891
* @pre vcpu != NULL
19001892
* @pre vector <= 255U

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

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -242,7 +242,6 @@ void vlapic_free(struct acrn_vcpu *vcpu);
242242
void vlapic_init(struct acrn_vlapic *vlapic);
243243
void vlapic_reset(struct acrn_vlapic *vlapic);
244244
void vlapic_restore(struct acrn_vlapic *vlapic, const struct lapic_regs *regs);
245-
bool vlapic_enabled(const struct acrn_vlapic *vlapic);
246245
uint64_t vlapic_apicv_get_apic_access_addr(void);
247246
uint64_t vlapic_apicv_get_apic_page_addr(struct acrn_vlapic *vlapic);
248247
void vlapic_apicv_inject_pir(struct acrn_vlapic *vlapic);

0 commit comments

Comments
 (0)