From: Boris Ostrovsky Subject: Re: [PATCH v3 00/19] Make ACPI builder available to components other than hvmloader Date: Thu, 15 Sep 2016 11:28:03 -0400 Message-ID: <242a5b0a-657f-23a2-0f52-50a8e69bf046@oracle.com> References: <1473274769-19129-1-git-send-email-boris.ostrovsky@oracle.com> <15ee87ab-ea40-2b6b-3df6-1ded453ab630@oracle.com> <20160915101822.GH15958@citrix.com> <27ac0fa8-32b8-bca6-4a2e-d525ab5badf8@arm.com> <20160915102233.GI15958@citrix.com> <5a8d2b47-7e51-3c05-94c8-7c3a4fd7398c@oracle.com> <57DACA9A020000780010F4D9@prv-mh.provo.novell.com> Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="------------D7D99878F673E8550DDCDCAB" Return-path: In-Reply-To: <57DACA9A020000780010F4D9@prv-mh.provo.novell.com> List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xen.org Sender: "Xen-devel" To: Jan Beulich , Julien Grall , Wei Liu Cc: Stefano Stabellini , andrew.cooper3@citrix.com, "xen.org" , "xen-devel@lists.xen.org" , zhaoshenglong@huawei.com, roger.pau@citrix.com List-Id: xen-devel@lists.xenproject.org This is a multi-part message in MIME format. --------------D7D99878F673E8550DDCDCAB Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit On 09/15/2016 10:21 AM, Jan Beulich wrote: >>>> On 15.09.16 at 16:07, wrote: >> On 09/15/2016 09:48 AM, Julien Grall wrote: >>> On 15/09/2016 13:39, Boris Ostrovsky wrote: >>>> One option could be to provide a 'gpl_all' (or some such) target in >>>> libacpi in addition to 'all' and that target will be careful about not >>>> including these small un-ACKed portions of the code. >>>> >>>> It will be ugly though. >>> >>> I agree that it is not nice, but it would help us to get this features >>> (and the other ones that depend on it) in Xen 4.8. Otherwise we would >>> have to wait another 6 months to get those features. >> >> >> If Jan (who is/will be libacpi maintainer) agrees to this it can be >> easily added. > > I'd like to make this dependent on how ugly it ends up being. > > Jan > Something along the lines of this (attached as well to prevent line wrapping) Maybe even without changes to mk_dsdt.c -boris >From 15149f5d6ac15d7e7da650259dfcfaf4097b03ae Mon Sep 17 00:00:00 2001 From: Boris Ostrovsky Date: Thu, 15 Sep 2016 11:15:31 -0400 Subject: [PATCH] libacpi: Prevent GPL-only code from seeping into non-GPL binaries Some code (specifically, introduced by commit 801d469ad ("[HVM] ACPI support patch 3 of 4: ACPI _PRT table.")) has only been licensed by GPLv2.1 We want to prevent this code from showing up in non-GPL binaries. Signed-off-by: Boris Ostrovsky --- tools/firmware/hvmloader/Makefile | 4 ++-- tools/libacpi/Makefile | 9 ++++++--- tools/libacpi/mk_dsdt.c | 10 ++++++++++ 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/tools/firmware/hvmloader/Makefile b/tools/firmware/hvmloader/Makefile index 9fa9bcc..dc21cdf 100644 --- a/tools/firmware/hvmloader/Makefile +++ b/tools/firmware/hvmloader/Makefile @@ -69,7 +69,7 @@ all: acpi subdirs-all .PHONY: acpi acpi: - $(MAKE) -C $(ACPI_PATH) ACPI_BUILD_DIR=$(CURDIR) + $(MAKE) -C $(ACPI_PATH) ACPI_BUILD_DIR=$(CURDIR) GPL=true rombios.o: roms.inc smbios.o: CFLAGS += -D__SMBIOS_DATE__="\"$(SMBIOS_REL_DATE)\"" @@ -119,7 +119,7 @@ endif clean: subdirs-clean rm -f roms.inc roms.inc.new acpi.h rm -f hvmloader hvmloader.tmp *.o $(DEPS) - $(MAKE) -C $(ACPI_PATH) ACPI_BUILD_DIR=$(CURDIR) clean + $(MAKE) -C $(ACPI_PATH) ACPI_BUILD_DIR=$(CURDIR) GPL=true clean .PHONY: distclean distclean: clean diff --git a/tools/libacpi/Makefile b/tools/libacpi/Makefile index 2d8a954..2fe14d4 100644 --- a/tools/libacpi/Makefile +++ b/tools/libacpi/Makefile @@ -18,7 +18,10 @@ include $(XEN_ROOT)/tools/firmware/Rules.mk MK_DSDT = $(ACPI_BUILD_DIR)/mk_dsdt # Sources to be generated -C_SRC = $(addprefix $(ACPI_BUILD_DIR)/, dsdt_anycpu.c dsdt_15cpu.c dsdt_anycpu_qemu_xen.c dsdt_pvh.c) +C_SRC = $(ACPI_BUILD_DIR)/dsdt_pvh.c +ifeq ($(GPL),true) +C_SRC += $(addprefix $(ACPI_BUILD_DIR)/, dsdt_anycpu.c dsdt_15cpu.c dsdt_anycpu_qemu_xen.c) +endif H_SRC = $(addprefix $(ACPI_BUILD_DIR)/, ssdt_s3.h ssdt_s4.h ssdt_pm.h ssdt_tpm.h) ifeq ($(subst all,,$(MAKECMDGOALS)),) @@ -39,14 +42,14 @@ $(MK_DSDT): mk_dsdt.c $(ACPI_BUILD_DIR)/dsdt_anycpu_qemu_xen.asl: dsdt.asl dsdt_acpi_info.asl $(MK_DSDT) awk 'NR > 1 {print s} {s=$$0}' $< > $(TDIR)/$(@F) cat dsdt_acpi_info.asl >> $(TDIR)/$(@F) - $(MK_DSDT) --debug=$(debug) --dm-version qemu-xen >> $(TDIR)/$(@F) + $(MK_DSDT) --debug=$(debug) --dm-version qemu-xen --gpl >> $(TDIR)/$(@F) cp $(TDIR)/$(@F) $@ # NB. awk invocation is a portable alternative to 'head -n -1' $(ACPI_BUILD_DIR)/dsdt_%cpu.asl: dsdt.asl dsdt_acpi_info.asl $(MK_DSDT) awk 'NR > 1 {print s} {s=$$0}' $< > $(TDIR)/$(@F) cat dsdt_acpi_info.asl >> $(TDIR)/$(@F) - $(MK_DSDT) --debug=$(debug) --maxcpu $* >> $(TDIR)/$(@F) + $(MK_DSDT) --debug=$(debug) --maxcpu $* --gpl >> $(TDIR)/$(@F) cp $(TDIR)/$(@F) $@ $(ACPI_BUILD_DIR)/dsdt_pvh.asl: dsdt_acpi_info.asl $(MK_DSDT) diff --git a/tools/libacpi/mk_dsdt.c b/tools/libacpi/mk_dsdt.c index 30477fd..c79e95f 100644 --- a/tools/libacpi/mk_dsdt.c +++ b/tools/libacpi/mk_dsdt.c @@ -99,6 +99,7 @@ static struct option options[] = { { "maxcpu", 1, 0, 'c' }, { "dm-version", 1, 0, 'q' }, { "debug", 1, 0, 'd' }, + { "gpl", 0,0,'g' }, { 0, 0, 0, 0 } }; @@ -106,6 +107,7 @@ int main(int argc, char **argv) { unsigned int slot, dev, intx, link, cpu, max_cpus = HVM_MAX_VCPUS; dm_version dm_version = QEMU_XEN_TRADITIONAL; + bool gpl = false; for ( ; ; ) { @@ -147,6 +149,9 @@ int main(int argc, char **argv) if (*optarg == 'y') debug = true; break; + case 'g': + gpl = true; + break; default: return -1; } @@ -293,6 +298,9 @@ int main(int argc, char **argv) } } pop_block(); + if (!gpl) + goto cont; // Should be "if (gpl) {...}", 'goto' is for pre-review, small diff + /*** PCI-ISA link definitions ***/ /* BUFA: List of ISA IRQs available for linking to PCI INTx. */ stmt("Name", "BUFA, ResourceTemplate() { " @@ -359,6 +367,8 @@ int main(int argc, char **argv) dev, intx, ((dev*4+dev/8+intx)&31)+16); printf("})\n"); +cont: + /* * Each PCI hotplug slot needs at least two methods to handle * the ACPI event: -- 1.8.3.1 --------------D7D99878F673E8550DDCDCAB Content-Type: text/x-patch; name="0001-libacpi-Prevent-GPL-only-code-from-seeping-into-non-.patch" Content-Transfer-Encoding: 7bit Content-Disposition: attachment; filename*0="0001-libacpi-Prevent-GPL-only-code-from-seeping-into-non-.pa"; filename*1="tch" >From 15149f5d6ac15d7e7da650259dfcfaf4097b03ae Mon Sep 17 00:00:00 2001 From: Boris Ostrovsky Date: Thu, 15 Sep 2016 11:15:31 -0400 Subject: [PATCH] libacpi: Prevent GPL-only code from seeping into non-GPL binaries Some code (specifically, introduced by commit 801d469ad ("[HVM] ACPI support patch 3 of 4: ACPI _PRT table.")) has only been licensed by GPLv2.1 We want to prevent this code from showing up in non-GPL binaries. Signed-off-by: Boris Ostrovsky --- tools/firmware/hvmloader/Makefile | 4 ++-- tools/libacpi/Makefile | 9 ++++++--- tools/libacpi/mk_dsdt.c | 10 ++++++++++ 3 files changed, 18 insertions(+), 5 deletions(-) diff --git a/tools/firmware/hvmloader/Makefile b/tools/firmware/hvmloader/Makefile index 9fa9bcc..dc21cdf 100644 --- a/tools/firmware/hvmloader/Makefile +++ b/tools/firmware/hvmloader/Makefile @@ -69,7 +69,7 @@ all: acpi subdirs-all .PHONY: acpi acpi: - $(MAKE) -C $(ACPI_PATH) ACPI_BUILD_DIR=$(CURDIR) + $(MAKE) -C $(ACPI_PATH) ACPI_BUILD_DIR=$(CURDIR) GPL=true rombios.o: roms.inc smbios.o: CFLAGS += -D__SMBIOS_DATE__="\"$(SMBIOS_REL_DATE)\"" @@ -119,7 +119,7 @@ endif clean: subdirs-clean rm -f roms.inc roms.inc.new acpi.h rm -f hvmloader hvmloader.tmp *.o $(DEPS) - $(MAKE) -C $(ACPI_PATH) ACPI_BUILD_DIR=$(CURDIR) clean + $(MAKE) -C $(ACPI_PATH) ACPI_BUILD_DIR=$(CURDIR) GPL=true clean .PHONY: distclean distclean: clean diff --git a/tools/libacpi/Makefile b/tools/libacpi/Makefile index 2d8a954..2fe14d4 100644 --- a/tools/libacpi/Makefile +++ b/tools/libacpi/Makefile @@ -18,7 +18,10 @@ include $(XEN_ROOT)/tools/firmware/Rules.mk MK_DSDT = $(ACPI_BUILD_DIR)/mk_dsdt # Sources to be generated -C_SRC = $(addprefix $(ACPI_BUILD_DIR)/, dsdt_anycpu.c dsdt_15cpu.c dsdt_anycpu_qemu_xen.c dsdt_pvh.c) +C_SRC = $(ACPI_BUILD_DIR)/dsdt_pvh.c +ifeq ($(GPL),true) +C_SRC += $(addprefix $(ACPI_BUILD_DIR)/, dsdt_anycpu.c dsdt_15cpu.c dsdt_anycpu_qemu_xen.c) +endif H_SRC = $(addprefix $(ACPI_BUILD_DIR)/, ssdt_s3.h ssdt_s4.h ssdt_pm.h ssdt_tpm.h) ifeq ($(subst all,,$(MAKECMDGOALS)),) @@ -39,14 +42,14 @@ $(MK_DSDT): mk_dsdt.c $(ACPI_BUILD_DIR)/dsdt_anycpu_qemu_xen.asl: dsdt.asl dsdt_acpi_info.asl $(MK_DSDT) awk 'NR > 1 {print s} {s=$$0}' $< > $(TDIR)/$(@F) cat dsdt_acpi_info.asl >> $(TDIR)/$(@F) - $(MK_DSDT) --debug=$(debug) --dm-version qemu-xen >> $(TDIR)/$(@F) + $(MK_DSDT) --debug=$(debug) --dm-version qemu-xen --gpl >> $(TDIR)/$(@F) cp $(TDIR)/$(@F) $@ # NB. awk invocation is a portable alternative to 'head -n -1' $(ACPI_BUILD_DIR)/dsdt_%cpu.asl: dsdt.asl dsdt_acpi_info.asl $(MK_DSDT) awk 'NR > 1 {print s} {s=$$0}' $< > $(TDIR)/$(@F) cat dsdt_acpi_info.asl >> $(TDIR)/$(@F) - $(MK_DSDT) --debug=$(debug) --maxcpu $* >> $(TDIR)/$(@F) + $(MK_DSDT) --debug=$(debug) --maxcpu $* --gpl >> $(TDIR)/$(@F) cp $(TDIR)/$(@F) $@ $(ACPI_BUILD_DIR)/dsdt_pvh.asl: dsdt_acpi_info.asl $(MK_DSDT) diff --git a/tools/libacpi/mk_dsdt.c b/tools/libacpi/mk_dsdt.c index 30477fd..c79e95f 100644 --- a/tools/libacpi/mk_dsdt.c +++ b/tools/libacpi/mk_dsdt.c @@ -99,6 +99,7 @@ static struct option options[] = { { "maxcpu", 1, 0, 'c' }, { "dm-version", 1, 0, 'q' }, { "debug", 1, 0, 'd' }, + { "gpl", 0,0,'g' }, { 0, 0, 0, 0 } }; @@ -106,6 +107,7 @@ int main(int argc, char **argv) { unsigned int slot, dev, intx, link, cpu, max_cpus = HVM_MAX_VCPUS; dm_version dm_version = QEMU_XEN_TRADITIONAL; + bool gpl = false; for ( ; ; ) { @@ -147,6 +149,9 @@ int main(int argc, char **argv) if (*optarg == 'y') debug = true; break; + case 'g': + gpl = true; + break; default: return -1; } @@ -293,6 +298,9 @@ int main(int argc, char **argv) } } pop_block(); + if (!gpl) + goto cont; // Should be "if (gpl) {...}", 'goto' is for pre-review, small diff + /*** PCI-ISA link definitions ***/ /* BUFA: List of ISA IRQs available for linking to PCI INTx. */ stmt("Name", "BUFA, ResourceTemplate() { " @@ -359,6 +367,8 @@ int main(int argc, char **argv) dev, intx, ((dev*4+dev/8+intx)&31)+16); printf("})\n"); +cont: + /* * Each PCI hotplug slot needs at least two methods to handle * the ACPI event: -- 1.8.3.1 --------------D7D99878F673E8550DDCDCAB Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: base64 Content-Disposition: inline X19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX19fX18KWGVuLWRldmVs IG1haWxpbmcgbGlzdApYZW4tZGV2ZWxAbGlzdHMueGVuLm9yZwpodHRwczovL2xpc3RzLnhlbi5v cmcveGVuLWRldmVsCg== --------------D7D99878F673E8550DDCDCAB--