{"id":2226028,"url":"http://patchwork.ozlabs.org/api/1.2/patches/2226028/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-pci/patch/20260422023239.1171963-4-mrathor@linux.microsoft.com/","project":{"id":28,"url":"http://patchwork.ozlabs.org/api/1.2/projects/28/?format=json","name":"Linux PCI development","link_name":"linux-pci","list_id":"linux-pci.vger.kernel.org","list_email":"linux-pci@vger.kernel.org","web_url":null,"scm_url":null,"webscm_url":null,"list_archive_url":"","list_archive_url_format":"","commit_url_format":""},"msgid":"<20260422023239.1171963-4-mrathor@linux.microsoft.com>","list_archive_url":null,"date":"2026-04-22T02:32:29","name":"[V1,03/13] x86/hyperv: add insufficient memory support in irqdomain.c","commit_ref":null,"pull_url":null,"state":"new","archived":false,"hash":"2527109ababe43429be781794e206aa34fee19fc","submitter":{"id":91512,"url":"http://patchwork.ozlabs.org/api/1.2/people/91512/?format=json","name":"Mukesh R","email":"mrathor@linux.microsoft.com"},"delegate":null,"mbox":"http://patchwork.ozlabs.org/project/linux-pci/patch/20260422023239.1171963-4-mrathor@linux.microsoft.com/mbox/","series":[{"id":500915,"url":"http://patchwork.ozlabs.org/api/1.2/series/500915/?format=json","web_url":"http://patchwork.ozlabs.org/project/linux-pci/list/?series=500915","date":"2026-04-22T02:32:26","name":"PCI passthru on Hyper-V (Part I)","version":1,"mbox":"http://patchwork.ozlabs.org/series/500915/mbox/"}],"comments":"http://patchwork.ozlabs.org/api/patches/2226028/comments/","check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/2226028/checks/","tags":{},"related":[],"headers":{"Return-Path":"\n <linux-pci+bounces-52896-incoming=patchwork.ozlabs.org@vger.kernel.org>","X-Original-To":["incoming@patchwork.ozlabs.org","linux-pci@vger.kernel.org"],"Delivered-To":"patchwork-incoming@legolas.ozlabs.org","Authentication-Results":["legolas.ozlabs.org;\n\tdkim=pass (1024-bit key;\n unprotected) header.d=linux.microsoft.com header.i=@linux.microsoft.com\n header.a=rsa-sha256 header.s=default header.b=UtQVZhp7;\n\tdkim-atps=neutral","legolas.ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=vger.kernel.org\n (client-ip=2600:3c04:e001:36c::12fc:5321; helo=tor.lore.kernel.org;\n envelope-from=linux-pci+bounces-52896-incoming=patchwork.ozlabs.org@vger.kernel.org;\n receiver=patchwork.ozlabs.org)","smtp.subspace.kernel.org;\n\tdkim=pass (1024-bit key) header.d=linux.microsoft.com\n header.i=@linux.microsoft.com header.b=\"UtQVZhp7\"","smtp.subspace.kernel.org;\n arc=none smtp.client-ip=13.77.154.182","smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=linux.microsoft.com","smtp.subspace.kernel.org;\n spf=pass smtp.mailfrom=linux.microsoft.com"],"Received":["from tor.lore.kernel.org (tor.lore.kernel.org\n [IPv6:2600:3c04:e001:36c::12fc:5321])\n\t(using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)\n\t key-exchange x25519 server-signature ECDSA (secp384r1) server-digest SHA384)\n\t(No client certificate requested)\n\tby legolas.ozlabs.org (Postfix) with ESMTPS id 4g0jyM0pcyz1yD5\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 22 Apr 2026 12:35:55 +1000 (AEST)","from smtp.subspace.kernel.org (conduit.subspace.kernel.org\n [100.90.174.1])\n\tby tor.lore.kernel.org (Postfix) with ESMTP id AA614307774C\n\tfor <incoming@patchwork.ozlabs.org>; Wed, 22 Apr 2026 02:33:54 +0000 (UTC)","from localhost.localdomain (localhost.localdomain [127.0.0.1])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id 54A8A382F1C;\n\tWed, 22 Apr 2026 02:33:52 +0000 (UTC)","from linux.microsoft.com (linux.microsoft.com [13.77.154.182])\n\tby smtp.subspace.kernel.org (Postfix) with ESMTP id D578D37CD54;\n\tWed, 22 Apr 2026 02:33:45 +0000 (UTC)","from mrdev.corp.microsoft.com\n (192-184-212-33.fiber.dynamic.sonic.net [192.184.212.33])\n\tby linux.microsoft.com (Postfix) with ESMTPSA id 8A90C20B6F12;\n\tTue, 21 Apr 2026 19:33:40 -0700 (PDT)"],"ARC-Seal":"i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116;\n\tt=1776825230; cv=none;\n b=c0NV1G5mhRAiXPuDG66LV/JjfQ2/Z1D2SjmK9yZ+aUbCNoJT97YlsFwgjpYy2NNEzp36g4kDwLjwk6xIJLf4AfXtoRfyG90nb6WF7nfP1H2HM1ibxKk/RwkCh7dSfhEWhEOpXm2zzUUhNlJvvb0EMBGVjjRirQQQZgN6jC0gNA8=","ARC-Message-Signature":"i=1; a=rsa-sha256; d=subspace.kernel.org;\n\ts=arc-20240116; t=1776825230; c=relaxed/simple;\n\tbh=Z3Tt+i4ryjnf6ysGYVY1XRQ8YBFCce5JBQ1Bz2twCCw=;\n\th=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References:\n\t MIME-Version;\n b=NKKAy9n35dTs2v+NqsyquEkpoMWQa00CJTcvRBycrcL+XzTZ3rmZLGSQD0tw8eOUnx1DT9HGoZr1UH4hRhDVgIV772LW0p9Vz+R3FJ69WWW8yqEJqo4y51RqXaRsbcevrYxERueJyb77n/9rNPvCPldK2UhuC8CloEXaTyxYY2g=","ARC-Authentication-Results":"i=1; smtp.subspace.kernel.org;\n dmarc=pass (p=none dis=none) header.from=linux.microsoft.com;\n spf=pass smtp.mailfrom=linux.microsoft.com;\n dkim=pass (1024-bit key) header.d=linux.microsoft.com\n header.i=@linux.microsoft.com header.b=UtQVZhp7;\n arc=none smtp.client-ip=13.77.154.182","DKIM-Filter":"OpenDKIM Filter v2.11.0 linux.microsoft.com 8A90C20B6F12","DKIM-Signature":"v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com;\n\ts=default; t=1776825221;\n\tbh=ONiMZWsb8/8IhaBjkgi5kkshWDnWtbTkSXDdbFle5ZE=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=UtQVZhp7fv0i6HpN1CrtxqNecqOwBHsibTl5ydNBUd1KFghrBaPB7lDZCCY55sv9D\n\t oNNyybQ/srUjUncnRi/0WZ0w8/XwbirBCbC+9DwEvhFb8zKCNNLrnZAmAZxGSUJVWV\n\t WQLsQ0zLRlycUT/HH1rx3r4W0SE6E7e4zex1aM5Q=","From":"Mukesh R <mrathor@linux.microsoft.com>","To":"hpa@zytor.com,\n\trobin.murphy@arm.com,\n\trobh@kernel.org,\n\twei.liu@kernel.org,\n\tmrathor@linux.microsoft.com,\n\tmhklinux@outlook.com,\n\tmuislam@microsoft.com,\n\tnamjain@linux.microsoft.com,\n\tmagnuskulke@linux.microsoft.com,\n\tanbelski@linux.microsoft.com,\n\tlinux-kernel@vger.kernel.org,\n\tlinux-hyperv@vger.kernel.org,\n\tiommu@lists.linux.dev,\n\tlinux-pci@vger.kernel.org,\n\tlinux-arch@vger.kernel.org","Cc":"kys@microsoft.com,\n\thaiyangz@microsoft.com,\n\tdecui@microsoft.com,\n\tlongli@microsoft.com,\n\ttglx@kernel.org,\n\tmingo@redhat.com,\n\tbp@alien8.de,\n\tdave.hansen@linux.intel.com,\n\tx86@kernel.org,\n\tjoro@8bytes.org,\n\twill@kernel.org,\n\tlpieralisi@kernel.org,\n\tkwilczynski@kernel.org,\n\tbhelgaas@google.com,\n\tarnd@arndb.de","Subject":"[PATCH V1 03/13] x86/hyperv: add insufficient memory support in\n irqdomain.c","Date":"Tue, 21 Apr 2026 19:32:29 -0700","Message-ID":"<20260422023239.1171963-4-mrathor@linux.microsoft.com>","X-Mailer":"git-send-email 2.51.2.vfs.0.1","In-Reply-To":"<20260422023239.1171963-1-mrathor@linux.microsoft.com>","References":"<20260422023239.1171963-1-mrathor@linux.microsoft.com>","Precedence":"bulk","X-Mailing-List":"linux-pci@vger.kernel.org","List-Id":"<linux-pci.vger.kernel.org>","List-Subscribe":"<mailto:linux-pci+subscribe@vger.kernel.org>","List-Unsubscribe":"<mailto:linux-pci+unsubscribe@vger.kernel.org>","MIME-Version":"1.0","Content-Transfer-Encoding":"8bit"},"content":"Intermittent insufficient memory hypercall failure have been observed in\nthe current map device interrupt hypercall. In case of such a failure,\nwe must deposit more memory and redo the hypercall. Add support for\nthat. Deposit memory needs partition id, make that a parameter to the\nmap interrupt function.\n\nSigned-off-by: Mukesh R <mrathor@linux.microsoft.com>\n---\n arch/x86/hyperv/irqdomain.c | 38 +++++++++++++++++++++++++++++++------\n 1 file changed, 32 insertions(+), 6 deletions(-)","diff":"diff --git a/arch/x86/hyperv/irqdomain.c b/arch/x86/hyperv/irqdomain.c\nindex b3ad50a874dc..229f986e08ea 100644\n--- a/arch/x86/hyperv/irqdomain.c\n+++ b/arch/x86/hyperv/irqdomain.c\n@@ -13,8 +13,9 @@\n #include <linux/irqchip/irq-msi-lib.h>\n #include <asm/mshyperv.h>\n \n-static int hv_map_interrupt(union hv_device_id hv_devid, bool level,\n-\t\tint cpu, int vector, struct hv_interrupt_entry *ret_entry)\n+static u64 hv_map_interrupt_hcall(u64 ptid, union hv_device_id hv_devid,\n+\t\t\t\t  bool level, int cpu, int vector,\n+\t\t\t\t  struct hv_interrupt_entry *ret_entry)\n {\n \tstruct hv_input_map_device_interrupt *input;\n \tstruct hv_output_map_device_interrupt *output;\n@@ -30,8 +31,10 @@ static int hv_map_interrupt(union hv_device_id hv_devid, bool level,\n \n \tintr_desc = &input->interrupt_descriptor;\n \tmemset(input, 0, sizeof(*input));\n-\tinput->partition_id = hv_current_partition_id;\n+\n+\tinput->partition_id = ptid;\n \tinput->device_id = hv_devid.as_uint64;\n+\n \tintr_desc->interrupt_type = HV_X64_INTERRUPT_TYPE_FIXED;\n \tintr_desc->vector_count = 1;\n \tintr_desc->target.vector = vector;\n@@ -64,6 +67,28 @@ static int hv_map_interrupt(union hv_device_id hv_devid, bool level,\n \n \tlocal_irq_restore(flags);\n \n+\treturn status;\n+}\n+\n+static int hv_map_interrupt(u64 ptid, union hv_device_id device_id, bool level,\n+\t\t\t    int cpu, int vector,\n+\t\t\t    struct hv_interrupt_entry *ret_entry)\n+{\n+\tu64 status;\n+\tint rc, deposit_pgs = 16;\t\t/* don't loop forever */\n+\n+\twhile (deposit_pgs--) {\n+\t\tstatus = hv_map_interrupt_hcall(ptid, device_id, level, cpu,\n+\t\t\t\t\t\tvector, ret_entry);\n+\n+\t\tif (hv_result(status) != HV_STATUS_INSUFFICIENT_MEMORY)\n+\t\t\tbreak;\n+\n+\t\trc = hv_call_deposit_pages(NUMA_NO_NODE, ptid, 1);\n+\t\tif (rc)\n+\t\t\tbreak;\n+\t}\n+\n \tif (!hv_result_success(status))\n \t\thv_status_err(status, \"\\n\");\n \n@@ -199,8 +224,8 @@ int hv_map_msi_interrupt(struct irq_data *data,\n \thv_devid = hv_build_devid_type_pci(pdev);\n \tcpu = cpumask_first(irq_data_get_effective_affinity_mask(data));\n \n-\treturn hv_map_interrupt(hv_devid, false, cpu, cfg->vector,\n-\t\t\t\tout_entry ? out_entry : &dummy);\n+\treturn hv_map_interrupt(hv_current_partition_id, hv_devid, false, cpu,\n+\t\t\t\tcfg->vector, out_entry ? out_entry : &dummy);\n }\n EXPORT_SYMBOL_GPL(hv_map_msi_interrupt);\n \n@@ -423,6 +448,7 @@ int hv_map_ioapic_interrupt(int ioapic_id, bool level, int cpu, int vector,\n \thv_devid.device_type = HV_DEVICE_TYPE_IOAPIC;\n \thv_devid.ioapic.ioapic_id = (u8)ioapic_id;\n \n-\treturn hv_map_interrupt(hv_devid, level, cpu, vector, entry);\n+\treturn hv_map_interrupt(hv_current_partition_id, hv_devid, level, cpu,\n+\t\t\t\tvector, entry);\n }\n EXPORT_SYMBOL_GPL(hv_map_ioapic_interrupt);\n","prefixes":["V1","03/13"]}