mirror of
https://github.com/qemu/qemu.git
synced 2026-02-04 02:24:38 +00:00
target/i386: Define enum X86ASIdx for x86's address spaces
Define X86ASIdx as enum, like ARM's ARMASIdx, so that it's clear index 0 is for memory and index 1 is for SMM. Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org> Reviewed-by: Zhao Liu <zhao1.liu@intel.com> Tested-By: Kirill Martynov <stdcalllevi@yandex-team.ru> Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com> Link: https://lore.kernel.org/r/20250730095253.1833411-3-xiaoyao.li@intel.com Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
committed by
Paolo Bonzini
parent
0516f4b702
commit
591f817d81
@@ -2574,6 +2574,11 @@ static inline bool x86_has_cpuid_0x1f(X86CPU *cpu)
|
||||
void x86_cpu_set_a20(X86CPU *cpu, int a20_state);
|
||||
void cpu_sync_avx_hflag(CPUX86State *env);
|
||||
|
||||
typedef enum X86ASIdx {
|
||||
X86ASIdx_MEM = 0,
|
||||
X86ASIdx_SMM = 1,
|
||||
} X86ASIdx;
|
||||
|
||||
#ifndef CONFIG_USER_ONLY
|
||||
static inline int x86_asidx_from_attrs(CPUState *cs, MemTxAttrs attrs)
|
||||
{
|
||||
|
||||
@@ -99,7 +99,7 @@ static bool kvm_cpu_realizefn(CPUState *cs, Error **errp)
|
||||
* initialized at register_smram_listener() after machine init done.
|
||||
*/
|
||||
cs->num_ases = x86_machine_is_smm_enabled(X86_MACHINE(current_machine)) ? 2 : 1;
|
||||
cpu_address_space_init(cs, 0, "cpu-memory", cs->memory);
|
||||
cpu_address_space_init(cs, X86ASIdx_MEM, "cpu-memory", cs->memory);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -2728,10 +2728,10 @@ static void register_smram_listener(Notifier *n, void *unused)
|
||||
|
||||
address_space_init(&smram_address_space, &smram_as_root, "KVM-SMRAM");
|
||||
kvm_memory_listener_register(kvm_state, &smram_listener,
|
||||
&smram_address_space, 1, "kvm-smram");
|
||||
&smram_address_space, X86ASIdx_SMM, "kvm-smram");
|
||||
|
||||
CPU_FOREACH(cpu) {
|
||||
cpu_address_space_init(cpu, 1, "cpu-smm", &smram_as_root);
|
||||
cpu_address_space_init(cpu, X86ASIdx_SMM, "cpu-smm", &smram_as_root);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -74,8 +74,8 @@ bool tcg_cpu_realizefn(CPUState *cs, Error **errp)
|
||||
memory_region_set_enabled(cpu->cpu_as_mem, true);
|
||||
|
||||
cs->num_ases = 2;
|
||||
cpu_address_space_init(cs, 0, "cpu-memory", cs->memory);
|
||||
cpu_address_space_init(cs, 1, "cpu-smm", cpu->cpu_as_root);
|
||||
cpu_address_space_init(cs, X86ASIdx_MEM, "cpu-memory", cs->memory);
|
||||
cpu_address_space_init(cs, X86ASIdx_SMM, "cpu-smm", cpu->cpu_as_root);
|
||||
|
||||
/* ... SMRAM with higher priority, linked from /machine/smram. */
|
||||
cpu->machine_done.notify = tcg_cpu_machine_done;
|
||||
|
||||
Reference in New Issue
Block a user