[PATCH v2 31/51] migration: Export ram_release_page()

2022-12-05 Thread Juan Quintela
Signed-off-by: Juan Quintela Reviewed-by: Leonardo Bras --- migration/ram.h | 1 + migration/ram.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/migration/ram.h b/migration/ram.h index e844966f69..038d52f49f 100644 --- a/migration/ram.h +++ b/migration/ram.h @@ -66,6 +66,

[PATCH v2 47/51] migration: Remove res_compatible parameter

2022-12-05 Thread Juan Quintela
It was only used for RAM, and in that case, it means that this amount of data was sent for memory. Just delete the field in all callers. Signed-off-by: Juan Quintela --- include/migration/register.h | 20 ++-- migration/savevm.h | 4 +--- hw/s390x/s390-stattrib.c

[PATCH v2 46/51] migration: Drop rs->f

2022-12-05 Thread Juan Quintela
From: Peter Xu Now with rs->pss we can already cache channels in pss->pss_channels. That pss_channel contains more infromation than rs->f because it's per-channel. So rs->f could be replaced by rss->pss[RAM_CHANNEL_PRECOPY].pss_channel, while rs->f itself is a bit vague now. Note that vanilla p

[PATCH v2 43/51] migration: Move last_sent_block into PageSearchStatus

2022-12-05 Thread Juan Quintela
From: Peter Xu Since we use PageSearchStatus to represent a channel, it makes perfect sense to keep last_sent_block (aka, leverage RAM_SAVE_FLAG_CONTINUE) to be per-channel rather than global because each channel can be sending different pages on ramblocks. Hence move it from RAMState into PageS

[PATCH v2 17/51] hw/nvme: fix aio cancel in format

2022-12-05 Thread Juan Quintela
From: Klaus Jensen There are several bugs in the async cancel code for the Format command. Firstly, cancelling a format operation neglects to set iocb->ret as well as clearing the iocb->aiocb after cancelling the underlying aiocb which causes the aio callback to ignore the cancellation. Trivial

[PATCH v2 45/51] migration: Remove old preempt code around state maintainance

2022-12-05 Thread Juan Quintela
From: Peter Xu With the new code to send pages in rp-return thread, there's little help to keep lots of the old code on maintaining the preempt state in migration thread, because the new way should always be faster.. Then if we'll always send pages in the rp-return thread anyway, we don't need t

[PATCH v2 28/51] multifd: Create page_size fields into both MultiFD{Recv, Send}Params

2022-12-05 Thread Juan Quintela
We were calling qemu_target_page_size() left and right. Signed-off-by: Juan Quintela Reviewed-by: Leonardo Bras --- migration/multifd.h | 4 migration/multifd-zlib.c | 14 ++ migration/multifd-zstd.c | 12 +--- migration/multifd.c | 18 -- 4 f

[PATCH v2 32/51] migration: Take bitmap mutex when completing ram migration

2022-12-05 Thread Juan Quintela
From: Peter Xu Any call to ram_find_and_save_block() needs to take the bitmap mutex. We used to not take it for most of ram_save_complete() because we thought we're the only one left using the bitmap, but it's not true after the preempt full patchset applied, since the return path can be taking

[PATCH v2 24/51] hw/loongarch/virt: Add cfi01 pflash device

2022-12-05 Thread Juan Quintela
From: Xiaojuan Yang Add cfi01 pflash device for LoongArch virt machine Signed-off-by: Xiaojuan Yang Reviewed-by: Philippe Mathieu-Daudé Message-Id: <20221130100647.398565-1-yangxiaoj...@loongson.cn> Signed-off-by: Song Gao --- include/hw/loongarch/virt.h | 5 +++ hw/loongarch/acpi-build.c

[PATCH v2 40/51] migration: Introduce pss_channel

2022-12-05 Thread Juan Quintela
From: Peter Xu Introduce pss_channel for PageSearchStatus, define it as "the migration channel to be used to transfer this host page". We used to have rs->f, which is a mirror to MigrationState.to_dst_file. After postcopy preempt initial version, rs->f can be dynamically changed depending on wh

[PATCH v2 09/51] block-backend: avoid bdrv_unregister_buf() NULL pointer deref

2022-12-05 Thread Juan Quintela
From: Stefan Hajnoczi bdrv_*() APIs expect a valid BlockDriverState. Calling them with bs=NULL leads to undefined behavior. Jonathan Cameron reported this following NULL pointer dereference when a VM with a virtio-blk device and a memory-backend-file object is terminated: 1. qemu_cleanup() close

[PATCH v2 14/51] hw/virtio: add started_vu status field to vhost-user-gpio

2022-12-05 Thread Juan Quintela
From: Alex Bennée As per the fix to vhost-user-blk in f5b22d06fb (vhost: recheck dev state in the vhost_migration_log routine) we really should track the connection and starting separately. Signed-off-by: Alex Bennée Reviewed-by: Michael S. Tsirkin Message-Id: <20221130112439.2527228-4-alex.be

[PATCH v2 21/51] hw/nvme: remove copy bh scheduling

2022-12-05 Thread Juan Quintela
From: Klaus Jensen Fix a potential use-after-free by removing the bottom half and enqueuing the completion directly. Fixes: 796d20681d9b ("hw/nvme: reimplement the copy command to allow aio cancellation") Reviewed-by: Keith Busch Signed-off-by: Klaus Jensen --- hw/nvme/ctrl.c | 63 ++

Re: [PATCH v2 00/51] migration patches for VFIO

2022-12-05 Thread Juan Quintela
Juan Quintela wrote: > Hi Nack myself This patch series should be sent against my next-8.0 branch, not master. Sorry for the noise. Will resend. > > On this v2: > > - Remove the stop of the guest to calculate the size > - Rebase on latest upstream. > > Please review. > > [v1/RFC] > VFIO migra

[PATCH v2 36/51] migration: Remove RAMState.f references in compression code

2022-12-05 Thread Juan Quintela
From: Peter Xu Removing referencing to RAMState.f in compress_page_with_multi_thread() and flush_compressed_data(). Compression code by default isn't compatible with having >1 channels (or it won't currently know which channel to flush the compressed data), so to make it simple we always flush o

[PATCH v2 33/51] migration: Add postcopy_preempt_active()

2022-12-05 Thread Juan Quintela
From: Peter Xu Add the helper to show that postcopy preempt enabled, meanwhile active. Reviewed-by: Dr. David Alan Gilbert Signed-off-by: Peter Xu Reviewed-by: Juan Quintela Signed-off-by: Juan Quintela --- migration/ram.c | 9 +++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff

[PATCH v2 20/51] hw/nvme: fix aio cancel in dsm

2022-12-05 Thread Juan Quintela
From: Klaus Jensen When the DSM operation is cancelled asynchronously, we set iocb->ret to -ECANCELED. However, the callback function only checks the return value of the completed aio, which may have completed succesfully prior to the cancellation and thus the callback ends up continuing the dsm

[PATCH v2 15/51] hw/virtio: generalise CHR_EVENT_CLOSED handling

2022-12-05 Thread Juan Quintela
From: Alex Bennée ..and use for both virtio-user-blk and virtio-user-gpio. This avoids the circular close by deferring shutdown due to disconnection until a later point. virtio-user-blk already had this mechanism in place so generalise it as a vhost-user helper function and use for both blk and g

[PATCH v2 37/51] migration: Yield bitmap_mutex properly when sending/sleeping

2022-12-05 Thread Juan Quintela
From: Peter Xu Don't take the bitmap mutex when sending pages, or when being throttled by migration_rate_limit() (which is a bit tricky to call it here in ram code, but seems still helpful). It prepares for the possibility of concurrently sending pages in >1 threads using the function ram_save_h

[PATCH v2 06/51] hw/display/qxl: Pass requested buffer size to qxl_phys2virt()

2022-12-05 Thread Juan Quintela
From: Philippe Mathieu-Daudé Currently qxl_phys2virt() doesn't check for buffer overrun. In order to do so in the next commit, pass the buffer size as argument. For QXLCursor in qxl_render_cursor() -> qxl_cursor() we verify the size of the chunked data ahead, checking we can access 'sizeof(QXLCu

[PATCH v2 04/51] hw/display/qxl: Have qxl_log_command Return early if no log_cmd handler

2022-12-05 Thread Juan Quintela
From: Philippe Mathieu-Daudé Only 3 command types are logged: no need to call qxl_phys2virt() for the other types. Using different cases will help to pass different structure sizes to qxl_phys2virt() in a pair of commits. Reviewed-by: Marc-André Lureau Signed-off-by: Philippe Mathieu-Daudé Sig

[PATCH v2 13/51] vhost: enable vrings in vhost_dev_start() for vhost-user devices

2022-12-05 Thread Juan Quintela
From: Stefano Garzarella Commit 02b61f38d3 ("hw/virtio: incorporate backend features in features") properly negotiates VHOST_USER_F_PROTOCOL_FEATURES with the vhost-user backend, but we forgot to enable vrings as specified in docs/interop/vhost-user.rst: If ``VHOST_USER_F_PROTOCOL_FEATURES``

[PATCH v2 18/51] hw/nvme: fix aio cancel in flush

2022-12-05 Thread Juan Quintela
From: Klaus Jensen Make sure that iocb->aiocb is NULL'ed when cancelling. Fix a potential use-after-free by removing the bottom half and enqueuing the completion directly. Fixes: 38f4ac65ac88 ("hw/nvme: reimplement flush to allow cancellation") Reviewed-by: Keith Busch Signed-off-by: Klaus Jen

[PATCH v2 16/51] include/hw: VM state takes precedence in virtio_device_should_start

2022-12-05 Thread Juan Quintela
From: Alex Bennée The VM status should always preempt the device status for these checks. This ensures the device is in the correct state when we suspend the VM prior to migrations. This restores the checks to the order they where in before the refactoring moved things around. While we are at it

[PATCH v2 12/51] tests/qtests: override "force-legacy" for gpio virtio-mmio tests

2022-12-05 Thread Juan Quintela
From: Alex Bennée The GPIO device is a VIRTIO_F_VERSION_1 devices but running with a legacy MMIO interface we miss out that feature bit causing confusion. For the GPIO test force the mmio bus to support non-legacy so we can properly test it. Signed-off-by: Alex Bennée Reviewed-by: Michael S. Ts

[PATCH v2 07/51] hw/display/qxl: Avoid buffer overrun in qxl_phys2virt (CVE-2022-4144)

2022-12-05 Thread Juan Quintela
From: Philippe Mathieu-Daudé Have qxl_get_check_slot_offset() return false if the requested buffer size does not fit within the slot memory region. Similarly qxl_phys2virt() now returns NULL in such case, and qxl_dirty_one_surface() aborts. This avoids buffer overrun in the host pointer returne

Re: [PATCH for-7.2] vhost: enable vrings in vhost_dev_start() for vhost-user devices

2022-12-05 Thread Stefano Garzarella
On Thu, Dec 01, 2022 at 04:49:37PM -0500, Michael S. Tsirkin wrote: On Thu, Dec 01, 2022 at 12:21:21PM +, Alex Bennée wrote: "Michael S. Tsirkin" writes: > On Thu, Dec 01, 2022 at 10:14:39AM +, Alex Bennée wrote: >> Do you think rust-vmm's vhost crates have enough of the state >> mana

Re: [PATCH v10 5/9] KVM: Use gfn instead of hva for mmu_notifier_retry

2022-12-05 Thread Fuad Tabba
Hi Chao, On Fri, Dec 2, 2022 at 6:19 AM Chao Peng wrote: > > Currently in mmu_notifier invalidate path, hva range is recorded and > then checked against by mmu_notifier_retry_hva() in the page fault > handling path. However, for the to be introduced private memory, a page > fault may not have a h

Re: [PULL for 7.2-rc4 0/1] loongarch for 7.2-rc4 patch

2022-12-05 Thread gaos...@loongson.cn
在 2022/12/5 15:24, Philippe Mathieu-Daudé 写道: On 2/12/22 11:25, Song Gao wrote: The following changes since commit c4ffd91aba1c3d878e99a3e7ba8aad4826728ece:    Update VERSION for v7.2.0-rc3 (2022-11-29 18:15:26 -0500) are available in the Git repository at:    https://gitlab.com/gaosong/qe

RE: [PATCH] target/i386/hax: Add XCR0 support

2022-12-05 Thread Wang, Wenchao
Thanks for Phillippe's reply. Hi, Paolo, Could you help to review the patch of HAX? If there is any concern about it, feel free to discuss with me. Thanks a lot. Best Regards, Wenchao -Original Message- From: Philippe Mathieu-Daudé Sent: Monday, December 5, 2022 17:05 To: Wang, Wenc

Re: [PATCH] target/i386/hax: Add XCR0 support

2022-12-05 Thread Philippe Mathieu-Daudé
Hi Wenchao, On 5/12/22 09:35, Wang, Wenchao wrote: Hi, Philippe, Do you agree with my opinion and is there any further process that I need to follow to get this patch merged? Thanks a lot. I don't understand this part of HAXM enough, but per your explanation, your change looks correct. I'll

Re: [PATCH v10 3/9] KVM: Extend the memslot to support fd-based private memory

2022-12-05 Thread Fuad Tabba
Hi Chao, On Fri, Dec 2, 2022 at 6:18 AM Chao Peng wrote: > > In memory encryption usage, guest memory may be encrypted with special > key and can be accessed only by the guest itself. We call such memory > private memory. It's valueless and sometimes can cause problem to allow > userspace to acce

Re: [RFC 0/5] Protection information pass-through for block devices

2022-12-05 Thread Dmitry Tihov
On Fri, Nov 25, 2022 at 08:44:18, Klaus Jensen wrote: > +CC: block layer maintainers (Kevin, Hanna) > > On Nov 24 18:58, Dmitry Tihov wrote: > > This patch set allows using End-to-End Data Protection in NVMe subsystem > > with integrity capable host devices as the NVMe namespaces backend. > > The

[PATCH v10 3/5] vdpa: add vdpa-dev-pci support

2022-12-05 Thread Longpeng(Mike)
From: Longpeng Supports vdpa-dev-pci, we can use the device as follow: -device vhost-vdpa-device-pci,vhostdev=/dev/vhost-vdpa-X Reviewed-by: Stefano Garzarella Acked-by: Jason Wang Signed-off-by: Longpeng --- hw/virtio/meson.build| 1 + hw/virtio/vdpa-dev-pci.c | 102 +

[PATCH v10 4/5] vdpa-dev: mark the device as unmigratable

2022-12-05 Thread Longpeng(Mike)
From: Longpeng The generic vDPA device doesn't support migration currently, so mark it as unmigratable temporarily. Reviewed-by: Stefano Garzarella Acked-by: Jason Wang Signed-off-by: Longpeng --- hw/virtio/vdpa-dev.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/virtio/vdpa-dev.c b

[PATCH v10 5/5] docs: Add generic vhost-vdpa device documentation

2022-12-05 Thread Longpeng(Mike)
From: Longpeng Signed-off-by: Longpeng --- .../devices/vhost-vdpa-generic-device.rst | 66 +++ 1 file changed, 66 insertions(+) create mode 100644 docs/system/devices/vhost-vdpa-generic-device.rst diff --git a/docs/system/devices/vhost-vdpa-generic-device.rst b/docs/syste

[PATCH v10 2/5] vdpa: add vdpa-dev support

2022-12-05 Thread Longpeng(Mike)
From: Longpeng Supports vdpa-dev, we can use the deivce directly: -M microvm -m 512m -smp 2 -kernel ... -initrd ... -device \ vhost-vdpa-device,vhostdev=/dev/vhost-vdpa-x Reviewed-by: Stefano Garzarella Acked-by: Jason Wang Signed-off-by: Longpeng --- hw/virtio/Kconfig| 5 + h

[PATCH v10 1/5] virtio: get class_id and pci device id by the virtio id

2022-12-05 Thread Longpeng(Mike)
From: Longpeng Add helpers to get the "Transitional PCI Device ID" and "class_id" of the device specified by the "Virtio Device ID". These helpers will be used to build the generic vDPA device later. Acked-by: Jason Wang Signed-off-by: Longpeng --- hw/virtio/virtio-pci.c | 88 +++

[PATCH v10 0/5] add generic vDPA device support

2022-12-05 Thread Longpeng(Mike)
From: Longpeng Hi guys, With the generic vDPA device, QEMU won't need to touch the device types any more, such like vfio. We can use the generic vDPA device as follow: -device vhost-vdpa-device-pci,vhostdev=/dev/vhost-vdpa-X Or -M microvm -m 512m -smp 2 -kernel ... -initrd ... -device \

RE: [PATCH] target/i386/hax: Add XCR0 support

2022-12-05 Thread Wang, Wenchao
Hi, Philippe, Do you agree with my opinion and is there any further process that I need to follow to get this patch merged? Thanks a lot. Best Regards, Wenchao -Original Message- From: Wang, Wenchao Sent: Monday, November 28, 2022 16:11 To: Philippe Mathieu-Daudé ; qemu-devel@nongnu.o

Re: REG: TTC Timer

2022-12-05 Thread Philippe Mathieu-Daudé
On 22/11/22 12:27, Gowri Shankar wrote: Hi Team, Advance Thanks for Your support. Could you please clarify one point here? I am using a Xilinx ZCU102 machine with QEMU7.1.0. I have seen QEMU 7.1.0 release has TTC timers for the Xilinx-zynqmp SoC model. url: https://wiki.qemu.org/ChangeLog/7.1

Re: [PATCH 15/15] hw/intc: sifive_plic: Fix the pending register range check

2022-12-05 Thread Bin Meng
On Fri, Dec 2, 2022 at 8:28 AM Wilfred Mallawa wrote: > > On Thu, 2022-12-01 at 22:08 +0800, Bin Meng wrote: > > The pending register upper limit is currently set to > > plic->num_sources >> 3, which is wrong, e.g.: considering > > plic->num_sources is 7, the upper limit becomes 0 which fails > >

<    1   2   3