[PATCH 02/10] HV: move global variable into the scope of calling function


YanLiang
 

From: Chaohong guo <chaohong.guo@...>

The static global variable apicv_apic_access_addr is used only by
vlapic_apicv_get_apic_access_addr(), to remove the warning by MISRA,
move it into function scope.

Signed-off-by: Chaohong guo <chaohong.guo@...>
---
hypervisor/arch/x86/guest/vlapic.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/hypervisor/arch/x86/guest/vlapic.c b/hypervisor/arch/x86/guest/vlapic.c
index 34461f58..d4457015 100644
--- a/hypervisor/arch/x86/guest/vlapic.c
+++ b/hypervisor/arch/x86/guest/vlapic.c
@@ -77,9 +77,6 @@ static inline void vlapic_dump_irr(__unused const struct acrn_vlapic *vlapic, __
static inline void vlapic_dump_isr(__unused const struct acrn_vlapic *vlapic, __unused const char *msg) {}
#endif

-/*APIC-v APIC-access address */
-static uint8_t apicv_apic_access_addr[PAGE_SIZE] __aligned(PAGE_SIZE);
-
static int32_t
apicv_set_intr_ready(struct acrn_vlapic *vlapic, uint32_t vector);

@@ -2347,6 +2344,9 @@ apicv_batch_set_tmr(const struct acrn_vlapic *vlapic)
uint64_t
vlapic_apicv_get_apic_access_addr(void)
{
+ /*APIC-v APIC-access address */
+ static uint8_t apicv_apic_access_addr[PAGE_SIZE] __aligned(PAGE_SIZE);
+
return hva2hpa(apicv_apic_access_addr);
}

--
2.19.0

Join acrn-dev@lists.projectacrn.org to automatically receive all group messages.