target-i386: Some CPUX86State -> X86CPU conversions
PATCH 1/5 target-i386: Use X86CPU on cpu_x86_support_mca_broadcast()
In reply to Eduardo HabkostSigned-off-by Eduardo Habkost <[email protected]>
--- target-i386/cpu.h | 2 +- target-i386/helper.c | 6 +++--- target-i386/kvm.c | 3 +-- 3 files changed, 5 insertions(+), 6 deletions(-)
target-i386/cpu.h +1 -1
@@ -984,7 +984,7 @@ X86CPU *cpu_x86_create(const char *cpu_model, Error **errp);int cpu_x86_exec (CPUX86State *s);void x86_cpu_list (FILE *f,fprintf_function cpu_fprintf);void x86_cpudef_setup (void ); -int cpu_x86_support_mca_broadcast (CPUX86State *env); +int cpu_x86_support_mca_broadcast (X86CPU *cpu);int cpu_get_pic_interrupt (CPUX86State *s);/* MSDOS compatibility mode FPU exception support */
target-i386/helper.c +3 -3
@@ -38,12 +38,12 @@ static void cpu_x86_version(CPUX86State *env, int *family, int *model) }/* Broadcast MCA signal for processor version 06H_EH and above */ -int cpu_x86_support_mca_broadcast (CPUX86State *env) +int cpu_x86_support_mca_broadcast (X86CPU *cpu) {int family =0 ;int model =0 ; -cpu_x86_version (env, &family, &model); +cpu_x86_version (&cpu->env, &family, &model);if ((family ==6 && model >=14 ) || family >6 ) {return 1 ; }
@@ -1148,7 +1148,7 @@ void cpu_x86_inject_mce(Monitor *mon, X86CPU *cpu, int bank,return ; }if ((flags &MCE_INJECT_BROADCAST ) - && !cpu_x86_support_mca_broadcast (cenv)) { + && !cpu_x86_support_mca_broadcast (cpu)) {monitor_printf (mon,"Guest CPU does not support MCA broadcast\n" );return ; }
target-i386/kvm.c +1 -2
@@ -298,7 +298,6 @@ static int kvm_get_mce_cap_supported(KVMState *s, uint64_t *mce_cap,static void kvm_mce_inject (X86CPU *cpu,hwaddr paddr,int code) { -CPUX86State *env = &cpu->env;uint64_t status =MCI_STATUS_VAL |MCI_STATUS_UC |MCI_STATUS_EN |MCI_STATUS_MISCV |MCI_STATUS_ADDRV |MCI_STATUS_S ;uint64_t mcg_status =MCG_STATUS_MCIP ;
@@ -312,7 +311,7 @@ static void kvm_mce_inject(X86CPU *cpu, hwaddr paddr, int code) }cpu_x86_inject_mce (NULL , cpu,9 , status, mcg_status, paddr, (MCM_ADDR_PHYS <<6 ) |0xc , -cpu_x86_support_mca_broadcast (env) ? +cpu_x86_support_mca_broadcast (cpu) ?MCE_INJECT_BROADCAST :0 ); }
Signature · 1 line
2.1.0
PATCH 2/5 target-i386: Use X86CPU on cpu_x86_version()
In reply to Eduardo HabkostSigned-off-by Eduardo Habkost <[email protected]>
--- target-i386/helper.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
target-i386/helper.c +3 -3
@@ -25,9 +25,9 @@#include "monitor/monitor.h" #endif -static void cpu_x86_version (CPUX86State *env,int *family,int *model) +static void cpu_x86_version (X86CPU *cpu,int *family,int *model) { -int cpuver = env->cpuid_version; +int cpuver = cpu->env.cpuid_version;if (family ==NULL || model ==NULL ) {return ;
@@ -43,7 +43,7 @@ int cpu_x86_support_mca_broadcast(X86CPU *cpu)int family =0 ;int model =0 ; -cpu_x86_version (&cpu->env, &family, &model); +cpu_x86_version (cpu, &family, &model);if ((family ==6 && model >=14 ) || family >6 ) {return 1 ; }
Signature · 1 line
2.1.0
cover target-i386: Some CPUX86State -> X86CPU conversions
Eduardo Habkost (5):
target-i386: Use X86CPU on cpu_x86_support_mca_broadcast()
target-i386: Use X86CPU on cpu_x86_version()
target-i386: Use X86CPU on cpu_get_pic_interrupt()
target-i386: Use X86CPU on cpu_report_tpr_access()
target-i386: Use X86CPU on cpu_x86_cpuid()
bsd-user/main.c | 2 +- hw/i386/pc.c | 3 +-- hw/intc/apic.c | 4 ++-- linux-user/main.c | 2 +- target-i386/cpu.c | 4 ++-- target-i386/cpu.h | 8 ++++---- target-i386/helper.c | 17 ++++++++--------- target-i386/kvm.c | 25 ++++++++++++------------- target-i386/misc_helper.c | 3 ++- target-i386/seg_helper.c | 2 +- 10 files changed, 34 insertions(+), 36 deletions(-)
Signature · 1 line
2.1.0
PATCH 4/5 target-i386: Use X86CPU on cpu_report_tpr_access()
Signed-off-by Eduardo Habkost <[email protected]>
--- hw/intc/apic.c | 4 ++-- target-i386/cpu.h | 2 +- target-i386/helper.c | 7 +++---- 3 files changed, 6 insertions(+), 7 deletions(-)
hw/intc/apic.c +2 -2
@@ -684,7 +684,7 @@ static uint32_t apic_mem_readl(void *opaque, hwaddr addr)case 0x08 :apic_sync_vapic (s,SYNC_FROM_VAPIC );if (apic_report_tpr_access) { -cpu_report_tpr_access (&s->cpu->env,TPR_ACCESS_READ ); +cpu_report_tpr_access (s->cpu,TPR_ACCESS_READ ); } val = s->tpr;break ;
@@ -786,7 +786,7 @@ static void apic_mem_writel(void *opaque, hwaddr addr, uint32_t val)break ;case 0x08 :if (apic_report_tpr_access) { -cpu_report_tpr_access (&s->cpu->env,TPR_ACCESS_WRITE ); +cpu_report_tpr_access (s->cpu,TPR_ACCESS_WRITE ); } s->tpr = val;apic_sync_vapic (s,SYNC_TO_VAPIC );
target-i386/cpu.h +1 -1
@@ -1306,7 +1306,7 @@ void do_interrupt_x86_hardirq(CPUX86State *env, int intno, int is_hw);void do_smm_enter (X86CPU *cpu); -void cpu_report_tpr_access (CPUX86State *env,TPRAccess access); +void cpu_report_tpr_access (X86CPU *cpu,TPRAccess access);void x86_cpu_compat_set_features (const char *cpu_model,FeatureWord w,uint32_t feat_add,uint32_t feat_remove);
target-i386/helper.c +3 -4
@@ -1172,19 +1172,18 @@ void cpu_x86_inject_mce(Monitor *mon, X86CPU *cpu, int bank, } } -void cpu_report_tpr_access (CPUX86State *env,TPRAccess access) +void cpu_report_tpr_access (X86CPU *cpu,TPRAccess access) { -X86CPU *cpu =x86_env_get_cpu (env);CPUState *cs =CPU (cpu);if (kvm_enabled ()) { - env->tpr_access_type = access; + cpu->env.tpr_access_type = access;cpu_interrupt (cs,CPU_INTERRUPT_TPR ); }else {cpu_restore_state (cs, cs->mem_io_pc); -apic_handle_tpr_access_report (cpu->apic_state, env->eip, access); +apic_handle_tpr_access_report (cpu->apic_state, cpu->env.eip, access); } }#endif /* !CONFIG_USER_ONLY */
Signature · 1 line
2.1.0
PATCH 5/5 target-i386: Use X86CPU on cpu_x86_cpuid()
In reply to Eduardo HabkostSigned-off-by Eduardo Habkost <[email protected]>
--- target-i386/cpu.c | 4 ++-- target-i386/cpu.h | 2 +- target-i386/kvm.c | 20 ++++++++++---------- target-i386/misc_helper.c | 3 ++- 4 files changed, 15 insertions(+), 14 deletions(-)
target-i386/cpu.c +2 -2
@@ -2233,11 +2233,11 @@ void x86_cpudef_setup(void) } } -void cpu_x86_cpuid (CPUX86State *env,uint32_t index,uint32_t count, +void cpu_x86_cpuid (X86CPU *cpu,uint32_t index,uint32_t count,uint32_t *eax,uint32_t *ebx,uint32_t *ecx,uint32_t *edx) { -X86CPU *cpu =x86_env_get_cpu (env); +CPUX86State *env = &cpu->env;CPUState *cs =CPU (cpu);/* test if maximum index reached */
target-i386/cpu.h +1 -1
@@ -1093,7 +1093,7 @@ int cpu_x86_signal_handler(int host_signum, void *pinfo, void *puc);/* cpuid.c */ -void cpu_x86_cpuid (CPUX86State *env,uint32_t index,uint32_t count, +void cpu_x86_cpuid (X86CPU *cpu,uint32_t index,uint32_t count,uint32_t *eax,uint32_t *ebx,uint32_t *ecx,uint32_t *edx);void cpu_clear_apic_feature (CPUX86State *env);
target-i386/kvm.c +10 -10
@@ -553,7 +553,7 @@ int kvm_arch_init_vcpu(CPUState *cs) has_msr_kvm_steal_time = c->eax & (1 <<KVM_FEATURE_STEAL_TIME ); } -cpu_x86_cpuid (env,0 ,0 , &limit, &unused, &unused, &unused); +cpu_x86_cpuid (cpu,0 ,0 , &limit, &unused, &unused, &unused);for (i =0 ; i <= limit; i++) {if (cpuid_i ==KVM_MAX_CPUID_ENTRIES ) {
@@ -570,7 +570,7 @@ int kvm_arch_init_vcpu(CPUState *cs) c->function = i; c->flags =KVM_CPUID_FLAG_STATEFUL_FUNC |KVM_CPUID_FLAG_STATE_READ_NEXT ; -cpu_x86_cpuid (env, i,0 , &c->eax, &c->ebx, &c->ecx, &c->edx); +cpu_x86_cpuid (cpu, i,0 , &c->eax, &c->ebx, &c->ecx, &c->edx); times = c->eax &0xff ;for (j =1 ; j < times; ++j) {
@@ -582,7 +582,7 @@ int kvm_arch_init_vcpu(CPUState *cs) c = &cpuid_data.entries[cpuid_i++]; c->function = i; c->flags =KVM_CPUID_FLAG_STATEFUL_FUNC ; -cpu_x86_cpuid (env, i,0 , &c->eax, &c->ebx, &c->ecx, &c->edx); +cpu_x86_cpuid (cpu, i,0 , &c->eax, &c->ebx, &c->ecx, &c->edx); }break ; }
@@ -596,7 +596,7 @@ int kvm_arch_init_vcpu(CPUState *cs) c->function = i; c->flags =KVM_CPUID_FLAG_SIGNIFCANT_INDEX ; c->index = j; -cpu_x86_cpuid (env, i, j, &c->eax, &c->ebx, &c->ecx, &c->edx); +cpu_x86_cpuid (cpu, i, j, &c->eax, &c->ebx, &c->ecx, &c->edx);if (i ==4 && c->eax ==0 ) {break ;
@@ -618,7 +618,7 @@ int kvm_arch_init_vcpu(CPUState *cs)default : c->function = i; c->flags =0 ; -cpu_x86_cpuid (env, i,0 , &c->eax, &c->ebx, &c->ecx, &c->edx); +cpu_x86_cpuid (cpu, i,0 , &c->eax, &c->ebx, &c->ecx, &c->edx);break ; } }
@@ -626,7 +626,7 @@ int kvm_arch_init_vcpu(CPUState *cs)if (limit >=0x0a ) {uint32_t ver; -cpu_x86_cpuid (env,0x0a ,0 , &ver, &unused, &unused, &unused); +cpu_x86_cpuid (cpu,0x0a ,0 , &ver, &unused, &unused, &unused);if ((ver &0xff ) >0 ) { has_msr_architectural_pmu = true; num_architectural_pmu_counters = (ver &0xff00 ) >>8 ;
@@ -641,7 +641,7 @@ int kvm_arch_init_vcpu(CPUState *cs) } } -cpu_x86_cpuid (env,0x80000000 ,0 , &limit, &unused, &unused, &unused); +cpu_x86_cpuid (cpu,0x80000000 ,0 , &limit, &unused, &unused, &unused);for (i =0x80000000 ; i <= limit; i++) {if (cpuid_i ==KVM_MAX_CPUID_ENTRIES ) {
@@ -652,12 +652,12 @@ int kvm_arch_init_vcpu(CPUState *cs) c->function = i; c->flags =0 ; -cpu_x86_cpuid (env, i,0 , &c->eax, &c->ebx, &c->ecx, &c->edx); +cpu_x86_cpuid (cpu, i,0 , &c->eax, &c->ebx, &c->ecx, &c->edx); }/* Call Centaur's CPUID instructions they are supported. */ if (env->cpuid_xlevel2 >0 ) { -cpu_x86_cpuid (env,0xC0000000 ,0 , &limit, &unused, &unused, &unused); +cpu_x86_cpuid (cpu,0xC0000000 ,0 , &limit, &unused, &unused, &unused);for (i =0xC0000000 ; i <= limit; i++) {if (cpuid_i ==KVM_MAX_CPUID_ENTRIES ) {
@@ -668,7 +668,7 @@ int kvm_arch_init_vcpu(CPUState *cs) c->function = i; c->flags =0 ; -cpu_x86_cpuid (env, i,0 , &c->eax, &c->ebx, &c->ecx, &c->edx); +cpu_x86_cpuid (cpu, i,0 , &c->eax, &c->ebx, &c->ecx, &c->edx); } }
target-i386/misc_helper.c +2 -1
@@ -77,7 +77,8 @@ void helper_cpuid(CPUX86State *env)cpu_svm_check_intercept_param (env,SVM_EXIT_CPUID ,0 ); -cpu_x86_cpuid (env, (uint32_t )env->regs[R_EAX ], (uint32_t )env->regs[R_ECX ], +cpu_x86_cpuid (x86_env_get_cpu (env), + (uint32_t )env->regs[R_EAX ], (uint32_t )env->regs[R_ECX ], &eax, &ebx, &ecx, &edx); env->regs[R_EAX ] = eax; env->regs[R_EBX ] = ebx;
Signature · 1 line
2.1.0
PATCH 3/5 target-i386: Use X86CPU on cpu_get_pic_interrupt()
In reply to Eduardo HabkostCc Blue Swirl <[email protected]>
Cc Riku Voipio <[email protected]>
Cc "Michael S. Tsirkin" <[email protected]>
Signed-off-by Eduardo Habkost <[email protected]>
--- bsd-user/main.c | 2 +- hw/i386/pc.c | 3 +-- linux-user/main.c | 2 +- target-i386/cpu.h | 2 +- target-i386/kvm.c | 2 +- target-i386/seg_helper.c | 2 +- 6 files changed, 6 insertions(+), 7 deletions(-)
bsd-user/main.c +1 -1
@@ -62,7 +62,7 @@ void gemu_log(const char *fmt, ...) }#if defined(TARGET_I386 ) -int cpu_get_pic_interrupt (CPUX86State *env) +int cpu_get_pic_interrupt (X86CPU *cpu) {return -1 ; }
hw/i386/pc.c +1 -2
@@ -185,9 +185,8 @@ void cpu_smm_update(CPUX86State *env)/* IRQ handling */ -int cpu_get_pic_interrupt (CPUX86State *env) +int cpu_get_pic_interrupt (X86CPU *cpu) { -X86CPU *cpu =x86_env_get_cpu (env);int intno; intno =apic_get_interrupt (cpu->apic_state);
linux-user/main.c +1 -1
@@ -85,7 +85,7 @@ void gemu_log(const char *fmt, ...) }#if defined(TARGET_I386 ) -int cpu_get_pic_interrupt (CPUX86State *env) +int cpu_get_pic_interrupt (X86CPU *cpu) {return -1 ; }
target-i386/cpu.h +1 -1
@@ -986,7 +986,7 @@ void x86_cpu_list(FILE *f, fprintf_function cpu_fprintf);void x86_cpudef_setup (void );int cpu_x86_support_mca_broadcast (X86CPU *cpu); -int cpu_get_pic_interrupt (CPUX86State *s); +int cpu_get_pic_interrupt (X86CPU *cpu);/* MSDOS compatibility mode FPU exception support */ void cpu_set_ferr (CPUX86State *s);
target-i386/kvm.c +1 -1
@@ -2215,7 +2215,7 @@ void kvm_arch_pre_run(CPUState *cpu, struct kvm_run *run)int irq; cpu->interrupt_request &= ~CPU_INTERRUPT_HARD ; - irq =cpu_get_pic_interrupt (env); + irq =cpu_get_pic_interrupt (x86_cpu);if (irq >=0 ) {struct kvm_interrupt intr;
target-i386/seg_helper.c +1 -1
@@ -1325,7 +1325,7 @@ bool x86_cpu_exec_interrupt(CPUState *cs, int interrupt_request)cpu_svm_check_intercept_param (env,SVM_EXIT_INTR ,0 ); cs->interrupt_request &= ~(CPU_INTERRUPT_HARD |CPU_INTERRUPT_VIRQ ); - intno =cpu_get_pic_interrupt (env); + intno =cpu_get_pic_interrupt (cpu);qemu_log_mask (CPU_LOG_TB_IN_ASM ,"Servicing hardware INT=0x%02x\n" , intno);do_interrupt_x86_hardirq (env, intno,1 );
Signature · 1 line
2.1.0