ports@,

Just sent an email to tech@ about this, subject:
 vmd(8): create a proper e820 bios memory map
 https://marc.info/?l=openbsd-tech&m=167071344902372&w=2

In short, this nukes some old hacks we've been carrying to communicate
things like >4GB of memory to SeaBIOS via CMOS. It assumes vmd(8)
properly builds and conveys a bios e820 memory map via the fw_cfg api.

While nuking, I also ripped out the etc/screen-and-debug tweak as vmd
has been communicating that value (0) via fw_cfg for awhile now. There's
no need to patch that.

The below diff isn't ready to commit until the changes to vmm/vmd land
(assuming they do), but I wanted to share this for any testers and get
eyeballs on my approach.

btw, I'm not bumping the SeaBIOS version at all, just revision.

-dv

diff refs/heads/master refs/heads/seabios-e820
commit - 2e9128e724420d4d786f1537c31c67623878de0a
commit + e27c83b9ed21ac29efaa0a8b2d8238af95799b0c
blob - ba30a80601c23dfd2f64eaa489418518c1f75800
blob + 32d68c925aa891000fdf411899d58bbe3805f333
--- sysutils/firmware/vmm/Makefile
+++ sysutils/firmware/vmm/Makefile
@@ -17,7 +17,7 @@ REVISION=     0
 FW_VER=                1.14.0
 SB_VER=                20180715
 DISTNAME=      seabios-${FW_VER}
-REVISION=      0
+REVISION=      1
 DISTFILES=     ${DISTNAME}${EXTRACT_SUFX} \
        sgabios-${SB_VER}{72f39d48bedf044e202fd51fecf3e2218fc2ae66}.tar.gz:0

blob - 2382176b2d3b8f3ca809985fa0cafc40423a3a79
blob + f81983fb071984dafe9a24ff6781244dbcd0086d
--- sysutils/firmware/vmm/patches/patch-src_fw_paravirt_c
+++ sysutils/firmware/vmm/patches/patch-src_fw_paravirt_c
@@ -1,11 +1,9 @@
 - 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 does not have.

 Index: src/fw/paravirt.c
 --- src/fw/paravirt.c.orig
 +++ src/fw/paravirt.c
-@@ -310,7 +310,9 @@ qemu_cfg_read(void *buf, int len)
+@@ -310,6 +310,8 @@ qemu_cfg_read(void *buf, int len)
      if (qemu_cfg_dma_enabled()) {
          qemu_cfg_dma_transfer(buf, len, QEMU_CFG_DMA_CTL_READ);
      } else {
@@ -15,23 +13,3 @@ Index: src/fw/paravirt.c
 +              *d++ = inb(PORT_QEMU_CFG_DATA);
      }
  }
-
-@@ -515,6 +517,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)
-+                | ((u64)rtc_read(CMOS_MEM_HIGHMEM_HIGH) << 32));
-+    RamSizeOver4G = high;
-+    e820_add(0x100000000ull, high, E820_RAM);
-+    dprintf(1, "RamSizeOver4G: 0x%016llx [cmos]\n", RamSizeOver4G);
-+}
-+
-+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)
blob - 06accf4cae866712fc782ccc6920e20184ee1957 (mode 644)
blob + /dev/null
--- sysutils/firmware/vmm/patches/patch-src_fw_paravirt_h
+++ /dev/null
@@ -1,12 +0,0 @@
-Allow detection of >4GB RAM. Normally seabios only allows this with the
-QEMU config device which VMM does not have.
-
-Index: src/fw/paravirt.h
---- src/fw/paravirt.h.orig
-+++ src/fw/paravirt.h
-@@ -75,4 +75,5 @@ int qemu_cfg_write_file(void *src, struct romfile_s *f
- int qemu_cfg_write_file_simple(void *src, u16 key, u32 offset, u32 len);
- u16 qemu_get_romfile_key(struct romfile_s *file);
-
-+void vmm_check_high_mem(void);
- #endif
blob - ac0a7376d85a599c2dba0703fdd0e499a9837bde
blob + 89b46991f85530edc0c2fb5c808c9c84a5ecdf5b
--- sysutils/firmware/vmm/patches/patch-src_optionroms_c
+++ sysutils/firmware/vmm/patches/patch-src_optionroms_c
@@ -1,25 +1,15 @@
 - Needed for SGABIOS option ROM for VMM. Normally these are setup based on
   the QEMU fw_cfg interface (or coreboot CBFS on hardware).
-- Turn off screen-and-debug to prevent double printing of chars.

 Index: src/optionroms.c
 --- src/optionroms.c.orig
 +++ src/optionroms.c
 @@ -387,7 +387,7 @@ optionrom_setup(void)
-
+
      // All option roms found and deployed - now build BEV/BCV vectors.
-
+
 -    u32 pos = post_vga;
 +    u32 pos = BUILD_BIOS_ADDR - BUILD_ROM_START;
      while (pos < rom_get_last()) {
          struct rom_header *rom = (void*)pos;
          if (! is_valid_rom(rom)) {
-@@ -461,7 +461,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);
blob - b95bf5b010beb1dcbe4f508992a42b8d386a523c (mode 644)
blob + /dev/null
--- sysutils/firmware/vmm/patches/patch-src_post_c
+++ /dev/null
@@ -1,14 +0,0 @@
-Allow detection of >4GB RAM. Normally seabios only allows this with the
-QEMU config device which VMM does not have.
-
-Index: src/post.c
---- src/post.c.orig
-+++ src/post.c
-@@ -106,6 +106,7 @@ interface_init(void)
-
-     // Setup romfile items.
-     qemu_cfg_init();
-+    vmm_check_high_mem();
-     coreboot_cbfs_init();
-     multiboot_init();
-

Reply via email to