[libvirt] PATCH: Xen PCI device passthrough

Gerd Hoffmann kraxel at redhat.com
Tue Mar 31 08:10:14 UTC 2009


  Hi,

> +static const char *
> +pciFindStubDriver(virConnectPtr conn)
> +{
> +    char drvpath[PATH_MAX];
> +    int probed = 0;
> +
> +recheck:
> +    pciDriverDir(drvpath, sizeof(drvpath), "pci-stub");
> +    if (virFileExists(drvpath))
> +        return "pci-stub";
> +    pciDriverDir(drvpath, sizeof(drvpath), "pciback");
> +    if (virFileExists(drvpath))
> +        return "pciback";
> +
> +    if (!probed) {
> +        const char *const stubprobe[] = { MODPROBE, "pci-stub", NULL };
> +        const char *const backprobe[] = { MODPROBE, "pciback", NULL };on xen.

> +
> +        probed = 1;
> +        if (virRun(conn, stubprobe, NULL) < 0 &&
> +            virRun(conn, backprobe, NULL) < 0) {
>              char ebuf[1024];
> -            VIR_WARN(_("modprobe %s failed: %s"), stub_module,
> +            VIR_WARN(_("failed to load pci-stub or pciback drivers: %s"),
>                       virStrerror(errno, ebuf, sizeof ebuf));
> +            return 0;
>          }
> +
> +        goto recheck;
>      }

I'd tend to reverse that ordering.  It isn't a issue today, but once
pv_ops/dom0 gets pciback support you might actually have both modules
present for a given kernel.

pci-stub doesn't do anything special and will load just fine in any
environment.  pciback is xen-specific (especially the part which handles
pci passthrough to pv domains) and should not load when not running on xen.

cheers,
  Gerd




More information about the libvir-list mailing list