Solved devctl: Failed to set pci0:2:0:0 driver to ppt: Device busy

Hello.

Please give a look at the bhyve's behavior that you see below :

Code:
/boot/loader.conf :

#pptdevs="2/0/0 2/0/1 2/0/2 2/0/3"

root@marietto:/home/marietto/bhyve # pciconf -l pci0:2:0:1
hdac1@pci0:2:0:1:       class=0x040300 rev=0xa1 hdr=0x00 vendor=0x10de device=0x10f7 subvendor=0x19da subdevice=0x2503
 
root@marietto:/home/marietto/bhyve # pciconf -l pci0:2:0:1
hdac1@pci0:2:0:1:       class=0x040300 rev=0xa1 hdr=0x00 vendor=0x10de device=0x10f7 subvendor=0x19da subdevice=0x2503

root@marietto:/home/marietto/bhyve # pciconf -l pci0:2:0:2
xhci0@pci0:2:0:2:       class=0x0c0330 rev=0xa1 hdr=0x00 vendor=0x10de device=0x1ad6 subvendor=0x19da subdevice=0x2503
 
root@marietto:/home/marietto/bhyve # pciconf -l pci0:2:0:3
none0@pci0:2:0:3:       class=0x0c8000 rev=0xa1 hdr=0x00 vendor=0x10de device=0x1ad7 subvendor=0x19da subdevice=0x2503


root@marietto:/home/marietto/bhyve # devctl detach pci0:2:0:0
devctl: Failed to detach pci0:2:0:0: Device busy

root@marietto:/home/marietto/bhyve # devctl set driver pci0:2:0:0 ppt
devctl: Failed to set pci0:2:0:0 driver to ppt: Device busy

root@marietto:/home/marietto/bhyve # devctl detach pci0:2:0:1
ok

root@marietto:/home/marietto/bhyve # devctl set driver pci0:2:0:1 ppt
ok

root@marietto:/ # devctl detach pci0:2:0:2
ok

root@marietto:/home/marietto/bhyve # devctl set driver pci0:2:0:2 ppt
ok


root@marietto:/ # devctl detach pci0:2:0:3
devctl: Failed to detach pci0:2:0:3: Device not configured

root@marietto:/home/marietto/bhyve # devctl set driver pci0:2:0:3 ppt
ok

Something is using the GPU (e.g. a window manager ?). So, it's busy and I can't detach it as long as it's been used. Do you know if there is and what's the command to show whats using the GPU (RTX 2080 ti) ?

Take in consideration that I have chosen to have the nvidia 1060 as default on the BIOS and on the xorg.conf file,so,I expect that the window manager or whatever keeps using it,but the 2080 ti is free,so nothing should use it. I'm very curious to see what keeps it busy. Thanks.
 
You posted the output of pci0:2:0:1 twice and missed the output of pci0:2:0:0. It might be taken by the vgapci driver for the console.
 
Code:
/boot/loader.conf :

#pptdevs="2/0/0 2/0/1 2/0/2 2/0/3"

root@marietto:/ # pciconf -l pci0:2:0:0

vgapci1@pci0:2:0:0:     class=0x030000 rev=0xa1 hdr=0x00 vendor=0x10de device=0x1e04 subvendor=0x19d
a subdevice=0x2503

root@marietto:/ # devctl set driver pci0:2:0:0 ppt
devctl: Failed to set pci0:2:0:0 driver to ppt: Device busy

what can I do to unbind the driver from the vgapci1 ?
 
You'll have to do this with pptdevs in loader.conf. It needs to be 'reserved' before the kernel gets a chance to grab it.
 
You'll have to do this with pptdevs in loader.conf. It needs to be 'reserved' before the kernel gets a chance to grab it.

sure,but if I do in that way,I can't use the commands : devctl detach and devctl set driver anymore and I will lose the chance to put them within a shell script and this is not good.
 
I have a debian VM in bhyve that I use for Android Custom ROM purposes (because adb on FreeBSD doesn't work very well, see PR 278264) and have to attach one of the USB controllers, I passthrough my front panel's USB controller for that purpose. I was doing it in /boot/loader.conf by setting pptdevs="1/0/0" parameter but i found out that using # devctl is better because I can set the pci device to use either ppt or xhci drivers. With # devctl, I can just change driver of the pci device when I want and vice versa.

Rich (BB code):
root@hale /home/yusuf # pciconf -lv | grep 1:0
hostb1@pci0:0:1:0:      class=0x060000 rev=0x00 hdr=0x00 vendor=0x1022 device=0x1632 subvendor=0x0000 subdevice=0x0000
xhci0@pci0:1:0:0:       class=0x0c0330 rev=0x00 hdr=0x00 vendor=0x1022 device=0x43ec subvendor=0x1b21 subdevice=0x1142
ahci0@pci0:1:0:1:       class=0x010601 rev=0x00 hdr=0x00 vendor=0x1022 device=0x43eb subvendor=0x1b21 subdevice=0x1062
pcib2@pci0:1:0:2:       class=0x060400 rev=0x00 hdr=0x01 vendor=0x1022 device=0x43e9 subvendor=0x1b21 subdevice=0x0201
pcib4@pci0:2:1:0:       class=0x060400 rev=0x00 hdr=0x01 vendor=0x1022 device=0x43ea subvendor=0x1b21 subdevice=0x3308
root@hale /home/yusuf # devctl set driver -f pci0:1:0:0 ppt
root@hale /home/yusuf # pciconf -lv | grep 1:0
hostb1@pci0:0:1:0:      class=0x060000 rev=0x00 hdr=0x00 vendor=0x1022 device=0x1632 subvendor=0x0000 subdevice=0x0000
ppt0@pci0:1:0:0:        class=0x0c0330 rev=0x00 hdr=0x00 vendor=0x1022 device=0x43ec subvendor=0x1b21 subdevice=0x1142
ahci0@pci0:1:0:1:       class=0x010601 rev=0x00 hdr=0x00 vendor=0x1022 device=0x43eb subvendor=0x1b21 subdevice=0x1062
pcib2@pci0:1:0:2:       class=0x060400 rev=0x00 hdr=0x01 vendor=0x1022 device=0x43e9 subvendor=0x1b21 subdevice=0x0201
pcib4@pci0:2:1:0:       class=0x060400 rev=0x00 hdr=0x01 vendor=0x1022 device=0x43ea subvendor=0x1b21 subdevice=0x3308
root@hale /home/yusuf # devctl clear driver -f pci0:1:0:0
root@hale /home/yusuf # pciconf -lv | grep 1:0
hostb1@pci0:0:1:0:      class=0x060000 rev=0x00 hdr=0x00 vendor=0x1022 device=0x1632 subvendor=0x0000 subdevice=0x0000
xhci0@pci0:1:0:0:       class=0x0c0330 rev=0x00 hdr=0x00 vendor=0x1022 device=0x43ec subvendor=0x1b21 subdevice=0x1142
ahci0@pci0:1:0:1:       class=0x010601 rev=0x00 hdr=0x00 vendor=0x1022 device=0x43eb subvendor=0x1b21 subdevice=0x1062
pcib2@pci0:1:0:2:       class=0x060400 rev=0x00 hdr=0x01 vendor=0x1022 device=0x43e9 subvendor=0x1b21 subdevice=0x0201
pcib4@pci0:2:1:0:       class=0x060400 rev=0x00 hdr=0x01 vendor=0x1022 device=0x43ea subvendor=0x1b21 subdevice=0x3308
root@hale /home/yusuf #
 
Code:
/boot/loader.conf :

#pptdevs="2/0/0 2/0/1 2/0/2 2/0/3"

root@marietto:/ # pciconf -l pci0:2:0:0

vgapci1@pci0:2:0:0:     class=0x030000 rev=0xa1 hdr=0x00 vendor=0x10de device=0x1e04 subvendor=0x19d
a subdevice=0x2503

root@marietto:/ # devctl set driver pci0:2:0:0 ppt
devctl: Failed to set pci0:2:0:0 driver to ppt: Device busy

what can I do to unbind the driver from the vgapci1 ?
Maybe force the command, that worked for me.
Rich (BB code):
root@hale /home/yusuf # devctl set driver pci0:1:0:0 ppt
devctl: Failed to set pci0:1:0:0 driver to ppt: Device busy
root@hale /home/yusuf # devctl set driver -f pci0:1:0:0 ppt
root@hale /home/yusuf # pciconf -lv | grep 1:0
hostb1@pci0:0:1:0:      class=0x060000 rev=0x00 hdr=0x00 vendor=0x1022 device=0x1632 subvendor=0x0000 subdevice=0x0000
ppt0@pci0:1:0:0:        class=0x0c0330 rev=0x00 hdr=0x00 vendor=0x1022 device=0x43ec subvendor=0x1b21 subdevice=0x1142
ahci0@pci0:1:0:1:       class=0x010601 rev=0x00 hdr=0x00 vendor=0x1022 device=0x43eb subvendor=0x1b21 subdevice=0x1062
pcib2@pci0:1:0:2:       class=0x060400 rev=0x00 hdr=0x01 vendor=0x1022 device=0x43e9 subvendor=0x1b21 subdevice=0x0201
pcib4@pci0:2:1:0:       class=0x060400 rev=0x00 hdr=0x01 vendor=0x1022 device=0x43ea subvendor=0x1b21 subdevice=0x3308
root@hale /home/yusuf #
 
Hello.

---> I have a debian VM in bhyve that I use for Android Custom ROM purposes

Can you elaborate more here ? or open a new thread is a better choice or talk about this in some way with me please,I'm interested.

---> (because adb on FreeBSD doesn't work very well, see PR 278264)

adb connect always worked great for me,in FreeBSD and even in Linux,with the Linuxulator.

---> I found out that using # devctl is better because I can set the pci device to use either ppt or xhci driver

exactly.

I see that you used devctl clear driver -f instead of devctl detach. Maybe this is the reason why it works. So,I will try this script :

Code:
if ! pciconf -l pci0:2:0:0 | grep -q "^ppt"; then
echo "rtx 2080ti slot 2/0/0 is not attached to ppt,attaching..."
kldload nvidia-modeset
devctl clear driver -f pci0:2:0:0
#devctl detach pci0:2:0:0
devctl set driver -f pci0:2:0:0 ppt
else
echo "rtx 2080ti slot 2/0/0 is already attached to ppt"
fi

if ! pciconf -l pci0:2:0:1 | grep -q "^ppt"; then
echo "rtx 2080ti slot 2/0/1 is not attached to ppt,attaching..."
#devctl detach pci0:2:0:1
devctl clear driver -f pci0:2:0:0
devctl set driver -f pci0:2:0:1 ppt
else
echo "rtx 2080ti slot 2/0/1 is already attached to ppt"
fi

if ! pciconf -l pci0:2:0:2 | grep -q "^ppt"; then
echo "rtx 2080ti slot 2/0/2 is not attached to ppt,attaching..."
#devctl detach pci0:2:0:2
devctl clear driver -f pci0:2:0:0
devctl set driver -f pci0:2:0:2 ppt
else
echo "rtx 2080ti slot 2/0/2 is already attached to ppt"
fi

if ! pciconf -l pci0:2:0:3 | grep -q "^ppt"; then
echo "rtx 2080ti slot 2/0/3 is not attached to ppt,attaching..."
#devctl detach pci0:2:0:3
devctl clear driver -f pci0:2:0:0
devctl set driver -f pci0:2:0:3 ppt
else
echo "rtx 2080ti slot 2/0/3 is already attached to ppt"
fi

echo "rtx 2080ti is fully attached to ppt"
 
Hello.



Can you elaborate more here ? or open a new thread is a better choice or talk about this in some way with me please,I'm interested.



adb always worked great for me,in FreeBSD and even in Linux,with the Linuxulator.



exactly.

I see that you used devctl clear driver -f instead of devctl detach. Maybe this is the reason why it works. So,I will try this script :

Code:
if ! pciconf -l pci0:2:0:0 | grep -q "^ppt"; then
echo "rtx 2080ti slot 2/0/0 is not attached to ppt,attaching..."
kldload nvidia-modeset
devctl clear driver -f pci0:2:0:0
#devctl detach pci0:2:0:0
devctl set driver -f pci0:2:0:0 ppt
else
echo "rtx 2080ti slot 2/0/0 is already attached to ppt"
fi

if ! pciconf -l pci0:2:0:1 | grep -q "^ppt"; then
echo "rtx 2080ti slot 2/0/1 is not attached to ppt,attaching..."
#devctl detach pci0:2:0:1
devctl clear driver -f pci0:2:0:0
devctl set driver -f pci0:2:0:1 ppt
else
echo "rtx 2080ti slot 2/0/1 is already attached to ppt"
fi

if ! pciconf -l pci0:2:0:2 | grep -q "^ppt"; then
echo "rtx 2080ti slot 2/0/2 is not attached to ppt,attaching..."
#devctl detach pci0:2:0:2
devctl clear driver -f pci0:2:0:0
devctl set driver -f pci0:2:0:2 ppt
else
echo "rtx 2080ti slot 2/0/2 is already attached to ppt"
fi

if ! pciconf -l pci0:2:0:3 | grep -q "^ppt"; then
echo "rtx 2080ti slot 2/0/3 is not attached to ppt,attaching..."
#devctl detach pci0:2:0:3
devctl clear driver -f pci0:2:0:0
devctl set driver -f pci0:2:0:3 ppt
else
echo "rtx 2080ti slot 2/0/3 is already attached to ppt"
fi

echo "rtx 2080ti is fully attached to ppt"
I and people had issues using adb sideload and adb push. I need to use adb sideload to flash images (recovery, rom etc.) to my android phone. I do passthrough front panel USB controller to Debian VM to make Debian see my phone when i connect it via USB. ADB on Debian works fine so that's why I chose it and it works fine with vm-bhyve.

Did the script worked for you? Did you try the devctl commands before entering them to script?
 
Back
Top