anthony.perard@citrix.com
2010-Oct-15 17:35 UTC
[Xen-devel] [PATCH 00/02] firmware changes as part of QEMU/Xen merge.
From: Anthony PERARD <anthony.perard@citrix.com> This two patches are for Xen-unstable and Qemu-DM. With the integration of Xen into QEMU, we would like to minimise the change and use the ACPI implementation of QEMU. So there are some change to make on the firmware to match the QEMU''s BIOS. Some IO Ports are different and the sleep state values are different. Firmware changes: Anthony PERARD (1): firmware, Change ACPI IO addresses and values to match QEMU BIOS. tools/firmware/hvmloader/acpi/dsdt.asl | 12 ++++++------ tools/firmware/hvmloader/hvmloader.c | 4 ++++ xen/include/public/hvm/ioreq.h | 6 +++--- 3 files changed, 13 insertions(+), 9 deletions(-) Qemu-Xen changes: Anthony PERARD (1): piix4acpi: change in ACPI to match the change in the BIOS. hw/piix4acpi.c | 9 ++++----- 1 files changed, 4 insertions(+), 5 deletions(-) -- Anthony PERARD _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
anthony.perard@citrix.com
2010-Oct-15 17:35 UTC
[Xen-devel] [PATCH 01/02] firmware, Change ACPI IO addresses and values to match QEMU BIOS.
From: Anthony PERARD <anthony.perard@citrix.com> As part of the QEMU/Xen merge, this patch comes to change the IO Port addresses, the value of sleep states and add some information in the PCI registers to match the implementation of the BIOS of QEMU. This patch must be applied at the same time with another patch for the piix4acpi of qemu-xen. Signed-off-by: Anthony PERARD <anthony.perard@citrix.com> --- tools/firmware/hvmloader/acpi/dsdt.asl | 12 ++++++------ tools/firmware/hvmloader/hvmloader.c | 4 ++++ xen/include/public/hvm/ioreq.h | 6 +++--- 3 files changed, 13 insertions(+), 9 deletions(-) diff --git a/tools/firmware/hvmloader/acpi/dsdt.asl b/tools/firmware/hvmloader/acpi/dsdt.asl index 03799d3..ea8e324 100644 --- a/tools/firmware/hvmloader/acpi/dsdt.asl +++ b/tools/firmware/hvmloader/acpi/dsdt.asl @@ -33,22 +33,22 @@ DefinitionBlock ("DSDT.aml", "DSDT", 2, "Xen", "HVM", 0) */ Name (\_S3, Package (0x04) { - 0x05, /* PM1a_CNT.SLP_TYP */ - 0x05, /* PM1b_CNT.SLP_TYP */ + 0x01, /* PM1a_CNT.SLP_TYP */ + 0x01, /* PM1b_CNT.SLP_TYP */ 0x0, /* reserved */ 0x0 /* reserved */ }) Name (\_S4, Package (0x04) { - 0x06, /* PM1a_CNT.SLP_TYP */ - 0x06, /* PM1b_CNT.SLP_TYP */ + 0x00, /* PM1a_CNT.SLP_TYP */ + 0x00, /* PM1b_CNT.SLP_TYP */ 0x00, /* reserved */ 0x00 /* reserved */ }) Name (\_S5, Package (0x04) { - 0x07, /* PM1a_CNT.SLP_TYP */ - 0x07, /* PM1b_CNT.SLP_TYP */ + 0x00, /* PM1a_CNT.SLP_TYP */ + 0x00, /* PM1b_CNT.SLP_TYP */ 0x00, /* reserved */ 0x00 /* reserved */ }) diff --git a/tools/firmware/hvmloader/hvmloader.c b/tools/firmware/hvmloader/hvmloader.c index c4c5ddc..cfe026f 100644 --- a/tools/firmware/hvmloader/hvmloader.c +++ b/tools/firmware/hvmloader/hvmloader.c @@ -31,6 +31,7 @@ #include "option_rom.h" #include <xen/version.h> #include <xen/hvm/params.h> +#include <xen/hvm/ioreq.h> #include <xen/memory.h> asm ( @@ -222,9 +223,12 @@ static void pci_setup(void) /* PIIX4 ACPI PM. Special device with special PCI config space. */ ASSERT((vendor_id == 0x8086) && (device_id == 0x7113)); pci_writew(devfn, 0x20, 0x0000); /* No smb bus IO enable */ + pci_writew(devfn, 0xd2, 0x0000); /* No smb bus IO enable */ pci_writew(devfn, 0x22, 0x0000); pci_writew(devfn, 0x3c, 0x0009); /* Hardcoded IRQ9 */ pci_writew(devfn, 0x3d, 0x0001); + pci_writel(devfn, 0x40, ACPI_PM1A_EVT_BLK_ADDRESS | 1); + pci_writeb(devfn, 0x80, 0x01); /* enable PM io space */ break; case 0x0101: if ( vendor_id == 0x8086 ) diff --git a/xen/include/public/hvm/ioreq.h b/xen/include/public/hvm/ioreq.h index 0c10c08..00f5c15 100644 --- a/xen/include/public/hvm/ioreq.h +++ b/xen/include/public/hvm/ioreq.h @@ -100,11 +100,11 @@ struct buffered_piopage { }; #endif /* defined(__ia64__) */ -#define ACPI_PM1A_EVT_BLK_ADDRESS 0x0000000000001f40 +#define ACPI_PM1A_EVT_BLK_ADDRESS 0x000000000000b000 #define ACPI_PM1A_CNT_BLK_ADDRESS (ACPI_PM1A_EVT_BLK_ADDRESS + 0x04) #define ACPI_PM_TMR_BLK_ADDRESS (ACPI_PM1A_EVT_BLK_ADDRESS + 0x08) -#define ACPI_GPE0_BLK_ADDRESS (ACPI_PM_TMR_BLK_ADDRESS + 0x20) -#define ACPI_GPE0_BLK_LEN 0x08 +#define ACPI_GPE0_BLK_ADDRESS (0x000000000000afe0) +#define ACPI_GPE0_BLK_LEN 0x04 #endif /* _IOREQ_H_ */ -- 1.7.1 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
anthony.perard@citrix.com
2010-Oct-15 17:35 UTC
[Xen-devel] [PATCH 02/02] piix4acpi: change in ACPI to match the change in the BIOS.
From: Anthony PERARD <anthony.perard@citrix.com> Some change have been introduced in the firmware to match QEMU''s BIOS. So this patch changes the sleep state values to use the new one and changes the ioport address of the ACPI IOPort mapping. Signed-off-by: Anthony PERARD <anthony.perard@citrix.com> --- hw/piix4acpi.c | 9 ++++----- 1 files changed, 4 insertions(+), 5 deletions(-) diff --git a/hw/piix4acpi.c b/hw/piix4acpi.c index 1efa77d..ae31729 100644 --- a/hw/piix4acpi.c +++ b/hw/piix4acpi.c @@ -52,9 +52,9 @@ /* Sleep state type codes as defined by the \_Sx objects in the DSDT. */ /* These must be kept in sync with the DSDT (hvmloader/acpi/dsdt.asl) */ -#define SLP_TYP_S4 (6 << 10) -#define SLP_TYP_S3 (5 << 10) -#define SLP_TYP_S5 (7 << 10) +#define SLP_TYP_S4 (0 << 10) +#define SLP_TYP_S3 (1 << 10) +#define SLP_TYP_S5 (0 << 10) #define ACPI_DBG_IO_ADDR 0xb044 #define ACPI_PHP_IO_ADDR 0x10c0 @@ -179,7 +179,6 @@ static void acpi_shutdown(uint32_t val) cmos_set_s3_resume(); xc_set_hvm_param(xc_handle, domid, HVM_PARAM_ACPI_S_STATE, 3); break; - case SLP_TYP_S4: case SLP_TYP_S5: qemu_system_shutdown_request(); break; @@ -703,7 +702,7 @@ i2c_bus *piix4_pm_init(PCIBus *bus, int devfn, uint32_t smb_io_base, pci_conf[0x43] = 0x00; d->pm1_control = SCI_EN; - acpi_map((PCIDevice *)d, 0, 0x1f40, 0x10, PCI_ADDRESS_SPACE_IO); + acpi_map((PCIDevice *)d, 0, ACPI_PM1A_EVT_BLK_ADDRESS, 0x10, PCI_ADDRESS_SPACE_IO); gpe_acpi_init(); #ifdef CONFIG_PASSTHROUGH -- 1.7.1 _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Keir Fraser
2010-Oct-15 18:34 UTC
Re: [Xen-devel] [PATCH 00/02] firmware changes as part of QEMU/Xen merge.
We cannot make changes to qemu-dm that are not backwards compatible with saved guests. Not only does this affect qemu in this case, but the register blocks you move around also affect Xen''s emulation of ACPI pmtimer. Both will/would need to be configurable based on whether this is an old or new guest. Hence this has to be strongly NACKed in its current form. -- Keir On 15/10/2010 18:35, "anthony.perard@citrix.com" <anthony.perard@citrix.com> wrote:> From: Anthony PERARD <anthony.perard@citrix.com> > > This two patches are for Xen-unstable and Qemu-DM. > > With the integration of Xen into QEMU, we would like to minimise the change > and use the ACPI implementation of QEMU. So there are some change to make on > the firmware to match the QEMU''s BIOS. Some IO Ports are different and the > sleep state values are different. > > Firmware changes: > > Anthony PERARD (1): > firmware, Change ACPI IO addresses and values to match QEMU BIOS. > > tools/firmware/hvmloader/acpi/dsdt.asl | 12 ++++++------ > tools/firmware/hvmloader/hvmloader.c | 4 ++++ > xen/include/public/hvm/ioreq.h | 6 +++--- > 3 files changed, 13 insertions(+), 9 deletions(-) > > > Qemu-Xen changes: > > Anthony PERARD (1): > piix4acpi: change in ACPI to match the change in the BIOS. > > hw/piix4acpi.c | 9 ++++----- > 1 files changed, 4 insertions(+), 5 deletions(-)_______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Ian Pratt
2010-Oct-18 14:52 UTC
RE: [Xen-devel] [PATCH 00/02] firmware changes as part of QEMU/Xen merge.
> We cannot make changes to qemu-dm that are not backwards compatible with > saved guests. Not only does this affect qemu in this case, but the > register > blocks you move around also affect Xen''s emulation of ACPI pmtimer. Both > will/would need to be configurable based on whether this is an old or new > guest. > > Hence this has to be strongly NACKed in its current form.It''s getting to the point where we might have to consider having two qemu binaries, one for compatibility, one that new VMs are transitioned on to. Things are now so different that I''m worried that installed guests might complain even when just fresh booted on the new qemu. This is something that we''d need to test and devise workarounds. Trying to retain saved image compatibility with a single binary looks ugly. Ian _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Stefano Stabellini
2010-Oct-18 15:10 UTC
RE: [Xen-devel] [PATCH 00/02] firmware changes as part of QEMU/Xen merge.
On Mon, 18 Oct 2010, Ian Pratt wrote:> > We cannot make changes to qemu-dm that are not backwards compatible with > > saved guests. Not only does this affect qemu in this case, but the > > register > > blocks you move around also affect Xen''s emulation of ACPI pmtimer. Both > > will/would need to be configurable based on whether this is an old or new > > guest. > > > > Hence this has to be strongly NACKed in its current form. > > It''s getting to the point where we might have to consider having two qemu binaries, one for compatibility, one that new VMs are transitioned on to. > > Things are now so different that I''m worried that installed guests might complain even when just fresh booted on the new qemu. This is something that we''d need to test and devise workarounds. Trying to retain saved image compatibility with a single binary looks ugly. >I agree. However in this particular case the firmware changes are only for ACPI support and we might be able to support both the old AND the new ioports in qemu-xen, so that we can switch the firmware to the new interface while keeping backward compatibility in qemu. That said I doubt we''ll be able to do the same in upstream qemu, so at some point the old ioport interface will probably be dropped. _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Ian Jackson
2010-Oct-18 15:13 UTC
RE: [Xen-devel] [PATCH 00/02] firmware changes as part of QEMU/Xen merge.
Ian Pratt writes ("RE: [Xen-devel] [PATCH 00/02] firmware changes as part of QEMU/Xen merge."):> It''s getting to the point where we might have to consider having two > qemu binaries, one for compatibility, one that new VMs are > transitioned on to.Yes. But the "new" qemu binary will be, hopefully, upstream qemu''s, based on the work that Anthony is doing against upstream.> Things are now so different that I''m worried that installed guests > might complain even when just fresh booted on the new qemu.That''s a possibility. Some PCI IDs and device strings have changed.> This is something that we''d need to test and devise > workarounds. Trying to retain saved image compatibility with a > single binary looks ugly.It would be difficult. I guess we might be able to write an external qemu save image translator. The difficulty with the ACPI values is that ideally we want to be able to use the same BIOS with both qemus and that means that the two qemus either need to use the same values or there needs to be some negotiation somewhere. We don''t want to try to patch the "new" qemu use the old values. So the combinations which we want to work are: qemu BIOS ACPI values notes ------------ ---------- ----------- ----------- upstream/new upstream''s standard native qemu upstream/new ours standard under Xen } save/restore upstream/new upstream''s standard in future } compat old ours old Xen current Xen This implies that we need to change "our" BIOS to be able to cope with either arrangement. Ian. _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel
Keir Fraser
2010-Oct-18 15:34 UTC
Re: [Xen-devel] [PATCH 00/02] firmware changes as part of QEMU/Xen merge.
On 18/10/2010 16:10, "Stefano Stabellini" <Stefano.Stabellini@eu.citrix.com> wrote:> I agree. > > However in this particular case the firmware changes are only for ACPI > support and we might be able to support both the old AND the new ioports > in qemu-xen, so that we can switch the firmware to the new interface > while keeping backward compatibility in qemu. > > That said I doubt we''ll be able to do the same in upstream qemu, so at > some point the old ioport interface will probably be dropped.I don''t think we can necessarily expect to drop all our patches against upstream qemu, for things like that this that we (ought to) care about and they don''t need to care about and will consider ugly. The backwards compatibility is going to be needed and be maintained somewhere -- if not in core Xen releases, then it''ll end up in XenServer/XCP -- so we may as well get our story straight on it up front now. -- Keir _______________________________________________ Xen-devel mailing list Xen-devel@lists.xensource.com http://lists.xensource.com/xen-devel