[PATCH v4 01/33] target/ppc: Fix gen_sc to use correct nip

2024-05-08 Thread BALATON Zoltan
Most exceptions are raised with nip pointing to the faulting instruction but the sc instruction generating a syscall exception leaves nip pointing to next instruction. Fix gen_sc to not use gen_exception_err() which sets nip back but correctly set nip to pc_next so we don't have to patch this in th

[PATCH v4 00/33] Misc PPC exception and BookE MMU clean ups

2024-05-08 Thread BALATON Zoltan
This series does some further clean up mostly around BookE MMU to untangle it from other MMU models. It also contains some other changes that I've come up with while working on this. The Simplify ppc_booke_xlate() part 1 and part 2 patches could be squashed together but left them separate for easie

[PATCH v4 08/33] target/ppc/mmu_common.c: Drop cases for unimplemented MPC8xx MMU

2024-05-08 Thread BALATON Zoltan
Drop MPC8xx cases from get_physical_address_wtlb() and ppc_jumbo_xlate(). The default case would still catch this and abort the same way and there is still a warning about it in ppc_tlb_invalidate_all() which is called in ppc_cpu_reset_hold() so likely we never get here but to make sure add a case

[PATCH v4 30/33] target/ppc/mmu-hash32.c: Drop a local variable

2024-05-08 Thread BALATON Zoltan
In ppc_hash32_xlate() the value of need_prop is checked in two places but precalculating it does not help because when we reach the first check we always return and not reach the second place so the value will only be used once. We can drop the local variable and calculate it when needed, which mak

[PATCH v4 32/33] target/ppc: Add a macro to check for page protection bit

2024-05-08 Thread BALATON Zoltan
Checking if a page protection bit is set for a given access type is a common operation. Add a macro to avoid repeating the same check at multiple places and also avoid a function call. As this relies on access type and page protection bit values having certain relation also add an assert to ensure

[PATCH v4 28/33] target/ppc: Remove id_tlbs flag from CPU env

2024-05-08 Thread BALATON Zoltan
This flag for split instruction/data TLBs is only set for 6xx soft TLB MMU model and not used otherwise so no need to have a separate flag for that. Signed-off-by: BALATON Zoltan Reviewed-by: Nicholas Piggin --- hw/ppc/pegasos2.c| 2 +- target/ppc/cpu.h | 5 - target/ppc/c

[PATCH 1/2] hw/usb/hcd-ohci: Fix #1510, #303: pid not IN or OUT

2024-05-08 Thread David Hubbard
From: Cord Amfmgm This changes the ohci validation to not assert if invalid data is fed to the ohci controller. The poc in https://bugs.launchpad.net/qemu/+bug/1907042 and migrated to bug #303 does the following to feed it a SETUP pid (valid) at an EndPt of 1 (invalid - all SETUP pids must be add

[PATCH 2/2] hw/usb/hcd-ohci: Fix ohci_service_td: accept valid TDs

2024-05-08 Thread David Hubbard
From: Cord Amfmgm This changes the way the ohci emulation handles a Transfer Descriptor with "Current Buffer Pointer" set to "Buffer End" + 1. The OHCI spec 4.3.1.2 Table 4-2 allows td.cbp to be one byte more than td.be to signal the buffer has zero length. Currently qemu only accepts zero-lengt

Re: [PATCH RESEND 0/2] Fix crash of VMs configured with the CDROM device

2024-05-08 Thread Yong Huang
Ping2 Make sure that this patchset is not overlooked. Yong On Tue, Apr 23, 2024 at 9:45 AM Yong Huang wrote: > Ping. > I would appreciate comments on this series. Thanks, > > Yong > > On Mon, Apr 8, 2024 at 8:08 PM Hyman Huang wrote: > >> This patchset fixes the crash of VMs configured with t

Re: [PATCH v8] virtio-pci: fix use of a released vector

2024-05-08 Thread Cindy Lu
On Thu, May 9, 2024 at 4:18 AM Michael Tokarev wrote: > > 15.04.2024 12:34, Michael S. Tsirkin wrote: > > From: Cindy Lu > > > > During the booting process of the non-standard image, the behavior of the > > called function in qemu is as follows: > > > > 1. vhost_net_stop() was triggered by guest

RE: [PATCH] hw/virtio: Fix obtain the buffer id from the last descriptor

2024-05-08 Thread Wafer
On Thu, May, 2024 at 2:21 AM Michael S. Tsirkin wrote: > > On Wed, May 08, 2024 at 02:56:11PM +0200, Eugenio Perez Martin wrote: > > On Mon, Apr 22, 2024 at 3:41 AM Wafer wrote: > > > > > > The virtio-1.3 specification > > > writ

[PATCH 1/3] migration/colo: Minor fix for colo error message

2024-05-08 Thread Li Zhijian via
- Explicitly show the missing module name: replication - Fix capability name to x-colo Signed-off-by: Li Zhijian --- migration/migration.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/migration/migration.c b/migration/migration.c index 6502e169a3..b4a09c561c 100644 -

[PATCH 3/3] migration/colo: Tidy up bql_unlock() around bdrv_activate_all()

2024-05-08 Thread Li Zhijian via
Make the code more tight. Cc: Michael Tokarev Signed-off-by: Li Zhijian --- This change/comment suggested by "Michael Tokarev " came a bit late at that time, let's update it together in these minor set this time. --- migration/colo.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff

[PATCH 2/3] migration/colo: make colo_incoming_co() return void

2024-05-08 Thread Li Zhijian via
Currently, it always returns 0, no need to check the return value at all. In addition, enter colo coroutine only if migration_incoming_colo_enabled() is true. Once the destination side enters the COLO* state, the COLO process will take over the remaining processes until COLO exits. Signed-off-by:

Re: [PATCH] scripts/simpletrace: Mark output with unstable timestamp as WARN

2024-05-08 Thread Zhao Liu
On Wed, May 08, 2024 at 02:05:04PM -0400, Stefan Hajnoczi wrote: > Date: Wed, 8 May 2024 14:05:04 -0400 > From: Stefan Hajnoczi > Subject: Re: [PATCH] scripts/simpletrace: Mark output with unstable > timestamp as WARN > > On Wed, 8 May 2024 at 00:19, Zhao Liu wrote: > > > > In some trace log, t

Re: [PATCH] scripts/simpletrace: Mark output with unstable timestamp as WARN

2024-05-08 Thread Zhao Liu
On Wed, May 08, 2024 at 04:23:00PM +0200, Philippe Mathieu-Daudé wrote: > Date: Wed, 8 May 2024 16:23:00 +0200 > From: Philippe Mathieu-Daudé > Subject: Re: [PATCH] scripts/simpletrace: Mark output with unstable > timestamp as WARN > > On 8/5/24 15:55, Zhao Liu wrote: > > Hi Philippe, > > > > O

RE: [PATCH] hw/virtio: Fix obtain the buffer id from the last descriptor

2024-05-08 Thread Wafer
On Wed, May 08, 2024 at 12:01 PM Jason Wang wrote: > > On Mon, Apr 22, 2024 at 9:41 AM Wafer wrote: > > > > The virtio-1.3 specification > > writes: > > 2.8.6 Next Flag: Descriptor Chaining > > Buffer ID is included in the

Re: [PATCH v8] virtio-pci: fix use of a released vector

2024-05-08 Thread Michael Tokarev
09.05.2024 04:43, Cindy Lu wrote: https://gitlab.com/qemu-project/qemu/-/issues/2321 https://gitlab.com/qemu-project/qemu/-/issues/2334 So something's not right here. I have checked the stack, seems there is a crash while set the vector to NO_VECTOER? #0 kvm_virtio_pci_vq_vector_release (

Re: [PATCH] hw/virtio: Fix obtain the buffer id from the last descriptor

2024-05-08 Thread Eugenio Perez Martin
On Thu, May 9, 2024 at 4:20 AM Wafer wrote: > > > > On Thu, May, 2024 at 2:21 AM Michael S. Tsirkin wrote: > > > > On Wed, May 08, 2024 at 02:56:11PM +0200, Eugenio Perez Martin wrote: > > > On Mon, Apr 22, 2024 at 3:41 AM Wafer wrote: > > > > > > > > The virtio-1.3 specification > > > >

Re: [PATCH] hw/virtio: Fix obtain the buffer id from the last descriptor

2024-05-08 Thread Eugenio Perez Martin
On Thu, May 9, 2024 at 6:32 AM Wafer wrote: > > > > On Wed, May 08, 2024 at 12:01 PM Jason Wang wrote: > > > > On Mon, Apr 22, 2024 at 9:41 AM Wafer wrote: > > > > > > The virtio-1.3 specification > > > writes: > > > 2.8.6 Next Fl

Re: [PATCH v3 01/33] target/ppc: Fix gen_sc to use correct nip

2024-05-08 Thread Nicholas Piggin
On Thu May 9, 2024 at 1:17 AM AEST, BALATON Zoltan wrote: > On Wed, 8 May 2024, Nicholas Piggin wrote: > > On Wed May 8, 2024 at 10:14 AM AEST, BALATON Zoltan wrote: > >> Most exceptions are raised with nip pointing to the faulting > >> instruction but the sc instruction generating a syscall except

Re: [PATCH v3 33/33] target/ppc: Add a macro to check for page protection bit

2024-05-08 Thread Nicholas Piggin
On Thu May 9, 2024 at 1:23 AM AEST, BALATON Zoltan wrote: > On Wed, 8 May 2024, Nicholas Piggin wrote: > > On Wed May 8, 2024 at 10:15 AM AEST, BALATON Zoltan wrote: > >> Checking if a page protection bit is set for a given access type is a > >> common operation. Add a macro to avoid repeating the

Re: [PATCH v3 26/33] target/ppc/mmu_common.c: Simplify ppc_booke_xlate() part 1

2024-05-08 Thread Nicholas Piggin
On Thu May 9, 2024 at 1:25 AM AEST, BALATON Zoltan wrote: > On Wed, 8 May 2024, Nicholas Piggin wrote: > > On Wed May 8, 2024 at 10:15 AM AEST, BALATON Zoltan wrote: > >> Move setting error_code that appears in every case out in front and > >> hoist the common fall through case for BOOKE206 as well

Re: [PATCH v2 26/28] target/ppc/mmu_common.c: Move BookE MMU functions together

2024-05-08 Thread Nicholas Piggin
On Thu May 9, 2024 at 9:33 AM AEST, BALATON Zoltan wrote: > On Wed, 8 May 2024, Nicholas Piggin wrote: > > On Tue May 7, 2024 at 10:31 PM AEST, BALATON Zoltan wrote: > >> On Tue, 7 May 2024, Nicholas Piggin wrote: > >>> What do you think about adding mmu-book3e.c instead? > >> > >> I have considere

Re: [PATCH v3 33/33] target/ppc: Add a macro to check for page protection bit

2024-05-08 Thread Nicholas Piggin
On Thu May 9, 2024 at 9:35 AM AEST, BALATON Zoltan wrote: > On Wed, 8 May 2024, Nicholas Piggin wrote: > > On Wed May 8, 2024 at 10:15 AM AEST, BALATON Zoltan wrote: > >> Checking if a page protection bit is set for a given access type is a > >> common operation. Add a macro to avoid repeating the

Re: [PATCH v4 08/33] target/ppc/mmu_common.c: Drop cases for unimplemented MPC8xx MMU

2024-05-08 Thread Nicholas Piggin
On Thu May 9, 2024 at 9:36 AM AEST, BALATON Zoltan wrote: > Drop MPC8xx cases from get_physical_address_wtlb() and ppc_jumbo_xlate(). > The default case would still catch this and abort the same way and > there is still a warning about it in ppc_tlb_invalidate_all() which is > called in ppc_cpu_res

Re: [PATCH v4 11/33] target/ppc/mmu_common.c: Move some debug logging

2024-05-08 Thread Nicholas Piggin
On Thu May 9, 2024 at 9:36 AM AEST, BALATON Zoltan wrote: > Move the debug logging within ppc6xx_tlb_check() from after its only > call to simplify the caller. > > Signed-off-by: BALATON Zoltan Reviewed-by: Nicholas Piggin > --- > target/ppc/mmu_common.c | 54 ++

Re: [PATCH v4 19/33] target/ppc/mmu_common.c: Don't use mmu_ctx_t for mmu40x_get_physical_address()

2024-05-08 Thread Nicholas Piggin
On Thu May 9, 2024 at 9:36 AM AEST, BALATON Zoltan wrote: > mmu40x_get_physical_address() only uses the raddr and prot fields from > mmu_ctx_t. Pass these directly instead of using a ctx struct. > > Signed-off-by: BALATON Zoltan > --- > target/ppc/mmu_common.c | 38 --

Re: [PATCH v4 20/33] target/ppc/mmu_common.c: Don't use mmu_ctx_t in mmubooke_get_physical_address()

2024-05-08 Thread Nicholas Piggin
On Thu May 9, 2024 at 9:36 AM AEST, BALATON Zoltan wrote: > mmubooke_get_physical_address() only uses the raddr and prot fields > from mmu_ctx_t. Pass these directly instead of using a ctx struct. Reviewed-by: Nicholas Piggin > > Signed-off-by: BALATON Zoltan > --- > target/ppc/mmu_common.c |

Re: [PATCH v4 21/33] target/ppc/mmu_common.c: Don't use mmu_ctx_t in mmubooke206_get_physical_address()

2024-05-08 Thread Nicholas Piggin
On Thu May 9, 2024 at 9:36 AM AEST, BALATON Zoltan wrote: > mmubooke206_get_physical_address() only uses the raddr and prot fields > from mmu_ctx_t. Pass these directly instead of using a ctx struct. > Reviewed-by: Nicholas Piggin > Signed-off-by: BALATON Zoltan > --- > target/ppc/mmu_common.c

Re: [PATCH v4 22/33] target/ppc/mmu_common.c: Make get_physical_address_wtlb() static

2024-05-08 Thread Nicholas Piggin
On Thu May 9, 2024 at 9:36 AM AEST, BALATON Zoltan wrote: > This function is not used from any other files so make it static and > fix the maybe used uninitialised warnings this has uncovered. Also > remove mmu_ctx_t definition from internal.h as this type is only used > within this file. get_phys

Re: [PATCH v4 25/33] target/ppc/mmu_common.c: Split off BookE handling from ppc_jumbo_xlate()

2024-05-08 Thread Nicholas Piggin
On Thu May 9, 2024 at 9:36 AM AEST, BALATON Zoltan wrote: > Introduce ppc_booke_xlate() to handle BookE and BookE 2.06 cases to > reduce ppc_jumbo_xlate() further. > Reviewed-by: Nicholas Piggin > Signed-off-by: BALATON Zoltan > --- > target/ppc/mmu_common.c | 148 ++---

Re: [PATCH v4 27/33] target/ppc/mmu_common.c: Simplify ppc_booke_xlate() part 2

2024-05-08 Thread Nicholas Piggin
On Thu May 9, 2024 at 9:36 AM AEST, BALATON Zoltan wrote: > Merge the code fetch and data access cases in a common switch. > > Signed-off-by: BALATON Zoltan Reviewed-by: Nicholas Piggin > --- > target/ppc/mmu_common.c | 52 - > 1 file changed, 20 inserti

Re: [PATCH v4 33/33] target/ppc: Move out BookE and related MMU functions from mmu_common.c

2024-05-08 Thread Nicholas Piggin
On Thu May 9, 2024 at 9:36 AM AEST, BALATON Zoltan wrote: > Add a new mmu-booke.c file for BookE and related MMU bits from > mmu_common.c. > Nice work. Acked-by: Nicholas Piggin > Signed-off-by: BALATON Zoltan > --- > target/ppc/cpu.h| 4 - > target/ppc/meson.build | 1 + > target

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

2024-05-08 Thread Jason Wang
On Thu, May 9, 2024 at 1:16 AM Eugenio Perez Martin wrote: > > On Wed, May 8, 2024 at 4:29 AM Jason Wang wrote: > > > > On Tue, May 7, 2024 at 6:57 PM Eugenio Perez Martin > > wrote: > > > > > > On Tue, May 7, 2024 at 9:29 AM Jason Wang wrote: > > > > > > > > On Fri, Apr 12, 2024 at 3:56 PM Eu

<    1   2   3   4