bios: Makefile ACPI DSDT generation
PATCH 1/1 bios: Makefile ACPI DSDT generation
Hi Avi,
This builds on your preprocessor work for cleaning up the DSDT and makes it trivially easy to change the CPU and PCI hotplug slot count. I'm thinking about splitting a few SSDTs out of the monolithic DSDT, and generating some of the code at compile time should make that easier. This generates the same ASL after the preprocessor as current code. BTW, isn't \_PR.PRU & \_PR.PRD too small for hotplug'ing more than 8 CPUs? Let me know what you think. Thanks,
Alex
kvm: bios: generate cpu and pci hotplug objects at compile time
--
bios/Makefile +55 -2
@@ -22,6 +22,9 @@ # Makefile for the BIOS component of bochs +max_cpus ?= 16 +max_pci_slots ?= 32 +win2k_cpu_limit ?= y .SUFFIXES: .cc
@@ -64,6 +67,9 @@ clean: rm -f *.o *.a *.s _rombios*_.c rombios*.txt rombios*.sym rm -f usage biossums rombios16.bin rm -f rombios32.bin rombios32.out acpi-dsdt.hex + rm -f acpi-dsdt-processor.gen acpi-dsdt-cpu-hotplug.gen + rm -f acpi-dsdt-prt-slot.gen acpi-dsdt-hotplug-slot.gen + rm -f acpi-dsdt-pci-hotplug.gen dist-clean: clean rm -f Makefile
@@ -101,13 +107,60 @@ rombios32.out: rombios32start.o rombios32.o vapic.o rombios32.ld ld -o $@ -T rombios32.ld rombios32start.o vapic.o rombios32.o rombios32.o: rombios32.c acpi-dsdt.hex - $(GCC) -m32 -O2 -Wall -c -o $@ $< + $(GCC) -m32 -O2 -Wall -DMAX_CPUS=$(max_cpus) -c -o $@ $< -acpi-dsdt.hex: acpi-dsdt.dsl +acpi-dsdt.hex: acpi-dsdt.dsl acpi-dsdt-processor.gen acpi-dsdt-cpu-hotplug.gen acpi-dsdt-prt-slot.gen acpi-dsdt-hotplug-slot.gen acpi-dsdt-pci-hotplug.gen cpp -P $< $<.i iasl -tc -p $@ $<.i rm $<.i +acpi-dsdt-processor.gen: + rm -f $@; + last=`expr $(max_cpus) - 1`; \ + if [ "$(win2k_cpu_limit)" = "y" ] && [ $$last -gt 14 ]; then \ + last=14; \ + fi; \ + for i in `seq 1 $$last`; do \ + echo "gen_processor($$i, `printf "%X" $$i`)" >> $@; \ + done + +acpi-dsdt-cpu-hotplug.gen: + rm -f $@; + last=`expr $(max_cpus) - 1`; \ + if [ "$(win2k_cpu_limit)" = "y" ] && [ $$last -gt 14 ]; then \ + last=14; \ + fi; \ + for i in `seq 1 $$last`; do \ + echo "gen_cpu_hotplug($$i, `printf "%X" $$i`)" >> $@; \ + done + +acpi-dsdt-prt-slot.gen: + rm -f $@; + last=`expr $(max_pci_slots) - 1`; \ + for i in `seq 0 4 $$last`; do \ + echo "prt_slot0(`printf "0x%04x" $$i`)," >> $@; \ + next=`expr $$i + 1`; \ + echo "prt_slot1(`printf "0x%04x" $$next`)," >> $@; \ + next=`expr $$i + 2`; \ + echo "prt_slot2(`printf "0x%04x" $$next`)," >> $@; \ + next=`expr $$i + 3`; \ + echo "prt_slot3(`printf "0x%04x" $$next`)," >> $@; \ + done + +acpi-dsdt-hotplug-slot.gen: + rm -f $@; + last=`expr $(max_pci_slots) - 1`; \ + for i in `seq 1 $$last`; do \ + echo "hotplug_slot($$i, `printf "0x%04x" $$i`)" >> $@; \ + done + +acpi-dsdt-pci-hotplug.gen: + rm -f $@; + last=`expr $(max_pci_slots) - 1`; \ + for i in `seq 1 $$last`; do \ + echo "gen_pci_hotplug($$i)" >> $@; \ + done + rombios32start.o: rombios32start.S $(GCC) -m32 -c -o $@ $<
bios/acpi-dsdt.dsl +12 -178
225 lines not on this page · raw message
bios/acpi-dsdt.h new file +67 -0
67 lines not on this page · raw message
bios/rombios.h +0 -2
@@ -59,8 +59,6 @@#define CPU_COUNT_ADDR 0xf000#define SMP_MSR_ADDR 0xf010 -#define MAX_CPUS 16 -// Define the application NAME #if defined(BX_QEMU )# define BX_APPNAME "QEMU"
Quoted 9 lines · Alex Williamson
Hi Avi,
This builds on your preprocessor work for cleaning up the DSDT and makes it trivially easy to change the CPU and PCI hotplug slot count. I'm thinking about splitting a few SSDTs out of the monolithic DSDT, and generating some of the code at compile time should make that easier. This generates the same ASL after the preprocessor as current code. BTW, isn't \_PR.PRU & \_PR.PRD too small for hotplug'ing more than 8 CPUs?
Yes, it is. Would be nice if you could enhance that (also needs changes in qemu/hw/acpi.c).
Quoted 24 lines · Alex Williamson
Hi Avi,
This builds on your preprocessor work for cleaning up the DSDT and makes it trivially easy to change the CPU and PCI hotplug slot count. I'm thinking about splitting a few SSDTs out of the monolithic DSDT, and generating some of the code at compile time should make that easier. This generates the same ASL after the preprocessor as current code. BTW, isn't \_PR.PRU & \_PR.PRD too small for hotplug'ing more than 8 CPUs? Let me know what you think. Thanks,
Alex
kvm: bios: generate cpu and pci hotplug objects at compile time
Signed-off-by Alex Williamson <[email protected]>--
bios/Makefile +0
-0
bios/Makefile line 28
Quoted 7 lines
bios/Makefile +3
-0@@ -22,6 +22,9 @@ # Makefile for the BIOS component of bochs +max_cpus ?= 16 +max_pci_slots ?= 32 +win2k_cpu_limit ?= y
I don't particularly like random environment variables influencing the build. This should be part of ./configure.
Quoted 40 lines
bios/Makefile +37
-0+acpi-dsdt-processor.gen: + rm -f $@; + last=`expr $(max_cpus) - 1`; \ + if [ "$(win2k_cpu_limit)" = "y" ] && [ $$last -gt 14 ]; then \ + last=14; \ + fi; \ + for i in `seq 1 $$last`; do \ + echo "gen_processor($$i, `printf "%X" $$i`)" >> $@; \ + done + +acpi-dsdt-cpu-hotplug.gen: + rm -f $@; + last=`expr $(max_cpus) - 1`; \ + if [ "$(win2k_cpu_limit)" = "y" ] && [ $$last -gt 14 ]; then \ + last=14; \ + fi; \ + for i in `seq 1 $$last`; do \ + echo "gen_cpu_hotplug($$i, `printf "%X" $$i`)" >> $@; \ + done + +acpi-dsdt-prt-slot.gen: + rm -f $@; + last=`expr $(max_pci_slots) - 1`; \ + for i in `seq 0 4 $$last`; do \ + echo "prt_slot0(`printf "0x%04x" $$i`)," >> $@; \ + next=`expr $$i + 1`; \ + echo "prt_slot1(`printf "0x%04x" $$next`)," >> $@; \ + next=`expr $$i + 2`; \ + echo "prt_slot2(`printf "0x%04x" $$next`)," >> $@; \ + next=`expr $$i + 3`; \ + echo "prt_slot3(`printf "0x%04x" $$next`)," >> $@; \ + done + +acpi-dsdt-hotplug-slot.gen: + rm -f $@; + last=`expr $(max_pci_slots) - 1`; \ + for i in `seq 1 $$last`; do \
bios/Makefile rombios32.out: rombios32start.o rombios32.o vapic.o rombios32.ld · line 163
Quoted 10 lines
bios/Makefile +10
-0+ echo "hotplug_slot($$i, `printf "0x%04x" $$i`)" >> $@; \ + done + +acpi-dsdt-pci-hotplug.gen: + rm -f $@; + last=`expr $(max_pci_slots) - 1`; \ + for i in `seq 1 $$last`; do \ + echo "gen_pci_hotplug($$i)" >> $@; \ + done +
Moving so much code into the Makefile isn't so pretty either. I considered using a preprocessor other than cpp, but then nobody knows how to work with things like m4.
Ideas, anyone?
Signature · 1 line
Do not meddle in the internals of kernels, for they are subtle and quick to panic.