NetBSD-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

port-xen/59350: PVHVM kernel cannot access cd unless vdev=hdc



>Number:         59350
>Category:       port-xen
>Synopsis:       PVHVM kernel cannot access cd unless vdev=hdc
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    port-xen-maintainer
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Apr 24 08:20:00 +0000 2025
>Originator:     Stephen Borrill
>Release:        10.1_STABLE
>Organization:
Precedence Technologies Ltd
>Environment:
NetBSD  10.1_STABLE NetBSD 10.1_STABLE (GENERIC) #0: Sun Apr 20 09:06:24 UTC 2025  mkrepro%mkrepro.NetBSD.org@localhost:/usr/src/sys/arch/amd64/compile/GENERIC amd64


>Description:
When specifying a block device for a domU, a guest device mapping needs to be specified. This is ignored in PV mode, but not in PVHVM mode. In the example below, a file-backed disk is device hda (old format configuration) and an ISO image is presented as a CDROM with device hdc (new key/value configuration):

disk =  [ 'file:/usr/pkg/etc/xen/disks/nbpv,hda,w',
        'format=raw, devtype=cdrom, access=ro, vdev=hdc, target=/usr/pkg/etc/xen/iso/boot.iso' ]

The disk is presented as a PV xbd device, the CD device is presented as an emulated CD drive. The CD device must be hdc in the configuration. If set to hdc it will appear as:

wdc1 at isa0 port 0x170-0x177 irq 15
atabus0 at wdc1 channel 0
atapibus0 at atabus0: 2 targets
cd0 at atapibus0 drive 0:  cdrom removable
cd0: drive supports PIO mode 4, DMA mode 2, Ultra-DMA mode 5 (Ultra/100)

If the CD device is hdb (or hdd) it will be mis-detected as a hard-disk and so the CD will not be usable:

wdc0 at isa0 port 0x1f0-0x1f7 irq 14
atabus0 at wdc0 channel 0
wd0 at atabus0 drive 0
wd0: 
wd0: drive supports 1-sector PIO transfers, chs addressing
wd0: 69632 KB, 1024 cyl, 8 head, 17 sec, 512 bytes/sect x 139264 sectors

The same problem also affects NetBSD HVM domUs on XenServer or XCP-ng as by default the emulated CD device is xvdd (the equivalent of hdd). It is therefore not possible to install NetBSD from CD on XenServer without manual changes.
>How-To-Repeat:
1) Download a NetBSD ISO image to /root.
2) Create a domU configuration called nbhvm as follows:

name = "nbhvm"
type="hvm"
memory = 1024
vif = [ 'type=ioemu,bridge=bridge0' ]
disk = [ 'format=raw, devtype=cdrom, access=ro, vdev=hdc, target=/root/NetBSD-10.1_STABLE-amd64.iso' ]
boot = d

3) xl create nbhvm
4) Connect to 127.0.0.1:0 with a VNC viewer
5) Note that boot was successful
6) xl destroy hbhvm
7) Alter domU configuration so that vdev=hdb
8) xl create nbhvm
9) Connect to 127.0.0.1:0 with a VNC viewer
10) Note that boot was not successful as the emulated CD drive was not available to the kernel

>Fix:
Ensure you always use hdc if using a NetBSD dom0.

If using XenServer/XCP-ng, determine the vbd used for the emulated CD device for the VM and alter userdevice to 2 (will be 3 by default):

[root@xenserver1 ~]# xe vm-list name-label="NetBSD 10" --minimal
30126d92-842a-ce8b-2939-c58f174d727f
[root@xenserver1 ~]# xe vm-param-set uuid=30126d92-842a-ce8b-2939-c58f174d727f platform:viridian=false
[root@xenserver1 ~]# xe vbd-list vm-uuid=30126d92-842a-ce8b-2939-c58f174d727f type=CD --minimal
515192ef-9019-e3d2-1322-48d51abfb080
[root@xenserver1 ~]# xe vbd-param-set uuid=515192ef-9019-e3d2-1322-48d51abfb080 userdevice=2



Home | Main Index | Thread Index | Old Index