On Thu, Nov 04, 2021 at 08:09:16PM +0100, Jan Klemkow wrote:
> On Thu, Nov 04, 2021 at 10:43:46AM -0400, Dave Voutila wrote:
> > Jan Klemkow <j.klem...@wemelug.de> writes:
> > > This fix [1] in seabios breaks our "boot device cdrom" feature.
> > >
> > > # vmctl start -Lc -d disk.img -r cd70.iso -B cdrom vm
> > > ...
> > > No bootable device.  Retrying in 60 seconds.
> > >
> > > # vmctl start -Lc -d disk.img -r cd70.iso vm
> > > doas vmctl start -c -r cd70.iso vm
> > > ...
> > > CD-ROM: E0
> > > Loading /7.0/AMD64/CDBOOT
> > > probing: pc0 com0 mem[638K 510M a20=on]
> > > disk: cd0
> > >>> OpenBSD/amd64 CDBOOT 3.53
> > > boot>
> > >
> > > The diff below, fixes the lun number of the bootorder string for cdrom.
> > >
> > > OK?
> >
> > This change definitely fixes -B cdrom, but -B disk seems broken as well.
> >
> > ok dv to fix the -B cdrom issue, but do you also have an idea how to fix
> > the -B disk option?
>
> The diff below, fixes the -B disk option. BUT...
>
> The bootorder for disk and cdrom are hard coded strings for a runtime
> dynamic PCI bus.  The current disk bootorder string just works, if there
> is no network device configured.  With the diff below, it will work, if
> there is just one network device.  The current cdrom bootorder string
> just works, with one network and one disk device, or with no network and
> two disk devices.
>
> One example of vmd(8)'s PCI bus:
>
> PCI: init bdf=00:00.0 id=0b5d:0666    /* VMM Host */
> PCI: init bdf=00:01.0 id=1af4:1005    /* Virtio RNG */
> PCI: init bdf=00:02.0 id=1af4:1000    /* Virtio Network */
> PCI: init bdf=00:03.0 id=1af4:1001    /* Virtio Storage (disk) */
> PCI: init bdf=00:04.0 id=1af4:1004    /* Virtio SCSI (cdrom) */
> PCI: init bdf=00:05.0 id=0b5d:0777    /* VMM Control */
>
> We should assemble dynamic bootorder strings, which fits to our dynamic
> assembled PCI bus.  This would be a general solution for this problem.
>
> For now, this diff will fix the -B disk option for the most common case
> of one NIC.  Which fits to the cdrom bootorder string for one NIC, one
> disk and a cdrom.
>
> OK?
>
> bye,
> Jan
>
> Index: fw_cfg.c
> ===================================================================
> RCS file: /cvs/src/usr.sbin/vmd/fw_cfg.c,v
> retrieving revision 1.4
> diff -u -p -r1.4 fw_cfg.c
> --- fw_cfg.c  4 Nov 2021 17:50:05 -0000       1.4
> +++ fw_cfg.c  4 Nov 2021 18:48:48 -0000
> @@ -77,7 +77,7 @@ fw_cfg_init(struct vmop_create_params *v
>
>       switch (vmc->vmc_bootdevice) {
>       case VMBOOTDEV_DISK:
> -             bootorder = "/pci@i0cf8/*@2\nHALT";
> +             bootorder = "/pci@i0cf8/*@3\nHALT";
>               break;
>       case VMBOOTDEV_CDROM:
>               bootorder = "/pci@i0cf8/*@4/*@0/*@0,40000100\nHALT";
>

Thanks. ok mlarkin@

And I do agree that we probably need dynamic bootorder strings.

-ml

Reply via email to