vmm pptdevs does not handle domain, only bus, slot, func

John <[email protected]>
Newsgroups gmane.os.freebsd.devel.hackers
Message-ID <[email protected]>
Hi -

   I am trying to pass some nvme devices to a bhyve vm, using pptdevs=
in loader.conf. From pciconf:

nvme0@pci0:176:0:0:  class=0x010802 rev=0x01 hdr=0x00 vendor=0x1344
nvme1@pci0:177:0:0:  class=0x010802 rev=0x01 hdr=0x00 vendor=0x1344
nvme2@pci1:176:0:0:  class=0x010802 rev=0x01 hdr=0x00 vendor=0x1344
nvme3@pci1:177:0:0:  class=0x010802 rev=0x01 hdr=0x00 vendor=0x1344
nvme4@pci1:178:0:0:  class=0x010802 rev=0x01 hdr=0x00 vendor=0x1344
nvme5@pci1:179:0:0:  class=0x010802 rev=0x01 hdr=0x00 vendor=0x1344

   Note, nvme0 & 1 have the same bus/slot/func definition as nvme2 & 3.
However, the code that parses pptdevs= does not consider the domain, pci0
vs pci1 in this case.

   Trying to passthru nvme2@pci1:176:0:0: with pptdevs="176/0/0" causes
confusion with nvme0@pci0:176:0:0:.

   Thoughts on adding a variable to contain a dbsf(dbdf), or try to parse
both a bsf(bdf) and dbsf from pptdevs? (and pass domain in along with bus,
slot, and func)

   Something along the lines of (untested):

vmm_is_pptdev(int domain, int bus, int slot, int func)

n = sscanf(cp, "%d/%d/%d/%d", &d, &b, &s, &f);
if (n == 4 && domain == d && bus == b && slot == s && func == f) {
   found = true;
   break;
}
n = sscanf(cp, "%d/%d/%d", &b, &s, &f);
if (n == 3 && bus == b && slot == s && func == f) {
   found = true;
   break;
}


   Yes, devctl does appear to work correctly. Looking for parity.

-John
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.