[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH v2 05/16] pc: Support for virtio-mem-pci
From: |
David Hildenbrand |
Subject: |
[PATCH v2 05/16] pc: Support for virtio-mem-pci |
Date: |
Wed, 12 Feb 2020 14:35:50 +0100 |
Signed-off-by: David Hildenbrand <address@hidden>
---
hw/i386/Kconfig | 1 +
hw/i386/pc.c | 42 ++++++++++++++++++++++++------------------
2 files changed, 25 insertions(+), 18 deletions(-)
diff --git a/hw/i386/Kconfig b/hw/i386/Kconfig
index cdc851598c..e8ce582edd 100644
--- a/hw/i386/Kconfig
+++ b/hw/i386/Kconfig
@@ -35,6 +35,7 @@ config PC
select ACPI_PCI
select ACPI_VMGENID
select VIRTIO_PMEM_SUPPORTED
+ select VIRTIO_MEM_SUPPORTED
config PC_PCI
bool
diff --git a/hw/i386/pc.c b/hw/i386/pc.c
index 2ddce4230a..ed8850f31d 100644
--- a/hw/i386/pc.c
+++ b/hw/i386/pc.c
@@ -85,6 +85,7 @@
#include "hw/net/ne2000-isa.h"
#include "standard-headers/asm-x86/bootparam.h"
#include "hw/virtio/virtio-pmem-pci.h"
+#include "hw/virtio/virtio-mem-pci.h"
#include "hw/mem/memory-device.h"
#include "sysemu/replay.h"
#include "qapi/qmp/qerror.h"
@@ -1648,8 +1649,8 @@ static void pc_cpu_pre_plug(HotplugHandler *hotplug_dev,
numa_cpu_pre_plug(cpu_slot, dev, errp);
}
-static void pc_virtio_pmem_pci_pre_plug(HotplugHandler *hotplug_dev,
- DeviceState *dev, Error **errp)
+static void pc_virtio_md_pci_pre_plug(HotplugHandler *hotplug_dev,
+ DeviceState *dev, Error **errp)
{
HotplugHandler *hotplug_dev2 = qdev_get_bus_hotplug_handler(dev);
Error *local_err = NULL;
@@ -1660,7 +1661,7 @@ static void pc_virtio_pmem_pci_pre_plug(HotplugHandler
*hotplug_dev,
* order. This should never be the case on x86, however better add
* a safety net.
*/
- error_setg(errp, "virtio-pmem-pci not supported on this bus.");
+ error_setg(errp, "virtio based memory devices not supported on this
bus.");
return;
}
/*
@@ -1675,8 +1676,8 @@ static void pc_virtio_pmem_pci_pre_plug(HotplugHandler
*hotplug_dev,
error_propagate(errp, local_err);
}
-static void pc_virtio_pmem_pci_plug(HotplugHandler *hotplug_dev,
- DeviceState *dev, Error **errp)
+static void pc_virtio_md_pci_plug(HotplugHandler *hotplug_dev,
+ DeviceState *dev, Error **errp)
{
HotplugHandler *hotplug_dev2 = qdev_get_bus_hotplug_handler(dev);
Error *local_err = NULL;
@@ -1694,15 +1695,15 @@ static void pc_virtio_pmem_pci_plug(HotplugHandler
*hotplug_dev,
error_propagate(errp, local_err);
}
-static void pc_virtio_pmem_pci_unplug_request(HotplugHandler *hotplug_dev,
- DeviceState *dev, Error **errp)
+static void pc_virtio_md_pci_unplug_request(HotplugHandler *hotplug_dev,
+ DeviceState *dev, Error **errp)
{
/* We don't support virtio pmem hot unplug */
error_setg(errp, "virtio pmem device unplug not supported.");
}
-static void pc_virtio_pmem_pci_unplug(HotplugHandler *hotplug_dev,
- DeviceState *dev, Error **errp)
+static void pc_virtio_md_pci_unplug(HotplugHandler *hotplug_dev,
+ DeviceState *dev, Error **errp)
{
/* We don't support virtio pmem hot unplug */
}
@@ -1714,8 +1715,9 @@ static void pc_machine_device_pre_plug_cb(HotplugHandler
*hotplug_dev,
pc_memory_pre_plug(hotplug_dev, dev, errp);
} else if (object_dynamic_cast(OBJECT(dev), TYPE_CPU)) {
pc_cpu_pre_plug(hotplug_dev, dev, errp);
- } else if (object_dynamic_cast(OBJECT(dev), TYPE_VIRTIO_PMEM_PCI)) {
- pc_virtio_pmem_pci_pre_plug(hotplug_dev, dev, errp);
+ } else if (object_dynamic_cast(OBJECT(dev), TYPE_VIRTIO_PMEM_PCI) ||
+ object_dynamic_cast(OBJECT(dev), TYPE_VIRTIO_MEM_PCI)) {
+ pc_virtio_md_pci_pre_plug(hotplug_dev, dev, errp);
}
}
@@ -1726,8 +1728,9 @@ static void pc_machine_device_plug_cb(HotplugHandler
*hotplug_dev,
pc_memory_plug(hotplug_dev, dev, errp);
} else if (object_dynamic_cast(OBJECT(dev), TYPE_CPU)) {
pc_cpu_plug(hotplug_dev, dev, errp);
- } else if (object_dynamic_cast(OBJECT(dev), TYPE_VIRTIO_PMEM_PCI)) {
- pc_virtio_pmem_pci_plug(hotplug_dev, dev, errp);
+ } else if (object_dynamic_cast(OBJECT(dev), TYPE_VIRTIO_PMEM_PCI) ||
+ object_dynamic_cast(OBJECT(dev), TYPE_VIRTIO_MEM_PCI)) {
+ pc_virtio_md_pci_plug(hotplug_dev, dev, errp);
}
}
@@ -1738,8 +1741,9 @@ static void
pc_machine_device_unplug_request_cb(HotplugHandler *hotplug_dev,
pc_memory_unplug_request(hotplug_dev, dev, errp);
} else if (object_dynamic_cast(OBJECT(dev), TYPE_CPU)) {
pc_cpu_unplug_request_cb(hotplug_dev, dev, errp);
- } else if (object_dynamic_cast(OBJECT(dev), TYPE_VIRTIO_PMEM_PCI)) {
- pc_virtio_pmem_pci_unplug_request(hotplug_dev, dev, errp);
+ } else if (object_dynamic_cast(OBJECT(dev), TYPE_VIRTIO_PMEM_PCI) ||
+ object_dynamic_cast(OBJECT(dev), TYPE_VIRTIO_MEM_PCI)) {
+ pc_virtio_md_pci_unplug_request(hotplug_dev, dev, errp);
} else {
error_setg(errp, "acpi: device unplug request for not supported device"
" type: %s", object_get_typename(OBJECT(dev)));
@@ -1753,8 +1757,9 @@ static void pc_machine_device_unplug_cb(HotplugHandler
*hotplug_dev,
pc_memory_unplug(hotplug_dev, dev, errp);
} else if (object_dynamic_cast(OBJECT(dev), TYPE_CPU)) {
pc_cpu_unplug_cb(hotplug_dev, dev, errp);
- } else if (object_dynamic_cast(OBJECT(dev), TYPE_VIRTIO_PMEM_PCI)) {
- pc_virtio_pmem_pci_unplug(hotplug_dev, dev, errp);
+ } else if (object_dynamic_cast(OBJECT(dev), TYPE_VIRTIO_PMEM_PCI) ||
+ object_dynamic_cast(OBJECT(dev), TYPE_VIRTIO_MEM_PCI)) {
+ pc_virtio_md_pci_unplug(hotplug_dev, dev, errp);
} else {
error_setg(errp, "acpi: device unplug for not supported device"
" type: %s", object_get_typename(OBJECT(dev)));
@@ -1766,7 +1771,8 @@ static HotplugHandler
*pc_get_hotplug_handler(MachineState *machine,
{
if (object_dynamic_cast(OBJECT(dev), TYPE_PC_DIMM) ||
object_dynamic_cast(OBJECT(dev), TYPE_CPU) ||
- object_dynamic_cast(OBJECT(dev), TYPE_VIRTIO_PMEM_PCI)) {
+ object_dynamic_cast(OBJECT(dev), TYPE_VIRTIO_PMEM_PCI) ||
+ object_dynamic_cast(OBJECT(dev), TYPE_VIRTIO_MEM_PCI)) {
return HOTPLUG_HANDLER(machine);
}
--
2.24.1
- [PATCH v2 00/16] Ram blocks with resizable anonymous allocations under POSIX, David Hildenbrand, 2020/02/12
- [PATCH v2 02/16] virtio-pci: Proxy for virtio-mem, David Hildenbrand, 2020/02/12
- [PATCH v2 01/16] virtio-mem: Prototype, David Hildenbrand, 2020/02/12
- [PATCH v2 03/16] hmp: Handle virtio-mem when printing memory device infos, David Hildenbrand, 2020/02/12
- [PATCH v2 04/16] numa: Handle virtio-mem in NUMA stats, David Hildenbrand, 2020/02/12
- [PATCH v2 05/16] pc: Support for virtio-mem-pci,
David Hildenbrand <=
- [PATCH v2 06/16] exec: Provide owner when resizing memory region, David Hildenbrand, 2020/02/12
- [PATCH v2 07/16] memory: Add memory_region_max_size() and memory_region_is_resizable(), David Hildenbrand, 2020/02/12
- [PATCH v2 08/16] memory: Disallow resizing to 0, David Hildenbrand, 2020/02/12
- [PATCH v2 09/16] memory-device: properly deal with resizable memory regions, David Hildenbrand, 2020/02/12
- [PATCH v2 10/16] hostmem: Factor out applying settings, David Hildenbrand, 2020/02/12
- [PATCH v2 11/16] hostmem: Factor out common checks into host_memory_backend_validate(), David Hildenbrand, 2020/02/12
- [PATCH v2 12/16] hostmem: Introduce "managed-size" for memory-backend-ram, David Hildenbrand, 2020/02/12
- [PATCH v2 13/16] qmp/hmp: Expose "managed-size" for memory backends, David Hildenbrand, 2020/02/12
- [PATCH v2 14/16] virtio-mem: Support for resizable memory regions, David Hildenbrand, 2020/02/12