X86_MSR_XCALL(9) Kernel Developer's Manual (x86) X86_MSR_XCALL(9)

x86_msr_xcall
MSR specific cross-call

#include <x86/cpu_msr.h>

void
x86_msr_xcall(void *arg1, void *arg1);

The x86_msr_xcall() function provides a x86-specific IPI handler suitable for use with the xcall(9) interface. It can be used to ensure that a given MSR call is executed on all processors. The prototype follows the xcfunc_t function pointer type and the opaque arg1 pointer is casted to the following structure:
struct msr_rw_info {
	int		msr_read;
	int		msr_type;
	uint64_t	msr_value;
	uint64_t	msr_mask;
};

This structure must be filled prior to the call. Two fields are compulsory: msr_type is used as the address of the MSR and msr_value is the value to be written. If msr_read is not zero, x86_msr_xcall() will first read from msr_type and then clear the mask specified in msr_mask before the write operation.

The following example writes a value zero to the MSR_THERM_CONTROL model-specific register on all processors in the system:
struct msr_rw_info msr;
uint64_t xc;

msr.msr_value = 0;
msr.msr_read = true;
msr.msr_type = MSR_THERM_CONTROL;
msr.msr_mask = 0x1e;

xc = xc_broadcast(0, (xcfunc_t)x86_msr_xcall, &msr, NULL);
xc_wait(xc);

x86/rdmsr(9), xcall(9)
February 17, 2017 NetBSD 9.2