diff mbox series

add SPDX to arch/arm/*.c

Message ID alpine.DEB.2.22.394.2208121758520.3790@ubuntu-linux-20-04-desktop (mailing list archive)
State New, archived
Headers show
Series add SPDX to arch/arm/*.c | expand

Commit Message

Stefano Stabellini Aug. 13, 2022, 12:59 a.m. UTC
Add SPDX license information to all the *.c files under arch/arm.

Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
---

We need to start from somewhere and I thought arch/arm/*.c would be a
good place to start.

Comments

Julien Grall Aug. 13, 2022, 8:04 a.m. UTC | #1
Hi Stefano,

On 13/08/2022 01:59, Stefano Stabellini wrote:
> Add SPDX license information to all the *.c files under arch/arm.
> 
> Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
> ---
> 
> We need to start from somewhere and I thought arch/arm/*.c would be a
> good place to start.

Thanks for doing it. This will make easier to understand the license in 
each file. There are a couple of places below where the SDPX tag is 
incorrect. How did you figure out the which license to use?

Also, I think we should consider to add a section about SPDX in our 
coding style so new files are using it. So we don't end up with a mix in 
arch/arm/*.

> 
> diff --git a/xen/arch/arm/alternative.c b/xen/arch/arm/alternative.c
> index f03cd943c6..8115f89408 100644
> --- a/xen/arch/arm/alternative.c
> +++ b/xen/arch/arm/alternative.c
> @@ -1,3 +1,4 @@
> +// SPDX-License-Identifier: GPL-2.0

Technically, this is a comment. So this should be /* ... */ to follow 
Xen coding style. Also...

>   /*
>    * alternative runtime patching
>    * inspired by the x86 version

... this comment contains information about the license. As you add the 
SPDX, the "long" version should be removed. This would also make easier 
to verify the SPDX you add match existing license.

> diff --git a/xen/arch/arm/bootfdt.c b/xen/arch/arm/bootfdt.c
> index ec81a45de9..7c986ecb18 100644
> --- a/xen/arch/arm/bootfdt.c
> +++ b/xen/arch/arm/bootfdt.c
> @@ -1,3 +1,4 @@
> +// SPDX-License-Identifier: GPL-2.0
>   /*
>    * Early Device Tree
>    *
> diff --git a/xen/arch/arm/cpuerrata.c b/xen/arch/arm/cpuerrata.c
> index ae649d16ef..887b5426c7 100644
> --- a/xen/arch/arm/cpuerrata.c
> +++ b/xen/arch/arm/cpuerrata.c
> @@ -1,3 +1,4 @@
> +// SPDX-License-Identifier: GPL-2.0

This file had no explicit license. I had a look at the 'git log' and 
AFAICT this was either new code and came from Linux. So this looks fine 
to add GPLv2 here.

>   #include <xen/cpu.h>
>   #include <xen/cpumask.h>
>   #include <xen/init.h>
> diff --git a/xen/arch/arm/cpufeature.c b/xen/arch/arm/cpufeature.c
> index 62d5e1770a..a6253cb57f 100644
> --- a/xen/arch/arm/cpufeature.c
> +++ b/xen/arch/arm/cpufeature.c
> @@ -1,3 +1,4 @@
> +// SPDX-License-Identifier: GPL-2.0
>   /*
>    * Contains CPU feature definitions
>    *
> diff --git a/xen/arch/arm/decode.c b/xen/arch/arm/decode.c
> index f5f6562600..f586c3d781 100644
> --- a/xen/arch/arm/decode.c
> +++ b/xen/arch/arm/decode.c
> @@ -1,3 +1,4 @@
> +// SPDX-License-Identifier: GPL-2.0

This tag doesn't match the license below. It is currently GPLv2+. I 
don't think you can change it without consulting the author. But if it 
is, then it should be mentioned in the commit message.

I remember we discussed in the past that some files were GPLv2+. But I 
can't remember what was the outcome (I can't find the thread). IIRC 
GPLv2+ is a lot more restrictive than GPLv2 and could prevent some 
companies to contribute.

[...]

> diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c
> index 2cd481979c..1a2dac95a9 100644
> --- a/xen/arch/arm/domain.c
> +++ b/xen/arch/arm/domain.c
> @@ -1,3 +1,4 @@
> +// SPDX-License-Identifier: GPL-2.0

Same here about GPLv2+. Please go through the rest of the files to 
confirm the license.

Cheers,
Stefano Stabellini Aug. 15, 2022, 8:32 p.m. UTC | #2
+ Xen maintainers and committers


For context, I wrote a patch to introduce SPDX tags starting from
arch/arm/*.c.

Julien rightfully pointed out that it should be added to our coding
style. He is right. Also as I was reading his replies, I realized there
are a couple of minor coding style things to agree as a group first.
I'll highlighted them here and suggested a proposal. I am happy to go
with the preference of the majority.


## comment format // vs /*

In this patch I used:
// SPDX-License-Identifier: GPL-2.0

But our comment format is actually /* xxx */. I think it is fair to
use /* xxx */ as Julien requested:

/* SPDX-License-Identifier: GPL-2.0 */

Unless there are any concerns, I'll change the patch to /* SPDX... */


## blank line after SPDX

In this series, I didn't add a blank line after the new SPDX comment, no
matter if the following line was an #include or another comment. Now I am
thinking it would be best to add a blank line, as follows:

---
/* SPDX-License-Identifier: GPL-2.0 */

#include <xen/bitops.h>
---

Or:

---
/* SPDX-License-Identifier: GPL-2.0 */

/*
 * xen/arch/arm/device.c
 *
---

Let me know if that's OK for you.


## Original copyright text

As we add the new SDPX tag, It makes sense to remove the older copyright
text at the top of the file, e.g.:

diff --git a/xen/arch/arm/alternative.c b/xen/arch/arm/alternative.c
index f03cd943c6..d0a409e4fd 100644
--- a/xen/arch/arm/alternative.c
+++ b/xen/arch/arm/alternative.c
@@ -1,20 +1,10 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+
 /*
  * alternative runtime patching
  * inspired by the x86 version
  *
  * Copyright (C) 2014-2016 ARM Ltd.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
  */
 
 #include <xen/init.h>


Now the question is whether we want to keep what's left:

/*
 * alternative runtime patching
 * inspired by the x86 version
 *
 * Copyright (C) 2014-2016 ARM Ltd.
 */

The Copyright line is not useful and often stale. Also the other comment
is not very interesting in most cases (I am referring to "alternative
runtime patching inspired by the x86 version"), although I realize this
is going to be a on case-by-case basis.

My suggestion is to get rid of it all unless useful (in most cases it is
not useful), leading to:


diff --git a/xen/arch/arm/alternative.c b/xen/arch/arm/alternative.c
index f03cd943c6..e363176d1f 100644
--- a/xen/arch/arm/alternative.c
+++ b/xen/arch/arm/alternative.c
@@ -1,21 +1,4 @@
-/*
- * alternative runtime patching
- * inspired by the x86 version
- *
- * Copyright (C) 2014-2016 ARM Ltd.
- *
- * This program is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License version 2 as
- * published by the Free Software Foundation.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program.  If not, see <http://www.gnu.org/licenses/>.
- */
+/* SPDX-License-Identifier: GPL-2.0 */
 
 #include <xen/init.h>
 #include <xen/types.h>


Do you guys agree?


Cheers,

Stefano


P.S.
Julien, I'll reply to your other points separately to avoid confusion.


On Sat, 13 Aug 2022, Julien Grall wrote:
> Hi Stefano,
> 
> On 13/08/2022 01:59, Stefano Stabellini wrote:
> > Add SPDX license information to all the *.c files under arch/arm.
> > 
> > Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
> > ---
> > 
> > We need to start from somewhere and I thought arch/arm/*.c would be a
> > good place to start.
> 
> Thanks for doing it. This will make easier to understand the license in each
> file. There are a couple of places below where the SDPX tag is incorrect. How
> did you figure out the which license to use?
> 
> Also, I think we should consider to add a section about SPDX in our coding
> style so new files are using it. So we don't end up with a mix in arch/arm/*.
> 
> > 
> > diff --git a/xen/arch/arm/alternative.c b/xen/arch/arm/alternative.c
> > index f03cd943c6..8115f89408 100644
> > --- a/xen/arch/arm/alternative.c
> > +++ b/xen/arch/arm/alternative.c
> > @@ -1,3 +1,4 @@
> > +// SPDX-License-Identifier: GPL-2.0
> 
> Technically, this is a comment. So this should be /* ... */ to follow Xen
> coding style. Also...
> 
> >   /*
> >    * alternative runtime patching
> >    * inspired by the x86 version
> 
> ... this comment contains information about the license. As you add the SPDX,
> the "long" version should be removed. This would also make easier to verify
> the SPDX you add match existing license.
> 
> > diff --git a/xen/arch/arm/bootfdt.c b/xen/arch/arm/bootfdt.c
> > index ec81a45de9..7c986ecb18 100644
> > --- a/xen/arch/arm/bootfdt.c
> > +++ b/xen/arch/arm/bootfdt.c
> > @@ -1,3 +1,4 @@
> > +// SPDX-License-Identifier: GPL-2.0
> >   /*
> >    * Early Device Tree
> >    *
> > diff --git a/xen/arch/arm/cpuerrata.c b/xen/arch/arm/cpuerrata.c
> > index ae649d16ef..887b5426c7 100644
> > --- a/xen/arch/arm/cpuerrata.c
> > +++ b/xen/arch/arm/cpuerrata.c
> > @@ -1,3 +1,4 @@
> > +// SPDX-License-Identifier: GPL-2.0
> 
> This file had no explicit license. I had a look at the 'git log' and AFAICT
> this was either new code and came from Linux. So this looks fine to add GPLv2
> here.
> 
> >   #include <xen/cpu.h>
> >   #include <xen/cpumask.h>
> >   #include <xen/init.h>
> > diff --git a/xen/arch/arm/cpufeature.c b/xen/arch/arm/cpufeature.c
> > index 62d5e1770a..a6253cb57f 100644
> > --- a/xen/arch/arm/cpufeature.c
> > +++ b/xen/arch/arm/cpufeature.c
> > @@ -1,3 +1,4 @@
> > +// SPDX-License-Identifier: GPL-2.0
> >   /*
> >    * Contains CPU feature definitions
> >    *
> > diff --git a/xen/arch/arm/decode.c b/xen/arch/arm/decode.c
> > index f5f6562600..f586c3d781 100644
> > --- a/xen/arch/arm/decode.c
> > +++ b/xen/arch/arm/decode.c
> > @@ -1,3 +1,4 @@
> > +// SPDX-License-Identifier: GPL-2.0
> 
> This tag doesn't match the license below. It is currently GPLv2+. I don't
> think you can change it without consulting the author. But if it is, then it
> should be mentioned in the commit message.
> 
> I remember we discussed in the past that some files were GPLv2+. But I can't
> remember what was the outcome (I can't find the thread). IIRC GPLv2+ is a lot
> more restrictive than GPLv2 and could prevent some companies to contribute.
> 
> [...]
> 
> > diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c
> > index 2cd481979c..1a2dac95a9 100644
> > --- a/xen/arch/arm/domain.c
> > +++ b/xen/arch/arm/domain.c
> > @@ -1,3 +1,4 @@
> > +// SPDX-License-Identifier: GPL-2.0
> 
> Same here about GPLv2+. Please go through the rest of the files to confirm the
> license.
> 
> Cheers,
> 
> -- 
> Julien Grall
>
Stefano Stabellini Aug. 15, 2022, 8:39 p.m. UTC | #3
On Sat, 13 Aug 2022, Julien Grall wrote:
> Hi Stefano,
> 
> On 13/08/2022 01:59, Stefano Stabellini wrote:
> > Add SPDX license information to all the *.c files under arch/arm.
> > 
> > Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
> > ---
> > 
> > We need to start from somewhere and I thought arch/arm/*.c would be a
> > good place to start.
> 
> Thanks for doing it. This will make easier to understand the license in each
> file. There are a couple of places below where the SDPX tag is incorrect. How
> did you figure out the which license to use?

I used the information in COPYING at the top of the repository. I
realize that I should also have checked the comment header at the top
of each source file, especially in regards to GPLv2 vs, GPLv2 or later.
I'll do that in the next version.


> Also, I think we should consider to add a section about SPDX in our coding
> style so new files are using it. So we don't end up with a mix in arch/arm/*.

Excellent point. I realized there are a couple of style details to sort
out so I sent out a separate email about that.


> > diff --git a/xen/arch/arm/alternative.c b/xen/arch/arm/alternative.c
> > index f03cd943c6..8115f89408 100644
> > --- a/xen/arch/arm/alternative.c
> > +++ b/xen/arch/arm/alternative.c
> > @@ -1,3 +1,4 @@
> > +// SPDX-License-Identifier: GPL-2.0
> 
> Technically, this is a comment. So this should be /* ... */ to follow Xen
> coding style. Also...
> 
> >   /*
> >    * alternative runtime patching
> >    * inspired by the x86 version
> 
> ... this comment contains information about the license. As you add the SPDX,
> the "long" version should be removed. This would also make easier to verify
> the SPDX you add match existing license.

I agree. Also I made a comment about this in the other larger thread to
make sure we are all on the same page about it.


> > diff --git a/xen/arch/arm/bootfdt.c b/xen/arch/arm/bootfdt.c
> > index ec81a45de9..7c986ecb18 100644
> > --- a/xen/arch/arm/bootfdt.c
> > +++ b/xen/arch/arm/bootfdt.c
> > @@ -1,3 +1,4 @@
> > +// SPDX-License-Identifier: GPL-2.0
> >   /*
> >    * Early Device Tree
> >    *
> > diff --git a/xen/arch/arm/cpuerrata.c b/xen/arch/arm/cpuerrata.c
> > index ae649d16ef..887b5426c7 100644
> > --- a/xen/arch/arm/cpuerrata.c
> > +++ b/xen/arch/arm/cpuerrata.c
> > @@ -1,3 +1,4 @@
> > +// SPDX-License-Identifier: GPL-2.0
> 
> This file had no explicit license. I had a look at the 'git log' and AFAICT
> this was either new code and came from Linux. So this looks fine to add GPLv2
> here.

Thanks


> >   #include <xen/cpu.h>
> >   #include <xen/cpumask.h>
> >   #include <xen/init.h>
> > diff --git a/xen/arch/arm/cpufeature.c b/xen/arch/arm/cpufeature.c
> > index 62d5e1770a..a6253cb57f 100644
> > --- a/xen/arch/arm/cpufeature.c
> > +++ b/xen/arch/arm/cpufeature.c
> > @@ -1,3 +1,4 @@
> > +// SPDX-License-Identifier: GPL-2.0
> >   /*
> >    * Contains CPU feature definitions
> >    *
> > diff --git a/xen/arch/arm/decode.c b/xen/arch/arm/decode.c
> > index f5f6562600..f586c3d781 100644
> > --- a/xen/arch/arm/decode.c
> > +++ b/xen/arch/arm/decode.c
> > @@ -1,3 +1,4 @@
> > +// SPDX-License-Identifier: GPL-2.0
> 
> This tag doesn't match the license below. It is currently GPLv2+. I don't
> think you can change it without consulting the author. But if it is, then it
> should be mentioned in the commit message.

[...]

> I remember we discussed in the past that some files were GPLv2+. But I can't
> remember what was the outcome (I can't find the thread). IIRC GPLv2+ is a lot
> more restrictive than GPLv2 and could prevent some companies to contribute.

[...]

> Same here about GPLv2+. Please go through the rest of the files to confirm the
> license.

The change was not intentional: this exercise should not result in any
licensing changes. Next time I'll make sure to check all the
copyright/license headers at the top of the files to make sure they
match the SPDX tag.

Thanks for spotting this.

Cheers,

Stefano
Jürgen Groß Aug. 16, 2022, 5:22 a.m. UTC | #4
On 15.08.22 22:32, Stefano Stabellini wrote:
> + Xen maintainers and committers
> 
> 
> For context, I wrote a patch to introduce SPDX tags starting from
> arch/arm/*.c.

Don't we want something like the kernel's LICENSES directory in order to
have something the SPDX lines refer to? COPYING should maybe adapted, too.


Juergen
Bertrand Marquis Aug. 16, 2022, 7:32 a.m. UTC | #5
Hi Stefano,

> On 15 Aug 2022, at 21:32, Stefano Stabellini <sstabellini@kernel.org> wrote:
> 
> + Xen maintainers and committers
> 
> 
> For context, I wrote a patch to introduce SPDX tags starting from
> arch/arm/*.c.
> 
> Julien rightfully pointed out that it should be added to our coding
> style. He is right. Also as I was reading his replies, I realized there
> are a couple of minor coding style things to agree as a group first.
> I'll highlighted them here and suggested a proposal. I am happy to go
> with the preference of the majority.
> 
> 
> ## comment format // vs /*
> 
> In this patch I used:
> // SPDX-License-Identifier: GPL-2.0
> 
> But our comment format is actually /* xxx */. I think it is fair to
> use /* xxx */ as Julien requested:
> 
> /* SPDX-License-Identifier: GPL-2.0 */
> 
> Unless there are any concerns, I'll change the patch to /* SPDX... */
> 

Agree

> 
> ## blank line after SPDX
> 
> In this series, I didn't add a blank line after the new SPDX comment, no
> matter if the following line was an #include or another comment. Now I am
> thinking it would be best to add a blank line, as follows:
> 
> ---
> /* SPDX-License-Identifier: GPL-2.0 */
> 
> #include <xen/bitops.h>
> ---
> 
> Or:
> 
> ---
> /* SPDX-License-Identifier: GPL-2.0 */
> 
> /*
> * xen/arch/arm/device.c
> *
> ---
> 
> Let me know if that's OK for you.

Agree.
Makes things clearer I think.

> 
> 
> ## Original copyright text
> 
> As we add the new SDPX tag, It makes sense to remove the older copyright
> text at the top of the file, e.g.:
> 
> diff --git a/xen/arch/arm/alternative.c b/xen/arch/arm/alternative.c
> index f03cd943c6..d0a409e4fd 100644
> --- a/xen/arch/arm/alternative.c
> +++ b/xen/arch/arm/alternative.c
> @@ -1,20 +1,10 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +
> /*
>  * alternative runtime patching
>  * inspired by the x86 version
>  *
>  * Copyright (C) 2014-2016 ARM Ltd.
> - *
> - * This program is free software; you can redistribute it and/or modify
> - * it under the terms of the GNU General Public License version 2 as
> - * published by the Free Software Foundation.
> - *
> - * This program is distributed in the hope that it will be useful,
> - * but WITHOUT ANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> - * GNU General Public License for more details.
> - *
> - * You should have received a copy of the GNU General Public License
> - * along with this program.  If not, see <http://www.gnu.org/licenses/>.
>  */
> 
> #include <xen/init.h>
> 
> 
> Now the question is whether we want to keep what's left:
> 
> /*
> * alternative runtime patching
> * inspired by the x86 version
> *
> * Copyright (C) 2014-2016 ARM Ltd.
> */
> 
> The Copyright line is not useful and often stale. Also the other comment
> is not very interesting in most cases (I am referring to "alternative
> runtime patching inspired by the x86 version"), although I realize this
> is going to be a on case-by-case basis.
> 
> My suggestion is to get rid of it all unless useful (in most cases it is
> not useful), leading to:
> 
> 
> diff --git a/xen/arch/arm/alternative.c b/xen/arch/arm/alternative.c
> index f03cd943c6..e363176d1f 100644
> --- a/xen/arch/arm/alternative.c
> +++ b/xen/arch/arm/alternative.c
> @@ -1,21 +1,4 @@
> -/*
> - * alternative runtime patching
> - * inspired by the x86 version
> - *
> - * Copyright (C) 2014-2016 ARM Ltd.
> - *
> - * This program is free software; you can redistribute it and/or modify
> - * it under the terms of the GNU General Public License version 2 as
> - * published by the Free Software Foundation.
> - *
> - * This program is distributed in the hope that it will be useful,
> - * but WITHOUT ANY WARRANTY; without even the implied warranty of
> - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> - * GNU General Public License for more details.
> - *
> - * You should have received a copy of the GNU General Public License
> - * along with this program.  If not, see <http://www.gnu.org/licenses/>.
> - */
> +/* SPDX-License-Identifier: GPL-2.0 */
> 
> #include <xen/init.h>
> #include <xen/types.h>
> 
> 
> Do you guys agree?

Removing the copyright would probably require an agreement from the original implementer.
To prevent troubles and round of questions I would keep the comment and copyright for now.

Cheers
Bertrand

> 
> 
> Cheers,
> 
> Stefano
> 
> 
> P.S.
> Julien, I'll reply to your other points separately to avoid confusion.
> 
> 
> On Sat, 13 Aug 2022, Julien Grall wrote:
>> Hi Stefano,
>> 
>> On 13/08/2022 01:59, Stefano Stabellini wrote:
>>> Add SPDX license information to all the *.c files under arch/arm.
>>> 
>>> Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
>>> ---
>>> 
>>> We need to start from somewhere and I thought arch/arm/*.c would be a
>>> good place to start.
>> 
>> Thanks for doing it. This will make easier to understand the license in each
>> file. There are a couple of places below where the SDPX tag is incorrect. How
>> did you figure out the which license to use?
>> 
>> Also, I think we should consider to add a section about SPDX in our coding
>> style so new files are using it. So we don't end up with a mix in arch/arm/*.
>> 
>>> 
>>> diff --git a/xen/arch/arm/alternative.c b/xen/arch/arm/alternative.c
>>> index f03cd943c6..8115f89408 100644
>>> --- a/xen/arch/arm/alternative.c
>>> +++ b/xen/arch/arm/alternative.c
>>> @@ -1,3 +1,4 @@
>>> +// SPDX-License-Identifier: GPL-2.0
>> 
>> Technically, this is a comment. So this should be /* ... */ to follow Xen
>> coding style. Also...
>> 
>>>  /*
>>>   * alternative runtime patching
>>>   * inspired by the x86 version
>> 
>> ... this comment contains information about the license. As you add the SPDX,
>> the "long" version should be removed. This would also make easier to verify
>> the SPDX you add match existing license.
>> 
>>> diff --git a/xen/arch/arm/bootfdt.c b/xen/arch/arm/bootfdt.c
>>> index ec81a45de9..7c986ecb18 100644
>>> --- a/xen/arch/arm/bootfdt.c
>>> +++ b/xen/arch/arm/bootfdt.c
>>> @@ -1,3 +1,4 @@
>>> +// SPDX-License-Identifier: GPL-2.0
>>>  /*
>>>   * Early Device Tree
>>>   *
>>> diff --git a/xen/arch/arm/cpuerrata.c b/xen/arch/arm/cpuerrata.c
>>> index ae649d16ef..887b5426c7 100644
>>> --- a/xen/arch/arm/cpuerrata.c
>>> +++ b/xen/arch/arm/cpuerrata.c
>>> @@ -1,3 +1,4 @@
>>> +// SPDX-License-Identifier: GPL-2.0
>> 
>> This file had no explicit license. I had a look at the 'git log' and AFAICT
>> this was either new code and came from Linux. So this looks fine to add GPLv2
>> here.
>> 
>>>  #include <xen/cpu.h>
>>>  #include <xen/cpumask.h>
>>>  #include <xen/init.h>
>>> diff --git a/xen/arch/arm/cpufeature.c b/xen/arch/arm/cpufeature.c
>>> index 62d5e1770a..a6253cb57f 100644
>>> --- a/xen/arch/arm/cpufeature.c
>>> +++ b/xen/arch/arm/cpufeature.c
>>> @@ -1,3 +1,4 @@
>>> +// SPDX-License-Identifier: GPL-2.0
>>>  /*
>>>   * Contains CPU feature definitions
>>>   *
>>> diff --git a/xen/arch/arm/decode.c b/xen/arch/arm/decode.c
>>> index f5f6562600..f586c3d781 100644
>>> --- a/xen/arch/arm/decode.c
>>> +++ b/xen/arch/arm/decode.c
>>> @@ -1,3 +1,4 @@
>>> +// SPDX-License-Identifier: GPL-2.0
>> 
>> This tag doesn't match the license below. It is currently GPLv2+. I don't
>> think you can change it without consulting the author. But if it is, then it
>> should be mentioned in the commit message.
>> 
>> I remember we discussed in the past that some files were GPLv2+. But I can't
>> remember what was the outcome (I can't find the thread). IIRC GPLv2+ is a lot
>> more restrictive than GPLv2 and could prevent some companies to contribute.
>> 
>> [...]
>> 
>>> diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c
>>> index 2cd481979c..1a2dac95a9 100644
>>> --- a/xen/arch/arm/domain.c
>>> +++ b/xen/arch/arm/domain.c
>>> @@ -1,3 +1,4 @@
>>> +// SPDX-License-Identifier: GPL-2.0
>> 
>> Same here about GPLv2+. Please go through the rest of the files to confirm the
>> license.
>> 
>> Cheers,
>> 
>> -- 
>> Julien Grall
>>
Stefano Stabellini Aug. 16, 2022, 7:49 p.m. UTC | #6
On Tue, 16 Aug 2022, Juergen Gross wrote:
> On 15.08.22 22:32, Stefano Stabellini wrote:
> > + Xen maintainers and committers
> > 
> > 
> > For context, I wrote a patch to introduce SPDX tags starting from
> > arch/arm/*.c.
> 
> Don't we want something like the kernel's LICENSES directory in order to
> have something the SPDX lines refer to? COPYING should maybe adapted, too.

I don't know if we need to go as far as the LICENSES directory. For
example, Zephyr doesn't have anything of the sort AFAICT. But maybe it
is cleaner to have it?

For the hypervisor, GPL-2.0 and GPL-2.0-or-later are the ones that are
relevant so we would only need LICENSES/preferred/GPL-2.0 initially?
Stefano Stabellini Aug. 16, 2022, 7:53 p.m. UTC | #7
On Tue, 16 Aug 2022, Bertrand Marquis wrote:
> Hi Stefano,
> 
> > On 15 Aug 2022, at 21:32, Stefano Stabellini <sstabellini@kernel.org> wrote:
> > 
> > + Xen maintainers and committers
> > 
> > 
> > For context, I wrote a patch to introduce SPDX tags starting from
> > arch/arm/*.c.
> > 
> > Julien rightfully pointed out that it should be added to our coding
> > style. He is right. Also as I was reading his replies, I realized there
> > are a couple of minor coding style things to agree as a group first.
> > I'll highlighted them here and suggested a proposal. I am happy to go
> > with the preference of the majority.
> > 
> > 
> > ## comment format // vs /*
> > 
> > In this patch I used:
> > // SPDX-License-Identifier: GPL-2.0
> > 
> > But our comment format is actually /* xxx */. I think it is fair to
> > use /* xxx */ as Julien requested:
> > 
> > /* SPDX-License-Identifier: GPL-2.0 */
> > 
> > Unless there are any concerns, I'll change the patch to /* SPDX... */
> > 
> 
> Agree
> 
> > 
> > ## blank line after SPDX
> > 
> > In this series, I didn't add a blank line after the new SPDX comment, no
> > matter if the following line was an #include or another comment. Now I am
> > thinking it would be best to add a blank line, as follows:
> > 
> > ---
> > /* SPDX-License-Identifier: GPL-2.0 */
> > 
> > #include <xen/bitops.h>
> > ---
> > 
> > Or:
> > 
> > ---
> > /* SPDX-License-Identifier: GPL-2.0 */
> > 
> > /*
> > * xen/arch/arm/device.c
> > *
> > ---
> > 
> > Let me know if that's OK for you.
> 
> Agree.
> Makes things clearer I think.
> 
> > 
> > 
> > ## Original copyright text
> > 
> > As we add the new SDPX tag, It makes sense to remove the older copyright
> > text at the top of the file, e.g.:
> > 
> > diff --git a/xen/arch/arm/alternative.c b/xen/arch/arm/alternative.c
> > index f03cd943c6..d0a409e4fd 100644
> > --- a/xen/arch/arm/alternative.c
> > +++ b/xen/arch/arm/alternative.c
> > @@ -1,20 +1,10 @@
> > +/* SPDX-License-Identifier: GPL-2.0 */
> > +
> > /*
> >  * alternative runtime patching
> >  * inspired by the x86 version
> >  *
> >  * Copyright (C) 2014-2016 ARM Ltd.
> > - *
> > - * This program is free software; you can redistribute it and/or modify
> > - * it under the terms of the GNU General Public License version 2 as
> > - * published by the Free Software Foundation.
> > - *
> > - * This program is distributed in the hope that it will be useful,
> > - * but WITHOUT ANY WARRANTY; without even the implied warranty of
> > - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> > - * GNU General Public License for more details.
> > - *
> > - * You should have received a copy of the GNU General Public License
> > - * along with this program.  If not, see <http://www.gnu.org/licenses/>.
> >  */
> > 
> > #include <xen/init.h>
> > 
> > 
> > Now the question is whether we want to keep what's left:
> > 
> > /*
> > * alternative runtime patching
> > * inspired by the x86 version
> > *
> > * Copyright (C) 2014-2016 ARM Ltd.
> > */
> > 
> > The Copyright line is not useful and often stale. Also the other comment
> > is not very interesting in most cases (I am referring to "alternative
> > runtime patching inspired by the x86 version"), although I realize this
> > is going to be a on case-by-case basis.
> > 
> > My suggestion is to get rid of it all unless useful (in most cases it is
> > not useful), leading to:
> > 
> > 
> > diff --git a/xen/arch/arm/alternative.c b/xen/arch/arm/alternative.c
> > index f03cd943c6..e363176d1f 100644
> > --- a/xen/arch/arm/alternative.c
> > +++ b/xen/arch/arm/alternative.c
> > @@ -1,21 +1,4 @@
> > -/*
> > - * alternative runtime patching
> > - * inspired by the x86 version
> > - *
> > - * Copyright (C) 2014-2016 ARM Ltd.
> > - *
> > - * This program is free software; you can redistribute it and/or modify
> > - * it under the terms of the GNU General Public License version 2 as
> > - * published by the Free Software Foundation.
> > - *
> > - * This program is distributed in the hope that it will be useful,
> > - * but WITHOUT ANY WARRANTY; without even the implied warranty of
> > - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
> > - * GNU General Public License for more details.
> > - *
> > - * You should have received a copy of the GNU General Public License
> > - * along with this program.  If not, see <http://www.gnu.org/licenses/>.
> > - */
> > +/* SPDX-License-Identifier: GPL-2.0 */
> > 
> > #include <xen/init.h>
> > #include <xen/types.h>
> > 
> > 
> > Do you guys agree?
> 
> Removing the copyright would probably require an agreement from the original implementer.
> To prevent troubles and round of questions I would keep the comment and copyright for now.

I don't think that we need agreement from the original implementer to
remove the copyright: the copyright information is expressed by the
Signed-off-by line. In fact, every person that changed the file has
partial copyright ownership over it. So I think that we can remove the
Copyright line without asking anyone, as long as we properly retain the
git history.

That said, I am all for preventing troubles and rounds of questions,
especially as we need to change very many files. The more mechanical the
changes the better at this stage.

So maybe it is actually better to only remove the strict necessary (the
license info) and keep everything else. This way it could be almost
scriptable and it is easier to review too.

Any further changes could be done with additional patches on top. I am
going to do that if everyone agrees.





> > Cheers,
> > 
> > Stefano
> > 
> > 
> > P.S.
> > Julien, I'll reply to your other points separately to avoid confusion.
> > 
> > 
> > On Sat, 13 Aug 2022, Julien Grall wrote:
> >> Hi Stefano,
> >> 
> >> On 13/08/2022 01:59, Stefano Stabellini wrote:
> >>> Add SPDX license information to all the *.c files under arch/arm.
> >>> 
> >>> Signed-off-by: Stefano Stabellini <stefano.stabellini@amd.com>
> >>> ---
> >>> 
> >>> We need to start from somewhere and I thought arch/arm/*.c would be a
> >>> good place to start.
> >> 
> >> Thanks for doing it. This will make easier to understand the license in each
> >> file. There are a couple of places below where the SDPX tag is incorrect. How
> >> did you figure out the which license to use?
> >> 
> >> Also, I think we should consider to add a section about SPDX in our coding
> >> style so new files are using it. So we don't end up with a mix in arch/arm/*.
> >> 
> >>> 
> >>> diff --git a/xen/arch/arm/alternative.c b/xen/arch/arm/alternative.c
> >>> index f03cd943c6..8115f89408 100644
> >>> --- a/xen/arch/arm/alternative.c
> >>> +++ b/xen/arch/arm/alternative.c
> >>> @@ -1,3 +1,4 @@
> >>> +// SPDX-License-Identifier: GPL-2.0
> >> 
> >> Technically, this is a comment. So this should be /* ... */ to follow Xen
> >> coding style. Also...
> >> 
> >>>  /*
> >>>   * alternative runtime patching
> >>>   * inspired by the x86 version
> >> 
> >> ... this comment contains information about the license. As you add the SPDX,
> >> the "long" version should be removed. This would also make easier to verify
> >> the SPDX you add match existing license.
> >> 
> >>> diff --git a/xen/arch/arm/bootfdt.c b/xen/arch/arm/bootfdt.c
> >>> index ec81a45de9..7c986ecb18 100644
> >>> --- a/xen/arch/arm/bootfdt.c
> >>> +++ b/xen/arch/arm/bootfdt.c
> >>> @@ -1,3 +1,4 @@
> >>> +// SPDX-License-Identifier: GPL-2.0
> >>>  /*
> >>>   * Early Device Tree
> >>>   *
> >>> diff --git a/xen/arch/arm/cpuerrata.c b/xen/arch/arm/cpuerrata.c
> >>> index ae649d16ef..887b5426c7 100644
> >>> --- a/xen/arch/arm/cpuerrata.c
> >>> +++ b/xen/arch/arm/cpuerrata.c
> >>> @@ -1,3 +1,4 @@
> >>> +// SPDX-License-Identifier: GPL-2.0
> >> 
> >> This file had no explicit license. I had a look at the 'git log' and AFAICT
> >> this was either new code and came from Linux. So this looks fine to add GPLv2
> >> here.
> >> 
> >>>  #include <xen/cpu.h>
> >>>  #include <xen/cpumask.h>
> >>>  #include <xen/init.h>
> >>> diff --git a/xen/arch/arm/cpufeature.c b/xen/arch/arm/cpufeature.c
> >>> index 62d5e1770a..a6253cb57f 100644
> >>> --- a/xen/arch/arm/cpufeature.c
> >>> +++ b/xen/arch/arm/cpufeature.c
> >>> @@ -1,3 +1,4 @@
> >>> +// SPDX-License-Identifier: GPL-2.0
> >>>  /*
> >>>   * Contains CPU feature definitions
> >>>   *
> >>> diff --git a/xen/arch/arm/decode.c b/xen/arch/arm/decode.c
> >>> index f5f6562600..f586c3d781 100644
> >>> --- a/xen/arch/arm/decode.c
> >>> +++ b/xen/arch/arm/decode.c
> >>> @@ -1,3 +1,4 @@
> >>> +// SPDX-License-Identifier: GPL-2.0
> >> 
> >> This tag doesn't match the license below. It is currently GPLv2+. I don't
> >> think you can change it without consulting the author. But if it is, then it
> >> should be mentioned in the commit message.
> >> 
> >> I remember we discussed in the past that some files were GPLv2+. But I can't
> >> remember what was the outcome (I can't find the thread). IIRC GPLv2+ is a lot
> >> more restrictive than GPLv2 and could prevent some companies to contribute.
> >> 
> >> [...]
> >> 
> >>> diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c
> >>> index 2cd481979c..1a2dac95a9 100644
> >>> --- a/xen/arch/arm/domain.c
> >>> +++ b/xen/arch/arm/domain.c
> >>> @@ -1,3 +1,4 @@
> >>> +// SPDX-License-Identifier: GPL-2.0
> >> 
> >> Same here about GPLv2+. Please go through the rest of the files to confirm the
> >> license.
> >> 
> >> Cheers,
> >> 
> >> -- 
> >> Julien Grall
> >> 
>
Jürgen Groß Aug. 17, 2022, 5:17 a.m. UTC | #8
On 16.08.22 21:49, Stefano Stabellini wrote:
> On Tue, 16 Aug 2022, Juergen Gross wrote:
>> On 15.08.22 22:32, Stefano Stabellini wrote:
>>> + Xen maintainers and committers
>>>
>>>
>>> For context, I wrote a patch to introduce SPDX tags starting from
>>> arch/arm/*.c.
>>
>> Don't we want something like the kernel's LICENSES directory in order to
>> have something the SPDX lines refer to? COPYING should maybe adapted, too.
> 
> I don't know if we need to go as far as the LICENSES directory. For
> example, Zephyr doesn't have anything of the sort AFAICT. But maybe it
> is cleaner to have it?

I would think so.

> For the hypervisor, GPL-2.0 and GPL-2.0-or-later are the ones that are
> relevant so we would only need LICENSES/preferred/GPL-2.0 initially?

I don't think we really need the "preferred" directory level.

And I do think that at least in the include/public directory we have many
files with MIT license. There might be BSD ones at other places, too.


Juergen
diff mbox series

Patch

diff --git a/xen/arch/arm/alternative.c b/xen/arch/arm/alternative.c
index f03cd943c6..8115f89408 100644
--- a/xen/arch/arm/alternative.c
+++ b/xen/arch/arm/alternative.c
@@ -1,3 +1,4 @@ 
+// SPDX-License-Identifier: GPL-2.0
 /*
  * alternative runtime patching
  * inspired by the x86 version
diff --git a/xen/arch/arm/bootfdt.c b/xen/arch/arm/bootfdt.c
index ec81a45de9..7c986ecb18 100644
--- a/xen/arch/arm/bootfdt.c
+++ b/xen/arch/arm/bootfdt.c
@@ -1,3 +1,4 @@ 
+// SPDX-License-Identifier: GPL-2.0
 /*
  * Early Device Tree
  *
diff --git a/xen/arch/arm/cpuerrata.c b/xen/arch/arm/cpuerrata.c
index ae649d16ef..887b5426c7 100644
--- a/xen/arch/arm/cpuerrata.c
+++ b/xen/arch/arm/cpuerrata.c
@@ -1,3 +1,4 @@ 
+// SPDX-License-Identifier: GPL-2.0
 #include <xen/cpu.h>
 #include <xen/cpumask.h>
 #include <xen/init.h>
diff --git a/xen/arch/arm/cpufeature.c b/xen/arch/arm/cpufeature.c
index 62d5e1770a..a6253cb57f 100644
--- a/xen/arch/arm/cpufeature.c
+++ b/xen/arch/arm/cpufeature.c
@@ -1,3 +1,4 @@ 
+// SPDX-License-Identifier: GPL-2.0
 /*
  * Contains CPU feature definitions
  *
diff --git a/xen/arch/arm/decode.c b/xen/arch/arm/decode.c
index f5f6562600..f586c3d781 100644
--- a/xen/arch/arm/decode.c
+++ b/xen/arch/arm/decode.c
@@ -1,3 +1,4 @@ 
+// SPDX-License-Identifier: GPL-2.0
 /*
  * xen/arch/arm/decode.c
  *
diff --git a/xen/arch/arm/device.c b/xen/arch/arm/device.c
index 70cd6c1a19..e5e8f806e0 100644
--- a/xen/arch/arm/device.c
+++ b/xen/arch/arm/device.c
@@ -1,3 +1,4 @@ 
+// SPDX-License-Identifier: GPL-2.0
 /*
  * xen/arch/arm/device.c
  *
diff --git a/xen/arch/arm/dm.c b/xen/arch/arm/dm.c
index 1b3fd6bc7d..90d403b767 100644
--- a/xen/arch/arm/dm.c
+++ b/xen/arch/arm/dm.c
@@ -1,3 +1,4 @@ 
+// SPDX-License-Identifier: GPL-2.0
 /*
  * Copyright (c) 2019 Arm ltd.
  *
diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c
index 2cd481979c..1a2dac95a9 100644
--- a/xen/arch/arm/domain.c
+++ b/xen/arch/arm/domain.c
@@ -1,3 +1,4 @@ 
+// SPDX-License-Identifier: GPL-2.0
 /*
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
diff --git a/xen/arch/arm/domain_build.c b/xen/arch/arm/domain_build.c
index 3fd1186b53..a29207b582 100644
--- a/xen/arch/arm/domain_build.c
+++ b/xen/arch/arm/domain_build.c
@@ -1,3 +1,4 @@ 
+// SPDX-License-Identifier: GPL-2.0
 #include <xen/init.h>
 #include <xen/compile.h>
 #include <xen/lib.h>
diff --git a/xen/arch/arm/domain_page.c b/xen/arch/arm/domain_page.c
index 71182575f9..d6f62a5db0 100644
--- a/xen/arch/arm/domain_page.c
+++ b/xen/arch/arm/domain_page.c
@@ -1,3 +1,4 @@ 
+// SPDX-License-Identifier: GPL-2.0
 #include <xen/mm.h>
 #include <xen/pmap.h>
 #include <xen/vmap.h>
diff --git a/xen/arch/arm/domctl.c b/xen/arch/arm/domctl.c
index 1baf25c3d9..c882afe6ca 100644
--- a/xen/arch/arm/domctl.c
+++ b/xen/arch/arm/domctl.c
@@ -1,3 +1,4 @@ 
+// SPDX-License-Identifier: GPL-2.0
 /******************************************************************************
  * Arch-specific domctl.c
  *
diff --git a/xen/arch/arm/early_printk.c b/xen/arch/arm/early_printk.c
index 333073d97e..ef74bac110 100644
--- a/xen/arch/arm/early_printk.c
+++ b/xen/arch/arm/early_printk.c
@@ -1,3 +1,4 @@ 
+// SPDX-License-Identifier: GPL-2.0
 /*
  * printk() for use before the final page tables are setup.
  *
diff --git a/xen/arch/arm/gic-v2.c b/xen/arch/arm/gic-v2.c
index bd773bcc67..7a019196ed 100644
--- a/xen/arch/arm/gic-v2.c
+++ b/xen/arch/arm/gic-v2.c
@@ -1,3 +1,4 @@ 
+// SPDX-License-Identifier: GPL-2.0
 /*
  * xen/arch/arm/gic-v2.c
  *
diff --git a/xen/arch/arm/gic-v3-its.c b/xen/arch/arm/gic-v3-its.c
index 9558bad96a..2f3abbcc7c 100644
--- a/xen/arch/arm/gic-v3-its.c
+++ b/xen/arch/arm/gic-v3-its.c
@@ -1,3 +1,4 @@ 
+// SPDX-License-Identifier: GPL-2.0
 /*
  * xen/arch/arm/gic-v3-its.c
  *
diff --git a/xen/arch/arm/gic-v3-lpi.c b/xen/arch/arm/gic-v3-lpi.c
index 61d90eb386..96efd38707 100644
--- a/xen/arch/arm/gic-v3-lpi.c
+++ b/xen/arch/arm/gic-v3-lpi.c
@@ -1,3 +1,4 @@ 
+// SPDX-License-Identifier: GPL-2.0
 /*
  * xen/arch/arm/gic-v3-lpi.c
  *
diff --git a/xen/arch/arm/gic-v3.c b/xen/arch/arm/gic-v3.c
index 64b36cec25..1565d6036a 100644
--- a/xen/arch/arm/gic-v3.c
+++ b/xen/arch/arm/gic-v3.c
@@ -1,3 +1,4 @@ 
+// SPDX-License-Identifier: GPL-2.0
 /*
  * xen/arch/arm/gic-v3.c
  *
diff --git a/xen/arch/arm/gic-vgic.c b/xen/arch/arm/gic-vgic.c
index 98c021f1a8..daf044e62d 100644
--- a/xen/arch/arm/gic-vgic.c
+++ b/xen/arch/arm/gic-vgic.c
@@ -1,3 +1,4 @@ 
+// SPDX-License-Identifier: GPL-2.0
 /*
  * xen/arch/arm/gic-vgic.c
  *
diff --git a/xen/arch/arm/gic.c b/xen/arch/arm/gic.c
index 3b0331b538..fc2789b2dd 100644
--- a/xen/arch/arm/gic.c
+++ b/xen/arch/arm/gic.c
@@ -1,3 +1,4 @@ 
+// SPDX-License-Identifier: GPL-2.0
 /*
  * xen/arch/arm/gic.c
  *
diff --git a/xen/arch/arm/guest_atomics.c b/xen/arch/arm/guest_atomics.c
index 1b78a062f0..e321840cd1 100644
--- a/xen/arch/arm/guest_atomics.c
+++ b/xen/arch/arm/guest_atomics.c
@@ -1,3 +1,4 @@ 
+// SPDX-License-Identifier: GPL-2.0
 /*
  * arch/arm/guest_atomics.c
  *
diff --git a/xen/arch/arm/guest_walk.c b/xen/arch/arm/guest_walk.c
index 87de40d0cb..60c3090da9 100644
--- a/xen/arch/arm/guest_walk.c
+++ b/xen/arch/arm/guest_walk.c
@@ -1,3 +1,4 @@ 
+// SPDX-License-Identifier: GPL-2.0
 /*
  * Guest page table walk
  * Copyright (c) 2017 Sergej Proskurin <proskurin@sec.in.tum.de>
diff --git a/xen/arch/arm/guestcopy.c b/xen/arch/arm/guestcopy.c
index abb6236e27..1a88d8bc2b 100644
--- a/xen/arch/arm/guestcopy.c
+++ b/xen/arch/arm/guestcopy.c
@@ -1,3 +1,4 @@ 
+// SPDX-License-Identifier: GPL-2.0
 #include <xen/domain_page.h>
 #include <xen/guest_access.h>
 #include <xen/lib.h>
diff --git a/xen/arch/arm/hvm.c b/xen/arch/arm/hvm.c
index fc1a52767d..c062846da6 100644
--- a/xen/arch/arm/hvm.c
+++ b/xen/arch/arm/hvm.c
@@ -1,3 +1,4 @@ 
+// SPDX-License-Identifier: GPL-2.0
 /*
  * arch/arm/hvm.c
  *
diff --git a/xen/arch/arm/io.c b/xen/arch/arm/io.c
index 4ce94243aa..3e513cd778 100644
--- a/xen/arch/arm/io.c
+++ b/xen/arch/arm/io.c
@@ -1,3 +1,4 @@ 
+// SPDX-License-Identifier: GPL-2.0
 /*
  * xen/arch/arm/io.c
  *
diff --git a/xen/arch/arm/ioreq.c b/xen/arch/arm/ioreq.c
index 1338c86adb..cf0cb465c6 100644
--- a/xen/arch/arm/ioreq.c
+++ b/xen/arch/arm/ioreq.c
@@ -1,3 +1,4 @@ 
+// SPDX-License-Identifier: GPL-2.0
 /*
  * arm/ioreq.c: hardware virtual machine I/O emulation
  *
diff --git a/xen/arch/arm/irq.c b/xen/arch/arm/irq.c
index fd0c15fffd..9f007a524b 100644
--- a/xen/arch/arm/irq.c
+++ b/xen/arch/arm/irq.c
@@ -1,3 +1,4 @@ 
+// SPDX-License-Identifier: GPL-2.0
 /*
  * xen/arch/arm/irq.c
  *
diff --git a/xen/arch/arm/kernel.c b/xen/arch/arm/kernel.c
index 2556a45c38..8cccd2fa7c 100644
--- a/xen/arch/arm/kernel.c
+++ b/xen/arch/arm/kernel.c
@@ -1,3 +1,4 @@ 
+// SPDX-License-Identifier: GPL-2.0
 /*
  * Kernel image loading.
  *
diff --git a/xen/arch/arm/livepatch.c b/xen/arch/arm/livepatch.c
index 57abc746e6..bbd8e14012 100644
--- a/xen/arch/arm/livepatch.c
+++ b/xen/arch/arm/livepatch.c
@@ -1,3 +1,4 @@ 
+// SPDX-License-Identifier: GPL-2.0
 /*
  *  Copyright (C) 2016 Citrix Systems R&D Ltd.
  */
diff --git a/xen/arch/arm/mem_access.c b/xen/arch/arm/mem_access.c
index 3e3620294c..8a6cc267c4 100644
--- a/xen/arch/arm/mem_access.c
+++ b/xen/arch/arm/mem_access.c
@@ -1,3 +1,4 @@ 
+// SPDX-License-Identifier: GPL-2.0
 /*
  * arch/arm/mem_access.c
  *
diff --git a/xen/arch/arm/mm.c b/xen/arch/arm/mm.c
index b42cddb1b4..7ad285902b 100644
--- a/xen/arch/arm/mm.c
+++ b/xen/arch/arm/mm.c
@@ -1,3 +1,4 @@ 
+// SPDX-License-Identifier: GPL-2.0
 /*
  * xen/arch/arm/mm.c
  *
diff --git a/xen/arch/arm/monitor.c b/xen/arch/arm/monitor.c
index 8c4a396e3c..328808e1cf 100644
--- a/xen/arch/arm/monitor.c
+++ b/xen/arch/arm/monitor.c
@@ -1,3 +1,4 @@ 
+// SPDX-License-Identifier: GPL-2.0
 /*
  * arch/arm/monitor.c
  *
diff --git a/xen/arch/arm/p2m.c b/xen/arch/arm/p2m.c
index 8449f97fe7..b2a5bd4fba 100644
--- a/xen/arch/arm/p2m.c
+++ b/xen/arch/arm/p2m.c
@@ -1,3 +1,4 @@ 
+// SPDX-License-Identifier: GPL-2.0
 #include <xen/cpu.h>
 #include <xen/domain_page.h>
 #include <xen/iocap.h>
diff --git a/xen/arch/arm/percpu.c b/xen/arch/arm/percpu.c
index 25442c48fe..557983ddf5 100644
--- a/xen/arch/arm/percpu.c
+++ b/xen/arch/arm/percpu.c
@@ -1,3 +1,4 @@ 
+// SPDX-License-Identifier: GPL-2.0
 #include <xen/percpu.h>
 #include <xen/cpu.h>
 #include <xen/init.h>
diff --git a/xen/arch/arm/physdev.c b/xen/arch/arm/physdev.c
index 95a8cdc0ee..851a1f6569 100644
--- a/xen/arch/arm/physdev.c
+++ b/xen/arch/arm/physdev.c
@@ -1,3 +1,4 @@ 
+// SPDX-License-Identifier: GPL-2.0
 /******************************************************************************
  * Arch-specific physdev.c
  *
diff --git a/xen/arch/arm/platform.c b/xen/arch/arm/platform.c
index 4db5bbb4c5..a32aeeb52e 100644
--- a/xen/arch/arm/platform.c
+++ b/xen/arch/arm/platform.c
@@ -1,3 +1,4 @@ 
+// SPDX-License-Identifier: GPL-2.0
 /*
  * xen/arch/arm/platform.c
  *
diff --git a/xen/arch/arm/platform_hypercall.c b/xen/arch/arm/platform_hypercall.c
index 403cc84324..2119a2f2c9 100644
--- a/xen/arch/arm/platform_hypercall.c
+++ b/xen/arch/arm/platform_hypercall.c
@@ -1,3 +1,4 @@ 
+// SPDX-License-Identifier: GPL-2.0
 /******************************************************************************
  * platform_hypercall.c
  *
diff --git a/xen/arch/arm/processor.c b/xen/arch/arm/processor.c
index acad8b31d6..bce17bd1e0 100644
--- a/xen/arch/arm/processor.c
+++ b/xen/arch/arm/processor.c
@@ -1,3 +1,4 @@ 
+// SPDX-License-Identifier: GPL-2.0
 /*
  * xen/arch/arm/processor.c
  *
diff --git a/xen/arch/arm/psci.c b/xen/arch/arm/psci.c
index 0c90c2305c..4ea13e56ca 100644
--- a/xen/arch/arm/psci.c
+++ b/xen/arch/arm/psci.c
@@ -1,3 +1,4 @@ 
+// SPDX-License-Identifier: GPL-2.0
 /*
  * xen/arch/arm/psci.c
  *
diff --git a/xen/arch/arm/setup.c b/xen/arch/arm/setup.c
index 500307edc0..1394d15406 100644
--- a/xen/arch/arm/setup.c
+++ b/xen/arch/arm/setup.c
@@ -1,3 +1,4 @@ 
+// SPDX-License-Identifier: GPL-2.0
 /*
  * xen/arch/arm/setup.c
  *
diff --git a/xen/arch/arm/shutdown.c b/xen/arch/arm/shutdown.c
index 0606cb84b3..9691765716 100644
--- a/xen/arch/arm/shutdown.c
+++ b/xen/arch/arm/shutdown.c
@@ -1,3 +1,4 @@ 
+// SPDX-License-Identifier: GPL-2.0
 #include <xen/console.h>
 #include <xen/cpu.h>
 #include <xen/delay.h>
diff --git a/xen/arch/arm/smp.c b/xen/arch/arm/smp.c
index 5823a69d3e..03890cd9c4 100644
--- a/xen/arch/arm/smp.c
+++ b/xen/arch/arm/smp.c
@@ -1,3 +1,4 @@ 
+// SPDX-License-Identifier: GPL-2.0
 #include <xen/mm.h>
 #include <asm/system.h>
 #include <asm/smp.h>
diff --git a/xen/arch/arm/smpboot.c b/xen/arch/arm/smpboot.c
index f7bda3a18b..edbd0171a9 100644
--- a/xen/arch/arm/smpboot.c
+++ b/xen/arch/arm/smpboot.c
@@ -1,3 +1,4 @@ 
+// SPDX-License-Identifier: GPL-2.0
 /*
  * xen/arch/arm/smpboot.c
  *
diff --git a/xen/arch/arm/sysctl.c b/xen/arch/arm/sysctl.c
index f87944e847..fe1dbe3d9d 100644
--- a/xen/arch/arm/sysctl.c
+++ b/xen/arch/arm/sysctl.c
@@ -1,3 +1,4 @@ 
+// SPDX-License-Identifier: GPL-2.0
 /******************************************************************************
  * Arch-specific sysctl.c
  *
diff --git a/xen/arch/arm/time.c b/xen/arch/arm/time.c
index dec53b5f7d..78ec806c5f 100644
--- a/xen/arch/arm/time.c
+++ b/xen/arch/arm/time.c
@@ -1,3 +1,4 @@ 
+// SPDX-License-Identifier: GPL-2.0
 /*
  * xen/arch/arm/time.c
  *
diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c
index 79f9ed0725..8036fcd1ed 100644
--- a/xen/arch/arm/traps.c
+++ b/xen/arch/arm/traps.c
@@ -1,3 +1,4 @@ 
+// SPDX-License-Identifier: GPL-2.0
 /*
  * xen/arch/arm/traps.c
  *
diff --git a/xen/arch/arm/vcpreg.c b/xen/arch/arm/vcpreg.c
index b5fbbe1cb8..b549bca406 100644
--- a/xen/arch/arm/vcpreg.c
+++ b/xen/arch/arm/vcpreg.c
@@ -1,3 +1,4 @@ 
+// SPDX-License-Identifier: GPL-2.0
 /*
  * xen/arch/arm/arm64/vcpreg.c
  *
diff --git a/xen/arch/arm/vgic-v2.c b/xen/arch/arm/vgic-v2.c
index b1bd7a46ad..30419554af 100644
--- a/xen/arch/arm/vgic-v2.c
+++ b/xen/arch/arm/vgic-v2.c
@@ -1,3 +1,4 @@ 
+// SPDX-License-Identifier: GPL-2.0
 /*
  * xen/arch/arm/vgic-v2.c
  *
diff --git a/xen/arch/arm/vgic-v3-its.c b/xen/arch/arm/vgic-v3-its.c
index 58d939b85f..30238448b1 100644
--- a/xen/arch/arm/vgic-v3-its.c
+++ b/xen/arch/arm/vgic-v3-its.c
@@ -1,3 +1,4 @@ 
+// SPDX-License-Identifier: GPL-2.0
 /*
  * xen/arch/arm/vgic-v3-its.c
  *
diff --git a/xen/arch/arm/vgic-v3.c b/xen/arch/arm/vgic-v3.c
index 7fb99a9ff2..201b68492e 100644
--- a/xen/arch/arm/vgic-v3.c
+++ b/xen/arch/arm/vgic-v3.c
@@ -1,3 +1,4 @@ 
+// SPDX-License-Identifier: GPL-2.0
 /*
  * xen/arch/arm/vgic-v3.c
  *
diff --git a/xen/arch/arm/vgic.c b/xen/arch/arm/vgic.c
index 83386cf3d5..a93f872709 100644
--- a/xen/arch/arm/vgic.c
+++ b/xen/arch/arm/vgic.c
@@ -1,3 +1,4 @@ 
+// SPDX-License-Identifier: GPL-2.0
 /*
  * xen/arch/arm/vgic.c
  *
diff --git a/xen/arch/arm/vm_event.c b/xen/arch/arm/vm_event.c
index eaac92078d..1edb5acabb 100644
--- a/xen/arch/arm/vm_event.c
+++ b/xen/arch/arm/vm_event.c
@@ -1,3 +1,4 @@ 
+// SPDX-License-Identifier: GPL-2.0
 /*
  * arch/arm/vm_event.c
  *
diff --git a/xen/arch/arm/vpci.c b/xen/arch/arm/vpci.c
index a9fc5817f9..57048ae705 100644
--- a/xen/arch/arm/vpci.c
+++ b/xen/arch/arm/vpci.c
@@ -1,3 +1,4 @@ 
+// SPDX-License-Identifier: GPL-2.0
 /*
  * xen/arch/arm/vpci.c
  *
diff --git a/xen/arch/arm/vpl011.c b/xen/arch/arm/vpl011.c
index 43522d48fd..34e85b7a9e 100644
--- a/xen/arch/arm/vpl011.c
+++ b/xen/arch/arm/vpl011.c
@@ -1,3 +1,4 @@ 
+// SPDX-License-Identifier: GPL-2.0
 /*
  * arch/arm/vpl011.c
  *
diff --git a/xen/arch/arm/vpsci.c b/xen/arch/arm/vpsci.c
index 744d43ec27..4a14ab1384 100644
--- a/xen/arch/arm/vpsci.c
+++ b/xen/arch/arm/vpsci.c
@@ -1,3 +1,4 @@ 
+// SPDX-License-Identifier: GPL-2.0
 /*
  * This program is free software; you can redistribute it and/or modify
  * it under the terms of the GNU General Public License as published by
diff --git a/xen/arch/arm/vsmc.c b/xen/arch/arm/vsmc.c
index 676740ef15..e8520cdd35 100644
--- a/xen/arch/arm/vsmc.c
+++ b/xen/arch/arm/vsmc.c
@@ -1,3 +1,4 @@ 
+// SPDX-License-Identifier: GPL-2.0
 /*
  * xen/arch/arm/vsmc.c
  *
diff --git a/xen/arch/arm/vtimer.c b/xen/arch/arm/vtimer.c
index aeaea78e4c..0ae135b0bc 100644
--- a/xen/arch/arm/vtimer.c
+++ b/xen/arch/arm/vtimer.c
@@ -1,3 +1,4 @@ 
+// SPDX-License-Identifier: GPL-2.0
 /*
  * xen/arch/arm/vtimer.c
  *
diff --git a/xen/arch/arm/vuart.c b/xen/arch/arm/vuart.c
index 80d4755d43..c75ecec95f 100644
--- a/xen/arch/arm/vuart.c
+++ b/xen/arch/arm/vuart.c
@@ -1,3 +1,4 @@ 
+// SPDX-License-Identifier: GPL-2.0
 /*
  * xen/arch/arm/vuart.c
  *