diff mbox series

[v2,11/39] xen/riscv: introduce asm/nospec.h

Message ID aa2ff1df494f82f7c045f913371d3b9d04962a5e.1700761381.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 Kurochko Nov. 24, 2023, 10:30 a.m. UTC
Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
---
Changes in V2:
 - Nothing changed. Only rebase.
---
 xen/arch/riscv/include/asm/nospec.h | 25 +++++++++++++++++++++++++
 1 file changed, 25 insertions(+)
 create mode 100644 xen/arch/riscv/include/asm/nospec.h

Comments

Jan Beulich Dec. 7, 2023, 2:28 p.m. UTC | #1
On 24.11.2023 11:30, Oleksii Kurochko wrote:
> --- /dev/null
> +++ b/xen/arch/riscv/include/asm/nospec.h
> @@ -0,0 +1,25 @@
> +/* SPDX-License-Identifier: GPL-2.0 */
> +/* Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. */
> +
> +#ifndef _ASM_RISCV_NOSPEC_H
> +#define _ASM_RISCV_NOSPEC_H
> +
> +static inline bool evaluate_nospec(bool condition)
> +{
> +    return condition;
> +}
> +
> +static inline void block_speculation(void)
> +{
> +}
> +
> +#endif /* _ASM_RISCV_NOSPEC_H */

This being identical between Arm, PPC, and now RISC-V, wouldn't this be another
asm-generic/ candidate? (Whether such trivial stubs are copyrightable is, as
per earlier remarks, at least questionable to me.)

Jan
Oleksii Kurochko Dec. 8, 2023, 9:33 a.m. UTC | #2
On Thu, 2023-12-07 at 15:28 +0100, Jan Beulich wrote:
> On 24.11.2023 11:30, Oleksii Kurochko wrote:
> > --- /dev/null
> > +++ b/xen/arch/riscv/include/asm/nospec.h
> > @@ -0,0 +1,25 @@
> > +/* SPDX-License-Identifier: GPL-2.0 */
> > +/* Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights
> > Reserved. */
> > +
> > +#ifndef _ASM_RISCV_NOSPEC_H
> > +#define _ASM_RISCV_NOSPEC_H
> > +
> > +static inline bool evaluate_nospec(bool condition)
> > +{
> > +    return condition;
> > +}
> > +
> > +static inline void block_speculation(void)
> > +{
> > +}
> > +
> > +#endif /* _ASM_RISCV_NOSPEC_H */
> 
> This being identical between Arm, PPC, and now RISC-V, wouldn't this
> be another
> asm-generic/ candidate? (Whether such trivial stubs are copyrightable
> is, as
> per earlier remarks, at least questionable to me.)
It is a good candidate to be moved to asm-generic. Thanks for notice
that. I'll update move this patch to generic headers patch series.

I am not sure too but the copyright was presented in Arm's file and
RISC-V's version is just a copy so I decided to leave it.
Does any documented rule exist in which cases copyright should be and
not?

~ Oleksii
Jan Beulich Dec. 8, 2023, 10:23 a.m. UTC | #3
On 08.12.2023 10:33, Oleksii wrote:
> On Thu, 2023-12-07 at 15:28 +0100, Jan Beulich wrote:
>> On 24.11.2023 11:30, Oleksii Kurochko wrote:
>>> --- /dev/null
>>> +++ b/xen/arch/riscv/include/asm/nospec.h
>>> @@ -0,0 +1,25 @@
>>> +/* SPDX-License-Identifier: GPL-2.0 */
>>> +/* Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights
>>> Reserved. */
>>> +
>>> +#ifndef _ASM_RISCV_NOSPEC_H
>>> +#define _ASM_RISCV_NOSPEC_H
>>> +
>>> +static inline bool evaluate_nospec(bool condition)
>>> +{
>>> +    return condition;
>>> +}
>>> +
>>> +static inline void block_speculation(void)
>>> +{
>>> +}
>>> +
>>> +#endif /* _ASM_RISCV_NOSPEC_H */
>>
>> This being identical between Arm, PPC, and now RISC-V, wouldn't this
>> be another
>> asm-generic/ candidate? (Whether such trivial stubs are copyrightable
>> is, as
>> per earlier remarks, at least questionable to me.)
> It is a good candidate to be moved to asm-generic. Thanks for notice
> that. I'll update move this patch to generic headers patch series.
> 
> I am not sure too but the copyright was presented in Arm's file and
> RISC-V's version is just a copy so I decided to leave it.
> Does any documented rule exist in which cases copyright should be and
> not?

I'm afraid there's nothing. But see how PPC has dropped the copyright,
too. Generally I'm of the opinion that purely trivial stubs aren't
sensible to put under a copyright.

Jan
diff mbox series

Patch

diff --git a/xen/arch/riscv/include/asm/nospec.h b/xen/arch/riscv/include/asm/nospec.h
new file mode 100644
index 0000000000..55087fa831
--- /dev/null
+++ b/xen/arch/riscv/include/asm/nospec.h
@@ -0,0 +1,25 @@ 
+/* SPDX-License-Identifier: GPL-2.0 */
+/* Copyright 2018 Amazon.com, Inc. or its affiliates. All Rights Reserved. */
+
+#ifndef _ASM_RISCV_NOSPEC_H
+#define _ASM_RISCV_NOSPEC_H
+
+static inline bool evaluate_nospec(bool condition)
+{
+    return condition;
+}
+
+static inline void block_speculation(void)
+{
+}
+
+#endif /* _ASM_RISCV_NOSPEC_H */
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */