qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Michael S. Tsirkin" <mst@redhat.com>
To: Anthony Liguori <anthony@codemonkey.ws>,
	avi@redhat.com, mtosatti@redhat.com, gleb@redhat.com,
	qemu-devel@nongnu.org, kvm@vger.kernel.org,
	Jan Kiszka <jan.kiszka@web.de>
Cc: Blue Swirl <blauwirbel@gmail.com>
Subject: [Qemu-devel] [PATCHv4 2/4] pc: refactor compat code
Date: Tue, 28 Aug 2012 20:43:49 +0300	[thread overview]
Message-ID: <e87fd7753c097333c39526f70a68fae7880a7259.1346175787.git.mst@redhat.com> (raw)
In-Reply-To: <cover.1346175787.git.mst@redhat.com>

In preparation to adding PV EOI migration for 1.2,
trivially refactor some some compat code
to make it easier to add version specific
cpuid tweaks.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>
---
 hw/pc_piix.c | 44 ++++++++++++++++++++++++++++++++++++--------
 1 file changed, 36 insertions(+), 8 deletions(-)

diff --git a/hw/pc_piix.c b/hw/pc_piix.c
index a771d79..008d42f 100644
--- a/hw/pc_piix.c
+++ b/hw/pc_piix.c
@@ -369,6 +369,22 @@ static QEMUMachine pc_machine_v1_2 = {
     .default_machine_opts = KVM_MACHINE_OPTIONS,
 };
 
+static void pc_machine_v1_1_compat(void)
+{
+}
+
+static void pc_init_pci_v1_1(ram_addr_t ram_size,
+                             const char *boot_device,
+                             const char *kernel_filename,
+                             const char *kernel_cmdline,
+                             const char *initrd_filename,
+                             const char *cpu_model)
+{
+    pc_machine_v1_1_compat();
+    pc_init_pci(ram_size, boot_device, kernel_filename,
+                kernel_cmdline, initrd_filename, cpu_model);
+}
+
 #define PC_COMPAT_1_1 \
         {\
             .driver   = "virtio-scsi-pci",\
@@ -403,7 +419,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_v1_1,
     .max_cpus = 255,
     .default_machine_opts = KVM_MACHINE_OPTIONS,
     .compat_props = (GlobalProperty[]) {
@@ -439,7 +455,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_v1_1,
     .max_cpus = 255,
     .default_machine_opts = KVM_MACHINE_OPTIONS,
     .compat_props = (GlobalProperty[]) {
@@ -455,7 +471,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_v1_1,
     .max_cpus = 255,
     .default_machine_opts = KVM_MACHINE_OPTIONS,
     .compat_props = (GlobalProperty[]) {
@@ -488,7 +504,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_v1_1,
     .max_cpus = 255,
     .default_machine_opts = KVM_MACHINE_OPTIONS,
     .compat_props = (GlobalProperty[]) {
@@ -519,10 +535,22 @@ static QEMUMachine pc_machine_v0_14 = {
             .value    = stringify(1),\
         }
 
+static void pc_init_pci_v0_13(ram_addr_t ram_size,
+                             const char *boot_device,
+                             const char *kernel_filename,
+                             const char *kernel_cmdline,
+                             const char *initrd_filename,
+                             const char *cpu_model)
+{
+    pc_machine_v1_1_compat();
+    pc_init_pci_no_kvmclock(ram_size, boot_device, kernel_filename,
+                            kernel_cmdline, initrd_filename, cpu_model);
+}
+
 static QEMUMachine pc_machine_v0_13 = {
     .name = "pc-0.13",
     .desc = "Standard PC",
-    .init = pc_init_pci_no_kvmclock,
+    .init = pc_init_pci_v0_13,
     .max_cpus = 255,
     .default_machine_opts = KVM_MACHINE_OPTIONS,
     .compat_props = (GlobalProperty[]) {
@@ -560,7 +588,7 @@ static QEMUMachine pc_machine_v0_13 = {
 static QEMUMachine pc_machine_v0_12 = {
     .name = "pc-0.12",
     .desc = "Standard PC",
-    .init = pc_init_pci_no_kvmclock,
+    .init = pc_init_pci_v0_13,
     .max_cpus = 255,
     .default_machine_opts = KVM_MACHINE_OPTIONS,
     .compat_props = (GlobalProperty[]) {
@@ -594,7 +622,7 @@ static QEMUMachine pc_machine_v0_12 = {
 static QEMUMachine pc_machine_v0_11 = {
     .name = "pc-0.11",
     .desc = "Standard PC, qemu 0.11",
-    .init = pc_init_pci_no_kvmclock,
+    .init = pc_init_pci_v0_13,
     .max_cpus = 255,
     .default_machine_opts = KVM_MACHINE_OPTIONS,
     .compat_props = (GlobalProperty[]) {
@@ -616,7 +644,7 @@ static QEMUMachine pc_machine_v0_11 = {
 static QEMUMachine pc_machine_v0_10 = {
     .name = "pc-0.10",
     .desc = "Standard PC, qemu 0.10",
-    .init = pc_init_pci_no_kvmclock,
+    .init = pc_init_pci_v0_13,
     .max_cpus = 255,
     .default_machine_opts = KVM_MACHINE_OPTIONS,
     .compat_props = (GlobalProperty[]) {
-- 
MST

  parent reply	other threads:[~2012-08-28 17:42 UTC|newest]

Thread overview: 33+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-08-28 17:43 [Qemu-devel] [PATCHv4 0/4] migrate PV EOI MSR Michael S. Tsirkin
2012-08-28 17:43 ` [Qemu-devel] [PATCHv4 1/4] linux-headers: update to 3.6-rc3 Michael S. Tsirkin
2012-08-28 17:43 ` Michael S. Tsirkin [this message]
2012-08-29 14:49   ` [Qemu-devel] [PATCHv4 2/4] pc: refactor compat code Anthony Liguori
2012-08-28 17:43 ` [Qemu-devel] [PATCHv4 3/4] cpuid: disable pv eoi for 1.1 and older compat types Michael S. Tsirkin
2012-08-28 19:13   ` Eduardo Habkost
2012-08-28 21:35     ` Michael S. Tsirkin
2012-08-28 22:02       ` Eduardo Habkost
2012-08-28 22:21         ` Michael S. Tsirkin
2012-08-28 22:25           ` Michael S. Tsirkin
2012-08-28 23:50             ` Eduardo Habkost
2012-08-29 10:06               ` Michael S. Tsirkin
2012-08-29 12:56                 ` Eduardo Habkost
2012-08-29 13:18                   ` Michael S. Tsirkin
2012-08-29 13:49                     ` Eduardo Habkost
2012-08-29 14:11                       ` Michael S. Tsirkin
2012-08-29 14:21                         ` Eduardo Habkost
2012-08-29  9:59           ` Marcelo Tosatti
2012-08-29 10:03             ` Marcelo Tosatti
2012-08-29 10:32               ` Michael S. Tsirkin
2012-08-29 10:23             ` Michael S. Tsirkin
2012-08-29 10:31               ` Michael S. Tsirkin
2012-08-29 14:43       ` Juan Quintela
2012-08-29 13:36   ` Anthony Liguori
2012-08-29 13:40     ` Gleb Natapov
2012-08-29 14:09       ` Anthony Liguori
2012-08-29 14:29         ` Michael S. Tsirkin
2012-08-29 14:41         ` Eduardo Habkost
2012-08-29 15:04           ` [Qemu-devel] [QEMU 1.2 PATCH] i386: kvm: have a predefined set of default KVM feature bits Eduardo Habkost
2012-08-29 15:10             ` Michael S. Tsirkin
2012-08-29 15:46               ` Marcelo Tosatti
2012-08-29 14:03     ` [Qemu-devel] [PATCHv4 3/4] cpuid: disable pv eoi for 1.1 and older compat types Eduardo Habkost
2012-08-28 17:43 ` [Qemu-devel] [PATCHv4 4/4] kvm: get/set PV EOI MSR Michael S. Tsirkin

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=e87fd7753c097333c39526f70a68fae7880a7259.1346175787.git.mst@redhat.com \
    --to=mst@redhat.com \
    --cc=anthony@codemonkey.ws \
    --cc=avi@redhat.com \
    --cc=blauwirbel@gmail.com \
    --cc=gleb@redhat.com \
    --cc=jan.kiszka@web.de \
    --cc=kvm@vger.kernel.org \
    --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).