[PATCH 25/35] /locking/co-mutex

2022-03-10 Thread Paolo Bonzini
Signed-off-by: Paolo Bonzini --- tests/unit/test-coroutine.c | 35 --- 1 file changed, 28 insertions(+), 7 deletions(-) diff --git a/tests/unit/test-coroutine.c b/tests/unit/test-coroutine.c index 0fe9226b86..642ef36bc3 100644 --- a/tests/unit/test-coroutine.c

[PATCH 19/35] /perf/lifecycle

2022-03-10 Thread Paolo Bonzini
Signed-off-by: Paolo Bonzini --- tests/unit/test-coroutine.c | 44 - 1 file changed, 39 insertions(+), 5 deletions(-) diff --git a/tests/unit/test-coroutine.c b/tests/unit/test-coroutine.c index 3d898d50c6..439bd269c9 100644 --- a/tests/unit/test-coroutine.c

[PATCH 21/35] /perf/yield

2022-03-10 Thread Paolo Bonzini
Signed-off-by: Paolo Bonzini --- tests/unit/test-coroutine.c | 23 +++ 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/tests/unit/test-coroutine.c b/tests/unit/test-coroutine.c index 75d54e5d29..0b7b4d6ef8 100644 --- a/tests/unit/test-coroutine.c +++

[PATCH-for-7.0] softmmu: List CPU types again

2022-03-10 Thread Philippe Mathieu-Daudé
From: Philippe Mathieu-Daudé Commit e0220bb5b2 made cpus.c target-agnostic but didn't notice the cpu_list() function is only defined in target-specific code in "cpu.h". Extract list_cpus() from the generic cpus.c into a new target-specific unit. Fixes: e0220bb5b2 ("softmmu: Build

[PATCH 16/35] /basic/entered

2022-03-10 Thread Paolo Bonzini
Signed-off-by: Paolo Bonzini --- tests/unit/test-coroutine.c | 30 ++ 1 file changed, 22 insertions(+), 8 deletions(-) diff --git a/tests/unit/test-coroutine.c b/tests/unit/test-coroutine.c index c701113d77..bc75050463 100644 --- a/tests/unit/test-coroutine.c +++

[PATCH 17/35] /basic/in_coroutine

2022-03-10 Thread Paolo Bonzini
Signed-off-by: Paolo Bonzini --- tests/unit/test-coroutine.c | 7 +++ 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/tests/unit/test-coroutine.c b/tests/unit/test-coroutine.c index bc75050463..6ad653adda 100644 --- a/tests/unit/test-coroutine.c +++

[PATCH 18/35] /basic/order

2022-03-10 Thread Paolo Bonzini
Signed-off-by: Paolo Bonzini --- tests/unit/test-coroutine.c | 23 ++- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/tests/unit/test-coroutine.c b/tests/unit/test-coroutine.c index 6ad653adda..3d898d50c6 100644 --- a/tests/unit/test-coroutine.c +++

[PATCH 15/35] /basic/self

2022-03-10 Thread Paolo Bonzini
Signed-off-by: Paolo Bonzini --- tests/unit/test-coroutine.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tests/unit/test-coroutine.c b/tests/unit/test-coroutine.c index 7aaadfd31a..c701113d77 100644 --- a/tests/unit/test-coroutine.c +++

[PATCH 11/35] convert CoMutex to stackless coroutines

2022-03-10 Thread Paolo Bonzini
Build the frame for qemu_co_mutex_lock_slowpath, because it has code that runs after qemu_coroutine_yield(). For qemu_co_mutex_lock() and qemu_co_mutex_unlock(), just return COROUTINE_CONTINUE on paths that do not go through an awaitable function, which is all of them in the case of

Re: [PATCH 04/18] tests: print newline after QMP response in qtest logs

2022-03-10 Thread Marc-André Lureau
Hi On Thu, Mar 10, 2022 at 3:35 PM Daniel P. Berrangé wrote: > On Thu, Mar 10, 2022 at 03:11:08PM +0400, Marc-André Lureau wrote: > > Hi > > > > On Thu, Mar 10, 2022 at 2:56 PM Daniel P. Berrangé > > wrote: > > > > > On Mon, Mar 07, 2022 at 11:09:37AM +0100, Thomas Huth wrote: > > > > On

[PATCH 13/35] /basic/yield

2022-03-10 Thread Paolo Bonzini
Signed-off-by: Paolo Bonzini --- tests/unit/test-coroutine.c | 27 +++ 1 file changed, 23 insertions(+), 4 deletions(-) diff --git a/tests/unit/test-coroutine.c b/tests/unit/test-coroutine.c index 3670750c5b..ae06e97c95 100644 --- a/tests/unit/test-coroutine.c +++

[PATCH 10/35] enable tail call optimization of qemu_co_mutex_lock

2022-03-10 Thread Paolo Bonzini
Make qemu_co_mutex_lock_slowpath a tail call, so that qemu_co_mutex_lock does not need to build a stack frame of its own. Signed-off-by: Paolo Bonzini --- util/qemu-coroutine-lock.c | 6 -- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/util/qemu-coroutine-lock.c

Re: [RFC PATCH] tests/tcg: drop -cpu max from s390x sha512-mvx invocation

2022-03-10 Thread Thomas Huth
On 10/03/2022 12.35, Richard Henderson wrote: On 3/10/22 02:21, Thomas Huth wrote: On 10/03/2022 09.36, Thomas Huth wrote: [...] However, the error still persists. I now had a closer look by running the test with "qemu-s390x" on my z15 machine directly, and all tests are failing! The problem

Re: MAINTAINERS: macOS host support (was: MAINTAINERS: take edk2)

2022-03-10 Thread Philippe Mathieu-Daudé
+Stefan for overall project resources. On 10/3/22 12:07, Daniel P. Berrangé wrote: On Thu, Mar 10, 2022 at 12:00:35PM +0100, Christian Schoenebeck wrote: On Mittwoch, 9. März 2022 12:44:16 CET Daniel P. Berrangé wrote: On Wed, Mar 09, 2022 at 11:40:42AM +0100, Christian Schoenebeck wrote: On

[PATCH 09/35] convert qemu-coroutine-sleep.c to stackless coroutines

2022-03-10 Thread Paolo Bonzini
The main change is to qemu_co_sleep_ns_wakeable, which gets the full conversion treatment. It's important to note that variables that escape (have their address taken), such as "QEMUTimer ts" in this case, move entirely to the frame structure and do not have local variables anymore. For the

Re: qemu-softmmu -cpu help broken

2022-03-10 Thread Thomas Huth
On 10/03/2022 12.10, Max Filippov wrote: Hello, I've noticed that the command qemu-system-xtensa -cpu help no longer prints anything. Apparently because cpu_list is no longer defined in list_cpus inside softmmu/cpus.c Bisection points to the following commit: e0220bb5b200 ("softmmu: Build

[PATCH 12/35] define magic macros for stackless coroutines

2022-03-10 Thread Paolo Bonzini
Because conversion to stackless coroutines is incredibly repetitive, define some magic variable-argument macros that simplify the task: - CO_DECLARE_FRAME() declares a frame structure, with a couple common fields and the extras coming from variable arguments - CO_INIT_FRAME() allocates the

[PATCH RESEND v1 0/2] i386: Make PIT and PIC the property of common x86 base machine type

2022-03-10 Thread Xiaoyao Li
For PIT, it's straightforward to merge microvm::pit and pc_machine::pit_enabled into x86ms::pit For PIC, move microvm::pic to x86ms:pic, which gives PC machine the ability to dis-/en-able PIC and it's the preparation for future TDX support. --- Resend: - collect Reviewed-by; - rebase to

Re: [RFC PATCH] tests/tcg: drop -cpu max from s390x sha512-mvx invocation

2022-03-10 Thread Richard Henderson
On 3/10/22 02:21, Thomas Huth wrote: On 10/03/2022 09.36, Thomas Huth wrote: On 09/03/2022 12.22, Alex Bennée wrote: With -cpu max we get a warning:    qemu-s390x: warning: 'msa5-base' requires 'kimd-sha-512'. But dropping the -cpu max and it still runs fine. Signed-off-by: Alex Bennée Cc:

[PATCH 04/35] coroutine: introduce coroutine_only_fn

2022-03-10 Thread Paolo Bonzini
Some functions only make sense from coroutine context, but never yield. Mark them as "coroutine_only_fn". Signed-off-by: Paolo Bonzini --- include/qemu/coroutine.h | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/include/qemu/coroutine.h b/include/qemu/coroutine.h index

Re: [PATCH v5 14/48] target/nios2: Use hw/registerfields.h for CR_EXCEPTION fields

2022-03-10 Thread Peter Maydell
On Thu, 10 Mar 2022 at 11:27, Richard Henderson wrote: > > Use FIELD_DP32 instead of manual shifting and masking. > > Signed-off-by: Richard Henderson > --- > target/nios2/cpu.h| 4 > target/nios2/helper.c | 37 ++--- > 2 files changed, 26

[PATCH 03/35] coroutine: introduce QemuCoLockable

2022-03-10 Thread Paolo Bonzini
In preparation for splitting "from coroutine" ("awaitable" in other languages) and "not from coroutine" functions, remove the CoMutex case from QemuLockable---thus making qemu_lockable_lock and qemu_lockable_unlock "not awaitable". To satisfy the qemu_co_queue_wait use case, introduce

[PATCH RESEND v1] trace: Split address space and slot id in trace_kvm_set_user_memory()

2022-03-10 Thread Xiaoyao Li
The upper 16 bits of kvm_userspace_memory_region::slot are address space id. Parse it separately in trace_kvm_set_user_memory(). Signed-off-by: Xiaoyao Li --- Resend: - rebase to 2048c4eba2b4 ("Merge remote-tracking branch 'remotes/philmd/tags/pmbus-20220308' into staging") ---

[PATCH v5 46/48] hw/nios2: Introduce Nios2MachineState

2022-03-10 Thread Richard Henderson
We want to move data from the heap into Nios2MachineState, which is not possible with DEFINE_MACHINE. Signed-off-by: Richard Henderson --- hw/nios2/10m50_devboard.c | 24 ++-- 1 file changed, 22 insertions(+), 2 deletions(-) diff --git a/hw/nios2/10m50_devboard.c

Re: [PATCH 04/18] tests: print newline after QMP response in qtest logs

2022-03-10 Thread Daniel P . Berrangé
On Thu, Mar 10, 2022 at 03:50:58PM +0400, Marc-André Lureau wrote: > Hi > > On Thu, Mar 10, 2022 at 3:35 PM Daniel P. Berrangé > wrote: > > > On Thu, Mar 10, 2022 at 03:11:08PM +0400, Marc-André Lureau wrote: > > > Hi > > > > > > On Thu, Mar 10, 2022 at 2:56 PM Daniel P. Berrangé > > > wrote:

[PATCH v5 43/48] target/nios2: Update helper_eret for shadow registers

2022-03-10 Thread Richard Henderson
When CRS = 0, we restore from estatus; otherwise from sstatus. Update for the new CRS. Signed-off-by: Richard Henderson --- target/nios2/cpu.h | 1 + target/nios2/op_helper.c | 3 ++- target/nios2/translate.c | 13 - 3 files changed, 11 insertions(+), 6 deletions(-) diff

Re: [PATCH 04/18] tests: print newline after QMP response in qtest logs

2022-03-10 Thread Marc-André Lureau
Hi On Thu, Mar 10, 2022 at 3:35 PM Daniel P. Berrangé wrote: > > Removing either 'assert' or g_assert would be a massive amount of code > churn, for no real functional benefit. > > Well, a few thousands of lines that are trivially regexp. And we can make use of git blame ignore-rev

[PATCH v5 41/48] target/nios2: Introduce shadow register sets

2022-03-10 Thread Richard Henderson
Do not actually enable them so far, but add all of the plumbing to address them. Do not enable them for user-only. Add an env->regs pointer that handles the indirection to the current register set. The naming of the pointer hides the difference between old and new, user-only and sysemu. >From

[PATCH RESEND v1 2/2] hw/i386: Make pic a property of common x86 base machine type

2022-03-10 Thread Xiaoyao Li
Legacy PIC (8259) cannot be supported for TDX guests since TDX module doesn't allow directly interrupt injection. Using posted interrupts for the PIC is not a viable option as the guest BIOS/kernel will not do EOI for PIC IRQs, i.e. will leave the vIRR bit set. Make PIC the property of common

[PATCH v5 42/48] target/nios2: Implement rdprs, wrprs

2022-03-10 Thread Richard Henderson
Implement these out of line, so that tcg global temps (aka the architectural registers) are synced back to tcg storage as required. This makes sure that we get the proper results when status.PRS == status.CRS. Signed-off-by: Richard Henderson --- target/nios2/cpu.h | 1 +

[PATCH RESEND v1 1/2] hw/i386: Make pit a property of common x86 base machine type

2022-03-10 Thread Xiaoyao Li
Both pc and microvm have pit property individually. Let's just make it the property of common x86 base machine type. Signed-off-by: Xiaoyao Li Reviewed-by: Sergio Lopez --- hw/i386/microvm.c | 27 +-- hw/i386/pc.c | 24 +++-

[PATCH v5 40/48] linux-user/nios2: Handle various SIGILL exceptions

2022-03-10 Thread Richard Henderson
We missed out on a couple of exception types that may legitimately be raised by a userland program. Signed-off-by: Richard Henderson --- linux-user/nios2/cpu_loop.c | 8 1 file changed, 8 insertions(+) diff --git a/linux-user/nios2/cpu_loop.c b/linux-user/nios2/cpu_loop.c index

[PATCH v5 38/48] target/nios2: Use tcg_gen_lookup_and_goto_ptr

2022-03-10 Thread Richard Henderson
Use lookup_and_goto_ptr for indirect chaining between TBs. Signed-off-by: Richard Henderson --- target/nios2/translate.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/target/nios2/translate.c b/target/nios2/translate.c index 6f31b6cc50..f7bab0908b 100644 ---

[PATCH v5 36/48] target/nios2: Hoist set of is_jmp into gen_goto_tb

2022-03-10 Thread Richard Henderson
Rather than force all callers to set this, do it within the subroutine. Signed-off-by: Richard Henderson --- target/nios2/translate.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/target/nios2/translate.c b/target/nios2/translate.c index f61ba92052..51907586ab 100644

[PATCH v5 39/48] target/nios2: Implement Misaligned destination exception

2022-03-10 Thread Richard Henderson
Indirect branches, plus eret and bret optionally raise an exception when branching to a misaligned address. The exception is required when an mmu is enabled, but enable it always because the fallback behaviour is not documented (though presumably it discards low bits). For the purposes of the

[PATCH v5 29/48] target/nios2: Remove CPU_INTERRUPT_NMI

2022-03-10 Thread Richard Henderson
This interrupt bit is never set, so testing it in nios2_cpu_has_work is pointless. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/nios2/cpu.h | 2 -- target/nios2/cpu.c | 2 +- 2 files changed, 1 insertion(+), 3 deletions(-) diff --git a/target/nios2/cpu.h

Re: [PULL v2 00/22] QEMU changes for 7.0 soft freeze

2022-03-10 Thread Peter Maydell
On Tue, 8 Mar 2022 at 11:38, Paolo Bonzini wrote: > > The following changes since commit 99c53410bc9d50e556f565b0960673cccb566452: > > Merge remote-tracking branch > 'remotes/thuth-gitlab/tags/pull-request-2022-02-28' into staging (2022-03-01 > 13:25:54 +) > > are available in the Git

Re: [PATCH v5 06/48] target/nios2: Fix BRET instruction

2022-03-10 Thread Peter Maydell
On Thu, 10 Mar 2022 at 11:27, Richard Henderson wrote: > > We had failed to copy BSTATUS back to STATUS, and diagnose > supervisor-only. The spec is light on the specifics of the > implementation of bret, but it is an easy assumption that > the restore into STATUS should work the same as eret. >

[PATCH v5 35/48] target/nios2: Create gen_jumpr

2022-03-10 Thread Richard Henderson
Split out a function to perform an indirect branch. Signed-off-by: Richard Henderson --- target/nios2/translate.c | 27 +-- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/target/nios2/translate.c b/target/nios2/translate.c index d5f2e98de9..f61ba92052

[PATCH v5 25/48] target/nios2: Clean up handling of tlbmisc in do_exception

2022-03-10 Thread Richard Henderson
The 4 lower bits, D, PERM, BAD, DBL, are unconditionally set on any exception with EH=0, or so says Table 42 (Processor Status After Taking Exception). We currently do not set PERM or BAD at all, and only set/clear DBL for tlb miss, and do not clear DBL for any other exception. It is a bit

Re: [PATCH 04/18] tests: print newline after QMP response in qtest logs

2022-03-10 Thread Thomas Huth
On 10/03/2022 12.35, Daniel P. Berrangé wrote: On Thu, Mar 10, 2022 at 03:11:08PM +0400, Marc-André Lureau wrote: Hi On Thu, Mar 10, 2022 at 2:56 PM Daniel P. Berrangé wrote: On Mon, Mar 07, 2022 at 11:09:37AM +0100, Thomas Huth wrote: On 07/03/2022 11.06, Daniel P. Berrangé wrote: On

Re: [RFC PATCH] tests/tcg: drop -cpu max from s390x sha512-mvx invocation

2022-03-10 Thread Alex Bennée
Thomas Huth writes: > On 10/03/2022 11.34, Alex Bennée wrote: >> Thomas Huth writes: >> >>> On 09/03/2022 12.22, Alex Bennée wrote: With -cpu max we get a warning: qemu-s390x: warning: 'msa5-base' requires 'kimd-sha-512'. But dropping the -cpu max and it still runs fine.

[PATCH v5 24/48] target/nios2: Cleanup set of CR_EXCEPTION for do_interrupt

2022-03-10 Thread Richard Henderson
The register is entirely read-only for software, and we do not implement ECC, so we need not deposit the cause into an existing value; just create a new value from scratch. Furthermore, exception.CAUSE is not written for break exceptions. Signed-off-by: Richard Henderson ---

[PATCH v5 30/48] target/nios2: Support division error exception

2022-03-10 Thread Richard Henderson
Division may (optionally) raise a division exception. Since the linux kernel has been prepared for this for some time, enable it by default. Signed-off-by: Richard Henderson --- target/nios2/cpu.h | 2 ++ target/nios2/helper.h | 2 ++ linux-user/nios2/cpu_loop.c | 4 +++

[PATCH v5 28/48] target/nios2: Implement CR_STATUS.RSIE

2022-03-10 Thread Richard Henderson
Without EIC, this bit is RES1. So set the bit at reset, and add it to the readonly fields of CR_STATUS. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/nios2/cpu.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/target/nios2/cpu.c

[PATCH v5 48/48] hw/nios2: Machine with a Vectored Interrupt Controller

2022-03-10 Thread Richard Henderson
From: Amir Gonnen Demonstrate how to use nios2 VIC on a machine. Introduce a new machine property to attach a VIC. When VIC is present, let the CPU know that it should use the External Interrupt Interface instead of the Internal Interrupt Interface. The devices on the machine are attached to

[PATCH v5 23/48] target/nios2: Handle EXCP_UNALIGN and EXCP_UALIGND

2022-03-10 Thread Richard Henderson
These misaligned data and misaligned destination exceptions are defined, but not currently raised. Signed-off-by: Richard Henderson --- target/nios2/helper.c | 8 1 file changed, 8 insertions(+) diff --git a/target/nios2/helper.c b/target/nios2/helper.c index 285f3aae1d..0392c0ea84

[PATCH v5 18/48] target/nios2: Use hw/registerfields.h for CR_TLBMISC fields

2022-03-10 Thread Richard Henderson
Use FIELD_EX32 and FIELD_DP32 instead of managing the masking by hand. Signed-off-by: Richard Henderson --- target/nios2/cpu.h | 29 +++-- target/nios2/helper.c| 7 ++- target/nios2/mmu.c | 35 +--

[PATCH v5 26/48] target/nios2: Prevent writes to read-only or reserved control fields

2022-03-10 Thread Richard Henderson
Create an array of masks which detail the writable and readonly bits for each control register. Apply them when writing to control registers, including the write to status during eret. Signed-off-by: Richard Henderson --- target/nios2/cpu.h | 13 ++ target/nios2/cpu.c | 94

[PATCH v5 37/48] target/nios2: Use gen_goto_tb for DISAS_TOO_MANY

2022-03-10 Thread Richard Henderson
Depending on the reason for ending the TB, we can chain to the next TB because the PC is constant. Signed-off-by: Richard Henderson --- target/nios2/translate.c | 5 - 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/target/nios2/translate.c b/target/nios2/translate.c index

[PATCH v5 34/48] target/nios2: Enable unaligned traps for system mode

2022-03-10 Thread Richard Henderson
Unaligned traps are optional, but required with an mmu. Turn them on always, because the fallback behaviour is not documented (though presumably it discards low bits). Enable alignment checks in the config file. Unwind the guest pc properly from do_unaligned_access. Signed-off-by: Richard

[PATCH v5 10/48] target/nios2: Split control registers away from general registers

2022-03-10 Thread Richard Henderson
Place the control registers into their own array, env->ctrl[]. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/nios2/cpu.h | 43 target/nios2/cpu.c | 19 +++ target/nios2/helper.c| 106 +++

[PATCH v5 27/48] target/nios2: Implement cpuid

2022-03-10 Thread Richard Henderson
Copy the existing cpu_index into the space reserved for CR_CPUID. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/nios2/cpu.c | 4 1 file changed, 4 insertions(+) diff --git a/target/nios2/cpu.c b/target/nios2/cpu.c index ce2b0c6493..d491360973 100644 ---

[PATCH v5 09/48] target/nios2: Remove cpu_interrupts_enabled

2022-03-10 Thread Richard Henderson
This function is unused. The real computation of this value is located in nios2_cpu_exec_interrupt. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/nios2/cpu.h | 5 - 1 file changed, 5 deletions(-) diff --git a/target/nios2/cpu.h b/target/nios2/cpu.h index

[PATCH v5 22/48] target/nios2: Hoist CPU_LOG_INT logging

2022-03-10 Thread Richard Henderson
Performing this early means that we can merge more cases within the non-logging switch statement. Signed-off-by: Richard Henderson --- target/nios2/helper.c | 58 +++ 1 file changed, 47 insertions(+), 11 deletions(-) diff --git a/target/nios2/helper.c

[PATCH v5 32/48] target/nios2: Introduce dest_gpr

2022-03-10 Thread Richard Henderson
Constrain all references to cpu_R[] to load_gpr and dest_gpr. This will be required for supporting shadow register sets. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/nios2/translate.c | 153 ++- 1 file changed, 55 insertions(+), 98

[PATCH v5 04/48] target/nios2: Split PC out of env->regs[]

2022-03-10 Thread Richard Henderson
It is cleaner to have a separate name for this variable. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/nios2/cpu.h | 10 +++- linux-user/elfload.c| 2 +- linux-user/nios2/cpu_loop.c | 17 ++--- linux-user/nios2/signal.c | 6 ++---

[PATCH v5 21/48] target/nios2: Clean up nios2_cpu_do_interrupt

2022-03-10 Thread Richard Henderson
Split out do_exception and do_iic_irq to handle bulk of the interrupt and exception processing. Parameterize the changes required to cpu state. The status.EH bit, which protects some data against double-faults, is only present with the MMU. Several exception cases did not check for status.EH

[PATCH v5 20/48] target/nios2: Create EXCP_SEMIHOST for semi-hosting

2022-03-10 Thread Richard Henderson
Decode 'break 1' during translation, rather than doing it again during exception processing. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/nios2/cpu.h | 1 + target/nios2/helper.c| 14 ++ target/nios2/translate.c | 17 - 3 files

Re: [PATCH 04/18] tests: print newline after QMP response in qtest logs

2022-03-10 Thread Daniel P . Berrangé
On Thu, Mar 10, 2022 at 03:11:08PM +0400, Marc-André Lureau wrote: > Hi > > On Thu, Mar 10, 2022 at 2:56 PM Daniel P. Berrangé > wrote: > > > On Mon, Mar 07, 2022 at 11:09:37AM +0100, Thomas Huth wrote: > > > On 07/03/2022 11.06, Daniel P. Berrangé wrote: > > > > On Mon, Mar 07, 2022 at

[PATCH v5 17/48] target/nios2: Rename CR_TLBMISC_WR to CR_TLBMISC_WE

2022-03-10 Thread Richard Henderson
WE is the architectural name of the field, not WR. Signed-off-by: Richard Henderson --- target/nios2/cpu.h| 2 +- target/nios2/helper.c | 4 ++-- target/nios2/mmu.c| 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/target/nios2/cpu.h b/target/nios2/cpu.h index

[PATCH v5 19/48] target/nios2: Move R_FOO and CR_BAR into enumerations

2022-03-10 Thread Richard Henderson
These symbols become available to the debugger. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/nios2/cpu.h | 72 ++ 1 file changed, 35 insertions(+), 37 deletions(-) diff --git a/target/nios2/cpu.h b/target/nios2/cpu.h index

[PATCH v5 02/48] target/nios2: Stop generating code if gen_check_supervisor fails

2022-03-10 Thread Richard Henderson
Whether the cpu is in user-mode or not is something that we know at translation-time. We do not need to generate code after having raised an exception. Suggested-by: Peter Maydell Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/nios2/translate.c | 20

[PATCH v5 47/48] hw/nios2: Move memory regions into Nios2Machine

2022-03-10 Thread Richard Henderson
Convert to contiguous allocation, as much as possible so far. The two timer objects are not exposed for subobject allocation. Reviewed-by: Mark Cave-Ayland Signed-off-by: Richard Henderson --- hw/nios2/10m50_devboard.c | 30 -- 1 file changed, 16 insertions(+), 14

[PATCH v5 15/48] target/nios2: Use hw/registerfields.h for CR_TLBADDR fields

2022-03-10 Thread Richard Henderson
Use FIELD_EX32 and FIELD_DP32 instead of manual manipulation of the fields. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/nios2/cpu.h | 8 target/nios2/helper.c| 4 ++-- target/nios2/mmu.c | 17 + target/nios2/translate.c | 2

[PATCH v5 16/48] target/nios2: Use hw/registerfields.h for CR_TLBACC fields

2022-03-10 Thread Richard Henderson
Retain the helper macros for single bit fields as aliases to the longer R_*_MASK names. Use FIELD_EX32 and FIELD_DP32 instead of manually manipulating the fields. Since we're rewriting the references to CR_TLBACC_IGN_* anyway, we correct the name of this field to IG, which is its name in the

[PATCH v5 45/48] hw/intc: Vectored Interrupt Controller (VIC)

2022-03-10 Thread Richard Henderson
From: Amir Gonnen Implement nios2 Vectored Interrupt Controller (VIC). VIC is connected to EIC. It needs to update rha, ril, rrs and rnmi fields on Nios2CPU before raising an IRQ. For that purpose, VIC has a "cpu" property which should refer to the nios2 cpu and set by the board that connects

[PATCH v5 00/48] target/nios2: Shadow register set, EIC and VIC

2022-03-10 Thread Richard Henderson
This has grown quite beyond merely implementing $SUBJECT, which are only the last 8 patches of the set. Version 5 addresses all of the feedback from v4, fixes some further bugs in the base exception handling, implements some missing exceptions. r~ Amir Gonnen (5): target/nios2: Check

[PATCH v5 13/48] target/nios2: Use hw/registerfields.h for CR_STATUS fields

2022-03-10 Thread Richard Henderson
Add all fields; retain the helper macros for single bit fields. So far there are no uses of the multi-bit status fields. Signed-off-by: Richard Henderson --- target/nios2/cpu.h | 28 +++- 1 file changed, 19 insertions(+), 9 deletions(-) diff --git a/target/nios2/cpu.h

[PATCH v5 14/48] target/nios2: Use hw/registerfields.h for CR_EXCEPTION fields

2022-03-10 Thread Richard Henderson
Use FIELD_DP32 instead of manual shifting and masking. Signed-off-by: Richard Henderson --- target/nios2/cpu.h| 4 target/nios2/helper.c | 37 ++--- 2 files changed, 26 insertions(+), 15 deletions(-) diff --git a/target/nios2/cpu.h b/target/nios2/cpu.h

Re: [PULL 0/9] I²C / SMBus / PMBus patches for 2022-03-08

2022-03-10 Thread Philippe Mathieu-Daudé
On 10/3/22 10:18, Peter Maydell wrote: On Tue, 8 Mar 2022 at 18:22, Philippe Mathieu-Daudé wrote: From: Philippe Mathieu-Daudé The following changes since commit 9740b907a5363c06ecf61e08b21966a81eb0dab4: Merge remote-tracking branch 'remotes/pmaydell/tags/pull-target-arm-20220307' into

[PATCH v5 44/48] target/nios2: Implement EIC interrupt processing

2022-03-10 Thread Richard Henderson
This is the cpu side of the operation. Register one irq line, called EIC. Split out the rather different processing to a separate function. Delay initialization of gpio irqs until realize. We need to provide a window after init in which the board can set eic_present. Signed-off-by: Richard

[PATCH v5 12/48] target/nios2: Clean up nios2_cpu_dump_state

2022-03-10 Thread Richard Henderson
Do not print control registers for user-only mode. Rename reserved control registers to "resN", where N is the control register index. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/nios2/translate.c | 19 +-- 1 file changed, 9 insertions(+), 10

[PATCH 4/5] s390x: Add KVM PV dump interface

2022-03-10 Thread Janosch Frank
Let's add a few bits of code which hide the new KVM PV dump API from us via new functions. Signed-off-by: Janosch Frank --- hw/s390x/pv.c | 52 +++ include/hw/s390x/pv.h | 8 +++ 2 files changed, 60 insertions(+) diff --git a/hw/s390x/pv.c

[PATCH v5 03/48] target/nios2: Add NUM_GP_REGS and NUM_CP_REGS

2022-03-10 Thread Richard Henderson
From: Amir Gonnen Split NUM_CORE_REGS into components that can be used elsewhere. Reviewed-by: Peter Maydell Signed-off-by: Amir Gonnen Message-Id: <20220303153906.2024748-3-amir.gon...@neuroblade.ai> [rth: Split out of a larger patch for shadow register sets.] Signed-off-by: Richard

[PATCH v5 33/48] target/nios2: Drop CR_STATUS_EH from tb->flags

2022-03-10 Thread Richard Henderson
There's nothing about EH that affects translation, so there's no need to include it in tb->flags. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/nios2/cpu.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/nios2/cpu.h b/target/nios2/cpu.h index

[PATCH v5 01/48] target/nios2: Check supervisor on eret

2022-03-10 Thread Richard Henderson
From: Amir Gonnen eret instruction is only allowed in supervisor mode. Reviewed-by: Peter Maydell Reviewed-by: Richard Henderson Signed-off-by: Amir Gonnen Message-Id: <20220303153906.2024748-2-amir.gon...@neuroblade.ai> Signed-off-by: Richard Henderson --- target/nios2/translate.c | 2 ++

[PATCH v5 11/48] target/nios2: Do not zero the general registers on reset

2022-03-10 Thread Richard Henderson
The bulk of the general register set is undefined on reset. The zero register is for the most part special-cased in translate, but the slot is still exposed to gdbstub and nios2_cpu_dump_state, so continue to make sure that's zeroed. Signed-off-by: Richard Henderson --- target/nios2/cpu.c | 6

[PATCH 3/5] s390x: Introduce PV query interface

2022-03-10 Thread Janosch Frank
Introduce an interface over which we can get information about UV data. Signed-off-by: Janosch Frank --- hw/s390x/pv.c | 61 ++ hw/s390x/s390-virtio-ccw.c | 5 include/hw/s390x/pv.h | 10 +++ 3 files changed, 76 insertions(+) diff

[PATCH v5 31/48] target/nios2: Use tcg_constant_tl

2022-03-10 Thread Richard Henderson
Replace current uses of tcg_const_tl, and remove the frees. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/nios2/translate.c | 30 ++ 1 file changed, 6 insertions(+), 24 deletions(-) diff --git a/target/nios2/translate.c

[PATCH v5 08/48] linux-user/nios2: Only initialize SP and PC in target_cpu_copy_regs

2022-03-10 Thread Richard Henderson
Drop the set of estatus in init_thread; it was clearly intended to be setting the value of CR_STATUS for the application, but we never actually performed that copy. However, the proper value is set in nios2_cpu_reset so we don't need to do anything here. We only initialize SP and EA in

[PATCH 5/5] s390x: pv: Add dump support

2022-03-10 Thread Janosch Frank
Sometimes dumping a guest from the outside is the only way to get the data that is needed. This can be the case if a dumping mechanism like KDUMP hasn't been configured or data needs to be fetched at a specific point. Dumping a protected guest from the outside without help from fw/hw doesn't yield

[PATCH 1/5] linux header sync

2022-03-10 Thread Janosch Frank
Signed-off-by: Janosch Frank --- linux-headers/linux/kvm.h | 55 +++ 1 file changed, 55 insertions(+) diff --git a/linux-headers/linux/kvm.h b/linux-headers/linux/kvm.h index 00af3bc333..ead1d51cb5 100644 --- a/linux-headers/linux/kvm.h +++

[PATCH v5 07/48] target/nios2: Do not create TCGv for control registers

2022-03-10 Thread Richard Henderson
We don't need to reference them often, and when we do it is just as easy to load/store from cpu_env directly. Reviewed-by: Peter Maydell Signed-off-by: Richard Henderson --- target/nios2/translate.c | 33 ++--- 1 file changed, 26 insertions(+), 7 deletions(-) diff

[PATCH 2/5] s390x: Add protected dump cap

2022-03-10 Thread Janosch Frank
Signed-off-by: Janosch Frank --- target/s390x/kvm/kvm.c | 7 +++ target/s390x/kvm/kvm_s390x.h | 1 + 2 files changed, 8 insertions(+) diff --git a/target/s390x/kvm/kvm.c b/target/s390x/kvm/kvm.c index 6acf14d5ec..56ca5408db 100644 --- a/target/s390x/kvm/kvm.c +++

[PATCH v5 06/48] target/nios2: Fix BRET instruction

2022-03-10 Thread Richard Henderson
We had failed to copy BSTATUS back to STATUS, and diagnose supervisor-only. The spec is light on the specifics of the implementation of bret, but it is an easy assumption that the restore into STATUS should work the same as eret. Therefore, reuse the existing helper_eret. Reported-by: Peter

[PATCH 4/5] dump/dump: Add section string table support

2022-03-10 Thread Janosch Frank
Time to add a bit more descriptiveness to the dumps. Signed-off-by: Janosch Frank --- dump/dump.c | 106 -- include/sysemu/dump.h | 1 + 2 files changed, 94 insertions(+), 13 deletions(-) diff --git a/dump/dump.c b/dump/dump.c index

[PATCH v5 05/48] target/nios2: Split out helper for eret instruction

2022-03-10 Thread Richard Henderson
From: Amir Gonnen The implementation of eret will become much more complex with the introduction of shadow registers. Reviewed-by: Peter Maydell Signed-off-by: Amir Gonnen Message-Id: <20220303153906.2024748-3-amir.gon...@neuroblade.ai> [rth: Split out of a larger patch for shadow register

Re: propagating vmgenid outward and upward

2022-03-10 Thread Alexander Graf
On 09.03.22 23:02, Jason A. Donenfeld wrote: Hi Alex, On Wed, Mar 9, 2022 at 3:10 AM Alexander Graf wrote: The vmgenid driver basically works, though it is racy, because that ACPI notification can arrive after the system is already running again. This I believe enough people already

[PATCH 0/5] s390x: dump: Add PV dump support

2022-03-10 Thread Janosch Frank
This is the qemu part of the PV dump support where we take the data that the KVM PV dump API gives us and put it into the ELF file for later processing. The encrypted PV cpu state is added as an additional note like the other architecture registers. The storage state and completion data however

[PATCH 5/5] dump/dump: Add arch section support

2022-03-10 Thread Janosch Frank
Add hooks which architectures can use to add arbitrary data to custom sections. Signed-off-by: Janosch Frank --- dump/dump.c| 21 ++--- include/sysemu/dump-arch.h | 27 +++ 2 files changed, 45 insertions(+), 3 deletions(-) diff --git

Re: [PATCH-for-7.0] aspeed: sbc: Correct default reset values

2022-03-10 Thread Philippe Mathieu-Daudé
On 10/3/22 06:21, Joel Stanley wrote: In order to correctly report secure boot running firmware, these values must be set. They are taken from a running machine when secure boot is enabled. We don't yet have documentation from ASPEED on what they mean. Set the raw values for now, and in the

[PATCH 0/5] dump: Add custom arch section support

2022-03-10 Thread Janosch Frank
Architectures already provide custom cpu data via elf notes but there's currently no way for an architecture to add other custom data to dumps. s390x for instance needs to store special data in the dump when dumping protected guests so the vm owner can decrypt the dump and access the vm data.

[PATCH v2 1/9] dump: Use ERRP_GUARD()

2022-03-10 Thread Janosch Frank
Let's move to the new way of handling errors before changing the dump code. This patch has mostly been generated by the coccinelle script scripts/coccinelle/errp-guard.cocci. Signed-off-by: Janosch Frank --- dump/dump.c | 144 ++-- 1 file changed,

[PATCH 1/5] dump: Allocate header

2022-03-10 Thread Janosch Frank
Allocating the header lets us write it at a later time and hence also allows us to change section and segment table offsets until we finally write it. Signed-off-by: Janosch Frank --- dump/dump.c | 115 ++ include/sysemu/dump.h | 1 + 2 files

[PATCH v2 3/9] dump: Introduce shdr_num to decrease complexity

2022-03-10 Thread Janosch Frank
Let's move from a boolean to a int variable which will later enable us to store the number of sections that are in the dump file. Signed-off-by: Janosch Frank --- dump/dump.c | 24 include/sysemu/dump.h | 2 +- 2 files changed, 13 insertions(+), 13

[PATCH 2/5] dump: Split write of section headers and data and add a prepare step

2022-03-10 Thread Janosch Frank
By splitting the writing of the section headers and (future) section data we prepare for the addition of a string table section and architecture sections. Signed-off-by: Janosch Frank --- dump/dump.c | 112 -- include/sysemu/dump.h | 4 ++ 2

Re: [PATCH 04/18] tests: print newline after QMP response in qtest logs

2022-03-10 Thread Marc-André Lureau
Hi On Thu, Mar 10, 2022 at 2:56 PM Daniel P. Berrangé wrote: > On Mon, Mar 07, 2022 at 11:09:37AM +0100, Thomas Huth wrote: > > On 07/03/2022 11.06, Daniel P. Berrangé wrote: > > > On Mon, Mar 07, 2022 at 02:51:23PM +0800, Peter Xu wrote: > > > > On Wed, Mar 02, 2022 at 05:49:18PM +, Daniel

[PATCH 3/5] dump: Reorder struct DumpState

2022-03-10 Thread Janosch Frank
Let's move ELF related members into one block and guest memory related ones into another to improve readability. Signed-off-by: Janosch Frank --- include/sysemu/dump.h | 18 +++--- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/include/sysemu/dump.h

[PATCH v2 7/9] dump: Consolidate phdr note writes

2022-03-10 Thread Janosch Frank
There's no need to have two write functions. Let's rather have two functions that set the data for elf 32/64 and then write it in a common function. Signed-off-by: Janosch Frank --- dump/dump.c | 94 +++-- 1 file changed, 48 insertions(+), 46

<    1   2   3   4   >