[PATCH v3 04/14] target/s390x: Fix ICM with M3=0

2023-07-19 Thread Ilya Leoshkevich
When the mask is zero, access exceptions should still be recognized for 1 byte at the second-operand address. CC should be set to 0. Cc: qemu-sta...@nongnu.org Fixes: e023e832d0ac ("s390x: translate engine for s390x CPU") Reviewed-by: David Hildenbrand Signed-off-by: Ilya L

[PATCH v3 14/14] tests/tcg/s390x: Test VCKSM

2023-07-19 Thread Ilya Leoshkevich
Add a small test to prevent regressions. Tested-by: Thomas Huth Signed-off-by: Ilya Leoshkevich --- tests/tcg/s390x/Makefile.target | 1 + tests/tcg/s390x/vcksm.c | 31 +++ tests/tcg/s390x/vx.h| 2 ++ 3 files changed, 34 insertions(+) create

[PATCH v3 11/14] tests/tcg/s390x: Test ICM

2023-07-19 Thread Ilya Leoshkevich
Add a small test to prevent regressions. Tested-by: Thomas Huth Signed-off-by: Ilya Leoshkevich --- tests/tcg/s390x/Makefile.softmmu-target | 1 + tests/tcg/s390x/icm.S | 32 + 2 files changed, 33 insertions(+) create mode 100644 tests/tcg/s390x

[PATCH v3 13/14] tests/tcg/s390x: Test STPQ

2023-07-19 Thread Ilya Leoshkevich
Add a small test to prevent regressions. Tested-by: Thomas Huth Signed-off-by: Ilya Leoshkevich --- tests/tcg/s390x/Makefile.softmmu-target | 1 + tests/tcg/s390x/stpq.S | 20 2 files changed, 21 insertions(+) create mode 100644 tests/tcg/s390x/stpq.S

[PATCH v3 02/14] target/s390x: Fix CLM with M3=0

2023-07-19 Thread Ilya Leoshkevich
When the mask is zero, access exceptions should still be recognized for 1 byte at the second-operand address. CC should be set to 0. Reviewed-by: David Hildenbrand Cc: qemu-sta...@nongnu.org Fixes: defb0e3157af ("s390x: Implement opcode helpers") Signed-off-by: Ilya Leoshkevich -

[PATCH v3 05/14] target/s390x: Make MC raise specification exception when class >= 16

2023-07-19 Thread Ilya Leoshkevich
MC requires bit positions 8-11 (upper 4 bits of class) to be zeros, otherwise it must raise a specification exception. Cc: qemu-sta...@nongnu.org Fixes: 20d143e2cab8 ("s390x/tcg: Implement MONITOR CALL") Reviewed-by: David Hildenbrand Signed-off-by: Ilya Leoshkevich --- target

[PATCH v3 03/14] target/s390x: Fix CONVERT TO LOGICAL/FIXED with out-of-range inputs

2023-07-19 Thread Ilya Leoshkevich
lpers") Reviewed-by: David Hildenbrand Signed-off-by: Ilya Leoshkevich --- target/s390x/tcg/fpu_helper.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/target/s390x/tcg/fpu_helper.c b/target/s390x/tcg/fpu_helper.c index 4b7fa58af3e..3d941ed2d28 100644 --- a/target

[PATCH v3 01/14] target/s390x: Make CKSM raise an exception if R2 is odd

2023-07-19 Thread Ilya Leoshkevich
R2 designates an even-odd register pair; the instruction should raise a specification exception when R2 is not even. Cc: qemu-sta...@nongnu.org Fixes: e023e832d0ac ("s390x: translate engine for s390x CPU") Reviewed-by: David Hildenbrand Signed-off-by: Ilya Leoshkevich --- target

Re: [PATCH v2 08/14] tests/tcg/s390x: Test CKSM

2023-07-19 Thread Ilya Leoshkevich
On Wed, 2023-07-19 at 16:20 +0200, Thomas Huth wrote: > On 19/07/2023 11.44, Ilya Leoshkevich wrote: > > Add a small test to prevent regressions. > > > > Signed-off-by: Ilya Leoshkevich > > --- > >   tests/tcg/s390x/Makefile.softmmu-target | 

Re: [PATCH v2 06/14] tcg/{i386, s390x}: Add earlyclobber to the op_add2's first output

2023-07-19 Thread Ilya Leoshkevich
On Wed, 2023-07-19 at 14:08 +0200, Philippe Mathieu-Daudé wrote: > Hi Ilya, > > On 19/7/23 11:44, Ilya Leoshkevich wrote: > > i386 and s390x implementations of op_add2 require an earlyclobber, > > which is currently missing. This breaks VCKSM in s390x guests. > > E.g.,

Re: [PATCH 17/18] host/include/i386: Implement clmul.h

2023-07-19 Thread Ilya Leoshkevich
On Thu, 2023-07-13 at 22:14 +0100, Richard Henderson wrote: > Detect PCLMUL in cpuinfo; implement the accel hooks. > > Signed-off-by: Richard Henderson > --- >  host/include/i386/host/cpuinfo.h    |   1 + >  host/include/i386/host/crypto/clmul.h   | 187 > >  

[PATCH v2 09/14] tests/tcg/s390x: Test CLGEBR and CGEBRA

2023-07-19 Thread Ilya Leoshkevich
Add a small test to prevent regressions. Signed-off-by: Ilya Leoshkevich --- tests/tcg/s390x/Makefile.target | 5 + tests/tcg/s390x/cgebra.c| 32 tests/tcg/s390x/clgebr.c| 32 3 files changed, 69 insertions

[PATCH v2 14/14] tests/tcg/s390x: Test VCKSM

2023-07-19 Thread Ilya Leoshkevich
Add a small test to prevent regressions. Signed-off-by: Ilya Leoshkevich --- tests/tcg/s390x/Makefile.target | 1 + tests/tcg/s390x/vcksm.c | 31 +++ tests/tcg/s390x/vx.h| 2 ++ 3 files changed, 34 insertions(+) create mode 100644 tests/tcg

[PATCH v2 10/14] tests/tcg/s390x: Test CLM

2023-07-19 Thread Ilya Leoshkevich
Add a small test to prevent regressions. Signed-off-by: Ilya Leoshkevich --- tests/tcg/s390x/Makefile.softmmu-target | 1 + tests/tcg/s390x/clm.S | 29 + 2 files changed, 30 insertions(+) create mode 100644 tests/tcg/s390x/clm.S diff --git a/tests

[PATCH v2 08/14] tests/tcg/s390x: Test CKSM

2023-07-19 Thread Ilya Leoshkevich
Add a small test to prevent regressions. Signed-off-by: Ilya Leoshkevich --- tests/tcg/s390x/Makefile.softmmu-target | 1 + tests/tcg/s390x/cksm.S | 29 + 2 files changed, 30 insertions(+) create mode 100644 tests/tcg/s390x/cksm.S diff --git a/tests

[PATCH v2 00/14] target/s390x: Miscellaneous TCG fixes, part 2

2023-07-19 Thread Ilya Leoshkevich
do with simple insufficient error handling or corner cases, but 3/14 and 6/14 took a while to figure out, and hopefully I got the fixes right. 13/14 is a test for an issue that Richard has already fixed, but I thought it would be helpful to have it anyway. Best regards, Ilya Ilya Leoshkevich

[PATCH v2 02/14] target/s390x: Fix CLM with M3=0

2023-07-19 Thread Ilya Leoshkevich
When the mask is zero, access exceptions should still be recognized for 1 byte at the second-operand address. CC should be set to 0. Reviewed-by: David Hildenbrand Cc: qemu-sta...@nongnu.org Fixes: defb0e3157af ("s390x: Implement opcode helpers") Signed-off-by: Ilya Leoshkevich -

[PATCH v2 06/14] tcg/{i386, s390x}: Add earlyclobber to the op_add2's first output

2023-07-19 Thread Ilya Leoshkevich
%r12d, %ebx Introduce a new C_N1_O1_I4 constraint, and make sure that earlyclobber of aliased outputs is honored. Cc: qemu-sta...@nongnu.org Fixes: 82790a870992 ("tcg: Add markup for output requires new register") Signed-off-by: Ilya Leoshkevich --- tcg/i386/tcg-target-con-set.h |

[PATCH v2 07/14] target/s390x: Fix assertion failure in VFMIN/VFMAX with type 13

2023-07-19 Thread Ilya Leoshkevich
Type 13 is reserved, so using it should result in specification exception. Due to an off-by-1 error the code triggers an assertion at a later point in time instead. Cc: qemu-sta...@nongnu.org Fixes: da4807527f3b ("s390x/tcg: Implement VECTOR FP (MAXIMUM|MINIMUM)") Signed-off-by: Ilya L

[PATCH v2 01/14] target/s390x: Make CKSM raise an exception if R2 is odd

2023-07-19 Thread Ilya Leoshkevich
R2 designates an even-odd register pair; the instruction should raise a specification exception when R2 is not even. Cc: qemu-sta...@nongnu.org Fixes: e023e832d0ac ("s390x: translate engine for s390x CPU") Reviewed-by: David Hildenbrand Signed-off-by: Ilya Leoshkevich --- target

[PATCH v2 11/14] tests/tcg/s390x: Test ICM

2023-07-19 Thread Ilya Leoshkevich
Add a small test to prevent regressions. Signed-off-by: Ilya Leoshkevich --- tests/tcg/s390x/Makefile.softmmu-target | 1 + tests/tcg/s390x/icm.S | 32 + 2 files changed, 33 insertions(+) create mode 100644 tests/tcg/s390x/icm.S diff --git a/tests

[PATCH v2 05/14] target/s390x: Make MC raise specification exception when class >= 16

2023-07-19 Thread Ilya Leoshkevich
MC requires bit positions 8-11 (upper 4 bits of class) to be zeros, otherwise it must raise a specification exception. Cc: qemu-sta...@nongnu.org Fixes: 20d143e2cab8 ("s390x/tcg: Implement MONITOR CALL") Reviewed-by: David Hildenbrand Signed-off-by: Ilya Leoshkevich --- target

[PATCH v2 03/14] target/s390x: Fix CONVERT TO LOGICAL/FIXED with out-of-range inputs

2023-07-19 Thread Ilya Leoshkevich
lpers") Reviewed-by: David Hildenbrand Signed-off-by: Ilya Leoshkevich --- target/s390x/tcg/fpu_helper.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/target/s390x/tcg/fpu_helper.c b/target/s390x/tcg/fpu_helper.c index 4b7fa58af3e..3d941ed2d28 100644 --- a/target

[PATCH v2 13/14] tests/tcg/s390x: Test STPQ

2023-07-19 Thread Ilya Leoshkevich
Add a small test to prevent regressions. Signed-off-by: Ilya Leoshkevich --- tests/tcg/s390x/Makefile.softmmu-target | 1 + tests/tcg/s390x/stpq.S | 20 2 files changed, 21 insertions(+) create mode 100644 tests/tcg/s390x/stpq.S diff --git a/tests/tcg

[PATCH v2 12/14] tests/tcg/s390x: Test MC

2023-07-19 Thread Ilya Leoshkevich
Add a small test to prevent regressions. Signed-off-by: Ilya Leoshkevich --- tests/tcg/s390x/Makefile.softmmu-target | 1 + tests/tcg/s390x/mc.S| 56 + 2 files changed, 57 insertions(+) create mode 100644 tests/tcg/s390x/mc.S diff --git a/tests/tcg

[PATCH v2 04/14] target/s390x: Fix ICM with M3=0

2023-07-19 Thread Ilya Leoshkevich
When the mask is zero, access exceptions should still be recognized for 1 byte at the second-operand address. CC should be set to 0. Cc: qemu-sta...@nongnu.org Fixes: e023e832d0ac ("s390x: translate engine for s390x CPU") Reviewed-by: David Hildenbrand Signed-off-by: Ilya L

Re: [PATCH 07/14] target/s390x: Fix assertion failure in VFMIN/VFMAX with reserved type

2023-07-19 Thread Ilya Leoshkevich
On Wed, 2023-07-19 at 10:40 +0200, David Hildenbrand wrote: > On 18.07.23 23:21, Ilya Leoshkevich wrote: > > Passing reserved type to VFMIN/VFMAX causes an assertion failure in > > vfmin_res() and vfmax_res(). These instructions should raise a > > specification exception in t

[PATCH 13/14] tests/tcg/s390x: Test STPQ

2023-07-18 Thread Ilya Leoshkevich
Add a small test to prevent regressions. Signed-off-by: Ilya Leoshkevich --- tests/tcg/s390x/Makefile.softmmu-target | 1 + tests/tcg/s390x/stpq.S | 20 2 files changed, 21 insertions(+) create mode 100644 tests/tcg/s390x/stpq.S diff --git a/tests/tcg

[PATCH 02/14] target/s390x: Fix CLM with M3=0

2023-07-18 Thread Ilya Leoshkevich
When the mask is zero, access exceptions should still be recognized for 1 byte at the second-operand address. CC should be set to 0. Cc: qemu-sta...@nongnu.org Fixes: defb0e3157af ("s390x: Implement opcode helpers") Signed-off-by: Ilya Leoshkevich --- target/s390x/tcg/mem_helper.c |

[PATCH 01/14] target/s390x: Make CKSM raise an exception if R2 is odd

2023-07-18 Thread Ilya Leoshkevich
R2 designates an even-odd register pair; the instruction should raise a specification exception when R2 is not even. Cc: qemu-sta...@nongnu.org Fixes: e023e832d0ac ("s390x: translate engine for s390x CPU") Signed-off-by: Ilya Leoshkevich --- target/s390x/tcg/translate.c | 11 +

[PATCH 10/14] tests/tcg/s390x: Test CLM

2023-07-18 Thread Ilya Leoshkevich
Add a small test to prevent regressions. Signed-off-by: Ilya Leoshkevich --- tests/tcg/s390x/Makefile.softmmu-target | 1 + tests/tcg/s390x/clm.S | 29 + 2 files changed, 30 insertions(+) create mode 100644 tests/tcg/s390x/clm.S diff --git a/tests

[PATCH 14/14] tests/tcg/s390x: Test VCKSM

2023-07-18 Thread Ilya Leoshkevich
Add a small test to prevent regressions. Signed-off-by: Ilya Leoshkevich --- tests/tcg/s390x/Makefile.target | 1 + tests/tcg/s390x/vcksm.c | 31 +++ tests/tcg/s390x/vx.h| 2 ++ 3 files changed, 34 insertions(+) create mode 100644 tests/tcg

[PATCH 04/14] target/s390x: Fix ICM with M3=0

2023-07-18 Thread Ilya Leoshkevich
When the mask is zero, access exceptions should still be recognized for 1 byte at the second-operand address. CC should be set to 0. Cc: qemu-sta...@nongnu.org Fixes: e023e832d0ac ("s390x: translate engine for s390x CPU") Signed-off-by: Ilya Leoshkevich --- target/s390x/tcg/trans

[PATCH 03/14] target/s390x: Fix CONVERT TO LOGICAL/FIXED with out-of-range inputs

2023-07-18 Thread Ilya Leoshkevich
lpers") Signed-off-by: Ilya Leoshkevich --- target/s390x/tcg/fpu_helper.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/target/s390x/tcg/fpu_helper.c b/target/s390x/tcg/fpu_helper.c index 4b7fa58af3e..3d941ed2d28 100644 --- a/target/s390x/tcg/fpu_helper.c +++ b/target

[PATCH 05/14] target/s390x: Make MC raise specification exception when class >= 16

2023-07-18 Thread Ilya Leoshkevich
MC requires bit positions 8-11 (upper 4 bits of class) to be zeros, otherwise it must raise a specification exception. Cc: qemu-sta...@nongnu.org Fixes: 20d143e2cab8 ("s390x/tcg: Implement MONITOR CALL") Signed-off-by: Ilya Leoshkevich --- target/s390x/tcg/excp_helper.c | 2 +- target

[PATCH 11/14] tests/tcg/s390x: Test ICM

2023-07-18 Thread Ilya Leoshkevich
Add a small test to prevent regressions. Signed-off-by: Ilya Leoshkevich --- tests/tcg/s390x/Makefile.softmmu-target | 1 + tests/tcg/s390x/icm.S | 32 + 2 files changed, 33 insertions(+) create mode 100644 tests/tcg/s390x/icm.S diff --git a/tests

[PATCH 06/14] tcg/{i386, s390x}: Add earlyclobber to the op_add2's first output

2023-07-18 Thread Ilya Leoshkevich
%r12d, %ebx Introduce a new C_N1_O1_I4 constraint, and make sure that earlyclobber of aliased outputs is honored. Cc: qemu-sta...@nongnu.org Fixes: 82790a870992 ("tcg: Add markup for output requires new register") Signed-off-by: Ilya Leoshkevich --- tcg/i386/tcg-target-con-set.h |

[PATCH 08/14] tests/tcg/s390x: Test CKSM

2023-07-18 Thread Ilya Leoshkevich
Add a small test to prevent regressions. Signed-off-by: Ilya Leoshkevich --- tests/tcg/s390x/Makefile.softmmu-target | 1 + tests/tcg/s390x/cksm.S | 29 + 2 files changed, 30 insertions(+) create mode 100644 tests/tcg/s390x/cksm.S diff --git a/tests

[PATCH 12/14] tests/tcg/s390x: Test MC

2023-07-18 Thread Ilya Leoshkevich
Add a small test to prevent regressions. Signed-off-by: Ilya Leoshkevich --- tests/tcg/s390x/Makefile.softmmu-target | 1 + tests/tcg/s390x/mc.S| 56 + 2 files changed, 57 insertions(+) create mode 100644 tests/tcg/s390x/mc.S diff --git a/tests/tcg

[PATCH 00/14] target/s390x: Miscellaneous TCG fixes, part 2

2023-07-18 Thread Ilya Leoshkevich
, but I thought it would be helpful to have it anyway. Best regards, Ilya Ilya Leoshkevich (14): target/s390x: Make CKSM raise an exception if R2 is odd target/s390x: Fix CLM with M3=0 target/s390x: Fix CONVERT TO LOGICAL/FIXED with out-of-range inputs target/s390x: Fix ICM with M3=0

[PATCH 09/14] tests/tcg/s390x: Test CLGEBR and CGEBRA

2023-07-18 Thread Ilya Leoshkevich
Add a small test to prevent regressions. Signed-off-by: Ilya Leoshkevich --- tests/tcg/s390x/Makefile.target | 5 + tests/tcg/s390x/cgebra.c| 32 tests/tcg/s390x/clgebr.c| 32 3 files changed, 69 insertions

[PATCH 07/14] target/s390x: Fix assertion failure in VFMIN/VFMAX with reserved type

2023-07-18 Thread Ilya Leoshkevich
Passing reserved type to VFMIN/VFMAX causes an assertion failure in vfmin_res() and vfmax_res(). These instructions should raise a specification exception in this case. Cc: qemu-sta...@nongnu.org Fixes: da4807527f3b ("s390x/tcg: Implement VECTOR FP (MAXIMUM|MINIMUM)") Signed-of

[PATCH][PING] linux-user/elfload: Fix /proc/cpuinfo features: on s390x

2023-07-14 Thread Ilya Leoshkevich
On Wed, 2023-06-28 at 09:49 +0200, Richard Henderson wrote: > On 6/27/23 17:13, Ilya Leoshkevich wrote: > > elf_hwcap_str() takes a bit number, but compares it for equality > > with > > the HWCAP_S390_* masks. This causes /proc/cpuinfo to display > > incorre

Re: [PULL 13/21] tests/tcg/s390x: Test MVCRL with a large value in R0

2023-07-10 Thread Ilya Leoshkevich
On Mon, 2023-07-10 at 14:09 +0100, Richard Henderson wrote: > On 7/10/23 13:15, Thomas Huth wrote: > > From: Ilya Leoshkevich > > > > Add a small test to prevent regressions. > > > > Signed-off-by: Ilya Leoshkevich > > Reviewed-by: David Hildenbrand &g

[PATCH] tests/tcg/s390x: Fix test-svc with clang

2023-07-07 Thread Ilya Leoshkevich
Signed-off-by: Ilya Leoshkevich --- tests/tcg/s390x/gdbstub/test-svc.py | 2 +- tests/tcg/s390x/hello-s390x-asm.S | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/tests/tcg/s390x/gdbstub/test-svc.py b/tests/tcg/s390x/gdbstub/test-svc.py index 7851ca72846..18fad3f1

[PATCH v2 04/12] target/s390x: Fix MVCRL with a large value in R0

2023-07-04 Thread Ilya Leoshkevich
od thing. Fix by truncating the size to 8 bits. Fixes: ea0a1053e276 ("s390x/tcg: Implement Miscellaneous-Instruction-Extensions Facility 3 for the s390x") Cc: qemu-sta...@nongnu.org Reviewed-by: David Hildenbrand Signed-off-by: Ilya Leoshkevich --- target/s390x/tcg/mem_helper.c | 1 + 1 f

[PATCH v2 08/12] tests/tcg/s390x: Test EPSW

2023-07-04 Thread Ilya Leoshkevich
Add a small test to prevent regressions. Reviewed-by: David Hildenbrand Signed-off-by: Ilya Leoshkevich --- tests/tcg/s390x/Makefile.target | 1 + tests/tcg/s390x/epsw.c | 23 +++ 2 files changed, 24 insertions(+) create mode 100644 tests/tcg/s390x/epsw.c diff

[PATCH v2 06/12] target/s390x: Fix LRA when DAT is off

2023-07-04 Thread Ilya Leoshkevich
LRA should perform DAT regardless of whether it's on or off. Disable DAT check for MMU_S390_LRA. Fixes: defb0e3157af ("s390x: Implement opcode helpers") Cc: qemu-sta...@nongnu.org Reviewed-by: David Hildenbrand Signed-off-by: Ilya Leoshkevich --- target/s390x/mmu_helper.c | 2

[PATCH v2 12/12] tests/tcg/s390x: Test MVCRL with a large value in R0

2023-07-04 Thread Ilya Leoshkevich
Add a small test to prevent regressions. Reviewed-by: David Hildenbrand Signed-off-by: Ilya Leoshkevich --- tests/tcg/s390x/mie3-mvcrl.c | 46 1 file changed, 36 insertions(+), 10 deletions(-) diff --git a/tests/tcg/s390x/mie3-mvcrl.c b/tests/tcg/s390x

[PATCH v2 05/12] target/s390x: Fix LRA overwriting the top 32 bits on DAT error

2023-07-04 Thread Ilya Leoshkevich
") Cc: qemu-sta...@nongnu.org Signed-off-by: Ilya Leoshkevich --- target/s390x/helper.h | 2 +- target/s390x/tcg/mem_helper.c | 4 ++-- target/s390x/tcg/translate.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/target/s390x/helper.h b/target/s390x/help

[PATCH v2 02/12] target/s390x: Fix EPSW CC reporting

2023-07-04 Thread Ilya Leoshkevich
EPSW should explicitly calculate and insert CC, like IPM does. Fixes: e30a9d3fea58 ("target-s390: Implement EPSW") Cc: qemu-sta...@nongnu.org Reviewed-by: David Hildenbrand Signed-off-by: Ilya Leoshkevich --- target/s390x/tcg/translate.c | 4 1 file changed, 4 insertions(+)

[PATCH v2 11/12] tests/tcg/s390x: Test MDEB and MDEBR

2023-07-04 Thread Ilya Leoshkevich
Add a small test to prevent regressions. Acked-by: David Hildenbrand Signed-off-by: Ilya Leoshkevich --- tests/tcg/s390x/Makefile.target | 1 + tests/tcg/s390x/mdeb.c | 30 ++ 2 files changed, 31 insertions(+) create mode 100644 tests/tcg/s390x/mdeb.c

[PATCH v2 10/12] tests/tcg/s390x: Test LRA

2023-07-04 Thread Ilya Leoshkevich
Add a small test to prevent regressions. Signed-off-by: Ilya Leoshkevich --- tests/tcg/s390x/Makefile.softmmu-target | 1 + tests/tcg/s390x/lra.S | 19 +++ 2 files changed, 20 insertions(+) create mode 100644 tests/tcg/s390x/lra.S diff --git a/tests/tcg

[PATCH v2 01/12] linux-user: elfload: Add more initial s390x PSW bits

2023-07-04 Thread Ilya Leoshkevich
Make the PSW look more similar to the real s390x userspace PSW. Except for being there, the newly added bits should not affect the userspace code execution. Reviewed-by: David Hildenbrand Signed-off-by: Ilya Leoshkevich --- linux-user/elfload.c | 4 +++- 1 file changed, 3 insertions(+), 1

[PATCH v2 07/12] target/s390x: Fix relative long instructions with large offsets

2023-07-04 Thread Ilya Leoshkevich
The expression "imm * 2" in gen_ri2() can wrap around if imm is large enough. Fix by casting imm to int64_t, like it's done in disas_jdest(). Fixes: e8ecdfeb30f0 ("Fix EXECUTE of relative branches") Reviewed-by: David Hildenbrand Signed-off-by: Ilya Leoshkevich -

[PATCH v2 09/12] tests/tcg/s390x: Test LARL with a large offset

2023-07-04 Thread Ilya Leoshkevich
Add a small test to prevent regressions. Acked-by: David Hildenbrand Signed-off-by: Ilya Leoshkevich --- tests/tcg/s390x/Makefile.target | 1 + tests/tcg/s390x/larl.c | 21 + 2 files changed, 22 insertions(+) create mode 100644 tests/tcg/s390x/larl.c diff --git

[PATCH v2 03/12] target/s390x: Fix MDEB and MDEBR

2023-07-04 Thread Ilya Leoshkevich
These instructions multiply 32 bits by 32 bits, not 32 bits by 64 bits. Fixes: 83b00736f3d8 ("target-s390: Convert FP MULTIPLY") Cc: qemu-sta...@nongnu.org Reviewed-by: David Hildenbrand Signed-off-by: Ilya Leoshkevich --- target/s390x/tcg/fpu_helper.c| 3 ++- target/s390

[PATCH v2 00/12] target/s390x: Miscellaneous TCG fixes

2023-07-04 Thread Ilya Leoshkevich
hem (patches 2-7) and adds tests (patches 8-12); patch 1 is a cosmetic improvement needed for the EPSW test. There are more issues, but I thought it would be better to send this batch now. Best regards, Ilya Ilya Leoshkevich (12): linux-user: elfload: Add more initial s390x PSW bits target/s390x:

Re: [PATCH 05/12] target/s390x: Fix LRA overwriting the top 32 bits on DAT error

2023-07-04 Thread Ilya Leoshkevich
On Tue, 2023-07-04 at 09:47 +0200, David Hildenbrand wrote: > On 03.07.23 17:50, Ilya Leoshkevich wrote: > > When a DAT error occurs, LRA is supposed to write the error > > information > > to the bottom 32 bits of R1, and leave the top 32 bits of R1 alone. > > >

Re: [PATCH 09/12] tests/tcg/s390x: Test LARL with a large offset

2023-07-04 Thread Ilya Leoshkevich
On Tue, 2023-07-04 at 09:56 +0200, David Hildenbrand wrote: > On 03.07.23 17:50, Ilya Leoshkevich wrote: > > Add a small test to prevent regressions. > > > > Signed-off-by: Ilya Leoshkevich > > --- > >   tests/tcg/s390x/Makefile.target |  1 + > >

Re: [PATCH 01/12] linux-user: elfload: Add more initial s390x PSW bits

2023-07-04 Thread Ilya Leoshkevich
On Tue, 2023-07-04 at 09:32 +0200, David Hildenbrand wrote: > On 03.07.23 17:50, Ilya Leoshkevich wrote: > > Make the PSW look more similar to the real s390x userspace PSW. > > Except for being there, the newly added bits should not affect the > > userspace code execution. &g

[PATCH 07/12] target/s390x: Fix relative long instructions with large offsets

2023-07-03 Thread Ilya Leoshkevich
The expression "imm * 2" in gen_ri2() can wrap around if imm is large enough. Fix by casting imm to int64_t, like it's done in disas_jdest(). Fixes: e8ecdfeb30f0 ("Fix EXECUTE of relative branches") Signed-off-by: Ilya Leoshkevich --- target/s390x/tcg/translate.c | 2 +

[PATCH 03/12] target/s390x: Fix MDEB and MDEBR

2023-07-03 Thread Ilya Leoshkevich
These instructions multiply 32 bits by 32 bits, not 32 bits by 64 bits. Fixes: 83b00736f3d8 ("target-s390: Convert FP MULTIPLY") Cc: qemu-sta...@nongnu.org Signed-off-by: Ilya Leoshkevich --- target/s390x/tcg/fpu_helper.c| 3 ++- target/s390x/tcg/insn-data.h.inc | 4 ++-- 2 files

[PATCH 08/12] tests/tcg/s390x: Test EPSW

2023-07-03 Thread Ilya Leoshkevich
Add a small test to prevent regressions. Signed-off-by: Ilya Leoshkevich --- tests/tcg/s390x/Makefile.target | 1 + tests/tcg/s390x/epsw.c | 23 +++ 2 files changed, 24 insertions(+) create mode 100644 tests/tcg/s390x/epsw.c diff --git a/tests/tcg/s390x

[PATCH 04/12] target/s390x: Fix MVCRL with a large value in R0

2023-07-03 Thread Ilya Leoshkevich
od thing. Fix by truncating the size to 8 bits. Fixes: ea0a1053e276 ("s390x/tcg: Implement Miscellaneous-Instruction-Extensions Facility 3 for the s390x") Cc: qemu-sta...@nongnu.org Signed-off-by: Ilya Leoshkevich --- target/s390x/tcg/mem_helper.c | 1 + 1 file changed, 1 insertion(+) diff

[PATCH 09/12] tests/tcg/s390x: Test LARL with a large offset

2023-07-03 Thread Ilya Leoshkevich
Add a small test to prevent regressions. Signed-off-by: Ilya Leoshkevich --- tests/tcg/s390x/Makefile.target | 1 + tests/tcg/s390x/larl.c | 17 + 2 files changed, 18 insertions(+) create mode 100644 tests/tcg/s390x/larl.c diff --git a/tests/tcg/s390x/Makefile.target

[PATCH 05/12] target/s390x: Fix LRA overwriting the top 32 bits on DAT error

2023-07-03 Thread Ilya Leoshkevich
") Cc: qemu-sta...@nongnu.org Signed-off-by: Ilya Leoshkevich --- target/s390x/helper.h | 2 +- target/s390x/tcg/mem_helper.c | 4 ++-- target/s390x/tcg/translate.c | 2 +- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/target/s390x/helper.h b/target/s390x/help

[PATCH 12/12] tests/tcg/s390x: Test MVCRL with a large value in R0

2023-07-03 Thread Ilya Leoshkevich
Add a small test to prevent regressions. Signed-off-by: Ilya Leoshkevich --- tests/tcg/s390x/mie3-mvcrl.c | 46 1 file changed, 36 insertions(+), 10 deletions(-) diff --git a/tests/tcg/s390x/mie3-mvcrl.c b/tests/tcg/s390x/mie3-mvcrl.c index 93c7b0a2903

[PATCH 00/12] target/s390x: Miscellaneous TCG fixes

2023-07-03 Thread Ilya Leoshkevich
regards, Ilya Ilya Leoshkevich (12): linux-user: elfload: Add more initial s390x PSW bits target/s390x: Fix EPSW CC reporting target/s390x: Fix MDEB and MDEBR target/s390x: Fix MVCRL with a large value in R0 target/s390x: Fix LRA overwriting the top 32 bits on DAT error target/s390x: Fix LRA

[PATCH 02/12] target/s390x: Fix EPSW CC reporting

2023-07-03 Thread Ilya Leoshkevich
EPSW should explicitly calculate and insert CC, like IPM does. Fixes: e30a9d3fea58 ("target-s390: Implement EPSW") Cc: qemu-sta...@nongnu.org Signed-off-by: Ilya Leoshkevich --- target/s390x/tcg/translate.c | 4 1 file changed, 4 insertions(+) diff --git a/target/s390x/tcg/tra

[PATCH 01/12] linux-user: elfload: Add more initial s390x PSW bits

2023-07-03 Thread Ilya Leoshkevich
Make the PSW look more similar to the real s390x userspace PSW. Except for being there, the newly added bits should not affect the userspace code execution. Signed-off-by: Ilya Leoshkevich --- linux-user/elfload.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/linux-user

[PATCH 11/12] tests/tcg/s390x: Test MDEB and MDEBR

2023-07-03 Thread Ilya Leoshkevich
Add a small test to prevent regressions. Signed-off-by: Ilya Leoshkevich --- tests/tcg/s390x/Makefile.target | 1 + tests/tcg/s390x/mdeb.c | 30 ++ 2 files changed, 31 insertions(+) create mode 100644 tests/tcg/s390x/mdeb.c diff --git a/tests/tcg/s390x

[PATCH 06/12] target/s390x: Fix LRA when DAT is off

2023-07-03 Thread Ilya Leoshkevich
LRA should perform DAT regardless of whether it's on or off. Disable DAT check for MMU_S390_LRA. Fixes: defb0e3157af ("s390x: Implement opcode helpers") Cc: qemu-sta...@nongnu.org Signed-off-by: Ilya Leoshkevich --- target/s390x/mmu_helper.c | 2 +- 1 file changed, 1 insertion(+),

[PATCH 10/12] tests/tcg/s390x: Test LRA

2023-07-03 Thread Ilya Leoshkevich
Add a small test to prevent regressions. Signed-off-by: Ilya Leoshkevich --- tests/tcg/s390x/Makefile.softmmu-target | 1 + tests/tcg/s390x/lra.S | 19 +++ 2 files changed, 20 insertions(+) create mode 100644 tests/tcg/s390x/lra.S diff --git a/tests/tcg

[PATCH v2 1/4] target: Make qemu_target_page_mask() available for *-user

2023-06-30 Thread Ilya Leoshkevich
Currently qemu_target_page_mask() is usable only from the softmmu code. Make it possible to use it from the *-user code as well. Make use of it in perf.c. Signed-off-by: Ilya Leoshkevich --- accel/tcg/perf.c | 2 +- softmmu/physmem.c | 5 - target/meson.build | 2 ++ target

[PATCH v2 3/4] accel/tcg: Remove #ifdef TARGET_I386 from perf.c

2023-06-30 Thread Ilya Leoshkevich
Preparation for moving perf.c to tcg/. This affects only profiling guest code, which has code in a non-0 based segment, e.g., 16-bit code, which is not particularly important. Suggested-by: Richard Henderson Signed-off-by: Ilya Leoshkevich --- accel/tcg/perf.c | 4 1 file changed, 4

[PATCH v2 0/4] accel/tcg: Move perf and debuginfo support to tcg

2023-06-30 Thread Ilya Leoshkevich
ags() and qemu_target_page_mask(), and I'm not sure if my choices there are perfect. Please let me know if there are better locations for them. Best regards, Ilya [1] https://lists.gnu.org/archive/html/qemu-devel/2023-06/msg06510.html Ilya Leoshkevich (4): target: Make qemu_target_page_mask() availa

[PATCH v2 2/4] tcg: Make tb_cflags() usable from target-agnostic code

2023-06-30 Thread Ilya Leoshkevich
Currently tb_cflags() is defined in exec-all.h, which is not usable from target-agnostic code. Move it to translation-block.h, which is. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Ilya Leoshkevich --- include/exec/exec-all.h | 6 -- include/exec/translation-block.h | 6

[PATCH v2 4/4] accel/tcg: Move perf and debuginfo support to tcg

2023-06-30 Thread Ilya Leoshkevich
tcg/ should not depend on accel/tcg/, but perf and debuginfo support provided by the latter are being used by tcg/tcg.c. Since that's the only user, move both to tcg/. Suggested-by: Philippe Mathieu-Daudé Signed-off-by: Ilya Leoshkevich --- accel/tcg/meson.build | 2 -- accel/tcg

[PATCH 3/4] accel/tcg: Remove #ifdef TARGET_I386 from perf.c

2023-06-30 Thread Ilya Leoshkevich
Preparation for moving perf.c to tcg/. This affects only profiling guest code, which has code in a non-0 based segment, e.g., 16-bit code, which is not particularly important. Suggested-by: Richard Henderson Signed-off-by: Ilya Leoshkevich --- accel/tcg/perf.c | 4 1 file changed, 4

[PATCH 0/4] accel/tcg: Move perf and debuginfo support to tcg

2023-06-30 Thread Ilya Leoshkevich
, Ilya [1] https://lists.gnu.org/archive/html/qemu-devel/2023-06/msg06510.html Ilya Leoshkevich (4): target: Make qemu_softmmu_page_mask() available for *-user tcg: Make tb_cflags() usable from target-agnostic code accel/tcg: Remove #ifdef TARGET_I386 from perf.c accel/tcg: Move perf

[PATCH 4/4] accel/tcg: Move perf and debuginfo support to tcg

2023-06-30 Thread Ilya Leoshkevich
tcg/ should not depend on accel/tcg/, but perf and debuginfo support provided by the latter are being used by tcg/tcg.c. Since that's the only user, move both to tcg/. Suggested-by: Philippe Mathieu-Daudé Signed-off-by: Ilya Leoshkevich --- accel/tcg/meson.build | 2 -- accel/tcg

[PATCH 2/4] tcg: Make tb_cflags() usable from target-agnostic code

2023-06-30 Thread Ilya Leoshkevich
Currently tb_cflags() is defined in exec-all.h, which is not usable from target-agnostic code. Move it to translation-block.h, which is. Signed-off-by: Ilya Leoshkevich --- include/exec/exec-all.h | 6 -- include/exec/translation-block.h | 6 ++ 2 files changed, 6 insertions

[PATCH 1/4] target: Make qemu_softmmu_page_mask() available for *-user

2023-06-30 Thread Ilya Leoshkevich
Currently qemu_softmmu_page_mask() is usable only from the softmmu code. Make it possible to use it from the *-user code as wel. Signed-off-by: Ilya Leoshkevich --- softmmu/physmem.c | 5 - target/meson.build | 2 ++ target/target-common.c | 9 + 3 files changed, 11

Re: [PULL 3/5] tcg: add perfmap and jitdump

2023-06-30 Thread Ilya Leoshkevich
On Thu, 2023-06-29 at 14:59 +0200, Richard Henderson wrote: > On 6/29/23 13:31, Philippe Mathieu-Daudé wrote: > > > diff --git a/tcg/tcg.c b/tcg/tcg.c > > > index da91779890..9b7df71e7a 100644 > > > --- a/tcg/tcg.c > > > +++ b/tcg/tcg.c > > > @@ -61,6 +61,7 @@ > > >   #include "exec/log.h" > > >  

[PATCH] linux-user/elfload: Fix /proc/cpuinfo features: on s390x

2023-06-27 Thread Ilya Leoshkevich
Signed-off-by: Ilya Leoshkevich --- include/elf.h| 66 +++- linux-user/elfload.c | 41 ++- 2 files changed, 69 insertions(+), 38 deletions(-) diff --git a/include/elf.h b/include/elf.h index 2f4d0e56d16..ec9755e73ba 100644 ---

[PATCH v4 5/8] gdbstub: Report the actual qemu-user pid

2023-06-21 Thread Ilya Leoshkevich
Currently qemu-user reports pid 1 to GDB. Resolve the TODO and report the actual PID. Using getpid() relies on the assumption that there is only one GDBProcess. Add an assertion to make sure that future changes don't break it. Reviewed-by: Alex Bennée Signed-off-by: Ilya Leoshkevich

[PATCH v4 8/8] tests/tcg: Add a test for info proc mappings

2023-06-21 Thread Ilya Leoshkevich
Add a small test to prevent regressions. Signed-off-by: Ilya Leoshkevich --- tests/tcg/multiarch/Makefile.target | 9 ++- .../multiarch/gdbstub/test-proc-mappings.py | 65 +++ 2 files changed, 73 insertions(+), 1 deletion(-) create mode 100644 tests/tcg/multiarch

[PATCH v4 0/8] gdbstub: Add support for info proc mappings

2023-06-21 Thread Ilya Leoshkevich
e patches. - Rename do_openat() to do_guest_openat(). - Do not retry pread(), since GDB is capable of doing it itself. - Add an extra sanity check to gdb_handle_query_xfer_exec_file(). - Replace citations of the spec by a single link. Best regards, Ilya Ilya Leoshkevich (8): linux-use

[PATCH v4 7/8] docs: Document security implications of debugging

2023-06-21 Thread Ilya Leoshkevich
the GDB connection themselves. Reviewed-by: Alex Bennée Signed-off-by: Ilya Leoshkevich --- docs/system/gdb.rst | 15 +++ 1 file changed, 15 insertions(+) diff --git a/docs/system/gdb.rst b/docs/system/gdb.rst index 7d3718deef..9906991b84 100644 --- a/docs/system/gdb.rst +++ b/docs

[PATCH v4 6/8] gdbstub: Add support for info proc mappings

2023-06-21 Thread Ilya Leoshkevich
-patches/2023-May/199432.html Co-developed-by: Dominik 'Disconnect3d' Czarnota Signed-off-by: Ilya Leoshkevich --- gdbstub/gdbstub.c | 45 +- gdbstub/internals.h | 5 ++ gdbstub/user-target.c | 139 ++ 3 files changed, 187 insertions

[PATCH v4 4/8] gdbstub: Expose gdb_get_process() and gdb_get_first_cpu_in_process()

2023-06-21 Thread Ilya Leoshkevich
These functions will be needed by user-target.c in order to retrieve the name of the executable. Reviewed-by: Alex Bennée Signed-off-by: Ilya Leoshkevich --- gdbstub/gdbstub.c | 16 gdbstub/internals.h | 2 ++ 2 files changed, 10 insertions(+), 8 deletions(-) diff --git

[PATCH v4 1/8] linux-user: Expose do_guest_openat() and do_guest_readlink()

2023-06-21 Thread Ilya Leoshkevich
These functions will be required by the GDB stub in order to provide the guest view of /proc to GDB. Reviewed-by: Alex Bennée Signed-off-by: Ilya Leoshkevich Reviewed-by: Richard Henderson --- linux-user/qemu.h| 3 +++ linux-user/syscall.c | 54

[PATCH v4 2/8] linux-user: Add "safe" parameter to do_guest_openat()

2023-06-21 Thread Ilya Leoshkevich
gdbstub cannot meaningfully handle QEMU_ERESTARTSYS, and it doesn't need to. Add a parameter to do_guest_openat() that makes it use openat() instead of safe_openat(), so that it becomes usable from gdbstub. Signed-off-by: Ilya Leoshkevich Reviewed-by: Richard Henderson --- linux-user/qemu.h

[PATCH v4 3/8] linux-user: Emulate /proc/self/smaps

2023-06-21 Thread Ilya Leoshkevich
the host mappings, since /proc/self/smaps is not emulated and is just passed through. Fix by emulating /proc/self/smaps. Provide true values only for Size, KernelPageSize, MMUPageSize and VmFlags. Leave all other values at 0, which is a valid conservative estimate. Signed-off-by: Ilya Leoshkevich

Re: [PATCH v3 8/8] tests/tcg: Add a test for info proc mappings

2023-06-21 Thread Ilya Leoshkevich
On Wed, 2023-06-21 at 11:21 +0100, Alex Bennée wrote: > > Ilya Leoshkevich writes: > > > Add a small test to prevent regressions. > > Since there are issues with how GDB interprets QEMU's target.xml, > > enable the test only on aarch64 and s390x for now. > > &g

Re: [PULL 15/18] s390x/tcg: Fix CPU address returned by STIDP

2023-06-07 Thread Ilya Leoshkevich
On Wed, 2023-06-07 at 12:05 +0300, Michael Tokarev wrote: > 06.06.2023 08:56, Thomas Huth wrote: > > From: Ilya Leoshkevich > > > > In qemu-user-s390x, /proc/cpuinfo contains: > > > > processor 0: version = 00,  identification = 00,  > >

Re: [PATCH v3 2/8] linux-user: Add "safe" parameter to do_guest_openat()

2023-06-06 Thread Ilya Leoshkevich
On Tue, 2023-06-06 at 11:24 -0700, Richard Henderson wrote: > On 6/6/23 06:27, Ilya Leoshkevich wrote: > > @@ -8518,7 +8522,11 @@ int do_guest_openat(CPUArchState *cpu_env, > > int dirfd, const char *pathname, > >   return fd; > >   } > >   > &

[PATCH v3 0/8] gdbstub: Add support for info proc mappings

2023-06-06 Thread Ilya Leoshkevich
Rename do_openat() to do_guest_openat(). - Do not retry pread(), since GDB is capable of doing it itself. - Add an extra sanity check to gdb_handle_query_xfer_exec_file(). - Replace citations of the spec by a single link. Best regards, Ilya Ilya Leoshkevich (8): linux-user: Expose do_guest_

[PATCH v3 5/8] gdbstub: Report the actual qemu-user pid

2023-06-06 Thread Ilya Leoshkevich
Currently qemu-user reports pid 1 to GDB. Resolve the TODO and report the actual PID. Using getpid() relies on the assumption that there is only one GDBProcess. Add an assertion to make sure that future changes don't break it. Reviewed-by: Alex Bennée Signed-off-by: Ilya Leoshkevich

<    1   2   3   4   5   6   7   8   9   10   >