Commit 1302519
committed
feat: add a FreeBSD platform (pciconf/devctl/camcontrol/fstat)
Implement the Platform interface with FreeBSD's native tools:
- pciconf -l enumerates devices. Both output formats are parsed: the
packed chip=/card= fields of 14.3 and earlier, and the split
vendor=/device= fields of 15.x and 14.4.
- devctl detach / devctl set driver implement unbind and bind for
kernel drivers. nic_uio cannot be attached that way: it only probes
devices listed in the hw.nic_uio.bdfs tunable. Binding to nic_uio
registers the device there, drops any driver pinned by an earlier
set driver, and (re)loads the module, which detaches the previous
driver and claims the device by itself. Binding back to a kernel
driver removes the bdfs entry again.
- camcontrol devlist maps an nvmeX controller to its CAM disk (ndaY),
so the fstat in-use check also sees users of the disk device.
- kldstat reports whether nic_uio is loaded.
- scan_devices() honors the --device class-filter bypass, matching
the Linux platform.
- pciconf -w enables bus-mastering once the nic_uio attach is
verified through pciconf -l. A failed write is reported instead of
ignored.
Helpers convert between the pciX:B:S:F selector and the
domain:bus:device.function bdf form. nic_uio is added to
KNOWN_DRIVERS, completion, and the docs. User-facing text drops its
Linux assumptions: the --bind help says driver file instead of .ko
file, and the memlock warning says DMA mapping instead of
VFIO_IOMMU_MAP_DMA. Unit tests cover both pciconf formats, the fstat
heuristic, kldstat probing, camcontrol parsing, the nic_uio bdfs
flow, and the devctl bind for kernel drivers.
Signed-off-by: Jaeyoon Choi <j_yoon.choi@samsung.com>1 parent 7fc744d commit 1302519
4 files changed
Lines changed: 515 additions & 23 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
16 | 28 | | |
17 | 29 | | |
18 | 30 | | |
| |||
33 | 45 | | |
34 | 46 | | |
35 | 47 | | |
36 | | - | |
| 48 | + | |
37 | 49 | | |
38 | 50 | | |
39 | 51 | | |
| |||
43 | 55 | | |
44 | 56 | | |
45 | 57 | | |
46 | | - | |
| 58 | + | |
47 | 59 | | |
48 | 60 | | |
49 | 61 | | |
| |||
55 | 67 | | |
56 | 68 | | |
57 | 69 | | |
58 | | - | |
59 | | - | |
| 70 | + | |
| 71 | + | |
60 | 72 | | |
61 | 73 | | |
62 | 74 | | |
| |||
71 | 83 | | |
72 | 84 | | |
73 | 85 | | |
| 86 | + | |
| 87 | + | |
| 88 | + | |
| 89 | + | |
| 90 | + | |
| 91 | + | |
| 92 | + | |
| 93 | + | |
74 | 94 | | |
75 | 95 | | |
76 | 96 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | | - | |
| 8 | + | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
| |||
18 | 18 | | |
19 | 19 | | |
20 | 20 | | |
| 21 | + | |
21 | 22 | | |
22 | 23 | | |
23 | 24 | | |
| |||
0 commit comments