mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-06 17:23:56 -06:00
pc,pci,virtio,hotplug fixes, enhancements
numa work by Hu Tao and others memory hotplug by Igor vhost-user by Nikolay, Antonios and others guest virtio announcements by Jason qtest fixes by Sergey qdev hotplug fixes by Paolo misc other fixes mostly by myself Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAABAgAGBQJTowW+AAoJECgfDbjSjVRpnMMH/jp3sKGzJumYLbi5ihjmYyND jYd6ySXoVAjUTgaCvdje5srisOap8pbc783kQvQS4CeWsjZ5Vvh+PZjkBPIqF1pD celxGQ43CY7QSUWq+02Dg9VIUwLwZqdKlxNsV01FligQn+ZBQ6sQ6ksWx7oGzqRt 5/HMZykbwUvSk/4xGUaMn2+/4uhQ0Wz5EsCkv9L/u8kS72k6ldc/tCGZMzBUNHTM rW5FPYwMQP0MXgGTXnlLEQjJ7Lozc66IaMZoHw/a/aGSIxdag9Otj0ADuXq6yZaV Xi4O/EOJWd1JpSG7w8LOyIZNakpHkU43fmJCLzBjDAupHeRp57TcW5ox4PJYAtg= =Oxdt -----END PGP SIGNATURE----- Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging pc,pci,virtio,hotplug fixes, enhancements numa work by Hu Tao and others memory hotplug by Igor vhost-user by Nikolay, Antonios and others guest virtio announcements by Jason qtest fixes by Sergey qdev hotplug fixes by Paolo misc other fixes mostly by myself Signed-off-by: Michael S. Tsirkin <mst@redhat.com> * remotes/mst/tags/for_upstream: (109 commits) numa: use RAM_ADDR_FMT with ram_addr_t qapi/string-output-visitor: fix bugs tests: simplify code qapi: fix input visitor bugs acpi: rephrase comment qmp: add ACPI_DEVICE_OST event handling qmp: add query-acpi-ospm-status command acpi: implement ospm_status() method for PIIX4/ICH9_LPC devices acpi: introduce TYPE_ACPI_DEVICE_IF interface qmp: add query-memory-devices command numa: handle mmaped memory allocation failure correctly pc: acpi: do not hardcode preprocessor qmp: clean out whitespace qdev: recursively unrealize devices when unrealizing bus qdev: reorganize error reporting in bus_set_realized qapi: fix build on glib < 2.28 qapi: make string output visitor parse int list qapi: make string input visitor parse int list tests: fix memory leak in test of string input visitor hmp: add info memdev ... Conflicts: include/hw/i386/pc.h [PMM: fixed minor conflict in pc.h] Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
0a99aae5fa
126 changed files with 7421 additions and 733 deletions
|
@ -24,15 +24,25 @@
|
|||
#include "hw/virtio/virtio-scsi.h"
|
||||
#include "hw/virtio/virtio-bus.h"
|
||||
|
||||
/* Features supported by host kernel. */
|
||||
static const int kernel_feature_bits[] = {
|
||||
VIRTIO_F_NOTIFY_ON_EMPTY,
|
||||
VIRTIO_RING_F_INDIRECT_DESC,
|
||||
VIRTIO_RING_F_EVENT_IDX,
|
||||
VIRTIO_SCSI_F_HOTPLUG,
|
||||
VHOST_INVALID_FEATURE_BIT
|
||||
};
|
||||
|
||||
static int vhost_scsi_set_endpoint(VHostSCSI *s)
|
||||
{
|
||||
VirtIOSCSICommon *vs = VIRTIO_SCSI_COMMON(s);
|
||||
const VhostOps *vhost_ops = s->dev.vhost_ops;
|
||||
struct vhost_scsi_target backend;
|
||||
int ret;
|
||||
|
||||
memset(&backend, 0, sizeof(backend));
|
||||
pstrcpy(backend.vhost_wwpn, sizeof(backend.vhost_wwpn), vs->conf.wwpn);
|
||||
ret = ioctl(s->dev.control, VHOST_SCSI_SET_ENDPOINT, &backend);
|
||||
ret = vhost_ops->vhost_call(&s->dev, VHOST_SCSI_SET_ENDPOINT, &backend);
|
||||
if (ret < 0) {
|
||||
return -errno;
|
||||
}
|
||||
|
@ -43,10 +53,11 @@ static void vhost_scsi_clear_endpoint(VHostSCSI *s)
|
|||
{
|
||||
VirtIOSCSICommon *vs = VIRTIO_SCSI_COMMON(s);
|
||||
struct vhost_scsi_target backend;
|
||||
const VhostOps *vhost_ops = s->dev.vhost_ops;
|
||||
|
||||
memset(&backend, 0, sizeof(backend));
|
||||
pstrcpy(backend.vhost_wwpn, sizeof(backend.vhost_wwpn), vs->conf.wwpn);
|
||||
ioctl(s->dev.control, VHOST_SCSI_CLEAR_ENDPOINT, &backend);
|
||||
vhost_ops->vhost_call(&s->dev, VHOST_SCSI_CLEAR_ENDPOINT, &backend);
|
||||
}
|
||||
|
||||
static int vhost_scsi_start(VHostSCSI *s)
|
||||
|
@ -55,13 +66,15 @@ static int vhost_scsi_start(VHostSCSI *s)
|
|||
VirtIODevice *vdev = VIRTIO_DEVICE(s);
|
||||
BusState *qbus = BUS(qdev_get_parent_bus(DEVICE(vdev)));
|
||||
VirtioBusClass *k = VIRTIO_BUS_GET_CLASS(qbus);
|
||||
const VhostOps *vhost_ops = s->dev.vhost_ops;
|
||||
|
||||
if (!k->set_guest_notifiers) {
|
||||
error_report("binding does not support guest notifiers");
|
||||
return -ENOSYS;
|
||||
}
|
||||
|
||||
ret = ioctl(s->dev.control, VHOST_SCSI_GET_ABI_VERSION, &abi_version);
|
||||
ret = vhost_ops->vhost_call(&s->dev,
|
||||
VHOST_SCSI_GET_ABI_VERSION, &abi_version);
|
||||
if (ret < 0) {
|
||||
return -errno;
|
||||
}
|
||||
|
@ -141,21 +154,7 @@ static uint32_t vhost_scsi_get_features(VirtIODevice *vdev,
|
|||
{
|
||||
VHostSCSI *s = VHOST_SCSI(vdev);
|
||||
|
||||
/* Clear features not supported by host kernel. */
|
||||
if (!(s->dev.features & (1 << VIRTIO_F_NOTIFY_ON_EMPTY))) {
|
||||
features &= ~(1 << VIRTIO_F_NOTIFY_ON_EMPTY);
|
||||
}
|
||||
if (!(s->dev.features & (1 << VIRTIO_RING_F_INDIRECT_DESC))) {
|
||||
features &= ~(1 << VIRTIO_RING_F_INDIRECT_DESC);
|
||||
}
|
||||
if (!(s->dev.features & (1 << VIRTIO_RING_F_EVENT_IDX))) {
|
||||
features &= ~(1 << VIRTIO_RING_F_EVENT_IDX);
|
||||
}
|
||||
if (!(s->dev.features & (1 << VIRTIO_SCSI_F_HOTPLUG))) {
|
||||
features &= ~(1 << VIRTIO_SCSI_F_HOTPLUG);
|
||||
}
|
||||
|
||||
return features;
|
||||
return vhost_get_features(&s->dev, kernel_feature_bits, features);
|
||||
}
|
||||
|
||||
static void vhost_scsi_set_config(VirtIODevice *vdev,
|
||||
|
@ -219,6 +218,13 @@ static void vhost_scsi_realize(DeviceState *dev, Error **errp)
|
|||
error_setg(errp, "vhost-scsi: unable to parse vhostfd");
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
vhostfd = open("/dev/vhost-scsi", O_RDWR);
|
||||
if (vhostfd < 0) {
|
||||
error_setg(errp, "vhost-scsi: open vhost char device failed: %s",
|
||||
strerror(errno));
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
virtio_scsi_common_realize(dev, &err, vhost_dummy_handle_output,
|
||||
|
@ -233,7 +239,8 @@ static void vhost_scsi_realize(DeviceState *dev, Error **errp)
|
|||
s->dev.vqs = g_new(struct vhost_virtqueue, s->dev.nvqs);
|
||||
s->dev.vq_index = 0;
|
||||
|
||||
ret = vhost_dev_init(&s->dev, vhostfd, "/dev/vhost-scsi", true);
|
||||
ret = vhost_dev_init(&s->dev, (void *)(uintptr_t)vhostfd,
|
||||
VHOST_BACKEND_TYPE_KERNEL, true);
|
||||
if (ret < 0) {
|
||||
error_setg(errp, "vhost-scsi: vhost initialization failed: %s",
|
||||
strerror(-ret));
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue