]> xenbits.xensource.com Git - people/aperard/xen-unstable.git/commitdiff
xen/riscv: add minimal stuff to processor.h to build full Xen
authorOleksii Kurochko <oleksii.kurochko@gmail.com>
Mon, 25 Mar 2024 09:47:49 +0000 (10:47 +0100)
committerJan Beulich <jbeulich@suse.com>
Mon, 25 Mar 2024 09:47:49 +0000 (10:47 +0100)
The cpu_relax() function, introduced in this commit, is anticipated to
support _zihintpause by the CPU.

Signed-off-by: Oleksii Kurochko <oleksii.kurochko@gmail.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
xen/arch/riscv/include/asm/processor.h

index 6db681d805926c1ae1e82b37ad029d1035d781c9..6846151717f7fc4f145a1438e68dc1e851966383 100644 (file)
@@ -12,6 +12,9 @@
 
 #ifndef __ASSEMBLY__
 
+/* TODO: need to be implemeted */
+#define smp_processor_id() 0
+
 /* On stack VCPU state */
 struct cpu_user_regs
 {
@@ -53,6 +56,23 @@ struct cpu_user_regs
     unsigned long pregs;
 };
 
+/* TODO: need to implement */
+#define cpu_to_core(cpu)   0
+#define cpu_to_socket(cpu) 0
+
+static inline void cpu_relax(void)
+{
+#ifdef __riscv_zihintpause
+    /* Reduce instruction retirement. */
+    __asm__ __volatile__ ( "pause" );
+#else
+    /* Encoding of the pause instruction */
+    __asm__ __volatile__ ( ".insn 0x0100000F" );
+#endif
+
+    barrier();
+}
+
 static inline void wfi(void)
 {
     __asm__ __volatile__ ("wfi");