Re: [PATCH v2 00/27] Implementing a MSHV (Microsoft Hypervisor) accelerator

2025-07-01 Thread Wei Liu
v: Handle HVMSG_X64_HALT vm exit > accel/mshv: Workaround for overlappig mem mappings > docs: Add mshv to documentation Thanks for posting this, Magnus. I skimmed through the code and found some cosmetic issues, but overall the code looks sensible to me. Wei

Re: [PATCH v2 24/27] target/i386/mshv: Implement mshv_vcpu_run()

2025-07-01 Thread Wei Liu
gt; + const uint64_t *values; > + uintptr_t count; Need four spaces for indentation. Wei.

Re: [PATCH v2 18/27] target/i386/mshv: Implement mshv_arch_put_registers()

2025-07-01 Thread Wei Liu
pcode; > + uint64_t last_ip; > + uint64_t last_dp; > + uint8_t xmm[16][16]; > + uint32_t mxcsr; > + uint32_t pad2; Not enough spaces here. > +} MshvFPU; > + Wei

Re: [PATCH v2 08/27] accel/mshv: Initialize VM partition

2025-07-01 Thread Wei Liu
parent_obj; > -int vm; > -MshvMemoryListener memory_listener; > -/* number of listeners */ > -int nr_as; > -MshvAddressSpace *as; > + AccelState parent_obj; > + int vm; > + MshvMemoryListener memory_listener; > + /* number of listeners */ > + int nr_as; > + MshvAddressSpace *as; Unnecessary changes due to tabs. > +int fd; > } MshvState; > extern MshvState *mshv_state; Wei

Re: [PATCH v2 02/27] target/i386/emulate: Allow instruction decoding from stream

2025-07-01 Thread Wei Liu
_decode { > struct x86_modrm modrm; > struct x86_decode_op op[4]; > bool is_fpu; > + > + x86_insn_stream *stream; Tab here. > } x86_decode; > > uint64_t sign(uint64_t val, int size); > > uint32_t decode_instruction(CPUX86State *env, struct x86_decode *decode); > +uint32_t decode_instruction_stream(CPUX86State *env, > +struct > x86_decode *decode, > +struct x86_insn_stream *stream); Mixing spaces and tabs. Wei

Re: [PATCH 2/6] MAINTAINERS: fix paths for relocated files

2025-07-01 Thread Sean Wei
On 2025/7/1 1:24 PM, Thomas Huth wrote: On 16/06/2025 17.48, Sean Wei wrote: Several files were renamed in previous commits, causing their entries in MAINTAINERS to reference outdated paths. This prevents scripts/get_maintainer.pl from correctly matching these files to their maintainers

Re: [RFC PATCH 24/25] target/i386/mshv: Implement mshv_vcpu_run()

2025-07-01 Thread Wei Liu
On Tue, Jul 01, 2025 at 05:45:07PM +0200, Magnus Kulke wrote: > On Tue, Jul 01, 2025 at 03:11:39PM +0000, Wei Liu wrote: > > On Tue, Jul 01, 2025 at 10:35:34AM +0200, Magnus Kulke wrote: > > > On Tue, May 20, 2025 at 10:52:39PM +, Wei Liu wrote: > > > > On Tue, Ma

Re: [RFC PATCH 24/25] target/i386/mshv: Implement mshv_vcpu_run()

2025-07-01 Thread Wei Liu
On Tue, Jul 01, 2025 at 10:35:34AM +0200, Magnus Kulke wrote: > On Tue, May 20, 2025 at 10:52:39PM +0000, Wei Liu wrote: > > On Tue, May 20, 2025 at 01:30:17PM +0200, Magnus Kulke wrote: > > > +default: > > > +msg = &exit_msg; > > > > Do you

Re: [PATCH 0/2] virtio-9p: move G_GNUC_PRINTF to header

2025-06-20 Thread Sean Wei
Hi Christian, On 2025/6/20 10:17 AM, Christian Schoenebeck wrote: On Saturday, June 14, 2025 4:07:40 AM CEST Sean Wei wrote: v9fs_string_sprintf() and v9fs_path_sprintf() already have G_GNUC_PRINTF annotations in their own *.c files, but the prototypes in the corresponding headers lack them

Re: [PATCH 12/12] target/i386/emulate: replace FSF postal address with licenses URL

2025-06-16 Thread Wei Liu
On Fri, Jun 13, 2025 at 12:54:20PM -0400, Sean Wei wrote: > Some of the LGPLv2.1 boiler-plate still contained the > obsolete "51 Franklin Street" postal address. > > Replace it with the canonical GNU licenses URL recommended by the FSF: > https://www.gnu.org/licenses/ >

[PATCH 3/6] MAINTAINERS: fix vendor capitalization (Vmware -> VMware)

2025-06-16 Thread Sean Wei
"VMware" is the vendor's official spelling. Adjust the spelling in MAINTAINERS for consistency. Signed-off-by: Sean Wei --- MAINTAINERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MAINTAINERS b/MAINTAINERS index 0477e124d1..7428217361 100644 --- a/MA

[PATCH 6/6] treewide: fix paths for relocated files in comments

2025-06-16 Thread Sean Wei
-target.c Rename cpus-common.c => cpu-common.c 42fa9665e59 (Apr 2025) exec: Restrict 'cpu_ldst.h' to accel/tcg/ Rename include/{exec/cpu_ldst.h => accel/tcg/cpu-ldst.h} Signed-off-by: Sean Wei --- docs/spin/tcg-exclusive.promela | 4 ++-- hw/nvme/ctrl.c

[PATCH 5/6] treewide: update docs file extensions (.txt -> .rst) in comments

2025-06-16 Thread Sean Wei
-hotplug.txt to .rst Signed-off-by: Sean Wei --- hw/acpi/nvdimm.c | 2 +- hw/acpi/pcihp.c| 2 +- hw/acpi/vmgenid.c | 6 +++--- hw/misc/ivshmem-flat.c | 2 +- hw/ppc/spapr.c | 2 +- include/hw/acpi/pcihp.h| 2 +- include/hw/misc

[PATCH 4/6] MAINTAINERS: fix VMware filename typo (vwm -> vmw)

2025-06-16 Thread Sean Wei
The entry for the VMware PVSCSI spec uses "vwm" instead of "vmw", which does not match any file in the tree. Correct the path so scripts/get_maintainer.pl can match the file. Signed-off-by: Sean Wei --- MAINTAINERS | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff

[PATCH 2/6] MAINTAINERS: fix paths for relocated files

2025-06-16 Thread Sean Wei
monitor: Rename misc.c to hmp-target.c Rename monitor/{misc.c => hmp-target.c} Signed-off-by: Sean Wei --- MAINTAINERS | 14 +++--- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/MAINTAINERS b/MAINTAINERS index fed8619874..0477e124d1 100644 --- a/MAINTAIN

[PATCH 1/6] MAINTAINERS: update docs file extensions (.txt -> .rst)

2025-06-16 Thread Sean Wei
: 8472cc5dbe6 (Sep 2023): docs/specs/vmw_pvscsi-spec: Convert to rST 8e72ceee5cd (Jun 2022): Rename docs/specs/fw_cfg.txt to .rst Signed-off-by: Sean Wei --- MAINTAINERS | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/MAINTAINERS b/MAINTAINERS index 28b3dd2684..fed8619874

[PATCH 0/6] Fix paths for relocated files

2025-06-16 Thread Sean Wei
be verified using: git log -- git show --stat I have also included the relevant commit IDs in each patch to make the review process easier. Sean Wei (6): MAINTAINERS: update docs file extensions (.txt -> .rst) MAINTAINERS: fix paths for relocated files MAINTAINERS: fix ven

Re: [PATCH 05/12] include/hw: replace FSF postal address with licenses URL

2025-06-16 Thread Sean Wei
ello Sean, On 6/13/25 18:44, Sean Wei wrote: Some of the GPLv2 boiler-plate still contained the obsolete "51 Franklin Street" postal address. Replace it with the canonical GNU licenses URL recommended by the FSF: https://www.gnu.org/licenses/ Signed-off-by: Sean Wei Instead,  I wo

Re: [PATCH 05/12] include/hw: replace FSF postal address with licenses URL

2025-06-14 Thread Sean Wei
-Identifier, without changing code. Does this approach sound reasonable for you? Thanks again for the guidance! Best regards, Sean Wei smime.p7s Description: S/MIME Cryptographic Signature

Re: [PATCH 05/12] include/hw: replace FSF postal address with licenses URL

2025-06-14 Thread Sean Wei
ith SPDX identifier in the same patch series? Please let me know what works best for you and I will send v2 accordingly. Thanks again for the guidance, Sean Wei

[PATCH 2/2] hw/9pfs: move G_GNUC_PRINTF to header

2025-06-13 Thread Sean Wei
change. Signed-off-by: Sean Wei --- hw/9pfs/9p.c | 3 +-- hw/9pfs/9p.h | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/hw/9pfs/9p.c b/hw/9pfs/9p.c index 8b001b9112..acfa7db4e1 100644 --- a/hw/9pfs/9p.c +++ b/hw/9pfs/9p.c @@ -201,8 +201,7 @@ void v9fs_path_free(V9fsPath *path

[PoC] show header-vs-source G_GNUC_PRINTF behavior

2025-06-13 Thread Sean Wei
$ make -C poc run // Compiling version 1 (Place G_GNUC_PRINTF in 'foo-v1.c') No warning will appear, sliently cause security flaw // Compiling version 2 (Place G_GNUC_PRINTF in 'foo-v2.h') bar-v2.c:4:17: warning: more '%' conversions than data arguments [-Wformat-insuf

[PATCH 1/2] fsdev/9p-marshal: move G_GNUC_PRINTF to header

2025-06-13 Thread Sean Wei
behavior change. Signed-off-by: Sean Wei --- fsdev/9p-marshal.c | 3 +-- fsdev/9p-marshal.h | 2 +- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/fsdev/9p-marshal.c b/fsdev/9p-marshal.c index f9b0336cd5..3455580703 100644 --- a/fsdev/9p-marshal.c +++ b/fsdev/9p-marshal.c @@ -27,8

[PATCH 0/2] virtio-9p: move G_GNUC_PRINTF to header

2025-06-13 Thread Sean Wei
next mail in the thread) demo how G_GNUC_PRINTF behaves differently when the attribute is present only in code.c or code.h file. -- Sean Wei (3): fsdev/9p-marshal: move G_GNUC_PRINTF to header hw/9pfs: move G_GNUC_PRINTF to header fsdev/9p-marshal.c | 3 +-- fsdev/9p-marshal.h | 2 +- hw

[PATCH 06/12] include/qemu: replace FSF postal address with licenses URL

2025-06-13 Thread Sean Wei
The LGPLv2.1 boiler-plate in rcu.h and rcu_queue.h still contained the obsolete "51 Franklin Street" postal address. Replace it with the canonical GNU licenses URL recommended by the FSF: https://www.gnu.org/licenses/ Signed-off-by: Sean Wei --- include/qemu/rcu.h | 4 ++-- in

[PATCH 12/12] target/i386/emulate: replace FSF postal address with licenses URL

2025-06-13 Thread Sean Wei
Some of the LGPLv2.1 boiler-plate still contained the obsolete "51 Franklin Street" postal address. Replace it with the canonical GNU licenses URL recommended by the FSF: https://www.gnu.org/licenses/ Signed-off-by: Sean Wei --- target/i386/emulate/x86_emu.c | 4 ++-- target/i3

[PATCH 11/12] target/xtensa: replace FSF postal address with licenses URL

2025-06-13 Thread Sean Wei
Some of the GPLv2 boiler-plate still contained the obsolete "51 Franklin Street" postal address. Replace it with the canonical GNU licenses URL recommended by the FSF: https://www.gnu.org/licenses/ Signed-off-by: Sean Wei --- target/xtensa/core-dc232b/gdb-config.c.inc | 5 ++-

[PATCH 10/12] contrib: replace FSF postal address with licenses URL

2025-06-13 Thread Sean Wei
The LGPLv2.1 boiler-plate in pdb.c file still contained the obsolete "51 Franklin Street" postal address. Replace it with the canonical GNU licenses URL recommended by the FSF: https://www.gnu.org/licenses/ Signed-off-by: Sean Wei --- contrib/elf2dmp/pdb.c | 4 ++-- 1 file

[PATCH 09/12] scripts: replace FSF postal address with licenses URL

2025-06-13 Thread Sean Wei
The GPLv2 boiler-plate in scripts/device-crash-test still contained the obsolete "51 Franklin Street" postal address. Replace it with the canonical GNU licenses URL recommended by the FSF: https://www.gnu.org/licenses/ Signed-off-by: Sean Wei --- scripts/device-crash-test | 3 +

[PATCH 08/12] hw: replace FSF postal address with licenses URL

2025-06-13 Thread Sean Wei
The GPLv2 boiler-plate in vmxnet3.h and vmw_pvscsi.h still contained the obsolete "51 Franklin Street" postal address. Replace it with the canonical GNU licenses URL recommended by the FSF: https://www.gnu.org/licenses/ Signed-off-by: Sean Wei --- hw/net/vmxnet3.h | 4 ++-

[PATCH 07/12] util/rcu.c: replace FSF postal address with licenses URL

2025-06-13 Thread Sean Wei
The LGPLv2.1 boiler-plate in util/rcu.c still contained the obsolete "51 Franklin Street" postal address. Replace it with the canonical GNU licenses URL recommended by the FSF: https://www.gnu.org/licenses/ Signed-off-by: Sean Wei --- util/rcu.c | 4 ++-- 1 file changed, 2 insert

[PATCH 05/12] include/hw: replace FSF postal address with licenses URL

2025-06-13 Thread Sean Wei
Some of the GPLv2 boiler-plate still contained the obsolete "51 Franklin Street" postal address. Replace it with the canonical GNU licenses URL recommended by the FSF: https://www.gnu.org/licenses/ Signed-off-by: Sean Wei --- include/hw/i2c/aspeed_i2c.h | 3 +-- include/hw/pci/pc

[PATCH 04/12] include/libdecnumber: replace FSF postal address with licenses URL

2025-06-13 Thread Sean Wei
Some of the GPLv2 boiler-plate still contained the obsolete "51 Franklin Street" postal address. Replace it with the canonical GNU licenses URL recommended by the FSF: https://www.gnu.org/licenses/ Signed-off-by: Sean Wei --- include/libdecnumber/dconfig.h | 5 ++--

[PATCH 03/12] libdecnumber: replace FSF postal address with licenses URL

2025-06-13 Thread Sean Wei
Some of the GPLv2 boiler-plate still contained the obsolete "51 Franklin Street" postal address. Replace it with the canonical GNU licenses URL recommended by the FSF: https://www.gnu.org/licenses/ Signed-off-by: Sean Wei --- libdecnumber/decContext.c | 5 ++--- libdecnumber/d

[PATCH 02/12] linux-headers: replace FSF postal address with licenses URL

2025-06-13 Thread Sean Wei
The GPLv2 boiler-plate in asm-arm/kvm.h and asm-powerpc/kvm.h still contained the obsolete "51 Franklin Street" postal address. Replace it with the canonical GNU licenses URL recommended by the FSF: https://www.gnu.org/licenses/ Signed-off-by: Sean Wei --- linux-headers/asm-arm/kvm

[PATCH 01/12] COPYING: replace FSF postal address with licenses URL

2025-06-13 Thread Sean Wei
The license text in COPYING (GPLv2), COPYING.LIB (LGPLv2.1), and the linux-headers/LICENSES/preferred/GPL-2.0 file are referenced to the obsolete FSF postal address. Replace it with the canonical GNU licenses URL recommended by the FSF: https://www.gnu.org/licenses/ Signed-off-by: Sean Wei

[PATCH 00/12] Replace FSF postal address with licenses URL

2025-06-13 Thread Sean Wei
r the clarifications. Resolves: https://gitlab.com/qemu-project/qemu/-/issues/2438 Signed-off-by: Sean Wei -- Sean Wei (12): COPYING: replace FSF postal address with licenses URL linux-headers: replace FSF postal address with licenses URL libdecnumber: replace FSF postal address with license

Request for QEMU Wiki Account

2025-06-11 Thread Sean Wei
ages might benefit from a short summary that links back to the main page. Could you please create a wiki account for me so I can submit these improvements? Thank you for your time and for maintaining such a great project! May the source be with you, Sean Wei smime.p7s Description: S/MIME Cry

Re: [RFC PATCH 18/25] target/i386/mshv: Implement mshv_arch_put_registers()

2025-06-06 Thread Wei Liu
On Wed, May 28, 2025 at 04:30:55PM +0200, Magnus Kulke wrote: > On Tue, May 20, 2025 at 10:22:27PM +0000, Wei Liu wrote: > > On Tue, May 20, 2025 at 01:30:11PM +0200, Magnus Kulke wrote: > > > +/* > > > + * TODO: support asserting an interrupt using interrup_bit

Re: [RFC PATCH 18/25] target/i386/mshv: Implement mshv_arch_put_registers()

2025-06-06 Thread Wei Liu
moved, since we know for sure how many elements are in `SPECIAL_REGISTER_NAMES`. It should be fine to use an on-stack array. There are probably other places you can optimize. Thanks, Wei.

Re: [PATCH v4 0/7] Move memory listener register to vhost_vdpa_init

2025-05-29 Thread Si-Wei Liu
On 5/26/2025 2:16 AM, Markus Armbruster wrote: Si-Wei Liu writes: On 5/15/2025 11:40 PM, Markus Armbruster wrote: Jason Wang writes: On Thu, May 8, 2025 at 2:47 AM Jonah Palmer wrote: Current memory operations like pinning may take a lot of time at the destination. Currently they

Re: [RFC PATCH 12/25] accel/mshv: Add vCPU creation and execution loop

2025-05-23 Thread Wei Liu
need some time to discuss kernel side changes. Thanks, Wei. > > Paolo >

Re: [RFC PATCH 08/25] accel/mshv: Initialize VM partition

2025-05-23 Thread Wei Liu
On Fri, May 23, 2025 at 10:23:58AM +0200, Magnus Kulke wrote: > On Tue, May 20, 2025 at 07:07:06PM +0000, Wei Liu wrote: > > On Tue, May 20, 2025 at 01:30:01PM +0200, Magnus Kulke wrote: > > > Create the MSHV virtual machine by opening a partition and issuing > >

Re: [RFC PATCH 08/25] accel/mshv: Initialize VM partition

2025-05-22 Thread Wei Liu
On Thu, May 22, 2025 at 05:42:48PM +0200, Magnus Kulke wrote: > On Tue, May 20, 2025 at 07:07:06PM +0000, Wei Liu wrote: > > On Tue, May 20, 2025 at 01:30:01PM +0200, Magnus Kulke wrote: > > > +static void mshv_reset(void *param) > > > +{ > > > +warn_r

Re: [RFC PATCH 24/25] target/i386/mshv: Implement mshv_vcpu_run()

2025-05-20 Thread Wei Liu
nmapped_mem(vm_fd, cpu, &exit_msg, &exit_reason); > +if (ret < 0) { > +error_report("failed to handle unmapped memory"); > +return -1; > +} > +return exit_reason; > + case HVMSG_GPA_INTERCEPT: I'm not sure why you want t

Re: [RFC PATCH 22/25] target/i386/mshv: Integrate x86 instruction decoder/emulator

2025-05-20 Thread Wei Liu
l = { .sel = seg->selector & 0x }; > + > +ret = x86_read_segment_descriptor(cpu, desc, sel); > +if (ret == false) { > +error_report("failed to read segment descriptor"); > +abort(); > +} > +} > + > +static const struct x86_emul_ops mshv_x86_emul_ops = { > +.fetch_instruction = fetch_instruction_emu, > +.read_mem = read_mem_emu, > +.write_mem = write_mem_emu, > +.read_segment_descriptor = read_segment_descriptor_emu, You can remove the _emu suffix from all the handler functions. > +}; > + > void mshv_init_cpu_logic(void) > { > cpu_guards_lock = g_new0(QemuMutex, 1); > qemu_mutex_init(cpu_guards_lock); > cpu_guards = g_hash_table_new(g_direct_hash, g_direct_equal); > + > +init_decoder(); > +init_emu(&mshv_x86_emul_ops); If I'm not mistaken, the name mshv_init_cpu_logic suggests this function is called every time a CPU is initialized. There is no need to repeatedly initialize the emulator. The code snippet should be moved to either the initialization function of the accelerator or the initialization function of the VM object. Thanks, Wei. > } > > void mshv_arch_init_vcpu(CPUState *cpu) > -- > 2.34.1 >

Re: [RFC PATCH 18/25] target/i386/mshv: Implement mshv_arch_put_registers()

2025-05-20 Thread Wei Liu
ic_state); > + > +/* > + * TODO: support asserting an interrupt using interrup_bitmap > + * it should be possible if we use the vm_fd > + */ > + Why is there a need to assert an interrupt here? > +ret = mshv_set_generic_regs(cpu_fd, assocs,

Re: [RFC PATCH 17/25] target/i386/mshv: Implement mshv_get_special_regs()

2025-05-20 Thread Wei Liu
ret < 0) { > +error_report("failed to get special registers"); > +g_free(assocs); > +return -errno; > +} > + > +populate_special_regs(assocs, x86cpu); > + > +g_free(assocs); > +return 0; > +} > + > int mshv_load_regs(CPUState *cpu) > { > int ret; > @@ -225,8 +334,13 @@ int mshv_load_regs(CPUState *cpu) > return -1; > } > > - error_report("unimplemented"); > - abort(); > +ret = mshv_get_special_regs(cpu); > +if (ret < 0) { > +error_report("Failed to load special registers"); > +return -1; > +} > + > +return 0; Ah so you changed the code in this patch. Thanks, Wei. > } > > int mshv_arch_put_registers(const CPUState *cpu) > -- > 2.34.1 >

Re: [RFC PATCH 16/25] target/i386/mshv: Implement mshv_get_standard_regs()

2025-05-20 Thread Wei Liu
+error_report("Failed to load standard registers"); > +return -1; > +} > + > error_report("unimplemented"); > abort(); This part looks wrong. It should be "return 0;" instead. Thanks, Wei. > } > -- > 2.34.1 >

Re: [RFC PATCH 15/25] target/i386/mshv: Implement mshv_store_regs()

2025-05-20 Thread Wei Liu
ed to store them every time we refresh the CPU state, unless we know some of them are dirtied by QEMU. Thanks, Wei. > + > +return 0; > } > > + > int mshv_load_regs(CPUState *cpu) > { > error_report("unimplemented"); > -- > 2.34.1 >

Re: [RFC PATCH 14/25] target/i386/mshv: Add CPU create and remove logic

2025-05-20 Thread Wei Liu
xit *exit) > > void mshv_remove_vcpu(int vm_fd, int cpu_fd) > { > - error_report("unimplemented"); > - abort(); > +/* > + * TODO: don't we have to perform an ioctl to remove the vcpu? > + * there is WHvDeleteVirtualProcessor in the WHV api > + *

Re: [RFC PATCH 11/25] accel/mshv: Add basic interrupt injection support

2025-05-20 Thread Wei Liu
? */ You must have seen this in real life, right? We need to convince ourselves why this is okay. Thanks, Wei. > +return 0; > +} > + > +union hv_interrupt_control control = { > +.interrupt_type = interrupt_type, > +.level_triggered = level_

Re: [RFC PATCH 09/25] accel/mshv: Register guest memory regions with hypervisor

2025-05-20 Thread Wei Liu
*mml, MemoryRegionSection *section, > bool add) > { > - error_report("unimplemented"); > - abort(); > -} > +int ret = 0; > +MemoryRegion *area = section->mr; > +bool writable = !area->readonly && !ar

Re: [RFC PATCH 08/25] accel/mshv: Initialize VM partition

2025-05-20 Thread Wei Liu
+error_report("Failed to perform hvcall: %s", strerror(errno)); > +return -1; > +} > +return ret; > +} > > > static int mshv_init(MachineState *ms) > { > MshvState *s; > +int mshv_fd, ret; > + > s = MSHV_

Re: [RFC PATCH 03/25] target/i386/mshv: Add x86 decoder/emu implementation

2025-05-20 Thread Wei Liu
mit = env->ldt.limit; > +} > + > +if (sel.index * 8 >= limit) { > +return false; > +} > + > +gva = base + sel.index * 8; > +emul_ops->write_mem(cpu, desc, gva, sizeof(*desc)); > + > +return true; > +} > + [...] > + > +target_ulong

Re: [RFC PATCH 02/25] target/i386/emulate: allow instruction decoding from stream

2025-05-20 Thread Wei Liu
gt; bool is_fpu; > + > + x86_insn_stream *stream; Tab here. > } x86_decode; > > uint64_t sign(uint64_t val, int size); > > uint32_t decode_instruction(CPUX86State *env, struct x86_decode *decode); > > +uint32_t decode_instruction_stream(CPUX86State *e

Re: [PATCH v4 0/7] Move memory listener register to vhost_vdpa_init

2025-05-16 Thread Si-Wei Liu
On 5/15/2025 11:40 PM, Markus Armbruster wrote: Jason Wang writes: On Thu, May 8, 2025 at 2:47 AM Jonah Palmer wrote: Current memory operations like pinning may take a lot of time at the destination. Currently they are done after the source of the migration is stopped, and before the wor

Re: [PATCH v4 0/7] Move memory listener register to vhost_vdpa_init

2025-05-15 Thread Si-Wei Liu
On 5/14/2025 10:43 PM, Michael S. Tsirkin wrote: On Wed, May 14, 2025 at 05:17:15PM -0700, Si-Wei Liu wrote: Hi Eugenio, On 5/14/2025 8:49 AM, Eugenio Perez Martin wrote: On Wed, May 7, 2025 at 8:47 PM Jonah Palmer wrote: Current memory operations like pinning may take a lot of time at

Re: [PATCH v4 7/7] vdpa: move memory listener register to vhost_vdpa_init

2025-05-15 Thread Si-Wei Liu
ggested-by: Si-Wei Liu -- v2: Move the memory listener registration to vhost_vdpa_set_owner function. In case of hotplug the vdpa device, the memory is already set up, and leaving memory listener register call in the init function made maps occur before set owner call. To be 100% safe, let'

Re: [PATCH v4 0/7] Move memory listener register to vhost_vdpa_init

2025-05-14 Thread Si-Wei Liu
oceed to Michael for upcoming merge? I think I cannot ack the series as I sent the first revision. Jason or Si-Wei, could you ack it? Sure, I just give my R-b, this series look good to me. Hopefully Jason can ack on his own. Thanks! -Siwei Thanks! Future directions on top of this serie

Re: [PATCH v4 0/7] Move memory listener register to vhost_vdpa_init

2025-05-14 Thread Si-Wei Liu
For the series: Reviewed-by: Si-Wei Liu On 5/7/2025 11:46 AM, Jonah Palmer wrote: Current memory operations like pinning may take a lot of time at the destination. Currently they are done after the source of the migration is stopped, and before the workload is resumed at the destination

Re: [PULL 05/22] target/i386/hvf: Include missing 'exec/target_page.h' header

2025-05-07 Thread Wei Liu
On Wed, May 07, 2025 at 01:20:49PM +0200, Philippe Mathieu-Daudé wrote: > Hi Wei, > > On 7/5/25 08:35, Wei Liu wrote: > > On Tue, May 06, 2025 at 04:34:54PM +0200, Philippe Mathieu-Daudé wrote: > > > Include "exec/target_page.h" to be able to compile HVF on x86_

Re: [PULL 05/22] target/i386/hvf: Include missing 'exec/target_page.h' header

2025-05-06 Thread Wei Liu
Fixes: 9c2ff9cdc9b ("exec/cpu-all: remove exec/target_page include") > Reported-by: Pierrick Bouvier > Reported-by: Wei Liu > Signed-off-by: Philippe Mathieu-Daudé > Message-Id: <20250425174310.70890-1-phi...@linaro.org> > Reviewed-by: Pierrick Bouvier FYI Pao

Re: [CFT PATCH 0/4] target/i386/emulate: cleanups

2025-05-05 Thread Wei Liu
Magnus, can you test this series on MSHV? On Fri, May 02, 2025 at 11:48:37PM +0200, Paolo Bonzini wrote: > These are some improvements to the x86 emulator that I wrote but have no > way of testing (right now). > > I tried to place them in order of importance so that, if something breaks, > it is

Re: [CFT PATCH 0/4] target/i386/emulate: cleanups

2025-05-05 Thread Wei Liu
On Sat, May 03, 2025 at 09:01:46AM +0200, Paolo Bonzini wrote: > Il sab 3 mag 2025, 07:39 Wei Liu ha scritto: > > > FWIW this series builds fine on for x86 HVF. > > > > Thanks, can you also test it on either HVF or Hyper-V? > I will leave it to Magnus to test your changes on MSHV. Wei.

Re: [CFT PATCH 0/4] target/i386/emulate: cleanups

2025-05-02 Thread Wei Liu
t; It should fix issues with 64-bit ALU operations, but it's also the one > where it's more likely to have a mistake. > > Patch 4 is comparatively trivial, though I cannot exclude any screwups. > > It should be possible to test this with both HVF and Hyper-V. >

Re: [PATCH v3] target/i386/emulate: remove rflags leftovers

2025-05-02 Thread Wei Liu
compilation issues w/ the emulator code, that I had to > fix to make it compile on Linux. However I don't have access to an x86_64 > Mac for development either, so I can't test a HVF build. > I still have my loaner Macbook for a few more days. If I have not returned it when Paolo posts his patches I can build test HVF. Thanks, Wei.

[PATCH] target/i386/hvf: fix a compilation error

2025-04-28 Thread Wei Liu
RGET_PAGE_SIZE - 1u); | ^ ../target/i386/hvf/hvf.c:141:45: error: use of undeclared identifier 'TARGET_PAGE_SIZE' 141 | hv_vm_protect(dirty_page_start, TARGET_PAGE_SIZE, | ^

Re: [PATCH v2] i386/emulate: remove rflags leftovers

2025-04-28 Thread Wei Liu
the commit message should be longer. Linux kernel uses 12 characters. Looking at some recent commits in the QEMU tree, their commti hash length goes from 11 to 14. Assuming you've built and tested this patch and with the minor issues fixed: Reviewed-by: Wei Liu > --- > target/i386/

Re: [PATCH v3 0/7] Move memory listener register to vhost_vdpa_init

2025-03-18 Thread Si-Wei Liu
Hi Lei, On 3/18/2025 7:06 AM, Lei Yang wrote: On Tue, Mar 18, 2025 at 10:15 AM Jason Wang wrote: On Tue, Mar 18, 2025 at 9:55 AM Lei Yang wrote: Hi Jonah I tested this series with the vhost_vdpa device based on mellanox ConnectX-6 DX nic and hit the host kernel crash. This problem can be ea

Re: [PATCH v2 00/14] Factor out HVF's instruction emulator

2025-03-14 Thread Wei Liu
On Fri, Mar 07, 2025 at 11:55:11AM -0800, Wei Liu wrote: > Hi, > > Microsoft's Linux Systems Group developed a Linux driver for the Microsoft > Hypervisor (MSHV for short). The driver is being upstreamed. The first > supported VMM is Cloud Hypervisor. We want to add QEMU as

[PATCH v2 03/14] target/i386/hvf: provide and use handle_io in emul_ops

2025-03-07 Thread Wei Liu
This drops the calls to hvf_handle_io from x86_emu.c. Signed-off-by: Wei Liu --- target/i386/hvf/hvf.c | 1 + target/i386/hvf/x86_emu.c | 29 +++-- target/i386/hvf/x86_emu.h | 2 ++ 3 files changed, 18 insertions(+), 14 deletions(-) diff --git a/target/i386/hvf

[PATCH v2 02/14] target/i386/hvf: remove HVF specific calls from x86_decode.c

2025-03-07 Thread Wei Liu
Use the newly defined emul_ops. This allows the module to be reused by other accelerator in the future. No functional change intended. Signed-off-by: Wei Liu --- target/i386/hvf/x86_decode.c | 19 ++- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/target/i386

[PATCH v2 12/14] target/i386/emulate: add a panic.h

2025-03-07 Thread Wei Liu
The macros will be used by the instruction emulator. The code is the same as the one under hvf. Signed-off-by: Wei Liu --- target/i386/emulate/panic.h | 45 + 1 file changed, 45 insertions(+) create mode 100644 target/i386/emulate/panic.h diff --git a

[PATCH v2 13/14] target/i386: move x86 instruction emulator out of hvf

2025-03-07 Thread Wei Liu
Move x86_decode, x86_emu, x86_flags and some headers to the new location. Fix up all the inclusion sites in hvf. Signed-off-by: Wei Liu --- target/i386/emulate/meson.build | 5 + target/i386/{hvf => emulate}/x86.h| 0 target/i386/{hvf => emulate}/x86_decode.c | 0

[PATCH v2 01/14] target/i386/hvf: introduce x86_emul_ops

2025-03-07 Thread Wei Liu
This will be used to remove HVF specific code from the instruction emulator. For now we only introduce two hooks for x86_decode.c. More hooks will be added when the code is refactored. The emulator initialization function now takes in a pointer to the ops structure. Signed-off-by: Wei Liu

[PATCH v2 14/14] MAINTAINERS: add an entry for the x86 instruction emulator

2025-03-07 Thread Wei Liu
Add myself as a reviewer. Signed-off-by: Wei Liu --- v2: new --- MAINTAINERS | 8 1 file changed, 8 insertions(+) diff --git a/MAINTAINERS b/MAINTAINERS index 5df6020ed545..02c763e9d14f 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -533,6 +533,14 @@ S: Supported F: target/i386/whpx

[PATCH v2 08/14] target/i386: rename lazy flags field and its type

2025-03-07 Thread Wei Liu
The same structure and code can be used by other accelerators. Drop the hvf prefix in the type and field name. No functional change. Signed-off-by: Wei Liu --- target/i386/cpu.h | 6 ++-- target/i386/hvf/x86_flags.c | 56 ++--- 2 files changed, 31

[PATCH v2 09/14] target/i386/hvf: drop unused headers

2025-03-07 Thread Wei Liu
Signed-off-by: Wei Liu --- target/i386/hvf/x86_decode.c | 3 --- target/i386/hvf/x86_emu.c| 4 2 files changed, 7 deletions(-) diff --git a/target/i386/hvf/x86_decode.c b/target/i386/hvf/x86_decode.c index 728e15963817..ddd7b60bcfe1 100644 --- a/target/i386/hvf/x86_decode.c +++ b

[PATCH v2 10/14] target/i386/hvf: rename some include guards

2025-03-07 Thread Wei Liu
These headers will be moved out to its own component. Signed-off-by: Wei Liu --- target/i386/hvf/x86.h| 4 ++-- target/i386/hvf/x86_decode.h | 4 ++-- target/i386/hvf/x86_flags.h | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/target/i386/hvf/x86.h b/target

[PATCH v2 07/14] target/i386/hvf: provide and use simulate_{wrmsr, rdmsr} in emul_ops

2025-03-07 Thread Wei Liu
Change the first argument's type to be CPUState to match other hooks. Signed-off-by: Wei Liu --- target/i386/hvf/hvf-i386.h | 4 ++-- target/i386/hvf/hvf.c | 18 ++ target/i386/hvf/x86_emu.c | 4 ++-- target/i386/hvf/x86_emu.h | 2 ++ 4 files changed, 16 inser

[PATCH v2 06/14] taret/i386/hvf: provide and use write_mem in emul_ops

2025-03-07 Thread Wei Liu
Signed-off-by: Wei Liu --- target/i386/hvf/hvf.c | 6 ++ target/i386/hvf/x86_emu.c | 8 target/i386/hvf/x86_emu.h | 1 + 3 files changed, 11 insertions(+), 4 deletions(-) diff --git a/target/i386/hvf/hvf.c b/target/i386/hvf/hvf.c index 1cecb765952b..e4f48a79fb7c 100644 --- a

[PATCH v2 11/14] target/i386: add a directory for x86 instruction emulator

2025-03-07 Thread Wei Liu
Signed-off-by: Wei Liu --- v2: name the directory emulate --- target/i386/emulate/meson.build | 0 target/i386/meson.build | 1 + 2 files changed, 1 insertion(+) create mode 100644 target/i386/emulate/meson.build diff --git a/target/i386/emulate/meson.build b/target/i386/emulate

[PATCH v2 04/14] target/i386: rename hvf_mmio_buf to emu_mmio_buf

2025-03-07 Thread Wei Liu
We want to refactor HVF's instruction emulator to a common component. Renaming hvf_mmio_buf removes the association between HVF and the instruction emulator. The definition of the field is still guarded by CONFIG_HVF for now, since it is the only user. No functional change. Signed-off-by

[PATCH v2 00/14] Factor out HVF's instruction emulator

2025-03-07 Thread Wei Liu
n an Intel-based Mac. Thanks, Wei. Changes in v2: 1. Address comments from Paolo on variable and directory names. 2. Rebase and drop the already applied patches. 3. Add a new entry in MAINTAINERS. Wei Liu (14): target/i386/hvf: introduce x86_emul_ops target/i386/hvf: remove HVF specific cal

[PATCH v2 05/14] target/i386/hvf: use emul_ops->read_mem in x86_emu.c

2025-03-07 Thread Wei Liu
No functional change. Signed-off-by: Wei Liu --- target/i386/hvf/x86_emu.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/target/i386/hvf/x86_emu.c b/target/i386/hvf/x86_emu.c index e59a73e00d5c..7b816b5a1dab 100644 --- a/target/i386/hvf/x86_emu.c +++ b/target

Re: [RFC PATCH v1 00/19] Factor out HVF's instruction emulator

2025-03-05 Thread Wei Liu
Hi Cameron, Roman and Phil, On Fri, Feb 21, 2025 at 12:36:08AM -0800, Wei Liu wrote: > Hi, > > Microsoft's Linux Systems Group developed a Linux driver for the Microsoft > Hypervisor (MSHV for short). The driver is being upstreamed. The first > supported VMM is Cloud Hypervis

Re: [RFC PATCH v1 00/19] Factor out HVF's instruction emulator

2025-02-21 Thread Wei Liu
On Fri, Feb 21, 2025 at 04:53:26PM +, Peter Maydell wrote: > On Fri, 21 Feb 2025 at 14:02, Wei Liu wrote: > > > > Hi, > > > > Microsoft's Linux Systems Group developed a Linux driver for the Microsoft > > Hypervisor (MSHV for short). The driver is being u

Re: [RFC PATCH v1 00/19] Factor out HVF's instruction emulator

2025-02-21 Thread Wei Liu
On Fri, Feb 21, 2025 at 05:36:39PM +0100, Paolo Bonzini wrote: > On 2/21/25 09:36, Wei Liu wrote: > > This patch series attempts to make the instruction emulator in HVF a common > > component for the i386 target. It removes HVF specific code by either using > > a > > s

[RFC PATCH v1 14/19] target/i386/hvf: drop unused headers

2025-02-21 Thread Wei Liu
Signed-off-by: Wei Liu --- target/i386/hvf/x86_decode.c | 3 --- target/i386/hvf/x86_emu.c| 4 2 files changed, 7 deletions(-) diff --git a/target/i386/hvf/x86_decode.c b/target/i386/hvf/x86_decode.c index 31285952ad..ffece4773b 100644 --- a/target/i386/hvf/x86_decode.c +++ b/target

[RFC PATCH v1 05/19] target/i386/hvf: remove HVF specific calls from x86_decode.c

2025-02-21 Thread Wei Liu
Use the newly defined emul_ops. This allows the module to be reused by other accelerator in the future. No functional change intended. Signed-off-by: Wei Liu --- target/i386/hvf/x86_decode.c | 19 ++- 1 file changed, 6 insertions(+), 13 deletions(-) diff --git a/target/i386

[RFC PATCH v1 09/19] target/i386/hvf: use emul_ops->read_mem in x86_emu.c

2025-02-21 Thread Wei Liu
No functional change. Signed-off-by: Wei Liu --- target/i386/hvf/x86_emu.c | 10 +- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/target/i386/hvf/x86_emu.c b/target/i386/hvf/x86_emu.c index d0a8e221ea..f1244640e6 100644 --- a/target/i386/hvf/x86_emu.c +++ b/target/i386

[RFC PATCH v1 02/19] target/i386/hvf: fix the declaration of hvf_handle_io

2025-02-21 Thread Wei Liu
-i386.h. Take the chance to change the first argument's type to be CPUState. Signed-off-by: Wei Liu --- target/i386/hvf/hvf-i386.h | 2 +- target/i386/hvf/hvf.c | 6 +++--- target/i386/hvf/x86_emu.c | 4 +--- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/target/i3

[RFC PATCH v1 16/19] target/i386/hvf: rename some include guards

2025-02-21 Thread Wei Liu
These headers will be moved out to its own component. Signed-off-by: Wei Liu --- target/i386/hvf/x86.h| 4 ++-- target/i386/hvf/x86_decode.h | 4 ++-- target/i386/hvf/x86_flags.h | 6 +++--- 3 files changed, 7 insertions(+), 7 deletions(-) diff --git a/target/i386/hvf/x86.h b/target

[RFC PATCH v1 07/19] target/i386/hvf: provide and use handle_io in emul_ops

2025-02-21 Thread Wei Liu
This drops the calls to hvf_handle_io from x86_emu.c. Signed-off-by: Wei Liu --- target/i386/hvf/hvf.c | 1 + target/i386/hvf/x86_emu.c | 30 +++--- target/i386/hvf/x86_emu.h | 2 ++ 3 files changed, 18 insertions(+), 15 deletions(-) diff --git a/target/i386/hvf

[RFC PATCH v1 11/19] target/i386/hvf: move and rename simulate_{rdmsr, wrmsr}

2025-02-21 Thread Wei Liu
This requires making raise_exception non-static. That function needs to be renamed to avoid clashing with a function in TCG. Mostly code movement. No functional change. Signed-off-by: Wei Liu --- target/i386/hvf/hvf-i386.h | 2 + target/i386/hvf/hvf.c | 216

[RFC PATCH v1 03/19] target/i386/hvf: use x86_segment in x86_decode.c

2025-02-21 Thread Wei Liu
Make the code to rely on the segment definition for checking cs.db. This allows removing HVF specific VMX related definition from the decoder. Introduce a function for retrieving the CS descriptor. No functional change intended. Signed-off-by: Wei Liu --- target/i386/hvf/x86_decode.c | 20

[RFC PATCH v1 12/19] target/i386/hvf: provide and use simulate_{wrmsr, rdmsr} in emul_ops

2025-02-21 Thread Wei Liu
Change the first argument's type to be CPUState to match other hooks. Signed-off-by: Wei Liu --- target/i386/hvf/hvf-i386.h | 4 ++-- target/i386/hvf/hvf.c | 18 ++ target/i386/hvf/x86_emu.c | 4 ++-- target/i386/hvf/x86_emu.h | 2 ++ 4 files changed, 16 inser

[RFC PATCH v1 13/19] target/i386: rename lazy flags field and its type

2025-02-21 Thread Wei Liu
The same structure and code can be used by other accelerators. Drop the hvf prefix in the type and field name. No functional change. Signed-off-by: Wei Liu --- target/i386/cpu.h | 6 ++-- target/i386/hvf/x86_flags.c | 56 ++--- 2 files changed, 31

[RFC PATCH v1 18/19] target/i386/x86-insn-emul: add a panic.h

2025-02-21 Thread Wei Liu
The macros will be used by the instruction emulator. The code is the same as the one under hvf. Signed-off-by: Wei Liu --- target/i386/x86-insn-emul/panic.h | 45 +++ 1 file changed, 45 insertions(+) create mode 100644 target/i386/x86-insn-emul/panic.h diff --git a

  1   2   3   4   5   6   7   8   9   10   >