diff mbox series

[v3,05/34] xen/riscv: introduce guest_atomics.h

Message ID fdbe7261178d057d9868aacea19c1c2b82d2da16.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 Kurochko Dec. 22, 2023, 3:12 p.m. UTC
Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
---
Changes in V3:
 - update the commit message
 - drop TODO commit.
 - add ASSERT_UNREACHABLE for stubs guest functions.
 - Add SPDX & footer
---
Changes in V2:
 - Nothing changed. Only rebase.
---
 xen/arch/riscv/include/asm/guest_atomics.h | 49 ++++++++++++++++++++++
 1 file changed, 49 insertions(+)
 create mode 100644 xen/arch/riscv/include/asm/guest_atomics.h

Comments

Jan Beulich Jan. 11, 2024, 3:57 p.m. UTC | #1
On 22.12.2023 16:12, Oleksii Kurochko wrote:
> Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
> ---
> Changes in V3:
>  - update the commit message

There (still) is none - what is the above about?

> --- /dev/null
> +++ b/xen/arch/riscv/include/asm/guest_atomics.h
> @@ -0,0 +1,49 @@
> +/* SPDX-License-Identifier: GPL-2.0-only */
> +#ifndef __ASM_RISCV_GUEST_ATOMICS_H
> +#define __ASM_RISCV_GUEST_ATOMICS_H
> +
> +#define guest_testop(name)                                                  \
> +static inline int guest_##name(struct domain *d, int nr, volatile void *p)  \
> +{                                                                           \
> +    (void) d;                                                               \
> +    (void) nr;                                                              \
> +    (void) p;                                                               \

What are these and ...

> +    ASSERT_UNREACHABLE();                                                   \
> +                                                                            \
> +    return 0;                                                               \
> +}
> +
> +#define guest_bitop(name)                                                   \
> +static inline void guest_##name(struct domain *d, int nr, volatile void *p) \
> +{                                                                           \
> +    (void) d;                                                               \
> +    (void) nr;                                                              \
> +    (void) p;                                                               \

... these about? If there's a reason for having them, then (nit) there
are stray blanks.

Jan
Oleksii Kurochko Jan. 15, 2024, 9:26 a.m. UTC | #2
On Thu, 2024-01-11 at 16:57 +0100, Jan Beulich wrote:
> On 22.12.2023 16:12, Oleksii Kurochko wrote:
> > Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
> > ---
> > Changes in V3:
> >  - update the commit message
> 
> There (still) is none - what is the above about?
Missed something. I'll double check during providing the next patch
version.
> 
> > --- /dev/null
> > +++ b/xen/arch/riscv/include/asm/guest_atomics.h
> > @@ -0,0 +1,49 @@
> > +/* SPDX-License-Identifier: GPL-2.0-only */
> > +#ifndef __ASM_RISCV_GUEST_ATOMICS_H
> > +#define __ASM_RISCV_GUEST_ATOMICS_H
> > +
> > +#define
> > guest_testop(name)                                                 
> > \
> > +static inline int guest_##name(struct domain *d, int nr, volatile
> > void *p)  \
> > +{                                                                 
> >           \
> > +    (void)
> > d;                                                               \
> > +    (void)
> > nr;                                                              \
> > +    (void)
> > p;                                                               \
> 
> What are these and ...
> 
> > +   
> > ASSERT_UNREACHABLE();                                              
> >      \
> > +                                                                  
> >           \
> > +    return
> > 0;                                                               \
> > +}
> > +
> > +#define
> > guest_bitop(name)                                                  
> > \
> > +static inline void guest_##name(struct domain *d, int nr, volatile
> > void *p) \
> > +{                                                                 
> >           \
> > +    (void)
> > d;                                                               \
> > +    (void)
> > nr;                                                              \
> > +    (void)
> > p;                                                               \
> 
> ... these about? If there's a reason for having them, then (nit)
> there
> are stray blanks.
It is only one reason for that to show that args are unused for time
being.
But I think I can drop these changes.


~ Oleksii
diff mbox series

Patch

diff --git a/xen/arch/riscv/include/asm/guest_atomics.h b/xen/arch/riscv/include/asm/guest_atomics.h
new file mode 100644
index 0000000000..98f7df7b6a
--- /dev/null
+++ b/xen/arch/riscv/include/asm/guest_atomics.h
@@ -0,0 +1,49 @@ 
+/* SPDX-License-Identifier: GPL-2.0-only */
+#ifndef __ASM_RISCV_GUEST_ATOMICS_H
+#define __ASM_RISCV_GUEST_ATOMICS_H
+
+#define guest_testop(name)                                                  \
+static inline int guest_##name(struct domain *d, int nr, volatile void *p)  \
+{                                                                           \
+    (void) d;                                                               \
+    (void) nr;                                                              \
+    (void) p;                                                               \
+                                                                            \
+    ASSERT_UNREACHABLE();                                                   \
+                                                                            \
+    return 0;                                                               \
+}
+
+#define guest_bitop(name)                                                   \
+static inline void guest_##name(struct domain *d, int nr, volatile void *p) \
+{                                                                           \
+    (void) d;                                                               \
+    (void) nr;                                                              \
+    (void) p;                                                               \
+    ASSERT_UNREACHABLE();                                                   \
+}
+
+guest_bitop(set_bit)
+guest_bitop(clear_bit)
+guest_bitop(change_bit)
+
+#undef guest_bitop
+
+guest_testop(test_and_set_bit)
+guest_testop(test_and_clear_bit)
+guest_testop(test_and_change_bit)
+
+#undef guest_testop
+
+#define guest_test_bit(d, nr, p) ((void)(d), test_bit(nr, p))
+
+#endif /* __ASM_RISCV_GUEST_ATOMICS_H */
+
+/*
+ * Local variables:
+ * mode: C
+ * c-file-style: "BSD"
+ * c-basic-offset: 4
+ * indent-tabs-mode: nil
+ * End:
+ */