Port-xen archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: PCI pass through Xen 4.1.x and NetBSD 6



Am 22.01.2013 22:04, schrieb Marcus Osdoba:
Unfortunatly I still got an error when starting the hvm domu with xl:
libxl: error: libxl_pci.c:750:libxl_device_pci_reset The kernel doesn't
support reset from sysfs for PCI device 0000:02:00.0
libxl: error: libxl_pci.c:750:libxl_device_pci_reset The kernel doesn't
support reset from sysfs for PCI device 0000:04:00.0

I have found the relevant function in xl and the following posts [0],[1] and [2].

Anyway, the patch in patch-libxl_libxl_internal.h leaves /sys/..
enabled ( #define SYSFS_PCI_DEV "/sys/bus/pci/devices"), which is used by the pci reset function in xl.

/sys is not present by default in netbsd.
I didn't find any compatibility /sys in pkgsrc or sys/compat.

Does PCI pass through ought to work without /sys (which might NOT when verifying the relevant libxl_device_pci_reset function).

Do I need to wait for 4.2 as proposed in [2]?

Thanks for a short statement,
Marcus

[0] http://xen.markmail.org/message/vgkh5duv32ga4ruz?q=%22SYSFS_PCIBACK_DRIVER%22 [1] http://xen.1045712.n5.nabble.com/xen-unstable-libxl-support-reset-file-on-sysfs-td2617808.html
[2] http://choon.net/forum/read.php?22,1473076

static int libxl_device_pci_reset(libxl__gc *gc, unsigned int domain, unsigned int bus,
                         unsigned int dev, unsigned int func)
{
    libxl_ctx *ctx = libxl__gc_owner(gc);
    char *reset;
    int fd, rc;

    reset = libxl__sprintf(gc, "%s/pciback/do_flr", SYSFS_PCI_DEV);
    fd = open(reset, O_WRONLY);
    if (fd > 0) {
        char *buf = libxl__sprintf(gc, PCI_BDF, domain, bus, dev, func);
        rc = write(fd, buf, strlen(buf));
        if (rc < 0)
LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "write to %s returned %d", reset, rc);
        close(fd);
        return rc < 0 ? rc : 0;
    }
    if (errno != ENOENT)
LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "Failed to access pciback path %s", reset); reset = libxl__sprintf(gc, "%s/"PCI_BDF"/reset", SYSFS_PCI_DEV, domain, bus, dev, func);
    fd = open(reset, O_WRONLY);
    if (fd > 0) {
        rc = write(fd, "1", 1);
        if (rc < 0)
LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "write to %s returned %d", reset, rc);
        close(fd);
        return rc < 0 ? rc : 0;
    }
    if (errno == ENOENT) {
LIBXL__LOG(ctx, LIBXL__LOG_ERROR, "The kernel doesn't support reset from sysfs for PCI device "PCI_BDF, domain, bus, dev, func);
    } else {
LIBXL__LOG_ERRNO(ctx, LIBXL__LOG_ERROR, "Failed to access reset path %s", reset);
    }
    return -1;
}


Home | Main Index | Thread Index | Old Index