Skip to content

Commit 1185884

Browse files
wuxyintellijinxia
authored andcommitted
HV:treewide:Clean up field names of struct cpuinfo_x86
In the data struct cpuinfo_x86, some field names have prefix x86, others don't have prefix. In order to unify names, update field names of struct cpuinfo_x86 as per its usage purpose, remove prefix x86. V1-->V2: Resolve conflict in cpu.c by rebase command V2-->V3: Remove track-on id as per jack's comments Signed-off-by: Xiangyang Wu <xiangyang.wu@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
1 parent abe5cb4 commit 1185884

File tree

4 files changed

+15
-15
lines changed

4 files changed

+15
-15
lines changed

hypervisor/arch/x86/cpu.c

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -87,7 +87,7 @@ static inline bool get_monitor_cap(void)
8787
* in hypervisor, but still expose it to the guests and
8888
* let them handle it correctly
8989
*/
90-
if (boot_cpu_data.x86 != 0x6U || boot_cpu_data.x86_model != 0x5cU)
90+
if (boot_cpu_data.family != 0x6U || boot_cpu_data.model != 0x5cU)
9191
return true;
9292
}
9393

@@ -114,12 +114,12 @@ static void get_cpu_capabilities(void)
114114
family = (eax >> 8U) & 0xffU;
115115
if (family == 0xFU)
116116
family += (eax >> 20U) & 0xffU;
117-
boot_cpu_data.x86 = (uint8_t)family;
117+
boot_cpu_data.family = (uint8_t)family;
118118

119119
model = (eax >> 4U) & 0xfU;
120120
if (family >= 0x06U)
121121
model += ((eax >> 16U) & 0xfU) << 4U;
122-
boot_cpu_data.x86_model = (uint8_t)model;
122+
boot_cpu_data.model = (uint8_t)model;
123123

124124

125125
cpuid(CPUID_EXTEND_FEATURE, &unused,
@@ -144,10 +144,10 @@ static void get_cpu_capabilities(void)
144144
/* EAX bits 07-00: #Physical Address Bits
145145
* bits 15-08: #Linear Address Bits
146146
*/
147-
boot_cpu_data.x86_virt_bits = (uint8_t)((eax >> 8U) & 0xffU);
148-
boot_cpu_data.x86_phys_bits = (uint8_t)(eax & 0xffU);
147+
boot_cpu_data.virt_bits = (uint8_t)((eax >> 8U) & 0xffU);
148+
boot_cpu_data.phys_bits = (uint8_t)(eax & 0xffU);
149149
boot_cpu_data.physical_address_mask =
150-
get_address_mask(boot_cpu_data.x86_phys_bits);
150+
get_address_mask(boot_cpu_data.phys_bits);
151151
}
152152

153153
/* For speculation defence.
@@ -188,8 +188,8 @@ static int hardware_detect_support(void)
188188
pr_fatal("%s, LM not supported\n", __func__);
189189
return -ENODEV;
190190
}
191-
if ((boot_cpu_data.x86_phys_bits == 0U) ||
192-
(boot_cpu_data.x86_virt_bits == 0U)) {
191+
if ((boot_cpu_data.phys_bits == 0U) ||
192+
(boot_cpu_data.virt_bits == 0U)) {
193193
pr_fatal("%s, can't detect Linear/Physical Address size\n",
194194
__func__);
195195
return -ENODEV;

hypervisor/arch/x86/guest/pm.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -111,8 +111,8 @@ void vm_setup_cpu_state(struct vm *vm)
111111
*/
112112
int vm_load_pm_s_state(struct vm *vm)
113113
{
114-
if ((boot_cpu_data.x86 == host_acpi_info.x86_family)
115-
&& (boot_cpu_data.x86_model == host_acpi_info.x86_model)) {
114+
if ((boot_cpu_data.family == host_acpi_info.x86_family)
115+
&& (boot_cpu_data.model == host_acpi_info.x86_model)) {
116116
vm->pm.sx_state_data = (struct pm_s_state_data *)
117117
&host_acpi_info.pm_s_state;
118118
pr_info("System S3/S5 is supported.");

hypervisor/arch/x86/lapic.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -386,7 +386,7 @@ send_startup_ipi(enum intr_cpu_startup_shorthand cpu_startup_shorthand,
386386
/* Give 10ms for INIT sequence to complete for old processors.
387387
* Modern processors (family == 6) don't need to wait here.
388388
*/
389-
if (boot_cpu_data.x86 != 6)
389+
if (boot_cpu_data.family != 6)
390390
mdelay(10);
391391

392392
/* De-assert INIT IPI */
@@ -404,7 +404,7 @@ send_startup_ipi(enum intr_cpu_startup_shorthand cpu_startup_shorthand,
404404
write_lapic_reg32(LAPIC_INT_COMMAND_REGISTER_0, icr.value_32.lo_32);
405405
wait_for_delivery();
406406

407-
if (boot_cpu_data.x86 == 6) /* 10us is enough for Modern processors */
407+
if (boot_cpu_data.family == 6) /* 10us is enough for Modern processors */
408408
udelay(10);
409409
else /* 200us for old processors */
410410
udelay(200);

hypervisor/include/arch/x86/cpu.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -237,9 +237,9 @@ struct cpu_state_info {
237237
};
238238

239239
struct cpuinfo_x86 {
240-
uint8_t x86, x86_model;
241-
uint8_t x86_virt_bits;
242-
uint8_t x86_phys_bits;
240+
uint8_t family, model;
241+
uint8_t virt_bits;
242+
uint8_t phys_bits;
243243
uint32_t cpuid_level;
244244
uint32_t extended_cpuid_level;
245245
uint64_t physical_address_mask;

0 commit comments

Comments
 (0)