diff mbox series

[for-6.2,10/43] target/s390x: Implement do_unaligned_access for user-only

Message ID 20210729004647.282017-11-richard.henderson@linaro.org
State Superseded
Headers show
Series Unaligned accesses for user-only | expand

Commit Message

Richard Henderson July 29, 2021, 12:46 a.m. UTC
Cc: qemu-s390x@nongnu.org
Signed-off-by: Richard Henderson <richard.henderson@linaro.org>

---
 target/s390x/cpu.c             |  2 +-
 target/s390x/tcg/excp_helper.c | 28 +++++++++++++++-------------
 2 files changed, 16 insertions(+), 14 deletions(-)

-- 
2.25.1

Comments

David Hildenbrand July 29, 2021, 8:03 a.m. UTC | #1
On 29.07.21 02:46, Richard Henderson wrote:
> Cc: qemu-s390x@nongnu.org

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

> ---

>   target/s390x/cpu.c             |  2 +-

>   target/s390x/tcg/excp_helper.c | 28 +++++++++++++++-------------

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

> 

> diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c

> index 7b7b05f1d3..9d8cfb37cd 100644

> --- a/target/s390x/cpu.c

> +++ b/target/s390x/cpu.c

> @@ -267,12 +267,12 @@ static void s390_cpu_reset_full(DeviceState *dev)

>   static const struct TCGCPUOps s390_tcg_ops = {

>       .initialize = s390x_translate_init,

>       .tlb_fill = s390_cpu_tlb_fill,

> +    .do_unaligned_access = s390x_cpu_do_unaligned_access,

>   

>   #if !defined(CONFIG_USER_ONLY)

>       .cpu_exec_interrupt = s390_cpu_exec_interrupt,

>       .do_interrupt = s390_cpu_do_interrupt,

>       .debug_excp_handler = s390x_cpu_debug_excp_handler,

> -    .do_unaligned_access = s390x_cpu_do_unaligned_access,

>   #endif /* !CONFIG_USER_ONLY */

>   };

>   #endif /* CONFIG_TCG */

> diff --git a/target/s390x/tcg/excp_helper.c b/target/s390x/tcg/excp_helper.c

> index a61917d04f..9cbe160f66 100644

> --- a/target/s390x/tcg/excp_helper.c

> +++ b/target/s390x/tcg/excp_helper.c

> @@ -82,6 +82,21 @@ void HELPER(data_exception)(CPUS390XState *env, uint32_t dxc)

>       tcg_s390_data_exception(env, dxc, GETPC());

>   }

>   

> +/*

> + * Unaligned accesses are only diagnosed with MO_ALIGN.  At the moment,

> + * this is only for the atomic operations, for which we want to raise a

> + * specification exception.

> + */

> +void s390x_cpu_do_unaligned_access(CPUState *cs, vaddr addr,

> +                                   MMUAccessType access_type,

> +                                   int mmu_idx, uintptr_t retaddr)

> +{

> +    S390CPU *cpu = S390_CPU(cs);

> +    CPUS390XState *env = &cpu->env;

> +

> +    tcg_s390_program_interrupt(env, PGM_SPECIFICATION, retaddr);

> +}

> +

>   #if defined(CONFIG_USER_ONLY)

>   

>   void s390_cpu_do_interrupt(CPUState *cs)

> @@ -602,19 +617,6 @@ void s390x_cpu_debug_excp_handler(CPUState *cs)

>       }

>   }

>   

> -/* Unaligned accesses are only diagnosed with MO_ALIGN.  At the moment,

> -   this is only for the atomic operations, for which we want to raise a

> -   specification exception.  */

> -void s390x_cpu_do_unaligned_access(CPUState *cs, vaddr addr,

> -                                   MMUAccessType access_type,

> -                                   int mmu_idx, uintptr_t retaddr)

> -{

> -    S390CPU *cpu = S390_CPU(cs);

> -    CPUS390XState *env = &cpu->env;

> -

> -    tcg_s390_program_interrupt(env, PGM_SPECIFICATION, retaddr);

> -}

> -

>   static void QEMU_NORETURN monitor_event(CPUS390XState *env,

>                                           uint64_t monitor_code,

>                                           uint8_t monitor_class, uintptr_t ra)

> 


Reviewed-by: David Hildenbrand <david@redhat.com>


-- 
Thanks,

David / dhildenb
diff mbox series

Patch

diff --git a/target/s390x/cpu.c b/target/s390x/cpu.c
index 7b7b05f1d3..9d8cfb37cd 100644
--- a/target/s390x/cpu.c
+++ b/target/s390x/cpu.c
@@ -267,12 +267,12 @@  static void s390_cpu_reset_full(DeviceState *dev)
 static const struct TCGCPUOps s390_tcg_ops = {
     .initialize = s390x_translate_init,
     .tlb_fill = s390_cpu_tlb_fill,
+    .do_unaligned_access = s390x_cpu_do_unaligned_access,
 
 #if !defined(CONFIG_USER_ONLY)
     .cpu_exec_interrupt = s390_cpu_exec_interrupt,
     .do_interrupt = s390_cpu_do_interrupt,
     .debug_excp_handler = s390x_cpu_debug_excp_handler,
-    .do_unaligned_access = s390x_cpu_do_unaligned_access,
 #endif /* !CONFIG_USER_ONLY */
 };
 #endif /* CONFIG_TCG */
diff --git a/target/s390x/tcg/excp_helper.c b/target/s390x/tcg/excp_helper.c
index a61917d04f..9cbe160f66 100644
--- a/target/s390x/tcg/excp_helper.c
+++ b/target/s390x/tcg/excp_helper.c
@@ -82,6 +82,21 @@  void HELPER(data_exception)(CPUS390XState *env, uint32_t dxc)
     tcg_s390_data_exception(env, dxc, GETPC());
 }
 
+/*
+ * Unaligned accesses are only diagnosed with MO_ALIGN.  At the moment,
+ * this is only for the atomic operations, for which we want to raise a
+ * specification exception.
+ */
+void s390x_cpu_do_unaligned_access(CPUState *cs, vaddr addr,
+                                   MMUAccessType access_type,
+                                   int mmu_idx, uintptr_t retaddr)
+{
+    S390CPU *cpu = S390_CPU(cs);
+    CPUS390XState *env = &cpu->env;
+
+    tcg_s390_program_interrupt(env, PGM_SPECIFICATION, retaddr);
+}
+
 #if defined(CONFIG_USER_ONLY)
 
 void s390_cpu_do_interrupt(CPUState *cs)
@@ -602,19 +617,6 @@  void s390x_cpu_debug_excp_handler(CPUState *cs)
     }
 }
 
-/* Unaligned accesses are only diagnosed with MO_ALIGN.  At the moment,
-   this is only for the atomic operations, for which we want to raise a
-   specification exception.  */
-void s390x_cpu_do_unaligned_access(CPUState *cs, vaddr addr,
-                                   MMUAccessType access_type,
-                                   int mmu_idx, uintptr_t retaddr)
-{
-    S390CPU *cpu = S390_CPU(cs);
-    CPUS390XState *env = &cpu->env;
-
-    tcg_s390_program_interrupt(env, PGM_SPECIFICATION, retaddr);
-}
-
 static void QEMU_NORETURN monitor_event(CPUS390XState *env,
                                         uint64_t monitor_code,
                                         uint8_t monitor_class, uintptr_t ra)