mirror of
https://github.com/Motorhead1991/qemu.git
synced 2025-08-06 17:23:56 -06:00
pc, virtio enhancements
Memory hot-unplug support for pc, MSI-X mapping update speedup for virtio-pci, misc refactorings and bugfixes. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iQEcBAABAgAGBQJVUFj/AAoJECgfDbjSjVRpteQH+gKoOMKilM6qvgdQS9vduFJ+ lDHNnmfgzWjVMEetiUOc9hImfEEyTyDFrkSI3wf4a8RZ7UnnDKD8hZR1nToySJPd SuDP/EdtXYtInIMjc1MUUrJEP6qtjjgM+IbikVzHDxCeekrTMFz2w05MZ+V+hxI5 8b8ndPNfjX3ciIRjHKZ2u6hKEemhzxr1yyKTnJVGDN07hmfMbCyLsiWnFfShZwfv g7USgiXjFfpvU5Q7QWpiCapfAaEpevRqieGzRjSbPy5Frm3XT7v+hWbFnvIJqUPj 5/SMV8I4qtKQe15Qah292HB//oaFM/AvRtHWvQkre3YIqFwyCYimQtjqoRCYC1E= =x0ub -----END PGP SIGNATURE----- Merge remote-tracking branch 'remotes/mst/tags/for_upstream' into staging pc, virtio enhancements Memory hot-unplug support for pc, MSI-X mapping update speedup for virtio-pci, misc refactorings and bugfixes. Signed-off-by: Michael S. Tsirkin <mst@redhat.com> # gpg: Signature made Mon May 11 08:23:43 2015 BST using RSA key ID D28D5469 # gpg: Good signature from "Michael S. Tsirkin <mst@kernel.org>" # gpg: aka "Michael S. Tsirkin <mst@redhat.com>" * remotes/mst/tags/for_upstream: (28 commits) acpi: update expected files for memory unplug virtio-scsi: Move DEFINE_VIRTIO_SCSI_FEATURES to virtio-scsi virtio-net: Move DEFINE_VIRTIO_NET_FEATURES to virtio-net pci: Merge pci_nic_init() into pci_nic_init_nofail() acpi: add a missing backslash to the \_SB scope. qmp-event: add event notification for memory hot unplug error acpi: add hardware implementation for memory hot unplug acpi: fix "Memory device control fields" register acpi: extend aml_field() to support UpdateRule acpi, mem-hotplug: add unplug cb for memory device acpi, mem-hotplug: add unplug request cb for memory device acpi, mem-hotplug: add acpi_memory_slot_status() to get MemStatus docs: update documentation for memory hot unplug virtio: coding style tweak pci: remove hard-coded bar size in msix_init_exclusive_bar() virtio-pci: speedup MSI-X masking and unmasking virtio: introduce vector to virtqueues mapping virtio-ccw: using VIRTIO_NO_VECTOR instead of 0 for invalid virtqueue monitor: check return value of qemu_find_net_clients_except() monitor: replace the magic number 255 with MAX_QUEUE_NUM ... Conflicts: hw/s390x/s390-virtio-bus.c [PMM: fixed conflict in s390_virtio_scsi_properties and s390_virtio_net_properties arrays; since the result of the two conflicting patches is to empty the property arrays completely, the conflict resolution is to remove them entirely.] Signed-off-by: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
commit
0403b0f539
42 changed files with 673 additions and 221 deletions
|
@ -295,29 +295,37 @@ int msix_init_exclusive_bar(PCIDevice *dev, unsigned short nentries,
|
|||
{
|
||||
int ret;
|
||||
char *name;
|
||||
uint32_t bar_size = 4096;
|
||||
uint32_t bar_pba_offset = bar_size / 2;
|
||||
uint32_t bar_pba_size = (nentries / 8 + 1) * 8;
|
||||
|
||||
/*
|
||||
* Migration compatibility dictates that this remains a 4k
|
||||
* BAR with the vector table in the lower half and PBA in
|
||||
* the upper half. Do not use these elsewhere!
|
||||
* the upper half for nentries which is lower or equal to 128.
|
||||
* No need to care about using more than 65 entries for legacy
|
||||
* machine types who has at most 64 queues.
|
||||
*/
|
||||
#define MSIX_EXCLUSIVE_BAR_SIZE 4096
|
||||
#define MSIX_EXCLUSIVE_BAR_TABLE_OFFSET 0
|
||||
#define MSIX_EXCLUSIVE_BAR_PBA_OFFSET (MSIX_EXCLUSIVE_BAR_SIZE / 2)
|
||||
#define MSIX_EXCLUSIVE_CAP_OFFSET 0
|
||||
if (nentries * PCI_MSIX_ENTRY_SIZE > bar_pba_offset) {
|
||||
bar_pba_offset = nentries * PCI_MSIX_ENTRY_SIZE;
|
||||
}
|
||||
|
||||
if (nentries * PCI_MSIX_ENTRY_SIZE > MSIX_EXCLUSIVE_BAR_PBA_OFFSET) {
|
||||
return -EINVAL;
|
||||
if (bar_pba_offset + bar_pba_size > 4096) {
|
||||
bar_size = bar_pba_offset + bar_pba_size;
|
||||
}
|
||||
|
||||
if (bar_size & (bar_size - 1)) {
|
||||
bar_size = 1 << qemu_fls(bar_size);
|
||||
}
|
||||
|
||||
name = g_strdup_printf("%s-msix", dev->name);
|
||||
memory_region_init(&dev->msix_exclusive_bar, OBJECT(dev), name, MSIX_EXCLUSIVE_BAR_SIZE);
|
||||
memory_region_init(&dev->msix_exclusive_bar, OBJECT(dev), name, bar_size);
|
||||
g_free(name);
|
||||
|
||||
ret = msix_init(dev, nentries, &dev->msix_exclusive_bar, bar_nr,
|
||||
MSIX_EXCLUSIVE_BAR_TABLE_OFFSET, &dev->msix_exclusive_bar,
|
||||
bar_nr, MSIX_EXCLUSIVE_BAR_PBA_OFFSET,
|
||||
MSIX_EXCLUSIVE_CAP_OFFSET);
|
||||
0, &dev->msix_exclusive_bar,
|
||||
bar_nr, bar_pba_offset,
|
||||
0);
|
||||
if (ret) {
|
||||
return ret;
|
||||
}
|
||||
|
|
43
hw/pci/pci.c
43
hw/pci/pci.c
|
@ -1615,28 +1615,32 @@ static const char * const pci_nic_names[] = {
|
|||
};
|
||||
|
||||
/* Initialize a PCI NIC. */
|
||||
static PCIDevice *pci_nic_init(NICInfo *nd, PCIBus *rootbus,
|
||||
PCIDevice *pci_nic_init_nofail(NICInfo *nd, PCIBus *rootbus,
|
||||
const char *default_model,
|
||||
const char *default_devaddr,
|
||||
Error **errp)
|
||||
const char *default_devaddr)
|
||||
{
|
||||
const char *devaddr = nd->devaddr ? nd->devaddr : default_devaddr;
|
||||
Error *err = NULL;
|
||||
PCIBus *bus;
|
||||
int devfn;
|
||||
PCIDevice *pci_dev;
|
||||
DeviceState *dev;
|
||||
int devfn;
|
||||
int i;
|
||||
|
||||
if (qemu_show_nic_models(nd->model, pci_nic_models)) {
|
||||
exit(0);
|
||||
}
|
||||
|
||||
i = qemu_find_nic_model(nd, pci_nic_models, default_model);
|
||||
if (i < 0)
|
||||
return NULL;
|
||||
if (i < 0) {
|
||||
exit(1);
|
||||
}
|
||||
|
||||
bus = pci_get_bus_devfn(&devfn, rootbus, devaddr);
|
||||
if (!bus) {
|
||||
error_report("Invalid PCI device address %s for device %s",
|
||||
devaddr, pci_nic_names[i]);
|
||||
return NULL;
|
||||
exit(1);
|
||||
}
|
||||
|
||||
pci_dev = pci_create(bus, devfn, pci_nic_names[i]);
|
||||
|
@ -1645,31 +1649,12 @@ static PCIDevice *pci_nic_init(NICInfo *nd, PCIBus *rootbus,
|
|||
|
||||
object_property_set_bool(OBJECT(dev), true, "realized", &err);
|
||||
if (err) {
|
||||
error_propagate(errp, err);
|
||||
error_report_err(err);
|
||||
object_unparent(OBJECT(dev));
|
||||
return NULL;
|
||||
}
|
||||
return pci_dev;
|
||||
}
|
||||
|
||||
PCIDevice *pci_nic_init_nofail(NICInfo *nd, PCIBus *rootbus,
|
||||
const char *default_model,
|
||||
const char *default_devaddr)
|
||||
{
|
||||
Error *err = NULL;
|
||||
PCIDevice *res;
|
||||
|
||||
if (qemu_show_nic_models(nd->model, pci_nic_models))
|
||||
exit(0);
|
||||
|
||||
res = pci_nic_init(nd, rootbus, default_model, default_devaddr, &err);
|
||||
if (!res) {
|
||||
if (err) {
|
||||
error_report_err(err);
|
||||
}
|
||||
exit(1);
|
||||
}
|
||||
return res;
|
||||
|
||||
return pci_dev;
|
||||
}
|
||||
|
||||
PCIDevice *pci_vga_init(PCIBus *bus)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue