Re: [PATCH hyperv-next v2 3/4] arch: hyperv: Get/set SynIC synth.registers via paravisor

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 





On 12-05-2025 04:37, Roman Kisel wrote:
+/*
+ * Not every paravisor supports getting SynIC registers, and
+ * this function may fail. The caller has to make sure that this function
+ * runs on the CPU of interest.
+ */

Title and Intent: Clearly state the purpose of the function in the first sentence
/*
 * Attempt to get the SynIC register value.
 *
 * Not all paravisors support reading SynIC registers, so this function
 * may fail. The caller must ensure that it is executed on the target
 * CPU.
 *
 * Returns: The SynIC register value or ~0ULL on failure.
 * Sets err to -ENODEV if the provided register is not a valid SynIC
 * MSR.
 */

+u64 hv_pv_get_synic_register(unsigned int reg, int *err)
+{
+	if (!hv_is_synic_msr(reg)) {
+		*err = -ENODEV;
+		return !0ULL;
+	}
+	return native_read_msr_safe(reg, err);
+}
+EXPORT_SYMBOL_GPL(hv_pv_get_synic_register);
+
+/*
+ * Not every paravisor supports setting SynIC registers, and
+ * this function may fail. The caller has to make sure that this function
+ * runs on the CPU of interest.
+ */

ditto.

+int hv_pv_set_synic_register(unsigned int reg, u64 val)
+{
+	if (!hv_is_synic_msr(reg))
+		return -ENODEV;
+	return wrmsrl_safe(reg, val);
+}
+EXPORT_SYMBOL_GPL(hv_pv_set_synic_register);

Thanks,
Alok





[Index of Archives]     [Kernel Newbies]     [Security]     [Netfilter]     [Bugtraq]     [Linux FS]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]     [Linux Resources]

  Powered by Linux