[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [PATCH v5 04/10] hw/i386: split PCMachineState deriving X86MachineSt
From: |
Philippe Mathieu-Daudé |
Subject: |
Re: [PATCH v5 04/10] hw/i386: split PCMachineState deriving X86MachineState from it |
Date: |
Thu, 3 Oct 2019 12:24:52 +0200 |
User-agent: |
Mozilla/5.0 (X11; Linux x86_64; rv:68.0) Gecko/20100101 Thunderbird/68.1.0 |
Hi Sergio,
On 10/2/19 1:30 PM, Sergio Lopez wrote:
Split up PCMachineState and PCMachineClass and derive X86MachineState
and X86MachineClass from them. This allows sharing code with non-PC
x86 machine types.
Signed-off-by: Sergio Lopez <address@hidden>
---
hw/acpi/cpu_hotplug.c | 10 +--
hw/i386/acpi-build.c | 29 ++++---
hw/i386/amd_iommu.c | 3 +-
hw/i386/intel_iommu.c | 3 +-
hw/i386/pc.c | 178 ++++++++++++++----------------------------
hw/i386/pc_piix.c | 43 +++++-----
hw/i386/pc_q35.c | 35 +++++----
hw/i386/x86.c | 139 +++++++++++++++++++++++++++++----
hw/intc/ioapic.c | 2 +-
include/hw/i386/pc.h | 27 +------
include/hw/i386/x86.h | 56 ++++++++++++-
11 files changed, 308 insertions(+), 217 deletions(-)
[...]
diff --git a/include/hw/i386/x86.h b/include/hw/i386/x86.h
index bc1b594a93..5de2f91845 100644
--- a/include/hw/i386/x86.h
+++ b/include/hw/i386/x86.h
@@ -17,7 +17,61 @@
#ifndef HW_I386_X86_H
#define HW_I386_X86_H
+#include "qemu-common.h"
+#include "exec/hwaddr.h"
+#include "qemu/notify.h"
+
#include "hw/boards.h"
+#include "hw/nmi.h"
+
+typedef struct {
+ /*< private >*/
+ MachineClass parent;
+
+ /*< public >*/
+
+ /* Enables contiguous-apic-ID mode */
+ bool compat_apic_id_mode;
+} X86MachineClass;
+
+typedef struct {
+ /*< private >*/
+ MachineState parent;
+
+ /*< public >*/
+
+ /* Pointers to devices and objects: */
+ ISADevice *rtc;
+ FWCfgState *fw_cfg;
+ qemu_irq *gsi;
+ GMappedFile *initrd_mapped_file;
+
+ /* Configuration options: */
+ uint64_t max_ram_below_4g;
+
+ /* RAM information (sizes, addresses, configuration): */
+ ram_addr_t below_4g_mem_size, above_4g_mem_size;
+
+ /* CPU and apic information: */
+ bool apic_xrupt_override;
+ unsigned apic_id_limit;
+ uint16_t boot_cpus;
+ unsigned smp_dies;
+
+ /* Address space used by IOAPIC device. All IOAPIC interrupts
+ * will be translated to MSI messages in the address space. */
+ AddressSpace *ioapic_as;
+} X86MachineState;
+
+#define X86_MACHINE_MAX_RAM_BELOW_4G "max-ram-below-4g"
+
+#define TYPE_X86_MACHINE MACHINE_TYPE_NAME("x86")
+#define X86_MACHINE(obj) \
+ OBJECT_CHECK(X86MachineState, (obj), TYPE_X86_MACHINE)
+#define X86_MACHINE_GET_CLASS(obj) \
+ OBJECT_GET_CLASS(X86MachineClass, obj, TYPE_X86_MACHINE)
+#define X86_MACHINE_CLASS(class) \
+ OBJECT_CLASS_CHECK(X86MachineClass, class, TYPE_X86_MACHINE)
uint32_t x86_cpu_apic_id_from_index(PCMachineState *pcms,
unsigned int cpu_index);
@@ -30,6 +84,6 @@ const CPUArchIdList *x86_possible_cpu_arch_ids(MachineState
*ms);
void x86_system_rom_init(MemoryRegion *rom_memory, bool isapc_ram_fw);
-void x86_load_linux(PCMachineState *x86ms, FWCfgState *fw_cfg);
+void x86_load_linux(PCMachineState *pcms, FWCfgState *fw_cfg);
#endif
You forgot to update Xen:
hw/i386/xen/xen-hvm.c: In function ‘xen_ram_init’:
hw/i386/xen/xen-hvm.c:203:53: error: ‘PC_MACHINE_MAX_RAM_BELOW_4G’
undeclared (first use in this function); did you mean
‘X86_MACHINE_MAX_RAM_BELOW_4G’?
PC_MACHINE_MAX_RAM_BELOW_4G,
^~~~~~~~~~~~~~~~~~~~~~~~~~~
X86_MACHINE_MAX_RAM_BELOW_4G
hw/i386/xen/xen-hvm.c:203:53: note: each undeclared identifier is
reported only once for each function it appears in
hw/i386/xen/xen-hvm.c:217:13: error: ‘PCMachineState’ {aka ‘struct
PCMachineState’} has no member named ‘above_4g_mem_size’
pcms->above_4g_mem_size = ram_size - user_lowmem;
^~
hw/i386/xen/xen-hvm.c:218:13: error: ‘PCMachineState’ {aka ‘struct
PCMachineState’} has no member named ‘below_4g_mem_size’
pcms->below_4g_mem_size = user_lowmem;
^~
hw/i386/xen/xen-hvm.c:220:13: error: ‘PCMachineState’ {aka ‘struct
PCMachineState’} has no member named ‘above_4g_mem_size’
pcms->above_4g_mem_size = 0;
^~
hw/i386/xen/xen-hvm.c:221:13: error: ‘PCMachineState’ {aka ‘struct
PCMachineState’} has no member named ‘below_4g_mem_size’
pcms->below_4g_mem_size = ram_size;
^~
hw/i386/xen/xen-hvm.c:223:14: error: ‘PCMachineState’ {aka ‘struct
PCMachineState’} has no member named ‘above_4g_mem_size’
if (!pcms->above_4g_mem_size) {
^~
hw/i386/xen/xen-hvm.c:230:40: error: ‘PCMachineState’ {aka ‘struct
PCMachineState’} has no member named ‘above_4g_mem_size’
block_len = (1ULL << 32) + pcms->above_4g_mem_size;
^~
hw/i386/xen/xen-hvm.c:247:34: error: ‘PCMachineState’ {aka ‘struct
PCMachineState’} has no member named ‘below_4g_mem_size’
pcms->below_4g_mem_size - 0xc0000);
^~
hw/i386/xen/xen-hvm.c:249:13: error: ‘PCMachineState’ {aka ‘struct
PCMachineState’} has no member named ‘above_4g_mem_size’
if (pcms->above_4g_mem_size > 0) {
^~
hw/i386/xen/xen-hvm.c:252:38: error: ‘PCMachineState’ {aka ‘struct
PCMachineState’} has no member named ‘above_4g_mem_size’
pcms->above_4g_mem_size);
^~
make[1]: *** [rules.mak:69: hw/i386/xen/xen-hvm.o] Error 1
- Re: [PATCH v5 01/10] hw/virtio: Factorize virtio-mmio headers, (continued)
[PATCH v5 02/10] hw/i386/pc: rename functions shared with non-PC machines, Sergio Lopez, 2019/10/02
[PATCH v5 03/10] hw/i386/pc: move shared x86 functions to x86.c and export them, Sergio Lopez, 2019/10/02
[PATCH v5 04/10] hw/i386: split PCMachineState deriving X86MachineState from it, Sergio Lopez, 2019/10/02
- Re: [PATCH v5 04/10] hw/i386: split PCMachineState deriving X86MachineState from it,
Philippe Mathieu-Daudé <=
[PATCH v5 05/10] hw/i386: make x86.c independent from PCMachineState, Sergio Lopez, 2019/10/02
[PATCH v5 06/10] fw_cfg: add "modify" functions for all types, Sergio Lopez, 2019/10/02
[PATCH v5 07/10] hw/intc/apic: reject pic ints if isa_pic == NULL, Sergio Lopez, 2019/10/02
[PATCH v5 08/10] roms: add microvm-bios (qboot) as binary and git submodule, Sergio Lopez, 2019/10/02
[PATCH v5 09/10] docs/microvm.rst: document the new microvm machine type, Sergio Lopez, 2019/10/02