qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: "Philippe Mathieu-Daudé" <philmd@redhat.com>
To: Sergio Lopez <slp@redhat.com>, qemu-devel@nongnu.org
Cc: Stefano Stabellini <sstabellini@kernel.org>,
	ehabkost@redhat.com, mst@redhat.com, Paul Durrant <paul@xen.org>,
	kraxel@redhat.com, pbonzini@redhat.com,
	Anthony Perard <anthony.perard@citrix.com>,
	imammedo@redhat.com, sgarzare@redhat.com, lersek@redhat.com,
	rth@twiddle.net
Subject: Re: [PATCH v5 04/10] hw/i386: split PCMachineState deriving X86MachineState from it
Date: Thu, 3 Oct 2019 12:24:52 +0200	[thread overview]
Message-ID: <11c49099-7911-2f3b-3c8c-b3d1659fad6e@redhat.com> (raw)
In-Reply-To: <20191002113103.45023-5-slp@redhat.com>

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 <slp@redhat.com>
> ---
>   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


  reply	other threads:[~2019-10-03 10:26 UTC|newest]

Thread overview: 31+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-02 11:30 [PATCH v5 00/10] Introduce the microvm machine type Sergio Lopez
2019-10-02 11:30 ` [PATCH v5 01/10] hw/virtio: Factorize virtio-mmio headers Sergio Lopez
2019-10-03 10:15   ` Philippe Mathieu-Daudé
2019-10-03 11:26     ` Sergio Lopez
2019-10-03 13:11       ` Eric Blake
2019-10-03 13:47         ` Philippe Mathieu-Daudé
2019-10-07  9:32         ` Markus Armbruster
2019-10-02 11:30 ` [PATCH v5 02/10] hw/i386/pc: rename functions shared with non-PC machines Sergio Lopez
2019-10-02 15:14   ` Philippe Mathieu-Daudé
2019-10-03 10:04     ` Sergio Lopez
2019-10-02 11:30 ` [PATCH v5 03/10] hw/i386/pc: move shared x86 functions to x86.c and export them Sergio Lopez
2019-10-03 10:27   ` Philippe Mathieu-Daudé
2019-10-03 11:14     ` Sergio Lopez
2019-10-02 11:30 ` [PATCH v5 04/10] hw/i386: split PCMachineState deriving X86MachineState from it Sergio Lopez
2019-10-03 10:24   ` Philippe Mathieu-Daudé [this message]
2019-10-03 11:15     ` Sergio Lopez
2019-10-02 11:30 ` [PATCH v5 05/10] hw/i386: make x86.c independent from PCMachineState Sergio Lopez
2019-10-02 11:30 ` [PATCH v5 06/10] fw_cfg: add "modify" functions for all types Sergio Lopez
2019-10-02 11:31 ` [PATCH v5 07/10] hw/intc/apic: reject pic ints if isa_pic == NULL Sergio Lopez
2019-10-02 11:31 ` [PATCH v5 08/10] roms: add microvm-bios (qboot) as binary and git submodule Sergio Lopez
2019-10-03 10:07   ` Sergio Lopez
2019-10-03 10:19     ` Paolo Bonzini
2019-10-03 11:16       ` Sergio Lopez
2019-10-02 11:31 ` [PATCH v5 09/10] docs/microvm.rst: document the new microvm machine type Sergio Lopez
2019-10-02 13:22   ` Paolo Bonzini
2019-10-02 13:37     ` Sergio Lopez
2019-10-02 11:31 ` [PATCH v5 10/10] hw/i386: Introduce the " Sergio Lopez
2019-10-02 12:05   ` Thomas Huth
2019-10-02 13:24     ` Sergio Lopez
2019-10-02 12:03 ` [PATCH v5 00/10] " no-reply
2019-10-02 12:14 ` no-reply

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=11c49099-7911-2f3b-3c8c-b3d1659fad6e@redhat.com \
    --to=philmd@redhat.com \
    --cc=anthony.perard@citrix.com \
    --cc=ehabkost@redhat.com \
    --cc=imammedo@redhat.com \
    --cc=kraxel@redhat.com \
    --cc=lersek@redhat.com \
    --cc=mst@redhat.com \
    --cc=paul@xen.org \
    --cc=pbonzini@redhat.com \
    --cc=qemu-devel@nongnu.org \
    --cc=rth@twiddle.net \
    --cc=sgarzare@redhat.com \
    --cc=slp@redhat.com \
    --cc=sstabellini@kernel.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).