Bug 259961 - bhyve virtio-scsi has different device id?
Summary: bhyve virtio-scsi has different device id?
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bhyve (show other bugs)
Version: CURRENT
Hardware: Any Any
: --- Affects Only Me
Assignee: Robert Wing
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2021-11-21 09:32 UTC by me
Modified: 2022-02-10 19:50 UTC (History)
6 users (show)

See Also:


Attachments
png file that shows that the virtio driver is not accepted (64.31 KB, image/png)
2021-11-21 11:52 UTC, mario felicioni
no flags Details
png file that shows that the virtio driver is not accepted (65.26 KB, image/png)
2021-11-21 11:52 UTC, mario felicioni
no flags Details
0x1004 for scsi device id (449 bytes, patch)
2021-11-21 18:30 UTC, Robert Wing
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description me 2021-11-21 09:32:29 UTC
According to the spec here ( https://docs.oasis-open.org/virtio/virtio/v1.1/virtio-v1.1.html#x1-99001r97 ) and virtio windows guest driver ( https://github.com/virtio-win/kvm-guest-drivers-windows/blob/a9ecb1dc1ecbde82ad655cb5581fb139ada1a512/vioscsi/vioscsi.inx ), virtio-scsi is supposed to have device id of 0x1004

bhyve on the other hand has it at 0x1008 ( https://cgit.freebsd.org/src/tree/usr.sbin/bhyve/virtio.h ) which results in driver from redhat virtio cd for windows can't be used.

I can't find any information on it but is it actually intentional and bhyve's virtio-scsi is just different compared to others?
Comment 1 mario felicioni 2021-11-21 11:52:11 UTC
Created attachment 229632 [details]
png file that shows that the virtio driver is not accepted
Comment 2 mario felicioni 2021-11-21 11:52:41 UTC
Created attachment 229633 [details]
png file that shows that the virtio driver is not accepted
Comment 3 mario felicioni 2021-11-21 11:56:13 UTC
it happens to me also,using these arguments :

bhyve -S -c 4 -m 8G -w -H \
-s 0,hostbridge \
-s 1,ahci-cd,/mnt/da2s1/ISO/Windows/Win.All.85in1.June.2021__CmTeamPK.CoM.iso \
-s 2,ahci-cd,/home/marietto/Downloads/virtio-win-0.1.208.iso \
-s 3,virtio-blk,/mnt/da2s1/OS/bhyve/Windows/win7.img \
-s 4,fbuf,tcp=0.0.0.0:5900,w=1440,h=900,wait \
-s 5:0,passthru,2/0/0,rom=TU102.rom \
-s 5:1,passthru,2/0/1 \
-s 5:2,passthru,2/0/2 \
-s 5:3,passthru,2/0/3 \
-s 8,virtio-net,tap0 \
-s 9,virtio-9p,sharename=/home/marietto \
-s 30,xhci,tablet \
-s 31,lpc \
-l bootrom,/usr/local/share/uefi-firmware/BHYVE_UEFI.fd \
vm0
Comment 4 Robert Wing freebsd_committer freebsd_triage 2021-11-21 18:30:21 UTC
Created attachment 229642 [details]
0x1004 for scsi device id

This change seems reasonable.

Do either of you have the ability to test this patch?
Comment 5 me 2021-11-23 10:10:28 UTC
yes, the driver can be installed after changing the device id.

weirdly windows doesn't detect any disks even after installing the virtio-scsi driver. Tested same config on debian and freebsd, both see the disk fine so I'm not sure where it went wrong.
Comment 6 commit-hook freebsd_committer freebsd_triage 2022-01-31 18:48:05 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=b4cc5d63b6112746598d21413c9800a43171da52

commit b4cc5d63b6112746598d21413c9800a43171da52
Author:     Robert Wing <rew@FreeBSD.org>
AuthorDate: 2022-01-31 18:44:47 +0000
Commit:     Robert Wing <rew@FreeBSD.org>
CommitDate: 2022-01-31 18:44:47 +0000

    bhyve/virtio: use correct device id for virtio-scsi

    Section 4.1.2.1 of the virtio spec states that the transitional PCI
    device id for a scsi device is 0x1004.

    Fix suggested by reporter.

    PR:             259961
    Reported by:    me@nanaya.pro
    Reviewed by:    imp, jhb
    Fixes:  f9c005a17f4e ("Add bhyve virtio-scsi storage backend support.")
    Differential Revision:  https://reviews.freebsd.org/D34103

 usr.sbin/bhyve/virtio.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Comment 7 commit-hook freebsd_committer freebsd_triage 2022-02-10 19:46:53 UTC
A commit in branch stable/13 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=cd6bdac0818a44f4faceddc485e314855c0b3f11

commit cd6bdac0818a44f4faceddc485e314855c0b3f11
Author:     Robert Wing <rew@FreeBSD.org>
AuthorDate: 2022-01-31 18:44:47 +0000
Commit:     Robert Wing <rew@FreeBSD.org>
CommitDate: 2022-02-10 19:45:56 +0000

    bhyve/virtio: use correct device id for virtio-scsi

    Section 4.1.2.1 of the virtio spec states that the transitional PCI
    device id for a scsi device is 0x1004.

    Fix suggested by reporter.

    PR:             259961
    Reported by:    me@nanaya.pro
    Reviewed by:    imp, jhb
    Fixes:  f9c005a17f4e ("Add bhyve virtio-scsi storage backend support.")
    Differential Revision:  https://reviews.freebsd.org/D34103

    (cherry picked from commit b4cc5d63b6112746598d21413c9800a43171da52)

 usr.sbin/bhyve/virtio.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
Comment 8 Robert Wing freebsd_committer freebsd_triage 2022-02-10 19:50:05 UTC
The Windows issue of not detecting any disks after the virtio-scsi driver is installed sounds like a separate problem.

I'm closing this bug report as fixed.