From: Eduardo Habkost <ehabkost@redhat.com>
To: qemu-devel@nongnu.org
Cc: "Andreas Färber" <afaerber@suse.de>,
"Michael S. Tsirkin" <mst@redhat.com>,
"Marcel Apfelbaum" <marcel@redhat.com>,
"Igor Mammedov" <imammedo@redhat.com>
Subject: [Qemu-devel] [PATCH for-2.7 2/4] pc: Set CPU model-id on compat_props for pc <= 2.4
Date: Sat, 9 Apr 2016 17:37:45 -0300 [thread overview]
Message-ID: <1460234267-20523-3-git-send-email-ehabkost@redhat.com> (raw)
In-Reply-To: <1460234267-20523-1-git-send-email-ehabkost@redhat.com>
Instead of relying on x86_cpudef_setup() calling
qemu_hw_version(), just make old machines set model-id explicitly
on compat_props for qemu64, qemu32, and athlon. This will allow
us to eliminate x86_cpudef_setup() later.
Signed-off-by: Eduardo Habkost <ehabkost@redhat.com>
---
hw/i386/pc_piix.c | 12 +++++++++++-
include/hw/i386/pc.h | 29 +++++++++++++++++++++++++++++
2 files changed, 40 insertions(+), 1 deletion(-)
diff --git a/hw/i386/pc_piix.c b/hw/i386/pc_piix.c
index 7f50116..25e04e4 100644
--- a/hw/i386/pc_piix.c
+++ b/hw/i386/pc_piix.c
@@ -583,6 +583,7 @@ DEFINE_I440FX_MACHINE(v1_4, "pc-i440fx-1.4", pc_compat_1_4,
#define PC_COMPAT_1_3 \
PC_COMPAT_1_4 \
+ PC_CPU_MODEL_IDS("1.3.0") \
{\
.driver = "usb-tablet",\
.property = "usb_version",\
@@ -615,6 +616,7 @@ DEFINE_I440FX_MACHINE(v1_3, "pc-1.3", pc_compat_1_3,
#define PC_COMPAT_1_2 \
PC_COMPAT_1_3 \
+ PC_CPU_MODEL_IDS("1.2.0") \
{\
.driver = "nec-usb-xhci",\
.property = "msi",\
@@ -654,6 +656,7 @@ DEFINE_I440FX_MACHINE(v1_2, "pc-1.2", pc_compat_1_2,
#define PC_COMPAT_1_1 \
PC_COMPAT_1_2 \
+ PC_CPU_MODEL_IDS("1.1.0") \
{\
.driver = "virtio-scsi-pci",\
.property = "hotplug",\
@@ -697,6 +700,7 @@ DEFINE_I440FX_MACHINE(v1_1, "pc-1.1", pc_compat_1_2,
#define PC_COMPAT_1_0 \
PC_COMPAT_1_1 \
+ PC_CPU_MODEL_IDS("1.0") \
{\
.driver = TYPE_ISA_FDC,\
.property = "check_media_rate",\
@@ -727,7 +731,8 @@ DEFINE_I440FX_MACHINE(v1_0, "pc-1.0", pc_compat_1_2,
#define PC_COMPAT_0_15 \
- PC_COMPAT_1_0
+ PC_COMPAT_1_0 \
+ PC_CPU_MODEL_IDS("0.15")
static void pc_i440fx_0_15_machine_options(MachineClass *m)
{
@@ -742,6 +747,7 @@ DEFINE_I440FX_MACHINE(v0_15, "pc-0.15", pc_compat_1_2,
#define PC_COMPAT_0_14 \
PC_COMPAT_0_15 \
+ PC_CPU_MODEL_IDS("0.14") \
{\
.driver = "virtio-blk-pci",\
.property = "event_idx",\
@@ -781,6 +787,7 @@ DEFINE_I440FX_MACHINE(v0_14, "pc-0.14", pc_compat_1_2,
#define PC_COMPAT_0_13 \
PC_COMPAT_0_14 \
+ PC_CPU_MODEL_IDS("0.13") \
{\
.driver = TYPE_PCI_DEVICE,\
.property = "command_serr_enable",\
@@ -818,6 +825,7 @@ DEFINE_I440FX_MACHINE(v0_13, "pc-0.13", pc_compat_0_13,
#define PC_COMPAT_0_12 \
PC_COMPAT_0_13 \
+ PC_CPU_MODEL_IDS("0.12") \
{\
.driver = "virtio-serial-pci",\
.property = "max_ports",\
@@ -853,6 +861,7 @@ DEFINE_I440FX_MACHINE(v0_12, "pc-0.12", pc_compat_0_13,
#define PC_COMPAT_0_11 \
PC_COMPAT_0_12 \
+ PC_CPU_MODEL_IDS("0.11") \
{\
.driver = "virtio-blk-pci",\
.property = "vectors",\
@@ -884,6 +893,7 @@ DEFINE_I440FX_MACHINE(v0_11, "pc-0.11", pc_compat_0_13,
#define PC_COMPAT_0_10 \
PC_COMPAT_0_11 \
+ PC_CPU_MODEL_IDS("0.10") \
{\
.driver = "virtio-blk-pci",\
.property = "class",\
diff --git a/include/hw/i386/pc.h b/include/hw/i386/pc.h
index 96f0b66..5639979 100644
--- a/include/hw/i386/pc.h
+++ b/include/hw/i386/pc.h
@@ -359,9 +359,30 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *);
#define PC_COMPAT_2_5 \
HW_COMPAT_2_5
+/* Helper for setting model-id for CPU models that changed model-id
+ * depending on QEMU versions up to QEMU 2.4.
+ */
+#define PC_CPU_MODEL_IDS(v) \
+ {\
+ .driver = "qemu32-" TYPE_X86_CPU,\
+ .property = "model-id",\
+ .value = "QEMU Virtual CPU version " v,\
+ },\
+ {\
+ .driver = "qemu64-" TYPE_X86_CPU,\
+ .property = "model-id",\
+ .value = "QEMU Virtual CPU version " v,\
+ },\
+ {\
+ .driver = "athlon-" TYPE_X86_CPU,\
+ .property = "model-id",\
+ .value = "QEMU Virtual CPU version " v,\
+ },
+
#define PC_COMPAT_2_4 \
PC_COMPAT_2_5 \
HW_COMPAT_2_4 \
+ PC_CPU_MODEL_IDS("2.4.0") \
{\
.driver = "Haswell-" TYPE_X86_CPU,\
.property = "abm",\
@@ -433,6 +454,7 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *);
#define PC_COMPAT_2_3 \
PC_COMPAT_2_4 \
HW_COMPAT_2_3 \
+ PC_CPU_MODEL_IDS("2.3.0") \
{\
.driver = TYPE_X86_CPU,\
.property = "arat",\
@@ -514,6 +536,7 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *);
#define PC_COMPAT_2_2 \
PC_COMPAT_2_3 \
HW_COMPAT_2_2 \
+ PC_CPU_MODEL_IDS("2.3.0") \
{\
.driver = "kvm64" "-" TYPE_X86_CPU,\
.property = "vme",\
@@ -608,6 +631,7 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *);
#define PC_COMPAT_2_1 \
PC_COMPAT_2_2 \
HW_COMPAT_2_1 \
+ PC_CPU_MODEL_IDS("2.1.0") \
{\
.driver = "coreduo" "-" TYPE_X86_CPU,\
.property = "vmx",\
@@ -621,6 +645,7 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *);
#define PC_COMPAT_2_0 \
PC_COMPAT_2_1 \
+ PC_CPU_MODEL_IDS("2.0.0") \
{\
.driver = "virtio-scsi-pci",\
.property = "any_layout",\
@@ -681,6 +706,7 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *);
#define PC_COMPAT_1_7 \
PC_COMPAT_2_0 \
+ PC_CPU_MODEL_IDS("1.7.0") \
{\
.driver = TYPE_USB_DEVICE,\
.property = "msos-desc",\
@@ -699,6 +725,7 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *);
#define PC_COMPAT_1_6 \
PC_COMPAT_1_7 \
+ PC_CPU_MODEL_IDS("1.6.0") \
{\
.driver = "e1000",\
.property = "mitigation",\
@@ -723,6 +750,7 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *);
#define PC_COMPAT_1_5 \
PC_COMPAT_1_6 \
+ PC_CPU_MODEL_IDS("1.5.0") \
{\
.driver = "Conroe-" TYPE_X86_CPU,\
.property = "model",\
@@ -767,6 +795,7 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *);
#define PC_COMPAT_1_4 \
PC_COMPAT_1_5 \
+ PC_CPU_MODEL_IDS("1.4.0") \
{\
.driver = "scsi-hd",\
.property = "discard_granularity",\
--
2.1.0
next prev parent reply other threads:[~2016-04-09 20:39 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-04-09 20:37 [Qemu-devel] [PATCH for-2.7 0/4] cpu: Finally remove cpudef_init() Eduardo Habkost
2016-04-09 20:37 ` [Qemu-devel] [PATCH for-2.7 1/4] osdep: Move default qemu_hw_version() value to a macro Eduardo Habkost
2016-04-09 20:37 ` Eduardo Habkost [this message]
2016-05-10 15:37 ` [Qemu-devel] [PATCH for-2.7 2/4] pc: Set CPU model-id on compat_props for pc <= 2.4 Michael S. Tsirkin
2016-04-09 20:37 ` [Qemu-devel] [PATCH for-2.7 3/4] target-i386: Set constant model_id for qemu63/qemu32/athlon Eduardo Habkost
2016-04-09 20:37 ` [Qemu-devel] [PATCH for-2.7 4/4] cpu: Eliminate cpudef_init(), cpudef_setup() Eduardo Habkost
2016-05-11 19:21 ` [Qemu-devel] [PATCH for-2.7 0/4] cpu: Finally remove cpudef_init() 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=1460234267-20523-3-git-send-email-ehabkost@redhat.com \
--to=ehabkost@redhat.com \
--cc=afaerber@suse.de \
--cc=imammedo@redhat.com \
--cc=marcel@redhat.com \
--cc=mst@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).