[PATCH v3 12/48] target/arm: Fix test of TCG_OVERSIZED_GUEST

Richard Henderson posted 48 patches 2 years, 8 months ago
Maintainers: Richard Henderson <richard.henderson@linaro.org>, Paolo Bonzini <pbonzini@redhat.com>, Peter Maydell <peter.maydell@linaro.org>, Michael Rolnik <mrolnik@gmail.com>, "Edgar E. Iglesias" <edgar.iglesias@gmail.com>, Brian Cain <bcain@quicinc.com>, Alessandro Di Federico <ale@rev.ng>, Anton Johansson <anjo@rev.ng>, Eduardo Habkost <eduardo@habkost.net>, Song Gao <gaosong@loongson.cn>, Xiaojuan Yang <yangxiaojuan@loongson.cn>, Laurent Vivier <laurent@vivier.eu>, "Philippe Mathieu-Daudé" <philmd@linaro.org>, Aurelien Jarno <aurelien@aurel32.net>, Jiaxun Yang <jiaxun.yang@flygoat.com>, Aleksandar Rikalo <aleksandar.rikalo@syrmia.com>, Chris Wulff <crwulff@gmail.com>, Marek Vasut <marex@denx.de>, Stafford Horne <shorne@gmail.com>, Daniel Henrique Barboza <danielhb413@gmail.com>, "Cédric Le Goater" <clg@kaod.org>, David Gibson <david@gibson.dropbear.id.au>, Greg Kurz <groug@kaod.org>, Palmer Dabbelt <palmer@dabbelt.com>, Alistair Francis <alistair.francis@wdc.com>, Bin Meng <bin.meng@windriver.com>, Weiwei Li <liweiwei@iscas.ac.cn>, Liu Zhiwei <zhiwei_liu@linux.alibaba.com>, Yoshinori Sato <ysato@users.sourceforge.jp>, David Hildenbrand <david@redhat.com>, Ilya Leoshkevich <iii@linux.ibm.com>, Thomas Huth <thuth@redhat.com>, Mark Cave-Ayland <mark.cave-ayland@ilande.co.uk>, Artyom Tarasenko <atar4qemu@gmail.com>, Bastian Koppelmann <kbastian@mail.uni-paderborn.de>, Max Filippov <jcmvbkbc@gmail.com>, WANG Xuerui <git@xen0n.name>, Huacai Chen <chenhuacai@kernel.org>, Stefan Weil <sw@weilnetz.de>
[PATCH v3 12/48] target/arm: Fix test of TCG_OVERSIZED_GUEST
Posted by Richard Henderson 2 years, 8 months ago
The symbol is always defined, even if to 0.
We wanted to test for TCG_OVERSIZED_GUEST == 0.

Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
---
 target/arm/ptw.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/target/arm/ptw.c b/target/arm/ptw.c
index 69c05cd9da..b0d2a05403 100644
--- a/target/arm/ptw.c
+++ b/target/arm/ptw.c
@@ -418,6 +418,7 @@ static uint64_t arm_casq_ptw(CPUARMState *env, uint64_t old_val,
                              uint64_t new_val, S1Translate *ptw,
                              ARMMMUFaultInfo *fi)
 {
+#ifdef TARGET_AARCH64
     uint64_t cur_val;
     void *host = ptw->out_host;
 
@@ -473,7 +474,7 @@ static uint64_t arm_casq_ptw(CPUARMState *env, uint64_t old_val,
      * we know that TCG_OVERSIZED_GUEST is set, which means that we are
      * running in round-robin mode and could only race with dma i/o.
      */
-#ifndef TCG_OVERSIZED_GUEST
+#if !TCG_OVERSIZED_GUEST
 # error "Unexpected configuration"
 #endif
     bool locked = qemu_mutex_iothread_locked();
@@ -497,6 +498,10 @@ static uint64_t arm_casq_ptw(CPUARMState *env, uint64_t old_val,
 #endif
 
     return cur_val;
+#else
+    /* AArch32 does not have FEAT_HADFS. */
+    g_assert_not_reached();
+#endif
 }
 
 static bool get_level1_table_address(CPUARMState *env, ARMMMUIdx mmu_idx,
-- 
2.34.1
Re: [PATCH v3 12/48] target/arm: Fix test of TCG_OVERSIZED_GUEST
Posted by Philippe Mathieu-Daudé 2 years, 8 months ago
On 31/5/23 06:02, Richard Henderson wrote:
> The symbol is always defined, even if to 0.
> We wanted to test for TCG_OVERSIZED_GUEST == 0.

Fixes: 71943a1e90 ("target/arm: Implement FEAT_HAFDBS, access flag portion")

> Signed-off-by: Richard Henderson <richard.henderson@linaro.org>
> ---
>   target/arm/ptw.c | 7 ++++++-
>   1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/target/arm/ptw.c b/target/arm/ptw.c
> index 69c05cd9da..b0d2a05403 100644
> --- a/target/arm/ptw.c
> +++ b/target/arm/ptw.c
> @@ -418,6 +418,7 @@ static uint64_t arm_casq_ptw(CPUARMState *env, uint64_t old_val,
>                                uint64_t new_val, S1Translate *ptw,
>                                ARMMMUFaultInfo *fi)
>   {
> +#ifdef TARGET_AARCH64

This change ^ ...

>       uint64_t cur_val;
>       void *host = ptw->out_host;
>   
> @@ -473,7 +474,7 @@ static uint64_t arm_casq_ptw(CPUARMState *env, uint64_t old_val,
>        * we know that TCG_OVERSIZED_GUEST is set, which means that we are
>        * running in round-robin mode and could only race with dma i/o.
>        */
> -#ifndef TCG_OVERSIZED_GUEST
> +#if !TCG_OVERSIZED_GUEST
>   # error "Unexpected configuration"
>   #endif
>       bool locked = qemu_mutex_iothread_locked();
> @@ -497,6 +498,10 @@ static uint64_t arm_casq_ptw(CPUARMState *env, uint64_t old_val,
>   #endif
>   
>       return cur_val;
> +#else
> +    /* AArch32 does not have FEAT_HADFS. */
> +    g_assert_not_reached();

... isn't documented. Do you mind adding a quick line about it?

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>

> +#endif
>   }
>   
>   static bool get_level1_table_address(CPUARMState *env, ARMMMUIdx mmu_idx,