[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [Xen-devel] [PATCH v3 00/19] Make ACPI builder available to components other than hvmloader



On 09/15/2016 10:21 AM, Jan Beulich wrote:
>>>> On 15.09.16 at 16:07, <boris.ostrovsky@xxxxxxxxxx> 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 <boris.ostrovsky@xxxxxxxxxx>
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 <boris.ostrovsky@xxxxxxxxxx>
---
 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


Attachment: 0001-libacpi-Prevent-GPL-only-code-from-seeping-into-non-.patch
Description: Text Data

_______________________________________________
Xen-devel mailing list
Xen-devel@xxxxxxxxxxxxx
https://lists.xen.org/xen-devel

 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.