lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1433185940-24770-3-git-send-email-zjzhang@codeaurora.org>
Date:	Mon,  1 Jun 2015 12:12:19 -0700
From:	"Jonathan (Zhixiong) Zhang" <zjzhang@...eaurora.org>
To:	Matt Fleming <matt.fleming@...el.com>,
	Thomas Gleixner <tglx@...utronix.de>,
	Ingo Molnar <mingo@...hat.com>,
	"H. Peter Anvin" <hpa@...or.com>, x86@...nel.org,
	leif.lindholm@...aro.org, al.stone@...aro.org, fu.wei@...aro.org
Cc:	"Jonathan (Zhixiong) Zhang" <zjzhang@...eaurora.org>,
	linux-efi@...r.kernel.org, linux-kernel@...r.kernel.org,
	linux-arm-msm@...r.kernel.org, linaro-acpi@...ts.linaro.org,
	vgandhi@...eaurora.org
Subject: [PATCH V2 2/3] efi: add efi_remap()

From: "Jonathan (Zhixiong) Zhang" <zjzhang@...eaurora.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@...eaurora.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

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ