tcg/x86_64: declare MO_ATOM_WITHIN16 host atomicity support
PATCH 1/1 tcg/x86_64: declare MO_ATOM_WITHIN16 host atomicity support
Just like aarch64's prepare_host_addr(), x86_64 should use MO_ATOM_WITHIN16 for the memop when it's capable. Unlike aarch64, which needs to check a CPU feature, x86 has been capable since P6 family processors and newer (see Intel SDM Vol. 3 §11.1.1).
Since a 16-byte aligned region always fits within a 16-byte multiple sized cache line (x86_64 implementations always have cache lines of at least 64 bytes), then this enables riscv cpu models with Zama16b to use the fast path, just as cpu models without Zama16b do.
--- tcg/x86_64/tcg-target.c.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
tcg/x86_64/tcg-target.c.inc +1 -1
@@ -1934,7 +1934,7 @@ static TCGLabelQemuLdst *prepare_host_addr(TCGContext *s, HostAddress *h, *h = x86_guest_base; } h->base = addr; - h->aa = atom_and_align_for_opc(s, opc, MO_ATOM_IFALIGN, s_bits == MO_128); + h->aa = atom_and_align_for_opc(s, opc, MO_ATOM_WITHIN16, s_bits == MO_128); a_mask = (1 << h->aa.align) - 1; if (tcg_use_softmmu) {
Signature · 1 line
2.43.0
Quoted 21 lines · Andrew Jones
Just like aarch64's
prepare_host_addr(),x86_64should useMO_ATOM_WITHIN16for the memop when it's capable. Unlike aarch64, which needs to check a CPU feature, x86 has been capable since P6 family processors and newer (see Intel SDM Vol. 3 §11.1.1).Since a 16-byte aligned region always fits within a 16-byte multiple sized cache line (
x86_64implementations always have cache lines of at least 64 bytes), then this enables riscv cpu models with Zama16b to use the fast path, just as cpu models without Zama16b do.Cc LIU Zhiwei <[email protected]>Signed-off-by Andrew Jones <[email protected]>--- tcg/x86_64/tcg-target.c.inc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)tcg/x86_64/tcg-target.c.inc +0
-0
tcg/x86_64/tcg-target.c.inc static TCGLabelQemuLdst *prepare_host_addr(TCGContext *s, HostAddress *h, · line 1940
Quoted 8 lines
tcg/x86_64/tcg-target.c.inc +1
-1@@ -1934,7 +1934,7 @@ static TCGLabelQemuLdst *prepare_host_addr(TCGContext *s, HostAddress *h, *h = x86_guest_base; } h->base = addr; - h->aa = atom_and_align_for_opc(s, opc, MO_ATOM_IFALIGN, s_bits == MO_128); + h->aa = atom_and_align_for_opc(s, opc, MO_ATOM_WITHIN16, s_bits == MO_128); a_mask = (1 << h->aa.align) - 1; if (tcg_use_softmmu) {
You should update both uses of atom_and_align_for_opc.
With that,
r~
Quoted 33 lines · Richard Henderson
Quoted 21 lines · Andrew Jones
Just like aarch64's
prepare_host_addr(),x86_64should useMO_ATOM_WITHIN16for the memop when it's capable. Unlike aarch64, which needs to check a CPU feature, x86 has been capable since P6 family processors and newer (see Intel SDM Vol. 3 §11.1.1).Since a 16-byte aligned region always fits within a 16-byte multiple sized cache line (
x86_64implementations always have cache lines of at least 64 bytes), then this enables riscv cpu models with Zama16b to use the fast path, just as cpu models without Zama16b do.Cc LIU Zhiwei <[email protected]>Signed-off-by Andrew Jones <[email protected]>---
tcg/x86_64/tcg-target.c.inc | 2 +-1 file changed, 1 insertion(+), 1 deletion(-)tcg/x86_64/tcg-target.c.inc +0
-0tcg/x86_64/tcg-target.c.inc static TCGLabelQemuLdst *prepare_host_addr(TCGContext *s, · line 1940
Quoted 8 lines
tcg/x86_64/tcg-target.c.inc +1
-1@@ -1934,7 +1934,7 @@ static TCGLabelQemuLdst *prepare_host_addr(TCGContext *s, HostAddress *h, *h = x86_guest_base; } h->base = addr; - h->aa = atom_and_align_for_opc(s, opc, MO_ATOM_IFALIGN, s_bits == MO_128); + h->aa = atom_and_align_for_opc(s, opc, MO_ATOM_WITHIN16, s_bits == MO_128); a_mask = (1 << h->aa.align) - 1; if (tcg_use_softmmu) {You should update both uses of
atom_and_align_for_opc.
Quoted 2 lines
With that,
Reviewed-by Richard Henderson <[email protected]>
I'll update this myself and queue for today's PR.
r~