[PATCH 2/7] configure: Remove unused meson_args variable

2022-08-25 Thread Peter Maydell
The meson_args variable was added in commit 3b4da13293482134b, but was not used in that commit and isn't used today. Delete the unnecessary assignment. Signed-off-by: Peter Maydell --- configure | 1 - 1 file changed, 1 deletion(-) diff --git a/configure b/configure index

[PATCH 7/7] configure: Avoid use of 'local' as it is non-POSIX

2022-08-25 Thread Peter Maydell
We use the non-POSIX 'local' keyword in just two places in configure; rewrite to avoid it. In do_compiler(), just drop the 'local' keyword. The variable 'compiler' is only used elsewhere in the do_compiler_werror() function, which already uses the variable as a normal non-local one. In

[PATCH 4/7] configure: Add './' on front of glob of */config-devices.mak.d

2022-08-25 Thread Peter Maydell
Shellcheck warns that in rm -f */config-devices.mak.d the glob might expand to something with a '-' in it, which would then be misinterpreted as an option to rm. Fix this by adding './'. Signed-off-by: Peter Maydell --- configure | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff

[PATCH 0/7] configure: fix misc shellcheck warnings

2022-08-25 Thread Peter Maydell
Currently if you run shellcheck on our configure script it generates a ton of warnings. This patchset fixes some of the easier ones. I wasn't aiming for completeness or consistency; I just wanted to zap some of the ones where the fix is clear and didn't take long to write and is hopefully easy to

[PATCH 6/7] configure: Check mkdir result directly, not via $?

2022-08-25 Thread Peter Maydell
Shellcheck warns that we have one place where we run a command and then check if it failed using $?; this is better written to simply check the command in the 'if' statement directly. Signed-off-by: Peter Maydell --- configure | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git

[PATCH 1/7] configure: Remove unused python_version variable

2022-08-25 Thread Peter Maydell
Shellcheck correctly reports that we set python_version and never use it. This is a leftover from commit f9332757898a7: we used to use python_version purely to as part of the summary information printed at the end of a configure run, and that commit changed to printing the information from meson

Re: EBUSY when using NVMe Block Driver with multiple devices in the same IOMMU group

2022-08-25 Thread Chaitanya Kulkarni
> First, multiple QEMU instances cannot access nvme:// devices sharing the > same IOMMU group. I don't think this will ever be possible because it > opens a backdoor around process memory isolation. > > However, a single QEMU (or qemu-storage-daemon) instance should be able > to access multiple

[PATCH v6 10/10] parallels: Replace qemu_co_mutex_lock by WITH_QEMU_LOCK_GUARD

2022-08-25 Thread Alexander Ivanov
Replace the way we use mutex in parallels_co_check() for simplier and less error prone code. Signed-off-by: Alexander Ivanov Reviewed-by: Denis V. Lunev --- block/parallels.c | 33 ++--- 1 file changed, 14 insertions(+), 19 deletions(-) diff --git

[PATCH v6 04/10] parallels: create parallels_set_bat_entry_helper() to assign BAT value

2022-08-25 Thread Alexander Ivanov
This helper will be reused in next patches during parallels_co_check rework to simplify its code. Signed-off-by: Alexander Ivanov Reviewed-by: Denis V. Lunev Reviewed-by: Vladimir Sementsov-Ogievskiy --- block/parallels.c | 11 --- 1 file changed, 8 insertions(+), 3 deletions(-) diff

[PATCH v6 03/10] parallels: Fix data_end after out-of-image check

2022-08-25 Thread Alexander Ivanov
Set data_end to the end of the last cluster inside the image. In such a way we can be shure that corrupted offsets in the BAT can't affect on the image size. Signed-off-by: Alexander Ivanov --- block/parallels.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/block/parallels.c

Re: [PATCH v1 15/40] i386/tdx: Add property sept-ve-disable for tdx-guest object

2022-08-25 Thread Xiaoyao Li
On 8/25/2022 7:36 PM, Gerd Hoffmann wrote: On Tue, Aug 02, 2022 at 03:47:25PM +0800, Xiaoyao Li wrote: Bit 28, named SEPT_VE_DISABLE, disables EPT violation conversion to #VE on guest TD access of PENDING pages when set to 1. Some guest OS (e.g., Linux TD guest) may require this bit set as 1.

[PATCH v6 05/10] parallels: Use generic infrastructure for BAT writing in parallels_co_check()

2022-08-25 Thread Alexander Ivanov
BAT is written in the context of conventional operations over the image inside bdrv_co_flush() when it calls parallels_co_flush_to_os() callback. Thus we should not modify BAT array directly, but call parallels_set_bat_entry() helper and bdrv_co_flush() further on. After that there is no need to

[PATCH v6 09/10] parallels: Move statistic collection to a separate function

2022-08-25 Thread Alexander Ivanov
We will add more and more checks so we need a better code structure in parallels_co_check. Let each check performs in a separate loop in a separate helper. Signed-off-by: Alexander Ivanov Reviewed-by: Denis V. Lunev Reviewed-by: Vladimir Sementsov-Ogievskiy --- block/parallels.c | 53

[PATCH v6 08/10] parallels: Move check of leaks to a separate function

2022-08-25 Thread Alexander Ivanov
We will add more and more checks so we need a better code structure in parallels_co_check. Let each check performs in a separate loop in a separate helper. Signed-off-by: Alexander Ivanov --- block/parallels.c | 84 +-- 1 file changed, 52

[PATCH v6 07/10] parallels: Move check of cluster outside image to a separate function

2022-08-25 Thread Alexander Ivanov
We will add more and more checks so we need a better code structure in parallels_co_check. Let each check performs in a separate loop in a separate helper. Signed-off-by: Alexander Ivanov --- block/parallels.c | 59 ++- 1 file changed, 43

Re: Issues related to the polling system on Windows

2022-08-25 Thread Clément Chigot
Hi, I've managed to fully transition to the Windows API. As the previous code wasn't taking G_IO_HUP into consideration, I've simply disabled the call to WSAEnumNetworkEvents for a GSource having just the G_IO_HUP condition. We might still have an issue if another GSource is one day added to the

[PATCH v6 02/10] parallels: Fix high_off calculation in parallels_co_check()

2022-08-25 Thread Alexander Ivanov
Don't let high_off be more than the file size even if we don't fix the image. Signed-off-by: Alexander Ivanov --- block/parallels.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/block/parallels.c b/block/parallels.c index 93bc2750ef..7e8cdbbc3a 100644 ---

[PATCH v6 06/10] parallels: Move check of unclean image to a separate function

2022-08-25 Thread Alexander Ivanov
We will add more and more checks so we need a better code structure in parallels_co_check. Let each check performs in a separate loop in a separate helper. Signed-off-by: Alexander Ivanov Reviewed-by: Denis V. Lunev Reviewed-by: Vladimir Sementsov-Ogievskiy --- block/parallels.c | 31

[PATCH v6 01/10] parallels: Out of image offset in BAT leads to image inflation

2022-08-25 Thread Alexander Ivanov
data_end field in BDRVParallelsState is set to the biggest offset present in BAT. If this offset is outside of the image, any further write will create the cluster at this offset and/or the image will be truncated to this offset on close. This is definitely not correct. Raise an error in

[PATCH v6 00/10] parallels: Refactor the code of images checks and fix a bug

2022-08-25 Thread Alexander Ivanov
Fix image inflation when offset in BAT is out of image. Replace whole BAT syncing by flushing only dirty blocks. Move all the checks outside the main check function in separate functions Use WITH_QEMU_LOCK_GUARD for simplier code. v6: 1: Move the error check inside the loop. Move file size

Re: [PATCH v2 00/11] misc: Remove variable-length arrays on the stack

2022-08-25 Thread Philippe Mathieu-Daudé via
On 19/8/22 17:39, Peter Maydell wrote: This is a resend of a subset of patches from a series that Philippe sent out last year: https://patchew.org/QEMU/20210505211047.1496765-1-phi...@redhat.com/ Basically I just pulled out the patches which: (1) trivially applied on a rebase (2) had got a

Re: [PATCH v2 1/3] hw/nvme: support irq(de)assertion with eventfd

2022-08-25 Thread Jinhao Fan
On 8/25/2022 9:59 PM, Klaus Jensen wrote: On Aug 25 21:09, Jinhao Fan wrote: 在 2022年8月25日,20:39,Klaus Jensen 写道: On Aug 25 13:56, Klaus Jensen wrote: On Aug 25 19:16, Jinhao Fan wrote: On 8/25/2022 5:33 PM, Klaus Jensen wrote: I'm still a bit perplexed by this issue, so I just tried

Re: [PATCH] configure: improve error for ucontext coroutine backend

2022-08-25 Thread Philippe Mathieu-Daudé via
On 19/8/22 19:02, Paolo Bonzini wrote: Instead of using feature_not_found(), which is not a good match because there is no "remedy" to fix the lack of makecontext(), just print a custom error. This happens to remove the last use of feature_not_found(), so remove the definition and the

Re: [PATCH v1 1/6] tests/avocado: push default timeout to QemuBaseTest

2022-08-25 Thread Philippe Mathieu-Daudé via
On 22/8/22 18:56, Alex Bennée wrote: All of the QEMU tests eventually end up derrived from this class. Move Typo "derived". the default timeout from LinuxTest to ensure we catch them all. As 15 minutes is fairly excessive we drop the default down to 2 minutes which is a more reasonable

Re: [PATCH] target/avr: Support probe argument to tlb_fill

2022-08-25 Thread Philippe Mathieu-Daudé via
On 23/8/22 07:07, Richard Henderson wrote: While there are no target-specific nonfaulting probes, generic code may grow some uses at some point. Note that the attrs argument was incorrect -- it should have been MEMTXATTRS_UNSPECIFIED. Just use the simpler interface. Signed-off-by: Richard

Re: [PATCH] tests/avocado: Fix trivial typo

2022-08-25 Thread Philippe Mathieu-Daudé via
On 24/8/22 10:09, Thomas Huth wrote: The intention was likely to use "intend" instead of "indent" here. Signed-off-by: Thomas Huth --- tests/avocado/avocado_qemu/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) Reviewed-by: Philippe Mathieu-Daudé

Re: [PATCH v2 1/3] hw/nvme: support irq(de)assertion with eventfd

2022-08-25 Thread Jinhao Fan
On 8/25/2022 7:56 PM, Klaus Jensen wrote: On Aug 25 19:16, Jinhao Fan wrote: On 8/25/2022 5:33 PM, Klaus Jensen wrote: I'm still a bit perplexed by this issue, so I just tried moving nvme_init_irq_notifier() to the end of nvme_init_cq() and removing this first_io_cqe thing. I did not observe

Re: [RFC PATCH] tests/vm: Remove obsolete Fedora VM test

2022-08-25 Thread Philippe Mathieu-Daudé via
On 24/8/22 19:29, Alex Bennée wrote: Thomas Huth writes: It's still based on Fedora 30 - which is not supported anymore by QEMU since years. Seems like nobody is using (and refreshing) this, and it's easier to test this via a container anyway, so let's remove this now. Signed-off-by: Thomas

Re: [PATCH v2 1/3] hw/nvme: support irq(de)assertion with eventfd

2022-08-25 Thread Klaus Jensen
On Aug 25 21:09, Jinhao Fan wrote: > > > > > 在 2022年8月25日,20:39,Klaus Jensen 写道: > > > > On Aug 25 13:56, Klaus Jensen wrote: > >>> On Aug 25 19:16, Jinhao Fan wrote: > >>> On 8/25/2022 5:33 PM, Klaus Jensen wrote: > I'm still a bit perplexed by this issue, so I just tried moving >

Re: [PATCH v1 2/5] virtio-blk: move config space sizing code to virtio-blk-common

2022-08-25 Thread Stefan Hajnoczi
On Thu, Aug 25, 2022 at 12:11:10AM +0300, Daniil Tatianin wrote: > > > On 8/24/22 9:13 PM, Stefan Hajnoczi wrote: > > On Wed, Aug 24, 2022 at 12:18:34PM +0300, Daniil Tatianin wrote: > > > +size_t virtio_blk_common_get_config_size(uint64_t host_features) > > > +{ > > > +size_t config_size =

Re: [PATCH 2/2] dump: fix kdump to work over non-aligned blocks

2022-08-25 Thread Marc-André Lureau
Hi On Thu, Aug 25, 2022 at 5:35 PM Peter Maydell wrote: > > On Thu, 25 Aug 2022 at 14:21, wrote: > > > > From: Marc-André Lureau > > > > Rewrite get_next_page() to work over non-aligned blocks. When it > > encounters non aligned addresses, it will allocate a zero-page and try > > to fill it. >

Re: [PATCH 2/2] dump: fix kdump to work over non-aligned blocks

2022-08-25 Thread Peter Maydell
On Thu, 25 Aug 2022 at 14:21, wrote: > > From: Marc-André Lureau > > Rewrite get_next_page() to work over non-aligned blocks. When it > encounters non aligned addresses, it will allocate a zero-page and try > to fill it. > > This solves a kdump crash with "tpm-crb-cmd" RAM memory region, >

Re: [PATCH v1 3/5] vhost-user-blk: make it possible to disable write-zeroes/discard

2022-08-25 Thread Stefan Hajnoczi
On Wed, Aug 24, 2022 at 11:24:55PM +0300, Daniil Tatianin wrote: > On 8/24/22 9:00 PM, Stefan Hajnoczi wrote: > > On Wed, Aug 24, 2022 at 12:18:35PM +0300, Daniil Tatianin wrote: > > > diff --git a/hw/block/vhost-user-blk.c b/hw/block/vhost-user-blk.c > > > index 9117222456..e89164c358 100644 > >

[PATCH 2/2] dump: fix kdump to work over non-aligned blocks

2022-08-25 Thread marcandre . lureau
From: Marc-André Lureau Rewrite get_next_page() to work over non-aligned blocks. When it encounters non aligned addresses, it will allocate a zero-page and try to fill it. This solves a kdump crash with "tpm-crb-cmd" RAM memory region, qemu-kvm: ../dump/dump.c:1162: _Bool

[PATCH 0/2] Fix dumping in kdump format with non-aligned memory

2022-08-25 Thread marcandre . lureau
From: Marc-André Lureau Hi, dump.c:get_next_page expects GuestPhysBlock to be page-aligned, and crashes over memory regions such as "tpm-crb-cmd". Teach it to handle non-aligned regions too, by returning allocated and filled up pages as necessary. Fixes:

[PATCH 1/2] dump: simplify a bit kdump get_next_page()

2022-08-25 Thread marcandre . lureau
From: Marc-André Lureau This should be functionally equivalent, but slightly easier to read, with simplified paths and checks at the end of the function. The following patch is a major rewrite to get rid of the assert(). Signed-off-by: Marc-André Lureau --- dump/dump.c | 30

Re: [PATCH v2 1/3] hw/nvme: support irq(de)assertion with eventfd

2022-08-25 Thread Jinhao Fan
> 在 2022年8月25日,20:39,Klaus Jensen 写道: > > On Aug 25 13:56, Klaus Jensen wrote: >>> On Aug 25 19:16, Jinhao Fan wrote: >>> On 8/25/2022 5:33 PM, Klaus Jensen wrote: I'm still a bit perplexed by this issue, so I just tried moving nvme_init_irq_notifier() to the end of nvme_init_cq()

Re: [PATCH 27/51] tests/qtest: Use send/recv for socket communication

2022-08-25 Thread Thomas Huth
On 24/08/2022 11.40, Bin Meng wrote: From: Xuzhou Cheng Socket communication in the libqtest and libqmp codes uses read() and write() which work on any file descriptor on *nix, and sockets in *nix are an example of a file descriptor. However sockets on Windows do not use *nix-style file

Re: [PATCH v1 08/40] i386/tdx: Adjust the supported CPUID based on TDX restrictions

2022-08-25 Thread Xiaoyao Li
On 8/25/2022 7:26 PM, Gerd Hoffmann wrote: Hi, between VMM and TDs. Adjust supported CPUID for TDs based on TDX restrictions. Automatic adjustment depending on hardware capabilities isn't going to fly long-term, you'll run into compatibility problems sooner or later, for example when

[PATCH] tests/tcg: i386: extend BMI test

2022-08-25 Thread Paolo Bonzini
Cover all BMI1 and BMI2 instructions, both 32- and 64-bit. Due to the use of inlines, the test now has to be compiled with -O2. Signed-off-by: Paolo Bonzini --- tests/tcg/i386/Makefile.target | 1 + tests/tcg/i386/test-i386-bmi2.c | 169 ++-- 2 files changed, 162

Re: [PATCH v2 1/3] hw/nvme: support irq(de)assertion with eventfd

2022-08-25 Thread Klaus Jensen
On Aug 25 13:56, Klaus Jensen wrote: > On Aug 25 19:16, Jinhao Fan wrote: > > On 8/25/2022 5:33 PM, Klaus Jensen wrote: > > > I'm still a bit perplexed by this issue, so I just tried moving > > > nvme_init_irq_notifier() to the end of nvme_init_cq() and removing this > > > first_io_cqe thing. I

Re: [PATCH 18/51] tests/qtest: Build cases that use memory-backend-file for posix only

2022-08-25 Thread Thomas Huth
On 24/08/2022 11.39, Bin Meng wrote: From: Bin Meng As backends/meson.build tells us, hostmem-file.c is only supported on POSIX platforms, hence any test case that utilizes the memory backend file should be guarded by CONFIG_POSIX too. Signed-off-by: Bin Meng ---

[PATCH] tests/tcg: x86_64: improve consistency with i386

2022-08-25 Thread Paolo Bonzini
Include test-i386-bmi2, and specify manually the tests (only one for now) that need -cpu max. Signed-off-by: Paolo Bonzini --- tests/tcg/i386/Makefile.target | 2 +- tests/tcg/x86_64/Makefile.target | 4 +++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git

Re: [PATCH 43/51] tests/qtest: npcm7xx_emc-test: Skip running test_{tx,rx} on win32

2022-08-25 Thread Thomas Huth
On 24/08/2022 11.40, Bin Meng wrote: From: Bin Meng The test cases 'test_{tx,rx}' call socketpair() which does not exist on win32. Exclude them. Signed-off-by: Bin Meng --- tests/qtest/npcm7xx_emc-test.c | 8 1 file changed, 8 insertions(+) Reviewed-by: Thomas Huth

Re: [PATCH 45/51] tests/qtest: prom-env-test: Use double quotes to pass the prom-env option

2022-08-25 Thread Thomas Huth
On 24/08/2022 11.40, Bin Meng wrote: From: Bin Meng Single quotes like -prom-env 'nvramrc=cafec0de 4000 l!' in the arguments are not removed in the Windows environment before it is passed to the QEMU executable. Such argument causes a failure in the QEMU prom-env option parser codes. Change

Re: [PATCH 38/51] tests/qtest: {ahci,ide}-test: Open file in binary mode

2022-08-25 Thread Thomas Huth
On 24/08/2022 11.40, Bin Meng wrote: From: Xuzhou Cheng By default Windows opens file in text mode, while a POSIX compliant implementation treats text files and binary files the same. The fopen() 'mode' string can include the letter 'b' to indicate binary mode shall be used. POSIX spec says

Re: [PATCH 36/51] tests/qtest: machine-none-test: Use double quotes to pass the cpu option

2022-08-25 Thread Thomas Huth
On 24/08/2022 11.40, Bin Meng wrote: From: Bin Meng Single quotes in the arguments (e.g.: -cpu 'qemu64,apic-id=0') are not removed in the Windows environment before it is passed to the QEMU executable. Such argument causes a failure in the QEMU CPU option parser codes. Change to use double

Re: [PATCH 35/51] tests/qtest: device-plug-test: Reverse the usage of double/single quotes

2022-08-25 Thread Thomas Huth
On 24/08/2022 11.40, Bin Meng wrote: From: Bin Meng The usage of double/single quotes in test_pci_unplug_json_request() should be reversed to work on both win32 and non-win32 platforms: - The value of -device parameter needs to be surrounded by "" as Windows does not drop '' when passing

Re: Page alignment & memory regions expectations

2022-08-25 Thread Peter Maydell
On Thu, 25 Aug 2022 at 12:57, David Hildenbrand wrote: > > On 25.08.22 13:47, Peter Maydell wrote: > > On Thu, 25 Aug 2022 at 08:27, David Hildenbrand wrote: > >> On 24.08.22 21:55, Peter Maydell wrote: > >>> Lumps of memory can be any size you like and anywhere in > >>> memory you like.

Re: [PATCH 32/51] tests/qtest: Fix ERROR_SHARING_VIOLATION for win32

2022-08-25 Thread Thomas Huth
On 24/08/2022 11.40, Bin Meng wrote: From: Bin Meng On Windows, the MinGW provided mkstemp() API opens the file with exclusive access, denying other processes to read/write the file. Such behavior prevents the QEMU executable from opening the file, (e.g.: CreateFile returns

Re: [PATCH 30/51] tests: Skip iotests and qtest when '--without-default-devices'

2022-08-25 Thread Thomas Huth
On 24/08/2022 11.40, Bin Meng wrote: From: Bin Meng When QEMU is configured with '--without-default-devices', we should not build and run iotests and qtest because devices used by these test cases are not built in. Signed-off-by: Bin Meng --- tests/qemu-iotests/meson.build | 5 +

Re: [PATCH 26/51] tests/qtest: libqtest: Move global_qtest definition back to libqtest.c

2022-08-25 Thread Thomas Huth
On 24/08/2022 11.40, Bin Meng wrote: From: Xuzhou Cheng Commit dd2107497275 ("tests/libqtest: Use libqtest-single.h in tests that require global_qtest") moved global_qtest to libqtest-single.h, by declaring global_qtest attribute to be common and weak. This trick unfortunately does not work

Re: [PATCH v2 1/3] hw/nvme: support irq(de)assertion with eventfd

2022-08-25 Thread Klaus Jensen
On Aug 25 19:16, Jinhao Fan wrote: > On 8/25/2022 5:33 PM, Klaus Jensen wrote: > > I'm still a bit perplexed by this issue, so I just tried moving > > nvme_init_irq_notifier() to the end of nvme_init_cq() and removing this > > first_io_cqe thing. I did not observe any particular issues? > > > >

Re: Page alignment & memory regions expectations

2022-08-25 Thread David Hildenbrand
On 25.08.22 13:47, Peter Maydell wrote: > On Thu, 25 Aug 2022 at 08:27, David Hildenbrand wrote: >> On 24.08.22 21:55, Peter Maydell wrote: >>> Lumps of memory can be any size you like and anywhere in >>> memory you like. Sometimes we are modelling real hardware >>> that has done something like

Re: [PATCH 24/51] tests/qtest: libqos: Drop inclusion of

2022-08-25 Thread Thomas Huth
On 24/08/2022 11.40, Bin Meng wrote: From: Xuzhou Cheng There is no in the Windows build environment. Actually this is not needed in the non-win32 builds too. Drop it. Signed-off-by: Xuzhou Cheng Signed-off-by: Bin Meng --- tests/qtest/libqos/libqos.c | 2 -- 1 file changed, 2

Re: Page alignment & memory regions expectations

2022-08-25 Thread Peter Maydell
On Thu, 25 Aug 2022 at 08:27, David Hildenbrand wrote: > On 24.08.22 21:55, Peter Maydell wrote: > > Lumps of memory can be any size you like and anywhere in > > memory you like. Sometimes we are modelling real hardware > > that has done something like that. Sometimes it's just > > a convenient

Re: [PATCH 22/51] tests/qtest: qmp-test: Skip running test_qmp_oob for win32

2022-08-25 Thread Thomas Huth
On 24/08/2022 11.40, Bin Meng wrote: From: Bin Meng The test_qmp_oob test case calls mkfifo() which does not exist on win32. Exclude it. Signed-off-by: Bin Meng --- tests/qtest/qmp-test.c | 6 ++ 1 file changed, 6 insertions(+) Reviewed-by: Thomas Huth

Re: [PATCH 25/51] tests/qtest: libqos: Rename malloc.h to libqos-malloc.h

2022-08-25 Thread Thomas Huth
On 24/08/2022 11.40, Bin Meng wrote: From: Xuzhou Cheng The qtest/libqos directory is included via the "-I" option to search for header files when building qtest. Unfortunately the malloc.h has a name conflict with the standard libc header, leading to a build failure on the Windows host, due

Re: [PATCH v1 18/40] i386/tdx: Implement user specified tsc frequency

2022-08-25 Thread Gerd Hoffmann
On Tue, Aug 02, 2022 at 03:47:28PM +0800, Xiaoyao Li wrote: > Reuse "-cpu,tsc-frequency=" to get user wanted tsc frequency and call VM > scope VM_SET_TSC_KHZ to set the tsc frequency of TD before KVM_TDX_INIT_VM. > > Besides, sanity check the tsc frequency to be in the legal range and > legal

Re: [PATCH 20/51] tests/qtest: i440fx-test: Skip running request_{bios,pflash} for win32

2022-08-25 Thread Thomas Huth
On 24/08/2022 11.39, Bin Meng wrote: From: Bin Meng The request_{bios,pflash} test cases call mmap() which does not exist on win32. Exclude them. Signed-off-by: Bin Meng --- tests/qtest/i440fx-test.c | 6 ++ 1 file changed, 6 insertions(+) diff --git a/tests/qtest/i440fx-test.c

Re: [PATCH 19/51] tests/qtest: Build test-filter-{mirror, redirector} cases for posix only

2022-08-25 Thread Thomas Huth
On 24/08/2022 11.39, Bin Meng wrote: From: Bin Meng The test-filter-{mirror,redirector} cases use socketpair() API that is only available on POSIX and should only be built for POSIX. Signed-off-by: Bin Meng --- tests/qtest/meson.build | 28 ++-- 1 file changed, 18

Re: [PATCH v1 17/40] i386/tdx: Validate TD attributes

2022-08-25 Thread Gerd Hoffmann
On Tue, Aug 02, 2022 at 03:47:27PM +0800, Xiaoyao Li wrote: > Validate TD attributes with tdx_caps that fixed-0 bits must be zero and > fixed-1 bits must be set. > > Besides, sanity check the attribute bits that have not been supported by > QEMU yet. e.g., debug bit, it will be allowed in the

Re: [PATCH v1 16/40] i386/tdx: Wire CPU features up with attributes of TD guest

2022-08-25 Thread Gerd Hoffmann
On Tue, Aug 02, 2022 at 03:47:26PM +0800, Xiaoyao Li wrote: > For QEMU VMs, PKS is configured via CPUID_7_0_ECX_PKS and PMU is > configured by x86cpu->enable_pmu. Reuse the existing configuration > interface for TDX VMs. Acked-by: Gerd Hoffmann

Re: [PATCH v1 15/40] i386/tdx: Add property sept-ve-disable for tdx-guest object

2022-08-25 Thread Gerd Hoffmann
On Tue, Aug 02, 2022 at 03:47:25PM +0800, Xiaoyao Li wrote: > Bit 28, named SEPT_VE_DISABLE, disables EPT violation conversion to #VE > on guest TD access of PENDING pages when set to 1. Some guest OS (e.g., > Linux TD guest) may require this bit set as 1. Otherwise refuse to boot.

Re: [PATCH v1 13/40] KVM: Introduce kvm_arch_pre_create_vcpu()

2022-08-25 Thread Gerd Hoffmann
On Tue, Aug 02, 2022 at 03:47:23PM +0800, Xiaoyao Li wrote: > Introduce kvm_arch_pre_create_vcpu(), to perform arch-dependent > work prior to create any vcpu. This is for i386 TDX because it needs > call TDX_INIT_VM before creating any vcpu. > > Signed-off-by: Xiaoyao Li Acked-by: Gerd Hoffmann

Re: [PATCH 17/51] tests/qtest: Build virtio-net-test for posix only

2022-08-25 Thread Thomas Huth
On 24/08/2022 11.39, Bin Meng wrote: From: Bin Meng All of the virtio-net-test test cases require socketpair() to do the test setup. I think that is not true. Look at the end of the file, after the comment "These tests do not need a loopback backend" ... these tests are using

Re: [PATCH v1 14/40] i386/tdx: Initialize TDX before creating TD vcpus

2022-08-25 Thread Gerd Hoffmann
On Tue, Aug 02, 2022 at 03:47:24PM +0800, Xiaoyao Li wrote: > Invoke KVM_TDX_INIT in kvm_arch_pre_create_vcpu() that KVM_TDX_INIT > configures global TD state, e.g. the canonical CPUID config, and must > be executed prior to creating vCPUs. > > Use kvm_x86_arch_cpuid() to setup the CPUID settings

Re: [PATCH v1 08/40] i386/tdx: Adjust the supported CPUID based on TDX restrictions

2022-08-25 Thread Gerd Hoffmann
Hi, > between VMM and TDs. Adjust supported CPUID for TDs based on TDX > restrictions. Automatic adjustment depending on hardware capabilities isn't going to fly long-term, you'll run into compatibility problems sooner or later, for example when different hardware with diverging capabilities

Re: [PATCH v2 1/3] hw/nvme: support irq(de)assertion with eventfd

2022-08-25 Thread Jinhao Fan
On 8/25/2022 5:33 PM, Klaus Jensen wrote: I'm still a bit perplexed by this issue, so I just tried moving nvme_init_irq_notifier() to the end of nvme_init_cq() and removing this first_io_cqe thing. I did not observe any particular issues? What bad behavior did you encounter, it seems to work

Re: [PATCH 16/51] tests/qtest: Build e1000e-test for posix only

2022-08-25 Thread Thomas Huth
On 24/08/2022 11.39, Bin Meng wrote: From: Bin Meng The whole e1000e-test test case relies on socketpair() which does not exist on win32. Signed-off-by: Bin Meng --- tests/qtest/meson.build | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tests/qtest/meson.build

Re: [PATCH v1 07/40] i386/tdx: Introduce is_tdx_vm() helper and cache tdx_guest object

2022-08-25 Thread Gerd Hoffmann
On Tue, Aug 02, 2022 at 03:47:17PM +0800, Xiaoyao Li wrote: > It will need special handling for TDX VMs all around the QEMU. > Introduce is_tdx_vm() helper to query if it's a TDX VM. > > Cache tdx_guest object thus no need to cast from ms->cgs every time. > > Signed-off-by: Xiaoyao Li

Re: [PATCH v1 06/40] i386/tdx: Get tdx_capabilities via KVM_TDX_CAPABILITIES

2022-08-25 Thread Gerd Hoffmann
Hi, > +r = tdx_platform_ioctl(KVM_TDX_CAPABILITIES, 0, caps); > +if (r == -E2BIG) { > +g_free(caps); > +nr_cpuid_configs *= 2; > +if (nr_cpuid_configs > KVM_MAX_CPUID_ENTRIES) { > +error_report("KVM TDX seems broken"); Maybe,

[PULL for-7.1 1/1] hw/i2c/aspeed: Fix old reg slave receive

2022-08-25 Thread Cédric Le Goater
From: Peter Delevoryas I think when Klaus ported his slave mode changes from the original patch series to the rewritten I2C module, he changed the behavior of the first byte that is received by the slave device. What's supposed to happen is that the AspeedI2CBus's slave device's i2c_event

Re: [PATCH v2 1/3] hw/nvme: support irq(de)assertion with eventfd

2022-08-25 Thread Klaus Jensen
On Aug 25 15:47, Jinhao Fan wrote: > When the new option 'irq-eventfd' is turned on, the IO emulation code > signals an eventfd when it want to (de)assert an irq. The main loop > eventfd handler does the actual irq (de)assertion. This paves the way > for iothread support since QEMU's interrupt

[PATCH v2] hw/net/vmxnet3: allow VMXNET3_MAX_MTU itself as a value

2022-08-25 Thread Fiona Ebner
Currently, VMXNET3_MAX_MTU itself (being 9000) is not considered a valid value for the MTU, but a guest running ESXi 7.0 might try to set it and fail the assert [0]. In the Linux kernel, dev->max_mtu itself is a valid value for the MTU and for the vmxnet3 driver it's 9000, so a guest running

Re: [PATCH 1/1] hw/i2c/aspeed: Fix old reg slave receive

2022-08-25 Thread Cédric Le Goater
On 8/25/22 10:04, Peter Delevoryas wrote: On Wed, Aug 24, 2022 at 04:31:50PM +0200, Cédric Le Goater wrote: On 8/23/22 19:27, Peter Delevoryas wrote: On Tue, Aug 23, 2022 at 11:23:55AM +0200, Klaus Jensen wrote: On Aug 20 15:57, Peter Delevoryas wrote: I think when Klaus ported his slave

Re: [RFC 1/2] virtio: expose used buffers

2022-08-25 Thread Eugenio Perez Martin
On Thu, Aug 25, 2022 at 9:16 AM Guo Zhi wrote: > > > > - Original Message - > > From: "eperezma" > > To: "Guo Zhi" > > Cc: "jasowang" , "sgarzare" , > > "Michael Tsirkin" , > > "qemu-devel@nongnu.org Developers" > > Sent: Monday, August 22, 2022 10:08:32 PM > > Subject: Re: [RFC 1/2]

Re: [PATCH 07/51] tests: Avoid using hardcoded /tmp in test cases

2022-08-25 Thread Thomas Huth
On 24/08/2022 11.39, Bin Meng wrote: From: Bin Meng Use g_get_tmp_dir() to get the directory to use for temporary files. Signed-off-by: Bin Meng --- tests/qtest/fuzz/generic_fuzz_configs.h | 6 -- tests/qtest/ahci-test.c | 15 +++

[PULL for-7.1 0/1] aspeed queue

2022-08-25 Thread Cédric Le Goater
The following changes since commit 9a99f964b152f8095949bbddca7841744ad418da: Update version for v7.1.0-rc4 release (2022-08-24 19:27:56 -0700) are available in the Git repository at: https://github.com/legoater/qemu/ tags/pull-aspeed-20220825 for you to fetch changes up

Re: [PATCH 50/51] .gitlab-ci.d/windows.yml: Increase the timeout to the runner limit

2022-08-25 Thread Thomas Huth
On 24/08/2022 11.40, Bin Meng wrote: From: Bin Meng commit 9f8e6cad65a6 ("gitlab-ci: Speed up the msys2-64bit job by using --without-default-devices" changed to compile QEMU with the --without-default-devices switch for the msys2-64bit job, due to the build could not complete within the

[PATCH v3 15/15] vhost: vhost-kernel: enable vq reset feature

2022-08-25 Thread Kangjie Xu
Add virtqueue reset feature for vhost-kernel. Signed-off-by: Kangjie Xu Signed-off-by: Xuan Zhuo --- hw/net/vhost_net.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/net/vhost_net.c b/hw/net/vhost_net.c index 0716f6cd96..74c5147d6e 100644 --- a/hw/net/vhost_net.c +++

[PATCH v3 14/15] virtio-net: support queue_enable

2022-08-25 Thread Kangjie Xu
Support queue_enable in vhost-kernel scenario. It can be called when a vq reset operation has been performed and the vq is restared. It should be noted that we can restart the vq when the vhost has already started. When launching a new vhost device, the vhost is not started and all vqs are not

[PATCH v3 00/15] Support VIRTIO_F_RING_RESET for virtio-net, vhost-net kernel in virtio pci-modern

2022-08-25 Thread Kangjie Xu
The virtio queue reset function has already been defined in the virtio spec 1.2. The relevant virtio spec information is here: https://github.com/oasis-tcs/virtio-spec/issues/124 https://github.com/oasis-tcs/virtio-spec/issues/139 This patch set is to support this function in QEMU. It

[PATCH v3 02/15] virtio: introduce __virtio_queue_reset()

2022-08-25 Thread Kangjie Xu
From: Xuan Zhuo Separate the logic of vq reset. This logic will be called directly later. Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- hw/virtio/virtio.c | 37 + 1 file changed, 21 insertions(+), 16 deletions(-) diff --git a/hw/virtio/virtio.c

[PATCH v3 13/15] virtio-net: support queue reset

2022-08-25 Thread Kangjie Xu
From: Xuan Zhuo virtio-net and vhost-kernel implement queue reset. Queued packets in the corresponding queue pair are flushed or purged. Signed-off-by: Xuan Zhuo Signed-off-by: Kangjie Xu --- hw/net/virtio-net.c | 18 ++ 1 file changed, 18 insertions(+) diff --git

[PATCH v3 07/15] virtio-pci: support queue enable

2022-08-25 Thread Kangjie Xu
PCI devices support device specific vq enable. Based on this function, the driver can re-enable the virtqueue after the virtqueue is reset. Signed-off-by: Kangjie Xu Signed-off-by: Xuan Zhuo --- hw/virtio/virtio-pci.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/virtio/virtio-pci.c

Re: [PATCH 15/51] tests/qtest: Adapt {m48t59,rtc}-test cases for win32

2022-08-25 Thread Thomas Huth
On 24/08/2022 11.39, Bin Meng wrote: From: Bin Meng There is no tm_gmtoff member in 'struct tm' on Windows. Update rtc-test.c and m48t59-test.c accordingly. Signed-off-by: Bin Meng --- tests/qtest/m48t59-test.c | 2 +- tests/qtest/rtc-test.c| 2 +- 2 files changed, 2 insertions(+),

[PATCH v3 05/15] virtio: core: vq reset feature negotation support

2022-08-25 Thread Kangjie Xu
A a new command line parameter "queue_reset" is added. Meanwhile, the vq reset feature is disabled for pre-7.1 machines. Signed-off-by: Kangjie Xu Signed-off-by: Xuan Zhuo --- hw/core/machine.c | 1 + include/hw/virtio/virtio.h | 4 +++- 2 files changed, 4 insertions(+), 1

[PATCH v3 10/15] vhost-net: vhost-kernel: introduce vhost_net_virtqueue_reset()

2022-08-25 Thread Kangjie Xu
Introduce vhost_virtqueue_reset(), which can reset the specific virtqueue in the device. Then it will unmap vrings and the desc of the virtqueue. Here we do not reuse the vhost_net_stop_one() or vhost_dev_stop(), because they work at queue pair level. We do not use vhost_virtqueue_stop() because

[PATCH v3 04/15] virtio: introduce virtio_queue_enable()

2022-08-25 Thread Kangjie Xu
Introduce the interface queue_enable() in VirtioDeviceClass and the fucntion virtio_queue_enable() in virtio, it can be called when VIRTIO_PCI_COMMON_Q_ENABLE is written and related virtqueue can be started. It only supports the devices of virtio 1 or later. The not-supported devices can only

[PATCH v3 03/15] virtio: introduce virtio_queue_reset()

2022-08-25 Thread Kangjie Xu
From: Xuan Zhuo Introduce a new interface function virtio_queue_reset() to implement reset for vq. Add a new callback to VirtioDeviceClass for queue reset operation for each child device. Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- hw/virtio/virtio.c | 11 +++

[PATCH v3 08/15] vhost: extract the logic of unmapping the vrings and desc

2022-08-25 Thread Kangjie Xu
Introduce vhost_virtqueue_unmap() to ummap the vrings and desc of a virtqueue. The function will be re-used when resetting a virtqueue. Signed-off-by: Kangjie Xu Signed-off-by: Xuan Zhuo Acked-by: Jason Wang --- hw/virtio/vhost.c | 20 ++-- include/hw/virtio/vhost.h |

[PATCH v3 01/15] virtio: sync relevant definitions with linux

2022-08-25 Thread Kangjie Xu
From: Xuan Zhuo This is updated using scripts/update-linux-headers.sh. Added VIRTIO_F_RING_RESET, VIRTIO_PCI_COMMON_Q_RESET. It came from here: https://github.com/oasis-tcs/virtio-spec/issues/124 https://github.com/oasis-tcs/virtio-spec/issues/139 Add VIRTIO_PCI_COMMON_Q_NDATA, which comes

Re: [PATCH 2/4] hw/acpi: set ATS capability explicitly per pcie root port

2022-08-25 Thread Igor Mammedov
On Wed, 24 Aug 2022 21:46:58 +0530 Ani Sinha wrote: > On Wed, Aug 24, 2022 at 8:54 PM Igor Mammedov wrote: > > > On Mon, 22 Aug 2022 14:38:09 +0530 > > Ani Sinha wrote: > > > > > Currently the bit 0 of the flags field of Root Port ATS capability > > reporting > > > structure sub-table

[PATCH v3 12/15] virtio-net: introduce flush_or_purge_queued_packets()

2022-08-25 Thread Kangjie Xu
Introduce the fucntion flush_or_purge_queued_packets(), it will be used in device reset and virtqueue reset. Therefore, we extract the common logic as a new function. Signed-off-by: Kangjie Xu Signed-off-by: Xuan Zhuo --- hw/net/virtio-net.c | 17 +++-- 1 file changed, 11

[PATCH v3 06/15] virtio-pci: support queue reset

2022-08-25 Thread Kangjie Xu
From: Xuan Zhuo PCI devices support vq reset. Based on this function, the driver can adjust the size of the ring, and quickly recycle the buffer in the ring. The migration of the virtio devices will not happen during a reset operation. This is becuase the global iothread lock is held.

[PATCH v3 11/15] vhost-net: vhost-kernel: introduce vhost_net_virtqueue_restart()

2022-08-25 Thread Kangjie Xu
Introduce vhost_net_virtqueue_restart(), which can restart the specific virtqueue when the vhost net started running before. If it fails to restart the virtqueue, the device will be stopped. Here we do not reuse vhost_net_start_one() or vhost_dev_start() because they work at queue pair level. The

Re: [PATCH 1/1] hw/i2c/aspeed: Fix old reg slave receive

2022-08-25 Thread Peter Delevoryas
On Wed, Aug 24, 2022 at 04:31:50PM +0200, Cédric Le Goater wrote: > On 8/23/22 19:27, Peter Delevoryas wrote: > > On Tue, Aug 23, 2022 at 11:23:55AM +0200, Klaus Jensen wrote: > > > On Aug 20 15:57, Peter Delevoryas wrote: > > > > I think when Klaus ported his slave mode changes from the original

[PATCH v3 09/15] vhost: expose vhost_virtqueue_start()

2022-08-25 Thread Kangjie Xu
Expose vhost_virtqueue_start(), we need to use it when restarting a virtqueue. Signed-off-by: Kangjie Xu Signed-off-by: Xuan Zhuo --- hw/virtio/vhost.c | 8 include/hw/virtio/vhost.h | 2 ++ 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/hw/virtio/vhost.c

Re: [PATCH v2 4/5] bios-tables-test: add test for number of cores > 255

2022-08-25 Thread Igor Mammedov
On Sun, 31 Jul 2022 18:21:40 +0200 Julia Suvorova wrote: > The new test is run with a large number of cpus and checks if the > core_count field in smbios_cpu_test (structure type 4) is correct. > > Choose q35 as it allows to run with -smp > 255. > > Signed-off-by: Julia Suvorova pls, run

<    1   2   3   >