From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from eggs.gnu.org ([2001:4830:134:3::10]:49502) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bjlkm-0004l8-0e for qemu-devel@nongnu.org; Tue, 13 Sep 2016 07:19:56 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1bjlkg-0005f2-Uw for qemu-devel@nongnu.org; Tue, 13 Sep 2016 07:19:50 -0400 Received: from mail-wm0-f44.google.com ([74.125.82.44]:35704) by eggs.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1bjlkg-0005X4-LR for qemu-devel@nongnu.org; Tue, 13 Sep 2016 07:19:46 -0400 Received: by mail-wm0-f44.google.com with SMTP id i130so26165208wmf.0 for ; Tue, 13 Sep 2016 04:19:25 -0700 (PDT) References: <1472935202-3342-1-git-send-email-rth@twiddle.net> <1472935202-3342-15-git-send-email-rth@twiddle.net> From: Alex =?utf-8?Q?Benn=C3=A9e?= In-reply-to: <1472935202-3342-15-git-send-email-rth@twiddle.net> Date: Tue, 13 Sep 2016 12:18:22 +0100 Message-ID: <87h99kvyip.fsf@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit Subject: Re: [Qemu-devel] [PATCH v3 14/34] tcg: Add atomic128 helpers List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , To: Richard Henderson Cc: qemu-devel@nongnu.org Richard Henderson writes: > Force the use of cmpxchg16b on x86_64. > > Wikipedia suggests that only very old AMD64 (circa 2004) did not have > this instruction. Further, it's required by Windows 8 so no new cpus > will ever omit it. > > If we truely care about these, then we could check this at startup time > and then avoid executing paths that use it. > > Signed-off-by: Richard Henderson > --- > atomic_template.h | 40 +++++++++++++++++++++++++++++++++++++++- > configure | 29 ++++++++++++++++++++++++++++- > cputlb.c | 5 +++++ > include/qemu/int128.h | 6 ++++++ > tcg-runtime.c | 20 +++++++++++++++++++- > tcg/tcg.h | 24 +++++++++++++++++++++++- > 6 files changed, 120 insertions(+), 4 deletions(-) > > diff --git a/tcg-runtime.c b/tcg-runtime.c > index aa55d12..0c97cdf 100644 > --- a/tcg-runtime.c > +++ b/tcg-runtime.c > @@ -118,8 +118,8 @@ static void *atomic_mmu_lookup(CPUArchState *env, target_ulong addr, > /* Macro to call the above, with local variables from the use context. */ > #define ATOMIC_MMU_LOOKUP atomic_mmu_lookup(env, addr, DATA_SIZE, GETPC()) > > -#define ATOMIC_NAME(X) HELPER(glue(glue(atomic_ ## X, SUFFIX), END)) > #define EXTRA_ARGS > +#define ATOMIC_NAME(X) HELPER(glue(glue(atomic_ ## X, SUFFIX), END)) Did I miss a subtly here? Should this change be squashed into the original atomic helpers patch? > #define DATA_SIZE 1 > #include "atomic_template.h" > @@ -133,4 +133,22 @@ static void *atomic_mmu_lookup(CPUArchState *env, target_ulong addr, > #define DATA_SIZE 8 > #include "atomic_template.h" > > +/* The following is only callable from other helpers, and matches up > + with the softmmu version. */ > + > +#ifdef CONFIG_ATOMIC128 > + > +#undef EXTRA_ARGS > +#undef ATOMIC_NAME > +#undef ATOMIC_MMU_LOOKUP > + > +#define EXTRA_ARGS , TCGMemOpIdx oi, uintptr_t retaddr > +#define ATOMIC_NAME(X) \ > + HELPER(glue(glue(glue(atomic_ ## X, SUFFIX), END), _mmu)) > +#define ATOMIC_MMU_LOOKUP atomic_mmu_lookup(env, addr, DATA_SIZE, retaddr) > + > +#define DATA_SIZE 16 > +#include "atomic_template.h" > +#endif /* CONFIG_ATOMIC128 */ > + > #endif /* !CONFIG_SOFTMMU */ > diff --git a/tcg/tcg.h b/tcg/tcg.h > index c91b8c6..5a94cec 100644 > --- a/tcg/tcg.h > +++ b/tcg/tcg.h > @@ -1227,7 +1227,29 @@ GEN_ATOMIC_HELPER_ALL(xchg) > > #undef GEN_ATOMIC_HELPER_ALL > #undef GEN_ATOMIC_HELPER > - > #endif /* CONFIG_SOFTMMU */ > > +#ifdef CONFIG_ATOMIC128 > +#include "qemu/int128.h" > + > +/* These aren't really a "proper" helpers because TCG cannot manage Int128. > + However, use the same format as the others, for use by the backends. */ > +Int128 helper_atomic_cmpxchgo_le_mmu(CPUArchState *env, target_ulong addr, > + Int128 cmpv, Int128 newv, > + TCGMemOpIdx oi, uintptr_t retaddr); > +Int128 helper_atomic_cmpxchgo_be_mmu(CPUArchState *env, target_ulong addr, > + Int128 cmpv, Int128 newv, > + TCGMemOpIdx oi, uintptr_t retaddr); > + > +Int128 helper_atomic_ldo_le_mmu(CPUArchState *env, target_ulong addr, > + TCGMemOpIdx oi, uintptr_t retaddr); > +Int128 helper_atomic_ldo_be_mmu(CPUArchState *env, target_ulong addr, > + TCGMemOpIdx oi, uintptr_t retaddr); > +void helper_atomic_sto_le_mmu(CPUArchState *env, target_ulong addr, Int128 val, > + TCGMemOpIdx oi, uintptr_t retaddr); > +void helper_atomic_sto_be_mmu(CPUArchState *env, target_ulong addr, Int128 val, > + TCGMemOpIdx oi, uintptr_t retaddr); > + > +#endif /* CONFIG_ATOMIC128 */ > + > #endif /* TCG_H */ Otherwise: Reviewed-by: Alex Bennée -- Alex Bennée