[PATCH-for-9.1 7/7] hw: Include minimal source set in user emulation build

2024-04-04 Thread Philippe Mathieu-Daudé
Only the files in hwcore_ss[] are required to link a user emulation binary. Have meson process the hw/ sub-directories if system emulation is selected, otherwise directly process hw/core/ to get hwcore_ss[], which is the only set required by user emulation. Signed-off-by: Philippe Mathieu-Daudé

[PATCH-for-9.1 4/7] util/qemu-config: Extract QMP commands to qemu-config-qmp.c

2024-04-04 Thread Philippe Mathieu-Daudé
QMP is irrelevant for user emulation. Extract the code related to QMP in a different source file, which won't be build for user emulation binaries. This avoid pulling pointless code. Signed-off-by: Philippe Mathieu-Daudé --- include/qemu/config-file.h | 3 + util/qemu-config-qmp.c | 206 ++

[PATCH-for-9.1 6/7] hw/core: Move reset.c to hwcore_ss[] source set

2024-04-04 Thread Philippe Mathieu-Daudé
reset.c contains core code used by any CPU, required by user emulation. Move it to hwcore_ss[] where it belongs. Signed-off-by: Philippe Mathieu-Daudé --- hw/core/meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/core/meson.build b/hw/core/meson.build index e26f2

[PATCH-for-9.1 5/7] hw/core: Restrict reset handlers API to system emulation

2024-04-04 Thread Philippe Mathieu-Daudé
Headers in include/sysemu/ are specific to system emulation and should not be used in user emulation. Signed-off-by: Philippe Mathieu-Daudé --- hw/core/reset.c | 4 1 file changed, 4 insertions(+) diff --git a/hw/core/reset.c b/hw/core/reset.c index d50da7e304..167c8bf1a9 100644 --- a/hw/c

[PATCH-for-9.1 1/7] ebpf: Restrict to system emulation

2024-04-04 Thread Philippe Mathieu-Daudé
eBPF is not used in user emulation. Signed-off-by: Philippe Mathieu-Daudé --- ebpf/meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/ebpf/meson.build b/ebpf/meson.build index c5bf9295a2..bff6156f51 100644 --- a/ebpf/meson.build +++ b/ebpf/meson.build @@ -1 +1 @@ -co

[PATCH-for-9.1 2/7] yank: Restrict to system emulation

2024-04-04 Thread Philippe Mathieu-Daudé
The yank feature is not used in user emulation. Signed-off-by: Philippe Mathieu-Daudé --- util/meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/util/meson.build b/util/meson.build index 0ef9886be0..247f55a80d 100644 --- a/util/meson.build +++ b/util/meson.build @@

[RFC PATCH-for-9.1] qapi: Do not generate commands/events/introspect code for user emulation

2024-04-04 Thread Philippe Mathieu-Daudé
User emulation requires the QAPI types. Due to the command line processing, some visitor code is also used. The rest is irrelevant (no QMP socket). Add an option to the qapi-gen script to allow generating the minimum when only user emulation is being built. Signed-off-by: Philippe Mathieu-Daudé

Re: [PATCH v1] migration/postcopy: ensure preempt channel is ready before loading states

2024-04-04 Thread Peter Xu
On Fri, Apr 05, 2024 at 12:48:15AM +0800, Wang, Lei wrote: > On 4/5/2024 0:25, Wang, Wei W wrote:> On Thursday, April 4, 2024 10:12 PM, > Peter > Xu wrote: > >> On Thu, Apr 04, 2024 at 06:05:50PM +0800, Wei Wang wrote: > >>> Before loading the guest states, ensure that the preempt channel has > >>

[PATCH for-9.0] tcg/optimize: Do not attempt to constant fold neg_vec

2024-04-04 Thread Richard Henderson
Split out the tail of fold_neg to fold_neg_no_const so that we can avoid attempting to constant fold vector negate. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2150 Signed-off-by: Richard Henderson --- tcg/optimize.c| 17 - tests/tcg/aarch64/test-2

Re: [External] Re: [PATCH v10 2/2] memory tier: create CPUless memory tiers after obtaining HMAT info

2024-04-04 Thread Ho-Ren (Jack) Chuang
Hi Jonathan, Thank you! I will fix them and send a V11 soon. On Thu, Apr 4, 2024 at 6:37 AM Jonathan Cameron wrote: > > > > > > > @@ -858,7 +910,8 @@ static int __init memory_tier_init(void) > > > >* For now we can have 4 faster memory tiers with smaller > > > > adistance > > > >

Re: [PATCH-for-9.1 1/7] ebpf: Restrict to system emulation

2024-04-04 Thread Richard Henderson
On 4/4/24 09:47, Philippe Mathieu-Daudé wrote: eBPF is not used in user emulation. Signed-off-by: Philippe Mathieu-Daudé --- ebpf/meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Reviewed-by: Richard Henderson r~

Re: [PATCH-for-9.1 2/7] yank: Restrict to system emulation

2024-04-04 Thread Richard Henderson
On 4/4/24 09:47, Philippe Mathieu-Daudé wrote: The yank feature is not used in user emulation. Signed-off-by: Philippe Mathieu-Daudé --- util/meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Reviewed-by: Richard Henderson r~

Re: [PATCH v2] sh4: mac.l: implement saturation arithmetic logic

2024-04-04 Thread Zack Buhman
Signed-off-by: Zack Buhman - Original message - From: "Philippe Mathieu-Daudé" To: Peter Maydell , Zack Buhman Cc: qemu-devel@nongnu.org, Yoshinori Sato Subject: Re: [PATCH v2] sh4: mac.l: implement saturation arithmetic logic Date: Friday, April 05, 2024 1:26 AM Hi Zack, Cc'ing the

[PATCH v2 06/21] plugins: Create TCGHelperInfo for all out-of-line callbacks

2024-04-04 Thread Richard Henderson
TCGHelperInfo includes the ABI for every function call. Reviewed-by: Pierrick Bouvier Signed-off-by: Richard Henderson --- include/qemu/plugin.h | 1 + plugins/core.c| 51 ++- 2 files changed, 46 insertions(+), 6 deletions(-) diff --git a/includ

[PATCH v2 02/21] tcg: Make tcg/helper-info.h self-contained

2024-04-04 Thread Richard Henderson
Move MAX_CALL_IARGS from tcg.h and include for the define of TCG_TARGET_REG_BITS. Reviewed-by: Alex Bennée Signed-off-by: Richard Henderson --- include/tcg/helper-info.h | 3 +++ include/tcg/tcg.h | 2 -- tcg/tci.c | 1 + 3 files changed, 4 insertions(+), 2 deletions(-)

[PATCH v2 05/21] plugins: Move function pointer in qemu_plugin_dyn_cb

2024-04-04 Thread Richard Henderson
The out-of-line function pointer is mutually exclusive with inline expansion, so move it into the union. Wrap the pointer in a structure named 'regular' to match PLUGIN_CB_REGULAR. Reviewed-by: Alex Bennée Signed-off-by: Richard Henderson --- include/qemu/plugin.h | 4 +++- accel/tcg/plugin-ge

[PATCH v2 01/21] tcg: Add TCGContext.emit_before_op

2024-04-04 Thread Richard Henderson
Allow operations to be emitted via normal expanders into the middle of the opcode stream. Reviewed-by: Pierrick Bouvier Signed-off-by: Richard Henderson --- include/tcg/tcg.h | 6 ++ tcg/tcg.c | 14 -- 2 files changed, 18 insertions(+), 2 deletions(-) diff --git a/incl

[PATCH v2 00/21] Rewrite plugin code generation

2024-04-04 Thread Richard Henderson
Add a (trivial) mechanism for emitting code into the middle of the opcode sequence: tcg_ctx->emit_before_op. Rip out all of the "empty" generation and "copy" to modify those sequences. Replace with regular code generation once we know what values to place. Changes for v2: * Fix TCI build failu

[PATCH v2 07/21] plugins: Use emit_before_op for PLUGIN_GEN_AFTER_INSN

2024-04-04 Thread Richard Henderson
Introduce a new plugin_cb op and migrate one operation. By using emit_before_op, we do not need to emit opcodes early and modify them later -- we can simply emit the final set of opcodes once. Signed-off-by: Richard Henderson --- include/tcg/tcg-op-common.h | 1 + include/tcg/tcg-opc.h |

[PATCH v2 08/21] plugins: Use emit_before_op for PLUGIN_GEN_FROM_TB

2024-04-04 Thread Richard Henderson
By having the qemu_plugin_cb_flags be recorded in the TCGHelperInfo, we no longer need to distinguish PLUGIN_CB_REGULAR from PLUGIN_CB_REGULAR_R, so place all TB callbacks in the same queue. Signed-off-by: Richard Henderson --- accel/tcg/plugin-gen.c | 96 +---

[PATCH v2 09/21] plugins: Add PLUGIN_GEN_AFTER_TB

2024-04-04 Thread Richard Henderson
Delay test of plugin_tb->mem_helper until the inject pass. Reviewed-by: Pierrick Bouvier Signed-off-by: Richard Henderson --- accel/tcg/plugin-gen.c | 37 - 1 file changed, 16 insertions(+), 21 deletions(-) diff --git a/accel/tcg/plugin-gen.c b/accel/tcg/plu

[PATCH v2 18/21] plugins: Split out common cb expanders

2024-04-04 Thread Richard Henderson
Reviewed-by: Pierrick Bouvier Signed-off-by: Richard Henderson --- accel/tcg/plugin-gen.c | 84 +- 1 file changed, 41 insertions(+), 43 deletions(-) diff --git a/accel/tcg/plugin-gen.c b/accel/tcg/plugin-gen.c index 49d9b07438..5b63b93114 100644 --- a/acc

[PATCH v2 14/21] tcg: Remove INDEX_op_plugin_cb_{start,end}

2024-04-04 Thread Richard Henderson
These opcodes are no longer used. Reviewed-by: Pierrick Bouvier Signed-off-by: Richard Henderson --- include/tcg/tcg-op-common.h | 2 -- include/tcg/tcg-opc.h | 2 -- accel/tcg/plugin-gen.c | 18 -- tcg/tcg-op.c| 10 -- 4 files changed, 32 de

[PATCH v2 11/21] plugins: Use emit_before_op for PLUGIN_GEN_FROM_MEM

2024-04-04 Thread Richard Henderson
Introduce a new plugin_mem_cb op to hold the address temp and meminfo computed by tcg-op-ldst.c. Because this now has its own opcode, we no longer need PLUGIN_GEN_FROM_MEM. Reviewed-by: Pierrick Bouvier Signed-off-by: Richard Henderson --- include/exec/plugin-gen.h | 4 - include/tcg/tcg-o

[PATCH v2 19/21] plugins: Merge qemu_plugin_tb_insn_get to plugin-gen.c

2024-04-04 Thread Richard Henderson
Merge qemu_plugin_insn_alloc and qemu_plugin_tb_insn_get into plugin_gen_insn_start, since it is used nowhere else. Reviewed-by: Pierrick Bouvier Signed-off-by: Richard Henderson --- include/qemu/plugin.h | 39 --- accel/tcg/plugin-gen.c | 39 +++

[PATCH v2 21/21] plugins: Update the documentation block for plugin-gen.c

2024-04-04 Thread Richard Henderson
Reviewed-by: Pierrick Bouvier Signed-off-by: Richard Henderson --- accel/tcg/plugin-gen.c | 31 --- 1 file changed, 4 insertions(+), 27 deletions(-) diff --git a/accel/tcg/plugin-gen.c b/accel/tcg/plugin-gen.c index d914d64de0..3db74ae9bf 100644 --- a/accel/tcg/plugi

[PATCH v2 10/21] plugins: Use emit_before_op for PLUGIN_GEN_FROM_INSN

2024-04-04 Thread Richard Henderson
Reviewed-by: Pierrick Bouvier Signed-off-by: Richard Henderson --- include/qemu/plugin.h | 1 - accel/tcg/plugin-gen.c | 286 ++--- plugins/api.c | 8 +- 3 files changed, 67 insertions(+), 228 deletions(-) diff --git a/include/qemu/plugin.h b/in

[PATCH v2 12/21] plugins: Remove plugin helpers

2024-04-04 Thread Richard Henderson
These placeholder helpers are no longer required. Reviewed-by: Alex Bennée Signed-off-by: Richard Henderson --- accel/tcg/plugin-helpers.h | 5 - include/exec/helper-gen-common.h | 4 include/exec/helper-proto-common.h | 4 accel/tcg/plugin-gen.c | 20

[PATCH v2 03/21] tcg: Pass function pointer to tcg_gen_call*

2024-04-04 Thread Richard Henderson
For normal helpers, read the function pointer from the structure earlier. For plugins, this will allow the function pointer to come from elsewhere. Reviewed-by: Alex Bennée Signed-off-by: Richard Henderson --- include/tcg/tcg.h | 21 +--- include/exec/helper-gen.h.inc |

[PATCH v2 04/21] plugins: Zero new qemu_plugin_dyn_cb entries

2024-04-04 Thread Richard Henderson
Reviewed-by: Alex Bennée Signed-off-by: Richard Henderson --- plugins/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/core.c b/plugins/core.c index 11ca20e626..4487cb7c48 100644 --- a/plugins/core.c +++ b/plugins/core.c @@ -307,7 +307,7 @@ static struct qemu_pl

[PATCH v2 17/21] plugins: Replace pr_ops with a proper debug dump flag

2024-04-04 Thread Richard Henderson
The DEBUG_PLUGIN_GEN_OPS ifdef is replaced with "-d op_plugin". The second pr_ops call can be obtained with "-d op". Reviewed-by: Pierrick Bouvier Signed-off-by: Richard Henderson --- include/qemu/log.h | 1 + include/tcg/tcg.h | 1 + accel/tcg/plugin-gen.c | 67 +++--

[PATCH v2 20/21] plugins: Inline plugin_gen_empty_callback

2024-04-04 Thread Richard Henderson
Each caller can use tcg_gen_plugin_cb directly. Reviewed-by: Alex Bennée Signed-off-by: Richard Henderson --- accel/tcg/plugin-gen.c | 19 +++ 1 file changed, 3 insertions(+), 16 deletions(-) diff --git a/accel/tcg/plugin-gen.c b/accel/tcg/plugin-gen.c index c0cbc26984..d914d64

[PATCH v2 15/21] plugins: Simplify callback queues

2024-04-04 Thread Richard Henderson
We have qemu_plugin_dyn_cb.type to differentiate the various callback types, so we do not need to keep them in separate queues. Reviewed-by: Pierrick Bouvier Signed-off-by: Richard Henderson --- include/qemu/plugin.h | 35 ++-- accel/tcg/plugin-gen.c | 90 ++

[PATCH v2 13/21] tcg: Remove TCG_CALL_PLUGIN

2024-04-04 Thread Richard Henderson
Since we no longer emit plugin helpers during the initial code translation phase, we don't need to specially mark plugin helpers. Reviewed-by: Pierrick Bouvier Signed-off-by: Richard Henderson --- include/tcg/tcg.h | 2 -- plugins/core.c| 10 -- tcg/tcg.c | 4 +--- 3 files

[PATCH v2 16/21] plugins: Introduce PLUGIN_CB_MEM_REGULAR

2024-04-04 Thread Richard Henderson
Use different enumerators for vcpu_udata and vcpu_mem callbacks. Reviewed-by: Pierrick Bouvier Signed-off-by: Richard Henderson --- include/qemu/plugin.h | 1 + accel/tcg/plugin-gen.c | 2 +- plugins/core.c | 4 ++-- 3 files changed, 4 insertions(+), 3 deletions(-) diff --git a/includ

[PATCH v11 0/2] Improved Memory Tier Creation for CPUless NUMA Nodes

2024-04-04 Thread Ho-Ren (Jack) Chuang
When a memory device, such as CXL1.1 type3 memory, is emulated as normal memory (E820_TYPE_RAM), the memory device is indistinguishable from normal DRAM in terms of memory tiering with the current implementation. The current memory tiering assigns all detected normal memory nodes to the same DRAM t

[PATCH v11 1/2] memory tier: dax/kmem: introduce an abstract layer for finding, allocating, and putting memory types

2024-04-04 Thread Ho-Ren (Jack) Chuang
Since different memory devices require finding, allocating, and putting memory types, these common steps are abstracted in this patch, enhancing the scalability and conciseness of the code. Signed-off-by: Ho-Ren (Jack) Chuang Reviewed-by: "Huang, Ying" --- drivers/dax/kmem.c | 30

[PATCH v11 2/2] memory tier: create CPUless memory tiers after obtaining HMAT info

2024-04-04 Thread Ho-Ren (Jack) Chuang
The current implementation treats emulated memory devices, such as CXL1.1 type3 memory, as normal DRAM when they are emulated as normal memory (E820_TYPE_RAM). However, these emulated devices have different characteristics than traditional DRAM, making it important to distinguish them. Thus, we mod

Re: [PATCH v2] riscv: thead: Add th.sxstatus CSR emulation

2024-04-04 Thread LIU Zhiwei
On 2024/3/29 20:04, Christoph Müllner wrote: The th.sxstatus CSR can be used to identify available custom extension on T-Head CPUs. The CSR is documented here: https://github.com/T-head-Semi/thead-extension-spec/pull/46 An important property of this patch is, that the th.sxstatus MAEE field

RE: [PATCH v1] migration/postcopy: ensure preempt channel is ready before loading states

2024-04-04 Thread Wang, Wei W
On Friday, April 5, 2024 4:57 AM, Peter Xu wrote: > On Fri, Apr 05, 2024 at 12:48:15AM +0800, Wang, Lei wrote: > > On 4/5/2024 0:25, Wang, Wei W wrote:> On Thursday, April 4, 2024 10:12 > > PM, Peter Xu wrote: > > >> On Thu, Apr 04, 2024 at 06:05:50PM +0800, Wei Wang wrote: > > >>> Before loading t

Re: [PATCH v1] migration/postcopy: ensure preempt channel is ready before loading states

2024-04-04 Thread Peter Xu
On Fri, Apr 05, 2024 at 01:38:31AM +, Wang, Wei W wrote: > On Friday, April 5, 2024 4:57 AM, Peter Xu wrote: > > On Fri, Apr 05, 2024 at 12:48:15AM +0800, Wang, Lei wrote: > > > On 4/5/2024 0:25, Wang, Wei W wrote:> On Thursday, April 4, 2024 10:12 > > > PM, Peter Xu wrote: > > > >> On Thu, Apr

RE: [PATCH v1] migration/postcopy: ensure preempt channel is ready before loading states

2024-04-04 Thread Wang, Wei W
On Friday, April 5, 2024 10:33 AM, Peter Xu wrote: > On Fri, Apr 05, 2024 at 01:38:31AM +, Wang, Wei W wrote: > > On Friday, April 5, 2024 4:57 AM, Peter Xu wrote: > > > On Fri, Apr 05, 2024 at 12:48:15AM +0800, Wang, Lei wrote: > > > > On 4/5/2024 0:25, Wang, Wei W wrote:> On Thursday, April 4

[PATCH v2] migration/postcopy: ensure preempt channel is ready before loading states

2024-04-04 Thread Wei Wang
Before loading the guest states, ensure that the preempt channel has been ready to use, as some of the states (e.g. via virtio_load) might trigger page faults that will be handled through the preempt channel. So yield to the main thread in the case that the channel create event hasn't been dispatch

RE: [PATCH v2] migration/postcopy: ensure preempt channel is ready before loading states

2024-04-04 Thread Wang, Wei W
On Friday, April 5, 2024 11:41 AM, Wang, Wei W wrote: > > Before loading the guest states, ensure that the preempt channel has been > ready to use, as some of the states (e.g. via virtio_load) might trigger page > faults that will be handled through the preempt channel. So yield to the main > thre

Re: [RFC PATCH-for-9.1] qapi: Do not generate commands/events/introspect code for user emulation

2024-04-04 Thread Markus Armbruster
Philippe Mathieu-Daudé writes: > User emulation requires the QAPI types. Due to the command > line processing, some visitor code is also used. The rest > is irrelevant (no QMP socket). > > Add an option to the qapi-gen script to allow generating > the minimum when only user emulation is being bui

Re: [PATCH v5 10/24] virtio-net: Use replay_schedule_bh_event for bhs that affect machine state

2024-04-04 Thread Pavel Dovgalyuk
Reviewed-by: Pavel Dovgalyuk On 18.03.2024 18:46, Nicholas Piggin wrote: The regular qemu_bh_schedule() calls result in non-deterministic execution of the bh in record-replay mode, which causes replay failure. Signed-off-by: Nicholas Piggin --- hw/net/virtio-net.c | 11 ++- 1 file

Re: [PATCH v5 20/24] replay: simple auto-snapshot mode for record

2024-04-04 Thread Pavel Dovgalyuk
On 18.03.2024 18:46, Nicholas Piggin wrote: record makes an initial snapshot when the machine is created, to enable reverse-debugging. Often the issue being debugged appears near the end of the trace, so it is important for performance to keep snapshots close to the end. This implements a period

<    1   2