Skip to content

Commit

Permalink
Merge tag 'for_upstream' of https://git.kernel.org/pub/scm/virt/kvm/m…
Browse files Browse the repository at this point in the history
…st/qemu into staging

virtio,pc,pci: features, cleanups, fixes

vhost-user-snd support
x2APIC mode with TCG support
CXL update to r3.1

fixes, cleanups all over the place.

Signed-off-by: Michael S. Tsirkin <mst@redhat.com>

# -----BEGIN PGP SIGNATURE-----
#
# iQFDBAABCAAtFiEEXQn9CHHI+FuUyooNKB8NuNKNVGkFAmXMoXUPHG1zdEByZWRo
# YXQuY29tAAoJECgfDbjSjVRpFtMIAKUKD0hzJrwOyPo4xsRUMbsB3ehIsJsMKfOK
# w+JWzTaojAG8ENPelWBdL2sEIs5U73VOchjLqHbH2m5sz6GJ13214amvdU/fYc8+
# /dU2ZKoAmaR5L1ovKO/fq07y/J6DrITZ5tosy2i84Xa8EnsL4j3wEPNVWsDi7dna
# mvXUICSOOoJQ4O2YhSruKCQ8qIgF1/0Oi3u/rcrW3alSs8VQlrtQXxl6k+LbYqek
# +Fytco3jMRHPvQ+GYUIwGuHjN15ghArcvbsV0GIa+24BPY5h7YbDYGbfasePT5OK
# zDz51jitkoyDrQr+OzwOEe/X5+dVGhayRXfMtU5Qm53IE3y61qc=
# =K4b1
# -----END PGP SIGNATURE-----
# gpg: Signature made Wed 14 Feb 2024 11:18:13 GMT
# gpg:                using RSA key 5D09FD0871C8F85B94CA8A0D281F0DB8D28D5469
# gpg:                issuer "mst@redhat.com"
# gpg: Good signature from "Michael S. Tsirkin <mst@kernel.org>" [full]
# gpg:                 aka "Michael S. Tsirkin <mst@redhat.com>" [full]
# Primary key fingerprint: 0270 606B 6F3C DF3D 0B17  0970 C350 3912 AFBE 8E67
#      Subkey fingerprint: 5D09 FD08 71C8 F85B 94CA  8A0D 281F 0DB8 D28D 5469

* tag 'for_upstream' of https://git.kernel.org/pub/scm/virt/kvm/mst/qemu: (60 commits)
  MAINTAINERS: Switch to my Enfabrica email
  virtio-gpu-rutabaga.c: override resource_destroy method
  virtio-gpu.c: add resource_destroy class method
  hw/display/virtio-gpu.c: use reset_bh class method
  hw/smbios: Fix port connector option validation
  hw/smbios: Fix OEM strings table option validation
  virtio-gpu: Correct virgl_renderer_resource_get_info() error check
  hw/cxl: Standardize all references on CXL r3.1 and minor updates
  hw/cxl: Update mailbox status registers.
  hw/cxl: Update RAS Capability Definitions for version 3.
  hw/cxl: Update link register definitions.
  hw/cxl: Update HDM Decoder capability to version 3
  tests/acpi: Update DSDT.cxl to reflect change _STA return value.
  hw/i386: Fix _STA return value for ACPI0017
  tests/acpi: Allow update of DSDT.cxl
  hw/mem/cxl_type3: Fix potential divide by zero reported by coverity
  hw/cxl: Pass NULL for a NULL MemoryRegionOps
  hw/cxl: Pass CXLComponentState to cache_mem_ops
  hw/cxl/device: read from register values in mdev_reg_read()
  hw/cxl/mbox: Remove dead code
  ...

Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
  • Loading branch information
pm215 committed Feb 14, 2024
2 parents 7083226 + 1dd6954 commit 5767815
Show file tree
Hide file tree
Showing 84 changed files with 2,002 additions and 1,908 deletions.
19 changes: 16 additions & 3 deletions MAINTAINERS
Original file line number Diff line number Diff line change
Expand Up @@ -2289,8 +2289,9 @@ L: virtio-fs@lists.linux.dev
virtio-input
M: Gerd Hoffmann <kraxel@redhat.com>
S: Odd Fixes
F: hw/input/vhost-user-input.c
F: docs/system/devices/vhost-user-input.rst
F: hw/input/virtio-input*.c
F: hw/virtio/vhost-user-input.c
F: include/hw/virtio/virtio-input.h
F: contrib/vhost-user-input/*

Expand Down Expand Up @@ -2319,6 +2320,12 @@ F: include/sysemu/rng*.h
F: backends/rng*.c
F: tests/qtest/virtio-rng-test.c

vhost-user-stubs
M: Alex Bennée <alex.bennee@linaro.org>
S: Maintained
F: hw/virtio/vhost-user-base.c
F: hw/virtio/vhost-user-device*

vhost-user-rng
M: Mathieu Poirier <mathieu.poirier@linaro.org>
S: Supported
Expand All @@ -2336,6 +2343,13 @@ F: hw/virtio/vhost-user-gpio*
F: include/hw/virtio/vhost-user-gpio.h
F: tests/qtest/libqos/virtio-gpio.*

vhost-user-snd
M: Alex Bennée <alex.bennee@linaro.org>
R: Manos Pitsidianakis <manos.pitsidianakis@linaro.org>
S: Maintained
F: hw/virtio/vhost-user-snd*
F: include/hw/virtio/vhost-user-snd.h

vhost-user-scmi
R: mzamazal@redhat.com
S: Supported
Expand Down Expand Up @@ -2556,7 +2570,7 @@ F: include/hw/virtio/virtio-gpu.h
F: docs/system/devices/virtio-gpu.rst

vhost-user-blk
M: Raphael Norwitz <raphael.s.norwitz@gmail.com>
M: Raphael Norwitz <raphael@enfabrica.net>
S: Maintained
F: contrib/vhost-user-blk/
F: contrib/vhost-user-scsi/
Expand Down Expand Up @@ -3623,7 +3637,6 @@ F: tests/uefi-test-tools/

VT-d Emulation
M: Michael S. Tsirkin <mst@redhat.com>
M: Peter Xu <peterx@redhat.com>
R: Jason Wang <jasowang@redhat.com>
S: Supported
F: hw/i386/intel_iommu.c
Expand Down
6 changes: 3 additions & 3 deletions contrib/vhost-user-gpu/virgl.c
Original file line number Diff line number Diff line change
Expand Up @@ -327,15 +327,15 @@ virgl_get_resource_info_modifiers(uint32_t resource_id,
#ifdef VIRGL_RENDERER_RESOURCE_INFO_EXT_VERSION
struct virgl_renderer_resource_info_ext info_ext;
ret = virgl_renderer_resource_get_info_ext(resource_id, &info_ext);
if (ret < 0) {
if (ret) {
return ret;
}

*info = info_ext.base;
*modifiers = info_ext.modifiers;
#else
ret = virgl_renderer_resource_get_info(resource_id, info);
if (ret < 0) {
if (ret) {
return ret;
}

Expand Down Expand Up @@ -372,7 +372,7 @@ virgl_cmd_set_scanout(VuGpu *g,
uint64_t modifiers = 0;
ret = virgl_get_resource_info_modifiers(ss.resource_id, &info,
&modifiers);
if (ret == -1) {
if (ret) {
g_critical("%s: illegal resource specified %d\n",
__func__, ss.resource_id);
cmd->error = VIRTIO_GPU_RESP_ERR_INVALID_RESOURCE_ID;
Expand Down
6 changes: 4 additions & 2 deletions docs/devel/migration/main.rst
Original file line number Diff line number Diff line change
Expand Up @@ -431,10 +431,10 @@ data doesn't match the stored device data well; it allows an
intermediate temporary structure to be populated with migration
data and then transferred to the main structure.

If you use memory API functions that update memory layout outside
If you use memory or portio_list API functions that update memory layout outside
initialization (i.e., in response to a guest action), this is a strong
indication that you need to call these functions in a ``post_load`` callback.
Examples of such memory API functions are:
Examples of such API functions are:

- memory_region_add_subregion()
- memory_region_del_subregion()
Expand All @@ -443,6 +443,8 @@ Examples of such memory API functions are:
- memory_region_set_enabled()
- memory_region_set_address()
- memory_region_set_alias_offset()
- portio_list_set_address()
- portio_list_set_enabled()

Iterative device migration
--------------------------
Expand Down
6 changes: 3 additions & 3 deletions docs/interop/vhost-user.rst
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,9 @@ Vring descriptor indices for packed virtqueues
A vring address description
^^^^^^^^^^^^^^^^^^^^^^^^^^^

+-------+-------+------+------------+------+-----------+-----+
| index | flags | size | descriptor | used | available | log |
+-------+-------+------+------------+------+-----------+-----+
+-------+-------+------------+------+-----------+-----+
| index | flags | descriptor | used | available | log |
+-------+-------+------------+------+-----------+-----+

:index: a 32-bit vring index

Expand Down
1 change: 1 addition & 0 deletions docs/system/device-emulation.rst
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,7 @@ Emulated Devices
devices/virtio-gpu.rst
devices/virtio-pmem.rst
devices/virtio-snd.rst
devices/vhost-user-input.rst
devices/vhost-user-rng.rst
devices/canokey.rst
devices/usb-u2f.rst
Expand Down
3 changes: 1 addition & 2 deletions docs/system/devices/cxl.rst
Original file line number Diff line number Diff line change
Expand Up @@ -411,5 +411,4 @@ References

- Consortium website for specifications etc:
http://www.computeexpresslink.org
- Compute Express link Revision 2 specification, October 2020
- CEDT CFMWS & QTG _DSM ECN May 2021
- Compute Express Link (CXL) Specification, Revision 3.1, August 2023
45 changes: 45 additions & 0 deletions docs/system/devices/vhost-user-input.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
.. _vhost_user_input:

QEMU vhost-user-input - Input emulation
=======================================

This document describes the setup and usage of the Virtio input device.
The Virtio input device is a paravirtualized device for input events.

Description
-----------

The vhost-user-input device implementation was designed to work with a daemon
polling on input devices and passes input events to the guest.

QEMU provides a backend implementation in contrib/vhost-user-input.

Linux kernel support
--------------------

Virtio input requires a guest Linux kernel built with the
``CONFIG_VIRTIO_INPUT`` option.

Examples
--------

The backend daemon should be started first:

::

host# vhost-user-input --socket-path=input.sock \
--evdev-path=/dev/input/event17

The QEMU invocation needs to create a chardev socket to communicate with the
backend daemon and access the VirtIO queues with the guest over the
:ref:`shared memory <shared_memory_object>`.

::

host# qemu-system \
-chardev socket,path=/tmp/input.sock,id=mouse0 \
-device vhost-user-input-pci,chardev=mouse0 \
-m 4096 \
-object memory-backend-file,id=mem,size=4G,mem-path=/dev/shm,share=on \
-numa node,memdev=mem \
...
2 changes: 2 additions & 0 deletions docs/system/devices/vhost-user-rng.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
.. _vhost_user_rng:

QEMU vhost-user-rng - RNG emulation
===================================

Expand Down
72 changes: 71 additions & 1 deletion docs/system/devices/vhost-user.rst
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,81 @@ outside of QEMU itself. To do this there are a number of things
required.

vhost-user device
===================
=================

These are simple stub devices that ensure the VirtIO device is visible
to the guest. The code is mostly boilerplate although each device has
a ``chardev`` option which specifies the ID of the ``--chardev``
device that connects via a socket to the vhost-user *daemon*.

Each device will have an virtio-mmio and virtio-pci variant. See your
platform details for what sort of virtio bus to use.

.. list-table:: vhost-user devices
:widths: 20 20 60
:header-rows: 1

* - Device
- Type
- Notes
* - vhost-user-blk
- Block storage
- See contrib/vhost-user-blk
* - vhost-user-fs
- File based storage driver
- See https://gitlab.com/virtio-fs/virtiofsd
* - vhost-user-gpio
- Proxy gpio pins to host
- See https://github.com/rust-vmm/vhost-device
* - vhost-user-gpu
- GPU driver
- See contrib/vhost-user-gpu
* - vhost-user-i2c
- Proxy i2c devices to host
- See https://github.com/rust-vmm/vhost-device
* - vhost-user-input
- Generic input driver
- :ref:`vhost_user_input`
* - vhost-user-rng
- Entropy driver
- :ref:`vhost_user_rng`
* - vhost-user-scmi
- System Control and Management Interface
- See https://github.com/rust-vmm/vhost-device
* - vhost-user-snd
- Audio device
- See https://github.com/rust-vmm/vhost-device/staging
* - vhost-user-scsi
- SCSI based storage
- See contrib/vhost-user-scsi
* - vhost-user-vsock
- Socket based communication
- See https://github.com/rust-vmm/vhost-device

The referenced *daemons* are not exhaustive, any conforming backend
implementing the device and using the vhost-user protocol should work.

vhost-user-device
^^^^^^^^^^^^^^^^^

The vhost-user-device is a generic development device intended for
expert use while developing new backends. The user needs to specify
all the required parameters including:

- Device ``virtio-id``
- The ``num_vqs`` it needs and their ``vq_size``
- The ``config_size`` if needed

.. note::
To prevent user confusion you cannot currently instantiate
vhost-user-device without first patching out::

/* Reason: stop inexperienced users confusing themselves */
dc->user_creatable = false;

in ``vhost-user-device.c`` and ``vhost-user-device-pci.c`` file and
rebuilding.

vhost-user daemon
=================

Expand All @@ -23,6 +91,8 @@ following the :ref:`vhost_user_proto`. There are a number of daemons
that can be built when enabled by the project although any daemon that
meets the specification for a given device can be used.

.. _shared_memory_object:

Shared memory object
====================

Expand Down
2 changes: 2 additions & 0 deletions hw/arm/smmu-common.c
Original file line number Diff line number Diff line change
Expand Up @@ -675,6 +675,8 @@ static void smmu_base_reset_hold(Object *obj)
{
SMMUState *s = ARM_SMMU(obj);

memset(s->smmu_pcibus_by_bus_num, 0, sizeof(s->smmu_pcibus_by_bus_num));

g_hash_table_remove_all(s->configs);
g_hash_table_remove_all(s->iotlb);
}
Expand Down
4 changes: 0 additions & 4 deletions hw/block/fdc-internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@
#ifndef HW_BLOCK_FDC_INTERNAL_H
#define HW_BLOCK_FDC_INTERNAL_H

#include "exec/memory.h"
#include "exec/ioport.h"
#include "hw/block/block.h"
#include "hw/block/fdc.h"
#include "qapi/qapi-types-block.h"
Expand Down Expand Up @@ -92,7 +90,6 @@ typedef struct FDrive {
} FDrive;

struct FDCtrl {
MemoryRegion iomem;
qemu_irq irq;
/* Controller state */
QEMUTimer *result_timer;
Expand Down Expand Up @@ -140,7 +137,6 @@ struct FDCtrl {
/* Timers state */
uint8_t timer0;
uint8_t timer1;
PortioList portio_list;
};

extern const FDFormat fd_formats[];
Expand Down
18 changes: 17 additions & 1 deletion hw/block/fdc-isa.c
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
#include "sysemu/block-backend.h"
#include "sysemu/blockdev.h"
#include "sysemu/sysemu.h"
#include "exec/ioport.h"
#include "qemu/log.h"
#include "qemu/main-loop.h"
#include "qemu/module.h"
Expand All @@ -60,6 +61,7 @@ struct FDCtrlISABus {
uint32_t irq;
uint32_t dma;
struct FDCtrl state;
PortioList portio_list;
int32_t bootindexA;
int32_t bootindexB;
};
Expand Down Expand Up @@ -91,7 +93,7 @@ static void isabus_fdc_realize(DeviceState *dev, Error **errp)
FDCtrl *fdctrl = &isa->state;
Error *err = NULL;

isa_register_portio_list(isadev, &fdctrl->portio_list,
isa_register_portio_list(isadev, &isa->portio_list,
isa->iobase, fdc_portio_list, fdctrl,
"fdc");

Expand Down Expand Up @@ -190,6 +192,20 @@ static Aml *build_fdinfo_aml(int idx, FloppyDriveType type)
return dev;
}

void isa_fdc_set_iobase(ISADevice *fdc, hwaddr iobase)
{
FDCtrlISABus *isa = ISA_FDC(fdc);

fdc->ioport_id = iobase;
isa->iobase = iobase;
portio_list_set_address(&isa->portio_list, isa->iobase);
}

void isa_fdc_set_enabled(ISADevice *fdc, bool enabled)
{
portio_list_set_enabled(&ISA_FDC(fdc)->portio_list, enabled);
}

int cmos_get_fd_drive_type(FloppyDriveType fd0)
{
int val;
Expand Down
6 changes: 4 additions & 2 deletions hw/block/fdc-sysbus.c
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
#include "qemu/osdep.h"
#include "qapi/error.h"
#include "qom/object.h"
#include "exec/memory.h"
#include "hw/sysbus.h"
#include "hw/block/fdc.h"
#include "migration/vmstate.h"
Expand All @@ -52,6 +53,7 @@ struct FDCtrlSysBus {
/*< public >*/

struct FDCtrl state;
MemoryRegion iomem;
};

static uint64_t fdctrl_read_mem(void *opaque, hwaddr reg, unsigned ize)
Expand Down Expand Up @@ -146,11 +148,11 @@ static void sysbus_fdc_common_instance_init(Object *obj)

qdev_set_legacy_instance_id(dev, 0 /* io */, 2); /* FIXME */

memory_region_init_io(&fdctrl->iomem, obj,
memory_region_init_io(&sys->iomem, obj,
sbdc->use_strict_io ? &fdctrl_mem_strict_ops
: &fdctrl_mem_ops,
fdctrl, "fdc", 0x08);
sysbus_init_mmio(sbd, &fdctrl->iomem);
sysbus_init_mmio(sbd, &sys->iomem);

sysbus_init_irq(sbd, &fdctrl->irq);
qdev_init_gpio_in(dev, fdctrl_handle_tc, 1);
Expand Down

0 comments on commit 5767815

Please sign in to comment.