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 via email to