Linux ARM-MSM sub-architecture
 help / color / mirror / Atom feed
From: "Jonathan (Zhixiong) Zhang" <zjzhang-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
To: Matt Fleming
	<matt.fleming-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org>,
	Thomas Gleixner <tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org>,
	Ingo Molnar <mingo-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>,
	"H. Peter Anvin" <hpa-YMNOUZJC4hwAvxtiuMwx3w@public.gmane.org>,
	x86-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org,
	leif.lindholm-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org,
	al.stone-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org,
	fu.wei-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org
Cc: "Jonathan (Zhixiong) Zhang"
	<zjzhang-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>,
	linux-efi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linux-arm-msm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org,
	linaro-acpi-cunTk1MwBs8s++Sfvej+rw@public.gmane.org,
	vgandhi-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org
Subject: [PATCH V2 2/3] efi: add efi_remap()
Date: Mon,  1 Jun 2015 12:12:19 -0700	[thread overview]
Message-ID: <1433185940-24770-3-git-send-email-zjzhang@codeaurora.org> (raw)
In-Reply-To: <1433185940-24770-1-git-send-email-zjzhang-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>

From: "Jonathan (Zhixiong) Zhang" <zjzhang-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>

If it is a EFI system, if EFI memmap is enabled and if
a memory region has attribute of EFI_MEMORY_UC, map it as uncached.

On x86, EFI memmap is unmapped in efi_free_boot_services(),
before kernel finishes booting. So when efi_remap() is called
during runtime on x86, it maps the region as cached.

Signed-off-by: Jonathan (Zhixiong) Zhang <zjzhang-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
---
 drivers/firmware/efi/efi.c | 9 +++++++++
 include/linux/efi.h        | 1 +
 2 files changed, 10 insertions(+)

diff --git a/drivers/firmware/efi/efi.c b/drivers/firmware/efi/efi.c
index 86da85368778..5b42bb6d1fde 100644
--- a/drivers/firmware/efi/efi.c
+++ b/drivers/firmware/efi/efi.c
@@ -535,3 +535,12 @@ u64 efi_mem_attributes(unsigned long phys_addr)
 	}
 	return 0;
 }
+
+void __iomem *efi_remap(phys_addr_t phys_addr, size_t size)
+{
+	if (efi_enabled(EFI_MEMMAP) &&
+	    (efi_mem_attributes(phys_addr) & EFI_MEMORY_UC))
+		return ioremap(phys_addr, size);
+	else
+		return ioremap_cache(phys_addr, size);
+}
diff --git a/include/linux/efi.h b/include/linux/efi.h
index af5be0368dec..0a0aa25d44d7 100644
--- a/include/linux/efi.h
+++ b/include/linux/efi.h
@@ -888,6 +888,7 @@ extern void efi_get_time(struct timespec *now);
 extern void efi_reserve_boot_services(void);
 extern int efi_get_fdt_params(struct efi_fdt_params *params, int verbose);
 extern struct efi_memory_map memmap;
+extern void __iomem *efi_remap(phys_addr_t phys_addr, size_t size);
 
 extern int efi_reboot_quirk_mode;
 extern bool efi_poweroff_required(void);
-- 
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project

  parent reply	other threads:[~2015-06-01 19:12 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-06-01 19:12 [PATCH V2 0/3] map GHES memory region with EFI memory map Jonathan (Zhixiong) Zhang
2015-06-01 19:12 ` [PATCH V2 1/3] efi: arch, x86: arch, ia64: move efi_mem_attributes() Jonathan (Zhixiong) Zhang
     [not found]   ` <1433185940-24770-2-git-send-email-zjzhang-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2015-06-02 13:36     ` Matt Fleming
2015-06-03  0:09       ` Zhang, Jonathan Zhixiong
2015-06-05  9:23         ` Matt Fleming
2015-06-05 16:44           ` Zhang, Jonathan Zhixiong
     [not found] ` <1433185940-24770-1-git-send-email-zjzhang-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org>
2015-06-01 19:12   ` Jonathan (Zhixiong) Zhang [this message]
2015-06-01 19:12 ` [PATCH V2 3/3] acpi, apei: use EFI memmap to map GHES memory Jonathan (Zhixiong) Zhang
2015-06-05  9:57   ` Matt Fleming
2015-06-05 10:25     ` Borislav Petkov
2015-06-05 17:05       ` Zhang, Jonathan Zhixiong
2015-06-05 17:12         ` Borislav Petkov
2015-06-05 21:43           ` Zhang, Jonathan Zhixiong
2015-06-05 16:43     ` Zhang, Jonathan Zhixiong
2015-06-05 16:50       ` Borislav Petkov
2015-06-05 17:06         ` Zhang, Jonathan Zhixiong

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=1433185940-24770-3-git-send-email-zjzhang@codeaurora.org \
    --to=zjzhang-sgv2jx0feol9jmxxk+q4oq@public.gmane.org \
    --cc=al.stone-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=fu.wei-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=hpa-YMNOUZJC4hwAvxtiuMwx3w@public.gmane.org \
    --cc=leif.lindholm-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org \
    --cc=linaro-acpi-cunTk1MwBs8s++Sfvej+rw@public.gmane.org \
    --cc=linux-arm-msm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-efi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org \
    --cc=matt.fleming-ral2JQCrhuEAvxtiuMwx3w@public.gmane.org \
    --cc=mingo-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org \
    --cc=tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org \
    --cc=vgandhi-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org \
    --cc=x86-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.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