]> git.ipfire.org Git - thirdparty/kernel/stable.git/commitdiff
Drivers: hv: Move add_interrupt_randomness() to hypervisor callback sysvec
authorMichael Kelley <mhklinux@outlook.com>
Thu, 2 Apr 2026 20:24:00 +0000 (13:24 -0700)
committerThomas Gleixner <tglx@kernel.org>
Sat, 4 Apr 2026 19:01:56 +0000 (21:01 +0200)
The Hyper-V ISRs, for normal guests and when running in the hypervisor root
patition, are calling add_interrupt_randomness() as a primary source of
entropy. The call is currently in the ISRs as a common place to handle both
x86/x64 and arm64.

On x86/x64, hypervisor interrupts come through a custom sysvec entry, and
do not go through a generic interrupt handler.

On arm64, hypervisor interrupts come through an emulated GICv3. GICv3 uses
the generic handler handle_percpu_devid_irq(), which does not do
add_interrupt_randomness() -- unlike its counterpart
handle_percpu_irq().

But handle_percpu_devid_irq() is now updated to do the
add_interrupt_randomness(). So add_interrupt_randomness() is now needed
only in Hyper-V's x86/x64 custom sysvec path.

Move add_interrupt_randomness() from the Hyper-V ISRs into the Hyper-V
x86/x64 custom sysvec path, matching the existing STIMER0 sysvec path.

With this change, add_interrupt_randomness() is no longer called from any
device drivers, which is appropriate.

Signed-off-by: Michael Kelley <mhklinux@outlook.com>
Signed-off-by: Thomas Gleixner <tglx@kernel.org>
Acked-by: Wei Liu <wei.liu@kernel.org>
Link: https://patch.msgid.link/20260402202400.1707-3-mhklkml@zohomail.com
arch/x86/kernel/cpu/mshyperv.c
drivers/hv/mshv_synic.c
drivers/hv/vmbus_drv.c

index 9befdc557d9e50b7b07a5352172aacc06095f853..a7dfc29d34700306c34149727c5c3d36acd0d9b9 100644 (file)
@@ -161,6 +161,8 @@ DEFINE_IDTENTRY_SYSVEC(sysvec_hyperv_callback)
        if (vmbus_handler)
                vmbus_handler();
 
+       add_interrupt_randomness(HYPERVISOR_CALLBACK_VECTOR);
+
        if (ms_hyperv.hints & HV_DEPRECATING_AEOI_RECOMMENDED)
                apic_eoi();
 
index 43f1bcbbf2d34dede6656ebab38468159b567ee5..e2288a726fec94b3d1be485fd006d2ef3685ddc4 100644 (file)
@@ -12,7 +12,6 @@
 #include <linux/mm.h>
 #include <linux/interrupt.h>
 #include <linux/io.h>
-#include <linux/random.h>
 #include <linux/cpuhotplug.h>
 #include <linux/reboot.h>
 #include <asm/mshyperv.h>
@@ -445,8 +444,6 @@ void mshv_isr(void)
                mb();
                if (msg->header.message_flags.msg_pending)
                        hv_set_non_nested_msr(HV_MSR_EOM, 0);
-
-               add_interrupt_randomness(mshv_sint_vector);
        } else {
                pr_warn_once("%s: unknown message type 0x%x\n", __func__,
                             msg->header.message_type);
index bc4fc1951ae1cf3471782d10b8d0f1db8dbc4a47..e7ac79e2fb4929bcc522255d3752aa7ad27a79ee 100644 (file)
@@ -32,7 +32,6 @@
 #include <linux/ptrace.h>
 #include <linux/sysfb.h>
 #include <linux/efi.h>
-#include <linux/random.h>
 #include <linux/kernel.h>
 #include <linux/syscore_ops.h>
 #include <linux/dma-map-ops.h>
@@ -1361,8 +1360,6 @@ static void __vmbus_isr(void)
 
        vmbus_message_sched(hv_cpu, hv_cpu->hyp_synic_message_page);
        vmbus_message_sched(hv_cpu, hv_cpu->para_synic_message_page);
-
-       add_interrupt_randomness(vmbus_interrupt);
 }
 
 static DEFINE_PER_CPU(bool, vmbus_irq_pending);