Skip to content

Commit c477211

Browse files
Xiangyang Wulijinxia
authored andcommitted
HV:treewide:rename struct key_info, pir_desc, map_params
For data structure types "struct key_info, struct pir_desc, struct map_params", its name is identical with variable name in the same scope. This MISRA C violation is detected by static analysis tool. Naming convention rule:If the data structure type is used by only one module and its name meaning is simplistic, its name needs prefix shorten module name. The following udpates are made: struct key_info-->struct trusty_key_info struct pir_desc-->struct vlapic_pir_desc struct map_params-->struct mem_map_params Signed-off-by: Xiangyang Wu <xiangyang.wu@linux.intel.com> Reviewed-by: Junjie Mao <junjie.mao@intel.com>
1 parent f614fcf commit c477211

File tree

9 files changed

+30
-30
lines changed

9 files changed

+30
-30
lines changed

hypervisor/arch/x86/cpu.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -375,7 +375,7 @@ void bsp_boot_init(void)
375375
* is matching the actual offset!
376376
*/
377377
ASSERT((sizeof(struct trusty_startup_param)
378-
+ sizeof(struct key_info)) < 0x1000U,
378+
+ sizeof(struct trusty_key_info)) < 0x1000U,
379379
"trusty_startup_param + key_info > 1Page size(4KB)!");
380380

381381
ASSERT(NR_WORLD == 2, "Only 2 Worlds supported!");

hypervisor/arch/x86/ept.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -469,7 +469,7 @@ int ept_misconfig_vmexit_handler(__unused struct vcpu *vcpu)
469469
int ept_mr_add(struct vm *vm, uint64_t hpa_arg,
470470
uint64_t gpa_arg, uint64_t size, uint32_t prot_arg)
471471
{
472-
struct map_params map_params;
472+
struct mem_map_params map_params;
473473
uint16_t i;
474474
struct vcpu *vcpu;
475475
uint64_t hpa = hpa_arg;

hypervisor/arch/x86/guest/vlapic.c

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1563,7 +1563,7 @@ vlapic_reset(struct acrn_vlapic *vlapic)
15631563
apic_page = (void *)vlapic->apic_page;
15641564
(void)memset(apic_page, 0U, CPU_PAGE_SIZE);
15651565
if (vlapic->pir_desc) {
1566-
(void)memset(vlapic->pir_desc, 0U, sizeof(struct pir_desc));
1566+
(void)memset(vlapic->pir_desc, 0U, sizeof(struct vlapic_pir_desc));
15671567
}
15681568

15691569
lapic->id = vlapic_build_id(vlapic);
@@ -2108,7 +2108,7 @@ int vlapic_create(struct vcpu *vcpu)
21082108
vlapic->ops.apicv_batch_set_tmr =
21092109
apicv_batch_set_tmr;
21102110

2111-
vlapic->pir_desc = (struct pir_desc *)(&(vlapic->pir));
2111+
vlapic->pir_desc = (struct vlapic_pir_desc *)(&(vlapic->pir));
21122112
}
21132113

21142114
if (is_vcpu_bsp(vcpu)) {
@@ -2174,7 +2174,7 @@ void vlapic_free(struct vcpu *vcpu)
21742174
static int
21752175
apicv_set_intr_ready(struct acrn_vlapic *vlapic, uint32_t vector, __unused bool level)
21762176
{
2177-
struct pir_desc *pir_desc;
2177+
struct vlapic_pir_desc *pir_desc;
21782178
uint64_t mask;
21792179
uint32_t idx;
21802180
int32_t notify;
@@ -2192,7 +2192,7 @@ apicv_set_intr_ready(struct acrn_vlapic *vlapic, uint32_t vector, __unused bool
21922192
static int
21932193
apicv_pending_intr(struct acrn_vlapic *vlapic, __unused uint32_t *vecptr)
21942194
{
2195-
struct pir_desc *pir_desc;
2195+
struct vlapic_pir_desc *pir_desc;
21962196
struct lapic_regs *lapic;
21972197
uint64_t pending, pirval;
21982198
uint32_t i, ppr, vpr;
@@ -2301,7 +2301,7 @@ apicv_get_apic_page_addr(struct acrn_vlapic *vlapic)
23012301
void
23022302
apicv_inject_pir(struct acrn_vlapic *vlapic)
23032303
{
2304-
struct pir_desc *pir_desc;
2304+
struct vlapic_pir_desc *pir_desc;
23052305
struct lapic_regs *lapic;
23062306
uint64_t val, pirval;
23072307
uint16_t rvi, pirbase = 0U, i;

hypervisor/arch/x86/guest/vlapic_priv.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@
9191

9292
struct acrn_vlapic;
9393

94-
struct pir_desc {
94+
struct vlapic_pir_desc {
9595
uint64_t pir[4];
9696
uint64_t pending;
9797
uint64_t unused[3];
@@ -119,7 +119,7 @@ struct acrn_vlapic {
119119
struct vm *vm;
120120
struct vcpu *vcpu;
121121
struct lapic_regs *apic_page;
122-
struct pir_desc *pir_desc;
122+
struct vlapic_pir_desc *pir_desc;
123123
struct vlapic_ops ops;
124124

125125
uint32_t esr_pending;
@@ -154,7 +154,7 @@ struct acrn_vlapic {
154154
*/
155155
uint32_t svr_last;
156156
uint32_t lvt_last[VLAPIC_MAXLVT_INDEX + 1];
157-
struct pir_desc pir;
157+
struct vlapic_pir_desc pir;
158158
};
159159

160160
#endif /* _VLAPIC_PRIV_H_ */

hypervisor/arch/x86/mmu.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -424,7 +424,7 @@ static int get_table_entry(void *addr, void *table_base,
424424
}
425425

426426
static void *walk_paging_struct(void *addr, void *table_base,
427-
uint32_t table_level, struct map_params *map_params,
427+
uint32_t table_level, struct mem_map_params *map_params,
428428
uint64_t attr)
429429
{
430430
uint32_t table_offset;
@@ -608,7 +608,7 @@ bool check_continuous_hpa(struct vm *vm, uint64_t gpa_arg, uint64_t size_arg)
608608

609609
}
610610

611-
int obtain_last_page_table_entry(struct map_params *map_params,
611+
int obtain_last_page_table_entry(struct mem_map_params *map_params,
612612
struct entry_params *entry, void *addr, bool direct)
613613
{
614614
uint64_t table_entry;
@@ -732,7 +732,7 @@ int obtain_last_page_table_entry(struct map_params *map_params,
732732
return 0;
733733
}
734734

735-
static uint64_t update_page_table_entry(struct map_params *map_params,
735+
static uint64_t update_page_table_entry(struct mem_map_params *map_params,
736736
void *paddr, void *vaddr, uint64_t size, uint64_t attr,
737737
bool direct)
738738
{
@@ -792,7 +792,7 @@ static uint64_t update_page_table_entry(struct map_params *map_params,
792792
return adjustment_size;
793793
}
794794

795-
static uint64_t break_page_table(struct map_params *map_params, void *paddr,
795+
static uint64_t break_page_table(struct mem_map_params *map_params, void *paddr,
796796
void *vaddr, uint64_t page_size, bool direct)
797797
{
798798
uint32_t i = 0U;
@@ -889,7 +889,7 @@ static uint64_t break_page_table(struct map_params *map_params, void *paddr,
889889
return next_page_size;
890890
}
891891

892-
static int modify_paging(struct map_params *map_params, void *paddr_arg,
892+
static int modify_paging(struct mem_map_params *map_params, void *paddr_arg,
893893
void *vaddr_arg, uint64_t size, uint32_t flags, bool direct)
894894
{
895895
void *vaddr = vaddr_arg;
@@ -978,7 +978,7 @@ static int modify_paging(struct map_params *map_params, void *paddr_arg,
978978
return 0;
979979
}
980980

981-
int map_mem(struct map_params *map_params, void *paddr, void *vaddr,
981+
int map_mem(struct mem_map_params *map_params, void *paddr, void *vaddr,
982982
uint64_t size, uint32_t flags)
983983
{
984984
int ret = 0;

hypervisor/arch/x86/trusty.c

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ struct trusty_mem {
1616
*/
1717
union {
1818
struct {
19-
struct key_info key_info;
19+
struct trusty_key_info key_info;
2020
struct trusty_startup_param startup_param;
2121
} data;
2222
uint8_t page[CPU_PAGE_SIZE];
@@ -27,7 +27,7 @@ struct trusty_mem {
2727
uint8_t left_mem[0];
2828
};
2929

30-
static struct key_info g_key_info = {
30+
static struct trusty_key_info g_key_info = {
3131
.size_of_this_struct = sizeof(g_key_info),
3232
.version = 0U,
3333
.platform = 3U,
@@ -78,7 +78,7 @@ static void create_secure_world_ept(struct vm *vm, uint64_t gpa_orig,
7878
{
7979
uint64_t nworld_pml4e = 0UL;
8080
uint64_t sworld_pml4e = 0UL;
81-
struct map_params map_params;
81+
struct mem_map_params map_params;
8282
uint64_t gpa = 0UL;
8383
uint64_t hpa = gpa2hpa(vm, gpa_orig);
8484
uint64_t table_present = (IA32E_EPT_R_BIT |
@@ -179,7 +179,7 @@ static void create_secure_world_ept(struct vm *vm, uint64_t gpa_orig,
179179

180180
void destroy_secure_world(struct vm *vm)
181181
{
182-
struct map_params map_params;
182+
struct mem_map_params map_params;
183183
struct vm *vm0 = get_vm_from_vmid(0U);
184184

185185
if (vm0 == NULL) {
@@ -347,7 +347,7 @@ static bool setup_trusty_info(struct vcpu *vcpu,
347347
{
348348
uint32_t i;
349349
struct trusty_mem *mem;
350-
struct key_info *key_info;
350+
struct trusty_key_info *key_info;
351351

352352
mem = (struct trusty_mem *)(HPA2HVA(mem_base_hpa));
353353

@@ -366,7 +366,7 @@ static bool setup_trusty_info(struct vcpu *vcpu,
366366
BUP_MKHI_BOOTLOADER_SEED_LEN,
367367
NULL, 0U,
368368
vcpu->vm->GUID, sizeof(vcpu->vm->GUID)) == 0) {
369-
(void)memset(key_info, 0U, sizeof(struct key_info));
369+
(void)memset(key_info, 0U, sizeof(struct trusty_key_info));
370370
pr_err("%s: derive dvseed failed!", __func__);
371371
return false;
372372
}
@@ -385,7 +385,7 @@ static bool setup_trusty_info(struct vcpu *vcpu,
385385
* is put in the first page of trusty memory just followed by key_info.
386386
*/
387387
vcpu->arch_vcpu.contexts[SECURE_WORLD].guest_cpu_regs.regs.rdi
388-
= (uint64_t)TRUSTY_EPT_REBASE_GPA + sizeof(struct key_info);
388+
= (uint64_t)TRUSTY_EPT_REBASE_GPA + sizeof(struct trusty_key_info);
389389

390390
return true;
391391
}

hypervisor/arch/x86/trusty2.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ uint64_t gpa2hpa_for_trusty(struct vm *vm, uint64_t gpa)
1313
{
1414
uint64_t hpa = 0UL;
1515
struct entry_params entry;
16-
struct map_params map_params;
16+
struct mem_map_params map_params;
1717

1818
map_params.page_table_type = PTT_EPT;
1919
map_params.pml4_base = vm->arch_vm.sworld_eptp;
@@ -58,7 +58,7 @@ void create_secure_world_ept(struct vm *vm, uint64_t gpa_orig,
5858
uint64_t nworld_pml4e = 0UL;
5959
uint64_t sworld_pml4e = 0UL;
6060
struct entry_params entry;
61-
struct map_params map_params;
61+
struct mem_map_params map_params;
6262
uint64_t gpa_uos = gpa_orig;
6363
uint64_t gpa_sos;
6464
uint64_t adjust_size;
@@ -158,7 +158,7 @@ void create_secure_world_ept(struct vm *vm, uint64_t gpa_orig,
158158
void destroy_secure_world(struct vm *vm)
159159
{
160160

161-
struct map_params map_params;
161+
struct mem_map_params map_params;
162162
struct entry_params entry;
163163
struct vm *vm0 = get_vm_from_vmid(0);
164164
uint64_t hpa;

hypervisor/include/arch/x86/mmu.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -220,7 +220,7 @@ enum _page_table_type {
220220
PAGETABLE_TYPE_UNKNOWN,
221221
};
222222

223-
struct map_params {
223+
struct mem_map_params {
224224
/* enum _page_table_type: HOST or EPT*/
225225
enum _page_table_type page_table_type;
226226
/* used HVA->HPA for HOST, used GPA->HPA for EPT */
@@ -310,7 +310,7 @@ void free_paging_struct(void *ptr);
310310
void enable_paging(uint64_t pml4_base_addr);
311311
void enable_smep(void);
312312
void init_paging(void);
313-
int map_mem(struct map_params *map_params, void *paddr, void *vaddr,
313+
int map_mem(struct mem_map_params *map_params, void *paddr, void *vaddr,
314314
uint64_t size, uint32_t flags);
315315
int mmu_add(uint64_t *pml4_page, uint64_t paddr_base,
316316
uint64_t vaddr_base, uint64_t size,
@@ -325,7 +325,7 @@ void flush_vpid_single(uint16_t vpid);
325325
void flush_vpid_global(void);
326326
void invept(struct vcpu *vcpu);
327327
bool check_continuous_hpa(struct vm *vm, uint64_t gpa_arg, uint64_t size_arg);
328-
int obtain_last_page_table_entry(struct map_params *map_params,
328+
int obtain_last_page_table_entry(struct mem_map_params *map_params,
329329
struct entry_params *entry, void *addr, bool direct);
330330
uint64_t *lookup_address(uint64_t *pml4_page, uint64_t addr,
331331
uint64_t *pg_size, enum _page_table_type ptt);

hypervisor/include/arch/x86/trusty.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ struct seed_info {
2929
};
3030

3131
/* Structure of key info */
32-
struct key_info {
32+
struct trusty_key_info {
3333
uint32_t size_of_this_struct;
3434

3535
/* version info:

0 commit comments

Comments
 (0)