Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 15 Nov 2018 21:08:27 +0100
From:      Jan Beich <jbeich@FreeBSD.org>
To:        freebsd-current@freebsd.org
Subject:   Re: [regression] drm-stable-kmod doesn't work in i386 jail on amd64 host
Message-ID:  <lg5u-5cjo-wny@FreeBSD.org>
References:  <zhvq-800y-wny@FreeBSD.org>

next in thread | previous in thread | raw e-mail | index | archive | help
Jan Beich <jbeich@FreeBSD.org> writes:

> I often test Firefox on 10.4 i386 and sometimes play games via Wine.
> Both require working OpenGL for COMPAT_FREEBSD32. My GPU is Skylake
> which worked fine a few weegs ago i.e., before r338990.
>
> Any clue?

I've opened https://github.com/FreeBSDDesktop/kms-drm/issues/99 but so
far no response. Would a sample would help?

$ cc -o test test.c
$ cc -m32 -o test32 test.c

$ pciconf -l | fgrep 0:0:2:0
vgapci1@pci0:0:2:0:     class=0x030000 card=0x79681462 chip=0x19128086 rev=0x06 hdr=0x00
$ /poudriere/jails/112i386/usr/sbin/pciconf -l
pciconf: ioctl(PCIOCGETCONF): Operation not permitted

$ ./test 0 0 2 0
vendor=0x8086, device=0x1912, subvendor=0x1462, subdevice=0x7968, revid=0x6
$ ./test32 0 0 2 0
test32: PCIOCGETCONF failed: Operation not permitted
$ sudo ./test32 0 0 2 0
test32: PCIOCGETCONF failed: Operation not permitted

$ cat test.c
#include <sys/types.h>
#include <sys/pciio.h>
#include <err.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
#include <strings.h>
#include <unistd.h>

int main(int argc, char **argv)
{
    /* Based on drmParsePciDeviceInfo() from graphics/libdrm/files/patch-xf86drm.c */
    struct pci_conf_io pc;
    struct pci_match_conf patterns[1];
    struct pci_conf results[1];

    if (argc < 5) {
        printf("usage: %s <domain> <bus> <dev> <func>\n", argv[0]);
	return 1;
    }

    int fd = open("/dev/pci", O_RDONLY, 0);
    if (fd < 0)
        err(1, "open(/dev/pci) failed");

    bzero(&patterns, sizeof(patterns));
    patterns[0].pc_sel.pc_domain = atoi(argv[1]);
    patterns[0].pc_sel.pc_bus = atoi(argv[2]);
    patterns[0].pc_sel.pc_dev = atoi(argv[3]);
    patterns[0].pc_sel.pc_func = atoi(argv[4]);
    patterns[0].flags = PCI_GETCONF_MATCH_DOMAIN | PCI_GETCONF_MATCH_BUS
                      | PCI_GETCONF_MATCH_DEV | PCI_GETCONF_MATCH_FUNC;
    bzero(&pc, sizeof(struct pci_conf_io));
    pc.num_patterns = 1;
    pc.pat_buf_len = sizeof(patterns);
    pc.patterns = patterns;
    pc.match_buf_len = sizeof(results);
    pc.matches = results;

    if (ioctl(fd, PCIOCGETCONF, &pc) || pc.status == PCI_GETCONF_ERROR) {
        close(fd);
        err(1, "PCIOCGETCONF failed");
    }
    close(fd);

    printf("vendor=%#x, device=%#x, subvendor=%#x, subdevice=%#x, revid=%#x\n", 
	   results[0].pc_vendor, results[0].pc_device, 
	   results[0].pc_subvendor, results[0].pc_subdevice,
	   results[0].pc_revid);

    return 0;
}



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?lg5u-5cjo-wny>