[PATCH qemu.git 0/2] hw/timer/imx_epit: fix reported issues

2023-04-05 Thread ~axelheider
This patchset fixes the following issues: - variable shadowing reported by Coverity - fix check, see https://gitlab.com/qemu-project/qemu/-/issues/1491 Axel Heider (2): hw/timer/imx_epit: don't shadow variable hw/timer/imx_epit: fix limit check hw/timer/imx_epit.c | 2 +- 1 file changed, 1 i

[PATCH qemu.git 2/2] hw/timer/imx_epit: fix limit check

2023-04-05 Thread ~axelheider
From: Axel Heider Fix the limit check. If the limit is less than the compare value, the timer can never reach this value, thus it will never fire. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/1491 Signed-off-by: Axel Heider --- hw/timer/imx_epit.c | 2 +- 1 file changed, 1 insertio

[PATCH qemu.git 1/2] hw/timer/imx_epit: don't shadow variable

2023-04-05 Thread ~axelheider
From: Axel Heider Fix issue reported by Coverity. Signed-off-by: Axel Heider --- hw/timer/imx_epit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/timer/imx_epit.c b/hw/timer/imx_epit.c index 3a869782bc..0821c62cd1 100644 --- a/hw/timer/imx_epit.c +++ b/hw/timer/imx_ep

[PATCH qemu.git v3 1/8] hw/timer/imx_epit: improve comments

2022-12-01 Thread ~axelheider
From: Axel Heider Fix typos, add background information Signed-off-by: Axel Heider --- hw/timer/imx_epit.c | 20 1 file changed, 16 insertions(+), 4 deletions(-) diff --git a/hw/timer/imx_epit.c b/hw/timer/imx_epit.c index ec0fa440d7..2841fbaa1c 100644 --- a/hw/timer/imx_

[PATCH qemu.git v3 6/8] hw/timer/imx_epit: factor out register write handlers

2022-12-01 Thread ~axelheider
From: Axel Heider Signed-off-by: Axel Heider --- hw/timer/imx_epit.c | 207 1 file changed, 113 insertions(+), 94 deletions(-) diff --git a/hw/timer/imx_epit.c b/hw/timer/imx_epit.c index 39f47222d0..e04427542f 100644 --- a/hw/timer/imx_epit.c +++ b

[PATCH qemu.git v3 7/8] hw/timer/imx_epit: remove explicit fields cnt and freq

2022-12-01 Thread ~axelheider
From: Axel Heider The CNT register is a read-only register. There is no need to store it's value, it can be calculated on demand. The calculated frequency is needed temporarily only. Note that this is a migration compatibility break for all boards types that use the EPIT peripheral. Signed-off-

[PATCH qemu.git v3 2/8] hw/timer/imx_epit: cleanup CR defines

2022-12-01 Thread ~axelheider
From: Axel Heider remove unused defines, add needed defines Signed-off-by: Axel Heider --- hw/timer/imx_epit.c | 4 ++-- include/hw/timer/imx_epit.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/hw/timer/imx_epit.c b/hw/timer/imx_epit.c index 2841fbaa1c..661e

[PATCH qemu.git v3 3/8] hw/timer/imx_epit: define SR_OCIF

2022-12-01 Thread ~axelheider
From: Axel Heider --- hw/timer/imx_epit.c | 12 ++-- include/hw/timer/imx_epit.h | 2 ++ 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/hw/timer/imx_epit.c b/hw/timer/imx_epit.c index 661e9158e3..f148868b8c 100644 --- a/hw/timer/imx_epit.c +++ b/hw/timer/imx_epit

[PATCH qemu.git v3 5/8] hw/timer/imx_epit: hard reset initializes CR with 0

2022-12-01 Thread ~axelheider
From: Axel Heider Signed-off-by: Axel Heider --- hw/timer/imx_epit.c | 20 ++-- 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/hw/timer/imx_epit.c b/hw/timer/imx_epit.c index 7af3a8b10e..39f47222d0 100644 --- a/hw/timer/imx_epit.c +++ b/hw/timer/imx_epit.c @@ -99

[PATCH qemu.git v3 8/8] hw/timer/imx_epit: fix compare timer handling

2022-12-01 Thread ~axelheider
From: Axel Heider - fix #1263 for CR writes - rework compare time handling - The compare timer has to run even if CR.OCIEN is not set, as SR.OCIF must be updated. - The compare timer fires exactly once when the compare value is less than the current value, but the reload values is

[PATCH qemu.git v3 4/8] hw/timer/imx_epit: update interrupt state on CR write access

2022-12-01 Thread ~axelheider
From: Axel Heider The interrupt state can change due to: - reset clears both SR.OCIF and CR.OCIE - write to CR.EN or CR.OCIE Signed-off-by: Axel Heider --- hw/timer/imx_epit.c | 16 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/hw/timer/imx_epit.c b/hw/timer/i

[PATCH qemu.git v2 1/1] hw/arm/virt: make second UART available

2022-12-01 Thread ~axelheider
From: Axel Heider The first UART always always exists. If the security extensions are enabled, the second UART also always exists. Otherwise, it only exists if a backend is configured explicitly via '-serial ', where 'null' creates a dummy backend. This allows enabling the second UART explicitly

[PATCH qemu.git v2 0/1] hw/arm/virt: make second UART available

2022-12-01 Thread ~axelheider
This is a follow-up on older attempts to make a second UART available for the arm-virt machine in normal world. The use case is, that this give a simple I/O channel in addition to stdout, as this simplifies various test scenarios. Especially for non-Linux operating systems (e.g. seL4) where arm-vir

[PATCH qemu.git 1/1] hw/arm/virt: add 2x sp804 timer

2022-11-30 Thread ~axelheider
From: Axel Heider Add 2x sp804 timer devices. Co-Authored-by: Florian Hauschild Signed-off-by: Axel Heider --- docs/system/arm/virt.rst | 1 + hw/arm/Kconfig | 1 + hw/arm/virt.c| 47 include/hw/arm/virt.h| 2 ++ 4 files ch

[PATCH qemu.git 0/1] hw/arm/virt: add 2x sp804 timer

2022-11-30 Thread ~axelheider
This patch adds timer peripherals to the arm-virt machine. The use case is, that this machine is quite useful for testing purposes when it comes to non-Linux operating system (seL4 in our case). However, is currently lacks a dedicates timer peripheral, so some scenarios cannot be tested easily with

[PATCH qemu.git 0/1] hw/arm/virt: make second UART available

2022-11-30 Thread ~axelheider
This is a follow-up on older attempts to make a second UART available for the arm-virt machine in normal world. The use case is, that this give a simple I/O channel in addition to stdout, as this simplifies various test scenarios. Especially for non-Linux operating system,s (e.g. seL4) where arm-vi

[PATCH qemu.git 1/1] hw/arm/virt: make second UART available

2022-11-30 Thread ~axelheider
From: Axel Heider The first UART always always exists. If the security extensions are enabled, the second UART also always exists. Otherwise, it only exists if a backend is configured explicitly via '-serial ', where 'null' creates a dummy backend. This allows enabling the second UART explicitly

[PATCH qemu.git v2 5/9] hw/timer/imx_epit: do not persist CR.SWR bit

2022-11-07 Thread ~axelheider
From: Axel Heider Signed-off-by: Axel Heider --- hw/timer/imx_epit.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/hw/timer/imx_epit.c b/hw/timer/imx_epit.c index 5315d9633e..6af460946f 100644 --- a/hw/timer/imx_epit.c +++ b/hw/timer/imx_epit.c @@ -191,8 +191,9 @@ s

[PATCH qemu.git v2 8/9] hw/timer/imx_epit: change reset handling

2022-11-07 Thread ~axelheider
From: Axel Heider - inline software reset - make hardware reset invoke software reset - simplify code flow Signed-off-by: Axel Heider --- hw/timer/imx_epit.c | 66 - 1 file changed, 23 insertions(+), 43 deletions(-) diff --git a/hw/timer/imx_epit.c

[PATCH qemu.git v2 7/9] hw/timer/imx_epit: factor out register write handlers

2022-11-07 Thread ~axelheider
From: Axel Heider Signed-off-by: Axel Heider --- hw/timer/imx_epit.c | 211 1 file changed, 115 insertions(+), 96 deletions(-) diff --git a/hw/timer/imx_epit.c b/hw/timer/imx_epit.c index b0ef727efb..30280a9ac1 100644 --- a/hw/timer/imx_epit.c +++ b

[PATCH qemu.git v2 2/9] hw/timer/imx_epit: cleanup CR defines

2022-11-07 Thread ~axelheider
From: Axel Heider remove unused defines, add needed defines Signed-off-by: Axel Heider --- hw/timer/imx_epit.c | 4 ++-- include/hw/timer/imx_epit.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/hw/timer/imx_epit.c b/hw/timer/imx_epit.c index 4af730593f..8ec7

[PATCH qemu.git v2 4/9] hw/timer/imx_epit: software reset clears the interrupt

2022-11-07 Thread ~axelheider
From: Axel Heider Signed-off-by: Axel Heider --- hw/timer/imx_epit.c | 4 1 file changed, 4 insertions(+) diff --git a/hw/timer/imx_epit.c b/hw/timer/imx_epit.c index 2e9dae0bc8..5315d9633e 100644 --- a/hw/timer/imx_epit.c +++ b/hw/timer/imx_epit.c @@ -94,6 +94,10 @@ static void imx_epit_

[PATCH qemu.git v2 9/9] hw/timer/imx_epit: fix compare timer handling

2022-11-07 Thread ~axelheider
From: Axel Heider - fix #1263 - rework compare time handling - The compare timer has to run even if CR.OCIEN is not set, as SR.OCIF must be updated. - The compare timer fires exactly once when the compare value is less than the current value, but the reload values is less than the

[PATCH qemu.git v2 6/9] hw/timer/imx_epit: remove explicit fields cnt and freq

2022-11-07 Thread ~axelheider
From: Axel Heider The CNT register is a read-only register. There is no need to store it's value, it can be calculated on demand. The calculated frequency is needed temporarily only. Signed-off-by: Axel Heider --- hw/timer/imx_epit.c | 76 +++-- include/

[PATCH qemu.git v2 0/9] hw/timer/imx_epit: imprive and fix compare timer handling

2022-11-07 Thread ~axelheider
This patch set improves the i.MX EPIT emulation: - fix #1263 for writes to CR also - do not persist CR.SWR bit - remove explicit fields cnt and freq - software reset clears the interrupt - general code and documentation improvements Axel Heider (9): hw/timer/imx_epit: improve comments hw/timer

[PATCH qemu.git v2 3/9] hw/timer/imx_epit: simplify interrupt logic

2022-11-07 Thread ~axelheider
From: Axel Heider Signed-off-by: Axel Heider --- hw/timer/imx_epit.c | 27 +++ 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/hw/timer/imx_epit.c b/hw/timer/imx_epit.c index 8ec770f674..2e9dae0bc8 100644 --- a/hw/timer/imx_epit.c +++ b/hw/timer/imx_epit.

[PATCH qemu.git v2 1/9] hw/timer/imx_epit: improve comments

2022-11-07 Thread ~axelheider
From: Axel Heider Fix typos, add background information Signed-off-by: Axel Heider --- hw/timer/imx_epit.c | 17 + 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/hw/timer/imx_epit.c b/hw/timer/imx_epit.c index ec0fa440d7..4af730593f 100644 --- a/hw/timer/imx_epi

[PATCH qemu.git 10/11] hw/timer/imx_epit: fix compare timer update

2022-10-30 Thread ~axelheider
From: Axel Heider The compare timer will never fire if the reload value is less than the compare value, so it must be disabled in this case. The compare time fire exactly once when the compare value is less than the current value, but the reload values is less than the compare value. Signed-off-

[PATCH qemu.git 04/11] hw/timer/imx_epit: remove explicit fields cnt and freq

2022-10-30 Thread ~axelheider
From: Axel Heider The CNT register is a read-only register. There is no need to store it's value, it can be calculated on demand. The calculated frequency is needed temporarily only. Signed-off-by: Axel Heider --- hw/timer/imx_epit.c | 42 +++-- include/

[PATCH qemu.git 05/11] hw/timer/imx_epit: simplify interrupt logic

2022-10-30 Thread ~axelheider
From: Axel Heider Signed-off-by: Axel Heider --- hw/timer/imx_epit.c | 23 +-- 1 file changed, 9 insertions(+), 14 deletions(-) diff --git a/hw/timer/imx_epit.c b/hw/timer/imx_epit.c index 37b04a1b53..d21cbf16f6 100644 --- a/hw/timer/imx_epit.c +++ b/hw/timer/imx_epit.c @@

[PATCH qemu.git 11/11] hw/timer/imx_epit: rework CR write handling

2022-10-30 Thread ~axelheider
From: Axel Heider - simplify code, improve comments - fix https://gitlab.com/qemu-project/qemu/-/issues/1263 Signed-off-by: Axel Heider --- hw/timer/imx_epit.c | 139 +--- 1 file changed, 65 insertions(+), 74 deletions(-) diff --git a/hw/timer/imx_epit.

[PATCH qemu.git 09/11] hw/timer/imx_epit: cleanup CR defines

2022-10-30 Thread ~axelheider
From: Axel Heider remove unused defines, add needed defines Signed-off-by: Axel Heider --- hw/timer/imx_epit.c | 4 ++-- include/hw/timer/imx_epit.h | 4 ++-- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/hw/timer/imx_epit.c b/hw/timer/imx_epit.c index 5915d4b3d4..196f

[PATCH qemu.git 00/11] improve hw/timer/imx_epit

2022-10-30 Thread ~axelheider
This is a follow-up on my initial work to fix https://gitlab.com/qemu- project/qemu/-/issues/1263. - fix #1263 for CR writes - fix compare timer update - software reset clears the interrupt - do not persist CR.SWR bit - general code cleanup and comment improvements Axel Heider (11): hw/timer/imx

[PATCH qemu.git 06/11] hw/timer/imx_epit: software reset clears the interrupt

2022-10-30 Thread ~axelheider
From: Axel Heider --- hw/timer/imx_epit.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/hw/timer/imx_epit.c b/hw/timer/imx_epit.c index d21cbf16f6..2e4ff89613 100644 --- a/hw/timer/imx_epit.c +++ b/hw/timer/imx_epit.c @@ -97,6 +97,9 @@ static void imx_epit_reset(DeviceState *dev) s

[PATCH qemu.git 07/11] hw/timer/imx_epit: do not persist CR.SWR bit

2022-10-30 Thread ~axelheider
From: Axel Heider Signed-off-by: Axel Heider --- hw/timer/imx_epit.c | 9 ++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/hw/timer/imx_epit.c b/hw/timer/imx_epit.c index 2e4ff89613..bba9c87cd4 100644 --- a/hw/timer/imx_epit.c +++ b/hw/timer/imx_epit.c @@ -175,9 +175,12 @

[PATCH qemu.git 08/11] hw/timer/imx_epit: simplify CR.ENMOD handling

2022-10-30 Thread ~axelheider
From: Axel Heider Signed-off-by: Axel Heider --- hw/timer/imx_epit.c | 11 --- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/hw/timer/imx_epit.c b/hw/timer/imx_epit.c index bba9c87cd4..5915d4b3d4 100644 --- a/hw/timer/imx_epit.c +++ b/hw/timer/imx_epit.c @@ -198,13 +198,

[PATCH qemu.git 03/11] hw/timer/imx_epit: factor out register write handlers

2022-10-30 Thread ~axelheider
From: Axel Heider Signed-off-by: Axel Heider --- hw/timer/imx_epit.c | 189 1 file changed, 103 insertions(+), 86 deletions(-) diff --git a/hw/timer/imx_epit.c b/hw/timer/imx_epit.c index b6c013292f..a79f58c963 100644 --- a/hw/timer/imx_epit.c +++ b

[PATCH qemu.git 02/11] hw/timer/imx_epit: improve comments

2022-10-30 Thread ~axelheider
From: Axel Heider Signed-off-by: Axel Heider --- hw/timer/imx_epit.c | 10 ++ 1 file changed, 10 insertions(+) diff --git a/hw/timer/imx_epit.c b/hw/timer/imx_epit.c index 06785fe6f6..b6c013292f 100644 --- a/hw/timer/imx_epit.c +++ b/hw/timer/imx_epit.c @@ -352,8 +352,18 @@ static void

[PATCH qemu.git 01/11] hw/timer/imx_epit: fix typo in comment

2022-10-30 Thread ~axelheider
From: Axel Heider Signed-off-by: Axel Heider --- hw/timer/imx_epit.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/timer/imx_epit.c b/hw/timer/imx_epit.c index ec0fa440d7..06785fe6f6 100644 --- a/hw/timer/imx_epit.c +++ b/hw/timer/imx_epit.c @@ -254,7 +254,7 @@ static v

[PATCH qemu.git] target/imx: reload cmp timer outside of the reload ptimer transaction

2022-10-24 Thread ~axelheider
From: Axel Heider When running seL4 tests (https://docs.sel4.systems/projects/sel4test) on the sabrelight platform, the timer tests fail. The arm/imx6 EPIT timer interrupt does not fire properly, instead of a e.g. second in can take up to a minute to finally see the interrupt. Resolves: https://

[PATCH qemu.git] target/imx: reload cmp timer outside of the reload ptimer transaction

2022-10-21 Thread ~axelheider
From: Axel Heider Signed-off-by: Axel Heider --- See https://gitlab.com/qemu-project/qemu/-/issues/1263 When running the seL4 tests (https://docs.sel4.systems/projects/sel4test), on the sabrelight platform the timer test fails (and thus it's disabled by default). Investigation has shown that the