Skip to contentSkip to conversation

apic: bump emulated lapic version to 0x14

PATCH Superseded Gabriel L. Somlo 4 participants 9 messages May 5, 2014

v5 of 6 Superseded Latest is v6 →

lore
Share & tools
lore
#0 lore raw

v5 cover apic: bump emulated lapic version to 0x14

Quoted 5 lines · Alexander Graf

From what I understand about the compat bits (which is little) this makes a lot of sense. And the version is a proper property now, which is great :).

Thanks! Here's a new version with only 8 bits dedicated to the "implementation version", as specified in the documentation for the "apic version register".

Cheers,
Gabriel

Gabriel L. Somlo (2):
pc: add compat_props placeholder for 2.0 machine type
apic: use emulated lapic version 0x14 on pc machines >= 2.1

 hw/i386/pc_piix.c               |  4 ++++
 hw/i386/pc_q35.c                |  4 ++++
 hw/intc/apic.c                  |  2 +-
 hw/intc/apic_common.c           |  1 +
 include/hw/i386/apic_internal.h |  1 +
 include/hw/i386/pc.h            | 12 ++++++++++++
 6 files changed, 23 insertions(+), 1 deletion(-)
Signature · 1 line
1.9.0
#1 lore raw

PATCH v5 1/2 pc: add compat_props placeholder for 2.0 machine type

Add the "boilerplate" necessary for subsequent patches to simply drop in compat_props for pc machines 2.0 and older.

This patch contains no functional changes.

---
 hw/i386/pc_piix.c    | 4 ++++
 hw/i386/pc_q35.c     | 4 ++++
 include/hw/i386/pc.h | 9 +++++++++
 3 files changed, 17 insertions(+)
hw/i386/pc_piix.c +4 -0
index 5b3594b..7c672d7 100644
@@ -415,6 +415,10 @@ static QEMUMachine pc_i440fx_machine_v2_0 = {
     PC_I440FX_2_0_MACHINE_OPTIONS,
     .name = "pc-i440fx-2.0",
     .init = pc_init_pci_2_0,
+    .compat_props = (GlobalProperty[]) {
+        PC_COMPAT_2_0,
+        { /* end of list */ }
+    },
 };
 
 #define PC_I440FX_1_7_MACHINE_OPTIONS PC_I440FX_MACHINE_OPTIONS
hw/i386/pc_q35.c +4 -0
index 5b48231..1fe2213 100644
@@ -328,6 +328,10 @@ static QEMUMachine pc_q35_machine_v2_0 = {
     PC_Q35_2_0_MACHINE_OPTIONS,
     .name = "pc-q35-2.0",
     .init = pc_q35_init_2_0,
+    .compat_props = (GlobalProperty[]) {
+        PC_Q35_COMPAT_2_0,
+        { /* end of list */ }
+    },
 };
 
 #define PC_Q35_1_7_MACHINE_OPTIONS PC_Q35_MACHINE_OPTIONS
include/hw/i386/pc.h +9 -0
index 9f26e14..0ade0f1 100644
@@ -242,8 +242,12 @@ int e820_add_entry(uint64_t, uint64_t, uint32_t);
 int e820_get_num_entries(void);
 bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *);
 
+#define PC_Q35_COMPAT_2_0 \
+        PC_COMPAT_2_0
+
 #define PC_Q35_COMPAT_1_7 \
         PC_COMPAT_1_7, \
+        PC_Q35_COMPAT_2_0, \
         {\
             .driver   = "hpet",\
             .property = HPET_INTCAP,\
@@ -262,7 +266,12 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *);
         PC_COMPAT_1_4, \
         PC_Q35_COMPAT_1_5
 
+#define PC_COMPAT_2_0 \
+        {\
+        }
+
 #define PC_COMPAT_1_7 \
+        PC_COMPAT_2_0, \
         {\
             .driver   = TYPE_USB_DEVICE,\
             .property = "msos-desc",\
Signature · 1 line
1.9.0
#2 lore raw

PATCH v5 2/2 apic: use emulated lapic version 0x14 on pc machines >= 2.1

In reply to Gabriel L. Somlo

Add "version" property to local apic, and have it default to 0x14 for pc machines starting at 2.1. For compatibility with previous releases, pc machines up to 2.0 will have their local apic version set to 0x11.

---
 hw/intc/apic.c                  | 2 +-
 hw/intc/apic_common.c           | 1 +
 include/hw/i386/apic_internal.h | 1 +
 include/hw/i386/pc.h            | 3 +++
 4 files changed, 6 insertions(+), 1 deletion(-)
hw/intc/apic.c +1 -1
index 2f40cba..ef19e55 100644
@@ -675,7 +675,7 @@ static uint32_t apic_mem_readl(void *opaque, hwaddr addr)
         val = s->id << 24;
         break;
     case 0x03: /* version */
-        val = 0x11 | ((APIC_LVT_NB - 1) << 16); /* version 0x11 */
+        val = s->version | ((APIC_LVT_NB - 1) << 16);
         break;
     case 0x08:
         apic_sync_vapic(s, SYNC_FROM_VAPIC);
hw/intc/apic_common.c +1 -0
index 7ecce2d..7137653 100644
@@ -380,6 +380,7 @@ static const VMStateDescription vmstate_apic_common = {
 
 static Property apic_properties_common[] = {
     DEFINE_PROP_UINT8("id", APICCommonState, id, -1),
+    DEFINE_PROP_UINT8("version", APICCommonState, version, 0x14),
     DEFINE_PROP_BIT("vapic", APICCommonState, vapic_control, VAPIC_ENABLE_BIT,
                     true),
     DEFINE_PROP_END_OF_LIST(),
include/hw/i386/apic_internal.h +1 -0
index 70542a6..83e2a42 100644
@@ -98,6 +98,7 @@ struct APICCommonState {
     X86CPU *cpu;
     uint32_t apicbase;
     uint8_t id;
+    uint8_t version;
     uint8_t arb_id;
     uint8_t tpr;
     uint32_t spurious_vec;
include/hw/i386/pc.h +3 -0
index 0ade0f1..32a7687 100644
@@ -268,6 +268,9 @@ bool e820_get_entry(int, uint32_t, uint64_t *, uint64_t *);
 
 #define PC_COMPAT_2_0 \
         {\
+            .driver   = "apic",\
+            .property = "version",\
+            .value    = stringify(0x11),\
         }
 
 #define PC_COMPAT_1_7 \
Signature · 1 line
1.9.0
Acked-by on the v5 series
#3 lore raw
In reply to Gabriel L. Somlo
Quoted 5 lines · Gabriel L. Somlo
Quoted 4 lines · Alexander Graf

From what I understand about the compat bits (which is little) this makes a lot of sense. And the version is a proper property now, which is great :).

Quoted 8 lines
Quoted 1 line

Thanks! Here's a new version with only 8 bits dedicated to the "implementation version", as specified in the documentation for the "apic version register".

Cheers,
Gabriel

I'll pick this up unless there are objections.

Quoted 14 lines

Gabriel L. Somlo (2):
pc: add compat_props placeholder for 2.0 machine type
apic: use emulated lapic version 0x14 on pc machines >= 2.1

 hw/i386/pc_piix.c               |  4 ++++
 hw/i386/pc_q35.c                |  4 ++++
 hw/intc/apic.c                  |  2 +-
 hw/intc/apic_common.c           |  1 +
 include/hw/i386/apic_internal.h |  1 +
 include/hw/i386/pc.h            | 12 ++++++++++++
 6 files changed, 23 insertions(+), 1 deletion(-)
Signature · 1 line
1.9.0
#4 lore raw

Am 05.05.2014 17:51, schrieb Michael S. Tsirkin:

Quoted 12 lines · Gabriel L. Somlo
Quoted 11 lines · Alexander Graf
Quoted 5 lines

From what I understand about the compat bits (which is little) this makes a lot of sense. And the version is a proper property now, which is great :).

Thanks! Here's a new version with only 8 bits dedicated to the "implementation version", as specified in the documentation for the "apic version register".

Quoted 7 lines
Quoted 2 lines

Cheers,
Gabriel

I'll pick this up unless there are objections.

Objection! .compat_props are being added to the current pc and q35 machines rather than introducing pc-i440fx-2.1 and pc-q35-2.1 machines and adding the compat_props for the 2.0 versions only.

If 2.1 machines without .compat_props get added and the alias is moved from 2.0 to 2.1, it'll be fine.

Regards,
Andreas

Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
#5 lore raw

Andreas,

Quoted 6 lines · Andreas F?rber

Objection! .compat_props are being added to the current pc and q35 machines rather than introducing pc-i440fx-2.1 and pc-q35-2.1 machines and adding the compat_props for the 2.0 versions only.

If 2.1 machines without .compat_props get added and the alias is moved from 2.0 to 2.1, it'll be fine.

Patch 1/2 (add compat_props placeholder for 2.0) is written to go in on top of this patch:

http://lists.nongnu.org/archive/html/qemu-devel/2014-05/msg00476.html

which is the one adding the 2.1 machine type and moving the alias.

The pair of apic patches under discussion here modifies the (by now legacy) 2.0 machine type.

Does that clear it up, or am I still misunderstanding something ?

Thanks,
--Gabriel

Reviewed-by
#6 lore raw

Am 05.05.2014 18:21, schrieb Gabriel L. Somlo:

Quoted 15 lines

Andreas,

Quoted 6 lines · Andreas F?rber

Objection! .compat_props are being added to the current pc and q35 machines rather than introducing pc-i440fx-2.1 and pc-q35-2.1 machines and adding the compat_props for the 2.0 versions only.

If 2.1 machines without .compat_props get added and the alias is moved from 2.0 to 2.1, it'll be fine.

Patch 1/2 (add compat_props placeholder for 2.0) is written to go in on top of this patch:

http://lists.nongnu.org/archive/html/qemu-devel/2014-05/msg00476.html

Quoted 7 lines

which is the one adding the 2.1 machine type and moving the alias.

The pair of apic patches under discussion here modifies the (by now legacy) 2.0 machine type.

Does that clear it up, or am I still misunderstanding something ?

Yes, with that patch it's okay, you just forgot to mention that dependency in your cover letter - also a change log from v1 is missing. Instead of quoting Alex in the cover letter, you should've placed his Acked-by before your Signed-off-by in the patches he ack'ed - unless you did major changes there (e.g., uint8_t), in which case it shouldn't be in the cover letter either. And please use [PATCH v5 n/m] as canonical ordering. :)

I trust that you have tested and other reviewers have considered no cast to be necessary for left-hand s->version in the expression now that it's uint8_t rather than uint32_t? Then,

Cheers,
Andreas

Signature · 2 lines
SUSE LINUX Products GmbH, Maxfeldstr. 5, 90409 Nürnberg, Germany
GF: Jeff Hawn, Jennifer Guild, Felix Imendörffer; HRB 16746 AG Nürnberg
#7 lore raw
Quoted 7 lines · Andreas F?rber

Yes, with that patch it's okay, you just forgot to mention that dependency in your cover letter - also a change log from v1 is missing. Instead of quoting Alex in the cover letter, you should've placed his Acked-by before your Signed-off-by in the patches he ack'ed - unless you did major changes there (e.g., uint8_t), in which case it shouldn't be in the cover letter either. And please use [PATCH v5 n/m] as canonical ordering. :)

You're right; the dependency was mentioned in the v4 cover letter, but in retrospect it makes perfect sense I should have kept appending to that content instead of using it as a place to reply to the last person who commented on the previous version :)

Re. all that stuff you said about how to handle acked-by and reviewed-by replies, is there a good spot where that process is documented ? I noticed you all have a protocol in place for dealing with that, but this is the first time I had a chance to screw it up myself :) Googling around, I found this:

https://www.kernel.org/doc/Documentation/SubmittingPatches

Does QEMU have its own, or is this what I need for future reference ?

Quoted 3 lines

I trust that you have tested and other reviewers have considered no cast to be necessary for left-hand s->version in the expression now that it's uint8_t rather than uint32_t? Then,

I get no compiler warnings, and adjacent case branches also assign other 8-bit values to the 32-bit "val" variable w/o a cast, so I think we're OK.

Quoted 2 lines

Thanks much,
--Gabriel

#8 lore raw
Quoted 19 lines · Gabriel L. Somlo
Quoted 7 lines · Andreas F?rber

Yes, with that patch it's okay, you just forgot to mention that dependency in your cover letter - also a change log from v1 is missing. Instead of quoting Alex in the cover letter, you should've placed his Acked-by before your Signed-off-by in the patches he ack'ed - unless you did major changes there (e.g., uint8_t), in which case it shouldn't be in the cover letter either. And please use [PATCH v5 n/m] as canonical ordering. :)

You're right; the dependency was mentioned in the v4 cover letter, but in retrospect it makes perfect sense I should have kept appending to that content instead of using it as a place to reply to the last person who commented on the previous version :)

Re. all that stuff you said about how to handle acked-by and reviewed-by replies, is there a good spot where that process is documented ? I noticed you all have a protocol in place for dealing with that, but this is the first time I had a chance to screw it up myself :) Googling around, I found this:

Quoted 3 lines

https://www.kernel.org/doc/Documentation/SubmittingPatches

Does QEMU have its own, or is this what I need for future reference ?

We have some help on top at

http://wiki.qemu.org/Contribute/SubmitAPatch

but if you simply stick to what Linux does you're mostly fine in QEMU land as well :)

Alex