From: Ingo Molnar <mingo@kernel.org>
To: Matt Fleming <matt@codeblueprint.co.uk>
Cc: Thomas Gleixner <tglx@linutronix.de>,
"H. Peter Anvin" <hpa@zytor.com>,
"Jonathan (Zhixiong) Zhang" <zjzhang@codeaurora.org>,
linux-kernel@vger.kernel.org, linux-efi@vger.kernel.org,
Matt Fleming <matt.fleming@intel.com>,
Ard Biesheuvel <ard.biesheuvel@linaro.org>,
Catalin Marinas <catalin.marinas@arm.com>,
Hanjun Guo <hanjun.guo@linaro.org>
Subject: Re: [PATCH 1/2] arm64: apei: implement arch_apei_get_mem_attributes()
Date: Thu, 13 Aug 2015 10:22:07 +0200 [thread overview]
Message-ID: <20150813082207.GB14610@gmail.com> (raw)
In-Reply-To: <1439396234-22863-2-git-send-email-matt@codeblueprint.co.uk>
* Matt Fleming <matt@codeblueprint.co.uk> wrote:
> From: "Jonathan (Zhixiong) Zhang" <zjzhang@codeaurora.org>
>
> Table 8 of UEFI 2.5 section 2.3.6.1 defines mappings from EFI
> memory types to MAIR attribute encodings for arm64.
>
> If the physical address has memory attributes defined by EFI
> memmap as EFI_MEMORY_[UC|WC|WT], return approprate page protection
> type according to the UEFI spec. Otherwise, return PAGE_KERNEL.
>
> Reviewed-by: Catalin Marinas <catalin.marinas@arm.com>
> Acked-by: Hanjun Guo <hanjun.guo@linaro.org>
> Reviewed-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
> Signed-off-by: Jonathan (Zhixiong) Zhang <zjzhang@codeaurora.org>
> Signed-off-by: Matt Fleming <matt.fleming@intel.com>
> ---
> arch/arm64/include/asm/acpi.h | 30 ++++++++++++++++++++++++++++++
> 1 file changed, 30 insertions(+)
>
> diff --git a/arch/arm64/include/asm/acpi.h b/arch/arm64/include/asm/acpi.h
> index 406485ed110a..1cbad43e561d 100644
> --- a/arch/arm64/include/asm/acpi.h
> +++ b/arch/arm64/include/asm/acpi.h
> @@ -19,6 +19,11 @@
> #include <asm/psci.h>
> #include <asm/smp_plat.h>
>
> +#ifdef CONFIG_ACPI_APEI
> +#include <linux/efi.h>
> +#include <asm/pgtable.h>
> +#endif
> +
> /* Macros for consistency checks of the GICC subtable of MADT */
> #define ACPI_MADT_GICC_LENGTH \
> (acpi_gbl_FADT.header.revision < 6 ? 76 : 80)
> @@ -92,4 +97,29 @@ static inline const char *acpi_get_enable_method(int cpu)
> {
> return acpi_psci_present() ? "psci" : NULL;
> }
> +
> +#ifdef CONFIG_ACPI_APEI
> +static inline pgprot_t arch_apei_get_mem_attribute(phys_addr_t addr)
> +{
> + /*
> + * According to "Table 8 Map: EFI memory types to AArch64 memory types"
> + * of UEFI 2.5 section 2.3.6.1, each EFI memory type is mapped to
> + * corresponding MAIR attribute encoding.
s/mapped to corresponding/
mapped to a corresponding
> + * The EFI memory attribute advises all possible capabilities of a
> + * memory region. We use the most efficient capability.
> + */
> +
> + u64 attr;
> +
> + attr = efi_mem_attributes(addr);
> + if (attr & EFI_MEMORY_WB)
> + return PAGE_KERNEL;
> + if (attr & EFI_MEMORY_WT)
> + return __pgprot(PROT_NORMAL_WT);
> + if (attr & EFI_MEMORY_WC)
> + return __pgprot(PROT_NORMAL_NC);
> + return __pgprot(PROT_DEVICE_nGnRnE);
> +}
> +#endif
Also, this doesn't look like a small function - why is it inlined?
Moving it to .c would also slightly improve compilation times for every .c file
that includes asm/acpi.h.
Thanks,
Ingo
next prev parent reply other threads:[~2015-08-13 8:22 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-08-12 16:17 [GIT PULL 0/2] EFI changes for v4.3 (part two) Matt Fleming
2015-08-12 16:17 ` [PATCH 1/2] arm64: apei: implement arch_apei_get_mem_attributes() Matt Fleming
2015-08-13 8:22 ` Ingo Molnar [this message]
[not found] ` <20150813082207.GB14610-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-08-14 18:55 ` Zhang, Jonathan Zhixiong
2015-08-14 19:12 ` Matt Fleming
2015-08-12 16:17 ` [PATCH 2/2] acpi, apei: use appropriate pgprot_t to map GHES memory Matt Fleming
[not found] ` <1439396234-22863-3-git-send-email-matt-mF/unelCI9GS6iBeEJttW/XRex20P6io@public.gmane.org>
2015-08-13 8:19 ` Ingo Molnar
[not found] ` <20150813081917.GA14610-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-08-13 9:24 ` Matt Fleming
[not found] ` <20150813092432.GA2797-mF/unelCI9GS6iBeEJttW/XRex20P6io@public.gmane.org>
2015-08-13 11:14 ` Will Deacon
[not found] ` <20150813111422.GE10280-5wv7dgnIgG8@public.gmane.org>
2015-08-14 19:09 ` Zhang, Jonathan Zhixiong
-- strict thread matches above, loose matches on Subject: below --
2015-09-04 13:11 [GIT PULL 0/2] EFI changes for v4.3 (part two) Matt Fleming
2015-09-04 13:11 ` [PATCH 1/2] arm64: apei: Implement arch_apei_get_mem_attributes() Matt Fleming
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=20150813082207.GB14610@gmail.com \
--to=mingo@kernel.org \
--cc=ard.biesheuvel@linaro.org \
--cc=catalin.marinas@arm.com \
--cc=hanjun.guo@linaro.org \
--cc=hpa@zytor.com \
--cc=linux-efi@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=matt.fleming@intel.com \
--cc=matt@codeblueprint.co.uk \
--cc=tglx@linutronix.de \
--cc=zjzhang@codeaurora.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).