From: Anthony Liguori <anthony@codemonkey.ws>
To: Amit Shah <amit.shah@redhat.com>
Cc: avi@redhat.com, kvm@vger.kernel.org, muli@il.ibm.com,
benami@il.ibm.com, weidong.han@intel.com, allen.m.kay@intel.com
Subject: Re: [PATCH 7/7] KVM/userspace: Device Assignment: Support for hot plugging PCI devices
Date: Tue, 23 Sep 2008 11:32:04 -0500 [thread overview]
Message-ID: <48D91A04.3000501@codemonkey.ws> (raw)
In-Reply-To: <1222181695-23418-8-git-send-email-amit.shah@redhat.com>
Amit Shah wrote:
> This patch adds support for hot-plugging host PCI devices into
> guests
>
Instead of using assigned, it should probably be host.
Regards,
Anthony Liguori
> Signed-off-by: Amit Shah <amit.shah@redhat.com>
> ---
> qemu/hw/device-hotplug.c | 19 +++++++++++++++++++
> qemu/monitor.c | 2 +-
> 2 files changed, 20 insertions(+), 1 deletions(-)
>
> diff --git a/qemu/hw/device-hotplug.c b/qemu/hw/device-hotplug.c
> index 8e2bc35..6d2ab8e 100644
> --- a/qemu/hw/device-hotplug.c
> +++ b/qemu/hw/device-hotplug.c
> @@ -6,6 +6,7 @@
> #include "pc.h"
> #include "console.h"
> #include "block_int.h"
> +#include "device-assignment.h"
>
> #define PCI_BASE_CLASS_STORAGE 0x01
> #define PCI_BASE_CLASS_NETWORK 0x02
> @@ -27,6 +28,22 @@ static PCIDevice *qemu_system_hot_add_nic(const char *opts, int bus_nr)
> return pci_nic_init (pci_bus, &nd_table[ret], -1);
> }
>
> +static PCIDevice *qemu_system_hot_assign_device(const char *opts, int bus_nr)
> +{
> + int index;
> + PCIBus *pci_bus;
> +
> + pci_bus = pci_find_bus(bus_nr);
> + if (!pci_bus) {
> + term_printf ("Can't find pci_bus %d\n", bus_nr);
> + return NULL;
> + }
> + add_assigned_device(opts);
> +
> + index = -1;
> + return init_assigned_device(pci_bus, &index);
> +}
> +
> static int add_init_drive(const char *opts)
> {
> int drive_opt_idx, drive_idx;
> @@ -143,6 +160,8 @@ void device_hot_add(int pcibus, const char *type, const char *opts)
> dev = qemu_system_hot_add_nic(opts, pcibus);
> else if (strcmp(type, "storage") == 0)
> dev = qemu_system_hot_add_storage(opts, pcibus);
> + else if (strcmp(type, "assigned") == 0)
> + dev = qemu_system_hot_assign_device(opts, pcibus);
> else
> term_printf("invalid type: %s\n", type);
>
> diff --git a/qemu/monitor.c b/qemu/monitor.c
> index 2619fdd..6cf5e8a 100644
> --- a/qemu/monitor.c
> +++ b/qemu/monitor.c
> @@ -1516,7 +1516,7 @@ static term_cmd_t term_cmds[] = {
> "[,cyls=c,heads=h,secs=s[,trans=t]]\n"
> "[snapshot=on|off][,cache=on|off]",
> "add drive to PCI storage controller" },
> - { "pci_add", "iss", device_hot_add, "bus nic|storage [[vlan=n][,macaddr=addr][,model=type]] [file=file][,if=type][,bus=nr]...", "hot-add PCI device" },
> + { "pci_add", "iss", device_hot_add, "bus nic|storage|assigned [[vlan=n][,macaddr=addr][,model=type]] [file=file][,if=type][,bus=nr]... [host=02:00.0[,name=string][,dma=none]" "hot-add PCI device" },
> { "pci_del", "ii", device_hot_remove, "bus slot-number", "hot remove PCI device" },
> #endif
> { "balloon", "i", do_balloon,
>
next prev parent reply other threads:[~2008-09-23 16:33 UTC|newest]
Thread overview: 31+ messages / expand[flat|nested] mbox.gz Atom feed top
2008-09-23 14:54 [V6] Userspace patches for PCI device assignment Amit Shah
2008-09-23 14:54 ` [PATCH 1/7] KVM/userspace: Device Assignment: Add ioctl wrappers needed for assigning devices Amit Shah
2008-09-23 14:54 ` [PATCH 2/7] qemu: Introduce pci_map_irq to get irq nr from pin number for a PCI device Amit Shah
2008-09-23 14:54 ` [PATCH 3/7] qemu: piix: Introduce functions to get pin number from irq and vice versa Amit Shah
2008-09-23 14:54 ` [PATCH 4/7] qemu: Include hw.h in qemu/hw/isa.h to fix compile issues Amit Shah
2008-09-23 14:54 ` [PATCH 5/7] KVM/userspace: Device Assignment: Support for assigning PCI devices to guests Amit Shah
2008-09-23 14:54 ` [PATCH 6/7] KVM/userspace: Build vtd.c for Intel IOMMU support Amit Shah
2008-09-23 14:54 ` [PATCH 7/7] KVM/userspace: Device Assignment: Support for hot plugging PCI devices Amit Shah
2008-09-23 16:32 ` Anthony Liguori [this message]
2008-09-24 4:24 ` Amit Shah
2008-09-23 16:31 ` [PATCH 6/7] KVM/userspace: Build vtd.c for Intel IOMMU support Anthony Liguori
2008-09-24 4:25 ` Amit Shah
2008-09-24 15:08 ` Anthony Liguori
2008-09-23 16:30 ` [PATCH 5/7] KVM/userspace: Device Assignment: Support for assigning PCI devices to guests Anthony Liguori
2008-09-23 18:32 ` Muli Ben-Yehuda
2008-09-23 19:18 ` Anthony Liguori
2008-09-23 19:43 ` Muli Ben-Yehuda
2008-09-23 19:58 ` Anthony Liguori
2008-09-24 4:58 ` Amit Shah
2008-09-24 15:07 ` Anthony Liguori
2008-09-24 17:10 ` Amit Shah
2008-09-25 4:54 ` Yang, Sheng
2008-09-25 5:20 ` Yang, Sheng
2008-09-26 1:34 ` Yang, Sheng
2008-09-23 16:13 ` [PATCH 4/7] qemu: Include hw.h in qemu/hw/isa.h to fix compile issues Anthony Liguori
2008-09-24 4:27 ` Amit Shah
2008-09-24 11:35 ` Amit Shah
2008-09-24 14:59 ` Anthony Liguori
2008-09-23 16:13 ` [PATCH 3/7] qemu: piix: Introduce functions to get pin number from irq and vice versa Anthony Liguori
2008-09-24 4:28 ` Amit Shah
2008-09-23 16:12 ` [PATCH 2/7] qemu: Introduce pci_map_irq to get irq nr from pin number for a PCI device Anthony Liguori
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=48D91A04.3000501@codemonkey.ws \
--to=anthony@codemonkey.ws \
--cc=allen.m.kay@intel.com \
--cc=amit.shah@redhat.com \
--cc=avi@redhat.com \
--cc=benami@il.ibm.com \
--cc=kvm@vger.kernel.org \
--cc=muli@il.ibm.com \
--cc=weidong.han@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.