Skip to content

Commit 97132ac

Browse files
JasonChenCJwenlingz
authored andcommitted
Make ibrs_type as internal variable
add get_ibrs_type API to get ibrs type. this patch fix Misra C violation: filename:/hypervisor/arch/x86/security.c function:None offset:19: reason:Variable should be declared static. : ibrs_type Tracked-On: #861 Signed-off-by: Jason Chen CJ <jason.cj.chen@intel.com>
1 parent 55cce7e commit 97132ac

File tree

3 files changed

+8
-2
lines changed

3 files changed

+8
-2
lines changed

hypervisor/arch/x86/guest/vcpu.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -407,6 +407,7 @@ int32_t run_vcpu(struct acrn_vcpu *vcpu)
407407
struct run_context *ctx =
408408
&vcpu->arch.contexts[vcpu->arch.cur_context].run_ctx;
409409
int64_t status = 0;
410+
int32_t ibrs_type = get_ibrs_type();
410411

411412
if (bitmap_test_and_clear_lock(CPU_REG_RIP, &vcpu->reg_updated))
412413
exec_vmwrite(VMX_GUEST_RIP, ctx->rip);

hypervisor/arch/x86/security.c

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
#include <logmsg.h>
1616

1717
static bool skip_l1dfl_vmentry;
18-
int32_t ibrs_type;
18+
static int32_t ibrs_type;
1919

2020
static void detect_ibrs(void)
2121
{
@@ -44,6 +44,11 @@ static void detect_ibrs(void)
4444
#endif
4545
}
4646

47+
int32_t get_ibrs_type(void)
48+
{
49+
return ibrs_type;
50+
}
51+
4752
bool check_cpu_security_cap(void)
4853
{
4954
uint64_t x86_arch_capabilities;

hypervisor/include/arch/x86/security.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
#define IBRS_OPT 2
1818

1919
#ifndef ASSEMBLER
20-
extern int32_t ibrs_type;
20+
int32_t get_ibrs_type(void);
2121
void cpu_l1d_flush(void);
2222
bool check_cpu_security_cap(void);
2323

0 commit comments

Comments
 (0)