diff mbox series

[v3,07/34] xen/asm-generic: introdure nospec.h

Message ID a1360d3de3da8757c69f11c3fafd99ff65654ae8.1703255175.git.oleksii.kurochko@gmail.com (mailing list archive)
State Superseded
Headers show
Series Enable build of full Xen for RISC-V | expand

Commit Message

Oleksii Dec. 22, 2023, 3:12 p.m. UTC
The <asm/nospec.h> header is similar between Arm, PPC, and RISC-V,
so it has been moved to asm-generic.

Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
---
Changes in V3:
 - new patch.
---
 xen/arch/arm/include/asm/Makefile                 |  1 +
 xen/arch/ppc/include/asm/Makefile                 |  1 +
 xen/arch/ppc/include/asm/nospec.h                 | 15 ---------------
 xen/arch/riscv/include/asm/Makefile               |  1 +
 .../include/asm => include/asm-generic}/nospec.h  | 10 +++++-----
 5 files changed, 8 insertions(+), 20 deletions(-)
 delete mode 100644 xen/arch/ppc/include/asm/nospec.h
 rename xen/{arch/arm/include/asm => include/asm-generic}/nospec.h (54%)

Comments

Jan Beulich Jan. 4, 2024, 11:06 a.m. UTC | #1
On 22.12.2023 16:12, Oleksii Kurochko wrote:
> The <asm/nospec.h> header is similar between Arm, PPC, and RISC-V,
> so it has been moved to asm-generic.
> 
> Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>

Acked-by: Jan Beulich <jbeulich@suse.com>

A word may want saying though on ...

> --- a/xen/arch/arm/include/asm/nospec.h
> +++ b/xen/include/asm-generic/nospec.h
> @@ -1,8 +1,8 @@
> -/* SPDX-License-Identifier: GPL-2.0 */
> -/* Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. */
> +/* SPDX-License-Identifier: GPL-2.0-only */
> +#ifndef _ASM_GENERIC_NOSPEC_H
> +#define _ASM_GENERIC_NOSPEC_H

... the removal of the copyright line.

Jan
Andrew Cooper Jan. 4, 2024, 11:13 a.m. UTC | #2
On 04/01/2024 11:06 am, Jan Beulich wrote:
> On 22.12.2023 16:12, Oleksii Kurochko wrote:
>> The <asm/nospec.h> header is similar between Arm, PPC, and RISC-V,
>> so it has been moved to asm-generic.
>>
>> Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
> Acked-by: Jan Beulich <jbeulich@suse.com>
>
> A word may want saying though on ...
>
>> --- a/xen/arch/arm/include/asm/nospec.h
>> +++ b/xen/include/asm-generic/nospec.h
>> @@ -1,8 +1,8 @@
>> -/* SPDX-License-Identifier: GPL-2.0 */
>> -/* Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. */
>> +/* SPDX-License-Identifier: GPL-2.0-only */
>> +#ifndef _ASM_GENERIC_NOSPEC_H
>> +#define _ASM_GENERIC_NOSPEC_H
> ... the removal of the copyright line.

That isn't a removal of ARM's copyright line.

The two files are similar enough to trigger git-diff's "this was a
rename" logic (see the a vs b paths), despite not being a rename.

It's unfortunate rendering in this case.

~Andrew
Jan Beulich Jan. 4, 2024, 12:03 p.m. UTC | #3
On 04.01.2024 12:13, Andrew Cooper wrote:
> On 04/01/2024 11:06 am, Jan Beulich wrote:
>> On 22.12.2023 16:12, Oleksii Kurochko wrote:
>>> The <asm/nospec.h> header is similar between Arm, PPC, and RISC-V,
>>> so it has been moved to asm-generic.
>>>
>>> Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
>> Acked-by: Jan Beulich <jbeulich@suse.com>
>>
>> A word may want saying though on ...
>>
>>> --- a/xen/arch/arm/include/asm/nospec.h
>>> +++ b/xen/include/asm-generic/nospec.h
>>> @@ -1,8 +1,8 @@
>>> -/* SPDX-License-Identifier: GPL-2.0 */
>>> -/* Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. */
>>> +/* SPDX-License-Identifier: GPL-2.0-only */
>>> +#ifndef _ASM_GENERIC_NOSPEC_H
>>> +#define _ASM_GENERIC_NOSPEC_H
>> ... the removal of the copyright line.
> 
> That isn't a removal of ARM's copyright line.
> 
> The two files are similar enough to trigger git-diff's "this was a
> rename" logic (see the a vs b paths), despite not being a rename.
> 
> It's unfortunate rendering in this case.

Hmm, well, might be. If I had done such a change, I surely wouldn't have
created the file anew, but rather moved one of the existing instances.
Even if it was PPC's that was moved, that was (likely) cloned from Arm's
as well.

Jan
Shawn Anastasio Jan. 5, 2024, 7:02 p.m. UTC | #4
Hi Oleksii,

On 12/22/23 9:12 AM, Oleksii Kurochko wrote:
> The <asm/nospec.h> header is similar between Arm, PPC, and RISC-V,
> so it has been moved to asm-generic.
> 
> Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>

Acked-by: Shawn Anastasio <sanastasio@raptorengineering.com>

Thanks,
Shawn
Oleksii Jan. 8, 2024, 2:58 p.m. UTC | #5
On Thu, 2024-01-04 at 12:06 +0100, Jan Beulich wrote:
> On 22.12.2023 16:12, Oleksii Kurochko wrote:
> > The <asm/nospec.h> header is similar between Arm, PPC, and RISC-V,
> > so it has been moved to asm-generic.
> > 
> > Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
> 
> Acked-by: Jan Beulich <jbeulich@suse.com>
> 
> A word may want saying though on ...
> 
> > --- a/xen/arch/arm/include/asm/nospec.h
> > +++ b/xen/include/asm-generic/nospec.h
> > @@ -1,8 +1,8 @@
> > -/* SPDX-License-Identifier: GPL-2.0 */
> > -/* Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights
> > Reserved. */
> > +/* SPDX-License-Identifier: GPL-2.0-only */
> > +#ifndef _ASM_GENERIC_NOSPEC_H
> > +#define _ASM_GENERIC_NOSPEC_H
> 
> ... the removal of the copyright line.
It was automatically decided by Git to do it this way.

I'll try to make it generate a new file instead of moving/renaming
Arm's nospec.h.

~ Oleksii
diff mbox series

Patch

diff --git a/xen/arch/arm/include/asm/Makefile b/xen/arch/arm/include/asm/Makefile
index c3f4291ee2..dfb4e9e45c 100644
--- a/xen/arch/arm/include/asm/Makefile
+++ b/xen/arch/arm/include/asm/Makefile
@@ -3,6 +3,7 @@  generic-y += altp2m.h
 generic-y += device.h
 generic-y += hardirq.h
 generic-y += iocap.h
+generic-y += nospec.h
 generic-y += numa.h
 generic-y += paging.h
 generic-y += percpu.h
diff --git a/xen/arch/ppc/include/asm/Makefile b/xen/arch/ppc/include/asm/Makefile
index adb752b804..0e96ad54c3 100644
--- a/xen/arch/ppc/include/asm/Makefile
+++ b/xen/arch/ppc/include/asm/Makefile
@@ -5,6 +5,7 @@  generic-y += div64.h
 generic-y += hardirq.h
 generic-y += hypercall.h
 generic-y += iocap.h
+generic-y += nospec.h
 generic-y += numa.h
 generic-y += paging.h
 generic-y += percpu.h
diff --git a/xen/arch/ppc/include/asm/nospec.h b/xen/arch/ppc/include/asm/nospec.h
deleted file mode 100644
index b97322e48d..0000000000
--- a/xen/arch/ppc/include/asm/nospec.h
+++ /dev/null
@@ -1,15 +0,0 @@ 
-/* SPDX-License-Identifier: GPL-2.0-only */
-/* From arch/arm/include/asm/nospec.h. */
-#ifndef __ASM_PPC_NOSPEC_H__
-#define __ASM_PPC_NOSPEC_H__
-
-static inline bool evaluate_nospec(bool condition)
-{
-    return condition;
-}
-
-static inline void block_speculation(void)
-{
-}
-
-#endif /* __ASM_PPC_NOSPEC_H__ */
diff --git a/xen/arch/riscv/include/asm/Makefile b/xen/arch/riscv/include/asm/Makefile
index adb752b804..0e96ad54c3 100644
--- a/xen/arch/riscv/include/asm/Makefile
+++ b/xen/arch/riscv/include/asm/Makefile
@@ -5,6 +5,7 @@  generic-y += div64.h
 generic-y += hardirq.h
 generic-y += hypercall.h
 generic-y += iocap.h
+generic-y += nospec.h
 generic-y += numa.h
 generic-y += paging.h
 generic-y += percpu.h
diff --git a/xen/arch/arm/include/asm/nospec.h b/xen/include/asm-generic/nospec.h
similarity index 54%
rename from xen/arch/arm/include/asm/nospec.h
rename to xen/include/asm-generic/nospec.h
index 51c7aea4f4..5ded9746f3 100644
--- a/xen/arch/arm/include/asm/nospec.h
+++ b/xen/include/asm-generic/nospec.h
@@ -1,8 +1,8 @@ 
-/* SPDX-License-Identifier: GPL-2.0 */
-/* Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. */
+/* SPDX-License-Identifier: GPL-2.0-only */
+#ifndef _ASM_GENERIC_NOSPEC_H
+#define _ASM_GENERIC_NOSPEC_H
 
-#ifndef _ASM_ARM_NOSPEC_H
-#define _ASM_ARM_NOSPEC_H
+#include <xen/stdbool.h>
 
 static inline bool evaluate_nospec(bool condition)
 {
@@ -13,7 +13,7 @@  static inline void block_speculation(void)
 {
 }
 
-#endif /* _ASM_ARM_NOSPEC_H */
+#endif /* _ASM_GENERIC_NOSPEC_H */
 
 /*
  * Local variables: