From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([208.118.235.92]:37715) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tx8EO-00005d-3u for qemu-devel@nongnu.org; Sun, 20 Jan 2013 22:39:33 -0500 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1Tx8EM-0003ve-C9 for qemu-devel@nongnu.org; Sun, 20 Jan 2013 22:39:32 -0500 Received: from cantor2.suse.de ([195.135.220.15]:46329 helo=mx2.suse.de) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1Tx8EL-0003vY-VH for qemu-devel@nongnu.org; Sun, 20 Jan 2013 22:39:30 -0500 Message-ID: <50FCB86C.8070208@suse.de> Date: Mon, 21 Jan 2013 04:39:24 +0100 From: =?ISO-8859-15?Q?Andreas_F=E4rber?= MIME-Version: 1.0 References: <1358456378-29248-1-git-send-email-ehabkost@redhat.com> <1358456378-29248-4-git-send-email-ehabkost@redhat.com> In-Reply-To: <1358456378-29248-4-git-send-email-ehabkost@redhat.com> Content-Type: text/plain; charset=ISO-8859-15 Content-Transfer-Encoding: quoted-printable Subject: Re: [Qemu-devel] [PATCH for-1.4 03/12] pc: Reverse pc_init_pci() compatibility logic List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Eduardo Habkost , Anthony Liguori , "Michael S. Tsirkin" Cc: Igor Mammedov , Gleb Natapov , Marcelo Tosatti , qemu-devel@nongnu.org, "kvm@vger.kernel.org list" Am 17.01.2013 21:59, schrieb Eduardo Habkost: > 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 additional compatibility code inside th= e > pc-1.2 init function because it would end up enabling the compatibility > behavior on pc-1.3 and pc-1.4 as well. >=20 > 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. >=20 > This way we can change older machine-types to enable compatibility > behavior, and the newer machine-types (pc-1.3, pc-q35-1.4 and > pc-i440fx-1.4) would just use the default behavior. >=20 > (This means that one nice side-effect of this change is that pc-q35-1.4 > will get PV EOI enabled by default, too) >=20 > 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, and/or after we use global-properties > to implement the compatibility modes present in pc_init_pci_1_2(). >=20 > Signed-off-by: Eduardo Habkost > --- > Cc: kvm@vger.kernel.org > Cc: Michael S. Tsirkin > Cc: Gleb Natapov > Cc: Marcelo Tosatti Ping! mst, you handled a previous PC machine compatibility patch - can you ack or nack? Eduardo, which of the following patches depend on this one? Only 12/12? Andreas >=20 > Signed-off-by: Eduardo Habkost > --- > hw/pc_piix.c | 22 +++++++++++++--------- > target-i386/cpu.c | 5 +++-- > target-i386/cpu.h | 2 +- > 3 files changed, 17 insertions(+), 12 deletions(-) >=20 > diff --git a/hw/pc_piix.c b/hw/pc_piix.c > index 0a6923d..f9cfe78 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); > } > =20 > -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); > } > =20 > +/* 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 =3D args->ram_size; > @@ -247,6 +249,7 @@ static void pc_init_pci_no_kvmclock(QEMUMachineInit= Args *args) > const char *kernel_cmdline =3D args->kernel_cmdline; > const char *initrd_filename =3D args->initrd_filename; > const char *boot_device =3D 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 =3D args->boot_device; > if (cpu_model =3D=3D NULL) > cpu_model =3D "486"; > + disable_kvm_pv_eoi(); > pc_init1(get_system_memory(), > get_system_io(), > ram_size, boot_device, > @@ -286,7 +290,7 @@ static QEMUMachine pc_i440fx_machine_v1_4 =3D { > .name =3D "pc-i440fx-1.4", > .alias =3D "pc", > .desc =3D "Standard PC (i440FX + PIIX, 1996)", > - .init =3D pc_init_pci_1_3, > + .init =3D pc_init_pci, > .max_cpus =3D 255, > .is_default =3D 1, > DEFAULT_MACHINE_OPTIONS, > @@ -302,7 +306,7 @@ static QEMUMachine pc_i440fx_machine_v1_4 =3D { > static QEMUMachine pc_machine_v1_3 =3D { > .name =3D "pc-1.3", > .desc =3D "Standard PC", > - .init =3D pc_init_pci_1_3, > + .init =3D pc_init_pci, > .max_cpus =3D 255, > .compat_props =3D (GlobalProperty[]) { > PC_COMPAT_1_3, > @@ -342,7 +346,7 @@ static QEMUMachine pc_machine_v1_3 =3D { > static QEMUMachine pc_machine_v1_2 =3D { > .name =3D "pc-1.2", > .desc =3D "Standard PC", > - .init =3D pc_init_pci, > + .init =3D pc_init_pci_1_2, > .max_cpus =3D 255, > .compat_props =3D (GlobalProperty[]) { > PC_COMPAT_1_2, > @@ -386,7 +390,7 @@ static QEMUMachine pc_machine_v1_2 =3D { > static QEMUMachine pc_machine_v1_1 =3D { > .name =3D "pc-1.1", > .desc =3D "Standard PC", > - .init =3D pc_init_pci, > + .init =3D pc_init_pci_1_2, > .max_cpus =3D 255, > .compat_props =3D (GlobalProperty[]) { > PC_COMPAT_1_1, > @@ -422,7 +426,7 @@ static QEMUMachine pc_machine_v1_1 =3D { > static QEMUMachine pc_machine_v1_0 =3D { > .name =3D "pc-1.0", > .desc =3D "Standard PC", > - .init =3D pc_init_pci, > + .init =3D pc_init_pci_1_2, > .max_cpus =3D 255, > .compat_props =3D (GlobalProperty[]) { > PC_COMPAT_1_0, > @@ -438,7 +442,7 @@ static QEMUMachine pc_machine_v1_0 =3D { > static QEMUMachine pc_machine_v0_15 =3D { > .name =3D "pc-0.15", > .desc =3D "Standard PC", > - .init =3D pc_init_pci, > + .init =3D pc_init_pci_1_2, > .max_cpus =3D 255, > .compat_props =3D (GlobalProperty[]) { > PC_COMPAT_0_15, > @@ -471,7 +475,7 @@ static QEMUMachine pc_machine_v0_15 =3D { > static QEMUMachine pc_machine_v0_14 =3D { > .name =3D "pc-0.14", > .desc =3D "Standard PC", > - .init =3D pc_init_pci, > + .init =3D pc_init_pci_1_2, > .max_cpus =3D 255, > .compat_props =3D (GlobalProperty[]) { > PC_COMPAT_0_14,=20 > diff --git a/target-i386/cpu.c b/target-i386/cpu.c > index 754eb6f..d1a14d5 100644 > --- a/target-i386/cpu.c > +++ b/target-i386/cpu.c > @@ -211,11 +211,12 @@ static uint32_t kvm_default_features =3D (1 << KV= M_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); > =20 > -void enable_kvm_pv_eoi(void) > +void disable_kvm_pv_eoi(void) > { > - kvm_default_features |=3D (1UL << KVM_FEATURE_PV_EOI); > + kvm_default_features &=3D ~(1UL << KVM_FEATURE_PV_EOI); > } > =20 > void host_cpuid(uint32_t function, uint32_t count, > diff --git a/target-i386/cpu.h b/target-i386/cpu.h > index 4e091cd..9d4fcf9 100644 > --- a/target-i386/cpu.h > +++ b/target-i386/cpu.h > @@ -1250,7 +1250,7 @@ void do_smm_enter(CPUX86State *env1); > =20 > void cpu_report_tpr_access(CPUX86State *env, TPRAccess access); > =20 > -void enable_kvm_pv_eoi(void); > +void disable_kvm_pv_eoi(void); > =20 > /* Return name of 32-bit register, from a R_* constant */ > const char *get_register_name_32(unsigned int reg); >=20 --=20 SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 N=FCrnberg, Germany GF: Jeff Hawn, Jennifer Guild, Felix Imend=F6rffer; HRB 16746 AG N=FCrnbe= rg