Alex Williamson wrote:
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]>
--

diff --git a/bios/Makefile b/bios/Makefile
index 48022ea..8ca5482 100644
--- a/bios/Makefile
+++ b/bios/Makefile
@@ -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.

+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
+

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?

--
Do not meddle in the internals of kernels, for they are subtle and quick to 
panic.

--
To unsubscribe from this list: send the line "unsubscribe kvm" in
the body of a message to [EMAIL PROTECTED]
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to