diff mbox series

[18/26] target/arm: Export aa64_va_parameters to internals.h

Message ID 20181207103631.28193-19-richard.henderson@linaro.org
State New
Headers show
Series target/arm: Implement ARMv8.3-PAuth | expand

Commit Message

Richard Henderson Dec. 7, 2018, 10:36 a.m. UTC
We need to reuse this from helper-a64.c.  Provide a stub
definition for CONFIG_USER_ONLY.  This matches the stub
definitions that we removed for arm_regime_tbi{0,1} before.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>

---
 target/arm/internals.h | 29 +++++++++++++++++++++++++++++
 target/arm/helper.c    | 16 ++--------------
 2 files changed, 31 insertions(+), 14 deletions(-)

-- 
2.17.2

Comments

Peter Maydell Dec. 11, 2018, 4:53 p.m. UTC | #1
On Fri, 7 Dec 2018 at 10:37, Richard Henderson
<richard.henderson@linaro.org> wrote:
>

> We need to reuse this from helper-a64.c.  Provide a stub

> definition for CONFIG_USER_ONLY.  This matches the stub

> definitions that we removed for arm_regime_tbi{0,1} before.

>

> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>

> ---

>  target/arm/internals.h | 29 +++++++++++++++++++++++++++++

>  target/arm/helper.c    | 16 ++--------------

>  2 files changed, 31 insertions(+), 14 deletions(-)


Reviewed-by: Peter Maydell <peter.maydell@linaro.org>


thanks
-- PMM
Richard Henderson Dec. 11, 2018, 6:23 p.m. UTC | #2
On 12/11/18 10:53 AM, Peter Maydell wrote:
> On Fri, 7 Dec 2018 at 10:37, Richard Henderson

> <richard.henderson@linaro.org> wrote:

>>

>> We need to reuse this from helper-a64.c.  Provide a stub

>> definition for CONFIG_USER_ONLY.  This matches the stub

>> definitions that we removed for arm_regime_tbi{0,1} before.

>>

>> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>

>> ---

>>  target/arm/internals.h | 29 +++++++++++++++++++++++++++++

>>  target/arm/helper.c    | 16 ++--------------

>>  2 files changed, 31 insertions(+), 14 deletions(-)

> 

> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>


FWIW, I'll smoosh this into the creation of the helper.
At some point we may fix tbi for user-only.


r~
diff mbox series

Patch

diff --git a/target/arm/internals.h b/target/arm/internals.h
index 6bc0daf560..4d25b267e8 100644
--- a/target/arm/internals.h
+++ b/target/arm/internals.h
@@ -912,4 +912,33 @@  void arm_cpu_update_virq(ARMCPU *cpu);
  */
 void arm_cpu_update_vfiq(ARMCPU *cpu);
 
+typedef struct ARMVAParameters {
+    unsigned tsz    : 8;
+    unsigned select : 1;
+    bool tbi        : 1;
+    bool epd        : 1;
+    bool hpd        : 1;
+    bool ha         : 1;
+    bool hd         : 1;
+    bool using16k   : 1;
+    bool using64k   : 1;
+} ARMVAParameters;
+
+#ifdef CONFIG_USER_ONLY
+static inline ARMVAParameters aa64_va_parameters(CPUARMState *env,
+                                                 uint64_t va,
+                                                 ARMMMUIdx mmu_idx, bool data)
+{
+    return (ARMVAParameters) {
+        /* 48-bit address space */
+        .tsz = 16,
+        /* We can't handle tagged addresses properly in user-only mode */
+        .tbi = false,
+    };
+}
+#else
+ARMVAParameters aa64_va_parameters(CPUARMState *env, uint64_t va,
+                                   ARMMMUIdx mmu_idx, bool data);
+#endif
+
 #endif
diff --git a/target/arm/helper.c b/target/arm/helper.c
index 3ad5909b1e..c73525f813 100644
--- a/target/arm/helper.c
+++ b/target/arm/helper.c
@@ -9712,20 +9712,8 @@  static uint8_t convert_stage2_attrs(CPUARMState *env, uint8_t s2attrs)
     return (hiattr << 6) | (hihint << 4) | (loattr << 2) | lohint;
 }
 
-typedef struct ARMVAParameters {
-    unsigned tsz    : 8;
-    unsigned select : 1;
-    bool tbi        : 1;
-    bool epd        : 1;
-    bool hpd        : 1;
-    bool ha         : 1;
-    bool hd         : 1;
-    bool using16k   : 1;
-    bool using64k   : 1;
-} ARMVAParameters;
-
-static ARMVAParameters aa64_va_parameters(CPUARMState *env, uint64_t va,
-                                          ARMMMUIdx mmu_idx, bool data)
+ARMVAParameters aa64_va_parameters(CPUARMState *env, uint64_t va,
+                                   ARMMMUIdx mmu_idx, bool data)
 {
     uint64_t tcr = regime_tcr(env, mmu_idx)->raw_tcr;
     uint32_t el = regime_el(env, mmu_idx);