On Tue, Apr 21, 2026 at 07:32:29PM -0700, Mukesh R wrote: > Intermittent insufficient memory hypercall failure have been observed in > the current map device interrupt hypercall. In case of such a failure, > we must deposit more memory and redo the hypercall. Add support for > that. Deposit memory needs partition id, make that a parameter to the > map interrupt function. > > Signed-off-by: Mukesh R <[email protected]> > --- > arch/x86/hyperv/irqdomain.c | 38 +++++++++++++++++++++++++++++++------ > 1 file changed, 32 insertions(+), 6 deletions(-) > > diff --git a/arch/x86/hyperv/irqdomain.c b/arch/x86/hyperv/irqdomain.c > index b3ad50a874dc..229f986e08ea 100644 > --- a/arch/x86/hyperv/irqdomain.c > +++ b/arch/x86/hyperv/irqdomain.c > @@ -13,8 +13,9 @@ > #include <linux/irqchip/irq-msi-lib.h> > #include <asm/mshyperv.h> > > -static int hv_map_interrupt(union hv_device_id hv_devid, bool level, > - int cpu, int vector, struct hv_interrupt_entry *ret_entry) > +static u64 hv_map_interrupt_hcall(u64 ptid, union hv_device_id hv_devid, > + bool level, int cpu, int vector, > + struct hv_interrupt_entry *ret_entry) > { > struct hv_input_map_device_interrupt *input; > struct hv_output_map_device_interrupt *output; > @@ -30,8 +31,10 @@ static int hv_map_interrupt(union hv_device_id hv_devid, > bool level, > > intr_desc = &input->interrupt_descriptor; > memset(input, 0, sizeof(*input)); > - input->partition_id = hv_current_partition_id; > + > + input->partition_id = ptid; > input->device_id = hv_devid.as_uint64; > + > intr_desc->interrupt_type = HV_X64_INTERRUPT_TYPE_FIXED; > intr_desc->vector_count = 1; > intr_desc->target.vector = vector; > @@ -64,6 +67,28 @@ static int hv_map_interrupt(union hv_device_id hv_devid, > bool level, > > local_irq_restore(flags); > > + return status; > +} > + > +static int hv_map_interrupt(u64 ptid, union hv_device_id device_id, bool > level, > + int cpu, int vector, > + struct hv_interrupt_entry *ret_entry) > +{ > + u64 status; > + int rc, deposit_pgs = 16; /* don't loop forever */ > + > + while (deposit_pgs--) { > + status = hv_map_interrupt_hcall(ptid, device_id, level, cpu, > + vector, ret_entry); > + > + if (hv_result(status) != HV_STATUS_INSUFFICIENT_MEMORY) > + break; > + > + rc = hv_call_deposit_pages(NUMA_NO_NODE, ptid, 1);
This code should use the hv_result_needs_memory() and hv_deposit_memory() helpers instead. Thanks, Anirudh

