[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Qemu-devel] [RFC QEMU PATCH v4 05/10] xen-hvm: initialize fw_cfg in
From: |
Haozhong Zhang |
Subject: |
Re: [Qemu-devel] [RFC QEMU PATCH v4 05/10] xen-hvm: initialize fw_cfg interface |
Date: |
Wed, 28 Feb 2018 16:16:59 +0800 |
User-agent: |
NeoMutt/20171027 |
On 02/27/18 16:46 +0000, Anthony PERARD wrote:
> On Thu, Dec 07, 2017 at 06:18:07PM +0800, Haozhong Zhang wrote:
> > Xen is going to reuse QEMU to build ACPI of some devices (e.g., NFIT
> > and SSDT for NVDIMM) for HVM domains. The existing QEMU ACPI build
> > code requires a fw_cfg interface which will also be used to pass QEMU
> > built ACPI to Xen. Therefore, we need to initialize fw_cfg when any
> > ACPI is going to be built by QEMU.
> >
> > Signed-off-by: Haozhong Zhang <address@hidden>
> > ---
> > Cc: Stefano Stabellini <address@hidden>
> > Cc: Anthony Perard <address@hidden>
> > Cc: "Michael S. Tsirkin" <address@hidden>
> > Cc: Paolo Bonzini <address@hidden>
> > Cc: Richard Henderson <address@hidden>
> > Cc: Eduardo Habkost <address@hidden>
> > ---
> > hw/i386/xen/xen-hvm.c | 12 ++++++++++++
> > 1 file changed, 12 insertions(+)
> >
> > diff --git a/hw/i386/xen/xen-hvm.c b/hw/i386/xen/xen-hvm.c
> > index fe01b7a025..4b29f4052b 100644
> > --- a/hw/i386/xen/xen-hvm.c
> > +++ b/hw/i386/xen/xen-hvm.c
> > @@ -14,6 +14,7 @@
> > #include "hw/pci/pci.h"
> > #include "hw/i386/pc.h"
> > #include "hw/i386/apic-msidef.h"
> > +#include "hw/loader.h"
> > #include "hw/xen/xen_common.h"
> > #include "hw/xen/xen_backend.h"
> > #include "qmp-commands.h"
> > @@ -1234,6 +1235,14 @@ static void xen_wakeup_notifier(Notifier *notifier,
> > void *data)
> > xc_set_hvm_param(xen_xc, xen_domid, HVM_PARAM_ACPI_S_STATE, 0);
> > }
> >
> > +static void xen_fw_cfg_init(PCMachineState *pcms)
> > +{
>
> The fw_cfg interface might already be initialized, it is used for
> "direct kernel boot" on hvm. It is initialized in xen_load_linux().
>
xen_hvm_init() --> xen_fw_cfg_init() are called before
xen_load_linux(). I'll add a check in xen_load_linux() to avoid
redoing fw_cfg_init_io and rom_set_fw.
Haozhong
> > + FWCfgState *fw_cfg = fw_cfg_init_io(FW_CFG_IO_BASE);
> > +
> > + rom_set_fw(fw_cfg);
> > + pcms->fw_cfg = fw_cfg;
> > +}
> > +
> > void xen_hvm_init(PCMachineState *pcms, MemoryRegion **ram_memory)
> > {
> > int i, rc;
> > @@ -1384,6 +1393,9 @@ void xen_hvm_init(PCMachineState *pcms, MemoryRegion
> > **ram_memory)
> >
> > /* Disable ACPI build because Xen handles it */
> > pcms->acpi_build_enabled = false;
> > + if (pcms->acpi_build_enabled) {
> > + xen_fw_cfg_init(pcms);
> > + }
> >
> > return;
> >
> > --
> > 2.15.1
> >
>
> --
> Anthony PERARD