From mboxrd@z Thu Jan 1 00:00:00 1970 From: Avi Kivity Subject: Re: [PATCH] bios: Makefile ACPI DSDT generation Date: Sun, 22 Jun 2008 09:16:02 +0300 Message-ID: <485DEE22.8090008@qumranet.com> References: <1213846162.17626.15.camel@lappy> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Cc: kvm To: Alex Williamson Return-path: Received: from il.qumranet.com ([212.179.150.194]:28326 "EHLO il.qumranet.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750887AbYFVGPu (ORCPT ); Sun, 22 Jun 2008 02:15:50 -0400 In-Reply-To: <1213846162.17626.15.camel@lappy> Sender: kvm-owner@vger.kernel.org List-ID: 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 > -- > > 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.