From: Eduardo Habkost <ehabkost@redhat.com>
To: qemu-devel@nongnu.org
Cc: kvm@vger.kernel.org, "Gleb Natapov" <gleb@redhat.com>,
"Michael S. Tsirkin" <mst@redhat.com>,
"Marcelo Tosatti" <mtosatti@redhat.com>,
"Igor Mammedov" <imammedo@redhat.com>,
"Andreas Färber" <afaerber@suse.de>
Subject: [Qemu-devel] [RFC 03/12] pc: Reverse pc_init_pci() compatibility logic
Date: Wed, 9 Jan 2013 16:53:43 -0200 [thread overview]
Message-ID: <1357757632-1950-4-git-send-email-ehabkost@redhat.com> (raw)
In-Reply-To: <1357757632-1950-1-git-send-email-ehabkost@redhat.com>
Currently, the pc-1.4 machine init function enables PV EOI and then
calls the pc-1.2 machine init function. The problem with this approach
is that now we can't enable any compatibility code inside the pc-1.2
init function because it would enable the compatibility behavior on
pc-1.3 and pc-1.4 as well.
This reverses the logic so that the pc-1.2 machine init function will
disable PV EOI, and then call the pc-1.4 machine init function. This way
we can change the pc-1.2 init function to enable compatibility behavior,
and the pc-1.4 init function would just use the default behavior.
It would be interesting to eventually change pc_init_pci_no_kvmclock()
and pc_init_isa() to reuse pc_init_pci_1_2() as well (so we don't need
to duplicate compatibility code on those two functions). But this will
be probably much easier to do after we create a PCInitArgs struct for
the PC initialization arguments.
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
Cc: kvm@vger.kernel.org
Cc: Michael S. Tsirkin <mst@redhat.com>
Cc: Gleb Natapov <gleb@redhat.com>
Cc: Marcelo Tosatti <mtosatti@redhat.com>
---
hw/pc_piix.c | 22 +++++++++++++---------
target-i386/cpu.c | 5 +++--
target-i386/cpu.h | 2 +-
3 files changed, 17 insertions(+), 12 deletions(-)
diff --git a/hw/pc_piix.c b/hw/pc_piix.c
index 2b3d58b..13d7cc8 100644
--- a/hw/pc_piix.c
+++ b/hw/pc_piix.c
@@ -233,12 +233,14 @@ static void pc_init_pci(QEMUMachineInitArgs *args)
initrd_filename, cpu_model, 1, 1);
}
-static void pc_init_pci_1_3(QEMUMachineInitArgs *args)
+/* PC machine init function for pc-0.14 to pc-1.2 */
+static void pc_init_pci_1_2(QEMUMachineInitArgs *args)
{
- enable_kvm_pv_eoi();
+ disable_kvm_pv_eoi();
pc_init_pci(args);
}
+/* PC init function for pc-0.10 to pc-0.13, and reused by xenfv */
static void pc_init_pci_no_kvmclock(QEMUMachineInitArgs *args)
{
ram_addr_t ram_size = args->ram_size;
@@ -247,6 +249,7 @@ static void pc_init_pci_no_kvmclock(QEMUMachineInitArgs *args)
const char *kernel_cmdline = args->kernel_cmdline;
const char *initrd_filename = args->initrd_filename;
const char *boot_device = args->boot_device;
+ disable_kvm_pv_eoi();
pc_init1(get_system_memory(),
get_system_io(),
ram_size, boot_device,
@@ -264,6 +267,7 @@ static void pc_init_isa(QEMUMachineInitArgs *args)
const char *boot_device = args->boot_device;
if (cpu_model == NULL)
cpu_model = "486";
+ disable_kvm_pv_eoi();
pc_init1(get_system_memory(),
get_system_io(),
ram_size, boot_device,
@@ -286,7 +290,7 @@ static QEMUMachine pc_machine_v1_4 = {
.name = "pc-1.4",
.alias = "pc",
.desc = "Standard PC",
- .init = pc_init_pci_1_3,
+ .init = pc_init_pci,
.max_cpus = 255,
.is_default = 1,
};
@@ -301,7 +305,7 @@ static QEMUMachine pc_machine_v1_4 = {
static QEMUMachine pc_machine_v1_3 = {
.name = "pc-1.3",
.desc = "Standard PC",
- .init = pc_init_pci_1_3,
+ .init = pc_init_pci,
.max_cpus = 255,
.compat_props = (GlobalProperty[]) {
PC_COMPAT_1_3,
@@ -340,7 +344,7 @@ static QEMUMachine pc_machine_v1_3 = {
static QEMUMachine pc_machine_v1_2 = {
.name = "pc-1.2",
.desc = "Standard PC",
- .init = pc_init_pci,
+ .init = pc_init_pci_1_2,
.max_cpus = 255,
.compat_props = (GlobalProperty[]) {
PC_COMPAT_1_2,
@@ -383,7 +387,7 @@ static QEMUMachine pc_machine_v1_2 = {
static QEMUMachine pc_machine_v1_1 = {
.name = "pc-1.1",
.desc = "Standard PC",
- .init = pc_init_pci,
+ .init = pc_init_pci_1_2,
.max_cpus = 255,
.compat_props = (GlobalProperty[]) {
PC_COMPAT_1_1,
@@ -418,7 +422,7 @@ static QEMUMachine pc_machine_v1_1 = {
static QEMUMachine pc_machine_v1_0 = {
.name = "pc-1.0",
.desc = "Standard PC",
- .init = pc_init_pci,
+ .init = pc_init_pci_1_2,
.max_cpus = 255,
.compat_props = (GlobalProperty[]) {
PC_COMPAT_1_0,
@@ -433,7 +437,7 @@ static QEMUMachine pc_machine_v1_0 = {
static QEMUMachine pc_machine_v0_15 = {
.name = "pc-0.15",
.desc = "Standard PC",
- .init = pc_init_pci,
+ .init = pc_init_pci_1_2,
.max_cpus = 255,
.compat_props = (GlobalProperty[]) {
PC_COMPAT_0_15,
@@ -465,7 +469,7 @@ static QEMUMachine pc_machine_v0_15 = {
static QEMUMachine pc_machine_v0_14 = {
.name = "pc-0.14",
.desc = "Standard PC",
- .init = pc_init_pci,
+ .init = pc_init_pci_1_2,
.max_cpus = 255,
.compat_props = (GlobalProperty[]) {
PC_COMPAT_0_14,
diff --git a/target-i386/cpu.c b/target-i386/cpu.c
index 57a22b7..492656c 100644
--- a/target-i386/cpu.c
+++ b/target-i386/cpu.c
@@ -211,11 +211,12 @@ static uint32_t kvm_default_features = (1 << KVM_FEATURE_CLOCKSOURCE) |
(1 << KVM_FEATURE_CLOCKSOURCE2) |
(1 << KVM_FEATURE_ASYNC_PF) |
(1 << KVM_FEATURE_STEAL_TIME) |
+ (1 << KVM_FEATURE_PV_EOI) |
(1 << KVM_FEATURE_CLOCKSOURCE_STABLE_BIT);
-void enable_kvm_pv_eoi(void)
+void disable_kvm_pv_eoi(void)
{
- kvm_default_features |= (1UL << KVM_FEATURE_PV_EOI);
+ kvm_default_features &= ~(1UL << KVM_FEATURE_PV_EOI);
}
void host_cpuid(uint32_t function, uint32_t count,
diff --git a/target-i386/cpu.h b/target-i386/cpu.h
index e4a7c50..f3c9df5 100644
--- a/target-i386/cpu.h
+++ b/target-i386/cpu.h
@@ -1233,7 +1233,7 @@ void do_smm_enter(CPUX86State *env1);
void cpu_report_tpr_access(CPUX86State *env, TPRAccess access);
-void enable_kvm_pv_eoi(void);
+void disable_kvm_pv_eoi(void);
/* Return name of 32-bit register, from a R_* constant */
const char *get_register_name_32(unsigned int reg);
--
1.7.11.7
next prev parent reply other threads:[~2013-01-09 18:52 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-01-09 18:53 [Qemu-devel] [RFC 00/12] target-i386: Fix APIC-ID-based topology (v4) Eduardo Habkost
2013-01-09 18:53 ` [Qemu-devel] [RFC 01/12] kvm: add KVM_FEATURE_CLOCKSOURCE_STABLE_BIT fake #define Eduardo Habkost
2013-01-10 23:15 ` Igor Mammedov
2013-01-11 0:05 ` Eduardo Habkost
2013-01-09 18:53 ` [Qemu-devel] [RFC 02/12] target-i386: Don't set any KVM flag by default if KVM is disabled Eduardo Habkost
2013-01-10 11:47 ` Michael S. Tsirkin
2013-01-10 23:07 ` Igor Mammedov
2013-01-11 0:03 ` Eduardo Habkost
2013-01-09 18:53 ` Eduardo Habkost [this message]
2013-01-09 18:53 ` [Qemu-devel] [RFC 04/12] kvm: Create kvm_arch_vcpu_id() function Eduardo Habkost
2013-01-09 18:53 ` [Qemu-devel] [RFC 05/12] target-i386: kvm: Set vcpu_id to APIC ID instead of CPU index Eduardo Habkost
2013-01-09 18:53 ` [Qemu-devel] [RFC 06/12] fw_cfg: Remove FW_CFG_MAX_CPUS from fw_cfg_init() Eduardo Habkost
2013-01-09 18:53 ` [Qemu-devel] [RFC 07/12] target-i386/cpu: Introduce apic_id_for_cpu() function Eduardo Habkost
2013-01-10 23:31 ` Igor Mammedov
2013-01-10 23:51 ` Eduardo Habkost
2013-01-10 23:57 ` Eduardo Habkost
2013-01-09 18:53 ` [Qemu-devel] [RFC 08/12] cpus.h: Make constant smp_cores/smp_threads available on *-user Eduardo Habkost
2013-01-09 18:53 ` [Qemu-devel] [RFC 09/12] pc: Set fw_cfg data based on APIC ID calculation Eduardo Habkost
2013-01-09 18:53 ` [Qemu-devel] [RFC 10/12] tests: Support target-specific unit tests Eduardo Habkost
2013-01-09 18:53 ` [Qemu-devel] [RFC 11/12] target-i386: Topology & APIC ID utility functions Eduardo Habkost
2013-01-09 18:53 ` [Qemu-devel] [RFC 12/12] pc: Generate APIC IDs according to CPU topology Eduardo Habkost
2013-01-10 23:36 ` Igor Mammedov
2013-01-10 23:55 ` Eduardo Habkost
2013-01-17 18:29 ` [Qemu-devel] [RFC 00/12] target-i386: Fix APIC-ID-based topology (v4) Eduardo Habkost
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1357757632-1950-4-git-send-email-ehabkost@redhat.com \
--to=ehabkost@redhat.com \
--cc=afaerber@suse.de \
--cc=gleb@redhat.com \
--cc=imammedo@redhat.com \
--cc=kvm@vger.kernel.org \
--cc=mst@redhat.com \
--cc=mtosatti@redhat.com \
--cc=qemu-devel@nongnu.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).