Re: [PATCH] tcg/i386: Set P_REXW in tcg_out_addi_ptr

2023-05-17 Thread Evgeny Iakovlev
A bit late to the party, but still Tested-by: Evgeny Iakovlev

Re: [PATCH v3 5/5] hw/char/pl011: check if UART is enabled before RX or TX operation

2023-01-25 Thread Evgeny Iakovlev
On 1/23/2023 17:41, Philippe Mathieu-Daudé wrote: On 23/1/23 17:23, Peter Maydell wrote: On Mon, 23 Jan 2023 at 15:21, Philippe Mathieu-Daudé wrote: pl011_can_receive() returns the number of bytes that pl011_receive() can accept, pl011_can_transmit() returns a boolean. I was thinking of:

[PATCH v4 2/5] hw/char/pl011: add post_load hook for backwards-compatibility

2023-01-23 Thread Evgeny Iakovlev
, also do some sanity checking on untrusted incoming input state. Signed-off-by: Evgeny Iakovlev --- hw/char/pl011.c | 25 + 1 file changed, 25 insertions(+) diff --git a/hw/char/pl011.c b/hw/char/pl011.c index 3fa3b75d04..05e8bdc050 100644 --- a/hw/char/pl011.c +++ b/hw/char

[PATCH v4 4/5] hw/char/pl011: better handling of FIFO flags on LCR reset

2023-01-23 Thread Evgeny Iakovlev
RXFE flag to be set (and RXFF to be cleared) after resetting FIFO will never see that happen. Signed-off-by: Evgeny Iakovlev Reviewed-by: Peter Maydell --- hw/char/pl011.c | 18 +- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/hw/char/pl011.c b/hw/char/pl011.c

[PATCH v4 0/5] Series of fixes for PL011 char device

2023-01-23 Thread Evgeny Iakovlev
based on review feedback. v2: * Moved FIFO depth refactoring part of FIFO flags change into its own commit. * Added a reset method for PL011 Evgeny Iakovlev (5): hw/char/pl011: refactor FIFO depth handling code hw/char/pl011: add post_load hook for backwards-compatibility hw/char/pl011

[PATCH v4 5/5] hw/char/pl011: check if UART is enabled before RX or TX operation

2023-01-23 Thread Evgeny Iakovlev
. Signed-off-by: Evgeny Iakovlev Reviewed-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daudé --- hw/char/pl011.c | 36 +++- 1 file changed, 31 insertions(+), 5 deletions(-) diff --git a/hw/char/pl011.c b/hw/char/pl011.c index c15cb7af20..28ba242e2f 100644 --- a/hw

[PATCH v4 3/5] hw/char/pl011: implement a reset method

2023-01-23 Thread Evgeny Iakovlev
PL011 currently lacks a reset method. Implement it. Signed-off-by: Evgeny Iakovlev Reviewed-by: Peter Maydell Reviewed-by: Philippe Mathieu-Daudé --- hw/char/pl011.c | 26 +- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/hw/char/pl011.c b/hw/char/pl011

[PATCH v4 1/5] hw/char/pl011: refactor FIFO depth handling code

2023-01-23 Thread Evgeny Iakovlev
(albeit guest-invisible) side-effect of this change is that previously we would always increment s->read_pos in UARTDR read handler even if FIFO was disabled, now we are limiting read_pos to not exceed FIFO depth (read_pos itself is reset to 0 if user disables FIFO). Signed-off-by: Evgeny Iakov

Re: [PATCH v3 5/5] hw/char/pl011: check if UART is enabled before RX or TX operation

2023-01-23 Thread Evgeny Iakovlev
On 1/23/2023 16:59, Evgeny Iakovlev wrote: On 1/23/2023 16:21, Philippe Mathieu-Daudé wrote: On 23/1/23 15:43, Evgeny Iakovlev wrote: On 1/23/2023 09:14, Philippe Mathieu-Daudé wrote: On 20/1/23 16:54, Evgeny Iakovlev wrote: UART should be enabled in general and have RX enabled

Re: [PATCH v3 5/5] hw/char/pl011: check if UART is enabled before RX or TX operation

2023-01-23 Thread Evgeny Iakovlev
On 1/23/2023 16:21, Philippe Mathieu-Daudé wrote: On 23/1/23 15:43, Evgeny Iakovlev wrote: On 1/23/2023 09:14, Philippe Mathieu-Daudé wrote: On 20/1/23 16:54, Evgeny Iakovlev wrote: UART should be enabled in general and have RX enabled specifically to be able to receive data from

Re: [PATCH v3 5/5] hw/char/pl011: check if UART is enabled before RX or TX operation

2023-01-23 Thread Evgeny Iakovlev
On 1/23/2023 09:14, Philippe Mathieu-Daudé wrote: On 20/1/23 16:54, Evgeny Iakovlev wrote: UART should be enabled in general and have RX enabled specifically to be able to receive data from peripheral device. Same goes for transmitting data to peripheral device and a TXE flag. Check if UART

Re: [PATCH v3 2/5] hw/char/pl011: add post_load hook for backwards-compatibility

2023-01-23 Thread Evgeny Iakovlev
On 1/20/2023 19:22, Peter Maydell wrote: On Fri, 20 Jan 2023 at 15:54, Evgeny Iakovlev wrote: Previous change slightly modified the way we handle data writes when FIFO is disabled. Previously we kept incrementing read_pos and were storing data at that position, although we only have a single

[PATCH v3 1/2] target/arm: implement DBGCLAIM registers

2023-01-20 Thread Evgeny Iakovlev
The architecture does not define any functionality for the CLAIM tag bits. So we will just keep the raw bits, as per spec. Signed-off-by: Evgeny Iakovlev Reviewed-by: Peter Maydell Reviewed-by: Richard Henderson --- target/arm/cpu.h | 1 + target/arm/debug_helper.c | 33

[PATCH v3 2/2] target/arm: provide stubs for more external debug registers

2023-01-20 Thread Evgeny Iakovlev
AZ/WI stubs for OSDTRRX_EL1, OSDTRTX_EL1 and OSECCR_EL1 registers in the same way the rest of DCM is currently done. Do account for access traps though with access_tda. Signed-off-by: Evgeny Iakovlev Reviewed-by: Peter Maydell --- target/arm/debug_helper.c | 21 + 1 file ch

[PATCH v3 0/2] various aarch64 fixes for running Hyper-V on TCG

2023-01-20 Thread Evgeny Iakovlev
registers * Patch 3 is dropped because it was manually picked into target-arm.next Evgeny Iakovlev (2): target/arm: implement DBGCLAIM registers target/arm: provide stubs for more external debug registers target/arm/cpu.h | 1 + target/arm/debug_helper.c | 54

[PATCH v3 2/5] hw/char/pl011: add post_load hook for backwards-compatibility

2023-01-20 Thread Evgeny Iakovlev
some sanity checking on untrusted incoming input state. Signed-off-by: Evgeny Iakovlev --- hw/char/pl011.c | 27 ++- 1 file changed, 26 insertions(+), 1 deletion(-) diff --git a/hw/char/pl011.c b/hw/char/pl011.c index 3fa3b75d04..4df649a064 100644 --- a/hw/char/pl011.c

[PATCH v3 1/5] hw/char/pl011: refactor FIFO depth handling code

2023-01-20 Thread Evgeny Iakovlev
(albeit guest-invisible) side-effect of this change is that previously we would always increment s->read_pos in UARTDR read handler even if FIFO was disabled, now we are limiting read_pos to not exceed FIFO depth (read_pos itself is reset to 0 if user disables FIFO). Signed-off-by: Evgeny Iakov

[PATCH v3 3/5] hw/char/pl011: implement a reset method

2023-01-20 Thread Evgeny Iakovlev
PL011 currently lacks a reset method. Implement it. Signed-off-by: Evgeny Iakovlev --- hw/char/pl011.c | 26 +- 1 file changed, 21 insertions(+), 5 deletions(-) diff --git a/hw/char/pl011.c b/hw/char/pl011.c index 4df649a064..f9413f3703 100644 --- a/hw/char/pl011.c

[PATCH v3 5/5] hw/char/pl011: check if UART is enabled before RX or TX operation

2023-01-20 Thread Evgeny Iakovlev
. Signed-off-by: Evgeny Iakovlev Reviewed-by: Peter Maydell --- hw/char/pl011.c | 22 +++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/hw/char/pl011.c b/hw/char/pl011.c index c72fbb7d50..dd20b76609 100644 --- a/hw/char/pl011.c +++ b/hw/char/pl011.c @@ -54,6 +54,11

[PATCH v3 0/5] Series of fixes for PL011 char device

2023-01-20 Thread Evgeny Iakovlev
. * Added a reset method for PL011 Evgeny Iakovlev (5): hw/char/pl011: refactor FIFO depth handling code hw/char/pl011: add post_load hook for backwards-compatibility hw/char/pl011: implement a reset method hw/char/pl011: better handling of FIFO flags on LCR reset hw/char/pl011: check if

[PATCH v3 4/5] hw/char/pl011: better handling of FIFO flags on LCR reset

2023-01-20 Thread Evgeny Iakovlev
RXFE flag to be set (and RXFF to be cleared) after resetting FIFO will never see that happen. Signed-off-by: Evgeny Iakovlev --- hw/char/pl011.c | 18 +- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/hw/char/pl011.c b/hw/char/pl011.c index f9413f3703..c72fbb7d50

Re: [RFC] 2-stage translation emulation support for SMMUv3 on TCG

2023-01-19 Thread Evgeny Iakovlev
On 1/17/2023 18:00, Eric Auger wrote: Hi Evgeny, On 1/16/23 16:37, Evgeny Iakovlev wrote: Hi! We are using qemu-tcg-aarch64 to run Hyper-V test and debug builds for arm. Besides some minor fixes that i have submitted over the last couple of weeks, one big compatibility item for us is SMMUv3

Re: [PATCH v2 1/2] target/arm: implement DBGCLAIM registers

2023-01-19 Thread Evgeny Iakovlev
On 1/17/2023 16:48, Richard Henderson wrote: On 1/17/23 05:04, Evgeny Iakovlev wrote: +    { .name = "DBGCLAIMCLR_EL1", .state = ARM_CP_STATE_BOTH, +  .cp = 14, .opc0 = 2, .opc1 = 0, .crn = 7, .crm = 9, .opc2 = 6, +  .access = PL1_RW, .accessfn = access_tda, +

Re: [PATCH v2 1/4] hw/char/pl011: refactor FIFO depth handling code

2023-01-19 Thread Evgeny Iakovlev
On 1/19/2023 14:45, Peter Maydell wrote: On Tue, 17 Jan 2023 at 22:05, Evgeny Iakovlev wrote: PL011 can be in either of 2 modes depending guest config: FIFO and single register. The last mode could be viewed as a 1-element-deep FIFO. Current code open-codes a bunch of depth-dependent logic

Re: [PATCH v2 3/4] hw/char/pl011: better handling of FIFO flags on LCR reset

2023-01-19 Thread Evgeny Iakovlev
On 1/19/2023 14:30, Peter Maydell wrote: On Tue, 17 Jan 2023 at 22:05, Evgeny Iakovlev wrote: Current FIFO handling code does not reset RXFE/RXFF flags when guest resets FIFO by writing to UARTLCR register, although internal FIFO state is reset to 0 read count. Actual guest-visible flag

Re: [PATCH v2 2/4] hw/char/pl011: implement a reset method

2023-01-19 Thread Evgeny Iakovlev
On 1/19/2023 14:27, Peter Maydell wrote: On Tue, 17 Jan 2023 at 22:05, Evgeny Iakovlev wrote: PL011 currently lacks a reset method. Implement it. Signed-off-by: Evgeny Iakovlev --- hw/char/pl011.c | 31 ++- 1 file changed, 26 insertions(+), 5 deletions

[PATCH v2 1/4] hw/char/pl011: refactor FIFO depth handling code

2023-01-17 Thread Evgeny Iakovlev
(albeit guest-invisible) side-effect of this change is that previously we would always increment s->read_pos in UARTDR read handler even if FIFO was disabled, now we are limiting read_pos to not exceed FIFO depth (read_pos itself is reset to 0 if user disables FIFO). Signed-off-by: Evgeny Iakov

[PATCH v2 0/4] Series of fixes for PL011 char device

2023-01-17 Thread Evgeny Iakovlev
v2: * Moved FIFO depth refactoring part of FIFO flags change into its own commit. * Added a reset method for PL011 Evgeny Iakovlev (4): hw/char/pl011: refactor FIFO depth handling code hw/char/pl011: implement a reset method hw/char/pl011: better handling of FIFO flags on LCR reset hw

[PATCH v2 4/4] hw/char/pl011: check if UART is enabled before RX or TX operation

2023-01-17 Thread Evgeny Iakovlev
. Signed-off-by: Evgeny Iakovlev --- hw/char/pl011.c | 22 +++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/hw/char/pl011.c b/hw/char/pl011.c index 3184949d69..522f36e4f3 100644 --- a/hw/char/pl011.c +++ b/hw/char/pl011.c @@ -54,6 +54,11 @@ #define INT_E (INT_OE

[PATCH v2 3/4] hw/char/pl011: better handling of FIFO flags on LCR reset

2023-01-17 Thread Evgeny Iakovlev
RXFE flag to be set (and RXFF to be cleared) after resetting FIFO will never see that happen. Signed-off-by: Evgeny Iakovlev --- hw/char/pl011.c | 14 +- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/hw/char/pl011.c b/hw/char/pl011.c index 404d52a3b8..3184949d69 100644

[PATCH v2 2/4] hw/char/pl011: implement a reset method

2023-01-17 Thread Evgeny Iakovlev
PL011 currently lacks a reset method. Implement it. Signed-off-by: Evgeny Iakovlev --- hw/char/pl011.c | 31 ++- 1 file changed, 26 insertions(+), 5 deletions(-) diff --git a/hw/char/pl011.c b/hw/char/pl011.c index 329cc6926d..404d52a3b8 100644 --- a/hw/char/pl011.c

Re: [PATCH 1/2] hw/char/pl011: better handling of FIFO flags on LCR reset

2023-01-17 Thread Evgeny Iakovlev
On 1/17/2023 16:24, Peter Maydell wrote: On Fri, 6 Jan 2023 at 17:28, Evgeny Iakovlev wrote: Current FIFO handling code does not reset RXFE/RXFF flags when guest resets FIFO by writing to UARTLCR register, although internal FIFO state is reset to 0 read count. Actual flag update will happen

[PATCH v2 2/2] target/arm: provide stubs for more external debug registers

2023-01-17 Thread Evgeny Iakovlev
AZ/WI stubs for OSDTRRX_EL1, OSDTRTX_EL1 and OSECCR_EL1 registers in the same way the rest of external debug is currently done. Signed-off-by: Evgeny Iakovlev Reviewed-by: Peter Maydell --- target/arm/debug_helper.c | 21 + 1 file changed, 21 insertions(+) diff --git a/targe

[PATCH v2 0/2] various aarch64 fixes for running Hyper-V on TCG

2023-01-17 Thread Evgeny Iakovlev
-arm.next Evgeny Iakovlev (2): target/arm: implement DBGCLAIM registers target/arm: provide stubs for more external debug registers target/arm/cpu.h | 1 + target/arm/debug_helper.c | 59 +++ 2 files changed, 60 insertions(+) -- 2.34.1

[PATCH v2 1/2] target/arm: implement DBGCLAIM registers

2023-01-17 Thread Evgeny Iakovlev
The architecture does not define any functionality for the CLAIM tag bits. So we will just keep the raw bits, as per spec. Signed-off-by: Evgeny Iakovlev Reviewed-by: Peter Maydell --- target/arm/cpu.h | 1 + target/arm/debug_helper.c | 38 ++ 2

[RFC] 2-stage translation emulation support for SMMUv3 on TCG

2023-01-16 Thread Evgeny Iakovlev
Hi! We are using qemu-tcg-aarch64 to run Hyper-V test and debug builds for arm. Besides some minor fixes that i have submitted over the last couple of weeks, one big compatibility item for us is SMMUv3 2-stage translations support. We can do fine without it right now, but having it would als

Re: [PATCH 3/3] target/arm: allow writes to SCR_EL3.HXEn bit when FEAT_HCX is enabled

2023-01-16 Thread Evgeny Iakovlev
On 1/13/2023 14:20, Peter Maydell wrote: On Thu, 5 Jan 2023 at 22:13, Evgeny Iakovlev wrote: ARM trusted firmware, when built with FEAT_HCX support, sets SCR_EL3.HXEn bit to allow EL2 to modify HCRX_EL2 register without trapping it in EL3. Qemu uses a valid mask to clear unsupported SCR_EL3

Re: [PATCH v2] semihosting: add O_BINARY flag in host_open for NT compatibility

2023-01-06 Thread Evgeny Iakovlev
On 1/6/2023 17:28, Peter Maydell wrote: On Fri, 6 Jan 2023 at 15:44, Alex Bennée wrote: Peter Maydell writes: The semihosting API, at least for Arm, has a modeflags string so the guest can say whether it wants to open O_BINARY or not: https://github.com/ARM-software/abi-aa/blob/main/semihos

[PATCH 2/2] hw/char/pl011: check if UART is enabled before RX or TX operation

2023-01-06 Thread Evgeny Iakovlev
. Signed-off-by: Evgeny Iakovlev --- hw/char/pl011.c | 22 +++--- 1 file changed, 19 insertions(+), 3 deletions(-) diff --git a/hw/char/pl011.c b/hw/char/pl011.c index 9108ed2be9..fcc2600944 100644 --- a/hw/char/pl011.c +++ b/hw/char/pl011.c @@ -54,6 +54,11 @@ #define INT_E (INT_OE

[PATCH 0/2] Series of fixes for PL011 char device

2023-01-06 Thread Evgeny Iakovlev
Evgeny Iakovlev (2): hw/char/pl011: better handling of FIFO flags on LCR reset hw/char/pl011: check if UART is enabled before RX or TX operation hw/char/pl011.c | 51 ++--- include/hw/char/pl011.h | 5 +++- 2 files changed, 41 insertions(+), 15

[PATCH 1/2] hw/char/pl011: better handling of FIFO flags on LCR reset

2023-01-06 Thread Evgeny Iakovlev
(and RXFF to be cleared) after resetting FIFO will just hang. Correctly reset FIFO flags on FIFO reset. Also, clean up some FIFO depth handling code based on current FIFO mode. Signed-off-by: Evgeny Iakovlev --- hw/char/pl011.c | 35 +-- include/hw/char

Re: [PATCH] semihosting: add O_BINARY flag in host_open for NT compatibility

2023-01-06 Thread Evgeny Iakovlev
On 1/6/2023 10:48, Bin Meng wrote: On Fri, Jan 6, 2023 at 3:39 PM Philippe Mathieu-Daudé wrote: On 5/1/23 22:19, Evgeny Iakovlev wrote: Windows open(2) implementations opens files in text mode by default and needs a Windows-only O_BINARY flag to open files as binary. Qemu already s/Qemu

Re: [PATCH] semihosting: add O_BINARY flag in host_open for NT compatibility

2023-01-06 Thread Evgeny Iakovlev
On 1/6/2023 10:48, Bin Meng wrote: On Fri, Jan 6, 2023 at 3:39 PM Philippe Mathieu-Daudé wrote: On 5/1/23 22:19, Evgeny Iakovlev wrote: Windows open(2) implementations opens files in text mode by default and needs a Windows-only O_BINARY flag to open files as binary. Qemu already s/Qemu

[PATCH v2] semihosting: add O_BINARY flag in host_open for NT compatibility

2023-01-06 Thread Evgeny Iakovlev
: Evgeny Iakovlev Reviewed-by: Philippe Mathieu-Daudé Reviewed-by: Bin Meng --- semihosting/syscalls.c | 8 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/semihosting/syscalls.c b/semihosting/syscalls.c index 508a0ad88c..b621d78c2d 100644 --- a/semihosting/syscalls.c +++ b

[PATCH] semihosting: add O_BINARY flag in host_open for NT compatibility

2023-01-05 Thread Evgeny Iakovlev
Windows open(2) implementations opens files in text mode by default and needs a Windows-only O_BINARY flag to open files as binary. Qemu already knows about that flag in osdep.h, so we can just add it to the host_flags for better compatibility when running qemu on Windows. Signed-off-by: Evgeny

[PATCH 1/3] target/arm: implement DBGCLAIM registers

2023-01-05 Thread Evgeny Iakovlev
The architecture does not define any functionality for the CLAIM tag bits. So we will just keep the raw bits, as per spec. Helps Hyper-V boot on aarch64-tcg because it context-switches DBGCLAIM on EL2 entry/exit. Signed-off-by: Evgeny Iakovlev --- target/arm/cpu.h | 1 + target/arm

[PATCH 3/3] target/arm: allow writes to SCR_EL3.HXEn bit when FEAT_HCX is enabled

2023-01-05 Thread Evgeny Iakovlev
T_HCX is enabled and exposed to the guest. As a result EL3 writes of that bit are ignored. Signed-off-by: Evgeny Iakovlev --- target/arm/helper.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/target/arm/helper.c b/target/arm/helper.c index bac2ea62c4..962affdd52 100644 --- a/targe

[PATCH 2/3] target/arm: provide RAZ/WI stubs for more DCC registers

2023-01-05 Thread Evgeny Iakovlev
e way the rest of DCM is currently done. Do account for access traps though with access_tda. Signed-off-by: Evgeny Iakovlev --- target/arm/debug_helper.c | 12 1 file changed, 12 insertions(+) diff --git a/target/arm/debug_helper.c b/target/arm/debug_helper.c index b244e146e2..2a7c3

[PATCH 0/3] various aarch64 fixes for running Hyper-V on TCG

2023-01-05 Thread Evgeny Iakovlev
Small series of changes to aarch64 emulation to better support running Hyper-V as a TCG guest wtih EL3 firmware. Evgeny Iakovlev (3): target/arm: implement DBGCLAIM registers target/arm: provide RAZ/WI stubs for more DCC registers target/arm: allow writes to SCR_EL3.HXEn bit when FEAT_HCX