From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:50411) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WG8bZ-0001x4-J2 for qemu-devel@nongnu.org; Wed, 19 Feb 2014 09:58:39 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1WG8bT-0005P1-9L for qemu-devel@nongnu.org; Wed, 19 Feb 2014 09:58:33 -0500 Received: from mx1.redhat.com ([209.132.183.28]:51891) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1WG8bS-0005Ov-V9 for qemu-devel@nongnu.org; Wed, 19 Feb 2014 09:58:27 -0500 From: Eduardo Habkost Date: Wed, 19 Feb 2014 11:58:11 -0300 Message-Id: <1392821892-26682-3-git-send-email-ehabkost@redhat.com> In-Reply-To: <1392821892-26682-1-git-send-email-ehabkost@redhat.com> References: <1392821892-26682-1-git-send-email-ehabkost@redhat.com> Subject: [Qemu-devel] [PATCH 2/3] target-i386: Introduce x86_cpu_compat_disable_kvm_features() List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: qemu-devel@nongnu.org, =?UTF-8?q?Andreas=20F=C3=A4rber?= Cc: Peter Maydell , "Michael S. Tsirkin" , Bandan Das , Anthony Liguori , Igor Mammedov , Paolo Bonzini , Richard Henderson Instead of the feature-specific disable_kvm_pv_eoi() function, create a more general function that can be used to disable other feature bits in machine-type compat code. Signed-off-by: Eduardo Habkost --- hw/i386/pc_piix.c | 6 +++--- target-i386/cpu.c | 4 ++-- target-i386/cpu.h | 4 ++-- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c index 1acd2b2..dab0c78 100644 --- a/hw/i386/pc_piix.c +++ b/hw/i386/pc_piix.c @@ -292,7 +292,7 @@ static void pc_compat_1_3(QEMUMachineInitArgs *args) static void pc_compat_1_2(QEMUMachineInitArgs *args) { pc_compat_1_3(args); - disable_kvm_pv_eoi(); + x86_cpu_compat_disable_kvm_features(FEAT_KVM, KVM_FEATURE_PV_EOI); } static void pc_init_pci_1_7(QEMUMachineInitArgs *args) @@ -338,7 +338,7 @@ static void pc_init_pci_no_kvmclock(QEMUMachineInitArgs *args) has_pci_info = false; has_acpi_build = false; smbios_type1_defaults = false; - disable_kvm_pv_eoi(); + x86_cpu_compat_disable_kvm_features(FEAT_KVM, KVM_FEATURE_PV_EOI); enable_compat_apic_id_mode(); pc_init1(args, 1, 0); } @@ -351,7 +351,7 @@ static void pc_init_isa(QEMUMachineInitArgs *args) if (!args->cpu_model) { args->cpu_model = "486"; } - disable_kvm_pv_eoi(); + x86_cpu_compat_disable_kvm_features(FEAT_KVM, KVM_FEATURE_PV_EOI); enable_compat_apic_id_mode(); pc_init1(args, 0, 1); } diff --git a/target-i386/cpu.c b/target-i386/cpu.c index ee9dff1..d65ca26 100644 --- a/target-i386/cpu.c +++ b/target-i386/cpu.c @@ -371,9 +371,9 @@ static uint32_t kvm_default_features[FEATURE_WORDS] = { (1 << KVM_FEATURE_CLOCKSOURCE_STABLE_BIT), }; -void disable_kvm_pv_eoi(void) +void x86_cpu_compat_disable_kvm_features(FeatureWord w, uint32_t features) { - kvm_default_features[FEAT_KVM] &= ~(1UL << KVM_FEATURE_PV_EOI); + kvm_default_features[w] &= ~features; } void host_cpuid(uint32_t function, uint32_t count, diff --git a/target-i386/cpu.h b/target-i386/cpu.h index 9989216..d6eb97d 100644 --- a/target-i386/cpu.h +++ b/target-i386/cpu.h @@ -1257,11 +1257,11 @@ void do_smm_enter(X86CPU *cpu); void cpu_report_tpr_access(CPUX86State *env, TPRAccess access); -void disable_kvm_pv_eoi(void); - void x86_cpu_compat_set_features(const char *cpu_model, FeatureWord w, uint32_t feat_add, uint32_t feat_remove); +void x86_cpu_compat_disable_kvm_features(FeatureWord w, uint32_t features); + /* Return name of 32-bit register, from a R_* constant */ const char *get_register_name_32(unsigned int reg); -- 1.8.5.3