Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1207931 > unrolled thread
| Started by | "Jonathan (Zhixiong) Zhang" <zjzhang@codeaurora.org> |
|---|---|
| First post | 2015-08-15 00:40 +0200 |
| Last post | 2015-08-17 23:20 +0200 |
| Articles | 3 — 3 participants |
Back to article view | Back to linux.kernel
[PATCH V2 1/2] arm64: apei: implement arch_apei_get_mem_attributes() "Jonathan (Zhixiong) Zhang" <zjzhang@codeaurora.org> - 2015-08-15 00:40 +0200
Re: [PATCH V2 1/2] arm64: apei: implement arch_apei_get_mem_attributes() Matt Fleming <matt@codeblueprint.co.uk> - 2015-08-17 15:10 +0200
Re: [PATCH V2 1/2] arm64: apei: implement arch_apei_get_mem_attributes() "Zhang, Jonathan Zhixiong" <zjzhang@codeaurora.org> - 2015-08-17 23:20 +0200
| From | "Jonathan (Zhixiong) Zhang" <zjzhang@codeaurora.org> |
|---|---|
| Date | 2015-08-15 00:40 +0200 |
| Subject | [PATCH V2 1/2] arm64: apei: implement arch_apei_get_mem_attributes() |
| Message-ID | <pXvNM-7b2-13@gated-at.bofh.it> |
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>
Signed-off-by: Jonathan (Zhixiong) Zhang <zjzhang@codeaurora.org>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Matt Fleming <matt.fleming@intel.com>
Cc: Hanjun Guo <hanjun.guo@linaro.org>
Cc: Will Deacon <will.deacon@arm.com>
---
V2: Changed arm64's implementation of arch_apei_get_mem_attributes()
from inline function to out of line function, based on Ingo's
feedback.
arch/arm64/include/asm/acpi.h | 5 +++++
arch/arm64/kernel/acpi.c | 29 +++++++++++++++++++++++++++++
2 files changed, 34 insertions(+)
diff --git a/arch/arm64/include/asm/acpi.h b/arch/arm64/include/asm/acpi.h
index 406485ed110a..8084f3640006 100644
--- a/arch/arm64/include/asm/acpi.h
+++ b/arch/arm64/include/asm/acpi.h
@@ -92,4 +92,9 @@ static inline const char *acpi_get_enable_method(int cpu)
{
return acpi_psci_present() ? "psci" : NULL;
}
+
+#ifdef CONFIG_ACPI_APEI
+pgprot_t arch_apei_get_mem_attribute(phys_addr_t addr);
+#endif
+
#endif /*_ASM_ACPI_H*/
diff --git a/arch/arm64/kernel/acpi.c b/arch/arm64/kernel/acpi.c
index 19de7537e7d3..9f083606e5bf 100644
--- a/arch/arm64/kernel/acpi.c
+++ b/arch/arm64/kernel/acpi.c
@@ -29,6 +29,11 @@
#include <asm/cpu_ops.h>
#include <asm/smp_plat.h>
+#ifdef CONFIG_ACPI_APEI
+#include <linux/efi.h>
+#include <asm/pgtable.h>
+#endif
+
int acpi_noirq = 1; /* skip ACPI IRQ initialization */
int acpi_disabled = 1;
EXPORT_SYMBOL(acpi_disabled);
@@ -230,3 +235,27 @@ void __init acpi_gic_init(void)
early_acpi_os_unmap_memory((char *)table, tbl_size);
}
+
+#ifdef CONFIG_ACPI_APEI
+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 a corresponding MAIR attribute encoding.
+ * 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
--
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
[toc] | [next] | [standalone]
| From | Matt Fleming <matt@codeblueprint.co.uk> |
|---|---|
| Date | 2015-08-17 15:10 +0200 |
| Subject | Re: [PATCH V2 1/2] arm64: apei: implement arch_apei_get_mem_attributes() |
| Message-ID | <pYskQ-8di-57@gated-at.bofh.it> |
| In reply to | #1207931 |
On Fri, 14 Aug, at 03:37:29PM, Jonathan (Zhixiong) Zhang 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> > Signed-off-by: Jonathan (Zhixiong) Zhang <zjzhang@codeaurora.org> > Cc: Ingo Molnar <mingo@kernel.org> > Cc: Matt Fleming <matt.fleming@intel.com> > Cc: Hanjun Guo <hanjun.guo@linaro.org> > Cc: Will Deacon <will.deacon@arm.com> > --- > V2: Changed arm64's implementation of arch_apei_get_mem_attributes() > from inline function to out of line function, based on Ingo's > feedback. > > arch/arm64/include/asm/acpi.h | 5 +++++ > arch/arm64/kernel/acpi.c | 29 +++++++++++++++++++++++++++++ > 2 files changed, 34 insertions(+) > Looks fine to me, though it appears to be missing Ard's Reviewed-by tag (the only change from the previous version is that it's no longer inline). Reviewed-by: Matt Fleming <matt.fleming@intel.com> Ingo, are you going to pick up this patch series and apply it directly to tip if you're OK with this version? -- Matt Fleming, Intel Open Source Technology Center -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [next] | [standalone]
| From | "Zhang, Jonathan Zhixiong" <zjzhang@codeaurora.org> |
|---|---|
| Date | 2015-08-17 23:20 +0200 |
| Subject | Re: [PATCH V2 1/2] arm64: apei: implement arch_apei_get_mem_attributes() |
| Message-ID | <pYzYZ-2iz-9@gated-at.bofh.it> |
| In reply to | #1208580 |
On 8/17/2015 6:05 AM, Matt Fleming wrote: > On Fri, 14 Aug, at 03:37:29PM, Jonathan (Zhixiong) Zhang 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> >> Signed-off-by: Jonathan (Zhixiong) Zhang <zjzhang@codeaurora.org> >> Cc: Ingo Molnar <mingo@kernel.org> >> Cc: Matt Fleming <matt.fleming@intel.com> >> Cc: Hanjun Guo <hanjun.guo@linaro.org> >> Cc: Will Deacon <will.deacon@arm.com> >> --- >> V2: Changed arm64's implementation of arch_apei_get_mem_attributes() >> from inline function to out of line function, based on Ingo's >> feedback. >> >> arch/arm64/include/asm/acpi.h | 5 +++++ >> arch/arm64/kernel/acpi.c | 29 +++++++++++++++++++++++++++++ >> 2 files changed, 34 insertions(+) >> > > Looks fine to me, though it appears to be missing Ard's Reviewed-by > tag (the only change from the previous version is that it's no longer > inline). > > Reviewed-by: Matt Fleming <matt.fleming@intel.com> Thanks. Will add both Reviewed-by. > > Ingo, are you going to pick up this patch series and apply it directly > to tip if you're OK with this version? > -- Jonathan (Zhixiong) Zhang The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/
[toc] | [prev] | [standalone]
Back to top | Article view | linux.kernel
csiph-web