apic: bump emulated lapic version to 0x14
v4 cover apic: bump emulated lapic version to 0x14
I decided to split the patch into the boilerplate compat_props for v2.0 and older (1/2) and the actual lapic-version "payload" (2/2).
The first (boilerplate) patch depends on another patch for which a pull request is already pending:
http://lists.nongnu.org/archive/html/qemu-devel/2014-04/msg04728.html,
Please let me know what you all think.
Thanks,
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
PATCH v4 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
@@ -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
@@ -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
@@ -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
PATCH v4 2/2 apic: use emulated lapic version 0x14 on pc machines >= 2.1
In reply to Gabriel L. SomloAdd "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
@@ -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
@@ -380,6 +380,7 @@ static const VMStateDescription vmstate_apic_common = {static Property apic_properties_common[] = {DEFINE_PROP_UINT8 ("id" , APICCommonState, id,-1 ), +DEFINE_PROP_UINT32 ("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
@@ -98,6 +98,7 @@ struct APICCommonState {X86CPU *cpu;uint32_t apicbase;uint8_t id; +uint32_t version;uint8_t arb_id;uint8_t tpr;uint32_t spurious_vec;
include/hw/i386/pc.h +3 -0
@@ -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
Quoted 2 lines · Gabriel L. Somlo
I decided to split the patch into the boilerplate
compat_propsfor v2.0 and older (1/2) and the actual lapic-version "payload" (2/2).
BTW, I plan on using uint8_t instead of uint32_t for "version" in a future (v5) revision, since only bits 7:0 of the apic version register are actually dedicated to the "implementation version".
But I'm waiting for any additional feedback before I blast out another update :)
Thanks,
--Gabriel
Quoted 9 lines · Gabriel L. Somlo
I decided to split the patch into the boilerplate
compat_propsfor v2.0 and older (1/2) and the actual lapic-version "payload" (2/2).The first (boilerplate) patch depends on another patch for which a pull request is already pending:
http://lists.nongnu.org/archive/html/qemu-devel/2014-04/msg04728.html,
Please let me know what you all think.
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 :).
Alex