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

2025-07-01 Thread Wei Liu
On Tue, Jul 01, 2025 at 07:28:07PM +0200, Magnus Kulke wrote: > Hey all, > [...] > > Magnus Kulke (27): > accel: Add Meson and config support for MSHV accelerator > target/i386/emulate: Allow instruction decoding from stream > target/i386/mshv: Add x86 decoder/emu implementation > hw/intc

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

2025-07-01 Thread Wei Liu
On Tue, Jul 01, 2025 at 07:28:31PM +0200, Magnus Kulke wrote: > Add the main vCPU execution loop for MSHV using the MSHV_RUN_VP ioctl. > > A translate_gva() hypercall is implemented. The execution loop handles > guest entry and VM exits. There are handlers for memory r/w, PIO and > MMIO to which t

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

2025-07-01 Thread Wei Liu
On Tue, Jul 01, 2025 at 07:28:25PM +0200, Magnus Kulke wrote: > Write CPU register state to MSHV vCPUs. Various mapping functions to > prepare the payload for the HV call have been implemented. > > Signed-off-by: Magnus Kulke > --- > include/system/mshv.h | 15 +++ > target/i386/mshv/mshv

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

2025-07-01 Thread Wei Liu
On Tue, Jul 01, 2025 at 07:28:15PM +0200, Magnus Kulke wrote: > Create the MSHV virtual machine by opening a partition and issuing > the necessary ioctl to initialize it. This sets up the basic VM > structure and initial configuration used by MSHV to manage guest state. > > Signed-off-by: Magnus K

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

2025-07-01 Thread Wei Liu
On Tue, Jul 01, 2025 at 07:28:09PM +0200, Magnus Kulke wrote: > Introduce a new helper function to decode x86 instructions from a > raw instruction byte stream. MSHV delivers an instruction stream in a > buffer of the vm_exit message. It can be used to speed up MMIO > emulation, since instructions

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 12/12] target/i386/emulate: replace FSF postal address with licenses URL

2025-06-16 Thread Wei Liu
; > Signed-off-by: Sean Wei It looks to me this is just following the footsteps of commit 8167ee883. Reviewed-by: Wei Liu > --- > target/i386/emulate/x86_emu.c | 4 ++-- > target/i386/emulate/x86_flags.c | 4 ++-- > target/i386/emulate/x86_flags.h | 4 ++-- > 3 files chan

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
On Tue, May 20, 2025 at 01:30:11PM +0200, Magnus Kulke wrote: > Write CPU register state to MSHV vCPUs. Various mapping functions to > prepare the payload for the HV call have been implemented. > > Signed-off-by: Magnus Kulke > --- [...] > + > +static void populate_hv_table_reg(const struct Segme

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
On Tue, May 20, 2025 at 03:54:57PM +0200, Paolo Bonzini wrote: > On 5/20/25 15:50, Paolo Bonzini wrote: > > You need support in the hypervisor for this: KVM and HVF both have it. > > > > There are two ways to do it > > Sorry - I left out the other way which is to pass something *into* > MSHV_RUN_

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
On Tue, May 20, 2025 at 01:30:17PM +0200, Magnus Kulke wrote: > Add the main vCPU execution loop for MSHV using the MSHV_RUN_VP ioctl. > > A translate_gva() hypercall is implemented. The execution loop handles > guest entry and VM exits. There are handlers for memory r/w, PIO and > MMIO to which t

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

2025-05-20 Thread Wei Liu
On Tue, May 20, 2025 at 01:30:15PM +0200, Magnus Kulke wrote: > Connect the x86 instruction decoder and emulator to the MSHV backend > to handle intercepted instructions. This enables software emulation > of MMIO operations in MSHV guests. MSHV has a translate_gva hypercall > that is used to access

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

2025-05-20 Thread Wei Liu
On Tue, May 20, 2025 at 01:30:11PM +0200, Magnus Kulke wrote: > Write CPU register state to MSHV vCPUs. Various mapping functions to > prepare the payload for the HV call have been implemented. > > Signed-off-by: Magnus Kulke > --- [...] > +static int set_special_regs(const CPUState *cpu) > +{ >

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

2025-05-20 Thread Wei Liu
On Tue, May 20, 2025 at 01:30:10PM +0200, Magnus Kulke wrote: > Retrieve special registers (e.g. segment, control, and descriptor > table registers) from MSHV vCPUs. > > Various helper functions to map register state representations between > Qemu and MSHV are introduced. > > Signed-off-by: Magnu

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

2025-05-20 Thread Wei Liu
On Tue, May 20, 2025 at 01:30:09PM +0200, Magnus Kulke wrote: > Fetch standard register state from MSHV vCPUs to support debugging, > migration, and other introspection features in QEMU. > > Fetch standard register state from a MHSV vCPU's. A generic get_regs() > function and a mapper to map the d

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

2025-05-20 Thread Wei Liu
On Tue, May 20, 2025 at 01:30:08PM +0200, Magnus Kulke wrote: > Add support for writing general-purpose registers to MSHV vCPUs > during initialization or migration using the MSHV register interface. A > generic set_register call is introduced to abstract the HV call over > the various register typ

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

2025-05-20 Thread Wei Liu
On Tue, May 20, 2025 at 01:30:07PM +0200, Magnus Kulke wrote: > Implement MSHV-specific hooks for vCPU creation and teardown in the > i386 target. A list of locks per vCPU is maintained to lock CPU state in > MMIO operations. > > Signed-off-by: Magnus Kulke > --- > target/i386/mshv/mshv-cpu.c |

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

2025-05-20 Thread Wei Liu
On Tue, May 20, 2025 at 01:30:04PM +0200, Magnus Kulke wrote: > Implement initial interrupt handling logic in the MSHV backend. This > includes management of MSI and un/registering of irqfd mechanisms. > > Signed-off-by: Magnus Kulke > --- [...] > +int mshv_request_interrupt(int vm_fd, uint32_t i

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

2025-05-20 Thread Wei Liu
On Tue, May 20, 2025 at 01:30:02PM +0200, Magnus Kulke wrote: > Handle region_add events by invoking the MSHV memory registration > ioctl to map guest memory into the hypervisor partition. This allows > the guest to access memory through MSHV-managed mappings. > > Note that this assumes the hyperv

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

2025-05-20 Thread Wei Liu
On Tue, May 20, 2025 at 01:30:01PM +0200, Magnus Kulke wrote: > Create the MSHV virtual machine by opening a partition and issuing > the necessary ioctl to initialize it. This sets up the basic VM > structure and initial configuration used by MSHV to manage guest state. > > Signed-off-by: Magnus K

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

2025-05-20 Thread Wei Liu
On Tue, May 20, 2025 at 01:29:56PM +0200, Magnus Kulke wrote: > The MSHV accelerator requires a x86 decoder/emulator in userland to > emulate MMIO instructions. This change contains the implementations for > the generalized i386 instruction decoder/emulator. > > Signed-off-by: Magnus Kulke > ---

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

2025-05-20 Thread Wei Liu
On Tue, May 20, 2025 at 01:29:55PM +0200, Magnus Kulke wrote: > Introduce a new helper function to decode x86 instructions from a > raw instruction byte stream. MSHV delivers an instruction stream in a > buffer of the vm_exit message. It can be used to speed up MMIO > emulation, since instructions

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
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 the destination. Currently they are done after the source of the migration is stopped, and before the workload is r

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
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 possible to commit a subset. I tried to co

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

2025-05-02 Thread Wei Liu
On Tue, Apr 29, 2025 at 02:17:01PM +0200, Magnus Kulke wrote: > On Tue, Apr 29, 2025 at 12:02:48PM +0200, Paolo Bonzini wrote: > > Il mar 29 apr 2025, 11:33 Magnus Kulke ha > > scritto: > > > > > Fixes: c901905ea670 ("target/i386/emulate: remove flags_mask") > > > > > > In c901905ea670 rflags hav

[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

[RFC PATCH v1 06/19] target/i386/hvf: move and rename {load, store}_regs

2025-02-21 Thread Wei Liu
They contain HVF specific code. Move them to a better location and add "hvf_" prefix. Fix up all the call sites. No functional change. Signed-off-by: Wei Liu --- target/i386/hvf/hvf.c | 71 +++--- target/i386/hvf/x86_e

[RFC PATCH v1 19/19] target/i386: move x86 instruction emulator out of hvf

2025-02-21 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/hvf/hvf.c | 8 target/i386/hvf/meson.build | 3 --- target/i386/hvf/vmx.h

[RFC PATCH v1 01/19] target/i386/hvf: fix a typo in a type name

2025-02-21 Thread Wei Liu
The prefix x68 is wrong. Change it to x86. Signed-off-by: Wei Liu --- target/i386/hvf/hvf.c | 2 +- target/i386/hvf/x86.c | 4 ++-- target/i386/hvf/x86.h | 8 target/i386/hvf/x86_descr.c | 8 target/i386/hvf/x86_descr.h | 6 +++--- target/i386/hvf

[RFC PATCH v1 15/19] target/i386/hvf: drop some dead code

2025-02-21 Thread Wei Liu
Signed-off-by: Wei Liu --- target/i386/hvf/x86_emu.c | 4 1 file changed, 4 deletions(-) diff --git a/target/i386/hvf/x86_emu.c b/target/i386/hvf/x86_emu.c index 84f97ed386..44ef068bef 100644 --- a/target/i386/hvf/x86_emu.c +++ b/target/i386/hvf/x86_emu.c @@ -1240,10 +1240,6 @@ static void

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

2025-02-21 Thread Wei Liu
elerator. That looks to be a worse option. Thanks, Wei. Wei Liu (19): target/i386/hvf: fix a typo in a type name target/i386/hvf: fix the declaration of hvf_handle_io target/i386/hvf: use x86_segment in x86_decode.c target/i386/hvf: introduce x86_emul_ops target/i386/hvf: remove HVF spec

[RFC PATCH v1 04/19] target/i386/hvf: introduce x86_emul_ops

2025-02-21 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

[RFC PATCH v1 08/19] target/i386: rename hvf_mmio_buf to mmio_buf

2025-02-21 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

[RFC PATCH v1 17/19] target/i386: add a directory for x86 instruction emulator

2025-02-21 Thread Wei Liu
Signed-off-by: Wei Liu --- target/i386/meson.build | 1 + target/i386/x86-insn-emul/meson.build | 0 2 files changed, 1 insertion(+) create mode 100644 target/i386/x86-insn-emul/meson.build diff --git a/target/i386/meson.build b/target/i386/meson.build index 2e9c472f49

[RFC PATCH v1 10/19] taret/i386/hvf: provide and use write_mem in emul_ops

2025-02-21 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 533b05577d..e108e2bbe6 100644 --- a/target

Re: [RFC v3 4/5] virtio: add in_xlat_addr & out_xlat_addr VirtQueueElement members

2025-01-22 Thread Si-Wei Liu
On 1/16/2025 11:02 AM, Eugenio Perez Martin wrote: On Fri, Jan 10, 2025 at 6:09 PM Jonah Palmer wrote: Adds the in_xlat_addr & out_xlat_addr hwaddr arrays to the VirtQueueElement struct and introduces an optional GPA output parameter to dma_memory_map(). These arrays will store a VirtQueue

Re: [RFC v2 1/2] vhost-vdpa: Implement IOVA->GPA tree

2024-10-10 Thread Si-Wei Liu
On 10/9/2024 2:29 AM, Eugenio Perez Martin wrote: On Tue, Oct 8, 2024 at 10:30 PM Si-Wei Liu wrote: On 10/8/2024 8:40 AM, Jonah Palmer wrote: On 10/8/24 2:51 AM, Eugenio Perez Martin wrote: On Tue, Oct 8, 2024 at 2:14 AM Si-Wei Liu wrote: On 10/7/2024 6:51 AM, Eugenio Perez Martin

Re: [RFC v2 1/2] vhost-vdpa: Implement IOVA->GPA tree

2024-10-08 Thread Si-Wei Liu
On 10/8/2024 8:40 AM, Jonah Palmer wrote: On 10/8/24 2:51 AM, Eugenio Perez Martin wrote: On Tue, Oct 8, 2024 at 2:14 AM Si-Wei Liu wrote: On 10/7/2024 6:51 AM, Eugenio Perez Martin wrote: On Fri, Oct 4, 2024 at 8:48 PM Jonah Palmer wrote: On 10/4/24 11:17 AM, Eugenio Perez

Re: [RFC v2 1/2] vhost-vdpa: Implement IOVA->GPA tree

2024-10-07 Thread Si-Wei Liu
On 10/7/2024 6:51 AM, Eugenio Perez Martin wrote: On Fri, Oct 4, 2024 at 8:48 PM Jonah Palmer wrote: On 10/4/24 11:17 AM, Eugenio Perez Martin wrote: On Fri, Oct 4, 2024 at 2:45 PM Jonah Palmer wrote: Implements the IOVA->GPA tree for handling mapping, unmapping, and translations for gu

Re: [RFC 1/2] vhost-vdpa: Decouple the IOVA allocator

2024-09-25 Thread Si-Wei Liu
On 9/11/2024 3:45 AM, Eugenio Perez Martin wrote: On Wed, Sep 11, 2024 at 11:06 AM Si-Wei Liu wrote: On 9/9/2024 11:22 PM, Eugenio Perez Martin wrote: On Tue, Sep 10, 2024 at 7:30 AM Si-Wei Liu wrote: Sorry for the delayed response, it seems I missed the email reply for some reason

Re: [PATCH v2 2/2] net: move backend cleanup to NIC cleanup

2024-09-17 Thread Si-Wei Liu
the first instance of QEMU is finished. Move the cleanup from qemu_cleanup to the NIC deletion and to net_cleanup. Fixes: a0d7215e33 ("vhost-vdpa: do not cleanup the vdpa/vhost-net structures if peer nic is present") Reported-by: Lei Yang Signed-off-by: Eugenio Pérez Reviewed-by: Si-Wei

Re: [RFC 1/2] vhost-vdpa: Decouple the IOVA allocator

2024-09-11 Thread Si-Wei Liu
On 9/9/2024 11:22 PM, Eugenio Perez Martin wrote: On Tue, Sep 10, 2024 at 7:30 AM Si-Wei Liu wrote: Sorry for the delayed response, it seems I missed the email reply for some reason during the long weekend. On 9/2/2024 4:09 AM, Eugenio Perez Martin wrote: On Fri, Aug 30, 2024 at 11:05 PM

Re: [RFC 1/2] vhost-vdpa: Decouple the IOVA allocator

2024-09-09 Thread Si-Wei Liu
Sorry for the delayed response, it seems I missed the email reply for some reason during the long weekend. On 9/2/2024 4:09 AM, Eugenio Perez Martin wrote: On Fri, Aug 30, 2024 at 11:05 PM Si-Wei Liu wrote: On 8/30/2024 1:05 AM, Eugenio Perez Martin wrote: On Fri, Aug 30, 2024 at 6:20 AM

Re: [PATCH 0/2] Move net backend cleanup to NIC cleanup

2024-09-09 Thread Si-Wei Liu
Hi Jason, It seems this series wasn't applied successfully, I still cannot see it from the latest tree. Any idea? In any case the fix LGTM. Reviewed-by: Si-Wei Liu Thanks, -Siwei On 1/31/2024 9:43 PM, Jason Wang wrote: On Mon, Jan 29, 2024 at 9:24 PM Eugenio Pérez wrote: C

Re: [RFC 1/2] vhost-vdpa: Decouple the IOVA allocator

2024-08-30 Thread Si-Wei Liu
On 8/30/2024 1:05 AM, Eugenio Perez Martin wrote: On Fri, Aug 30, 2024 at 6:20 AM Si-Wei Liu wrote: On 8/29/2024 9:53 AM, Eugenio Perez Martin wrote: On Wed, Aug 21, 2024 at 2:56 PM Jonah Palmer wrote: Decouples the IOVA allocator from the IOVA->HVA tree and instead adds the alloca

Re: [RFC 1/2] vhost-vdpa: Decouple the IOVA allocator

2024-08-29 Thread Si-Wei Liu
On 8/29/2024 9:53 AM, Eugenio Perez Martin wrote: On Wed, Aug 21, 2024 at 2:56 PM Jonah Palmer wrote: Decouples the IOVA allocator from the IOVA->HVA tree and instead adds the allocated IOVA range to an IOVA-only tree (iova_map). This IOVA tree will hold all IOVA ranges that have been alloca

Re: [RFC 0/2] Identify aliased maps in vdpa SVQ iova_tree

2024-08-01 Thread Si-Wei Liu
On 8/1/2024 1:22 AM, Eugenio Perez Martin wrote: On Thu, Aug 1, 2024 at 2:41 AM Si-Wei Liu wrote: Hi Jonah, On 7/31/2024 7:09 AM, Jonah Palmer wrote: Let me clarify, correct me if I was wrong: 1) IOVA allocator is still implemented via a tree, we just don't need to store how the IO

Re: [RFC 0/2] Identify aliased maps in vdpa SVQ iova_tree

2024-07-31 Thread Si-Wei Liu
Hi Jonah, On 7/31/2024 7:09 AM, Jonah Palmer wrote: Let me clarify, correct me if I was wrong: 1) IOVA allocator is still implemented via a tree, we just don't need to store how the IOVA is used 2) A dedicated GPA -> IOVA tree, updated via listeners and is used in the datapath SVQ transla

Re: [RFC 1/2] iova_tree: add an id member to DMAMap

2024-05-07 Thread Si-Wei Liu
On 5/1/2024 11:44 PM, Eugenio Perez Martin wrote: On Thu, May 2, 2024 at 1:16 AM Si-Wei Liu wrote: On 4/30/2024 10:19 AM, Eugenio Perez Martin wrote: On Tue, Apr 30, 2024 at 7:55 AM Si-Wei Liu wrote: On 4/29/2024 1:14 AM, Eugenio Perez Martin wrote: On Thu, Apr 25, 2024 at 7:44 PM Si

Re: [RFC 1/2] iova_tree: add an id member to DMAMap

2024-05-07 Thread Si-Wei Liu
On 5/1/2024 11:18 PM, Eugenio Perez Martin wrote: On Thu, May 2, 2024 at 12:09 AM Si-Wei Liu wrote: On 4/30/2024 11:11 AM, Eugenio Perez Martin wrote: On Mon, Apr 29, 2024 at 1:19 PM Jonah Palmer wrote: On 4/29/24 4:14 AM, Eugenio Perez Martin wrote: On Thu, Apr 25, 2024 at 7:44 PM

Re: [RFC 1/2] iova_tree: add an id member to DMAMap

2024-05-01 Thread Si-Wei Liu
On 4/30/2024 10:19 AM, Eugenio Perez Martin wrote: On Tue, Apr 30, 2024 at 7:55 AM Si-Wei Liu wrote: On 4/29/2024 1:14 AM, Eugenio Perez Martin wrote: On Thu, Apr 25, 2024 at 7:44 PM Si-Wei Liu wrote: On 4/24/2024 12:33 AM, Eugenio Perez Martin wrote: On Wed, Apr 24, 2024 at 12:21 AM

Re: [RFC 1/2] iova_tree: add an id member to DMAMap

2024-05-01 Thread Si-Wei Liu
On 4/30/2024 11:11 AM, Eugenio Perez Martin wrote: On Mon, Apr 29, 2024 at 1:19 PM Jonah Palmer wrote: On 4/29/24 4:14 AM, Eugenio Perez Martin wrote: On Thu, Apr 25, 2024 at 7:44 PM Si-Wei Liu wrote: On 4/24/2024 12:33 AM, Eugenio Perez Martin wrote: On Wed, Apr 24, 2024 at 12

Re: [RFC 1/2] iova_tree: add an id member to DMAMap

2024-04-29 Thread Si-Wei Liu
On 4/29/2024 1:14 AM, Eugenio Perez Martin wrote: On Thu, Apr 25, 2024 at 7:44 PM Si-Wei Liu wrote: On 4/24/2024 12:33 AM, Eugenio Perez Martin wrote: On Wed, Apr 24, 2024 at 12:21 AM Si-Wei Liu wrote: On 4/22/2024 1:49 AM, Eugenio Perez Martin wrote: On Sat, Apr 20, 2024 at 1:50 AM

Re: [RFC 1/2] iova_tree: add an id member to DMAMap

2024-04-25 Thread Si-Wei Liu
On 4/24/2024 12:33 AM, Eugenio Perez Martin wrote: On Wed, Apr 24, 2024 at 12:21 AM Si-Wei Liu wrote: On 4/22/2024 1:49 AM, Eugenio Perez Martin wrote: On Sat, Apr 20, 2024 at 1:50 AM Si-Wei Liu wrote: On 4/19/2024 1:29 AM, Eugenio Perez Martin wrote: On Thu, Apr 18, 2024 at 10:46 PM

Re: [RFC 1/2] iova_tree: add an id member to DMAMap

2024-04-23 Thread Si-Wei Liu
On 4/22/2024 1:49 AM, Eugenio Perez Martin wrote: On Sat, Apr 20, 2024 at 1:50 AM Si-Wei Liu wrote: On 4/19/2024 1:29 AM, Eugenio Perez Martin wrote: On Thu, Apr 18, 2024 at 10:46 PM Si-Wei Liu wrote: On 4/10/2024 3:03 AM, Eugenio Pérez wrote: IOVA tree is also used to track the

Re: [RFC 1/2] iova_tree: add an id member to DMAMap

2024-04-19 Thread Si-Wei Liu
On 4/19/2024 1:29 AM, Eugenio Perez Martin wrote: On Thu, Apr 18, 2024 at 10:46 PM Si-Wei Liu wrote: On 4/10/2024 3:03 AM, Eugenio Pérez wrote: IOVA tree is also used to track the mappings of virtio-net shadow virtqueue. This mappings may not match with the GPA->HVA ones. This cause

  1   2   3   4   5   6   >