lkml.org 
[lkml]   [2020]   [Nov]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH v1 03/24] arm64: Move MAIR_EL1_SET to asm/memory.h
    On 2020-11-09 11:32, David Brazdil wrote:
    > KVM currently initializes MAIR_EL2 to the value of MAIR_EL1. In
    > preparation for initializing MAIR_EL2 before MAIR_EL1, move the
    > constant
    > into a shared header file.
    >
    > Signed-off-by: David Brazdil <dbrazdil@google.com>
    > ---
    > arch/arm64/include/asm/memory.h | 13 +++++++++++++
    > arch/arm64/mm/proc.S | 13 -------------
    > 2 files changed, 13 insertions(+), 13 deletions(-)
    >
    > diff --git a/arch/arm64/include/asm/memory.h
    > b/arch/arm64/include/asm/memory.h
    > index cd61239bae8c..aca00737e771 100644
    > --- a/arch/arm64/include/asm/memory.h
    > +++ b/arch/arm64/include/asm/memory.h
    > @@ -152,6 +152,19 @@
    > #define MT_S2_FWB_NORMAL 6
    > #define MT_S2_FWB_DEVICE_nGnRE 1
    >
    > +/*
    > + * Default MAIR_EL1. MT_NORMAL_TAGGED is initially mapped as Normal
    > memory and
    > + * changed during __cpu_setup to Normal Tagged if the system supports
    > MTE.
    > + */
    > +#define MAIR_EL1_SET \

    If we are going to use this at EL2 directly, consider renaming it to
    MAIR_ELx_SET, as we do for other constants that are shared across
    exception
    levels.

    > + (MAIR_ATTRIDX(MAIR_ATTR_DEVICE_nGnRnE, MT_DEVICE_nGnRnE) | \

    This creates an implicit dependency between sysreg.h and memory.h.
    Consider including asm/sysreg.h, assuming this doesn't create any
    circular
    dependency, or even move it to sysreg.h altogether.

    > + MAIR_ATTRIDX(MAIR_ATTR_DEVICE_nGnRE, MT_DEVICE_nGnRE) | \
    > + MAIR_ATTRIDX(MAIR_ATTR_DEVICE_GRE, MT_DEVICE_GRE) | \
    > + MAIR_ATTRIDX(MAIR_ATTR_NORMAL_NC, MT_NORMAL_NC) | \
    > + MAIR_ATTRIDX(MAIR_ATTR_NORMAL, MT_NORMAL) | \
    > + MAIR_ATTRIDX(MAIR_ATTR_NORMAL_WT, MT_NORMAL_WT) | \
    > + MAIR_ATTRIDX(MAIR_ATTR_NORMAL, MT_NORMAL_TAGGED))
    > +
    > #ifdef CONFIG_ARM64_4K_PAGES
    > #define IOREMAP_MAX_ORDER (PUD_SHIFT)
    > #else
    > diff --git a/arch/arm64/mm/proc.S b/arch/arm64/mm/proc.S
    > index 23c326a06b2d..25ff21b3a1c6 100644
    > --- a/arch/arm64/mm/proc.S
    > +++ b/arch/arm64/mm/proc.S
    > @@ -45,19 +45,6 @@
    > #define TCR_KASAN_FLAGS 0
    > #endif
    >
    > -/*
    > - * Default MAIR_EL1. MT_NORMAL_TAGGED is initially mapped as Normal
    > memory and
    > - * changed during __cpu_setup to Normal Tagged if the system supports
    > MTE.
    > - */
    > -#define MAIR_EL1_SET \
    > - (MAIR_ATTRIDX(MAIR_ATTR_DEVICE_nGnRnE, MT_DEVICE_nGnRnE) | \
    > - MAIR_ATTRIDX(MAIR_ATTR_DEVICE_nGnRE, MT_DEVICE_nGnRE) | \
    > - MAIR_ATTRIDX(MAIR_ATTR_DEVICE_GRE, MT_DEVICE_GRE) | \
    > - MAIR_ATTRIDX(MAIR_ATTR_NORMAL_NC, MT_NORMAL_NC) | \
    > - MAIR_ATTRIDX(MAIR_ATTR_NORMAL, MT_NORMAL) | \
    > - MAIR_ATTRIDX(MAIR_ATTR_NORMAL_WT, MT_NORMAL_WT) | \
    > - MAIR_ATTRIDX(MAIR_ATTR_NORMAL, MT_NORMAL_TAGGED))
    > -
    > #ifdef CONFIG_CPU_PM
    > /**
    > * cpu_do_suspend - save CPU registers context

    Thanks,

    M.
    --
    Jazz is not dead. It just smells funny...

    \
     
     \ /
      Last update: 2020-11-10 15:50    [W:5.054 / U:0.028 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site