From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by mx.groups.io with SMTP id smtpd.web10.2508.1603914183884024366 for ; Wed, 28 Oct 2020 12:43:04 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=pass (domain: arm.com, ip: 217.140.110.172, mailfrom: ard.biesheuvel@arm.com) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id E052B1ACC; Wed, 28 Oct 2020 12:42:42 -0700 (PDT) Received: from e123331-lin.nice.arm.com (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 974B93F68F; Wed, 28 Oct 2020 12:42:39 -0700 (PDT) From: "Ard Biesheuvel" To: devel@edk2.groups.io Cc: Ard Biesheuvel , Dandan Bi , Liming Gao , Jian J Wang , Hao A Wu , Sami Mujawar , Laszlo Ersek , Leif Lindholm Subject: [PATCH v2 0/3] MdeModulePkg: use pool allocations for ACPI tables Date: Wed, 28 Oct 2020 20:42:23 +0100 Message-Id: <20201028194226.21556-1-ard.biesheuvel@arm.com> X-Mailer: git-send-email 2.17.1 Currently, the AcpiTableDxe memory allocator uses page based allocations, for which the only reason seems to be that it permits the use of a memory limit, which is necessary for ACPI 1.0 tables that need to reside in the first 4 GB of memory. That requirement does not exist on AArch64, and since page based allocations are rounded up to 64 KB multiples, this wastes some memory in a way that can easily be avoided. So let's use the existing 'mAcpiTableAllocType' policy variable, and switch to pool allocations if it is set to 'AllocateAnyPages' Changes since v1: - incorporate Laszlo's review feedback . update description of EFI_ACPI_TABLE_LIST struct . avoid EFI_PHYSICAL_ADDRESS to VOID* conversion in case AllocatePages() returns an error . put closing ) on a line by itself when using the non-condensed format for passing function call arguments. . fix error in comment text Example output from Linux booting on ArmVirtQemu: Before: ACPI: RSDP 0x0000000078510000 000024 (v02 BOCHS ) ACPI: XSDT 0x0000000078500000 00004C (v01 BOCHS BXPCFACP 00000001 01000013) ACPI: FACP 0x00000000784C0000 00010C (v05 BOCHS BXPCFACP 00000001 BXPC 00000001) ACPI: DSDT 0x00000000784D0000 0014BB (v02 BOCHS BXPCDSDT 00000001 BXPC 00000001) ACPI: APIC 0x00000000784B0000 0000A8 (v03 BOCHS BXPCAPIC 00000001 BXPC 00000001) ACPI: GTDT 0x00000000784A0000 000060 (v02 BOCHS BXPCGTDT 00000001 BXPC 00000001) ACPI: MCFG 0x0000000078490000 00003C (v01 BOCHS BXPCMCFG 00000001 BXPC 00000001) ACPI: SPCR 0x0000000078480000 000050 (v02 BOCHS BXPCSPCR 00000001 BXPC 00000001) After: ACPI: RSDP 0x000000007C030018 000024 (v02 BOCHS ) ACPI: XSDT 0x000000007C03FE98 00004C (v01 BOCHS BXPCFACP 00000001 01000013) ACPI: FACP 0x000000007C03FA98 00010C (v05 BOCHS BXPCFACP 00000001 BXPC 00000001) ACPI: DSDT 0x000000007C037518 0014BB (v02 BOCHS BXPCDSDT 00000001 BXPC 00000001) ACPI: APIC 0x000000007C03FC18 0000A8 (v03 BOCHS BXPCAPIC 00000001 BXPC 00000001) ACPI: GTDT 0x000000007C03FD18 000060 (v02 BOCHS BXPCGTDT 00000001 BXPC 00000001) ACPI: MCFG 0x000000007C03FE18 00003C (v01 BOCHS BXPCMCFG 00000001 BXPC 00000001) ACPI: SPCR 0x000000007C03FF98 000050 (v02 BOCHS BXPCSPCR 00000001 BXPC 00000001) Cc: Dandan Bi Cc: Liming Gao Cc: Jian J Wang Cc: Hao A Wu Cc: Sami Mujawar Cc: Laszlo Ersek Cc: Leif Lindholm Ard Biesheuvel (3): MdeModulePkg/AcpiTableDxe: use pool allocations when possible MdeModulePkg/AcpiTableDxe: use pool allocation for RSDT/XSDT if possible MdeModulePkg/AcpiTableDxe: use pool allocation for RSDP if possible .../Universal/Acpi/AcpiTableDxe/AcpiTable.h | 11 +- .../Universal/Acpi/AcpiTableDxe/AcpiSdt.c | 4 +- .../Acpi/AcpiTableDxe/AcpiTableProtocol.c | 230 ++++++++++++------ 3 files changed, 162 insertions(+), 83 deletions(-) -- 2.17.1