[for-6.2,01/43] hw/core: Make do_unaligned_access available to user-only

Message ID 20210729004647.282017-2-richard.henderson@linaro.org
State New
Headers show
Series
  • Unaligned accesses for user-only
Related show

Commit Message

Richard Henderson July 29, 2021, 12:46 a.m.
We shouldn't be ignoring SIGBUS for user-only.
Move our existing TCGCPUOps hook out from CONFIG_SOFTMMU.

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

---
 include/hw/core/tcg-cpu-ops.h | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)

-- 
2.25.1

Comments

Philippe Mathieu-Daudé July 29, 2021, 6:14 a.m. | #1
On 7/29/21 2:46 AM, Richard Henderson wrote:
> We shouldn't be ignoring SIGBUS for user-only.

> Move our existing TCGCPUOps hook out from CONFIG_SOFTMMU.

> 

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

> ---

>  include/hw/core/tcg-cpu-ops.h | 14 +++++++-------

>  1 file changed, 7 insertions(+), 7 deletions(-)


Reviewed-by: Philippe Mathieu-Daudé <f4bug@amsat.org>
Philippe Mathieu-Daudé July 29, 2021, 6:19 a.m. | #2
On 7/29/21 2:46 AM, Richard Henderson wrote:
> We shouldn't be ignoring SIGBUS for user-only.

> Move our existing TCGCPUOps hook out from CONFIG_SOFTMMU.

> 

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

> ---

>  include/hw/core/tcg-cpu-ops.h | 14 +++++++-------

>  1 file changed, 7 insertions(+), 7 deletions(-)

> 

> diff --git a/include/hw/core/tcg-cpu-ops.h b/include/hw/core/tcg-cpu-ops.h

> index eab27d0c03..513d6bfe72 100644

> --- a/include/hw/core/tcg-cpu-ops.h

> +++ b/include/hw/core/tcg-cpu-ops.h

> @@ -60,6 +60,13 @@ struct TCGCPUOps {

>      /** @debug_excp_handler: Callback for handling debug exceptions */

>      void (*debug_excp_handler)(CPUState *cpu);

>  

> +    /**

> +     * @do_unaligned_access: Callback for unaligned access handling

> +     */

> +    void (*do_unaligned_access)(CPUState *cpu, vaddr addr,

> +                                MMUAccessType access_type,

> +                                int mmu_idx, uintptr_t retaddr);


Shouldn't it be QEMU_NORETURN?
Peter Maydell July 29, 2021, 1:05 p.m. | #3
On Thu, 29 Jul 2021 at 01:50, Richard Henderson
<richard.henderson@linaro.org> wrote:
>

> We shouldn't be ignoring SIGBUS for user-only.

> Move our existing TCGCPUOps hook out from CONFIG_SOFTMMU.

>

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


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


thanks
-- PMM
Richard Henderson July 29, 2021, 5:51 p.m. | #4
On 7/28/21 8:19 PM, Philippe Mathieu-Daudé wrote:
> On 7/29/21 2:46 AM, Richard Henderson wrote:

>> We shouldn't be ignoring SIGBUS for user-only.

>> Move our existing TCGCPUOps hook out from CONFIG_SOFTMMU.

>>

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

>> ---

>>   include/hw/core/tcg-cpu-ops.h | 14 +++++++-------

>>   1 file changed, 7 insertions(+), 7 deletions(-)

>>

>> diff --git a/include/hw/core/tcg-cpu-ops.h b/include/hw/core/tcg-cpu-ops.h

>> index eab27d0c03..513d6bfe72 100644

>> --- a/include/hw/core/tcg-cpu-ops.h

>> +++ b/include/hw/core/tcg-cpu-ops.h

>> @@ -60,6 +60,13 @@ struct TCGCPUOps {

>>       /** @debug_excp_handler: Callback for handling debug exceptions */

>>       void (*debug_excp_handler)(CPUState *cpu);

>>   

>> +    /**

>> +     * @do_unaligned_access: Callback for unaligned access handling

>> +     */

>> +    void (*do_unaligned_access)(CPUState *cpu, vaddr addr,

>> +                                MMUAccessType access_type,

>> +                                int mmu_idx, uintptr_t retaddr);

> 

> Shouldn't it be QEMU_NORETURN?

> 


I think in system mode we're allowed to return, letting the unaligned access continue. 
But I'm not sure about that, and it may not even be used.

r~

Patch

diff --git a/include/hw/core/tcg-cpu-ops.h b/include/hw/core/tcg-cpu-ops.h
index eab27d0c03..513d6bfe72 100644
--- a/include/hw/core/tcg-cpu-ops.h
+++ b/include/hw/core/tcg-cpu-ops.h
@@ -60,6 +60,13 @@  struct TCGCPUOps {
     /** @debug_excp_handler: Callback for handling debug exceptions */
     void (*debug_excp_handler)(CPUState *cpu);
 
+    /**
+     * @do_unaligned_access: Callback for unaligned access handling
+     */
+    void (*do_unaligned_access)(CPUState *cpu, vaddr addr,
+                                MMUAccessType access_type,
+                                int mmu_idx, uintptr_t retaddr);
+
 #ifdef NEED_CPU_H
 #ifdef CONFIG_SOFTMMU
     /**
@@ -70,13 +77,6 @@  struct TCGCPUOps {
                                   unsigned size, MMUAccessType access_type,
                                   int mmu_idx, MemTxAttrs attrs,
                                   MemTxResult response, uintptr_t retaddr);
-    /**
-     * @do_unaligned_access: Callback for unaligned access handling
-     */
-    void (*do_unaligned_access)(CPUState *cpu, vaddr addr,
-                                MMUAccessType access_type,
-                                int mmu_idx, uintptr_t retaddr);
-
     /**
      * @adjust_watchpoint_address: hack for cpu_check_watchpoint used by ARM
      */