[SeaBIOS] [PATCH v2] make BUILD_MIN_BIOSTABLE configurable

Gerd Hoffmann posted 1 patch 2 years, 11 months ago
Patches applied successfully (tree, apply log)
git fetch https://github.com/patchew-project/seabios tags/patchew/20210527085227.1029147-1-kraxel@redhat.com
Makefile             | 2 +-
scripts/layoutrom.py | 3 ++-
src/Kconfig          | 7 +++++++
3 files changed, 10 insertions(+), 2 deletions(-)
[SeaBIOS] [PATCH v2] make BUILD_MIN_BIOSTABLE configurable
Posted by Gerd Hoffmann 2 years, 11 months ago
BUILD_MIN_BIOSTABLE reserves space in the f-segment.  Some data
structures -- for example disk drives known to seabios -- must be
stored there, so the space available here limits the number of
devices seabios is able to manage.

This patch adds an config option for BUILD_MIN_BIOSTABLE so the size of
the reservation can be configured at build time.  Default is 8k for bios
images being 256k or larger in size (32bit code is moved off then so we
have more room in the f-segment), 2k (current value) otherwise.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
---
 Makefile             | 2 +-
 scripts/layoutrom.py | 3 ++-
 src/Kconfig          | 7 +++++++
 3 files changed, 10 insertions(+), 2 deletions(-)

diff --git a/Makefile b/Makefile
index 3d8943ef5f25..ddcd1dff399d 100644
--- a/Makefile
+++ b/Makefile
@@ -172,7 +172,7 @@ $(OUT)romlayout16.lds: $(OUT)ccode32flat.o $(OUT)code32seg.o $(OUT)ccode16.o $(O
 	$(Q)$(OBJDUMP) -thr $(OUT)code32flat.o > $(OUT)code32flat.o.objdump
 	$(Q)$(OBJDUMP) -thr $(OUT)code32seg.o > $(OUT)code32seg.o.objdump
 	$(Q)$(OBJDUMP) -thr $(OUT)code16.o > $(OUT)code16.o.objdump
-	$(Q)$(PYTHON) ./scripts/layoutrom.py $(OUT)code16.o.objdump $(OUT)code32seg.o.objdump $(OUT)code32flat.o.objdump $(OUT)$(KCONFIG_AUTOHEADER) $(OUT)romlayout16.lds $(OUT)romlayout32seg.lds $(OUT)romlayout32flat.lds
+	$(Q)$(PYTHON) ./scripts/layoutrom.py $(OUT)code16.o.objdump $(OUT)code32seg.o.objdump $(OUT)code32flat.o.objdump $(OUT)$(KCONFIG_AUTOHEADER) $(OUT)romlayout16.lds $(OUT)romlayout32seg.lds $(OUT)romlayout32flat.lds $(CONFIG_MIN_BIOSTABLE)
 
 # These are actually built by scripts/layoutrom.py above, but by pulling them
 # into an extra rule we prevent make -j from spawning layoutrom.py 4 times.
diff --git a/scripts/layoutrom.py b/scripts/layoutrom.py
index 6616721d1b58..94deca9fcc85 100755
--- a/scripts/layoutrom.py
+++ b/scripts/layoutrom.py
@@ -636,7 +636,8 @@ def scanconfig(file):
 
 def main():
     # Get output name
-    in16, in32seg, in32flat, cfgfile, out16, out32seg, out32flat = sys.argv[1:]
+    in16, in32seg, in32flat, cfgfile, out16, out32seg, out32flat, biostable = sys.argv[1:]
+    BUILD_MIN_BIOSTABLE = biostable * 1024
 
     # Read in the objdump information
     infile16 = open(in16, 'r')
diff --git a/src/Kconfig b/src/Kconfig
index 3a8ffa15fded..95519fc50fa3 100644
--- a/src/Kconfig
+++ b/src/Kconfig
@@ -140,6 +140,13 @@ endchoice
             it into 128 KB (which was big enouth for a long time) you'll
             probably have to disable some featues such as xhci support.
 
+    config MIN_BIOSTABLE
+        int "biostable size (in KB)"
+        default 8 if ROM_SIZE >= 256
+        default 2
+        help
+            Memory space for BIOS tables in f-segment.
+
 endmenu
 
 menu "Hardware support"
-- 
2.31.1

_______________________________________________
SeaBIOS mailing list -- seabios@seabios.org
To unsubscribe send an email to seabios-leave@seabios.org
[SeaBIOS] Re: [PATCH v2] make BUILD_MIN_BIOSTABLE configurable
Posted by Kevin O'Connor 2 years, 11 months ago
On Thu, May 27, 2021 at 10:52:27AM +0200, Gerd Hoffmann wrote:
> BUILD_MIN_BIOSTABLE reserves space in the f-segment.  Some data
> structures -- for example disk drives known to seabios -- must be
> stored there, so the space available here limits the number of
> devices seabios is able to manage.
> 
> This patch adds an config option for BUILD_MIN_BIOSTABLE so the size of
> the reservation can be configured at build time.  Default is 8k for bios
> images being 256k or larger in size (32bit code is moved off then so we
> have more room in the f-segment), 2k (current value) otherwise.

I'm not sure it is a good idea to make this a user configurable value.
I'm concerned that it's too easy to set it to a value that breaks
things.  Is there any harm in setting it to 8K unconditionally?

> 
> Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
> ---
>  Makefile             | 2 +-
>  scripts/layoutrom.py | 3 ++-
>  src/Kconfig          | 7 +++++++
>  3 files changed, 10 insertions(+), 2 deletions(-)
> 
> diff --git a/Makefile b/Makefile
> index 3d8943ef5f25..ddcd1dff399d 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -172,7 +172,7 @@ $(OUT)romlayout16.lds: $(OUT)ccode32flat.o $(OUT)code32seg.o $(OUT)ccode16.o $(O
>  	$(Q)$(OBJDUMP) -thr $(OUT)code32flat.o > $(OUT)code32flat.o.objdump
>  	$(Q)$(OBJDUMP) -thr $(OUT)code32seg.o > $(OUT)code32seg.o.objdump
>  	$(Q)$(OBJDUMP) -thr $(OUT)code16.o > $(OUT)code16.o.objdump
> -	$(Q)$(PYTHON) ./scripts/layoutrom.py $(OUT)code16.o.objdump $(OUT)code32seg.o.objdump $(OUT)code32flat.o.objdump $(OUT)$(KCONFIG_AUTOHEADER) $(OUT)romlayout16.lds $(OUT)romlayout32seg.lds $(OUT)romlayout32flat.lds
> +	$(Q)$(PYTHON) ./scripts/layoutrom.py $(OUT)code16.o.objdump $(OUT)code32seg.o.objdump $(OUT)code32flat.o.objdump $(OUT)$(KCONFIG_AUTOHEADER) $(OUT)romlayout16.lds $(OUT)romlayout32seg.lds $(OUT)romlayout32flat.lds $(CONFIG_MIN_BIOSTABLE)
>  
>  # These are actually built by scripts/layoutrom.py above, but by pulling them
>  # into an extra rule we prevent make -j from spawning layoutrom.py 4 times.
> diff --git a/scripts/layoutrom.py b/scripts/layoutrom.py
> index 6616721d1b58..94deca9fcc85 100755
> --- a/scripts/layoutrom.py
> +++ b/scripts/layoutrom.py
> @@ -636,7 +636,8 @@ def scanconfig(file):
>  
>  def main():
>      # Get output name
> -    in16, in32seg, in32flat, cfgfile, out16, out32seg, out32flat = sys.argv[1:]
> +    in16, in32seg, in32flat, cfgfile, out16, out32seg, out32flat, biostable = sys.argv[1:]
> +    BUILD_MIN_BIOSTABLE = biostable * 1024

FYI, the layoutrom.py script reads in the Kconfig file explicitly a
few lines down.  If we do want to have a setting in Kconfig, I think
it should be taken directly from Kconfig instead of passed from the
command-line.

Cheers,
-Kevin


>      # Read in the objdump information
>      infile16 = open(in16, 'r')
> diff --git a/src/Kconfig b/src/Kconfig
> index 3a8ffa15fded..95519fc50fa3 100644
> --- a/src/Kconfig
> +++ b/src/Kconfig
> @@ -140,6 +140,13 @@ endchoice
>              it into 128 KB (which was big enouth for a long time) you'll
>              probably have to disable some featues such as xhci support.
>  
> +    config MIN_BIOSTABLE
> +        int "biostable size (in KB)"
> +        default 8 if ROM_SIZE >= 256
> +        default 2
> +        help
> +            Memory space for BIOS tables in f-segment.
> +
>  endmenu
>  
>  menu "Hardware support"
> -- 
> 2.31.1
> 
> _______________________________________________
> SeaBIOS mailing list -- seabios@seabios.org
> To unsubscribe send an email to seabios-leave@seabios.org
_______________________________________________
SeaBIOS mailing list -- seabios@seabios.org
To unsubscribe send an email to seabios-leave@seabios.org