diff mbox series

[v3,28/34] xen/riscv: add required things to current.h

Message ID 8fd8d3652eafabf5f5586de91d97ecae077b90ea.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:13 p.m. UTC
Add minimal requied things to be able to build full Xen.

Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
---
Changes in V3:
 - add SPDX
 - drop a forward declaration of struct vcpu;
 - update guest_cpu_user_regs() macros
 - replace get_processor_id with smp_processor_id
 - update the commit message
 - code style fixes
---
Changes in V2:
 - Nothing changed. Only rebase.
---
 xen/arch/riscv/include/asm/current.h | 19 +++++++++++++++++++
 1 file changed, 19 insertions(+)

Comments

Jan Beulich Jan. 23, 2024, 11:35 a.m. UTC | #1
On 22.12.2023 16:13, Oleksii Kurochko wrote:> --- a/xen/arch/riscv/include/asm/current.h
> +++ b/xen/arch/riscv/include/asm/current.h
> @@ -3,6 +3,21 @@
>  #ifndef __ASM_CURRENT_H
>  #define __ASM_CURRENT_H
>  
> +#include <xen/bug.h>
> +#include <xen/percpu.h>
> +#include <asm/processor.h>
> +
> +#ifndef __ASSEMBLY__
> +
> +/* Which VCPU is "current" on this PCPU. */
> +DECLARE_PER_CPU(struct vcpu *, curr_vcpu);
> +
> +#define current            this_cpu(curr_vcpu)
> +#define set_current(vcpu)  do { current = (vcpu); } while (0)
> +#define get_cpu_current(cpu)  per_cpu(curr_vcpu, cpu)
> +
> +#define guest_cpu_user_regs() ({ BUG(); NULL; })

Again with this changed to the "canonical" placeholder:
Acked-by: Jan Beulich <jbeulich@suse.com>

Jan
Oleksii Kurochko Jan. 23, 2024, 4:52 p.m. UTC | #2
On Tue, 2024-01-23 at 12:35 +0100, Jan Beulich wrote:
> On 22.12.2023 16:13, Oleksii Kurochko wrote:> ---
> a/xen/arch/riscv/include/asm/current.h
> > +++ b/xen/arch/riscv/include/asm/current.h
> > @@ -3,6 +3,21 @@
> >  #ifndef __ASM_CURRENT_H
> >  #define __ASM_CURRENT_H
> >  
> > +#include <xen/bug.h>
> > +#include <xen/percpu.h>
> > +#include <asm/processor.h>
> > +
> > +#ifndef __ASSEMBLY__
> > +
> > +/* Which VCPU is "current" on this PCPU. */
> > +DECLARE_PER_CPU(struct vcpu *, curr_vcpu);
> > +
> > +#define current            this_cpu(curr_vcpu)
> > +#define set_current(vcpu)  do { current = (vcpu); } while (0)
> > +#define get_cpu_current(cpu)  per_cpu(curr_vcpu, cpu)
> > +
> > +#define guest_cpu_user_regs() ({ BUG(); NULL; })
> 
> Again with this changed to the "canonical" placeholder:
> Acked-by: Jan Beulich <jbeulich@suse.com>
Thanks. I'll updarte BUG() part.

~ Oleksii
diff mbox series

Patch

diff --git a/xen/arch/riscv/include/asm/current.h b/xen/arch/riscv/include/asm/current.h
index d84f15dc50..1694f68c6f 100644
--- a/xen/arch/riscv/include/asm/current.h
+++ b/xen/arch/riscv/include/asm/current.h
@@ -3,6 +3,21 @@ 
 #ifndef __ASM_CURRENT_H
 #define __ASM_CURRENT_H
 
+#include <xen/bug.h>
+#include <xen/percpu.h>
+#include <asm/processor.h>
+
+#ifndef __ASSEMBLY__
+
+/* Which VCPU is "current" on this PCPU. */
+DECLARE_PER_CPU(struct vcpu *, curr_vcpu);
+
+#define current            this_cpu(curr_vcpu)
+#define set_current(vcpu)  do { current = (vcpu); } while (0)
+#define get_cpu_current(cpu)  per_cpu(curr_vcpu, cpu)
+
+#define guest_cpu_user_regs() ({ BUG(); NULL; })
+
 #define switch_stack_and_jump(stack, fn) do {               \
     asm volatile (                                          \
             "mv sp, %0\n"                                   \
@@ -10,4 +25,8 @@ 
     unreachable();                                          \
 } while ( false )
 
+#define get_per_cpu_offset() __per_cpu_offset[smp_processor_id()]
+
+#endif /* __ASSEMBLY__ */
+
 #endif /* __ASM_CURRENT_H */