From: "Roger Pau Monné" <roger.pau@citrix.com>
To: Thierry Escande <thierry.escande@vates.tech>
Cc: xen-devel@lists.xenproject.org, Jan Beulich <jbeulich@suse.com>,
Andrew Cooper <andrew.cooper3@citrix.com>,
Anthony PERARD <anthony.perard@vates.tech>
Subject: Re: [PATCH 01/17] libacpi: Split dsdt.asl file and extract i440 specific parts
Date: Tue, 28 Apr 2026 11:05:53 +0200 [thread overview]
Message-ID: <afB4cc8wI__auaJu@macbook.local> (raw)
In-Reply-To: <20260313163455.790692-2-thierry.escande@vates.tech>
On Fri, Mar 13, 2026 at 04:35:01PM +0000, Thierry Escande wrote:
> In order to factorize the common parts between i440 and q35 dsdt files,
> this patch splits dsdt.asl and put the i440 specific parts into
> dsdt_i400.asl.
>
> This also makes use of #include directives instead of file
> concatenations to build the asl files.
>
> Also, the anycpu asl files generation makes use of makefile pattern
> rules to avoid duplication for i440 and q35.
>
> Becuase the LPC controller BDF (which differs between i440 and q35) must
s/Becuase/Because/
> be set at device declaration, it is still set in dsdt.asl by checking
> for a MACHINE_TYPE_I440 macro defined in dsdt_i400.asl.
s/i400/i440/
> Signed-off-by: Thierry Escande <thierry.escande@vates.tech>
> ---
> tools/firmware/hvmloader/Makefile | 2 +-
> tools/firmware/hvmloader/ovmf.c | 4 ++--
> tools/firmware/hvmloader/seabios.c | 4 ++--
> tools/firmware/hvmloader/util.c | 4 ++--
> tools/firmware/hvmloader/util.h | 4 ++--
> tools/libacpi/Makefile | 10 ++++-----
> tools/libacpi/dsdt.asl | 25 ++++-----------------
> tools/libacpi/dsdt_i440.asl | 36 ++++++++++++++++++++++++++++++
> 8 files changed, 53 insertions(+), 36 deletions(-)
> create mode 100644 tools/libacpi/dsdt_i440.asl
>
> diff --git a/tools/firmware/hvmloader/Makefile b/tools/firmware/hvmloader/Makefile
> index 21de72187d..bdc33a877f 100644
> --- a/tools/firmware/hvmloader/Makefile
> +++ b/tools/firmware/hvmloader/Makefile
> @@ -78,7 +78,7 @@ rombios.o: roms.inc
> smbios.o: CFLAGS += -D__SMBIOS_DATE__="\"$(SMBIOS_REL_DATE)\""
>
> ACPI_PATH = ../../libacpi
> -DSDT_FILES += dsdt_anycpu_qemu_xen.c
> +DSDT_FILES += dsdt_i440_anycpu_qemu_xen.c
> ACPI_OBJS = $(patsubst %.c,%.o,$(DSDT_FILES)) build.o static_tables.o
> $(ACPI_OBJS): CFLAGS += -iquote . -DLIBACPI_STDUTILS=\"$(CURDIR)/util.h\"
> CFLAGS += -I$(ACPI_PATH)
> diff --git a/tools/firmware/hvmloader/ovmf.c b/tools/firmware/hvmloader/ovmf.c
> index 23610a0717..d264a50c73 100644
> --- a/tools/firmware/hvmloader/ovmf.c
> +++ b/tools/firmware/hvmloader/ovmf.c
> @@ -119,8 +119,8 @@ static void ovmf_load(const struct bios_config *config,
> static void ovmf_acpi_build_tables(void)
> {
> struct acpi_config config = {
> - .dsdt_anycpu = dsdt_anycpu_qemu_xen,
> - .dsdt_anycpu_len = dsdt_anycpu_qemu_xen_len,
> + .dsdt_anycpu = dsdt_i440_anycpu_qemu_xen,
> + .dsdt_anycpu_len = dsdt_i440_anycpu_qemu_xen_len,
> .dsdt_15cpu = NULL,
> .dsdt_15cpu_len = 0
> };
> diff --git a/tools/firmware/hvmloader/seabios.c b/tools/firmware/hvmloader/seabios.c
> index 444d118ddb..74b0406b5a 100644
> --- a/tools/firmware/hvmloader/seabios.c
> +++ b/tools/firmware/hvmloader/seabios.c
> @@ -90,8 +90,8 @@ static void seabios_acpi_build_tables(void)
> {
> uint32_t rsdp = (uint32_t)scratch_alloc(sizeof(struct acpi_20_rsdp), 0);
> struct acpi_config config = {
> - .dsdt_anycpu = dsdt_anycpu_qemu_xen,
> - .dsdt_anycpu_len = dsdt_anycpu_qemu_xen_len,
> + .dsdt_anycpu = dsdt_i440_anycpu_qemu_xen,
> + .dsdt_anycpu_len = dsdt_i440_anycpu_qemu_xen_len,
> .dsdt_15cpu = NULL,
> .dsdt_15cpu_len = 0,
> };
> diff --git a/tools/firmware/hvmloader/util.c b/tools/firmware/hvmloader/util.c
> index e651342681..f1ed1eb48d 100644
> --- a/tools/firmware/hvmloader/util.c
> +++ b/tools/firmware/hvmloader/util.c
> @@ -843,8 +843,8 @@ void hvmloader_acpi_build_tables(struct acpi_config *config,
> s = xenstore_read("platform/device-model", "");
> if ( !strncmp(s, "qemu_xen", 9) )
> {
> - config->dsdt_anycpu = dsdt_anycpu_qemu_xen;
> - config->dsdt_anycpu_len = dsdt_anycpu_qemu_xen_len;
> + config->dsdt_anycpu = dsdt_i440_anycpu_qemu_xen;
> + config->dsdt_anycpu_len = dsdt_i440_anycpu_qemu_xen_len;
> config->dsdt_15cpu = NULL;
> config->dsdt_15cpu_len = 0;
> }
> diff --git a/tools/firmware/hvmloader/util.h b/tools/firmware/hvmloader/util.h
> index 765a013ddd..3c5eeff5e7 100644
> --- a/tools/firmware/hvmloader/util.h
> +++ b/tools/firmware/hvmloader/util.h
> @@ -381,8 +381,8 @@ extern struct e820map memory_map;
> bool check_overlap(uint64_t start, uint64_t size,
> uint64_t reserved_start, uint64_t reserved_size);
>
> -extern const unsigned char dsdt_anycpu_qemu_xen[], dsdt_anycpu[], dsdt_15cpu[];
> -extern const int dsdt_anycpu_qemu_xen_len, dsdt_anycpu_len, dsdt_15cpu_len;
> +extern const unsigned char dsdt_i440_anycpu_qemu_xen[], dsdt_anycpu[], dsdt_15cpu[];
> +extern const int dsdt_i440_anycpu_qemu_xen_len, dsdt_anycpu_len, dsdt_15cpu_len;
While there you can make this unsigned int, like the dsdt_anycpu_len
field.
>
> unsigned long acpi_pages_allocated(void);
>
> diff --git a/tools/libacpi/Makefile b/tools/libacpi/Makefile
> index b21a64c6b4..d3d4bc9543 100644
> --- a/tools/libacpi/Makefile
> +++ b/tools/libacpi/Makefile
> @@ -11,7 +11,7 @@ endif
>
> MK_DSDT = $(ACPI_BUILD_DIR)/mk_dsdt
>
> -C_SRC-$(CONFIG_X86) = dsdt_anycpu.c dsdt_15cpu.c dsdt_anycpu_qemu_xen.c dsdt_pvh.c
> +C_SRC-$(CONFIG_X86) = dsdt_anycpu.c dsdt_15cpu.c dsdt_i440_anycpu_qemu_xen.c dsdt_pvh.c
> C_SRC-$(CONFIG_ARM_64) = dsdt_anycpu_arm.c
> DSDT_FILES ?= $(C_SRC-y)
> C_SRC = $(addprefix $(ACPI_BUILD_DIR)/, $(DSDT_FILES))
> @@ -39,18 +39,16 @@ $(H_SRC): $(ACPI_BUILD_DIR)/%.h: %.asl
> $(MK_DSDT): mk_dsdt.c
> $(HOSTCC) $(HOSTCFLAGS) $(MKDSDT_CFLAGS-y) $(CFLAGS_xeninclude) -D__XEN_TOOLS__ -o $@ mk_dsdt.c
>
> -$(ACPI_BUILD_DIR)/dsdt_anycpu_qemu_xen.asl: dsdt.asl dsdt_acpi_info.asl $(MK_DSDT)
> +$(ACPI_BUILD_DIR)/dsdt_%_anycpu_qemu_xen.asl: dsdt_%.asl dsdt.asl dsdt_acpi_info.asl $(MK_DSDT)
> # Remove last bracket
> awk 'NR > 1 {print s} {s=$$0}' $< > $@.$(TMP_SUFFIX)
> - cat dsdt_acpi_info.asl >> $@.$(TMP_SUFFIX)
> $(MK_DSDT) --debug=$(debug) --dm-version qemu-xen >> $@.$(TMP_SUFFIX)
> mv -f $@.$(TMP_SUFFIX) $@
>
> # NB. awk invocation is a portable alternative to 'head -n -1'
> -$(ACPI_BUILD_DIR)/dsdt_%cpu.asl: dsdt.asl dsdt_acpi_info.asl $(MK_DSDT)
> +$(ACPI_BUILD_DIR)/dsdt_%cpu.asl: dsdt_i440.asl dsdt.asl dsdt_acpi_info.asl $(MK_DSDT)
> # Remove last bracket
> awk 'NR > 1 {print s} {s=$$0}' $< > $@.$(TMP_SUFFIX)
> - cat dsdt_acpi_info.asl >> $@.$(TMP_SUFFIX)
> $(MK_DSDT) --debug=$(debug) --maxcpu $* >> $@.$(TMP_SUFFIX)
> mv -f $@.$(TMP_SUFFIX) $@
>
> @@ -65,7 +63,7 @@ $(ACPI_BUILD_DIR)/dsdt_anycpu_arm.asl: $(MK_DSDT)
> mv -f $@.$(TMP_SUFFIX) $@
>
> $(C_SRC): $(ACPI_BUILD_DIR)/%.c: $(ACPI_BUILD_DIR)/%.asl
> - $(IASL) -vs -p $(ACPI_BUILD_DIR)/$*.$(TMP_SUFFIX) -tc $<
> + $(IASL) -vs -I $(CURDIR) -p $(ACPI_BUILD_DIR)/$*.$(TMP_SUFFIX) -tc $<
> sed -e 's/AmlCode/$*/g' -e 's/_aml_code//g' $(ACPI_BUILD_DIR)/$*.hex > $@.$(TMP_SUFFIX)
> echo "int $*_len=sizeof($*);" >> $@.$(TMP_SUFFIX)
> mv -f $@.$(TMP_SUFFIX) $@
> diff --git a/tools/libacpi/dsdt.asl b/tools/libacpi/dsdt.asl
> index 32b42f85ae..130826fdcc 100644
> --- a/tools/libacpi/dsdt.asl
> +++ b/tools/libacpi/dsdt.asl
> @@ -5,8 +5,6 @@
> * Copyright (c) 2004, Intel Corporation.
> */
>
> -DefinitionBlock ("DSDT.aml", "DSDT", 2, "Xen", "HVM", 0)
> -{
> Name (\PMBS, 0x0C00)
> Name (\PMLN, 0x08)
> Name (\IOB1, 0x00)
> @@ -199,7 +197,10 @@ DefinitionBlock ("DSDT.aml", "DSDT", 2, "Xen", "HVM", 0)
>
> Device (ISA)
> {
> - Name (_ADR, 0x00010000) /* device 1, fn 0 */
> + /* Error will be raised if the machine type is not defined */
> + #ifdef MACHINE_TYPE_I440
> + Name (_ADR, 0x00010000) /* device 1, fn 0 */
> + #endif
I think we want the preprocessor directives not indented the same as
asl code, like we do in C, iow:
Device (ISA)
{
/* Error will be raised if the machine type is not defined */
#ifdef MACHINE_TYPE_I440
Name (_ADR, 0x00010000) /* device 1, fn 0 */
#endif
Same with the includes and defines below.
>
> OperationRegion(PIRQ, PCI_Config, 0x60, 0x4)
> Scope(\) {
> @@ -329,23 +330,6 @@ DefinitionBlock ("DSDT.aml", "DSDT", 2, "Xen", "HVM", 0)
> })
> }
>
> - Device (FDC0)
> - {
> - Name (_HID, EisaId ("PNP0700"))
> - Method (_STA, 0, NotSerialized)
> - {
> - Return (0x0F)
> - }
> -
> - Name (_CRS, ResourceTemplate ()
> - {
> - IO (Decode16, 0x03F0, 0x03F0, 0x01, 0x06)
> - IO (Decode16, 0x03F7, 0x03F7, 0x01, 0x01)
> - IRQNoFlags () {6}
> - DMA (Compatibility, NotBusMaster, Transfer8) {2}
> - })
> - }
I need to look at the Q35 changes, but ff the only differences are the
Name() method at the top and this, we might as well use an #ifdef
here, and there's no need to split into so many separate files? I
need to look at further patches.
The ACPI table generation stuff could certainly do with an overall
rework.
> Device (UAR1)
> {
> Name (_HID, EisaId ("PNP0501"))
> @@ -444,4 +428,3 @@ DefinitionBlock ("DSDT.aml", "DSDT", 2, "Xen", "HVM", 0)
> Method(_PIC, 1) {
> Store(Arg0, PICD)
> }
> -}
> diff --git a/tools/libacpi/dsdt_i440.asl b/tools/libacpi/dsdt_i440.asl
> new file mode 100644
> index 0000000000..e80c454ad9
> --- /dev/null
> +++ b/tools/libacpi/dsdt_i440.asl
> @@ -0,0 +1,36 @@
> +/* SPDX-License-Identifier: LGPL-2.1-only */
> +/******************************************************************************
> + * DSDT for Xen with Qemu device model (for i440 machine)
> + *
> + * Copyright (c) 2004, Intel Corporation.
> + */
> +
> +DefinitionBlock ("DSDT.aml", "DSDT", 2, "Xen", "HVM", 0)
> +{
> + #define MACHINE_TYPE_I440
IMO we probably want to define this outside of the DefinitionBlock
section, just after the copyright header.
> +
> + #include "dsdt.asl"
> +
> + Scope (\_SB.PCI0.ISA)
> + {
> + Device (FDC0)
> + {
> + Name (_HID, EisaId ("PNP0700"))
> +
> + Method (_STA, 0, NotSerialized)
> + {
> + Return (0x0F)
> + }
> +
> + Name (_CRS, ResourceTemplate ()
> + {
> + IO (Decode16, 0x03F0, 0x03F0, 0x01, 0x06)
> + IO (Decode16, 0x03F7, 0x03F7, 0x01, 0x01)
> + IRQNoFlags () {6}
> + DMA (Compatibility, NotBusMaster, Transfer8) {2}
> + })
> + }
> + }
> +
> + #include "dsdt_acpi_info.asl"
> +}
> --
> 2.51.0
>
>
>
> --
> Thierry Escande | Vates XCP-ng Developer
>
> XCP-ng & Xen Orchestra - Vates solutions
>
> web: https://vates.tech
>
next prev parent reply other threads:[~2026-04-28 9:06 UTC|newest]
Thread overview: 59+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-03-13 16:35 [PATCH 00/17] Q35 initial support for HVM guests Thierry Escande
2026-03-13 16:35 ` [PATCH 01/17] libacpi: Split dsdt.asl file and extract i440 specific parts Thierry Escande
2026-04-28 9:05 ` Roger Pau Monné [this message]
2026-05-04 14:34 ` Jan Beulich
2026-05-04 14:35 ` Jan Beulich
2026-03-13 16:35 ` [PATCH 06/17] hvmloader: Move pci devices setup to a separate function Thierry Escande
2026-04-28 12:48 ` Roger Pau Monné
2026-05-04 14:52 ` Jan Beulich
2026-03-13 16:35 ` [PATCH 03/17] hvmloader: add function to set the emulated machine type (i440/Q35) Thierry Escande
2026-04-28 10:39 ` Roger Pau Monné
2026-05-04 10:58 ` Jan Beulich
2026-05-04 14:43 ` Jan Beulich
2026-03-13 16:35 ` [PATCH 02/17] libacpi: new DSDT ACPI table for Q35 Thierry Escande
2026-04-28 10:17 ` Roger Pau Monné
2026-05-04 14:39 ` Jan Beulich
2026-03-13 16:35 ` [PATCH 05/17] hvmloader: add Q35 DSDT table loading Thierry Escande
2026-04-28 11:08 ` Roger Pau Monné
2026-03-13 16:35 ` [PATCH 08/17] hvmloader: Extend PCI BAR struct Thierry Escande
2026-04-28 13:31 ` Roger Pau Monné
2026-05-04 15:01 ` Jan Beulich
2026-03-13 16:35 ` [PATCH 10/17] hvmloader: Add support for HVMOP_set|get_ecam_space hypercalls Thierry Escande
2026-04-28 14:14 ` Roger Pau Monné
2026-03-13 16:35 ` [PATCH 07/17] hvmloader: add basic Q35 support Thierry Escande
2026-04-28 13:15 ` Roger Pau Monné
2026-05-10 23:32 ` Alexey G
2026-05-04 14:55 ` Jan Beulich
2026-03-13 16:35 ` [PATCH 14/17] libacpi: build ACPI MCFG table if requested Thierry Escande
2026-04-29 10:13 ` Roger Pau Monné
2026-03-13 16:35 ` [PATCH 09/17] xev/hvm: Add HVMOP_get|set_ecam_space hypercalls Thierry Escande
2026-04-28 13:59 ` Roger Pau Monné
2026-05-04 11:09 ` Jan Beulich
2026-05-04 15:12 ` Jan Beulich
2026-03-13 16:35 ` [PATCH 11/17] hvmloader: allocate MMCONFIG area in the MMIO hole Thierry Escande
2026-04-29 9:29 ` Roger Pau Monné
2026-05-04 11:11 ` Jan Beulich
2026-05-04 12:23 ` Roger Pau Monné
2026-05-04 12:36 ` Jan Beulich
2026-03-13 16:35 ` [PATCH 12/17] libxl: Q35 support (new option device_model_machine) Thierry Escande
2026-04-29 10:01 ` Roger Pau Monné
2026-03-13 16:35 ` [PATCH 13/17] libxl: Add xen-platform device for Q35 machine Thierry Escande
2026-03-13 16:35 ` [PATCH 15/17] hvmloader: Set MCFG in ACPI table Thierry Escande
2026-04-29 12:33 ` Roger Pau Monné
2026-03-13 16:35 ` [PATCH 04/17] hvmloader: add ACPI enabling for Q35 Thierry Escande
2026-04-28 10:48 ` Roger Pau Monné
2026-05-05 13:58 ` Alexey G
2026-05-05 14:25 ` Roger Pau Monné
2026-03-13 16:35 ` [PATCH 16/17] Handle PCIe ECAM space access from guests Thierry Escande
2026-04-29 12:42 ` Roger Pau Monné
2026-05-04 15:22 ` Jan Beulich
2026-03-13 16:35 ` [PATCH 17/17] docs: provide description for device_model_machine option Thierry Escande
2026-04-29 12:43 ` Roger Pau Monné
2026-03-15 22:43 ` [PATCH 00/17] Q35 initial support for HVM guests Alexey G
2026-04-28 7:48 ` Roger Pau Monné
2026-05-04 10:45 ` Jan Beulich
2026-05-05 5:48 ` Jan Beulich
2026-05-05 5:49 ` Jan Beulich
2026-05-05 13:29 ` Alexey G
2026-05-05 13:07 ` Alexey G
2026-05-05 14:15 ` Roger Pau Monné
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=afB4cc8wI__auaJu@macbook.local \
--to=roger.pau@citrix.com \
--cc=andrew.cooper3@citrix.com \
--cc=anthony.perard@vates.tech \
--cc=jbeulich@suse.com \
--cc=thierry.escande@vates.tech \
--cc=xen-devel@lists.xenproject.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.