[v4.4,20/45] mm: Introduce lm_alias

Message ID 8500aeb27596eef7bd952f988c8db0a4b2f655c6.1560480942.git.viresh.kumar@linaro.org
State New
Headers show
Series
  • V4.4 backport of arm64 Spectre patches
Related show

Commit Message

Viresh Kumar June 14, 2019, 3:08 a.m.
From: Laura Abbott <labbott@redhat.com>


commit 568c5fe5a54f2654f5a4c599c45b8a62ed9a2013 upstream.

Certain architectures may have the kernel image mapped separately to
alias the linear map. Introduce a macro lm_alias to translate a kernel
image symbol into its linear alias. This is used in part with work to
add CONFIG_DEBUG_VIRTUAL support for arm64.

Reviewed-by: Mark Rutland <mark.rutland@arm.com>

Tested-by: Mark Rutland <mark.rutland@arm.com>

Signed-off-by: Laura Abbott <labbott@redhat.com>

Signed-off-by: Will Deacon <will.deacon@arm.com>

Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>

---
 include/linux/mm.h | 4 ++++
 1 file changed, 4 insertions(+)

-- 
2.21.0.rc0.269.g1a574e7a288b

Comments

Julien Thierry June 17, 2019, 12:33 p.m. | #1
Hi Viresh,

On 14/06/2019 04:08, Viresh Kumar wrote:
> From: Laura Abbott <labbott@redhat.com>

> 

> commit 568c5fe5a54f2654f5a4c599c45b8a62ed9a2013 upstream.

> 

> Certain architectures may have the kernel image mapped separately to

> alias the linear map. Introduce a macro lm_alias to translate a kernel

> image symbol into its linear alias. This is used in part with work to

> add CONFIG_DEBUG_VIRTUAL support for arm64.

> 


I think this commit was backported in 4.9 because one of the commits you
dropped (6840bdd73d07 arm64: KVM: Use per-CPU vector when BP hardening
is enabled) depended on it. I have yet to check whether that other
commit can be just dropped, however on your branch 4.4 branch, lm_alias
isn't used anywhere, so we probably don't want to backport this
particular patch (unless we need to actually backport the other patch in
some way).

Cheers,

-- 
Julien Thierry
Viresh Kumar June 18, 2019, 5 a.m. | #2
On 17-06-19, 13:33, Julien Thierry wrote:
> I think this commit was backported in 4.9 because one of the commits you

> dropped (6840bdd73d07 arm64: KVM: Use per-CPU vector when BP hardening

> is enabled) depended on it.


Looks like that. I dropped 6840bdd73d07 patch at a later point of time when the
conflicts couldn't get resolved properly any further. I should have dropped
$subject one as well :(

> I have yet to check whether that other

> commit can be just dropped, however on your branch 4.4 branch, lm_alias

> isn't used anywhere, so we probably don't want to backport this

> particular patch (unless we need to actually backport the other patch in

> some way).


Right, dropping this doesn't generate any compilation warnings so we should be
good without it.

-- 
viresh

Patch

diff --git a/include/linux/mm.h b/include/linux/mm.h
index 251adf4d8a71..f86fdf015c74 100644
--- a/include/linux/mm.h
+++ b/include/linux/mm.h
@@ -59,6 +59,10 @@  extern int sysctl_legacy_va_layout;
 #define __pa_symbol(x)  __pa(RELOC_HIDE((unsigned long)(x), 0))
 #endif
 
+#ifndef lm_alias
+#define lm_alias(x)	__va(__pa_symbol(x))
+#endif
+
 /*
  * To prevent common memory management code establishing
  * a zero page mapping on a read fault.