commit 5beedb58147cbb04e206a71429198b6316217cfc
Author: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
Date: Mon Jun 1 10:45:42 2009 +0100
passthrough: hot-plug PCI devices at boot-time
Currently there are two interfaces to pass-through PCI devices:
1. A method driven through per-device xenstore entries that is used at
boot-time
2. An event-based method used for hot-plug.
This seems somewhat redundant and makes extending the code cumbersome
and prone to error - often the change needs to be made twice, in
two different ways.
This patch removes support for the boot-time protocol from qemu-xen.
There is a companion patch for xend which uses the hot-plug protocol
at boot time.
Cc: Edwin Zhai <edwin.zhai@xxxxxxxxx>
Cc: Masaki Kanno <kanno.masaki@xxxxxxxxxxxxxx>
Signed-off-by: Simon Horman <horms@xxxxxxxxxxxx>
---
hw/pass-through.c | 61 +---------------------------------------------------
hw/pc.c | 11 +++------
hw/pci.h | 2 +-
vl.c | 3 --
xenstore.c | 58 --------------------------------------------------
5 files changed, 7 insertions(+), 128 deletions(-)
diff --git a/hw/pass-through.c b/hw/pass-through.c
index 2af2a1c..57c2c27 100644
--- a/hw/pass-through.c
+++ b/hw/pass-through.c
@@ -4247,16 +4247,9 @@ int power_off_php_slot(int php_slot)
return unregister_real_device(php_slot);
}
-int pt_init(PCIBus *e_bus, const char *direct_pci)
+int pt_init(PCIBus *e_bus)
{
- int seg, b, d, f, s, status = -1;
- struct pt_dev *pt_dev;
struct pci_access *pci_access;
- char *vslots;
- char slot_str[8];
- char *direct_pci_head = NULL;
- char *direct_pci_p = NULL;
- char *opt;
/* Initialize libpci */
pci_access = pci_alloc();
@@ -4272,56 +4265,6 @@ int pt_init(PCIBus *e_bus, const char *direct_pci)
dpci_infos.pci_access = pci_access;
dpci_infos.e_bus = e_bus;
- if ( !direct_pci || strlen(direct_pci) == 0 ) {
- return 0;
- }
-
- if ( !(direct_pci_head = direct_pci_p = strdup(direct_pci)) )
- return 0;
-
- /* The minimal format of direct_pci: xxxx:xx:xx.x-xxxx:xx:xx.x-... It may
- * be even longer considering the per-device opts(see the parsing for
- * '/local/domain/0/backend/pci/XX/YY/opts-ZZ' in
- * xenstore_parse_domain_config().
- *
- * The format of vslots(virtual pci slots of all pass-through devs):
- * 0xXX;0xXX;... (see the code below).
- *
- * We're sure the length of direct_pci is bigger than that of vslots.
- */
- vslots = qemu_mallocz(strlen(direct_pci) + 1);
- if ( vslots == NULL )
- {
- status = -1;
- goto err;
- }
-
- /* Assign given devices to guest */
- while ( next_bdf(&direct_pci_p, &seg, &b, &d, &f, &opt, &s) )
- {
- /* Register real device with the emulated bus */
- pt_dev = register_real_device(e_bus, "DIRECT PCI", s,
- b, d, f, PT_MACHINE_IRQ_AUTO, pci_access, opt);
- if ( pt_dev == NULL )
- {
- PT_LOG("Error: Registration failed (%02x:%02x.%x)\n", b, d, f);
- goto err;
- }
-
- /* Record the virtual slot info */
- sprintf(slot_str, "0x%02x;", PCI_SLOT(pt_dev->dev.devfn));
-
- strcat(vslots, slot_str);
- }
-
- /* Write virtual slots info to xenstore for Control panel use */
- xenstore_write_vslots(vslots);
-
- status = 0;
-err:
- qemu_free(vslots);
- free(direct_pci_head);
-
- return status;
+ return 0;
}
diff --git a/hw/pc.c b/hw/pc.c
index 9a5637c..129e9d9 100644
--- a/hw/pc.c
+++ b/hw/pc.c
@@ -787,8 +787,7 @@ static void pc_init1(ram_addr_t ram_size, int vga_ram_size,
const char *boot_device,
const char *kernel_filename, const char *kernel_cmdline,
const char *initrd_filename,
- int pci_enabled, const char *cpu_model,
- const char *direct_pci)
+ int pci_enabled, const char *cpu_model)
{
char buf[1024];
int ret, linux_boot, i;
@@ -1017,7 +1016,7 @@ vga_bios_error:
*/
if ( pci_enabled )
{
- rc = pt_init(pci_bus, direct_pci);
+ rc = pt_init(pci_bus);
if ( rc < 0 )
{
fprintf(logfile, "Error: Initialization failed for pass-through
devices\n");
@@ -1205,8 +1204,7 @@ static void pc_init_pci(ram_addr_t ram_size, int
vga_ram_size,
{
pc_init1(ram_size, vga_ram_size, boot_device,
kernel_filename, kernel_cmdline,
- initrd_filename, 1, cpu_model,
- direct_pci);
+ initrd_filename, 1, cpu_model);
}
static void pc_init_isa(ram_addr_t ram_size, int vga_ram_size,
@@ -1219,8 +1217,7 @@ static void pc_init_isa(ram_addr_t ram_size, int
vga_ram_size,
{
pc_init1(ram_size, vga_ram_size, boot_device,
kernel_filename, kernel_cmdline,
- initrd_filename, 0, cpu_model,
- direct_pci);
+ initrd_filename, 0, cpu_model);
}
/* set CMOS shutdown status register (index 0xF) as S3_resume(0xFE)
diff --git a/hw/pci.h b/hw/pci.h
index ee13a36..d45b80c 100644
--- a/hw/pci.h
+++ b/hw/pci.h
@@ -337,6 +337,6 @@ PCIBus *sh_pci_register_bus(pci_set_irq_fn set_irq,
pci_map_irq_fn map_irq,
qemu_irq *pic, int devfn_min, int nirq);
/* pass-through.c */
-int pt_init(PCIBus *e_bus, const char *direct_pci_opt);
+int pt_init(PCIBus *e_bus);
#endif
diff --git a/vl.c b/vl.c
index 3506977..7549a19 100644
--- a/vl.c
+++ b/vl.c
@@ -5829,9 +5829,6 @@ int main(int argc, char **argv, char **envp)
}
}
- if (strlen(direct_pci_str) > 0)
- direct_pci = direct_pci_str;
-
machine->init(ram_size, vga_ram_size, boot_devices,
kernel_filename, kernel_cmdline, initrd_filename, cpu_model,
direct_pci);
diff --git a/xenstore.c b/xenstore.c
index 3db3531..8504610 100644
--- a/xenstore.c
+++ b/xenstore.c
@@ -301,10 +301,8 @@ static const char *xenstore_get_guest_uuid(void)
return already_computed;
}
-#define DIRECT_PCI_STR_LEN 512
#define PT_PCI_MSITRANSLATE_DEFAULT 1
#define PT_PCI_POWER_MANAGEMENT_DEFAULT 0
-char direct_pci_str[DIRECT_PCI_STR_LEN];
int direct_pci_msitranslate;
int direct_pci_power_mgmt;
void xenstore_parse_domain_config(int hvm_domid)
@@ -567,62 +565,6 @@ void xenstore_parse_domain_config(int hvm_domid)
goto out;
num = atoi(params);
- for ( i = 0; i < num; i++ ) {
- if (pasprintf(&buf, "/local/domain/0/backend/pci/%u/%u/dev-%d",
- hvm_domid, pci_devid, i) != -1) {
- free(dev);
- dev = xs_read(xsh, XBT_NULL, buf, &len);
-
- if ( strlen(dev) + strlen(direct_pci_str) > DIRECT_PCI_STR_LEN -
1) {
- fprintf(stderr, "qemu: too many pci pass-through devices\n");
- memset(direct_pci_str, 0, DIRECT_PCI_STR_LEN);
- goto out;
- }
-
-
- /* append to direct_pci_str */
- if ( !dev )
- continue;
-
- strcat(direct_pci_str, dev);
-
- if (pasprintf(&buf, "/local/domain/0/backend/pci/%u/%u/vslot-%d",
- hvm_domid, pci_devid, i) != -1) {
- free(dev);
- dev = xs_read(xsh, XBT_NULL, buf, &len);
- }
- if ( dev ) {
- if (strlen(dev) + strlen(direct_pci_str) >
- DIRECT_PCI_STR_LEN - 2) {
- fprintf(stderr, "qemu: too many pci pass-through "
- "devices\n");
- memset(direct_pci_str, 0, DIRECT_PCI_STR_LEN);
- goto out;
- }
- strcat(direct_pci_str, "@");
- strcat(direct_pci_str, dev);
- }
-
-
- if (pasprintf(&buf, "/local/domain/0/backend/pci/%u/%u/opts-%d",
- hvm_domid, pci_devid, i) != -1) {
- free(dev);
- dev = xs_read(xsh, XBT_NULL, buf, &len);
- }
- if ( dev ) {
- if ( strlen(dev) + strlen(direct_pci_str) > DIRECT_PCI_STR_LEN
- 2) {
- fprintf(stderr, "qemu: too many pci pass-through
devices\n");
- memset(direct_pci_str, 0, DIRECT_PCI_STR_LEN);
- goto out;
- }
- strcat(direct_pci_str, ",");
- strcat(direct_pci_str, dev);
- }
-
- strcat(direct_pci_str, "-");
- }
- }
-
/* get the pci pass-through parameter */
if (pasprintf(&buf, "/local/domain/0/backend/pci/%u/%u/msitranslate",
hvm_domid, pci_devid) != -1)
--
generated by git-patchbot for /home/xen/git/qemu-xen-unstable.git
_______________________________________________
Xen-changelog mailing list
Xen-changelog@xxxxxxxxxxxxxxxxxxx
http://lists.xensource.com/xen-changelog
|