public inbox for linux-arm-kernel@lists.infradead.org 
 help / color / mirror / Atom feed
From: zhaoshenglong@huawei•com (Shannon Zhao)
To: linux-arm-kernel@lists•infradead.org
Subject: [PATCH v3 52/62] arm/acpi: Prepare EFI memory descriptor for Dom0
Date: Thu, 31 Dec 2015 15:40:16 +0800	[thread overview]
Message-ID: <5684DBE0.80202@huawei.com> (raw)
In-Reply-To: <alpine.DEB.2.02.1511271415480.8984@kaball.uk.xensource.com>



On 2015/11/27 22:30, Stefano Stabellini wrote:
> On Tue, 17 Nov 2015, shannon.zhao at linaro.org wrote:
>> > From: Shannon Zhao <shannon.zhao@linaro•org>
>> > 
>> > Create a few EFI memory descriptors to tell Dom0 the RAM region
>> > information, ACPI table regions and EFI tables reserved resions.
>> > 
>> > Signed-off-by: Parth Dixit <parth.dixit@linaro•org>
>> > Signed-off-by: Shannon Zhao <shannon.zhao@linaro•org>
>> > ---
>> >  xen/arch/arm/domain_build.c |  2 ++
>> >  xen/common/efi/boot.c       | 48 +++++++++++++++++++++++++++++++++++++++++++++
>> >  xen/include/asm-arm/setup.h |  4 ++++
>> >  3 files changed, 54 insertions(+)
>> > 
>> > diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
>> > index 9d667ea..073c634 100644
>> > --- a/xen/arch/arm/domain_build.c
>> > +++ b/xen/arch/arm/domain_build.c
>> > @@ -1737,6 +1737,8 @@ static int prepare_acpi(struct domain *d, struct kernel_info *kinfo)
>> >      acpi_map_rest_tables(d);
>> >      acpi_create_efi_system_table(d->arch.efi_acpi_gpa, d->arch.efi_acpi_table,
>> >                                   tbl_add);
>> > +    acpi_create_efi_mmap_table(d->arch.efi_acpi_gpa, d->arch.efi_acpi_table,
>> > +                               &kinfo->mem, tbl_add);
>> >  
>> >      return 0;
>> >  }
>> > diff --git a/xen/common/efi/boot.c b/xen/common/efi/boot.c
>> > index 75835ae..ff2faed 100644
>> > --- a/xen/common/efi/boot.c
>> > +++ b/xen/common/efi/boot.c
>> > @@ -1256,6 +1256,54 @@ void __init acpi_create_efi_system_table(paddr_t paddr, void *efi_acpi_table,
>> >      tbl_add[TBL_EFIT].start = table_addr;
>> >      tbl_add[TBL_EFIT].size = table_size;
>> >  }
>> > +
>> > +void __init acpi_create_efi_mmap_table(paddr_t paddr, void *efi_acpi_table,
>> > +                                       const struct meminfo *mem,
>> > +                                       struct membank tbl_add[])
> This function shouldn't be in this file.
> 
> 
> 
>> > +{
>> > +    EFI_MEMORY_DESCRIPTOR *memory_map;
>> > +    int i, offset;
>> > +    u8 *base_ptr;
>> > +
>> > +    tbl_add[TBL_MMAP].start = paddr + acpi_get_table_offset(tbl_add, TBL_MMAP);
>> > +    tbl_add[TBL_MMAP].size = sizeof(EFI_MEMORY_DESCRIPTOR)
>> > +                             * (mem->nr_banks + acpi_mem.nr_banks + TBL_MMAX);
>> > +
>> > +    base_ptr = efi_acpi_table + acpi_get_table_offset(tbl_add, TBL_MMAP);
>> > +    memory_map = (EFI_MEMORY_DESCRIPTOR *)(base_ptr);
>> > +
>> > +    offset = 0;
>> > +    for( i = 0; i < mem->nr_banks; i++, offset++ )
>> > +    {
>> > +        memory_map[offset].Type = EfiConventionalMemory;
>> > +        memory_map[offset].PhysicalStart = mem->bank[i].start;
>> > +        memory_map[offset].NumberOfPages = mem->bank[i].size/PAGE_SIZE;
> Use PAGE_SHIFT throughout the function.
> 
> 
>> > +        memory_map[offset].Attribute = EFI_MEMORY_WB;
>> > +    }
>> > +
>> > +    for( i = 0; i < acpi_mem.nr_banks; i++, offset++ )
>> > +    {
>> > +        memory_map[offset].Type = EfiACPIReclaimMemory;
>> > +        memory_map[offset].PhysicalStart = acpi_mem.bank[i].start;
>> > +        memory_map[offset].NumberOfPages = acpi_mem.bank[i].size/PAGE_SIZE;
>> > +        memory_map[offset].Attribute = EFI_MEMORY_WB;
>> > +    }
>> > +
>> > +    for( i = 0; i < TBL_EFIT; i++, offset++ )
>> > +    {
>> > +        memory_map[offset].Type = EfiACPIReclaimMemory;
>> > +        memory_map[offset].PhysicalStart = tbl_add[i].start;
>> > +        memory_map[offset].NumberOfPages =tbl_add[i].size/PAGE_SIZE;
>> > +        memory_map[offset].Attribute = EFI_MEMORY_WB;
>> > +    }
> Can't we just use a single EFI_MEMORY_DESCRIPTOR (or maybe 2, to cover
> EfiACPIReclaimMemory and EfiReservedMemoryType regions) to describe the
> whole efi_acpi_gpa region? Using one EFI_MEMORY_DESCRIPTOR per table,
> and PAGE_ALIGNing each of them, looks like a waste of memory to me.
> Unless it's an ACPI or EFI spec requirement.
> 

Looking at the UEFI SPEC it says
"EFI memory descriptors of type EfiACPIReclaimMemory and EfiACPIMemoryNVS
must be aligned on a 4 KiB boundary and must be a multiple of 4 KiB in size"

-- 
Shannon

  reply	other threads:[~2015-12-31  7:40 UTC|newest]

Thread overview: 212+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-11-17  9:39 [PATCH v3 00/62] Add ACPI support for arm64 on Xen shannon.zhao at linaro.org
2015-11-17  9:40 ` [PATCH v3 01/62] Revert "xen/arm: vgic-v2: Drop cbase from arch_domain" shannon.zhao at linaro.org
2015-11-17 11:27   ` Julien Grall
2015-11-17 12:32     ` Shannon Zhao
2015-11-17 13:57       ` Julien Grall
2015-11-18  2:28         ` Shannon Zhao
2015-11-18 11:41           ` Julien Grall
2015-11-18 13:09             ` Shannon Zhao
2015-11-18 13:33               ` Julien Grall
2015-11-18 13:38                 ` Shannon Zhao
2015-11-17  9:40 ` [PATCH v3 02/62] acpi/NUMA: Build NUMA for x86 only shannon.zhao at linaro.org
2015-11-17  9:40 ` [PATCH v3 03/62] acpi/pmstat: Build pmstat " shannon.zhao at linaro.org
2015-11-23 15:46   ` Jan Beulich
2015-11-17  9:40 ` [PATCH v3 04/62] arm/acpi: Emulate io ports for arm shannon.zhao at linaro.org
2015-11-17  9:50   ` Arnd Bergmann
2015-11-18  7:01     ` Shannon Zhao
2015-11-18  8:24       ` Arnd Bergmann
2015-11-17  9:40 ` [PATCH v3 05/62] acpi: Don't do traditional BIOS table scan for ARM64 shannon.zhao at linaro.org
2015-11-23 11:24   ` Stefano Stabellini
2015-11-23 11:35     ` Jan Beulich
2015-11-24  3:39       ` Shannon Zhao
2015-11-24  7:20         ` Jan Beulich
2015-11-17  9:40 ` [PATCH v3 06/62] acpi: Refactor acpi_os_map_memory to be architecturally independent shannon.zhao at linaro.org
2015-11-23 11:29   ` [Xen-devel] " Stefano Stabellini
2015-11-23 11:37     ` Jan Beulich
2015-12-07 12:00   ` Julien Grall
2015-11-17  9:40 ` [PATCH v3 07/62] arm/acpi: Add arch_acpi_os_map_memory helper function for ARM shannon.zhao at linaro.org
2015-11-23 11:37   ` Stefano Stabellini
2015-11-30 14:47     ` [Xen-devel] " Julien Grall
2015-12-07  8:58       ` Shannon Zhao
2015-12-07 10:32         ` Jan Beulich
2015-12-07 10:38           ` Ian Campbell
2015-12-07 12:02             ` Julien Grall
2015-11-17  9:40 ` [PATCH v3 08/62] arm/acpi: Add arm specific acpi header file shannon.zhao at linaro.org
2015-11-23 11:43   ` Stefano Stabellini
2015-11-17  9:40 ` [PATCH v3 09/62] arm/acpi: Add basic ACPI initialization shannon.zhao at linaro.org
2015-11-23 11:52   ` [Xen-devel] " Stefano Stabellini
2015-11-17  9:40 ` [PATCH v3 10/62] arm/acpi: Move end_boot_allocator after acpi_boot_table_init shannon.zhao at linaro.org
2015-11-23 11:54   ` Stefano Stabellini
2015-11-17  9:40 ` [PATCH v3 11/62] arm/acpi: Introduce ARM Boot Architecture Flags in FADT shannon.zhao at linaro.org
2015-11-23 12:13   ` Stefano Stabellini
2015-11-17  9:40 ` [PATCH v3 12/62] ACPICA: ACPI 6.0: Add changes for FADT table shannon.zhao at linaro.org
2015-11-23 12:15   ` Stefano Stabellini
2015-11-24 11:29   ` Jan Beulich
2015-11-25  1:45     ` Shannon Zhao
2015-11-17  9:40 ` [PATCH v3 13/62] arm/acpi: Parse FADT table and get PSCI flags shannon.zhao at linaro.org
2015-11-23 12:42   ` Stefano Stabellini
2015-11-17  9:40 ` [PATCH v3 14/62] arm/acpi: Add Generic Interrupt and Distributor struct shannon.zhao at linaro.org
2015-11-23 14:43   ` Stefano Stabellini
2015-11-17  9:40 ` [PATCH v3 15/62] ACPICA: ACPI 6.0: Add changes for MADT table shannon.zhao at linaro.org
2015-11-23 14:51   ` Stefano Stabellini
2015-11-17  9:40 ` [PATCH v3 16/62] ACPICA: ACPI 6.0: Add values for MADT GIC version field shannon.zhao at linaro.org
2015-11-23 14:52   ` Stefano Stabellini
2015-11-17  9:40 ` [PATCH v3 17/62] arm/acpi: Print GIC information when MADT is parsed shannon.zhao at linaro.org
2015-11-23 14:56   ` Stefano Stabellini
2015-11-17  9:40 ` [PATCH v3 18/62] arm/acpi: Parse MADT to map logical cpu to MPIDR and get cpu_possible_map shannon.zhao at linaro.org
2015-11-23 15:18   ` Stefano Stabellini
2015-11-17  9:40 ` [PATCH v3 19/62] arm/smpboot: Move dt specific code in smp to seperate functions shannon.zhao at linaro.org
2015-11-23 15:22   ` Stefano Stabellini
2015-11-17  9:40 ` [PATCH v3 20/62] arm/acpi: Add ACPI support for SMP initialization shannon.zhao at linaro.org
2015-11-23 15:27   ` Stefano Stabellini
2015-11-30 14:57   ` [Xen-devel] " Julien Grall
2015-12-30  3:11     ` Shannon Zhao
2016-01-04 14:51       ` Stefano Stabellini
2016-01-04 15:00         ` Mark Rutland
2016-01-04 15:14           ` Mark Rutland
2016-01-04 15:12       ` Mark Rutland
2015-11-17  9:40 ` [PATCH v3 21/62] arm/gic-v2: Refactor gicv2_init into generic and dt specific parts shannon.zhao at linaro.org
2015-11-23 15:40   ` Stefano Stabellini
2015-11-17  9:40 ` [PATCH v3 22/62] arm/gic-v3: Refactor gicv3_init " shannon.zhao at linaro.org
2015-11-24 10:51   ` [Xen-devel] " Stefano Stabellini
2015-11-30 15:01     ` Julien Grall
2015-11-17  9:40 ` [PATCH v3 23/62] acpi/table: Introduce acpi_parse_entries shannon.zhao at linaro.org
2015-11-23 16:56   ` Jan Beulich
2015-11-17  9:40 ` [PATCH v3 24/62] arm: Introduce a generic way to use a device from acpi shannon.zhao at linaro.org
2015-11-17 12:40   ` Julien Grall
2015-11-17 13:21     ` Shannon Zhao
2015-11-17 14:25       ` Julien Grall
2015-11-18  2:37         ` Shannon Zhao
2015-11-18 11:46           ` Julien Grall
2015-11-24 11:18   ` [Xen-devel] " Stefano Stabellini
2015-11-17  9:40 ` [PATCH v3 25/62] acpi/table: Introduce acpi_get_entry to get specified entry shannon.zhao at linaro.org
2015-11-23 16:59   ` Jan Beulich
2015-11-24  3:08     ` Shannon Zhao
2015-11-24  7:22       ` Jan Beulich
2015-11-24  7:48         ` Shannon Zhao
2015-11-24  8:04           ` Jan Beulich
2015-11-17  9:40 ` [PATCH v3 26/62] arm/gic-v2: Add ACPI boot support for GICv2 shannon.zhao at linaro.org
2015-11-24 11:54   ` [Xen-devel] " Stefano Stabellini
2015-11-17  9:40 ` [PATCH v3 27/62] arm/gic-v3: Add ACPI boot support for GICv3 shannon.zhao at linaro.org
2015-11-24 12:00   ` [Xen-devel] " Stefano Stabellini
2015-11-17  9:40 ` [PATCH v3 28/62] arm/gic: Add ACPI support for GIC preinit shannon.zhao at linaro.org
2015-11-26 12:10   ` Stefano Stabellini
2015-11-17  9:40 ` [PATCH v3 29/62] arm/acpi: Add GTDT support updated by ACPI 5.1 shannon.zhao at linaro.org
2015-11-26 12:14   ` [Xen-devel] " Stefano Stabellini
2015-11-17  9:40 ` [PATCH v3 30/62] arm/irq: Add helper function for setting interrupt type shannon.zhao at linaro.org
2015-11-26 12:20   ` Stefano Stabellini
2015-11-17  9:40 ` [PATCH v3 31/62] arm/acpi: Add a helper function to get " shannon.zhao at linaro.org
2015-11-18 12:16   ` [Xen-devel] " Julien Grall
2015-11-26 12:33   ` Stefano Stabellini
2015-11-17  9:40 ` [PATCH v3 32/62] arm/acpi: Parse GTDT to initialize timer shannon.zhao at linaro.org
2015-11-26 12:54   ` [Xen-devel] " Stefano Stabellini
2015-11-17  9:40 ` [PATCH v3 33/62] arm/uart: Create generic uart initialization function shannon.zhao at linaro.org
2015-11-17 11:49   ` Julien Grall
2015-11-17 12:34     ` Shannon Zhao
2015-11-17  9:40 ` [PATCH v3 34/62] pl011: Refactor pl011 driver to dt and common initialization parts shannon.zhao at linaro.org
2015-11-26 15:22   ` Stefano Stabellini
2015-11-17  9:40 ` [PATCH v3 35/62] serial: Rename SERHND_DTUART to SERHND_UART shannon.zhao at linaro.org
2015-11-26 15:32   ` [Xen-devel] " Stefano Stabellini
2015-11-17  9:40 ` [PATCH v3 36/62] arm/acpi: Initialize serial port from ACPI SPCR table shannon.zhao at linaro.org
2015-11-26 15:43   ` Stefano Stabellini
2015-11-17  9:40 ` [PATCH v3 37/62] arm/acpi: Define a enum for reserved tables shannon.zhao at linaro.org
2015-11-26 16:50   ` [Xen-devel] " Stefano Stabellini
2015-11-26 17:06     ` Stefano Stabellini
2015-11-17  9:40 ` [PATCH v3 38/62] arm/acpi: Add placeholder for efi and acpi load address shannon.zhao at linaro.org
2015-11-17 11:58   ` Julien Grall
2015-11-17 12:45     ` Shannon Zhao
2015-11-17 14:23       ` Julien Grall
2015-11-18  3:01         ` Shannon Zhao
2015-11-18 11:56           ` Julien Grall
2015-11-26 16:04             ` Stefano Stabellini
2015-11-30 15:10               ` Julien Grall
2015-11-26 16:02       ` Stefano Stabellini
2015-11-17  9:40 ` [PATCH v3 39/62] arm/acpi: Read acpi memory info from uefi shannon.zhao at linaro.org
2015-11-26 16:18   ` Stefano Stabellini
2015-11-17  9:40 ` [PATCH v3 40/62] arm/acpi: Estimate memory required for acpi/efi tables shannon.zhao at linaro.org
2015-11-26 16:39   ` Stefano Stabellini
2015-12-31  9:16     ` Shannon Zhao
2016-01-04 14:35       ` Stefano Stabellini
2015-11-30 15:14   ` [Xen-devel] " Julien Grall
2016-01-04  9:03     ` Shannon Zhao
2016-01-04 14:34       ` Stefano Stabellini
2015-11-17  9:40 ` [PATCH v3 41/62] arm/acpi: Add a helper function to get the acpi table offset shannon.zhao at linaro.org
2015-11-26 17:02   ` Stefano Stabellini
2015-11-17  9:40 ` [PATCH v3 42/62] arm/acpi: Prepare FADT table for Dom0 shannon.zhao at linaro.org
2015-11-26 17:19   ` [Xen-devel] " Stefano Stabellini
2015-11-27  9:50     ` Ian Campbell
2015-11-17  9:40 ` [PATCH v3 43/62] arm/acpi: Prepare MADT " shannon.zhao at linaro.org
2015-11-26 17:48   ` Stefano Stabellini
2015-11-17  9:40 ` [PATCH v3 44/62] ACPICA: ACPI 6.0: Add support for STAO table shannon.zhao at linaro.org
2015-11-27 11:15   ` Stefano Stabellini
2015-11-17  9:40 ` [PATCH v3 45/62] arm/acpi: Prepare STAO table for Dom0 shannon.zhao at linaro.org
2015-11-27 11:24   ` [Xen-devel] " Stefano Stabellini
2015-11-17  9:40 ` [PATCH v3 46/62] arm/acpi: Prepare XSDT " shannon.zhao at linaro.org
2015-11-27 11:58   ` [Xen-devel] " Stefano Stabellini
2015-11-17  9:40 ` [PATCH v3 47/62] arm/p2m: Add helper functions to map memory regions shannon.zhao at linaro.org
2015-11-27 12:04   ` Stefano Stabellini
2015-11-30 15:22     ` Julien Grall
2016-01-05  3:50       ` Shannon Zhao
2015-11-30 15:23   ` [Xen-devel] " Julien Grall
2015-11-17  9:40 ` [PATCH v3 48/62] arm/acpi: Prepare RSDP table for Dom0 shannon.zhao at linaro.org
2015-11-27 12:10   ` Stefano Stabellini
2015-11-17  9:40 ` [PATCH v3 49/62] arm/acpi: Map rest tables " shannon.zhao at linaro.org
2015-11-27 12:16   ` Stefano Stabellini
2015-11-30 15:25     ` Julien Grall
2015-11-17  9:40 ` [PATCH v3 50/62] xen/efi: store EFI system table in efi structure shannon.zhao at linaro.org
2015-11-17 11:07   ` Jan Beulich
2015-11-17 11:57   ` Julien Grall
2015-11-18  3:17     ` Shannon Zhao
2015-11-17  9:40 ` [PATCH v3 51/62] arm/acpi: Prepare EFI system table for Dom0 shannon.zhao at linaro.org
2015-11-17 12:02   ` Julien Grall
2015-11-18 12:09   ` [Xen-devel] " Julien Grall
2015-11-27 14:13   ` Stefano Stabellini
2015-11-17  9:40 ` [PATCH v3 52/62] arm/acpi: Prepare EFI memory descriptor " shannon.zhao at linaro.org
2015-11-27 14:30   ` Stefano Stabellini
2015-12-31  7:40     ` Shannon Zhao [this message]
2016-01-04 14:54       ` Stefano Stabellini
2015-11-17  9:40 ` [PATCH v3 53/62] arm/acpi: Map the new created EFI and ACPI tables to Dom0 shannon.zhao at linaro.org
2015-11-27 14:34   ` Stefano Stabellini
2015-11-17  9:40 ` [PATCH v3 54/62] arm/acpi: Create min DT stub for Dom0 shannon.zhao at linaro.org
2015-11-27 14:44   ` [Xen-devel] " Stefano Stabellini
2015-11-17  9:40 ` [PATCH v3 55/62] arm/acpi: Route all Xen unused SPIs to Dom0 shannon.zhao at linaro.org
2015-11-17 12:33   ` Julien Grall
2015-11-27 15:04   ` Stefano Stabellini
2015-11-30 15:41     ` [Xen-devel] " Julien Grall
2015-11-17  9:40 ` [PATCH v3 56/62] arm/acpi: Deny MMIO access of UART shannon.zhao at linaro.org
2015-11-17 12:04   ` Julien Grall
2015-11-17 13:10     ` Shannon Zhao
2015-11-27 14:50       ` Stefano Stabellini
2015-11-30 15:30       ` Julien Grall
2015-11-17  9:40 ` [PATCH v3 57/62] hvm/params: Add a new dilivery type for event-channel in HVM_PARAM_CALLBACK_IRQ shannon.zhao at linaro.org
2015-11-24  7:35   ` Jan Beulich
2015-11-17  9:40 ` [PATCH v3 58/62] xen/acpi: Fix event-channel interrupt when booting with ACPI shannon.zhao at linaro.org
2015-11-27 15:12   ` Stefano Stabellini
2015-11-30 15:30     ` Julien Grall
2015-11-17  9:40 ` [PATCH v3 59/62] xen/arm: Add a hypercall for device mmio mapping shannon.zhao at linaro.org
2015-11-17 11:04   ` Jan Beulich
2016-01-07  6:58     ` Shannon Zhao
2016-01-07  7:45       ` Jan Beulich
2016-01-07  9:11         ` Shannon Zhao
2016-01-07 10:50           ` Jan Beulich
2016-01-07 21:40             ` Daniel De Graaf
2016-01-08  2:12               ` Shannon Zhao
2015-11-17  9:40 ` [PATCH v3 60/62] arm/acpi: Configure interrupts dynamically shannon.zhao at linaro.org
2015-11-27 16:13   ` Stefano Stabellini
2015-11-27 16:19     ` Stefano Stabellini
2015-11-30 15:42   ` [Xen-devel] " Julien Grall
2016-01-05 11:51     ` Shannon Zhao
2016-01-05 14:18       ` Stefano Stabellini
2015-11-17  9:41 ` [PATCH v3 61/62] arm/acpi: Add acpi parameter to enable/disable acpi shannon.zhao at linaro.org
2015-11-17 12:26   ` Julien Grall
2015-11-17 12:57     ` Shannon Zhao
2015-11-17 14:32       ` Julien Grall
2015-11-17  9:41 ` [PATCH v3 62/62] xen/arm64: Add ACPI support shannon.zhao at linaro.org
2015-11-27 15:16   ` [Xen-devel] " Stefano Stabellini
2015-11-30 15:44   ` Julien Grall
2015-11-17 10:59 ` [PATCH v3 00/62] Add ACPI support for arm64 on Xen Jan Beulich
2015-11-17 11:10   ` David Vrabel
2015-11-17 13:02     ` Shannon Zhao
2015-11-17 11:52 ` Julien Grall
2015-11-18  8:03   ` Shannon Zhao
2015-11-18 12:18     ` Julien Grall

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=5684DBE0.80202@huawei.com \
    --to=zhaoshenglong@huawei$(echo .)com \
    --cc=linux-arm-kernel@lists$(echo .)infradead.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html
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