Re: [PATCH v7 11/12] hw/riscv: virt: Add PMU DT node to the device tree

2022-04-08 Thread Alistair Francis
On Thu, Mar 31, 2022 at 10:18 AM Atish Patra wrote: > > Qemu virt machine can support few cache events and cycle/instret counters. > It also supports counter overflow for these events. > > Add a DT node so that OpenSBI/Linux kernel is aware of the virt machine > capabilities. There are some dummy

[PATCH v5 0/2] Option to take screenshot with screendump as PNG

2022-04-08 Thread Kshitij Suri
This patch series aims to add PNG support using libpng to screendump method. Currently screendump only supports PPM format, which is uncompressed. PATCH 1 phases out CONFIG_VNC_PNG parameter and replaces it with CONFIG_PNG which detects libpng support. PATCH 2 contains core logic for PNG creation

[PATCH v5 1/2] Replacing CONFIG_VNC_PNG with CONFIG_PNG

2022-04-08 Thread Kshitij Suri
Libpng is only detected if VNC is enabled currently. This patch adds a generalised png option in the meson build which is aimed to replace use of CONFIG_VNC_PNG with CONFIG_PNG. Signed-off-by: Kshitij Suri Reviewed-by: Daniel P. Berrangé --- meson.build| 12 +++- meson_options.

[PATCH v5 2/2] Added parameter to take screenshot with screendump as PNG

2022-04-08 Thread Kshitij Suri
Currently screendump only supports PPM format, which is un-compressed. Added a "format" parameter to QMP and HMP screendump command to support PNG image capture using libpng. QMP example usage: { "execute": "screendump", "arguments": { "filename": "/tmp/image", "format":"png" } } HMP example usag

Re: [PATCH 1/3] vhost: Refactor vhost_reset_device() in VhostOps

2022-04-08 Thread Michael Qiu
在 2022/4/7 15:35, Jason Wang 写道: 在 2022/4/2 下午1:14, Michael Qiu 写道: On 2022/4/2 10:38, Jason Wang wrote: 在 2022/4/1 下午7:06, Michael Qiu 写道: Currently in vhost framwork, vhost_reset_device() is misnamed. Actually, it should be vhost_reset_owner(). In vhost user, it make compatible with

Re: [PATCH 1/2] gdbstub: Set current_cpu for memory read write

2022-04-08 Thread Alex Bennée
Bin Meng writes: > On Sat, Apr 2, 2022 at 7:20 PM Bin Meng wrote: >> >> On Tue, Mar 29, 2022 at 12:43 PM Bin Meng wrote: >> > >> > On Mon, Mar 28, 2022 at 5:10 PM Peter Maydell >> > wrote: >> > > >> > > On Mon, 28 Mar 2022 at 03:10, Bin Meng wrote: >> > > > IMHO it's too bad to just ignore

Re: Wiki: Update package name in build instructions

2022-04-08 Thread Thomas Huth
On 07/01/2022 18.10, Lucas Hecht wrote: Hi there, could someone please give me a wiki account or make this minor change themself: In the wiki article "Host/Linux" under "Recommended additional packages" libvte-2.90-dev should be changed to libvte-2.91-dev since the former is not available any

[PATCH] Warn user if the vga flag is passed but no vga device is created

2022-04-08 Thread Gautam Agrawal
This patch is in regards to this issue:https://gitlab.com/qemu-project/qemu/-/issues/581#. A global boolean variable "vga_interface_created"(declared in softmmu/globals.c) has been used to track the creation of vga interface. If the vga flag is passed in the command line "default_vga"(declared in

Re: [PATCH v9 33/45] cxl/cxl-host: Add memops for CFMWS region.

2022-04-08 Thread Jonathan Cameron via
On Thu, 7 Apr 2022 21:07:06 + Tong Zhang wrote: > On 4/4/22 08:14, Jonathan Cameron wrote: > > From: Jonathan Cameron > > > > > > +static MemTxResult cxl_read_cfmws(void *opaque, hwaddr addr, uint64_t > > *data, > > + unsigned size, MemTxAttrs attrs) > > +{

[PATCH 0/5] Vhost-user: add Virtio RSS support

2022-04-08 Thread Maxime Coquelin
The goal of this series is to add support for Virtio RSS feature to the Vhost-user backend. First patches are preliminary reworks to support variable RSS key and indirection table length. eBPF change only adds checks on whether the key length is 40B, it does not add support for longer keys. Vhost

[PATCH 4/5] docs: introduce RSS support in Vhost-user specification

2022-04-08 Thread Maxime Coquelin
This patch documents RSS feature in Vhost-user specification. Two new requests are introduced backed by a dedicated protocol feature. First one is to query the Vhost-user slave RSS capabilities such as supported hash types, maximum key length and indirection table size. The second one is to provi

[PATCH 1/5] ebpf: pass and check RSS key length to the loader

2022-04-08 Thread Maxime Coquelin
This patch is preliminary rework to support RSS with Vhost-user backends. The Vhost-user implementation will allow RSS hash key of 40 bytes or more as allowed by the Virtio specification, whereas the eBPF-based Vhost-kernel solution only supports 40 bytes keys. This patch adds the RSS key length t

[PATCH 5/5] vhost-user: add RSS support

2022-04-08 Thread Maxime Coquelin
This patch implements the RSS feature to the Vhost-user backend. The implementation supports up to 52 bytes RSS key length, and 512 indirection table entries. Signed-off-by: Maxime Coquelin --- hw/virtio/vhost-user.c | 146 - 1 file changed, 145 insertion

[PATCH 3/5] virtio-net: add RSS support for Vhost backends

2022-04-08 Thread Maxime Coquelin
This patch introduces new Vhost backend callbacks to support RSS, and makes them called in Virtio-net device. It will be used by Vhost-user backend implementation to support RSS feature. Signed-off-by: Maxime Coquelin --- hw/net/vhost_net-stub.c | 10 ++ hw/net/vhost_net.c

[PATCH 2/5] virtio-net: prepare for variable RSS key and indir table lengths

2022-04-08 Thread Maxime Coquelin
This patch is a preliminary rework to support RSS with Vhost-user backends. It enables supporting different types of hashes, key lengths and indirection table lengths. This patch does not introduces behavioral changes. Signed-off-by: Maxime Coquelin --- ebpf/ebpf_rss.c| 8 -

Re: [PATCH v5 02/13] mm: Introduce memfile_notifier

2022-04-08 Thread Chao Peng
On Tue, Mar 29, 2022 at 06:45:16PM +, Sean Christopherson wrote: > On Thu, Mar 10, 2022, Chao Peng wrote: > > diff --git a/mm/Makefile b/mm/Makefile > > index 70d4309c9ce3..f628256dce0d 100644 > > +void memfile_notifier_invalidate(struct memfile_notifier_list *list, > > +

Re: [PATCH v5 04/13] mm/shmem: Restrict MFD_INACCESSIBLE memory against RLIMIT_MEMLOCK

2022-04-08 Thread Chao Peng
On Thu, Apr 07, 2022 at 04:05:36PM +, Sean Christopherson wrote: > On Thu, Mar 10, 2022, Chao Peng wrote: > > Since page migration / swapping is not supported yet, MFD_INACCESSIBLE > > memory behave like longterm pinned pages and thus should be accounted to > > mm->pinned_vm and be restricted b

[PATCH v2 0/2] Remove PCIE root bridge LSI on powernv

2022-04-08 Thread Frederic Barrat
The powernv8/powernv9/powernv10 machines allocate a LSI for their root port bridge, which is not the case on real hardware. The default root port implementation in qemu requests a LSI. Since the powernv implementation derives from it, that's where the LSI is coming from. This series fixes it, so th

[PATCH v2 1/2] pcie: Don't try triggering a LSI when not defined

2022-04-08 Thread Frederic Barrat
This patch skips [de]asserting a LSI interrupt if the device doesn't have any LSI defined. Doing so would trigger an assert in pci_irq_handler(). The PCIE root port implementation in qemu requests a LSI (INTA), but a subclass may want to change that behavior since it's a valid configuration. For e

[PATCH v2 2/2] ppc/pnv: Remove LSI on the PCIE host bridge

2022-04-08 Thread Frederic Barrat
The phb3/phb4/phb5 root ports inherit from the default PCIE root port implementation, which requests a LSI interrupt (#INTA). On real hardware (POWER8/POWER9/POWER10), there is no such LSI. This patch corrects it so that it matches the hardware. As a consequence, the device tree previously generat

Re: [PATCH v5 05/13] KVM: Extend the memslot to support fd-based private memory

2022-04-08 Thread Chao Peng
On Mon, Mar 28, 2022 at 09:27:32PM +, Sean Christopherson wrote: > On Thu, Mar 10, 2022, Chao Peng wrote: > > Extend the memslot definition to provide fd-based private memory support > > by adding two new fields (private_fd/private_offset). The memslot then > > can maintain memory for both shar

[RFC PATCH v5 01/23] vdpa: Add missing tracing to batch mapping functions

2022-04-08 Thread Eugenio Pérez
These functions were not traced properly. Signed-off-by: Eugenio Pérez --- hw/virtio/vhost-vdpa.c | 2 ++ hw/virtio/trace-events | 2 ++ 2 files changed, 4 insertions(+) diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c index 8adf7c0b92..9e5fe15d03 100644 --- a/hw/virtio/vhost-vdpa.c

[RFC PATCH v5 04/23] hw/virtio: Replace g_memdup() by g_memdup2()

2022-04-08 Thread Eugenio Pérez
From: Philippe Mathieu-Daudé Per https://discourse.gnome.org/t/port-your-module-from-g-memdup-to-g-memdup2-now/5538 The old API took the size of the memory to duplicate as a guint, whereas most memory functions take memory sizes as a gsize. This made it easy to accidentally pass a gsize t

[RFC PATCH v5 06/23] vdpa: Add x-svq to NetdevVhostVDPAOptions

2022-04-08 Thread Eugenio Pérez
Finally offering the possibility to enable SVQ from the command line. Signed-off-by: Eugenio Pérez --- qapi/net.json| 9 - net/vhost-vdpa.c | 48 2 files changed, 48 insertions(+), 9 deletions(-) diff --git a/qapi/net.json b/qapi/net

[RFC PATCH v5 00/23] Net Control VQ support with asid in vDPA SVQ

2022-04-08 Thread Eugenio Pérez
Control virtqueue is used by networking device for accepting various commands from the driver. It's a must to support multiqueue and other configurations. Shadow VirtQueue (SVQ) already makes possible migration of virtqueue states, effectively intercepting them so qemu can track what regions of me

[RFC PATCH v5 03/23] util: Return void on iova_tree_remove

2022-04-08 Thread Eugenio Pérez
It always returns IOVA_OK so nobody uses it. Signed-off-by: Eugenio Pérez --- include/qemu/iova-tree.h | 4 +--- util/iova-tree.c | 4 +--- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/include/qemu/iova-tree.h b/include/qemu/iova-tree.h index c938fb0793..16bbfdf5f8 1006

[RFC PATCH v5 07/23] vhost: move descriptor translation to vhost_svq_vring_write_descs

2022-04-08 Thread Eugenio Pérez
It's done for both in and out descriptors so it's better placed here. Signed-off-by: Eugenio Pérez --- hw/virtio/vhost-shadow-virtqueue.c | 26 +++--- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/hw/virtio/vhost-shadow-virtqueue.c b/hw/virtio/vhost-shadow-

[RFC PATCH v5 02/23] vdpa: Fix bad index calculus at vhost_vdpa_get_vring_base

2022-04-08 Thread Eugenio Pérez
Fixes: 6d0b222666 ("vdpa: Adapt vhost_vdpa_get_vring_base to SVQ") Signed-off-by: Eugenio Pérez --- hw/virtio/vhost-vdpa.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c index 9e5fe15d03..1f229ff4cb 100644 --- a/hw/virtio/v

[RFC PATCH v5 05/23] vhost: Fix bad return of descriptors to SVQ

2022-04-08 Thread Eugenio Pérez
Only the first one of them were properly enqueued back. Fixes: 100890f7ca ("vhost: Shadow virtqueue buffers forwarding") Signed-off-by: Eugenio Pérez --- hw/virtio/vhost-shadow-virtqueue.c | 17 +++-- 1 file changed, 15 insertions(+), 2 deletions(-) diff --git a/hw/virtio/vhost-shad

[RFC PATCH v5 11/23] virtio: Make virtqueue_alloc_element non-static

2022-04-08 Thread Eugenio Pérez
So SVQ can allocate elements using it Signed-off-by: Eugenio Pérez --- include/hw/virtio/virtio.h | 1 + hw/virtio/virtio.c | 2 +- 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/include/hw/virtio/virtio.h b/include/hw/virtio/virtio.h index b31c4507f5..1e85833897 100644 --

[RFC PATCH v5 12/23] vhost: Add SVQElement

2022-04-08 Thread Eugenio Pérez
This allows SVQ to add metadata to the different queue elements Signed-off-by: Eugenio Pérez --- hw/virtio/vhost-shadow-virtqueue.h | 8 -- hw/virtio/vhost-shadow-virtqueue.c | 42 -- 2 files changed, 29 insertions(+), 21 deletions(-) diff --git a/hw/virtio/vhos

[RFC PATCH v5 16/23] vdpa: Add map/unmap operation callback to SVQ

2022-04-08 Thread Eugenio Pérez
Signed-off-by: Eugenio Pérez --- hw/virtio/vhost-shadow-virtqueue.h | 21 +++-- hw/virtio/vhost-shadow-virtqueue.c | 8 +++- hw/virtio/vhost-vdpa.c | 20 +++- 3 files changed, 45 insertions(+), 4 deletions(-) diff --git a/hw/virtio/vhost-shadow-vi

[RFC PATCH v5 08/23] vdpa: Fix index calculus at vhost_vdpa_svqs_start

2022-04-08 Thread Eugenio Pérez
Signed-off-by: Eugenio Pérez --- hw/virtio/vhost-vdpa.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/hw/virtio/vhost-vdpa.c b/hw/virtio/vhost-vdpa.c index 1f229ff4cb..3f8fa66e8e 100644 --- a/hw/virtio/vhost-vdpa.c +++ b/hw/virtio/vhost-vdpa.c @@ -1018,7 +1018,7 @@ static bo

[RFC PATCH v5 10/23] vdpa: Extract get features part from vhost_vdpa_get_max_queue_pairs

2022-04-08 Thread Eugenio Pérez
To know the device features is also needed for CVQ SVQ. Extract from vhost_vdpa_get_max_queue_pairs so we can reuse it. Report errno in case of failure getting them while we're at it. Signed-off-by: Eugenio Pérez --- net/vhost-vdpa.c | 30 -- 1 file changed, 20 inser

[RFC PATCH v5 18/23] vdpa: add NetClientState->start() callback

2022-04-08 Thread Eugenio Pérez
It allows to inject custom code on device success start, right before release lock. Signed-off-by: Eugenio Pérez --- include/net/net.h | 2 ++ hw/net/vhost_net.c | 4 2 files changed, 6 insertions(+) diff --git a/include/net/net.h b/include/net/net.h index 523136c7ac..2fc3002ab4 100644 --

[RFC PATCH v5 15/23] vhost: Add vhost_iova_tree_find

2022-04-08 Thread Eugenio Pérez
Just a simple wrapper so we can find DMAMap entries based on iova Signed-off-by: Eugenio Pérez --- hw/virtio/vhost-iova-tree.h | 2 ++ hw/virtio/vhost-iova-tree.c | 14 ++ 2 files changed, 16 insertions(+) diff --git a/hw/virtio/vhost-iova-tree.h b/hw/virtio/vhost-iova-tree.h index

[RFC PATCH v5 09/23] virtio-net: Expose ctrl virtqueue logic

2022-04-08 Thread Eugenio Pérez
This allows external vhost-net devices to modify the state of the VirtIO device model once vhost-vdpa device has acknowledge the control commands. Signed-off-by: Eugenio Pérez --- include/hw/virtio/virtio-net.h | 3 ++ hw/net/virtio-net.c| 83 -- 2 fi

[RFC PATCH v5 19/23] vdpa: Add vhost_vdpa_start_control_svq

2022-04-08 Thread Eugenio Pérez
This will send CVQ commands in the destination machine, seting up everything o there is no guest-visible change. Signed-off-by: Eugenio Pérez --- net/vhost-vdpa.c | 63 1 file changed, 63 insertions(+) diff --git a/net/vhost-vdpa.c b/net/vhost-vd

[RFC PATCH v5 13/23] vhost: Add custom used buffer callback

2022-04-08 Thread Eugenio Pérez
The callback allows SVQ users to know the VirtQueue requests and responses. QEMU can use this to synchronize virtio device model state, allowing to migrate it with minimum changes to the migration code. In the case of networking, this will be used to inspect control virtqueue messages. Signed-off

[RFC PATCH v5 20/23] vhost: Update kernel headers

2022-04-08 Thread Eugenio Pérez
Signed-off-by: Eugenio Pérez --- include/standard-headers/linux/vhost_types.h | 11 - linux-headers/linux/vhost.h | 25 2 files changed, 30 insertions(+), 6 deletions(-) diff --git a/include/standard-headers/linux/vhost_types.h b/include/standard-he

[RFC PATCH v5 21/23] vhost: Make possible to check for device exclusive vq group

2022-04-08 Thread Eugenio Pérez
CVQ needs to be in its own group, not shared with any data vq. Enable the checking of it here, before introducing address space id concepts. Signed-off-by: Eugenio Pérez --- include/hw/virtio/vhost.h | 2 + hw/net/vhost_net.c| 4 +- hw/virtio/vhost-vdpa.c| 79 ++

[RFC PATCH v5 22/23] vdpa: Add asid attribute to vdpa device

2022-04-08 Thread Eugenio Pérez
We can configure ASID per group, but we still use asid 0 for every vdpa device. Multiple asid support for cvq will be introduced in next patches Signed-off-by: Eugenio Pérez --- include/hw/virtio/vhost-vdpa.h | 2 + include/hw/virtio/vhost.h | 2 + hw/net/vhost_net.c | 1 + h

Re: [PATCH v5 05/13] KVM: Extend the memslot to support fd-based private memory

2022-04-08 Thread Chao Peng
On Mon, Mar 28, 2022 at 09:56:33PM +, Sean Christopherson wrote: > On Thu, Mar 10, 2022, Chao Peng wrote: > > Extend the memslot definition to provide fd-based private memory support > > by adding two new fields (private_fd/private_offset). The memslot then > > can maintain memory for both shar

[RFC PATCH v5 14/23] vdpa: control virtqueue support on shadow virtqueue

2022-04-08 Thread Eugenio Pérez
Introduce the control virtqueue support for vDPA shadow virtqueue. This is needed for advanced networking features like multiqueue. To demonstrate command handling, VIRTIO_NET_F_CTRL_MACADDR and VIRTIO_NET_CTRL_MQ are implemented. If vDPA device is started with SVQ support and virtio-net driver ch

Re: [PATCH v9 09/11] 9p: darwin: Implement compatibility for mknodat

2022-04-08 Thread Christian Schoenebeck
On Sonntag, 27. Februar 2022 23:35:20 CEST Will Cohen wrote: > From: Keno Fischer > > Darwin does not support mknodat. However, to avoid race conditions > with later setting the permissions, we must avoid using mknod on > the full path instead. We could try to fchdir, but that would cause > probl

[RFC PATCH v5 17/23] vhost: Add vhost_svq_inject

2022-04-08 Thread Eugenio Pérez
This allows qemu to inject packets to the device without guest's notice. This will be use to inject net CVQ messages to restore status in the destination Signed-off-by: Eugenio Pérez --- hw/virtio/vhost-shadow-virtqueue.h | 5 + hw/virtio/vhost-shadow-virtqueue.c | 179 +++

[RFC PATCH v5 23/23] vdpa: Add x-cvq-svq

2022-04-08 Thread Eugenio Pérez
This isolates shadow cvq in its own group. Signed-off-by: Eugenio Pérez --- qapi/net.json| 8 +++- net/vhost-vdpa.c | 98 ++-- 2 files changed, 100 insertions(+), 6 deletions(-) diff --git a/qapi/net.json b/qapi/net.json index 92848e4362..39c245e

Re: [PULL 0/2] Fixes 20220408 patches

2022-04-08 Thread Peter Maydell
axel.org/qemu tags/fixes-20220408-pull-request > > for you to fetch changes up to fa892e9abb728e76afcf27323ab29c57fb0fe7aa: > > ui/cursor: fix integer overflow in cursor_alloc (CVE-2021-4206) (2022-04-07 > 12:30:54 +0200) > > -

Re: [PATCH v5 07/13] KVM: Add KVM_EXIT_MEMORY_ERROR exit

2022-04-08 Thread Chao Peng
On Mon, Mar 28, 2022 at 10:33:37PM +, Sean Christopherson wrote: > On Thu, Mar 10, 2022, Chao Peng wrote: > > This new KVM exit allows userspace to handle memory-related errors. It > > indicates an error happens in KVM at guest memory range [gpa, gpa+size). > > The flags includes additional inf

Re: [PATCH v5 08/13] KVM: Use memfile_pfn_ops to obtain pfn for private pages

2022-04-08 Thread Chao Peng
On Mon, Mar 28, 2022 at 11:56:06PM +, Sean Christopherson wrote: > On Thu, Mar 10, 2022, Chao Peng wrote: > > @@ -2217,4 +2220,34 @@ static inline void kvm_handle_signal_exit(struct > > kvm_vcpu *vcpu) > > /* Max number of entries allowed for each kvm dirty ring */ > > #define KVM_DIRTY_RIN

Re: [PATCH v5 06/13] KVM: Use kvm_userspace_memory_region_ext

2022-04-08 Thread Chao Peng
On Mon, Mar 28, 2022 at 10:26:55PM +, Sean Christopherson wrote: > On Thu, Mar 10, 2022, Chao Peng wrote: > > @@ -4476,14 +4477,23 @@ static long kvm_vm_ioctl(struct file *filp, > > break; > > } > > case KVM_SET_USER_MEMORY_REGION: { > > - struct kvm_userspace_memo

[PATCH 00/41] arm: Implement GICv4

2022-04-08 Thread Peter Maydell
This patchset implements emulation of GICv4 in our TCG GIC and ITS models, and makes the virt board use it where appropriate. The GICv4 provides a single new feature: direct injection of virtual interrupts from the ITS to a VM. In QEMU terms this means that if you have an outer QEMU which is emula

[PATCH 05/41] target/arm/cpu.c: ignore VIRQ and VFIQ if no EL2

2022-04-08 Thread Peter Maydell
In a GICv3, it is impossible for the GIC to deliver a VIRQ or VFIQ to the CPU unless the CPU has EL2, because VIRQ and VFIQ are only configurable via EL2-only system registers. Moreover, in our implementation we were only calculating and updating the state of the VIRQ and VFIQ lines in gicv3_cpuif

[PATCH 04/41] hw/intc/arm_gicv3: Report correct PIDR0 values for ID registers

2022-04-08 Thread Peter Maydell
We use the common function gicv3_idreg() to supply the CoreSight ID register values for the GICv3 for the copies of these ID registers in the distributor, redistributor and ITS register frames. This isn't quite correct, because while most of the register values are the same, the PIDR0 value should

[PATCH 03/41] hw/intc/arm_gicv3: Insist that redist region capacity matches CPU count

2022-04-08 Thread Peter Maydell
Boards using the GICv3 need to configure it with both the total number of CPUs and also the sizes of all the memory regions which contain redistributors (one redistributor per CPU). At the moment the GICv3 checks that the number of CPUs specified is not too many to fit in the defined redistributor

[PATCH 06/41] hw/intc/arm_gicv3_its: Factor out "is intid a valid LPI ID?"

2022-04-08 Thread Peter Maydell
In process_mapti() we check interrupt IDs to see whether they are in the valid LPI range. Factor this out into its own utility function, as we're going to want it elsewhere too for GICv4. Signed-off-by: Peter Maydell --- hw/intc/arm_gicv3_its.c | 10 +++--- 1 file changed, 7 insertions(+), 3

[PATCH 02/41] hw/intc/arm_gicv3: Sanity-check num-cpu property

2022-04-08 Thread Peter Maydell
In the GICv3 code we implicitly rely on there being at least one CPU and thus at least one redistributor and CPU interface. Sanity-check that the property the board code sets is not zero. Signed-off-by: Peter Maydell --- Doing this would be a board code error, but we might as well get a clean di

[PATCH 07/41] hw/intc/arm_gicv3_its: Implement GITS_BASER2 for GICv4

2022-04-08 Thread Peter Maydell
The GICv4 defines a new in-guest-memory table for the ITS: this is the vPE table. Implement the new GITS_BASER2 register which the guest uses to tell the ITS where the vPE table is located, including the decode of the register fields into the TableDesc structure which we do for the GITS_BASER when

[PATCH 08/41] hw/intc/arm_gicv3_its: Implement VMAPI and VMAPTI

2022-04-08 Thread Peter Maydell
Implement the GICv4 VMAPI and VMAPTI commands. These write an interrupt translation table entry that maps (DeviceID,EventID) to (vPEID,vINTID,doorbell). The only difference between VMAPI and VMAPTI is that VMAPI assumes vINTID == EventID rather than both being specified in the command packet. (Thi

[PATCH 01/41] hw/intc/arm_gicv3_its: Add missing blank line

2022-04-08 Thread Peter Maydell
In commit b6f96009acc we split do_process_its_cmd() from process_its_cmd(), but forgot the usual blank line between function definitions. Add it. Signed-off-by: Peter Maydell --- hw/intc/arm_gicv3_its.c | 1 + 1 file changed, 1 insertion(+) diff --git a/hw/intc/arm_gicv3_its.c b/hw/intc/arm_gi

[PATCH 10/41] hw/intc/arm_gicv3_its: Distinguish success and error cases of CMD_CONTINUE

2022-04-08 Thread Peter Maydell
In the ItsCmdResult enum, we currently distinguish only CMD_STALL (failure, stall processing of the command queue) and CMD_CONTINUE (keep processing the queue), and we use the latter both for "there was a parameter error, go on to the next command" and "the command succeeded, go on to the next comm

[PATCH 11/41] hw/intc/arm_gicv3_its: Factor out "find ITE given devid, eventid"

2022-04-08 Thread Peter Maydell
The operation of finding an interrupt table entry given a (DeviceID, EventID) pair is necessary in multiple different ITS commands. The process requires first using the DeviceID as an index into the device table to find the DTE, and then useng the EventID as an index into the interrupt table speci

[PATCH 20/41] hw/intc/arm_gicv3_its: Implement VMOVI

2022-04-08 Thread Peter Maydell
Implement the GICv4 VMOVI command, which moves the pending state of a virtual interrupt from one redistributor to another. As with MOVI, we handle the "parse and validate command arguments and table lookups" part in the ITS source file, and pass the final results to a function in the redistributor

[PATCH 09/41] hw/intc/arm_gicv3_its: Implement VMAPP

2022-04-08 Thread Peter Maydell
Implement the GICv4 VMAPP command, which writes an entry to the vPE table. For GICv4.1 this command has extra fields in the command packet and additional behaviour. We define the 4.1-only fields with the FIELD macro, but only implement the GICv4.0 version of the command. Signed-off-by: Peter Mayd

[PATCH 13/41] hw/intc/arm_gicv3_its: Split out process_its_cmd() physical interrupt code

2022-04-08 Thread Peter Maydell
Split the part of process_its_cmd() which is specific to physical interrupts into its own function. This is the part which starts by taking the ICID and looking it up in the collection table. The handling of virtual interrupts is significantly different (involving a lookup in the vPE table) so st

[PATCH 18/41] hw/intc/arm_gicv3_its: Implement INV command properly

2022-04-08 Thread Peter Maydell
We were previously implementing INV (like INVALL) to just blow away cached highest-priority-pending-LPI information on all connected redistributors. For GICv4.0, this isn't going to be sufficient, because the LPI we are invalidating cached information for might be either physical or virtual, and t

[PATCH 12/41] hw/intc/arm_gicv3_its: Factor out CTE lookup sequence

2022-04-08 Thread Peter Maydell
Factor out the sequence of looking up a CTE from an ICID including the validity and error checks. Signed-off-by: Peter Maydell --- I think process_movi() in particular is now a lot cleaner to read with all the error-checking factored out. --- hw/intc/arm_gicv3_its.c | 109 ++-

[PATCH 23/41] hw/intc/arm_gicv3: Implement new GICv4 redistributor registers

2022-04-08 Thread Peter Maydell
Implement the new GICv4 redistributor registers: GICR_VPROPBASER and GICR_VPENDBASER; for the moment we implement these as simple reads-as-written stubs, together with the necessary migration and reset handling. We don't put ID-register checks on the handling of these registers, because they are a

[PATCH 17/41] hw/intc/arm_gicv3_its: Implement VSYNC

2022-04-08 Thread Peter Maydell
The VSYNC command forces the ITS to synchronize all outstanding ITS operations for the specified vPEID, so that subsequent writse to GITS_TRANSLATER honour them. The QEMU implementation is always in sync, so for us this is a nop, like the existing SYNC command. Signed-off-by: Peter Maydell ---

[PATCH 21/41] hw/intc/arm_gicv3_its: Implement VINVALL

2022-04-08 Thread Peter Maydell
The VINVALL command should cause any cached information in the ITS or redistributor for the specified vCPU to be dropped or otherwise made consistent with the in-memory LPI configuration tables. Here we implement the command and table parsing, leaving the redistributor part as a stub for the momen

[PATCH 15/41] hw/intc/arm_gicv3: Keep pointers to every connected ITS

2022-04-08 Thread Peter Maydell
The GICv4 ITS VMOVP command's semantics require it to perform the operation on every ITS connected to the same GIC that the ITS that received the command is attached to. This means that the GIC object needs to keep a pointer to every ITS that is connected to it (previously it was sufficient for th

[PATCH 25/41] hw/intc/arm_gicv3_cpuif: Support vLPIs

2022-04-08 Thread Peter Maydell
The CPU interface changes to support vLPIs are fairly minor: in the parts of the code that currently look at the list registers to determine the highest priority pending virtual interrupt, we must also look at the highest priority pending vLPI. To do this we change hppvi_index() to check the vLPI a

[PATCH 16/41] hw/intc/arm_gicv3_its: Implement VMOVP

2022-04-08 Thread Peter Maydell
Implement the GICv4 VMOVP command, which updates an entry in the vPE table to change its rdbase field. This command is unique in the ITS command set because its effects must be propagated to all the other ITSes connected to the same GIC as the ITS which executes the VMOVP command. The GICv4 spec a

[PATCH 26/41] hw/intc/arm_gicv3_cpuif: Don't recalculate maintenance irq unnecessarily

2022-04-08 Thread Peter Maydell
The maintenance interrupt state depends only on: * ICH_HCR_EL2 * ICH_LR_EL2 * ICH_VMCR_EL2 fields VENG0 and VENG1 Now we have a separate function that updates only the vIRQ and vFIQ lines, use that in places that only change state that affects vIRQ and vFIQ but not the maintenance interrupt. S

[PATCH 14/41] hw/intc/arm_gicv3_its: Handle virtual interrupts in process_its_cmd()

2022-04-08 Thread Peter Maydell
For GICv4, interrupt table entries read by process_its_cmd() may indicate virtual LPIs which are to be directly injected into a VM. Implement the ITS side of the code for handling this. This is similar to the existing handling of physical LPIs, but instead of looking up a collection ID in a collec

[PATCH 19/41] hw/intc/arm_gicv3_its: Implement INV for virtual interrupts

2022-04-08 Thread Peter Maydell
Implement the ITS side of the handling of the INV command for virtual interrupts; as usual this calls into a redistributor function which we leave as a stub to fill in later. Signed-off-by: Peter Maydell --- hw/intc/gicv3_internal.h | 9 + hw/intc/arm_gicv3_its.c| 16 +

[PATCH 27/41] hw/intc/arm_gicv3_redist: Factor out "update hpplpi for one LPI" logic

2022-04-08 Thread Peter Maydell
Currently the functions which update the highest priority pending LPI information by looking at the LPI Pending and Configuration tables are hard-coded to use the physical LPI tables addressed by GICR_PENDBASER and GICR_PROPBASER. To support virtual LPIs we will need to do essentially the same job

[PATCH 22/41] hw/intc/arm_gicv3: Implement GICv4's new redistributor frame

2022-04-08 Thread Peter Maydell
The GICv4 extends the redistributor register map -- where GICv3 had two 64KB frames per CPU, GICv4 has four frames. Add support for the extra frame by using a new gicv3_redist_size() function in the places in the GIC implementation which currently use a fixed constant size for the redistributor reg

[PATCH 33/41] hw/intc/arm_gicv3_redist: Use set_pending_table_bit() in mov handling

2022-04-08 Thread Peter Maydell
We can use our new set_pending_table_bit() utility function in gicv3_redist_mov_lpi() to clear the bit in the source pending table, rather than doing the "load, clear bit, store" ourselves. Signed-off-by: Peter Maydell --- hw/intc/arm_gicv3_redist.c | 9 + 1 file changed, 1 insertion(+),

[PATCH 30/41] hw/intc/arm_gicv3_redist: Factor out "update bit in pending table" code

2022-04-08 Thread Peter Maydell
Factor out the code which sets a single bit in an LPI pending table. We're going to need this for handling vLPI tables, not just the physical LPI table. Signed-off-by: Peter Maydell --- hw/intc/arm_gicv3_redist.c | 49 +++--- 1 file changed, 30 insertions(+), 19 d

[PATCH 24/41] hw/intc/arm_gicv3_cpuif: Split "update vIRQ/vFIQ" from gicv3_cpuif_virt_update()

2022-04-08 Thread Peter Maydell
The function gicv3_cpuif_virt_update() currently sets all of vIRQ, vFIQ and the maintenance interrupt. This implies that it has to be used quite carefully -- as the comment notes, setting the maintenance interrupt will typically cause the GIC code to be re-entered recursively. For handling vLPIs,

[PATCH 32/41] hw/intc/arm_gicv3_redist: Implement gicv3_redist_vlpi_pending()

2022-04-08 Thread Peter Maydell
Implement the function gicv3_redist_vlpi_pending(), which was previously left as a stub. This is the function that is called by the CPU interface when it changes the state of a vLPI. It's similar to gicv3_redist_process_vlpi(), but we know that the vCPU is definitely resident on the redistributor

[PATCH 37/41] hw/intc/arm_gicv3: Update ID and feature registers for GICv4

2022-04-08 Thread Peter Maydell
Update the various GIC ID and feature registers for GICv4: * PIDR2 [7:4] is the GIC architecture revision * GICD_TYPER.DVIS is 1 to indicate direct vLPI injection support * GICR_TYPER.VLPIS is 1 to indicate redistributor support for vLPIs * GITS_TYPER.VIRTUAL is 1 to indicate vLPI support * GI

[PATCH 28/41] hw/intc/arm_gicv3_redist: Factor out "update hpplpi for all LPIs" logic

2022-04-08 Thread Peter Maydell
Factor out the common part of gicv3_redist_update_lpi_only() into a new function update_for_all_lpis(), which does a full rescan of an LPI Pending table and sets the specified PendingIrq struct with the highest priority pending enabled LPI it finds. Signed-off-by: Peter Maydell --- hw/intc/arm_g

[PATCH 31/41] hw/intc/arm_gicv3_redist: Implement gicv3_redist_process_vlpi()

2022-04-08 Thread Peter Maydell
Implement the function gicv3_redist_process_vlpi(), which was left as just a stub earlier. This function deals with being handed a VLPI by the ITS. It must set the bit in the pending table. If the vCPU is currently resident we must recalculate the highest priority pending vLPI; otherwise we may

[PATCH 38/41] hw/intc/arm_gicv3: Allow 'revision' property to be set to 4

2022-04-08 Thread Peter Maydell
Now that we have implemented all the GICv4 requirements, relax the error-checking on the GIC object's 'revision' property to allow a TCG GIC to be a GICv4, whilst still constraining the KVM GIC to GICv3. Our 'revision' property doesn't consider the possibility of wanting to specify the minor versi

[PATCH 39/41] hw/arm/virt: Use VIRT_GIC_VERSION_* enum values in create_gic()

2022-04-08 Thread Peter Maydell
Everywhere we need to check which GIC version we're using, we look at vms->gic_version and use the VIRT_GIC_VERSION_* enum values, except in create_gic(), which copies vms->gic_version into a local 'int' variable and makes direct comparisons against values 2 and 3. For consistency, change this fun

[PATCH 34/41] hw/intc/arm_gicv3_redist: Implement gicv3_redist_mov_vlpi()

2022-04-08 Thread Peter Maydell
Implement the gicv3_redist_mov_vlpi() function (previously left as a stub). This function handles the work of a VMOVI command: it marks the vLPI not-pending on the source and pending on the destination. Signed-off-by: Peter Maydell --- hw/intc/arm_gicv3_redist.c | 20 ++-- 1 fil

[PATCH 29/41] hw/intc/arm_gicv3_redist: Recalculate hppvlpi on VPENDBASER writes

2022-04-08 Thread Peter Maydell
The guest uses GICR_VPENDBASER to tell the redistributor when it is scheduling or descheduling a vCPU. When it writes and changes the VALID bit from 0 to 1, it is scheduling a vCPU, and we must update our view of the current highest priority pending vLPI from the new Pending and Configuration tabl

[PATCH 40/41] hw/arm/virt: Abstract out calculation of redistributor region capacity

2022-04-08 Thread Peter Maydell
In several places in virt.c we calculate the number of redistributors that fit in a region of our memory map, which is the size of the region divided by the size of a single redistributor frame. For GICv4, the redistributor frame is a different size from that for GICv3. Abstract out the calculation

[PATCH 36/41] hw/intc/arm_gicv3_redist: Implement gicv3_redist_inv_vlpi()

2022-04-08 Thread Peter Maydell
Implement the function gicv3_redist_inv_vlpi(), which was previously left as a stub. This is the function that does the work of the INV command for a virtual interrupt. Signed-off-by: Peter Maydell --- hw/intc/arm_gicv3_redist.c | 7 +-- 1 file changed, 5 insertions(+), 2 deletions(-) diff

[PATCH 35/41] hw/intc/arm_gicv3_redist: Implement gicv3_redist_vinvall()

2022-04-08 Thread Peter Maydell
Implement the gicv3_redist_vinvall() function (previously left as a stub). This function handles the work of a VINVALL command: it must invalidate any cached information associated with a specific vCPU. Signed-off-by: Peter Maydell --- hw/intc/arm_gicv3_redist.c | 8 +++- 1 file changed, 7

Re: [PATCH 00/41] arm: Implement GICv4

2022-04-08 Thread Peter Maydell
On Fri, 8 Apr 2022 at 15:15, Peter Maydell wrote: > > This patchset implements emulation of GICv4 in our TCG GIC and ITS > models, and makes the virt board use it where appropriate. > Tested with a Linux kernel passing through a virtio-blk device > to an inner Linux VM with KVM/QEMU. (NB that to

[PATCH 41/41] hw/arm/virt: Support TCG GICv4

2022-04-08 Thread Peter Maydell
Add support for the TCG GICv4 to the virt board. For the board, the GICv4 is very similar to the GICv3, with the only difference being the size of the redistributor frame. The changes here are thus: * calculating virt_redist_capacity correctly for GICv4 * changing various places which were "if GI

Re: [PATCH] x86: Implement Linear Address Masking support

2022-04-08 Thread Richard Henderson
On 4/7/22 08:27, Kirill A. Shutemov wrote: The fast path does not clear the bits, so you enter the slow path before you get to clearing the bits. You've lost most of the advantage of the tlb already. Sorry for my ignorance, but what do you mean by fast path here? My understanding is that it i

Procedures adding new CPUs in sbsa-ref

2022-04-08 Thread Itaru Kitayama
Hi, I'd like to add a64fx cpu to the sbsa-ref board, if there's a quick and dirty way of completing that, advice from the maintainers is greatly appreciated. Thanks, Itaru.

Re: [PATCH v9 09/11] 9p: darwin: Implement compatibility for mknodat

2022-04-08 Thread Greg Kurz
On Fri, 08 Apr 2022 15:52:25 +0200 Christian Schoenebeck wrote: > On Sonntag, 27. Februar 2022 23:35:20 CEST Will Cohen wrote: > > From: Keno Fischer > > > > Darwin does not support mknodat. However, to avoid race conditions > > with later setting the permissions, we must avoid using mknod on >

Support for x86_64 on aarch64 emulation

2022-04-08 Thread Redha Gouicem
We are working on support for x86_64 emulation on aarch64, mainly related to memory ordering issues. We first wanted to know what the community thinks about our proposal, and its chance of getting merged one day. Note that we worked with qemu-user, so there may be issues in system mode that we mis

Re: [PATCH v4 3/7] iotests: add copy-before-write: on-cbw-error tests

2022-04-08 Thread Hanna Reitz
On 07.04.22 15:27, Vladimir Sementsov-Ogievskiy wrote: Add tests for new option of copy-before-write filter: on-cbw-error. Note that we use QEMUMachine instead of VM class, because in further commit we'll want to use throttling which doesn't work with -accel qtest used by VM. We also touch pyli

Re: [PATCH v4 7/7] iotests: copy-before-write: add cases for cbw-timeout option

2022-04-08 Thread Hanna Reitz
On 07.04.22 15:27, Vladimir Sementsov-Ogievskiy wrote: Add two simple test-cases: timeout failure with break-snapshot-on-cbw-error behavior and similar with break-guest-write-on-cbw-error behavior. Signed-off-by: Vladimir Sementsov-Ogievskiy --- tests/qemu-iotests/tests/copy-before-write|

  1   2   >