Download raw body.
cpu_xcall glue for amd64
On Sun, Jul 13, 2025 at 03:56:45PM +1000, David Gwynne wrote:
> if a driver needs cpu_xcall, it can depend on xcall and enable
> compilation of the xcall code and this glue.
>
> ok?
>
If we're going to do xcalls at all, why even bother making it conditional?
Eg, I don't see any benefit of having some kernels be non-xcall and some
xcall enabled based on what drivers are in them.
-ml
> Index: amd64/cpu.c
> ===================================================================
> RCS file: /cvs/src/sys/arch/amd64/amd64/cpu.c,v
> diff -u -p -r1.196 cpu.c
> --- amd64/cpu.c 5 Jun 2025 09:29:54 -0000 1.196
> +++ amd64/cpu.c 13 Jul 2025 05:50:03 -0000
> @@ -637,6 +637,10 @@ cpu_attach(struct device *parent, struct
> #endif
>
> #if defined(MULTIPROCESSOR)
> +#if NXCALL > 0
> + cpu_xcall_establish(ci);
> +#endif
> +
> /*
> * Allocate UPAGES contiguous pages for the idle PCB and stack.
> */
> Index: amd64/ipifuncs.c
> ===================================================================
> RCS file: /cvs/src/sys/arch/amd64/amd64/ipifuncs.c,v
> diff -u -p -r1.39 ipifuncs.c
> --- amd64/ipifuncs.c 7 Jun 2024 16:53:35 -0000 1.39
> +++ amd64/ipifuncs.c 13 Jul 2025 05:50:03 -0000
> @@ -108,6 +108,11 @@ void (*ipifunc[X86_NIPI])(struct cpu_inf
> NULL,
> #endif
> x86_64_ipi_wbinvd,
> +#if NXCALL > 0
> + cpu_xcall_dispatch,
> +#else
> + NULL,
> +#endif
> };
>
> void
> Index: include/cpu.h
> ===================================================================
> RCS file: /cvs/src/sys/arch/amd64/include/cpu.h,v
> diff -u -p -r1.180 cpu.h
> --- include/cpu.h 28 Apr 2025 16:18:25 -0000 1.180
> +++ include/cpu.h 13 Jul 2025 05:50:04 -0000
> @@ -42,9 +42,12 @@
> * Definitions unique to x86-64 cpu support.
> */
> #ifdef _KERNEL
> +#include "xcall.h"
> +
> #include <machine/frame.h>
> #include <machine/segments.h> /* USERMODE */
> #include <machine/intrdefs.h>
> +#include <sys/xcall.h>
> #endif /* _KERNEL */
>
> #include <sys/clockintr.h>
> @@ -215,6 +218,9 @@ struct cpu_info {
>
> #ifdef MULTIPROCESSOR
> struct srp_hazard ci_srp_hazards[SRP_HAZARD_NUM];
> +#if NXCALL > 0
> + struct xcall_cpu ci_xcall;
> +#endif
> #define __HAVE_UVM_PERCPU
> struct uvm_pmr_cache ci_uvm; /* [o] page cache */
> #endif
> Index: include/intr.h
> ===================================================================
> RCS file: /cvs/src/sys/arch/amd64/include/intr.h,v
> diff -u -p -r1.36 intr.h
> --- include/intr.h 11 Jun 2025 09:57:01 -0000 1.36
> +++ include/intr.h 13 Jul 2025 05:50:04 -0000
> @@ -222,7 +222,9 @@ void x86_ipi_handler(void);
> void x86_setperf_ipi(struct cpu_info *);
>
> extern void (*ipifunc[X86_NIPI])(struct cpu_info *);
> -#endif
> +
> +#define cpu_xcall_ipi(_ci) x86_send_ipi((_ci), X86_IPI_XCALL)
> +#endif /* MULTIPROCESSOR */
>
> #endif /* !_LOCORE */
>
> Index: include/intrdefs.h
> ===================================================================
> RCS file: /cvs/src/sys/arch/amd64/include/intrdefs.h,v
> diff -u -p -r1.24 intrdefs.h
> --- include/intrdefs.h 26 May 2024 13:37:31 -0000 1.24
> +++ include/intrdefs.h 13 Jul 2025 05:50:04 -0000
> @@ -85,8 +85,9 @@
> #define X86_IPI_START_VMM 0x00000100
> #define X86_IPI_STOP_VMM 0x00000200
> #define X86_IPI_WBINVD 0x00000400
> +#define X86_IPI_XCALL 0x00000800
>
> -#define X86_NIPI 12
> +#define X86_NIPI 13
>
> #define IREENT_MAGIC 0x18041969
>
>
cpu_xcall glue for amd64