Update vmm-firmware port

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|

Update vmm-firmware port

Claudio Jeker
I started looking at supporting fw_cfg in vmd. Now to make this work with
SeaBIOS there are a few fixes needed. First of all the way it reads the
FW_CFG_DATA port is not supported by vmm(4) (problem whith 'rep insb' on
IO ports). Additionally this cleans up some of the patches which I think
are not needed if the setting of screen-and-debug is changed. At least I
no longer see double printing of messages.
I enabled CONFIG_BOOTORDER because this is what I would like to tweak.
The CONFIG_DEBUG_LEVEL can be taken out before commit but it helped me
debugging this. Once vmd uses fw_cfg more of the patches can be removed.

--
:wq Claudio

Index: Makefile
===================================================================
RCS file: /cvs/ports/sysutils/firmware/vmm/Makefile,v
retrieving revision 1.15
diff -u -p -r1.15 Makefile
--- Makefile 21 Nov 2018 00:26:05 -0000 1.15
+++ Makefile 9 Dec 2018 11:09:05 -0000
@@ -13,7 +13,7 @@ CC = /usr/bin/gcc
 FW_DRIVER= vmm
 FW_VER= 1.11.0
 SB_VER= 20100422
-REVISION= 0
+REVISION= 1
 DISTNAME= seabios-${FW_VER}
 DISTFILES= ${DISTNAME}${EXTRACT_SUFX} \
  sgabios-20100422{23d474943dcd55d0550a3d20b3d30e9040a4f15b}.tar.gz:0
Index: files/config
===================================================================
RCS file: /cvs/ports/sysutils/firmware/vmm/files/config,v
retrieving revision 1.6
diff -u -p -r1.6 config
--- files/config 11 Jul 2018 09:09:46 -0000 1.6
+++ files/config 7 Dec 2018 20:34:05 -0000
@@ -15,7 +15,7 @@ CONFIG_QEMU_HARDWARE=y
 # CONFIG_THREADS is not set
 # CONFIG_RELOCATE_INIT is not set
 # CONFIG_BOOTMENU is not set
-# CONFIG_BOOTORDER is not set
+CONFIG_BOOTORDER=y
 # CONFIG_ENTRY_EXTRASTACK is not set
 CONFIG_MALLOC_UPPERMEMORY=y
 CONFIG_ROM_SIZE=0
@@ -92,7 +92,7 @@ CONFIG_VGA_EXTRA_STACK_SIZE=512
 #
 # Debugging
 #
-CONFIG_DEBUG_LEVEL=-1
+CONFIG_DEBUG_LEVEL=1
 CONFIG_DEBUG_SERIAL=y
 CONFIG_DEBUG_SERIAL_PORT=0x3f8
 CONFIG_DEBUG_IO=n
Index: patches/patch-src_boot_c
===================================================================
RCS file: patches/patch-src_boot_c
diff -N patches/patch-src_boot_c
--- patches/patch-src_boot_c 11 Jul 2018 09:09:46 -0000 1.1
+++ /dev/null 1 Jan 1970 00:00:00 -0000
@@ -1,43 +0,0 @@
---- src/boot.c.orig Tue Jul 10 14:52:11 2018
-+++ src/boot.c Tue Jul 10 14:53:18 2018
-@@ -659,7 +659,7 @@ boot_cdrom(struct drive_s *drive)
- {
-     if (! CONFIG_CDROM_BOOT)
-         return;
--    printf("Booting from DVD/CD...\n");
-+    dprintf(1, "Booting from DVD/CD...\n");
-
-     int status = cdrom_boot(drive);
-     if (status) {
-@@ -685,7 +685,7 @@ boot_cbfs(struct cbfs_file *file)
- {
-     if (!CONFIG_COREBOOT_FLASH)
-         return;
--    printf("Booting from CBFS...\n");
-+    dprintf(1, "Booting from CBFS...\n");
-     cbfs_run_payload(file);
- }
-
-@@ -693,7 +693,7 @@ boot_cbfs(struct cbfs_file *file)
- static void
- boot_rom(u32 vector)
- {
--    printf("Booting from ROM...\n");
-+    dprintf(1, "Booting from ROM...\n");
-     struct segoff_s so;
-     so.segoff = vector;
-     call_boot_entry(so, 0);
-@@ -733,11 +733,11 @@ do_boot(int seq_nr)
-     struct bev_s *ie = &BEV[seq_nr];
-     switch (ie->type) {
-     case IPL_TYPE_FLOPPY:
--        printf("Booting from Floppy...\n");
-+        dprintf(1, "Booting from Floppy...\n");
-         boot_disk(0x00, CheckFloppySig);
-         break;
-     case IPL_TYPE_HARDDISK:
--        printf("Booting from Hard Disk...\n");
-+        dprintf(1, "Booting from Hard Disk...\n");
-         boot_disk(0x80, 1);
-         break;
-     case IPL_TYPE_CDROM:
Index: patches/patch-src_fw_paravirt_c
===================================================================
RCS file: /cvs/ports/sysutils/firmware/vmm/patches/patch-src_fw_paravirt_c,v
retrieving revision 1.2
diff -u -p -r1.2 patch-src_fw_paravirt_c
--- patches/patch-src_fw_paravirt_c 26 Apr 2018 12:23:32 -0000 1.2
+++ patches/patch-src_fw_paravirt_c 9 Dec 2018 10:55:37 -0000
@@ -1,18 +1,27 @@
 $OpenBSD: patch-src_fw_paravirt_c,v 1.2 2018/04/26 12:23:32 sthen Exp $
 
+Don't use 'rep insb' to read IO ports, vmm does not support that yet.
 Allow detection of >4GB RAM. Normally seabios only allows this with the
 qemu config device which VMM doesn't have.
 
 Index: src/fw/paravirt.c
 --- src/fw/paravirt.c.orig
 +++ src/fw/paravirt.c
-@@ -500,6 +500,18 @@ qemu_cfg_e820(void)
-     dprintf(1, "RamSizeOver4G: 0x%016llx [cmos]\n", RamSizeOver4G);
+@@ -257,7 +257,9 @@ qemu_cfg_read(void *buf, int len)
+     if (qemu_cfg_dma_enabled()) {
+         qemu_cfg_dma_transfer(buf, len, QEMU_CFG_DMA_CTL_READ);
+     } else {
+-        insb(PORT_QEMU_CFG_DATA, buf, len);
++ u8 *d = buf;
++ while (len-- > 0)
++ *d++ = inb(PORT_QEMU_CFG_DATA);
+     }
  }
 
-+void
-+vmm_check_high_mem(void)
-+{
+@@ -491,6 +493,18 @@ qemu_cfg_e820(void)
+         e820_add(0xfffbc000, 4*4096, E820_RESERVED);
+     }
+
 +    // Check for memory over 4Gig in cmos
 +    u64 high = ((rtc_read(CMOS_MEM_HIGHMEM_LOW) << 16)
 +                | ((u32)rtc_read(CMOS_MEM_HIGHMEM_MID) << 24)
@@ -22,6 +31,9 @@ Index: src/fw/paravirt.c
 +    dprintf(1, "RamSizeOver4G: 0x%016llx [cmos]\n", RamSizeOver4G);
 +}
 +
- // Populate romfile entries for legacy fw_cfg ports (that predate the
- // "file" interface).
- static void
++void
++vmm_check_high_mem(void)
++{
+     // Check for memory over 4Gig in cmos
+     u64 high = ((rtc_read(CMOS_MEM_HIGHMEM_LOW) << 16)
+                 | ((u32)rtc_read(CMOS_MEM_HIGHMEM_MID) << 24)
Index: patches/patch-src_optionroms_c
===================================================================
RCS file: /cvs/ports/sysutils/firmware/vmm/patches/patch-src_optionroms_c,v
retrieving revision 1.2
diff -u -p -r1.2 patch-src_optionroms_c
--- patches/patch-src_optionroms_c 19 Jul 2017 19:33:51 -0000 1.2
+++ patches/patch-src_optionroms_c 9 Dec 2018 10:45:01 -0000
@@ -2,9 +2,11 @@ $OpenBSD: patch-src_optionroms_c,v 1.2 2
 
 Needed for SGABIOS option ROM for VMM. Normally these are setup based on
 the qemu fw_cfg interface (or coreboot CBFS on hardware).
+Turn of screen-and-debug to prevent double printing of chars.
 
---- src/optionroms.c.orig Fri Mar 31 09:34:40 2017
-+++ src/optionroms.c Fri Mar 31 09:35:35 2017
+Index: src/optionroms.c
+--- src/optionroms.c.orig
++++ src/optionroms.c
 @@ -361,7 +361,7 @@ optionrom_setup(void)
 
      // All option roms found and deployed - now build BEV/BCV vectors.
@@ -14,3 +16,12 @@ the qemu fw_cfg interface (or coreboot C
      while (pos < rom_get_last()) {
          struct rom_header *rom = (void*)pos;
          if (! is_valid_rom(rom)) {
+@@ -413,7 +413,7 @@ vgarom_setup(void)
+     EnforceChecksum = romfile_loadint("etc/optionroms-checksum", 1);
+     S3ResumeVga = romfile_loadint("etc/s3-resume-vga-init", CONFIG_QEMU);
+     RunPCIroms = romfile_loadint("etc/pci-optionrom-exec", 2);
+-    ScreenAndDebug = romfile_loadint("etc/screen-and-debug", 1);
++    ScreenAndDebug = romfile_loadint("etc/screen-and-debug", 0);
+
+     // Clear option rom memory
+     memset((void*)BUILD_ROM_START, 0, rom_get_max() - BUILD_ROM_START);

Reply | Threaded
Open this post in threaded view
|

Re: Update vmm-firmware port

Reyk Floeter-2
Hi,

I don’t understand - does this turn on more of these annoying debug messages like “Boot from” by default again?

Reyk

> Am 09.12.2018 um 12:19 schrieb Claudio Jeker <[hidden email]>:
>
> I started looking at supporting fw_cfg in vmd. Now to make this work with
> SeaBIOS there are a few fixes needed. First of all the way it reads the
> FW_CFG_DATA port is not supported by vmm(4) (problem whith 'rep insb' on
> IO ports). Additionally this cleans up some of the patches which I think
> are not needed if the setting of screen-and-debug is changed. At least I
> no longer see double printing of messages.
> I enabled CONFIG_BOOTORDER because this is what I would like to tweak.
> The CONFIG_DEBUG_LEVEL can be taken out before commit but it helped me
> debugging this. Once vmd uses fw_cfg more of the patches can be removed.
>
> --
> :wq Claudio
>
> Index: Makefile
> ===================================================================
> RCS file: /cvs/ports/sysutils/firmware/vmm/Makefile,v
> retrieving revision 1.15
> diff -u -p -r1.15 Makefile
> --- Makefile    21 Nov 2018 00:26:05 -0000    1.15
> +++ Makefile    9 Dec 2018 11:09:05 -0000
> @@ -13,7 +13,7 @@ CC =        /usr/bin/gcc
> FW_DRIVER=    vmm
> FW_VER=        1.11.0
> SB_VER=        20100422
> -REVISION=    0
> +REVISION=    1
> DISTNAME=    seabios-${FW_VER}
> DISTFILES=    ${DISTNAME}${EXTRACT_SUFX} \
>    sgabios-20100422{23d474943dcd55d0550a3d20b3d30e9040a4f15b}.tar.gz:0
> Index: files/config
> ===================================================================
> RCS file: /cvs/ports/sysutils/firmware/vmm/files/config,v
> retrieving revision 1.6
> diff -u -p -r1.6 config
> --- files/config    11 Jul 2018 09:09:46 -0000    1.6
> +++ files/config    7 Dec 2018 20:34:05 -0000
> @@ -15,7 +15,7 @@ CONFIG_QEMU_HARDWARE=y
> # CONFIG_THREADS is not set
> # CONFIG_RELOCATE_INIT is not set
> # CONFIG_BOOTMENU is not set
> -# CONFIG_BOOTORDER is not set
> +CONFIG_BOOTORDER=y
> # CONFIG_ENTRY_EXTRASTACK is not set
> CONFIG_MALLOC_UPPERMEMORY=y
> CONFIG_ROM_SIZE=0
> @@ -92,7 +92,7 @@ CONFIG_VGA_EXTRA_STACK_SIZE=512
> #
> # Debugging
> #
> -CONFIG_DEBUG_LEVEL=-1
> +CONFIG_DEBUG_LEVEL=1
> CONFIG_DEBUG_SERIAL=y
> CONFIG_DEBUG_SERIAL_PORT=0x3f8
> CONFIG_DEBUG_IO=n
> Index: patches/patch-src_boot_c
> ===================================================================
> RCS file: patches/patch-src_boot_c
> diff -N patches/patch-src_boot_c
> --- patches/patch-src_boot_c    11 Jul 2018 09:09:46 -0000    1.1
> +++ /dev/null    1 Jan 1970 00:00:00 -0000
> @@ -1,43 +0,0 @@
> ---- src/boot.c.orig    Tue Jul 10 14:52:11 2018
> -+++ src/boot.c    Tue Jul 10 14:53:18 2018
> -@@ -659,7 +659,7 @@ boot_cdrom(struct drive_s *drive)
> - {
> -     if (! CONFIG_CDROM_BOOT)
> -         return;
> --    printf("Booting from DVD/CD...\n");
> -+    dprintf(1, "Booting from DVD/CD...\n");
> -
> -     int status = cdrom_boot(drive);
> -     if (status) {
> -@@ -685,7 +685,7 @@ boot_cbfs(struct cbfs_file *file)
> - {
> -     if (!CONFIG_COREBOOT_FLASH)
> -         return;
> --    printf("Booting from CBFS...\n");
> -+    dprintf(1, "Booting from CBFS...\n");
> -     cbfs_run_payload(file);
> - }
> -
> -@@ -693,7 +693,7 @@ boot_cbfs(struct cbfs_file *file)
> - static void
> - boot_rom(u32 vector)
> - {
> --    printf("Booting from ROM...\n");
> -+    dprintf(1, "Booting from ROM...\n");
> -     struct segoff_s so;
> -     so.segoff = vector;
> -     call_boot_entry(so, 0);
> -@@ -733,11 +733,11 @@ do_boot(int seq_nr)
> -     struct bev_s *ie = &BEV[seq_nr];
> -     switch (ie->type) {
> -     case IPL_TYPE_FLOPPY:
> --        printf("Booting from Floppy...\n");
> -+        dprintf(1, "Booting from Floppy...\n");
> -         boot_disk(0x00, CheckFloppySig);
> -         break;
> -     case IPL_TYPE_HARDDISK:
> --        printf("Booting from Hard Disk...\n");
> -+        dprintf(1, "Booting from Hard Disk...\n");
> -         boot_disk(0x80, 1);
> -         break;
> -     case IPL_TYPE_CDROM:
> Index: patches/patch-src_fw_paravirt_c
> ===================================================================
> RCS file: /cvs/ports/sysutils/firmware/vmm/patches/patch-src_fw_paravirt_c,v
> retrieving revision 1.2
> diff -u -p -r1.2 patch-src_fw_paravirt_c
> --- patches/patch-src_fw_paravirt_c    26 Apr 2018 12:23:32 -0000    1.2
> +++ patches/patch-src_fw_paravirt_c    9 Dec 2018 10:55:37 -0000
> @@ -1,18 +1,27 @@
> $OpenBSD: patch-src_fw_paravirt_c,v 1.2 2018/04/26 12:23:32 sthen Exp $
>
> +Don't use 'rep insb' to read IO ports, vmm does not support that yet.
> Allow detection of >4GB RAM. Normally seabios only allows this with the
> qemu config device which VMM doesn't have.
>
> Index: src/fw/paravirt.c
> --- src/fw/paravirt.c.orig
> +++ src/fw/paravirt.c
> -@@ -500,6 +500,18 @@ qemu_cfg_e820(void)
> -     dprintf(1, "RamSizeOver4G: 0x%016llx [cmos]\n", RamSizeOver4G);
> +@@ -257,7 +257,9 @@ qemu_cfg_read(void *buf, int len)
> +     if (qemu_cfg_dma_enabled()) {
> +         qemu_cfg_dma_transfer(buf, len, QEMU_CFG_DMA_CTL_READ);
> +     } else {
> +-        insb(PORT_QEMU_CFG_DATA, buf, len);
> ++    u8 *d = buf;
> ++    while (len-- > 0)
> ++        *d++ = inb(PORT_QEMU_CFG_DATA);
> +     }
>  }
>
> -+void
> -+vmm_check_high_mem(void)
> -+{
> +@@ -491,6 +493,18 @@ qemu_cfg_e820(void)
> +         e820_add(0xfffbc000, 4*4096, E820_RESERVED);
> +     }
> +
> +    // Check for memory over 4Gig in cmos
> +    u64 high = ((rtc_read(CMOS_MEM_HIGHMEM_LOW) << 16)
> +                | ((u32)rtc_read(CMOS_MEM_HIGHMEM_MID) << 24)
> @@ -22,6 +31,9 @@ Index: src/fw/paravirt.c
> +    dprintf(1, "RamSizeOver4G: 0x%016llx [cmos]\n", RamSizeOver4G);
> +}
> +
> - // Populate romfile entries for legacy fw_cfg ports (that predate the
> - // "file" interface).
> - static void
> ++void
> ++vmm_check_high_mem(void)
> ++{
> +     // Check for memory over 4Gig in cmos
> +     u64 high = ((rtc_read(CMOS_MEM_HIGHMEM_LOW) << 16)
> +                 | ((u32)rtc_read(CMOS_MEM_HIGHMEM_MID) << 24)
> Index: patches/patch-src_optionroms_c
> ===================================================================
> RCS file: /cvs/ports/sysutils/firmware/vmm/patches/patch-src_optionroms_c,v
> retrieving revision 1.2
> diff -u -p -r1.2 patch-src_optionroms_c
> --- patches/patch-src_optionroms_c    19 Jul 2017 19:33:51 -0000    1.2
> +++ patches/patch-src_optionroms_c    9 Dec 2018 10:45:01 -0000
> @@ -2,9 +2,11 @@ $OpenBSD: patch-src_optionroms_c,v 1.2 2
>
> Needed for SGABIOS option ROM for VMM. Normally these are setup based on
> the qemu fw_cfg interface (or coreboot CBFS on hardware).
> +Turn of screen-and-debug to prevent double printing of chars.
>
> ---- src/optionroms.c.orig    Fri Mar 31 09:34:40 2017
> -+++ src/optionroms.c    Fri Mar 31 09:35:35 2017
> +Index: src/optionroms.c
> +--- src/optionroms.c.orig
> ++++ src/optionroms.c
> @@ -361,7 +361,7 @@ optionrom_setup(void)
>
>      // All option roms found and deployed - now build BEV/BCV vectors.
> @@ -14,3 +16,12 @@ the qemu fw_cfg interface (or coreboot C
>      while (pos < rom_get_last()) {
>          struct rom_header *rom = (void*)pos;
>          if (! is_valid_rom(rom)) {
> +@@ -413,7 +413,7 @@ vgarom_setup(void)
> +     EnforceChecksum = romfile_loadint("etc/optionroms-checksum", 1);
> +     S3ResumeVga = romfile_loadint("etc/s3-resume-vga-init", CONFIG_QEMU);
> +     RunPCIroms = romfile_loadint("etc/pci-optionrom-exec", 2);
> +-    ScreenAndDebug = romfile_loadint("etc/screen-and-debug", 1);
> ++    ScreenAndDebug = romfile_loadint("etc/screen-and-debug", 0);
> +
> +     // Clear option rom memory
> +     memset((void*)BUILD_ROM_START, 0, rom_get_max() - BUILD_ROM_START);
>

Reply | Threaded
Open this post in threaded view
|

Re: Update vmm-firmware port

Claudio Jeker
On Sun, Dec 09, 2018 at 01:44:07PM +0100, Reyk Floeter wrote:
> Hi,
>
> I don’t understand - does this turn on more of these annoying debug
> messages like “Boot from” by default again?
>

If CONFIG_DEBUG_LEVEL is kept at -1 then the output will be:

Connected to /dev/ttypi (speed 115200)
Booting from Hard Disk...
Using drive 0, partition 3.
Loading......
probing: pc0 com0 mem[638K 510M a20=on]
disk: hd0+
>> OpenBSD/amd64 BOOT 3.41
-
com0: 115200 baud
switching console to com0
>> OpenBSD/amd64 BOOT 3.41
boot>

Since I plan to add bootorder support I think it is a useful message:

Connected to /dev/ttypi (speed 115200)
Booting from DVD/CD...
CD-ROM: E0
Loading /6.4/AMD64/CDBOOT
probing: pc0 com0 mem[638K 510M a20=on]
disk: hd0+ cd0
>> OpenBSD/amd64 CDBOOT 3.40
boot>

Makes it easier to know what SeaBIOS selected to boot from.
But honestly if this is the bikeshed to work on then I can readd the
boot.c diff since honestly that is absolutly unimportant.

> Reyk
>
> > Am 09.12.2018 um 12:19 schrieb Claudio Jeker <[hidden email]>:
> >
> > I started looking at supporting fw_cfg in vmd. Now to make this work with
> > SeaBIOS there are a few fixes needed. First of all the way it reads the
> > FW_CFG_DATA port is not supported by vmm(4) (problem whith 'rep insb' on
> > IO ports). Additionally this cleans up some of the patches which I think
> > are not needed if the setting of screen-and-debug is changed. At least I
> > no longer see double printing of messages.
> > I enabled CONFIG_BOOTORDER because this is what I would like to tweak.
> > The CONFIG_DEBUG_LEVEL can be taken out before commit but it helped me
> > debugging this. Once vmd uses fw_cfg more of the patches can be removed.
> >
> > --
> > :wq Claudio
> >
> > Index: Makefile
> > ===================================================================
> > RCS file: /cvs/ports/sysutils/firmware/vmm/Makefile,v
> > retrieving revision 1.15
> > diff -u -p -r1.15 Makefile
> > --- Makefile    21 Nov 2018 00:26:05 -0000    1.15
> > +++ Makefile    9 Dec 2018 11:09:05 -0000
> > @@ -13,7 +13,7 @@ CC =        /usr/bin/gcc
> > FW_DRIVER=    vmm
> > FW_VER=        1.11.0
> > SB_VER=        20100422
> > -REVISION=    0
> > +REVISION=    1
> > DISTNAME=    seabios-${FW_VER}
> > DISTFILES=    ${DISTNAME}${EXTRACT_SUFX} \
> >    sgabios-20100422{23d474943dcd55d0550a3d20b3d30e9040a4f15b}.tar.gz:0
> > Index: files/config
> > ===================================================================
> > RCS file: /cvs/ports/sysutils/firmware/vmm/files/config,v
> > retrieving revision 1.6
> > diff -u -p -r1.6 config
> > --- files/config    11 Jul 2018 09:09:46 -0000    1.6
> > +++ files/config    7 Dec 2018 20:34:05 -0000
> > @@ -15,7 +15,7 @@ CONFIG_QEMU_HARDWARE=y
> > # CONFIG_THREADS is not set
> > # CONFIG_RELOCATE_INIT is not set
> > # CONFIG_BOOTMENU is not set
> > -# CONFIG_BOOTORDER is not set
> > +CONFIG_BOOTORDER=y
> > # CONFIG_ENTRY_EXTRASTACK is not set
> > CONFIG_MALLOC_UPPERMEMORY=y
> > CONFIG_ROM_SIZE=0
> > @@ -92,7 +92,7 @@ CONFIG_VGA_EXTRA_STACK_SIZE=512
> > #
> > # Debugging
> > #
> > -CONFIG_DEBUG_LEVEL=-1
> > +CONFIG_DEBUG_LEVEL=1
> > CONFIG_DEBUG_SERIAL=y
> > CONFIG_DEBUG_SERIAL_PORT=0x3f8
> > CONFIG_DEBUG_IO=n
> > Index: patches/patch-src_boot_c
> > ===================================================================
> > RCS file: patches/patch-src_boot_c
> > diff -N patches/patch-src_boot_c
> > --- patches/patch-src_boot_c    11 Jul 2018 09:09:46 -0000    1.1
> > +++ /dev/null    1 Jan 1970 00:00:00 -0000
> > @@ -1,43 +0,0 @@
> > ---- src/boot.c.orig    Tue Jul 10 14:52:11 2018
> > -+++ src/boot.c    Tue Jul 10 14:53:18 2018
> > -@@ -659,7 +659,7 @@ boot_cdrom(struct drive_s *drive)
> > - {
> > -     if (! CONFIG_CDROM_BOOT)
> > -         return;
> > --    printf("Booting from DVD/CD...\n");
> > -+    dprintf(1, "Booting from DVD/CD...\n");
> > -
> > -     int status = cdrom_boot(drive);
> > -     if (status) {
> > -@@ -685,7 +685,7 @@ boot_cbfs(struct cbfs_file *file)
> > - {
> > -     if (!CONFIG_COREBOOT_FLASH)
> > -         return;
> > --    printf("Booting from CBFS...\n");
> > -+    dprintf(1, "Booting from CBFS...\n");
> > -     cbfs_run_payload(file);
> > - }
> > -
> > -@@ -693,7 +693,7 @@ boot_cbfs(struct cbfs_file *file)
> > - static void
> > - boot_rom(u32 vector)
> > - {
> > --    printf("Booting from ROM...\n");
> > -+    dprintf(1, "Booting from ROM...\n");
> > -     struct segoff_s so;
> > -     so.segoff = vector;
> > -     call_boot_entry(so, 0);
> > -@@ -733,11 +733,11 @@ do_boot(int seq_nr)
> > -     struct bev_s *ie = &BEV[seq_nr];
> > -     switch (ie->type) {
> > -     case IPL_TYPE_FLOPPY:
> > --        printf("Booting from Floppy...\n");
> > -+        dprintf(1, "Booting from Floppy...\n");
> > -         boot_disk(0x00, CheckFloppySig);
> > -         break;
> > -     case IPL_TYPE_HARDDISK:
> > --        printf("Booting from Hard Disk...\n");
> > -+        dprintf(1, "Booting from Hard Disk...\n");
> > -         boot_disk(0x80, 1);
> > -         break;
> > -     case IPL_TYPE_CDROM:
> > Index: patches/patch-src_fw_paravirt_c
> > ===================================================================
> > RCS file: /cvs/ports/sysutils/firmware/vmm/patches/patch-src_fw_paravirt_c,v
> > retrieving revision 1.2
> > diff -u -p -r1.2 patch-src_fw_paravirt_c
> > --- patches/patch-src_fw_paravirt_c    26 Apr 2018 12:23:32 -0000    1.2
> > +++ patches/patch-src_fw_paravirt_c    9 Dec 2018 10:55:37 -0000
> > @@ -1,18 +1,27 @@
> > $OpenBSD: patch-src_fw_paravirt_c,v 1.2 2018/04/26 12:23:32 sthen Exp $
> >
> > +Don't use 'rep insb' to read IO ports, vmm does not support that yet.
> > Allow detection of >4GB RAM. Normally seabios only allows this with the
> > qemu config device which VMM doesn't have.
> >
> > Index: src/fw/paravirt.c
> > --- src/fw/paravirt.c.orig
> > +++ src/fw/paravirt.c
> > -@@ -500,6 +500,18 @@ qemu_cfg_e820(void)
> > -     dprintf(1, "RamSizeOver4G: 0x%016llx [cmos]\n", RamSizeOver4G);
> > +@@ -257,7 +257,9 @@ qemu_cfg_read(void *buf, int len)
> > +     if (qemu_cfg_dma_enabled()) {
> > +         qemu_cfg_dma_transfer(buf, len, QEMU_CFG_DMA_CTL_READ);
> > +     } else {
> > +-        insb(PORT_QEMU_CFG_DATA, buf, len);
> > ++    u8 *d = buf;
> > ++    while (len-- > 0)
> > ++        *d++ = inb(PORT_QEMU_CFG_DATA);
> > +     }
> >  }
> >
> > -+void
> > -+vmm_check_high_mem(void)
> > -+{
> > +@@ -491,6 +493,18 @@ qemu_cfg_e820(void)
> > +         e820_add(0xfffbc000, 4*4096, E820_RESERVED);
> > +     }
> > +
> > +    // Check for memory over 4Gig in cmos
> > +    u64 high = ((rtc_read(CMOS_MEM_HIGHMEM_LOW) << 16)
> > +                | ((u32)rtc_read(CMOS_MEM_HIGHMEM_MID) << 24)
> > @@ -22,6 +31,9 @@ Index: src/fw/paravirt.c
> > +    dprintf(1, "RamSizeOver4G: 0x%016llx [cmos]\n", RamSizeOver4G);
> > +}
> > +
> > - // Populate romfile entries for legacy fw_cfg ports (that predate the
> > - // "file" interface).
> > - static void
> > ++void
> > ++vmm_check_high_mem(void)
> > ++{
> > +     // Check for memory over 4Gig in cmos
> > +     u64 high = ((rtc_read(CMOS_MEM_HIGHMEM_LOW) << 16)
> > +                 | ((u32)rtc_read(CMOS_MEM_HIGHMEM_MID) << 24)
> > Index: patches/patch-src_optionroms_c
> > ===================================================================
> > RCS file: /cvs/ports/sysutils/firmware/vmm/patches/patch-src_optionroms_c,v
> > retrieving revision 1.2
> > diff -u -p -r1.2 patch-src_optionroms_c
> > --- patches/patch-src_optionroms_c    19 Jul 2017 19:33:51 -0000    1.2
> > +++ patches/patch-src_optionroms_c    9 Dec 2018 10:45:01 -0000
> > @@ -2,9 +2,11 @@ $OpenBSD: patch-src_optionroms_c,v 1.2 2
> >
> > Needed for SGABIOS option ROM for VMM. Normally these are setup based on
> > the qemu fw_cfg interface (or coreboot CBFS on hardware).
> > +Turn of screen-and-debug to prevent double printing of chars.
> >
> > ---- src/optionroms.c.orig    Fri Mar 31 09:34:40 2017
> > -+++ src/optionroms.c    Fri Mar 31 09:35:35 2017
> > +Index: src/optionroms.c
> > +--- src/optionroms.c.orig
> > ++++ src/optionroms.c
> > @@ -361,7 +361,7 @@ optionrom_setup(void)
> >
> >      // All option roms found and deployed - now build BEV/BCV vectors.
> > @@ -14,3 +16,12 @@ the qemu fw_cfg interface (or coreboot C
> >      while (pos < rom_get_last()) {
> >          struct rom_header *rom = (void*)pos;
> >          if (! is_valid_rom(rom)) {
> > +@@ -413,7 +413,7 @@ vgarom_setup(void)
> > +     EnforceChecksum = romfile_loadint("etc/optionroms-checksum", 1);
> > +     S3ResumeVga = romfile_loadint("etc/s3-resume-vga-init", CONFIG_QEMU);
> > +     RunPCIroms = romfile_loadint("etc/pci-optionrom-exec", 2);
> > +-    ScreenAndDebug = romfile_loadint("etc/screen-and-debug", 1);
> > ++    ScreenAndDebug = romfile_loadint("etc/screen-and-debug", 0);
> > +
> > +     // Clear option rom memory
> > +     memset((void*)BUILD_ROM_START, 0, rom_get_max() - BUILD_ROM_START);
> >
>

--
:wq Claudio

Reply | Threaded
Open this post in threaded view
|

Re: Update vmm-firmware port

Reyk Floeter-2

> Am 09.12.2018 um 14:01 schrieb Claudio Jeker <[hidden email]>:
>
>> On Sun, Dec 09, 2018 at 01:44:07PM +0100, Reyk Floeter wrote:
>> Hi,
>>
>> I don’t understand - does this turn on more of these annoying debug
>> messages like “Boot from” by default again?
>>
>
> If CONFIG_DEBUG_LEVEL is kept at -1 then the output will be:
>
> Connected to /dev/ttypi (speed 115200)
> Booting from Hard Disk...
> Using drive 0, partition 3.
> Loading......
> probing: pc0 com0 mem[638K 510M a20=on]
> disk: hd0+
>>> OpenBSD/amd64 BOOT 3.41
> -
> com0: 115200 baud
> switching console to com0
>>> OpenBSD/amd64 BOOT 3.41
> boot>
>
> Since I plan to add bootorder support I think it is a useful message:
>
> Connected to /dev/ttypi (speed 115200)
> Booting from DVD/CD...
> CD-ROM: E0
> Loading /6.4/AMD64/CDBOOT
> probing: pc0 com0 mem[638K 510M a20=on]
> disk: hd0+ cd0
>>> OpenBSD/amd64 CDBOOT 3.40
> boot>
>
> Makes it easier to know what SeaBIOS selected to boot from.
> But honestly if this is the bikeshed to work on then I can readd the
> boot.c diff since honestly that is absolutly unimportant.
>

It’s not a bikeshed since I intentionally added this diff to remove the debug messages before.

And we know from the later messages if it selected CDROM, HDD, etc. So please keep the diff that removes it.

Otherwise OK reyk@

>> Reyk
>>
>>> Am 09.12.2018 um 12:19 schrieb Claudio Jeker <[hidden email]>:
>>>
>>> I started looking at supporting fw_cfg in vmd. Now to make this work with
>>> SeaBIOS there are a few fixes needed. First of all the way it reads the
>>> FW_CFG_DATA port is not supported by vmm(4) (problem whith 'rep insb' on
>>> IO ports). Additionally this cleans up some of the patches which I think
>>> are not needed if the setting of screen-and-debug is changed. At least I
>>> no longer see double printing of messages.
>>> I enabled CONFIG_BOOTORDER because this is what I would like to tweak.
>>> The CONFIG_DEBUG_LEVEL can be taken out before commit but it helped me
>>> debugging this. Once vmd uses fw_cfg more of the patches can be removed.
>>>
>>> --
>>> :wq Claudio
>>>
>>> Index: Makefile
>>> ===================================================================
>>> RCS file: /cvs/ports/sysutils/firmware/vmm/Makefile,v
>>> retrieving revision 1.15
>>> diff -u -p -r1.15 Makefile
>>> --- Makefile    21 Nov 2018 00:26:05 -0000    1.15
>>> +++ Makefile    9 Dec 2018 11:09:05 -0000
>>> @@ -13,7 +13,7 @@ CC =        /usr/bin/gcc
>>> FW_DRIVER=    vmm
>>> FW_VER=        1.11.0
>>> SB_VER=        20100422
>>> -REVISION=    0
>>> +REVISION=    1
>>> DISTNAME=    seabios-${FW_VER}
>>> DISTFILES=    ${DISTNAME}${EXTRACT_SUFX} \
>>>   sgabios-20100422{23d474943dcd55d0550a3d20b3d30e9040a4f15b}.tar.gz:0
>>> Index: files/config
>>> ===================================================================
>>> RCS file: /cvs/ports/sysutils/firmware/vmm/files/config,v
>>> retrieving revision 1.6
>>> diff -u -p -r1.6 config
>>> --- files/config    11 Jul 2018 09:09:46 -0000    1.6
>>> +++ files/config    7 Dec 2018 20:34:05 -0000
>>> @@ -15,7 +15,7 @@ CONFIG_QEMU_HARDWARE=y
>>> # CONFIG_THREADS is not set
>>> # CONFIG_RELOCATE_INIT is not set
>>> # CONFIG_BOOTMENU is not set
>>> -# CONFIG_BOOTORDER is not set
>>> +CONFIG_BOOTORDER=y
>>> # CONFIG_ENTRY_EXTRASTACK is not set
>>> CONFIG_MALLOC_UPPERMEMORY=y
>>> CONFIG_ROM_SIZE=0
>>> @@ -92,7 +92,7 @@ CONFIG_VGA_EXTRA_STACK_SIZE=512
>>> #
>>> # Debugging
>>> #
>>> -CONFIG_DEBUG_LEVEL=-1
>>> +CONFIG_DEBUG_LEVEL=1
>>> CONFIG_DEBUG_SERIAL=y
>>> CONFIG_DEBUG_SERIAL_PORT=0x3f8
>>> CONFIG_DEBUG_IO=n
>>> Index: patches/patch-src_boot_c
>>> ===================================================================
>>> RCS file: patches/patch-src_boot_c
>>> diff -N patches/patch-src_boot_c
>>> --- patches/patch-src_boot_c    11 Jul 2018 09:09:46 -0000    1.1
>>> +++ /dev/null    1 Jan 1970 00:00:00 -0000
>>> @@ -1,43 +0,0 @@
>>> ---- src/boot.c.orig    Tue Jul 10 14:52:11 2018
>>> -+++ src/boot.c    Tue Jul 10 14:53:18 2018
>>> -@@ -659,7 +659,7 @@ boot_cdrom(struct drive_s *drive)
>>> - {
>>> -     if (! CONFIG_CDROM_BOOT)
>>> -         return;
>>> --    printf("Booting from DVD/CD...\n");
>>> -+    dprintf(1, "Booting from DVD/CD...\n");
>>> -
>>> -     int status = cdrom_boot(drive);
>>> -     if (status) {
>>> -@@ -685,7 +685,7 @@ boot_cbfs(struct cbfs_file *file)
>>> - {
>>> -     if (!CONFIG_COREBOOT_FLASH)
>>> -         return;
>>> --    printf("Booting from CBFS...\n");
>>> -+    dprintf(1, "Booting from CBFS...\n");
>>> -     cbfs_run_payload(file);
>>> - }
>>> -
>>> -@@ -693,7 +693,7 @@ boot_cbfs(struct cbfs_file *file)
>>> - static void
>>> - boot_rom(u32 vector)
>>> - {
>>> --    printf("Booting from ROM...\n");
>>> -+    dprintf(1, "Booting from ROM...\n");
>>> -     struct segoff_s so;
>>> -     so.segoff = vector;
>>> -     call_boot_entry(so, 0);
>>> -@@ -733,11 +733,11 @@ do_boot(int seq_nr)
>>> -     struct bev_s *ie = &BEV[seq_nr];
>>> -     switch (ie->type) {
>>> -     case IPL_TYPE_FLOPPY:
>>> --        printf("Booting from Floppy...\n");
>>> -+        dprintf(1, "Booting from Floppy...\n");
>>> -         boot_disk(0x00, CheckFloppySig);
>>> -         break;
>>> -     case IPL_TYPE_HARDDISK:
>>> --        printf("Booting from Hard Disk...\n");
>>> -+        dprintf(1, "Booting from Hard Disk...\n");
>>> -         boot_disk(0x80, 1);
>>> -         break;
>>> -     case IPL_TYPE_CDROM:
>>> Index: patches/patch-src_fw_paravirt_c
>>> ===================================================================
>>> RCS file: /cvs/ports/sysutils/firmware/vmm/patches/patch-src_fw_paravirt_c,v
>>> retrieving revision 1.2
>>> diff -u -p -r1.2 patch-src_fw_paravirt_c
>>> --- patches/patch-src_fw_paravirt_c    26 Apr 2018 12:23:32 -0000    1.2
>>> +++ patches/patch-src_fw_paravirt_c    9 Dec 2018 10:55:37 -0000
>>> @@ -1,18 +1,27 @@
>>> $OpenBSD: patch-src_fw_paravirt_c,v 1.2 2018/04/26 12:23:32 sthen Exp $
>>>
>>> +Don't use 'rep insb' to read IO ports, vmm does not support that yet.
>>> Allow detection of >4GB RAM. Normally seabios only allows this with the
>>> qemu config device which VMM doesn't have.
>>>
>>> Index: src/fw/paravirt.c
>>> --- src/fw/paravirt.c.orig
>>> +++ src/fw/paravirt.c
>>> -@@ -500,6 +500,18 @@ qemu_cfg_e820(void)
>>> -     dprintf(1, "RamSizeOver4G: 0x%016llx [cmos]\n", RamSizeOver4G);
>>> +@@ -257,7 +257,9 @@ qemu_cfg_read(void *buf, int len)
>>> +     if (qemu_cfg_dma_enabled()) {
>>> +         qemu_cfg_dma_transfer(buf, len, QEMU_CFG_DMA_CTL_READ);
>>> +     } else {
>>> +-        insb(PORT_QEMU_CFG_DATA, buf, len);
>>> ++    u8 *d = buf;
>>> ++    while (len-- > 0)
>>> ++        *d++ = inb(PORT_QEMU_CFG_DATA);
>>> +     }
>>> }
>>>
>>> -+void
>>> -+vmm_check_high_mem(void)
>>> -+{
>>> +@@ -491,6 +493,18 @@ qemu_cfg_e820(void)
>>> +         e820_add(0xfffbc000, 4*4096, E820_RESERVED);
>>> +     }
>>> +
>>> +    // Check for memory over 4Gig in cmos
>>> +    u64 high = ((rtc_read(CMOS_MEM_HIGHMEM_LOW) << 16)
>>> +                | ((u32)rtc_read(CMOS_MEM_HIGHMEM_MID) << 24)
>>> @@ -22,6 +31,9 @@ Index: src/fw/paravirt.c
>>> +    dprintf(1, "RamSizeOver4G: 0x%016llx [cmos]\n", RamSizeOver4G);
>>> +}
>>> +
>>> - // Populate romfile entries for legacy fw_cfg ports (that predate the
>>> - // "file" interface).
>>> - static void
>>> ++void
>>> ++vmm_check_high_mem(void)
>>> ++{
>>> +     // Check for memory over 4Gig in cmos
>>> +     u64 high = ((rtc_read(CMOS_MEM_HIGHMEM_LOW) << 16)
>>> +                 | ((u32)rtc_read(CMOS_MEM_HIGHMEM_MID) << 24)
>>> Index: patches/patch-src_optionroms_c
>>> ===================================================================
>>> RCS file: /cvs/ports/sysutils/firmware/vmm/patches/patch-src_optionroms_c,v
>>> retrieving revision 1.2
>>> diff -u -p -r1.2 patch-src_optionroms_c
>>> --- patches/patch-src_optionroms_c    19 Jul 2017 19:33:51 -0000    1.2
>>> +++ patches/patch-src_optionroms_c    9 Dec 2018 10:45:01 -0000
>>> @@ -2,9 +2,11 @@ $OpenBSD: patch-src_optionroms_c,v 1.2 2
>>>
>>> Needed for SGABIOS option ROM for VMM. Normally these are setup based on
>>> the qemu fw_cfg interface (or coreboot CBFS on hardware).
>>> +Turn of screen-and-debug to prevent double printing of chars.
>>>
>>> ---- src/optionroms.c.orig    Fri Mar 31 09:34:40 2017
>>> -+++ src/optionroms.c    Fri Mar 31 09:35:35 2017
>>> +Index: src/optionroms.c
>>> +--- src/optionroms.c.orig
>>> ++++ src/optionroms.c
>>> @@ -361,7 +361,7 @@ optionrom_setup(void)
>>>
>>>     // All option roms found and deployed - now build BEV/BCV vectors.
>>> @@ -14,3 +16,12 @@ the qemu fw_cfg interface (or coreboot C
>>>     while (pos < rom_get_last()) {
>>>         struct rom_header *rom = (void*)pos;
>>>         if (! is_valid_rom(rom)) {
>>> +@@ -413,7 +413,7 @@ vgarom_setup(void)
>>> +     EnforceChecksum = romfile_loadint("etc/optionroms-checksum", 1);
>>> +     S3ResumeVga = romfile_loadint("etc/s3-resume-vga-init", CONFIG_QEMU);
>>> +     RunPCIroms = romfile_loadint("etc/pci-optionrom-exec", 2);
>>> +-    ScreenAndDebug = romfile_loadint("etc/screen-and-debug", 1);
>>> ++    ScreenAndDebug = romfile_loadint("etc/screen-and-debug", 0);
>>> +
>>> +     // Clear option rom memory
>>> +     memset((void*)BUILD_ROM_START, 0, rom_get_max() - BUILD_ROM_START);
>>>
>>
>
> --
> :wq Claudio

Reply | Threaded
Open this post in threaded view
|

Re: Update vmm-firmware port

Mike Larkin
In reply to this post by Claudio Jeker
On Sun, Dec 09, 2018 at 12:19:46PM +0100, Claudio Jeker wrote:

> I started looking at supporting fw_cfg in vmd. Now to make this work with
> SeaBIOS there are a few fixes needed. First of all the way it reads the
> FW_CFG_DATA port is not supported by vmm(4) (problem whith 'rep insb' on
> IO ports). Additionally this cleans up some of the patches which I think
> are not needed if the setting of screen-and-debug is changed. At least I
> no longer see double printing of messages.
> I enabled CONFIG_BOOTORDER because this is what I would like to tweak.
> The CONFIG_DEBUG_LEVEL can be taken out before commit but it helped me
> debugging this. Once vmd uses fw_cfg more of the patches can be removed.
>
> --
> :wq Claudio
>

While I am not opposed to vmm-firmware updates in general, we have to be
careful a bit now since there are tons of people using all sorts of bizarre
linux distributions, which all do different things with the bios during boot.

I'd think we would need to put this out there for a long while before I'd
feel comfortable turning it on for everyone.

I did not read the diff yet but I will.

-ml

> Index: Makefile
> ===================================================================
> RCS file: /cvs/ports/sysutils/firmware/vmm/Makefile,v
> retrieving revision 1.15
> diff -u -p -r1.15 Makefile
> --- Makefile 21 Nov 2018 00:26:05 -0000 1.15
> +++ Makefile 9 Dec 2018 11:09:05 -0000
> @@ -13,7 +13,7 @@ CC = /usr/bin/gcc
>  FW_DRIVER= vmm
>  FW_VER= 1.11.0
>  SB_VER= 20100422
> -REVISION= 0
> +REVISION= 1
>  DISTNAME= seabios-${FW_VER}
>  DISTFILES= ${DISTNAME}${EXTRACT_SUFX} \
>   sgabios-20100422{23d474943dcd55d0550a3d20b3d30e9040a4f15b}.tar.gz:0
> Index: files/config
> ===================================================================
> RCS file: /cvs/ports/sysutils/firmware/vmm/files/config,v
> retrieving revision 1.6
> diff -u -p -r1.6 config
> --- files/config 11 Jul 2018 09:09:46 -0000 1.6
> +++ files/config 7 Dec 2018 20:34:05 -0000
> @@ -15,7 +15,7 @@ CONFIG_QEMU_HARDWARE=y
>  # CONFIG_THREADS is not set
>  # CONFIG_RELOCATE_INIT is not set
>  # CONFIG_BOOTMENU is not set
> -# CONFIG_BOOTORDER is not set
> +CONFIG_BOOTORDER=y
>  # CONFIG_ENTRY_EXTRASTACK is not set
>  CONFIG_MALLOC_UPPERMEMORY=y
>  CONFIG_ROM_SIZE=0
> @@ -92,7 +92,7 @@ CONFIG_VGA_EXTRA_STACK_SIZE=512
>  #
>  # Debugging
>  #
> -CONFIG_DEBUG_LEVEL=-1
> +CONFIG_DEBUG_LEVEL=1
>  CONFIG_DEBUG_SERIAL=y
>  CONFIG_DEBUG_SERIAL_PORT=0x3f8
>  CONFIG_DEBUG_IO=n
> Index: patches/patch-src_boot_c
> ===================================================================
> RCS file: patches/patch-src_boot_c
> diff -N patches/patch-src_boot_c
> --- patches/patch-src_boot_c 11 Jul 2018 09:09:46 -0000 1.1
> +++ /dev/null 1 Jan 1970 00:00:00 -0000
> @@ -1,43 +0,0 @@
> ---- src/boot.c.orig Tue Jul 10 14:52:11 2018
> -+++ src/boot.c Tue Jul 10 14:53:18 2018
> -@@ -659,7 +659,7 @@ boot_cdrom(struct drive_s *drive)
> - {
> -     if (! CONFIG_CDROM_BOOT)
> -         return;
> --    printf("Booting from DVD/CD...\n");
> -+    dprintf(1, "Booting from DVD/CD...\n");
> -
> -     int status = cdrom_boot(drive);
> -     if (status) {
> -@@ -685,7 +685,7 @@ boot_cbfs(struct cbfs_file *file)
> - {
> -     if (!CONFIG_COREBOOT_FLASH)
> -         return;
> --    printf("Booting from CBFS...\n");
> -+    dprintf(1, "Booting from CBFS...\n");
> -     cbfs_run_payload(file);
> - }
> -
> -@@ -693,7 +693,7 @@ boot_cbfs(struct cbfs_file *file)
> - static void
> - boot_rom(u32 vector)
> - {
> --    printf("Booting from ROM...\n");
> -+    dprintf(1, "Booting from ROM...\n");
> -     struct segoff_s so;
> -     so.segoff = vector;
> -     call_boot_entry(so, 0);
> -@@ -733,11 +733,11 @@ do_boot(int seq_nr)
> -     struct bev_s *ie = &BEV[seq_nr];
> -     switch (ie->type) {
> -     case IPL_TYPE_FLOPPY:
> --        printf("Booting from Floppy...\n");
> -+        dprintf(1, "Booting from Floppy...\n");
> -         boot_disk(0x00, CheckFloppySig);
> -         break;
> -     case IPL_TYPE_HARDDISK:
> --        printf("Booting from Hard Disk...\n");
> -+        dprintf(1, "Booting from Hard Disk...\n");
> -         boot_disk(0x80, 1);
> -         break;
> -     case IPL_TYPE_CDROM:
> Index: patches/patch-src_fw_paravirt_c
> ===================================================================
> RCS file: /cvs/ports/sysutils/firmware/vmm/patches/patch-src_fw_paravirt_c,v
> retrieving revision 1.2
> diff -u -p -r1.2 patch-src_fw_paravirt_c
> --- patches/patch-src_fw_paravirt_c 26 Apr 2018 12:23:32 -0000 1.2
> +++ patches/patch-src_fw_paravirt_c 9 Dec 2018 10:55:37 -0000
> @@ -1,18 +1,27 @@
>  $OpenBSD: patch-src_fw_paravirt_c,v 1.2 2018/04/26 12:23:32 sthen Exp $
>  
> +Don't use 'rep insb' to read IO ports, vmm does not support that yet.
>  Allow detection of >4GB RAM. Normally seabios only allows this with the
>  qemu config device which VMM doesn't have.
>  
>  Index: src/fw/paravirt.c
>  --- src/fw/paravirt.c.orig
>  +++ src/fw/paravirt.c
> -@@ -500,6 +500,18 @@ qemu_cfg_e820(void)
> -     dprintf(1, "RamSizeOver4G: 0x%016llx [cmos]\n", RamSizeOver4G);
> +@@ -257,7 +257,9 @@ qemu_cfg_read(void *buf, int len)
> +     if (qemu_cfg_dma_enabled()) {
> +         qemu_cfg_dma_transfer(buf, len, QEMU_CFG_DMA_CTL_READ);
> +     } else {
> +-        insb(PORT_QEMU_CFG_DATA, buf, len);
> ++ u8 *d = buf;
> ++ while (len-- > 0)
> ++ *d++ = inb(PORT_QEMU_CFG_DATA);
> +     }
>   }
>  
> -+void
> -+vmm_check_high_mem(void)
> -+{
> +@@ -491,6 +493,18 @@ qemu_cfg_e820(void)
> +         e820_add(0xfffbc000, 4*4096, E820_RESERVED);
> +     }
> +
>  +    // Check for memory over 4Gig in cmos
>  +    u64 high = ((rtc_read(CMOS_MEM_HIGHMEM_LOW) << 16)
>  +                | ((u32)rtc_read(CMOS_MEM_HIGHMEM_MID) << 24)
> @@ -22,6 +31,9 @@ Index: src/fw/paravirt.c
>  +    dprintf(1, "RamSizeOver4G: 0x%016llx [cmos]\n", RamSizeOver4G);
>  +}
>  +
> - // Populate romfile entries for legacy fw_cfg ports (that predate the
> - // "file" interface).
> - static void
> ++void
> ++vmm_check_high_mem(void)
> ++{
> +     // Check for memory over 4Gig in cmos
> +     u64 high = ((rtc_read(CMOS_MEM_HIGHMEM_LOW) << 16)
> +                 | ((u32)rtc_read(CMOS_MEM_HIGHMEM_MID) << 24)
> Index: patches/patch-src_optionroms_c
> ===================================================================
> RCS file: /cvs/ports/sysutils/firmware/vmm/patches/patch-src_optionroms_c,v
> retrieving revision 1.2
> diff -u -p -r1.2 patch-src_optionroms_c
> --- patches/patch-src_optionroms_c 19 Jul 2017 19:33:51 -0000 1.2
> +++ patches/patch-src_optionroms_c 9 Dec 2018 10:45:01 -0000
> @@ -2,9 +2,11 @@ $OpenBSD: patch-src_optionroms_c,v 1.2 2
>  
>  Needed for SGABIOS option ROM for VMM. Normally these are setup based on
>  the qemu fw_cfg interface (or coreboot CBFS on hardware).
> +Turn of screen-and-debug to prevent double printing of chars.
>  
> ---- src/optionroms.c.orig Fri Mar 31 09:34:40 2017
> -+++ src/optionroms.c Fri Mar 31 09:35:35 2017
> +Index: src/optionroms.c
> +--- src/optionroms.c.orig
> ++++ src/optionroms.c
>  @@ -361,7 +361,7 @@ optionrom_setup(void)
>  
>       // All option roms found and deployed - now build BEV/BCV vectors.
> @@ -14,3 +16,12 @@ the qemu fw_cfg interface (or coreboot C
>       while (pos < rom_get_last()) {
>           struct rom_header *rom = (void*)pos;
>           if (! is_valid_rom(rom)) {
> +@@ -413,7 +413,7 @@ vgarom_setup(void)
> +     EnforceChecksum = romfile_loadint("etc/optionroms-checksum", 1);
> +     S3ResumeVga = romfile_loadint("etc/s3-resume-vga-init", CONFIG_QEMU);
> +     RunPCIroms = romfile_loadint("etc/pci-optionrom-exec", 2);
> +-    ScreenAndDebug = romfile_loadint("etc/screen-and-debug", 1);
> ++    ScreenAndDebug = romfile_loadint("etc/screen-and-debug", 0);
> +
> +     // Clear option rom memory
> +     memset((void*)BUILD_ROM_START, 0, rom_get_max() - BUILD_ROM_START);
>

Reply | Threaded
Open this post in threaded view
|

Re: Update vmm-firmware port

Claudio Jeker
On Sun, Dec 09, 2018 at 09:32:25PM -0800, Mike Larkin wrote:

> On Sun, Dec 09, 2018 at 12:19:46PM +0100, Claudio Jeker wrote:
> > I started looking at supporting fw_cfg in vmd. Now to make this work with
> > SeaBIOS there are a few fixes needed. First of all the way it reads the
> > FW_CFG_DATA port is not supported by vmm(4) (problem whith 'rep insb' on
> > IO ports). Additionally this cleans up some of the patches which I think
> > are not needed if the setting of screen-and-debug is changed. At least I
> > no longer see double printing of messages.
> > I enabled CONFIG_BOOTORDER because this is what I would like to tweak.
> > The CONFIG_DEBUG_LEVEL can be taken out before commit but it helped me
> > debugging this. Once vmd uses fw_cfg more of the patches can be removed.
> >
> > --
> > :wq Claudio
> >
>
> While I am not opposed to vmm-firmware updates in general, we have to be
> careful a bit now since there are tons of people using all sorts of bizarre
> linux distributions, which all do different things with the bios during boot.
>
> I'd think we would need to put this out there for a long while before I'd
> feel comfortable turning it on for everyone.

I think it is the right time now to make this available as a snapshot
package so that people can start testing this the easy way. At least this
way we get a few month of full exposure before 6.5. If there are problems
with this we can still revert back.

> I did not read the diff yet but I will.

I attached an updated diff of what I plan to commit.

--
:wq Claudio

Index: Makefile
===================================================================
RCS file: /cvs/ports/sysutils/firmware/vmm/Makefile,v
retrieving revision 1.15
diff -u -p -r1.15 Makefile
--- Makefile 21 Nov 2018 00:26:05 -0000 1.15
+++ Makefile 9 Dec 2018 11:09:05 -0000
@@ -13,7 +13,7 @@ CC = /usr/bin/gcc
 FW_DRIVER= vmm
 FW_VER= 1.11.0
 SB_VER= 20100422
-REVISION= 0
+REVISION= 1
 DISTNAME= seabios-${FW_VER}
 DISTFILES= ${DISTNAME}${EXTRACT_SUFX} \
  sgabios-20100422{23d474943dcd55d0550a3d20b3d30e9040a4f15b}.tar.gz:0
Index: files/config
===================================================================
RCS file: /cvs/ports/sysutils/firmware/vmm/files/config,v
retrieving revision 1.6
diff -u -p -r1.6 config
--- files/config 11 Jul 2018 09:09:46 -0000 1.6
+++ files/config 9 Dec 2018 12:46:20 -0000
@@ -15,7 +15,7 @@ CONFIG_QEMU_HARDWARE=y
 # CONFIG_THREADS is not set
 # CONFIG_RELOCATE_INIT is not set
 # CONFIG_BOOTMENU is not set
-# CONFIG_BOOTORDER is not set
+CONFIG_BOOTORDER=y
 # CONFIG_ENTRY_EXTRASTACK is not set
 CONFIG_MALLOC_UPPERMEMORY=y
 CONFIG_ROM_SIZE=0
Index: patches/patch-src_fw_paravirt_c
===================================================================
RCS file: /cvs/ports/sysutils/firmware/vmm/patches/patch-src_fw_paravirt_c,v
retrieving revision 1.2
diff -u -p -r1.2 patch-src_fw_paravirt_c
--- patches/patch-src_fw_paravirt_c 26 Apr 2018 12:23:32 -0000 1.2
+++ patches/patch-src_fw_paravirt_c 9 Dec 2018 10:55:37 -0000
@@ -1,18 +1,27 @@
 $OpenBSD: patch-src_fw_paravirt_c,v 1.2 2018/04/26 12:23:32 sthen Exp $
 
+Don't use 'rep insb' to read IO ports, vmm does not support that yet.
 Allow detection of >4GB RAM. Normally seabios only allows this with the
 qemu config device which VMM doesn't have.
 
 Index: src/fw/paravirt.c
 --- src/fw/paravirt.c.orig
 +++ src/fw/paravirt.c
-@@ -500,6 +500,18 @@ qemu_cfg_e820(void)
-     dprintf(1, "RamSizeOver4G: 0x%016llx [cmos]\n", RamSizeOver4G);
+@@ -257,7 +257,9 @@ qemu_cfg_read(void *buf, int len)
+     if (qemu_cfg_dma_enabled()) {
+         qemu_cfg_dma_transfer(buf, len, QEMU_CFG_DMA_CTL_READ);
+     } else {
+-        insb(PORT_QEMU_CFG_DATA, buf, len);
++ u8 *d = buf;
++ while (len-- > 0)
++ *d++ = inb(PORT_QEMU_CFG_DATA);
+     }
  }
 
-+void
-+vmm_check_high_mem(void)
-+{
+@@ -491,6 +493,18 @@ qemu_cfg_e820(void)
+         e820_add(0xfffbc000, 4*4096, E820_RESERVED);
+     }
+
 +    // Check for memory over 4Gig in cmos
 +    u64 high = ((rtc_read(CMOS_MEM_HIGHMEM_LOW) << 16)
 +                | ((u32)rtc_read(CMOS_MEM_HIGHMEM_MID) << 24)
@@ -22,6 +31,9 @@ Index: src/fw/paravirt.c
 +    dprintf(1, "RamSizeOver4G: 0x%016llx [cmos]\n", RamSizeOver4G);
 +}
 +
- // Populate romfile entries for legacy fw_cfg ports (that predate the
- // "file" interface).
- static void
++void
++vmm_check_high_mem(void)
++{
+     // Check for memory over 4Gig in cmos
+     u64 high = ((rtc_read(CMOS_MEM_HIGHMEM_LOW) << 16)
+                 | ((u32)rtc_read(CMOS_MEM_HIGHMEM_MID) << 24)
Index: patches/patch-src_optionroms_c
===================================================================
RCS file: /cvs/ports/sysutils/firmware/vmm/patches/patch-src_optionroms_c,v
retrieving revision 1.2
diff -u -p -r1.2 patch-src_optionroms_c
--- patches/patch-src_optionroms_c 19 Jul 2017 19:33:51 -0000 1.2
+++ patches/patch-src_optionroms_c 9 Dec 2018 10:45:01 -0000
@@ -2,9 +2,11 @@ $OpenBSD: patch-src_optionroms_c,v 1.2 2
 
 Needed for SGABIOS option ROM for VMM. Normally these are setup based on
 the qemu fw_cfg interface (or coreboot CBFS on hardware).
+Turn of screen-and-debug to prevent double printing of chars.
 
---- src/optionroms.c.orig Fri Mar 31 09:34:40 2017
-+++ src/optionroms.c Fri Mar 31 09:35:35 2017
+Index: src/optionroms.c
+--- src/optionroms.c.orig
++++ src/optionroms.c
 @@ -361,7 +361,7 @@ optionrom_setup(void)
 
      // All option roms found and deployed - now build BEV/BCV vectors.
@@ -14,3 +16,12 @@ the qemu fw_cfg interface (or coreboot C
      while (pos < rom_get_last()) {
          struct rom_header *rom = (void*)pos;
          if (! is_valid_rom(rom)) {
+@@ -413,7 +413,7 @@ vgarom_setup(void)
+     EnforceChecksum = romfile_loadint("etc/optionroms-checksum", 1);
+     S3ResumeVga = romfile_loadint("etc/s3-resume-vga-init", CONFIG_QEMU);
+     RunPCIroms = romfile_loadint("etc/pci-optionrom-exec", 2);
+-    ScreenAndDebug = romfile_loadint("etc/screen-and-debug", 1);
++    ScreenAndDebug = romfile_loadint("etc/screen-and-debug", 0);
+
+     // Clear option rom memory
+     memset((void*)BUILD_ROM_START, 0, rom_get_max() - BUILD_ROM_START);

Reply | Threaded
Open this post in threaded view
|

Re: Update vmm-firmware port

Mike Larkin
On Mon, Dec 10, 2018 at 09:53:15AM +0100, Claudio Jeker wrote:

> On Sun, Dec 09, 2018 at 09:32:25PM -0800, Mike Larkin wrote:
> > On Sun, Dec 09, 2018 at 12:19:46PM +0100, Claudio Jeker wrote:
> > > I started looking at supporting fw_cfg in vmd. Now to make this work with
> > > SeaBIOS there are a few fixes needed. First of all the way it reads the
> > > FW_CFG_DATA port is not supported by vmm(4) (problem whith 'rep insb' on
> > > IO ports). Additionally this cleans up some of the patches which I think
> > > are not needed if the setting of screen-and-debug is changed. At least I
> > > no longer see double printing of messages.
> > > I enabled CONFIG_BOOTORDER because this is what I would like to tweak.
> > > The CONFIG_DEBUG_LEVEL can be taken out before commit but it helped me
> > > debugging this. Once vmd uses fw_cfg more of the patches can be removed.
> > >
> > > --
> > > :wq Claudio
> > >
> >
> > While I am not opposed to vmm-firmware updates in general, we have to be
> > careful a bit now since there are tons of people using all sorts of bizarre
> > linux distributions, which all do different things with the bios during boot.
> >
> > I'd think we would need to put this out there for a long while before I'd
> > feel comfortable turning it on for everyone.
>
> I think it is the right time now to make this available as a snapshot
> package so that people can start testing this the easy way. At least this
> way we get a few month of full exposure before 6.5. If there are problems
> with this we can still revert back.
>
> > I did not read the diff yet but I will.
>
> I attached an updated diff of what I plan to commit.
>
> --
> :wq Claudio
>

If we've tested at least the common OpenBSD scenarios and at least one
Linux guest, I'm ok with rolling the dice on this one.

Thanks.

-ml

> Index: Makefile
> ===================================================================
> RCS file: /cvs/ports/sysutils/firmware/vmm/Makefile,v
> retrieving revision 1.15
> diff -u -p -r1.15 Makefile
> --- Makefile 21 Nov 2018 00:26:05 -0000 1.15
> +++ Makefile 9 Dec 2018 11:09:05 -0000
> @@ -13,7 +13,7 @@ CC = /usr/bin/gcc
>  FW_DRIVER= vmm
>  FW_VER= 1.11.0
>  SB_VER= 20100422
> -REVISION= 0
> +REVISION= 1
>  DISTNAME= seabios-${FW_VER}
>  DISTFILES= ${DISTNAME}${EXTRACT_SUFX} \
>   sgabios-20100422{23d474943dcd55d0550a3d20b3d30e9040a4f15b}.tar.gz:0
> Index: files/config
> ===================================================================
> RCS file: /cvs/ports/sysutils/firmware/vmm/files/config,v
> retrieving revision 1.6
> diff -u -p -r1.6 config
> --- files/config 11 Jul 2018 09:09:46 -0000 1.6
> +++ files/config 9 Dec 2018 12:46:20 -0000
> @@ -15,7 +15,7 @@ CONFIG_QEMU_HARDWARE=y
>  # CONFIG_THREADS is not set
>  # CONFIG_RELOCATE_INIT is not set
>  # CONFIG_BOOTMENU is not set
> -# CONFIG_BOOTORDER is not set
> +CONFIG_BOOTORDER=y
>  # CONFIG_ENTRY_EXTRASTACK is not set
>  CONFIG_MALLOC_UPPERMEMORY=y
>  CONFIG_ROM_SIZE=0
> Index: patches/patch-src_fw_paravirt_c
> ===================================================================
> RCS file: /cvs/ports/sysutils/firmware/vmm/patches/patch-src_fw_paravirt_c,v
> retrieving revision 1.2
> diff -u -p -r1.2 patch-src_fw_paravirt_c
> --- patches/patch-src_fw_paravirt_c 26 Apr 2018 12:23:32 -0000 1.2
> +++ patches/patch-src_fw_paravirt_c 9 Dec 2018 10:55:37 -0000
> @@ -1,18 +1,27 @@
>  $OpenBSD: patch-src_fw_paravirt_c,v 1.2 2018/04/26 12:23:32 sthen Exp $
>  
> +Don't use 'rep insb' to read IO ports, vmm does not support that yet.
>  Allow detection of >4GB RAM. Normally seabios only allows this with the
>  qemu config device which VMM doesn't have.
>  
>  Index: src/fw/paravirt.c
>  --- src/fw/paravirt.c.orig
>  +++ src/fw/paravirt.c
> -@@ -500,6 +500,18 @@ qemu_cfg_e820(void)
> -     dprintf(1, "RamSizeOver4G: 0x%016llx [cmos]\n", RamSizeOver4G);
> +@@ -257,7 +257,9 @@ qemu_cfg_read(void *buf, int len)
> +     if (qemu_cfg_dma_enabled()) {
> +         qemu_cfg_dma_transfer(buf, len, QEMU_CFG_DMA_CTL_READ);
> +     } else {
> +-        insb(PORT_QEMU_CFG_DATA, buf, len);
> ++ u8 *d = buf;
> ++ while (len-- > 0)
> ++ *d++ = inb(PORT_QEMU_CFG_DATA);
> +     }
>   }
>  
> -+void
> -+vmm_check_high_mem(void)
> -+{
> +@@ -491,6 +493,18 @@ qemu_cfg_e820(void)
> +         e820_add(0xfffbc000, 4*4096, E820_RESERVED);
> +     }
> +
>  +    // Check for memory over 4Gig in cmos
>  +    u64 high = ((rtc_read(CMOS_MEM_HIGHMEM_LOW) << 16)
>  +                | ((u32)rtc_read(CMOS_MEM_HIGHMEM_MID) << 24)
> @@ -22,6 +31,9 @@ Index: src/fw/paravirt.c
>  +    dprintf(1, "RamSizeOver4G: 0x%016llx [cmos]\n", RamSizeOver4G);
>  +}
>  +
> - // Populate romfile entries for legacy fw_cfg ports (that predate the
> - // "file" interface).
> - static void
> ++void
> ++vmm_check_high_mem(void)
> ++{
> +     // Check for memory over 4Gig in cmos
> +     u64 high = ((rtc_read(CMOS_MEM_HIGHMEM_LOW) << 16)
> +                 | ((u32)rtc_read(CMOS_MEM_HIGHMEM_MID) << 24)
> Index: patches/patch-src_optionroms_c
> ===================================================================
> RCS file: /cvs/ports/sysutils/firmware/vmm/patches/patch-src_optionroms_c,v
> retrieving revision 1.2
> diff -u -p -r1.2 patch-src_optionroms_c
> --- patches/patch-src_optionroms_c 19 Jul 2017 19:33:51 -0000 1.2
> +++ patches/patch-src_optionroms_c 9 Dec 2018 10:45:01 -0000
> @@ -2,9 +2,11 @@ $OpenBSD: patch-src_optionroms_c,v 1.2 2
>  
>  Needed for SGABIOS option ROM for VMM. Normally these are setup based on
>  the qemu fw_cfg interface (or coreboot CBFS on hardware).
> +Turn of screen-and-debug to prevent double printing of chars.
>  
> ---- src/optionroms.c.orig Fri Mar 31 09:34:40 2017
> -+++ src/optionroms.c Fri Mar 31 09:35:35 2017
> +Index: src/optionroms.c
> +--- src/optionroms.c.orig
> ++++ src/optionroms.c
>  @@ -361,7 +361,7 @@ optionrom_setup(void)
>  
>       // All option roms found and deployed - now build BEV/BCV vectors.
> @@ -14,3 +16,12 @@ the qemu fw_cfg interface (or coreboot C
>       while (pos < rom_get_last()) {
>           struct rom_header *rom = (void*)pos;
>           if (! is_valid_rom(rom)) {
> +@@ -413,7 +413,7 @@ vgarom_setup(void)
> +     EnforceChecksum = romfile_loadint("etc/optionroms-checksum", 1);
> +     S3ResumeVga = romfile_loadint("etc/s3-resume-vga-init", CONFIG_QEMU);
> +     RunPCIroms = romfile_loadint("etc/pci-optionrom-exec", 2);
> +-    ScreenAndDebug = romfile_loadint("etc/screen-and-debug", 1);
> ++    ScreenAndDebug = romfile_loadint("etc/screen-and-debug", 0);
> +
> +     // Clear option rom memory
> +     memset((void*)BUILD_ROM_START, 0, rom_get_max() - BUILD_ROM_START);
>

Reply | Threaded
Open this post in threaded view
|

Re: Update vmm-firmware port

Stuart Henderson
Since vmd can load different firmware files, if we want to try anything
that might be considered more disruptive, we could add regular-installable
packages (i.e. handled by pkg_add not fw_update) which users could
configure per-VM. (I already do this locally for testing with a version
with the messages that Reyk doesn't like added back in ;-)

In this case I think that would be overkill but worth bearing in mind for
other changes that need testing.

--
Sent from a phone, apologies for poor formatting.

On 10 December 2018 09:23:42 Mike Larkin <[hidden email]> wrote:

> On Mon, Dec 10, 2018 at 09:53:15AM +0100, Claudio Jeker wrote:
>> On Sun, Dec 09, 2018 at 09:32:25PM -0800, Mike Larkin wrote:
>> > On Sun, Dec 09, 2018 at 12:19:46PM +0100, Claudio Jeker wrote:
>> > > I started looking at supporting fw_cfg in vmd. Now to make this work with
>> > > SeaBIOS there are a few fixes needed. First of all the way it reads the
>> > > FW_CFG_DATA port is not supported by vmm(4) (problem whith 'rep insb' on
>> > > IO ports). Additionally this cleans up some of the patches which I think
>> > > are not needed if the setting of screen-and-debug is changed. At least I
>> > > no longer see double printing of messages.
>> > > I enabled CONFIG_BOOTORDER because this is what I would like to tweak.
>> > > The CONFIG_DEBUG_LEVEL can be taken out before commit but it helped me
>> > > debugging this. Once vmd uses fw_cfg more of the patches can be removed.
>> > >
>> > > --
>> > > :wq Claudio
>> > >
>> >
>> > While I am not opposed to vmm-firmware updates in general, we have to be
>> > careful a bit now since there are tons of people using all sorts of bizarre
>> > linux distributions, which all do different things with the bios during boot.
>> >
>> > I'd think we would need to put this out there for a long while before I'd
>> > feel comfortable turning it on for everyone.
>>
>> I think it is the right time now to make this available as a snapshot
>> package so that people can start testing this the easy way. At least this
>> way we get a few month of full exposure before 6.5. If there are problems
>> with this we can still revert back.
>>
>> > I did not read the diff yet but I will.
>>
>> I attached an updated diff of what I plan to commit.
>>
>> --
>> :wq Claudio
>>
>
> If we've tested at least the common OpenBSD scenarios and at least one
> Linux guest, I'm ok with rolling the dice on this one.
>
> Thanks.
>
> -ml
>
>> Index: Makefile
>> ===================================================================
>> RCS file: /cvs/ports/sysutils/firmware/vmm/Makefile,v
>> retrieving revision 1.15
>> diff -u -p -r1.15 Makefile
>> --- Makefile 21 Nov 2018 00:26:05 -0000 1.15
>> +++ Makefile 9 Dec 2018 11:09:05 -0000
>> @@ -13,7 +13,7 @@ CC = /usr/bin/gcc
>>  FW_DRIVER= vmm
>>  FW_VER= 1.11.0
>>  SB_VER= 20100422
>> -REVISION= 0
>> +REVISION= 1
>>  DISTNAME= seabios-${FW_VER}
>>  DISTFILES= ${DISTNAME}${EXTRACT_SUFX} \
>>   sgabios-20100422{23d474943dcd55d0550a3d20b3d30e9040a4f15b}.tar.gz:0
>> Index: files/config
>> ===================================================================
>> RCS file: /cvs/ports/sysutils/firmware/vmm/files/config,v
>> retrieving revision 1.6
>> diff -u -p -r1.6 config
>> --- files/config 11 Jul 2018 09:09:46 -0000 1.6
>> +++ files/config 9 Dec 2018 12:46:20 -0000
>> @@ -15,7 +15,7 @@ CONFIG_QEMU_HARDWARE=y
>>  # CONFIG_THREADS is not set
>>  # CONFIG_RELOCATE_INIT is not set
>>  # CONFIG_BOOTMENU is not set
>> -# CONFIG_BOOTORDER is not set
>> +CONFIG_BOOTORDER=y
>>  # CONFIG_ENTRY_EXTRASTACK is not set
>>  CONFIG_MALLOC_UPPERMEMORY=y
>>  CONFIG_ROM_SIZE=0
>> Index: patches/patch-src_fw_paravirt_c
>> ===================================================================
>> RCS file: /cvs/ports/sysutils/firmware/vmm/patches/patch-src_fw_paravirt_c,v
>> retrieving revision 1.2
>> diff -u -p -r1.2 patch-src_fw_paravirt_c
>> --- patches/patch-src_fw_paravirt_c 26 Apr 2018 12:23:32 -0000 1.2
>> +++ patches/patch-src_fw_paravirt_c 9 Dec 2018 10:55:37 -0000
>> @@ -1,18 +1,27 @@
>>  $OpenBSD: patch-src_fw_paravirt_c,v 1.2 2018/04/26 12:23:32 sthen Exp $
>>
>> +Don't use 'rep insb' to read IO ports, vmm does not support that yet.
>>  Allow detection of >4GB RAM. Normally seabios only allows this with the
>>  qemu config device which VMM doesn't have.
>>
>>  Index: src/fw/paravirt.c
>>  --- src/fw/paravirt.c.orig
>>  +++ src/fw/paravirt.c
>> -@@ -500,6 +500,18 @@ qemu_cfg_e820(void)
>> -     dprintf(1, "RamSizeOver4G: 0x%016llx [cmos]\n", RamSizeOver4G);
>> +@@ -257,7 +257,9 @@ qemu_cfg_read(void *buf, int len)
>> +     if (qemu_cfg_dma_enabled()) {
>> +         qemu_cfg_dma_transfer(buf, len, QEMU_CFG_DMA_CTL_READ);
>> +     } else {
>> +-        insb(PORT_QEMU_CFG_DATA, buf, len);
>> ++ u8 *d = buf;
>> ++ while (len-- > 0)
>> ++ *d++ = inb(PORT_QEMU_CFG_DATA);
>> +     }
>>   }
>>
>> -+void
>> -+vmm_check_high_mem(void)
>> -+{
>> +@@ -491,6 +493,18 @@ qemu_cfg_e820(void)
>> +         e820_add(0xfffbc000, 4*4096, E820_RESERVED);
>> +     }
>> +
>>  +    // Check for memory over 4Gig in cmos
>>  +    u64 high = ((rtc_read(CMOS_MEM_HIGHMEM_LOW) << 16)
>>  +                | ((u32)rtc_read(CMOS_MEM_HIGHMEM_MID) << 24)
>> @@ -22,6 +31,9 @@ Index: src/fw/paravirt.c
>>  +    dprintf(1, "RamSizeOver4G: 0x%016llx [cmos]\n", RamSizeOver4G);
>>  +}
>>  +
>> - // Populate romfile entries for legacy fw_cfg ports (that predate the
>> - // "file" interface).
>> - static void
>> ++void
>> ++vmm_check_high_mem(void)
>> ++{
>> +     // Check for memory over 4Gig in cmos
>> +     u64 high = ((rtc_read(CMOS_MEM_HIGHMEM_LOW) << 16)
>> +                 | ((u32)rtc_read(CMOS_MEM_HIGHMEM_MID) << 24)
>> Index: patches/patch-src_optionroms_c
>> ===================================================================
>> RCS file: /cvs/ports/sysutils/firmware/vmm/patches/patch-src_optionroms_c,v
>> retrieving revision 1.2
>> diff -u -p -r1.2 patch-src_optionroms_c
>> --- patches/patch-src_optionroms_c 19 Jul 2017 19:33:51 -0000 1.2
>> +++ patches/patch-src_optionroms_c 9 Dec 2018 10:45:01 -0000
>> @@ -2,9 +2,11 @@ $OpenBSD: patch-src_optionroms_c,v 1.2 2
>>
>>  Needed for SGABIOS option ROM for VMM. Normally these are setup based on
>>  the qemu fw_cfg interface (or coreboot CBFS on hardware).
>> +Turn of screen-and-debug to prevent double printing of chars.
>>
>> ---- src/optionroms.c.orig Fri Mar 31 09:34:40 2017
>> -+++ src/optionroms.c Fri Mar 31 09:35:35 2017
>> +Index: src/optionroms.c
>> +--- src/optionroms.c.orig
>> ++++ src/optionroms.c
>>  @@ -361,7 +361,7 @@ optionrom_setup(void)
>>
>>       // All option roms found and deployed - now build BEV/BCV vectors.
>> @@ -14,3 +16,12 @@ the qemu fw_cfg interface (or coreboot C
>>       while (pos < rom_get_last()) {
>>           struct rom_header *rom = (void*)pos;
>>           if (! is_valid_rom(rom)) {
>> +@@ -413,7 +413,7 @@ vgarom_setup(void)
>> +     EnforceChecksum = romfile_loadint("etc/optionroms-checksum", 1);
>> +     S3ResumeVga = romfile_loadint("etc/s3-resume-vga-init", CONFIG_QEMU);
>> +     RunPCIroms = romfile_loadint("etc/pci-optionrom-exec", 2);
>> +-    ScreenAndDebug = romfile_loadint("etc/screen-and-debug", 1);
>> ++    ScreenAndDebug = romfile_loadint("etc/screen-and-debug", 0);
>> +
>> +     // Clear option rom memory
>> +     memset((void*)BUILD_ROM_START, 0, rom_get_max() - BUILD_ROM_START);
>>