Re: [PATCH v2 5/5] hw/nvram/eeprom_at24c: Make reset behavior more like hardware

2023-01-16 Thread Cédric Le Goater
On 1/17/23 00:56, Peter Delevoryas wrote: EEPROM's are a form of non-volatile memory. After power-cycling an EEPROM, I would expect the I2C state machine to be reset to default values, but I wouldn't really expect the memory to change at all. The current implementation of the at24c EEPROM

Re: [PATCH v2 4/5] hw/arm/aspeed: Add aspeed_eeprom.c

2023-01-16 Thread Cédric Le Goater
On 1/17/23 00:56, Peter Delevoryas wrote: - Create aspeed_eeprom.c and aspeed_eeprom.h - Include aspeed_eeprom.c in CONFIG_ASPEED meson source files - Include aspeed_eeprom.h in aspeed.c - Add fby35_bmc_fruid data - Use new at24c_eeprom_init_rom helper to initialize BMC FRUID EEPROM with data

Re: [PATCH v2 3/5] hw/nvram/eeprom_at24c: Add init_rom field and at24c_eeprom_init_rom helper

2023-01-16 Thread Cédric Le Goater
On 1/17/23 00:56, Peter Delevoryas wrote: Allows users to specify binary data to initialize an EEPROM, allowing users to emulate data programmed at manufacturing time. - Added init_rom and init_rom_size attributes to TYPE_AT24C_EE - Added at24c_eeprom_init_rom helper function to initialize

Re: [PATCH v3 2/2] hw/arm/virt: Make accels in GIC finalize logic explicit

2023-01-16 Thread Philippe Mathieu-Daudé
On 11/1/23 14:35, Zenghui Yu wrote: Hi Alexander, On 2022/12/23 17:01, Alexander Graf wrote: Let's explicitly list out all accelerators that we support when trying to determine the supported set of GIC versions. KVM was already separate, so the only missing one is HVF which simply reuses all

Re: [PATCH v14 08/11] qapi/s390/cpu topology: change-topology monitor command

2023-01-16 Thread Thomas Huth
On 16/01/2023 22.09, Nina Schoetterl-Glausch wrote: On Thu, 2023-01-05 at 15:53 +0100, Pierre Morel wrote: The modification of the CPU attributes are done through a monitor commands. It allows to move the core inside the topology tree to optimise the cache usage in the case the host's

Re: [PATCH v14 01/11] s390x/cpu topology: adding s390 specificities to CPU topology

2023-01-16 Thread Thomas Huth
On 16/01/2023 17.32, Pierre Morel wrote: On 1/10/23 12:37, Thomas Huth wrote: ... Other question: Do we have "node-id"s on s390x? If not, is that similar to books or drawers, i.e. just another word? If so, we should maybe rather re-use "nodes" instead of introducing a new name for the same

Re: [PATCH v14 01/11] s390x/cpu topology: adding s390 specificities to CPU topology

2023-01-16 Thread Thomas Huth
On 16/01/2023 18.28, Pierre Morel wrote: On 1/13/23 17:58, Nina Schoetterl-Glausch wrote: On Thu, 2023-01-05 at 15:53 +0100, Pierre Morel wrote: S390 adds two new SMP levels, drawers and books to the CPU topology. The S390 CPU have specific toplogy features like dedication and polarity to

Re: [PATCH v4 2/2] qtests/arm: add some mte tests

2023-01-16 Thread Philippe Mathieu-Daudé
On 11/1/23 17:13, Cornelia Huck wrote: Acked-by: Thomas Huth Signed-off-by: Cornelia Huck --- tests/qtest/arm-cpu-features.c | 76 ++ 1 file changed, 76 insertions(+) Reviewed-by: Philippe Mathieu-Daudé

Re: [PATCH v2 1/5] hw/arm: Extract at24c_eeprom_init helper from Aspeed and Nuvoton boards

2023-01-16 Thread Cédric Le Goater
On 1/17/23 00:56, Peter Delevoryas wrote: This helper is useful in board initialization because lets users initialize and realize an EEPROM on an I2C bus with a single function call. Signed-off-by: Peter Delevoryas Reviewed-by: Cédric Le Goater Thanks, C. --- hw/arm/aspeed.c

Re: [PATCH 07/11] audio/audio_template: use g_malloc0() to replace audio_calloc()

2023-01-16 Thread Volker Rümelin
Am 16.01.23 um 09:58 schrieb Daniel P. Berrangé: On Sun, Dec 18, 2022 at 06:39:00PM +0100, Volker Rümelin wrote: Am 18.12.22 um 18:26 schrieb Philippe Mathieu-Daudé: On 18/12/22 18:15, Volker Rümelin wrote: Use g_malloc0() as a direct replacement for audio_calloc(). Signed-off-by: Volker

Re: [PATCH] usb-ccid: make ids and descriptor configurable

2023-01-16 Thread Philippe Mathieu-Daudé
Hi Klaus, On 16/1/23 16:46, Ripke, Klaus wrote: Signed-off-by: Klaus Ripke hw/usb/dev-smartcard-reader.c: Set some static values from ccid_properties. ---  hw/usb/dev-smartcard-reader.c | 35 ++-  1 file changed, 30 insertions(+), 5 deletions(-) diff --git

Re: [PATCH 08/11] audio/audio_template: use g_new0() to replace audio_calloc()

2023-01-16 Thread Volker Rümelin
Am 16.01.23 um 10:03 schrieb Daniel P. Berrangé: On Sun, Dec 18, 2022 at 06:15:36PM +0100, Volker Rümelin wrote: Replace audio_calloc() with the equivalent g_new0(). With a n_structs argument >= 1, g_new0() never returns NULL. Also remove the unnecessary NULL checks. Signed-off-by: Volker

Re: [RFC v2 04/13] vdpa: rewind at get_base, not set_base

2023-01-16 Thread Eugenio Perez Martin
On Tue, Jan 17, 2023 at 5:38 AM Jason Wang wrote: > > > 在 2023/1/16 17:53, Eugenio Perez Martin 写道: > > On Mon, Jan 16, 2023 at 4:32 AM Jason Wang wrote: > >> > >> 在 2023/1/13 15:40, Eugenio Perez Martin 写道: > >>> On Fri, Jan 13, 2023 at 5:10 AM Jason Wang wrote: > On Fri, Jan 13, 2023 at

Re: [RFC PATCH for 8.0 10/13] virtio-net: Migrate vhost inflight descriptors

2023-01-16 Thread Jason Wang
On Tue, Jan 17, 2023 at 4:58 AM Michael S. Tsirkin wrote: > > On Wed, Jan 11, 2023 at 01:51:06PM +0800, Jason Wang wrote: > > On Wed, Jan 11, 2023 at 12:40 PM Parav Pandit wrote: > > > > > > > > > > From: Jason Wang > > > > Sent: Tuesday, January 10, 2023 11:35 PM > > > > > > > > On Tue, Jan

Re: [PATCH 6/6] hw/arm/aspeed: Init fby35 BMC FRUID EEPROM

2023-01-16 Thread Philippe Mathieu-Daudé
On 16/1/23 18:23, Peter Delevoryas wrote: On Mon, Jan 16, 2023 at 01:30:19PM +0100, Philippe Mathieu-Daudé wrote: On 14/1/23 18:01, Peter Delevoryas wrote: Signed-off-by: Peter Delevoryas --- hw/arm/aspeed.c | 49 + 1 file changed, 49

Re: [RFC v2 05/13] vdpa net: add migration blocker if cannot migrate cvq

2023-01-16 Thread Jason Wang
在 2023/1/16 17:33, Eugenio Perez Martin 写道: On Mon, Jan 16, 2023 at 6:24 AM Michael S. Tsirkin wrote: On Mon, Jan 16, 2023 at 11:34:20AM +0800, Jason Wang wrote: 在 2023/1/13 15:46, Eugenio Perez Martin 写道: On Fri, Jan 13, 2023 at 5:25 AM Jason Wang wrote: 在 2023/1/13 01:24, Eugenio Pérez

Re: [RFC v2 06/13] vhost: delay set_vring_ready after DRIVER_OK

2023-01-16 Thread Jason Wang
在 2023/1/17 00:16, Eugenio Perez Martin 写道: On Mon, Jan 16, 2023 at 7:37 AM Jason Wang wrote: 在 2023/1/13 16:19, Eugenio Perez Martin 写道: On Fri, Jan 13, 2023 at 5:36 AM Jason Wang wrote: On Fri, Jan 13, 2023 at 1:25 AM Eugenio Pérez wrote: To restore the device at the destination of a

Re: completion timeouts with pin-based interrupts in QEMU hw/nvme

2023-01-16 Thread Keith Busch
On Mon, Jan 16, 2023 at 10:14:07PM +0100, Klaus Jensen wrote: > I noticed that the Linux driver does not use the INTMS/INTMC registers > to mask interrupts on the controller while processing CQEs. While not > required by the spec, it is *recommended* in setups not using MSI-X to > reduce the risk

Re: [RFC v2 04/13] vdpa: rewind at get_base, not set_base

2023-01-16 Thread Jason Wang
在 2023/1/16 17:53, Eugenio Perez Martin 写道: On Mon, Jan 16, 2023 at 4:32 AM Jason Wang wrote: 在 2023/1/13 15:40, Eugenio Perez Martin 写道: On Fri, Jan 13, 2023 at 5:10 AM Jason Wang wrote: On Fri, Jan 13, 2023 at 1:24 AM Eugenio Pérez wrote: At this moment it is only possible to migrate

Re: [RFC v2 02/13] vdpa net: move iova tree creation from init to start

2023-01-16 Thread Jason Wang
在 2023/1/16 17:14, Eugenio Perez Martin 写道: On Mon, Jan 16, 2023 at 4:05 AM Jason Wang wrote: 在 2023/1/13 15:28, Eugenio Perez Martin 写道: On Fri, Jan 13, 2023 at 4:53 AM Jason Wang wrote: On Fri, Jan 13, 2023 at 1:24 AM Eugenio Pérez wrote: Only create iova_tree if and when it is

[PATCH 1/3] tests/tcg: Use SIGKILL for timeout

2023-01-16 Thread Richard Henderson
There are some tests for which SIGTERM appears insufficient. Signed-off-by: Richard Henderson --- tests/tcg/Makefile.target | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/tests/tcg/Makefile.target b/tests/tcg/Makefile.target index 14bc013181..a3b0aaf8af 100644 ---

[PATCH 2/3] plugins: Avoid deadlock in qemu_plugin_user_exit

2023-01-16 Thread Richard Henderson
Use of start_exclusive on this exit path leads to deadlock, in particular when called from dump_core_and_abort. There does not appear to be a need for it. While we're at it, skip the entire function if no plugins. Signed-off-by: Richard Henderson --- plugins/core.c | 6 +++--- 1 file changed,

[PATCH 0/3] tests: Fix some deadlocks

2023-01-16 Thread Richard Henderson
The first patch addresses the fact that linux-user blocks all signals while attempting to handle guest signals (e.g. ABRT), which means that the default TERM sent by timeout has no effect -- KILL instead. When a guest aborts (possible nios2 guest bug), sending SIGABRT to itself, I have caught one

[PATCH 3/3] plugins: Iterate on cb_lists in qemu_plugin_user_exit

2023-01-16 Thread Richard Henderson
Rather than iterate over all plugins for all events, iterate over plugins that have registered a given event. Signed-off-by: Richard Henderson --- plugins/core.c | 7 --- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/plugins/core.c b/plugins/core.c index

Re: [RFC PATCH for 8.0 10/13] virtio-net: Migrate vhost inflight descriptors

2023-01-16 Thread Jason Wang
On Tue, Jan 17, 2023 at 5:02 AM Michael S. Tsirkin wrote: > > On Wed, Dec 07, 2022 at 09:56:20AM +0100, Eugenio Perez Martin wrote: > > > A dumb question, any reason we need bother with virtio-net? It looks > > > to me it's not a must and would complicate migration compatibility. > > > > > > I

Re: Re: Re: [for-8.0 v2 00/11] Refactor cryptodev

2023-01-16 Thread zhenwei pi
On 1/16/23 19:27, Daniel P. Berrangé wrote: On Mon, Jan 16, 2023 at 05:53:07PM +0800, zhenwei pi wrote: On 12/20/22 23:36, Michael S. Tsirkin wrote: On Tue, Nov 22, 2022 at 10:07:45PM +0800, zhenwei pi wrote: v1 -> v2: - fix coding style and use 'g_strjoin()' instead of 'char services[128]'

Re: [PATCH v3 2/7] hw/acpi/acpi_dev_interface: Resolve AcpiDeviceIfClass::madt_cpu

2023-01-16 Thread Bernhard Beschow
Am 16. Januar 2023 16:29:30 UTC schrieb Igor Mammedov : >On Mon, 16 Jan 2023 16:29:03 +0100 >Bernhard Beschow wrote: > >> This class attribute was always set to pc_madt_cpu_entry(). >> pc_madt_cpu_entry() is architecture dependent and was assigned to the >> attribute even in architecture

[PATCH v2 2/5] hw/arm/aspeed: Replace aspeed_eeprom_init with at24c_eeprom_init

2023-01-16 Thread Peter Delevoryas
aspeed_eeprom_init is an exact copy of at24c_eeprom_init, not needed. Signed-off-by: Peter Delevoryas Reviewed-by: Cédric Le Goater Reviewed-by: Philippe Mathieu-Daudé --- hw/arm/aspeed.c | 95 ++--- 1 file changed, 43 insertions(+), 52 deletions(-)

[PATCH v2 4/5] hw/arm/aspeed: Add aspeed_eeprom.c

2023-01-16 Thread Peter Delevoryas
- Create aspeed_eeprom.c and aspeed_eeprom.h - Include aspeed_eeprom.c in CONFIG_ASPEED meson source files - Include aspeed_eeprom.h in aspeed.c - Add fby35_bmc_fruid data - Use new at24c_eeprom_init_rom helper to initialize BMC FRUID EEPROM with data from aspeed_eeprom.c wget

[PATCH v2 1/5] hw/arm: Extract at24c_eeprom_init helper from Aspeed and Nuvoton boards

2023-01-16 Thread Peter Delevoryas
This helper is useful in board initialization because lets users initialize and realize an EEPROM on an I2C bus with a single function call. Signed-off-by: Peter Delevoryas --- hw/arm/aspeed.c | 10 +- hw/arm/npcm7xx_boards.c | 20 +---

[PATCH v2 5/5] hw/nvram/eeprom_at24c: Make reset behavior more like hardware

2023-01-16 Thread Peter Delevoryas
EEPROM's are a form of non-volatile memory. After power-cycling an EEPROM, I would expect the I2C state machine to be reset to default values, but I wouldn't really expect the memory to change at all. The current implementation of the at24c EEPROM resets its internal memory on reset. This matches

[PATCH v2 3/5] hw/nvram/eeprom_at24c: Add init_rom field and at24c_eeprom_init_rom helper

2023-01-16 Thread Peter Delevoryas
Allows users to specify binary data to initialize an EEPROM, allowing users to emulate data programmed at manufacturing time. - Added init_rom and init_rom_size attributes to TYPE_AT24C_EE - Added at24c_eeprom_init_rom helper function to initialize attributes Signed-off-by: Peter Delevoryas ---

[PATCH v2 0/5] hw/nvram/eeprom_at24c: Cleanup + FRUID EEPROM init example

2023-01-16 Thread Peter Delevoryas
v1: https://lore.kernel.org/qemu-devel/20230114170151.87833-1-pe...@pjd.dev/ v2: - Squashed 3 commits from original series into extract helper commit - Dropped last 2 commits from original series - Changed at24c_eeprom_init to return the I2CSlave object - Added commit to introduce

[PULL 3/5] tcg: add perfmap and jitdump

2023-01-16 Thread Richard Henderson
From: Ilya Leoshkevich Add ability to dump /tmp/perf-.map and jit-.dump. The first one allows the perf tool to map samples to each individual translation block. The second one adds the ability to resolve symbol names, line numbers and inspect JITed code. Example of use: perf record

[PULL 0/5] tcg patch queue

2023-01-16 Thread Richard Henderson
The following changes since commit fb7e7990342e59cf67dbd895c1a1e3fb1741df7a: tests/qtest/qom-test: Do not print tested properties by default (2023-01-16 15:00:57 +) are available in the Git repository at: https://gitlab.com/rth7680/qemu.git tags/pull-tcg-20230116 for you to fetch

[PULL 5/5] accel/tcg: Split out cpu_exec_{setjmp,loop}

2023-01-16 Thread Richard Henderson
Recently the g_assert(cpu == current_cpu) test has been intermittently failing with gcc. Reorg the code around the setjmp to minimize the lifetime of the cpu variable affected by the setjmp. This appears to fix the existing issue with clang as well. Resolves:

[PULL 4/5] util/bufferiszero: Use __attribute__((target)) for avx2/avx512

2023-01-16 Thread Richard Henderson
Use the attribute, which is supported by clang, instead of the #pragma, which is not supported and, for some reason, also not detected by the meson probe, so we fail by -Werror. Include only as that is the outermost "official" header for these intrinsics -- emmintrin.h and smmintrin -- are older

[PULL 2/5] accel/tcg: Add debuginfo support

2023-01-16 Thread Richard Henderson
From: Ilya Leoshkevich Add libdw-based functions for loading and querying debuginfo. Load debuginfo from the system and the linux-user loaders. This is useful for the upcoming perf support, which can then put human-readable guest symbols instead of raw guest PCs into perfmap and jitdump files.

[PULL 0/5] tcg patch queue

2023-01-16 Thread Richard Henderson
The following changes since commit fb7e7990342e59cf67dbd895c1a1e3fb1741df7a: tests/qtest/qom-test: Do not print tested properties by default (2023-01-16 15:00:57 +) are available in the Git repository at: https://gitlab.com/rth7680/qemu.git tags/pull-tcg-20230116 for you to fetch

[PULL 1/5] linux-user: Clean up when exiting due to a signal

2023-01-16 Thread Richard Henderson
From: Ilya Leoshkevich When exiting due to an exit() syscall, qemu-user calls preexit_cleanup(), but this is currently not the case when exiting due to a signal. This leads to various buffers not being flushed (e.g., for gprof, for gcov, and for the upcoming perf support). Add the missing call.

[RFC PATCH v7bis 04/19] hw/xen: Pass grant ref to gnttab unmap

2023-01-16 Thread David Woodhouse
From: David Woodhouse Under real Xen we only need to munmap() but in the emulation code will want to know the original ref to keep the the tracking straight. Signed-off-by: David Woodhouse --- hw/9pfs/xen-9p-backend.c| 7 --- hw/block/dataplane/xen-block.c | 1 +

[RFC PATCH v7bis 19/19] hw/xen: Support MSI mapping to PIRQ

2023-01-16 Thread David Woodhouse
From: David Woodhouse The way that Xen handles MSI PIRQs is kind of awful. There is a special MSI message which targets a PIRQ. The vector in the low bits of data must be zero. The low 8 bits of the PIRQ# are in the destination ID field, the extended destination ID field is unused, and instead

[RFC PATCH v7bis 15/19] i386/xen: Initialize XenBus and legacy backends from pc_init1()

2023-01-16 Thread David Woodhouse
From: David Woodhouse Now that we're close to being able to use the PV backends without actual Xen, move the bus instantiation out from xen_hvm_init_pc() to pc_init1(). However, still only do it for (xen_mode == XEN_ATTACH) (i.e. when running on true Xen) because we don't have XenStore ops for

[RFC PATCH v7bis 12/19] hw/xen: Add backend implementation of grant table operations

2023-01-16 Thread David Woodhouse
From: David Woodhouse This is limited to mapping a single grant at a time, because under Xen the pages are mapped *contiguously* into qemu's address space, and that's very hard to do when those pages actually come from anonymous mappings in qemu in the first place. Eventually perhaps we can

[RFC PATCH v7bis 00/19] Emulated Xen PV backend and PIRQ support

2023-01-16 Thread David Woodhouse
This is what's in flux on top of the series posted as v7. It contains both the PV back end support and the PIRQ support which were previous posted in separate series. The former is mostly unchanged, and we still need to either port that C++ XenStore implementation or make Xen's own xenstored stop

[RFC PATCH v7bis 07/19] hw/xen: Move xenstore_store_pv_console_info to xen_console.c

2023-01-16 Thread David Woodhouse
From: David Woodhouse There's no need for this to be in the Xen accel code, and as we want to use the Xen console support with KVM-emulated Xen we'll want to have a platform-agnostic version of it. Make it use GString to build up the path while we're at it. Signed-off-by: David Woodhouse ---

[RFC PATCH v7bis 03/19] hw/xen: Add gnttab operations to allow redirection to internal emulation

2023-01-16 Thread David Woodhouse
From: David Woodhouse In emulation, mapping more than one grant ref to be virtually contiguous would be fairly difficult. The best way to do it might be to make the ram_block mappings actually backed by a file (shmem or a deleted file, perhaps) so that we can have multiple *shared* mappings of

[RFC PATCH v7bis 06/19] hw/xen: Add xenstore operations to allow redirection to internal emulation

2023-01-16 Thread David Woodhouse
From: Paul Durrant Signed-off-by: Paul Durrant Signed-off-by: David Woodhouse --- accel/xen/xen-all.c | 11 +- hw/char/xen_console.c | 2 +- hw/xen/xen-bus-helper.c | 61 +++ hw/xen/xen-bus.c| 258

[RFC PATCH v7bis 01/19] hw/xen: Add evtchn operations to allow redirection to internal emulation

2023-01-16 Thread David Woodhouse
From: David Woodhouse Signed-off-by: David Woodhouse Signed-off-by: Paul Durrant --- hw/9pfs/xen-9p-backend.c| 24 +++--- hw/i386/xen/xen-hvm.c | 28 --- hw/xen/meson.build | 1 + hw/xen/xen-bus.c| 22 +++---

[RFC PATCH v7bis 16/19] i386/xen: Implement HYPERVISOR_physdev_op

2023-01-16 Thread David Woodhouse
From: David Woodhouse Just hook up the basic hypercalls to stubs in xen_evtchn.c for now. Signed-off-by: David Woodhouse --- hw/i386/kvm/xen_evtchn.c | 25 hw/i386/kvm/xen_evtchn.h | 11 target/i386/kvm/xen-compat.h | 19 ++ target/i386/kvm/xen-emu.c| 118

[RFC PATCH v7bis 02/19] hw/xen: Add emulated evtchn ops

2023-01-16 Thread David Woodhouse
From: David Woodhouse Signed-off-by: David Woodhouse --- hw/i386/kvm/xen_evtchn.c | 15 +++ 1 file changed, 15 insertions(+) diff --git a/hw/i386/kvm/xen_evtchn.c b/hw/i386/kvm/xen_evtchn.c index b23bb71abb..b571517b2c 100644 --- a/hw/i386/kvm/xen_evtchn.c +++

[RFC PATCH v7bis 18/19] hw/xen: Support GSI mapping to PIRQ

2023-01-16 Thread David Woodhouse
From: David Woodhouse If I advertise XENFEAT_hvm_pirqs then a guest now boots successfully as long as I tell it 'pci=nomsi'. [root@localhost ~]# cat /proc/interrupts CPU0 0: 52 IO-APIC 2-edge timer 1: 16 xen-pirq 1-ioapic-edge i8042 4: 1534

[RFC PATCH v7bis 11/19] hw/xen: Map guest XENSTORE_PFN grant in emulated Xenstore

2023-01-16 Thread David Woodhouse
From: David Woodhouse Signed-off-by: David Woodhouse --- hw/i386/kvm/xen_xenstore.c | 13 ++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/hw/i386/kvm/xen_xenstore.c b/hw/i386/kvm/xen_xenstore.c index 6369e29f59..6e712816d3 100644 --- a/hw/i386/kvm/xen_xenstore.c

[RFC PATCH v7bis 10/19] hw/xen: Build PV backend drivers for XENFV_MACHINE

2023-01-16 Thread David Woodhouse
From: David Woodhouse Now that we have the redirectable Xen backend operations we can build the PV backends even without the Xen libraries. Signed-off-by: David Woodhouse --- hw/9pfs/meson.build| 2 +- hw/block/dataplane/meson.build | 2 +- hw/block/meson.build | 2 +-

[RFC PATCH v7bis 05/19] hw/xen: Add foreignmem operations to allow redirection to internal emulation

2023-01-16 Thread David Woodhouse
From: David Woodhouse Signed-off-by: David Woodhouse Signed-off-by: Paul Durrant --- hw/char/xen_console.c| 8 ++-- hw/display/xenfb.c | 20 +- hw/xen/xen-operations.c | 63 include/hw/xen/xen_backend_ops.h | 26

[RFC PATCH v7bis 09/19] hw/xen: Rename xen_common.h to xen_native.h

2023-01-16 Thread David Woodhouse
From: David Woodhouse This header is now only for native Xen code, not PV backends that may be used in Xen emulation. Since the toolstack libraries may depend on the specific version of Xen headers that they pull in (and will set the __XEN_TOOLS__ macro to enable internal definitions that they

[RFC PATCH v7bis 08/19] hw/xen: Use XEN_PAGE_SIZE in PV backend drivers

2023-01-16 Thread David Woodhouse
From: David Woodhouse XC_PAGE_SIZE comes from the actual Xen libraries, while XEN_PAGE_SIZE is provided by QEMU itself in xen_backend_ops.h. For backends which may be built for emulation mode, use the latter. Signed-off-by: David Woodhouse --- hw/block/dataplane/xen-block.c | 8

[RFC PATCH v7bis 13/19] hw/xen: Implement soft reset for emulated gnttab

2023-01-16 Thread David Woodhouse
From: David Woodhouse This is only part of it; we will also need to get the PV back end drivers to tear down their own mappings (or do it for them, but they kind of need to stop using the pointers too). Signed-off-by: David Woodhouse --- hw/i386/kvm/xen_gnttab.c | 26

[RFC PATCH v7bis 17/19] hw/xen: Implement emulated PIRQ hypercall support

2023-01-16 Thread David Woodhouse
From: David Woodhouse This wires up the basic infrastructure but the actual interrupts aren't there yet, so don't advertise it to the guest. Signed-off-by: David Woodhouse --- hw/i386/kvm/trace-events | 4 + hw/i386/kvm/trace.h | 1 + hw/i386/kvm/xen_evtchn.c | 252

[PATCH v7 24/51] i386/xen: implement HVMOP_set_evtchn_upcall_vector

2023-01-16 Thread David Woodhouse
From: Ankur Arora The HVMOP_set_evtchn_upcall_vector hypercall sets the per-vCPU upcall vector, to be delivered to the local APIC just like an MSI (with an EOI). This takes precedence over the system-wide delivery method set by the HVMOP_set_param hypercall with HVM_PARAM_CALLBACK_IRQ. It's

[PATCH v7 04/51] i386/kvm: Add xen-version KVM accelerator property and init KVM Xen support

2023-01-16 Thread David Woodhouse
From: David Woodhouse This just initializes the basic Xen support in KVM for now. Only permitted on TYPE_PC_MACHINE because that's where the sysbus devices for Xen heap overlay, event channel, grant tables and other stuff will exist. There's no point having the basic hypercall support if nothing

[PATCH v7 48/51] i386/xen: handle HVMOP_get_param

2023-01-16 Thread David Woodhouse
From: Joao Martins Which is used to fetch xenstore PFN and port to be used by the guest. This is preallocated by the toolstack when guest will just read those and use it straight away. Signed-off-by: Joao Martins Signed-off-by: David Woodhouse --- target/i386/kvm/xen-emu.c | 39

[PATCH v7 06/51] i386/hvm: Set Xen vCPU ID in KVM

2023-01-16 Thread David Woodhouse
From: David Woodhouse There are (at least) three different vCPU ID number spaces. One is the internal KVM vCPU index, based purely on which vCPU was chronologically created in the kernel first. If userspace threads are all spawned and create their KVM vCPUs in essentially random order, then the

[PATCH v7 13/51] hw/xen: Add xen_overlay device for emulating shared xenheap pages

2023-01-16 Thread David Woodhouse
From: David Woodhouse For the shared info page and for grant tables, Xen shares its own pages from the "Xen heap" to the guest. The guest requests that a given page from a certain address space (XENMAPSPACE_shared_info, etc.) be mapped to a given GPA using the XENMEM_add_to_physmap hypercall.

[PATCH v7 00/51] Xen support under KVM

2023-01-16 Thread David Woodhouse
Even before this is merged, we've been able to use it to find bugs in the Linux Xen guest support, and test the fixes. https://lore.kernel.org/all/4bffa69a949bfdc92c4a18e5a1c3cbb3b94a0d32.ca...@infradead.org/ https://lore.kernel.org/all/871qnunycr.ffs@tglx/ Version 7 is some trivial cosmetics,

[PATCH v7 43/51] hw/xen: Support mapping grant frames

2023-01-16 Thread David Woodhouse
From: David Woodhouse Signed-off-by: David Woodhouse --- hw/i386/kvm/xen_gnttab.c | 80 ++- hw/i386/kvm/xen_overlay.c | 2 +- hw/i386/kvm/xen_overlay.h | 2 + 3 files changed, 82 insertions(+), 2 deletions(-) diff --git a/hw/i386/kvm/xen_gnttab.c

[PATCH v7 41/51] kvm/i386: Add xen-gnttab-max-frames property

2023-01-16 Thread David Woodhouse
From: David Woodhouse Signed-off-by: David Woodhouse --- accel/kvm/kvm-all.c | 1 + include/sysemu/kvm_int.h | 1 + include/sysemu/kvm_xen.h | 1 + target/i386/kvm/kvm.c | 34 ++ target/i386/kvm/xen-emu.c | 6 ++ 5 files changed, 43

[PATCH v7 12/51] i386/xen: Implement SCHEDOP_poll and SCHEDOP_yield

2023-01-16 Thread David Woodhouse
From: David Woodhouse They both do the same thing and just call sched_yield. This is enough to stop the Linux guest panicking when running on a host kernel which doesn't intercept SCHEDOP_poll and lets it reach userspace. Signed-off-by: David Woodhouse Reviewed-by: Paul Durrant ---

[PATCH v7 14/51] i386/xen: add pc_machine_kvm_type to initialize XEN_EMULATE mode

2023-01-16 Thread David Woodhouse
From: David Woodhouse The xen_overlay device (and later similar devices for event channels and grant tables) need to be instantiated. Do this from a kvm_type method on the PC machine derivatives, since KVM is only way to support Xen emulation for now. Signed-off-by: David Woodhouse ---

[PATCH v7 46/51] i386/xen: handle PV timer hypercalls

2023-01-16 Thread David Woodhouse
From: Joao Martins Introduce support for one shot and periodic mode of Xen PV timers, whereby timer interrupts come through a special virq event channel with deadlines being set through: 1) set_timer_op hypercall (only oneshot) 2) vcpu_op hypercall for {set,stop}_{singleshot,periodic}_timer

[PATCH v7 30/51] hw/xen: Implement EVTCHNOP_unmask

2023-01-16 Thread David Woodhouse
From: David Woodhouse This finally comes with a mechanism for actually injecting events into the guest vCPU, with all the atomic-test-and-set that's involved in setting the bit in the shinfo, then the index in the vcpu_info, and injecting either the lapic vector as MSI, or letting KVM inject the

[PATCH v7 10/51] i386/xen: implement HYPERVISOR_xen_version

2023-01-16 Thread David Woodhouse
From: Joao Martins This is just meant to serve as an example on how we can implement hypercalls. xen_version specifically since Qemu does all kind of feature controllability. So handling that here seems appropriate. Signed-off-by: Joao Martins [dwmw2: Implement kvm_gva_rw() safely]

[PATCH v7 33/51] hw/xen: Implement EVTCHNOP_send

2023-01-16 Thread David Woodhouse
From: David Woodhouse Signed-off-by: David Woodhouse --- hw/i386/kvm/xen_evtchn.c | 180 ++ hw/i386/kvm/xen_evtchn.h | 2 + target/i386/kvm/xen-emu.c | 12 +++ 3 files changed, 194 insertions(+) diff --git a/hw/i386/kvm/xen_evtchn.c

[PATCH v7 42/51] hw/xen: Add xen_gnttab device for grant table emulation

2023-01-16 Thread David Woodhouse
From: David Woodhouse Signed-off-by: David Woodhouse --- hw/i386/kvm/meson.build | 1 + hw/i386/kvm/xen_gnttab.c | 110 ++ hw/i386/kvm/xen_gnttab.h | 18 +++ hw/i386/pc.c | 2 + target/i386/kvm/xen-emu.c | 3 ++ 5 files changed,

[PATCH v7 20/51] i386/xen: handle VCPUOP_register_vcpu_info

2023-01-16 Thread David Woodhouse
From: Joao Martins Handle the hypercall to set a per vcpu info, and also wire up the default vcpu_info in the shared_info page for the first 32 vCPUs. To avoid deadlock within KVM a vCPU thread must set its *own* vcpu_info rather than it being set from the context in which the hypercall is

[PATCH v7 49/51] hw/xen: Add backend implementation of interdomain event channel support

2023-01-16 Thread David Woodhouse
From: David Woodhouse The provides the QEMU side of interdomain event channels, allowing events to be sent to/from the guest. The API mirrors libxenevtchn, and in time both this and the real Xen one will be available through ops structures so that the PV backend drivers can use the correct one

[PATCH v7 29/51] hw/xen: Implement EVTCHNOP_close

2023-01-16 Thread David Woodhouse
From: David Woodhouse It calls an internal close_port() helper which will also be used from EVTCHNOP_reset and will actually do the work to disconnect/unbind a port once any of that is actually implemented in the first place. That in turn calls a free_port() internal function which will be in

[PATCH v7 15/51] i386/xen: manage and save/restore Xen guest long_mode setting

2023-01-16 Thread David Woodhouse
From: David Woodhouse Xen will "latch" the guest's 32-bit or 64-bit ("long mode") setting when the guest writes the MSR to fill in the hypercall page, or when the guest sets the event channel callback in HVM_PARAM_CALLBACK_IRQ. KVM handles the former and sets the kernel's long_mode flag

[PATCH v7 11/51] i386/xen: implement HYPERVISOR_sched_op, SCHEDOP_shutdown

2023-01-16 Thread David Woodhouse
From: Joao Martins It allows to shutdown itself via hypercall with any of the 3 reasons: 1) self-reboot 2) shutdown 3) crash Implementing SCHEDOP_shutdown sub op let us handle crashes gracefully rather than leading to triple faults if it remains unimplemented. In addition, the

[PATCH v7 40/51] hw/xen: Support HVM_PARAM_CALLBACK_TYPE_PCI_INTX callback

2023-01-16 Thread David Woodhouse
From: David Woodhouse The guest is permitted to specify an arbitrary domain/bus/device/function and INTX pin from which the callback IRQ shall appear to have come. In QEMU we can only easily do this for devices that actually exist, and even that requires us "knowing" that it's a PCMachine in

[PATCH v7 22/51] i386/xen: handle VCPUOP_register_runstate_memory_area

2023-01-16 Thread David Woodhouse
From: Joao Martins Allow guest to setup the vcpu runstates which is used as steal clock. Signed-off-by: Joao Martins Signed-off-by: David Woodhouse Reviewed-by: Paul Durrant --- target/i386/cpu.h | 1 + target/i386/kvm/xen-emu.c | 57 +++

[PATCH v7 17/51] i386/xen: implement XENMEM_add_to_physmap_batch

2023-01-16 Thread David Woodhouse
From: David Woodhouse Signed-off-by: David Woodhouse Reviewed-by: Paul Durrant --- target/i386/kvm/xen-compat.h | 24 + target/i386/kvm/xen-emu.c| 69 2 files changed, 93 insertions(+) diff --git a/target/i386/kvm/xen-compat.h

[PATCH v7 38/51] i386/xen: add monitor commands to test event injection

2023-01-16 Thread David Woodhouse
From: Joao Martins Specifically add listing, injection of event channels. Signed-off-by: Joao Martins Signed-off-by: David Woodhouse Acked-by: Dr. David Alan Gilbert --- hmp-commands.hx | 29 hw/i386/kvm/meson.build | 4 ++ hw/i386/kvm/xen-stubs.c | 25 +++

[PATCH v7 36/51] hw/xen: Implement EVTCHNOP_bind_vcpu

2023-01-16 Thread David Woodhouse
From: David Woodhouse Signed-off-by: David Woodhouse --- hw/i386/kvm/xen_evtchn.c | 40 +++ hw/i386/kvm/xen_evtchn.h | 2 ++ target/i386/kvm/xen-emu.c | 12 3 files changed, 54 insertions(+) diff --git a/hw/i386/kvm/xen_evtchn.c

[PATCH v7 28/51] hw/xen: Implement EVTCHNOP_status

2023-01-16 Thread David Woodhouse
From: David Woodhouse This adds the basic structure for maintaining the port table and reporting the status of ports therein. Signed-off-by: David Woodhouse --- hw/i386/kvm/xen_evtchn.c | 104 ++ hw/i386/kvm/xen_evtchn.h | 3 ++ include/sysemu/kvm_xen.h

[PATCH v7 45/51] hw/xen: Implement GNTTABOP_query_size

2023-01-16 Thread David Woodhouse
From: David Woodhouse Signed-off-by: David Woodhouse --- hw/i386/kvm/xen_gnttab.c | 19 +++ hw/i386/kvm/xen_gnttab.h | 2 ++ target/i386/kvm/xen-emu.c | 16 +++- 3 files changed, 36 insertions(+), 1 deletion(-) diff --git a/hw/i386/kvm/xen_gnttab.c

[PATCH v7 19/51] i386/xen: implement HYPERVISOR_vcpu_op

2023-01-16 Thread David Woodhouse
From: Joao Martins This is simply when guest tries to register a vcpu_info and since vcpu_info placement is optional in the minimum ABI therefore we can just fail with -ENOSYS Signed-off-by: Joao Martins Signed-off-by: David Woodhouse Reviewed-by: Paul Durrant --- target/i386/kvm/xen-emu.c

[PATCH v7 27/51] i386/xen: Add support for Xen event channel delivery to vCPU

2023-01-16 Thread David Woodhouse
From: David Woodhouse The kvm_xen_inject_vcpu_callback_vector() function will either deliver the per-vCPU local APIC vector (as an MSI), or just kick the vCPU out of the kernel to trigger KVM's automatic delivery of the global vector. Support for asserting the GSI/PCI_INTX callbacks will come

[PATCH v7 09/51] i386/xen: handle guest hypercalls

2023-01-16 Thread David Woodhouse
From: Joao Martins This means handling the new exit reason for Xen but still crashing on purpose. As we implement each of the hypercalls we will then return the right return code. Signed-off-by: Joao Martins [dwmw2: Add CPL to hypercall tracing, disallow hypercalls from CPL > 0] Signed-off-by:

[PATCH v7 37/51] hw/xen: Implement EVTCHNOP_reset

2023-01-16 Thread David Woodhouse
From: David Woodhouse Signed-off-by: David Woodhouse --- hw/i386/kvm/xen_evtchn.c | 29 + hw/i386/kvm/xen_evtchn.h | 3 +++ target/i386/kvm/xen-emu.c | 17 + 3 files changed, 49 insertions(+) diff --git a/hw/i386/kvm/xen_evtchn.c

[PATCH v7 02/51] xen: add CONFIG_XENFV_MACHINE and CONFIG_XEN_EMU options for Xen emulation

2023-01-16 Thread David Woodhouse
From: David Woodhouse The XEN_EMU option will cover core Xen support in target/, which exists only for x86 with KVM today but could theoretically also be implemented on Arm/Aarch64 and with TCG or other accelerators. It will also cover the support for architecture-independent grant table and

[PATCH v7 16/51] i386/xen: implement HYPERVISOR_memory_op

2023-01-16 Thread David Woodhouse
From: Joao Martins Specifically XENMEM_add_to_physmap with space XENMAPSPACE_shared_info to allow the guest to set its shared_info page. Signed-off-by: Joao Martins [dwmw2: Use the xen_overlay device, add compat support] Signed-off-by: David Woodhouse Reviewed-by: Paul Durrant ---

[PATCH v7 50/51] hw/xen: Add xen_xenstore device for xenstore emulation

2023-01-16 Thread David Woodhouse
From: David Woodhouse Just the basic shell, with the event channel hookup. It only dumps the buffer for now; a real ring implmentation will come in a subsequent patch. Signed-off-by: David Woodhouse --- hw/i386/kvm/meson.build| 1 + hw/i386/kvm/xen_evtchn.c | 1 +

[PATCH v7 03/51] xen: Add XEN_DISABLED mode and make it default

2023-01-16 Thread David Woodhouse
From: David Woodhouse Also set XEN_ATTACH mode in xen_init() to reflect the truth; not that anyone ever cared before. It was *only* ever checked in xen_init_pv() before. Suggested-by: Paolo Bonzini Signed-off-by: David Woodhouse Reviewed-by: Paul Durrant --- accel/xen/xen-all.c | 2 ++

[PATCH v7 25/51] i386/xen: implement HVMOP_set_param

2023-01-16 Thread David Woodhouse
From: Ankur Arora This is the hook for adding the HVM_PARAM_CALLBACK_IRQ parameter in a subsequent commit. Signed-off-by: Ankur Arora Signed-off-by: Joao Martins [dwmw2: Split out from another commit] Signed-off-by: David Woodhouse Reviewed-by: Paul Durrant --- target/i386/kvm/xen-emu.c |

[PATCH v7 26/51] hw/xen: Add xen_evtchn device for event channel emulation

2023-01-16 Thread David Woodhouse
From: David Woodhouse Include basic support for setting HVM_PARAM_CALLBACK_IRQ to the global vector method HVM_PARAM_CALLBACK_TYPE_VECTOR, which is handled in-kernel by raising the vector whenever the vCPU's vcpu_info->evtchn_upcall_pending flag is set. Signed-off-by: David Woodhouse ---

[PATCH v7 51/51] hw/xen: Add basic ring handling to xenstore

2023-01-16 Thread David Woodhouse
From: David Woodhouse Extract requests, return ENOSYS to all of them. This is enough to allow older Linux guests to boot, as they need *something* back but it doesn't matter much what. In the first instance we're likely to wire this up over a UNIX socket to an actual xenstored implementation,

[PATCH v7 31/51] hw/xen: Implement EVTCHNOP_bind_virq

2023-01-16 Thread David Woodhouse
From: David Woodhouse Add the array of virq ports to each vCPU so that we can deliver timers, debug ports, etc. Global virqs are allocated against vCPU 0 initially, but can be migrated to other vCPUs (when we implement that). The kernel needs to know about VIRQ_TIMER in order to accelerate

[PATCH v7 32/51] hw/xen: Implement EVTCHNOP_bind_ipi

2023-01-16 Thread David Woodhouse
From: David Woodhouse Signed-off-by: David Woodhouse --- hw/i386/kvm/xen_evtchn.c | 69 +++ hw/i386/kvm/xen_evtchn.h | 2 ++ target/i386/kvm/xen-emu.c | 15 + 3 files changed, 86 insertions(+) diff --git a/hw/i386/kvm/xen_evtchn.c

[PATCH v7 05/51] i386/kvm: handle Xen HVM cpuid leaves

2023-01-16 Thread David Woodhouse
From: Joao Martins Introduce support for emulating CPUID for Xen HVM guests. It doesn't make sense to advertise the KVM leaves to a Xen guest, so do Xen unconditionally when the xen-version machine property is set. Signed-off-by: Joao Martins [dwmw2: Obtain xen_version from KVM property, make

  1   2   3   4   >