Re: [PATCH] hw/vfio: fix iteration over global VFIODevice list

2024-01-01 Thread Cédric Le Goater
On 12/29/23 21:38, Volker Rümelin wrote: Commit 3d779abafe ("vfio/common: Introduce a global VFIODevice list") introduced a global VFIODevice list, but forgot to update the list element field name when iterating over the new list. Change the code to use the correct list element field. Fixes:

RE: FW: [PATCH] vhost-user: add VIRTIO_F_IN_ORDER and VIRTIO_F_NOTIFICATION_DATA feature

2024-01-01 Thread Wentao Jia
--- hw/net/vhost_net.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c index e8e1661646..211ca859a6 100644 --- a/hw/net/vhost_net.c +++ b/hw/net/vhost_net.c @@ -76,6 +76,8 @@ static const int user_feature_bits[] = { VIRTIO_F_IOMMU_PLATFORM,

Re: [PATCH for 9.0 08/12] vdpa: add vhost_vdpa_load_setup

2024-01-01 Thread Peter Xu
Jason, Eugenio, Apologies for a late reply; just back from the long holiday. On Thu, Dec 21, 2023 at 09:20:40AM +0100, Eugenio Perez Martin wrote: > Si-Wei did the actual profiling as he is the one with the 128G guests, > but most of the time was spent in the memory pinning. Si-Wei, please >

RE: [PATCH] hw/vfio: fix iteration over global VFIODevice list

2024-01-01 Thread Duan, Zhenzhong
>-Original Message- >From: Volker Rümelin >Subject: [PATCH] hw/vfio: fix iteration over global VFIODevice list > >Commit 3d779abafe ("vfio/common: Introduce a global VFIODevice list") >introduced a global VFIODevice list, but forgot to update the list >element field name when iterating

Re: [PATCH v3 8/9] target/loongarch: Implement set vcpu intr for kvm

2024-01-01 Thread gaosong
This patch also broken 'loongarch64-linux-user' build 在 2023/12/28 下午4:40, Tianrui Zhao 写道: Implement loongarch kvm set vcpu interrupt interface, when a irq is set in vcpu, we use the KVM_INTERRUPT ioctl to set intr into kvm. Signed-off-by: Tianrui Zhao Signed-off-by: xianglai li ---

Re: [PATCH v3 9/9] target/loongarch: Add loongarch kvm into meson build

2024-01-01 Thread gaosong
Hi,  TianRui 在 2023/12/28 下午4:40, Tianrui Zhao 写道: Add kvm.c into meson.build to compile it when kvm is configed. Meanwhile in meson.build, we set the kvm_targets to loongarch64-softmmu when the cpu is loongarch. And fix the compiling error when config is enable-kvm,disable-tcg. Signed-off-by:

[PATCH] virtio-net: correctly copy vnet header when flushing TX

2024-01-01 Thread Jason Wang
When HASH_REPORT is negotiated, the guest_hdr_len might be larger than the size of the mergeable rx buffer header. Using virtio_net_hdr_mrg_rxbuf during the header swap might lead a stack overflow in this case. Fixing this by using virtio_net_hdr_v1_hash instead. Reported-by: Xiao Lei Cc: Yuri

[PATCH v2 2/2] target/loongarch: move translate modules to tcg/

2024-01-01 Thread Song Gao
Introduce the target/loongarch/tcg directory. Its purpose is to hold the TCG code that is selected by CONFIG_TCG Signed-off-by: Song Gao --- target/loongarch/{ => tcg}/constant_timer.c | 0 target/loongarch/{ => tcg}/csr_helper.c | 0 target/loongarch/{ => tcg}/fpu_helper.c | 0

[PATCH v2 1/2] target/loongarch/meson: move gdbstub.c to loongarch.ss

2024-01-01 Thread Song Gao
gdbstub.c is not specific to TCG and can be used by other accelerators, such as KVM accelerator Suggested-by: Philippe Mathieu-Daudé Signed-off-by: Song Gao --- target/loongarch/meson.build | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/target/loongarch/meson.build

[PATCH v3 31/33] linux-user: Bound mmap_min_addr by host page size

2024-01-01 Thread Richard Henderson
Bizzarely, it is possible to set /proc/sys/vm/mmap_min_addr to a value below the host page size. Fix that. Signed-off-by: Richard Henderson --- linux-user/main.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linux-user/main.c b/linux-user/main.c index

[PATCH v3 30/33] target/arm: Enable TARGET_PAGE_BITS_VARY for AArch64 user-only

2024-01-01 Thread Richard Henderson
Since aarch64 binaries are generally built for multiple page sizes, it is trivial to allow the page size to vary. Signed-off-by: Richard Henderson --- target/arm/cpu-param.h | 6 - target/arm/cpu.c | 51 -- 2 files changed, 34 insertions(+), 23

[PATCH v3 04/33] linux-user: Remove qemu_host_page_size from create_elf_tables

2024-01-01 Thread Richard Henderson
AT_PAGESZ is supposed to advertise the guest page size. The random adjustment made here using qemu_host_page_size does not match anything else within linux-user. The idea here is good, but should be done more systemically via adjustment to TARGET_PAGE_SIZE. Signed-off-by: Richard Henderson ---

[PATCH v3 09/33] linux-user: Remove REAL_HOST_PAGE_ALIGN from mmap.c

2024-01-01 Thread Richard Henderson
We already have qemu_real_host_page_size() in a local variable. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- linux-user/mmap.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linux-user/mmap.c b/linux-user/mmap.c index 4d3c8717b9..53e5486cc8

[PATCH v3 32/33] target/ppc: Enable TARGET_PAGE_BITS_VARY for user-only

2024-01-01 Thread Richard Henderson
Since ppc binaries are generally built for multiple page sizes, it is trivial to allow the page size to vary. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- target/ppc/cpu-param.h | 9 - 1 file changed, 8 insertions(+), 1 deletion(-) diff --git

[PATCH v3 06/33] linux-user/nios2: Remove qemu_host_page_size from init_guest_commpage

2024-01-01 Thread Richard Henderson
Use qemu_real_host_page_size. If !reserved_va, use MAP_FIXED_NOREPLACE. Signed-off-by: Richard Henderson --- linux-user/elfload.c | 14 +- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/linux-user/elfload.c b/linux-user/elfload.c index 96d8d4f84c..4fcc490ce6 100644

[PATCH v3 25/33] tests/tcg: Extend file in linux-madvise.c

2024-01-01 Thread Richard Henderson
When guest page size > host page size, this test can fail due to the SIGBUS protection hack. Avoid this by making sure that the file size is at least one guest page. Visible with alpha guest on x86_64 host. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson ---

[PATCH v3 23/33] linux-user: Split out mmap_h_gt_g

2024-01-01 Thread Richard Henderson
Signed-off-by: Richard Henderson --- linux-user/mmap.c | 288 ++ 1 file changed, 139 insertions(+), 149 deletions(-) diff --git a/linux-user/mmap.c b/linux-user/mmap.c index 8b0a26e50d..552656edd4 100644 --- a/linux-user/mmap.c +++ b/linux-user/mmap.c

[PATCH v3 24/33] tests/tcg: Remove run-test-mmap-*

2024-01-01 Thread Richard Henderson
These tests are confused, because -p does not change the guest page size, but the host page size. Signed-off-by: Richard Henderson --- tests/tcg/alpha/Makefile.target | 3 --- tests/tcg/arm/Makefile.target | 3 --- tests/tcg/hppa/Makefile.target | 3 ---

[PATCH v3 27/33] cpu: Remove page_size_init

2024-01-01 Thread Richard Henderson
Move qemu_host_page_{size,mask} and HOST_PAGE_ALIGN into bsd-user. It should be removed from bsd-user as well, but defer that cleanup. Reviewed-by: Warner Losh Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- bsd-user/qemu.h | 7 +++

[PATCH v3 02/33] linux-user: Adjust SVr4 NULL page mapping

2024-01-01 Thread Richard Henderson
Use TARGET_PAGE_SIZE and MAP_FIXED_NOREPLACE. We really should be attending to this earlier during probe_guest_base, as well as better detection and emulation of various Linux personalities. Signed-off-by: Richard Henderson --- linux-user/elfload.c | 5 +++-- 1 file changed, 3 insertions(+), 2

[PATCH v3 26/33] *-user: Deprecate and disable -p pagesize

2024-01-01 Thread Richard Henderson
This option controls the host page size. From the mis-usage in our own testsuite, this is easily confused with guest page size. The only thing that occurs when changing the host page size is that stuff breaks, because one cannot actually change the host page size. Therefore reject all but the

[PATCH v3 28/33] accel/tcg: Disconnect TargetPageDataNode from page size

2024-01-01 Thread Richard Henderson
Dynamically size the node for the runtime target page size. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- accel/tcg/user-exec.c | 13 - 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/accel/tcg/user-exec.c b/accel/tcg/user-exec.c index

[PATCH v3 13/33] softmmu/physmem: Remove qemu_host_page_size

2024-01-01 Thread Richard Henderson
Use qemu_real_host_page_size() instead. Signed-off-by: Richard Henderson --- system/physmem.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/system/physmem.c b/system/physmem.c index a63853a7bc..c09953270f 100644 --- a/system/physmem.c +++ b/system/physmem.c @@ -3520,7

[PATCH v3 22/33] linux-user: Split out mmap_h_lt_g

2024-01-01 Thread Richard Henderson
Work much harder to get alignment and mapping beyond the end of the file correct. Both of which are excercised by our test-mmap for alpha (8k pages) on any 4k page host. Signed-off-by: Richard Henderson --- linux-user/mmap.c | 156 +- 1 file changed,

[PATCH v3 12/33] hw/tpm: Remove HOST_PAGE_ALIGN from tpm_ppi_init

2024-01-01 Thread Richard Henderson
The size of the allocation need not match the alignment. Signed-off-by: Richard Henderson --- hw/tpm/tpm_ppi.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/hw/tpm/tpm_ppi.c b/hw/tpm/tpm_ppi.c index 7f74e26ec6..91eeafd53a 100644 --- a/hw/tpm/tpm_ppi.c +++

[PATCH v3 33/33] target/alpha: Enable TARGET_PAGE_BITS_VARY for user-only

2024-01-01 Thread Richard Henderson
Since alpha binaries are generally built for multiple page sizes, it is trivial to allow the page size to vary. Signed-off-by: Richard Henderson --- target/alpha/cpu-param.h | 16 ++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/target/alpha/cpu-param.h

[PATCH v3 21/33] linux-user: Split out mmap_h_eq_g

2024-01-01 Thread Richard Henderson
Move the MAX_FIXED_NOREPLACE check for reserved_va earlier. Move the computation of host_prot earlier. Signed-off-by: Richard Henderson --- linux-user/mmap.c | 66 +-- 1 file changed, 53 insertions(+), 13 deletions(-) diff --git a/linux-user/mmap.c

[PATCH v3 29/33] linux-user: Allow TARGET_PAGE_BITS_VARY

2024-01-01 Thread Richard Henderson
If set, match the host and guest page sizes. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- linux-user/main.c | 16 +--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/linux-user/main.c b/linux-user/main.c index 9ba4dc5872..d00a0d7d1f

[PATCH v3 16/33] linux-user: Split out target_mmap__locked

2024-01-01 Thread Richard Henderson
All "goto fail" may be transformed to "return -1". Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- linux-user/mmap.c | 62 ++- 1 file changed, 35 insertions(+), 27 deletions(-) diff --git a/linux-user/mmap.c

[PATCH v3 10/33] linux-user: Remove HOST_PAGE_ALIGN from mmap.c

2024-01-01 Thread Richard Henderson
This removes a hidden use of qemu_host_page_size, using instead the existing host_page_size local within each function. Signed-off-by: Richard Henderson --- linux-user/mmap.c | 13 ++--- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/linux-user/mmap.c b/linux-user/mmap.c

[PATCH v3 17/33] linux-user: Move some mmap checks outside the lock

2024-01-01 Thread Richard Henderson
Basic validation of operands does not require the lock. Hoist them from target_mmap__locked back into target_mmap. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- linux-user/mmap.c | 107 +++--- 1 file changed, 53 insertions(+),

[PATCH v3 01/33] accel/tcg: Remove qemu_host_page_size from page_protect/page_unprotect

2024-01-01 Thread Richard Henderson
Use qemu_real_host_page_size instead. Except for the final mprotect within page_protect, we already handled host < target page size. Signed-off-by: Richard Henderson --- accel/tcg/user-exec.c | 18 ++ 1 file changed, 10 insertions(+), 8 deletions(-) diff --git

[PATCH v3 19/33] linux-user: Split out mmap_end

2024-01-01 Thread Richard Henderson
Use a subroutine instead of a goto within target_mmap__locked. Reviewed-by: Philippe Mathieu-Daudé Signed-off-by: Richard Henderson --- linux-user/mmap.c | 71 +++ 1 file changed, 41 insertions(+), 30 deletions(-) diff --git a/linux-user/mmap.c

[PATCH v3 18/33] linux-user: Fix sub-host-page mmap

2024-01-01 Thread Richard Henderson
We cannot skip over the_end1 to the_end, because we fail to record the validity of the guest page with the interval tree. Remove "the_end" and rename "the_end1" to "the_end". Signed-off-by: Richard Henderson --- linux-user/mmap.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff

[PATCH v3 20/33] linux-user: Do early mmap placement only for reserved_va

2024-01-01 Thread Richard Henderson
For reserved_va, place all non-fixed maps then proceed as for MAP_FIXED. Signed-off-by: Richard Henderson --- linux-user/mmap.c | 12 +++- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/linux-user/mmap.c b/linux-user/mmap.c index cc983bedbd..42eb3eb2b4 100644 ---

[PATCH v3 14/33] softmmu/physmem: Remove HOST_PAGE_ALIGN

2024-01-01 Thread Richard Henderson
Align allocation sizes to the maximum of host and target page sizes. Signed-off-by: Richard Henderson --- system/physmem.c | 15 +++ 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/system/physmem.c b/system/physmem.c index c09953270f..c1e48dfb6a 100644 ---

[PATCH v3 07/33] linux-user/arm: Remove qemu_host_page_size from init_guest_commpage

2024-01-01 Thread Richard Henderson
Use qemu_real_host_page_size. If the commpage is not within reserved_va, use MAP_FIXED_NOREPLACE. Signed-off-by: Richard Henderson --- linux-user/elfload.c | 13 - 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/linux-user/elfload.c b/linux-user/elfload.c index

[PATCH v3 08/33] linux-user: Remove qemu_host_page_{size, mask} from mmap.c

2024-01-01 Thread Richard Henderson
Use qemu_real_host_page_size instead. Signed-off-by: Richard Henderson --- linux-user/mmap.c | 66 +++ 1 file changed, 33 insertions(+), 33 deletions(-) diff --git a/linux-user/mmap.c b/linux-user/mmap.c index 96c9433e27..4d3c8717b9 100644 ---

[PATCH v3 03/33] linux-user: Remove qemu_host_page_{size, mask} in probe_guest_base

2024-01-01 Thread Richard Henderson
The host SHMLBA is by definition a multiple of the host page size. Thus the remaining component of qemu_host_page_size is the target page size. Signed-off-by: Richard Henderson --- linux-user/elfload.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/linux-user/elfload.c

[PATCH v3 11/33] migration: Remove qemu_host_page_size

2024-01-01 Thread Richard Henderson
Replace with the maximum of the real host page size and the target page size. This is an exact replacement. Signed-off-by: Richard Henderson --- migration/ram.c | 22 ++ 1 file changed, 18 insertions(+), 4 deletions(-) diff --git a/migration/ram.c b/migration/ram.c index

[PATCH v3 05/33] linux-user/hppa: Simplify init_guest_commpage

2024-01-01 Thread Richard Henderson
If reserved_va, then we have already reserved the entire guest virtual address space; no need to remap page. If !reserved_va, then use MAP_FIXED_NOREPLACE. Signed-off-by: Richard Henderson --- linux-user/elfload.c | 23 ++- 1 file changed, 14 insertions(+), 9 deletions(-)

[PATCH v3 00/33] linux-user: Improve host and guest page size handling

2024-01-01 Thread Richard Henderson
Changes for v3: * Rebase. Blurb from v1: While working on mmap issues for 8.1, I noticed a lot of corner cases of host != guest page size that we implement poorly. This seems to be particularly visible on Apple M1 with 16k pages, more so than Power with 64k pages for some reason. Objective 1

[PATCH v3 15/33] linux-user: Remove qemu_host_page_size from main

2024-01-01 Thread Richard Henderson
Use qemu_real_host_page_size() instead. Signed-off-by: Richard Henderson --- linux-user/main.c | 10 ++ 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/linux-user/main.c b/linux-user/main.c index 0cdaf30d34..5f217cc2a8 100644 --- a/linux-user/main.c +++ b/linux-user/main.c

[PATCH] tcg/ppc: Use new registers for LQ destination

2024-01-01 Thread Richard Henderson
LQ has a constraint that RTp != RA, else SIGILL. Therefore, force the destination of INDEX_op_qemu_*_ld128 to be a new register pair, so that it cannot overlap the input address. This requires new support in process_op_defs and tcg_reg_alloc_op. Cc: qemu-sta...@nongnu.org Fixes: 526cd4ec01f

Re: [PATCH 1/1] target/loongarch: move translate modules to tcg/

2024-01-01 Thread gaosong
在 2023/12/29 下午6:08, Philippe Mathieu-Daudé 写道: Hi, On 29/12/23 10:24, Song Gao wrote: Introduce the target/loongarch/tcg directory. Its purpose is to hold the TCG code that is selected by CONFIG_TCG Signed-off-by: Song Gao ---   target/loongarch/{ => tcg}/constant_timer.c |  0  

Re: [PATCH 22/33] hw/arm/aspeed_ast2600: Let the A7MPcore create/wire the CPU cores

2024-01-01 Thread Andrew Jeffery
On Tue, 2023-12-12 at 17:29 +0100, Philippe Mathieu-Daudé wrote: > Set the properties on the a7mpcore object to let it create and > wire the CPU cores. Remove the redundant code. > > Signed-off-by: Philippe Mathieu-Daudé Acked-by: Andrew Jeffery

[PATCH] target/i386: Do not re-compute new pc with CF_PCREL

2024-01-01 Thread Richard Henderson
With PCREL, we have a page-relative view of EIP, and an approximation of PC = EIP+CSBASE that is good enough to detect page crossings. If we try to recompute PC after masking EIP, we will mess up that approximation and write a corrupt value to EIP. We already handled masking properly for PCREL,

Re: [PATCH] hw/block/fdc: do not set SEEK status bit in multi track commands

2024-01-01 Thread Hervé Poussineau
Ping. Le 12/08/2023 à 10:59, Hervé Poussineau a écrit : I don't understand when SEEK must be set or not, but it seems to fix Minix... Fixes: https://gitlab.com/qemu-project/qemu/-/issues/1522 Signed-off-by: Hervé Poussineau --- hw/block/fdc.c | 1 - 1 file changed, 1 deletion(-) diff

Re: [PATCH v2 4/4] hw/cxl/events: discard all event records during sanitation

2024-01-01 Thread Davidlohr Bueso
On Fri, 22 Dec 2023, Hyeonggon Yoo wrote: Per spec 8.2.9.9.5.1 Sanitize (Opcode 4400h), sanitize command should delete all event logs. Introduce cxl_discard_all_event_logs() and call this in __do_sanitization(). lgtm Reviewed-by: Davidlohr Bueso Signed-off-by: Hyeonggon Yoo

Re: [PATCH 5/8] vga: optimize horizontal pel panning in 256-color modes

2024-01-01 Thread Paolo Bonzini
Il dom 31 dic 2023, 17:27 BALATON Zoltan ha scritto: > > palette = vga->last_palette; > > hpel = (hpel >> 1) & 3; > > + > > +/* For 256 color modes, we can adjust the source address and write > directly > > + * to the destination, even if horizontal pel panning is active. >