From nobody Tue Oct 7 07:16:04 2025 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 60D6C1D63E8; Fri, 11 Jul 2025 19:19:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=13.77.154.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752261542; cv=none; b=AVz43Qi5hM/lYhtMUvqswttfy7pZZJJMr0szclVhzlOkWNl9hJ7IJIBG3lFgoTwLO5ZeqRVMFvipr2pyI5ZUD/jrPoxLAUqR/Hj9lxNgFpvwumIeequ7lVXRTKLLbM0ZIvGIDVrUUC3913HnJ7fEfm1lQ9JUdGz9nA2thIbWbyc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752261542; c=relaxed/simple; bh=J5kuogw9IQfPgbT4RfUmgOjGf7U9ruaXcd4WAnF06BA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=NAx5YfQwSvHqPiOa71yYSuaO8AdNfQVJV5ALUQZZuXp5l6y3HyNESvYwAjcxgkfW/1m5FXfHJm6Qc8Dcd/erdlM2fWrQfnpmjLZsCyD2Xv6JvV202K0JtJpUgSyCr7pBT/ClC+HoWw4rjUUzm/RrSFq/2YJj9x4V9yt2T2ZnKAY= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.microsoft.com; spf=pass smtp.mailfrom=linux.microsoft.com; dkim=pass (1024-bit key) header.d=linux.microsoft.com header.i=@linux.microsoft.com header.b=BcKyRt95; arc=none smtp.client-ip=13.77.154.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.microsoft.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.microsoft.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.microsoft.com header.i=@linux.microsoft.com header.b="BcKyRt95" Received: by linux.microsoft.com (Postfix, from userid 1032) id 955732115802; Fri, 11 Jul 2025 12:18:55 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com 955732115802 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1752261535; bh=UMFPZ8IrMjqiIE9bHcG8tr3UGU/I4RiiuVq8nzCqZJ4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=BcKyRt95LY91swi1TdKcoT+mfHyF8tYy50XkcwH3KV167LODNbEpbYPioy6kFWxCO dF+ZYckPR0PiLgpf/y5W1z7ynyZJ3RLJDs1ZQ32UnXd3dI/ndJe/RFCCgk2J9ThxGg 69MVy8hY5lgivpclVpsy5xpMjZp+LNQPaEVhusq8= From: Nuno Das Neves To: linux-hyperv@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, wei.liu@kernel.org, mhklinux@outlook.com, tglx@linutronix.de, bhelgaas@google.com, romank@linux.microsoft.com Cc: kys@microsoft.com, haiyangz@microsoft.com, decui@microsoft.com, catalin.marinas@arm.com, will@kernel.org, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, hpa@zytor.com, lpieralisi@kernel.org, kw@linux.com, robh@kernel.org, jinankjain@linux.microsoft.com, skinsburskii@linux.microsoft.com, mrathor@linux.microsoft.com, x86@kernel.org, Nuno Das Neves Subject: [PATCH v3 1/3] Drivers: hv: Use nested hypercall for post message and signal event Date: Fri, 11 Jul 2025 12:18:50 -0700 Message-Id: <1752261532-7225-2-git-send-email-nunodasneves@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1752261532-7225-1-git-send-email-nunodasneves@linux.microsoft.com> References: <1752261532-7225-1-git-send-email-nunodasneves@linux.microsoft.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" When running nested, these hypercalls must be sent to the L0 hypervisor or VMBus will fail. Remove hv_do_nested_hypercall() and hv_do_fast_nested_hypercall8() altogether and open-code these cases, since there are only 2 and all they do is add the nested bit. Signed-off-by: Nuno Das Neves Reviewed-by: Roman Kisel --- arch/x86/include/asm/mshyperv.h | 20 -------------------- drivers/hv/connection.c | 5 ++++- drivers/hv/hv.c | 6 ++++-- 3 files changed, 8 insertions(+), 23 deletions(-) diff --git a/arch/x86/include/asm/mshyperv.h b/arch/x86/include/asm/mshyper= v.h index e1752ba47e67..ab097a3a8b75 100644 --- a/arch/x86/include/asm/mshyperv.h +++ b/arch/x86/include/asm/mshyperv.h @@ -112,12 +112,6 @@ static inline u64 hv_do_hypercall(u64 control, void *i= nput, void *output) return hv_status; } =20 -/* Hypercall to the L0 hypervisor */ -static inline u64 hv_do_nested_hypercall(u64 control, void *input, void *o= utput) -{ - return hv_do_hypercall(control | HV_HYPERCALL_NESTED, input, output); -} - /* Fast hypercall with 8 bytes of input and no output */ static inline u64 _hv_do_fast_hypercall8(u64 control, u64 input1) { @@ -165,13 +159,6 @@ static inline u64 hv_do_fast_hypercall8(u16 code, u64 = input1) return _hv_do_fast_hypercall8(control, input1); } =20 -static inline u64 hv_do_fast_nested_hypercall8(u16 code, u64 input1) -{ - u64 control =3D (u64)code | HV_HYPERCALL_FAST_BIT | HV_HYPERCALL_NESTED; - - return _hv_do_fast_hypercall8(control, input1); -} - /* Fast hypercall with 16 bytes of input */ static inline u64 _hv_do_fast_hypercall16(u64 control, u64 input1, u64 inp= ut2) { @@ -223,13 +210,6 @@ static inline u64 hv_do_fast_hypercall16(u16 code, u64= input1, u64 input2) return _hv_do_fast_hypercall16(control, input1, input2); } =20 -static inline u64 hv_do_fast_nested_hypercall16(u16 code, u64 input1, u64 = input2) -{ - u64 control =3D (u64)code | HV_HYPERCALL_FAST_BIT | HV_HYPERCALL_NESTED; - - return _hv_do_fast_hypercall16(control, input1, input2); -} - extern struct hv_vp_assist_page **hv_vp_assist_page; =20 static inline struct hv_vp_assist_page *hv_get_vp_assist_page(unsigned int= cpu) diff --git a/drivers/hv/connection.c b/drivers/hv/connection.c index be490c598785..1fe3573ae52a 100644 --- a/drivers/hv/connection.c +++ b/drivers/hv/connection.c @@ -519,7 +519,10 @@ void vmbus_set_event(struct vmbus_channel *channel) else WARN_ON_ONCE(1); } else { - hv_do_fast_hypercall8(HVCALL_SIGNAL_EVENT, channel->sig_event); + u64 control =3D HVCALL_SIGNAL_EVENT; + + control |=3D hv_nested ? HV_HYPERCALL_NESTED : 0; + hv_do_fast_hypercall8(control, channel->sig_event); } } EXPORT_SYMBOL_GPL(vmbus_set_event); diff --git a/drivers/hv/hv.c b/drivers/hv/hv.c index 308c8f279df8..b14c5f9e0ef2 100644 --- a/drivers/hv/hv.c +++ b/drivers/hv/hv.c @@ -85,8 +85,10 @@ int hv_post_message(union hv_connection_id connection_id, else status =3D HV_STATUS_INVALID_PARAMETER; } else { - status =3D hv_do_hypercall(HVCALL_POST_MESSAGE, - aligned_msg, NULL); + u64 control =3D HVCALL_POST_MESSAGE; + + control |=3D hv_nested ? HV_HYPERCALL_NESTED : 0; + status =3D hv_do_hypercall(control, aligned_msg, NULL); } =20 local_irq_restore(flags); --=20 2.34.1 From nobody Tue Oct 7 07:16:04 2025 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 60DBE1DE4E0; Fri, 11 Jul 2025 19:19:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=13.77.154.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752261542; cv=none; b=LnWdzdmaSZ39SfDXe6KIwvImCDEHfAQsTHds0KZYCXQwuo/jOvzF2SkXSacPqPjgODP8xEfj+kXDwjS4a3MG8DBBGaJIJFAzOXCxc7C3Eci8vHEvZO68L9e0tYOhkMbyNd6ilm8zUv9GOqUyvTw1o4I8N7kXPbLqacuzsAFWdjk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752261542; c=relaxed/simple; bh=1tQI5GBVNvc/GU3PlrZZV3y33641kuBLyR9oIhCjq3E=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=eF14Ib5oB51EFxLxiSaY2tbHDn4nXuiZWBlEj9Uc0EUec9F1dMVJww/0cTOBo/CAq3T8Zc84XlPXdJvMB8RGe/yg64Aj466j8DT9qS/tmJ2ohAgk6/SXmqAbVAelBTZQQaBmRDBwfEDHf36qgFvZityqT7Rwt7CG3BRKWX0iVMI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.microsoft.com; spf=pass smtp.mailfrom=linux.microsoft.com; dkim=pass (1024-bit key) header.d=linux.microsoft.com header.i=@linux.microsoft.com header.b=IfUwr2/B; arc=none smtp.client-ip=13.77.154.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.microsoft.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.microsoft.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.microsoft.com header.i=@linux.microsoft.com header.b="IfUwr2/B" Received: by linux.microsoft.com (Postfix, from userid 1032) id A457E2115803; Fri, 11 Jul 2025 12:18:55 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com A457E2115803 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1752261535; bh=sFZ1PcBMw9jT/La9cSdzjaxoBiffb+KtiJHzK65ieQw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=IfUwr2/BEJV/P4zK1EjlNTEelPgd1NC6Ma6c441y229FZuK4SpVs/JIOZubMCVfIn X9TfP/crS1nj2rMG21JWMTRSBs71bAZy6OzatcO0AFosl9oi0+zThIbtvrLQ8OZDKR LfOAzdrs3Wo5lwcITYz1E96de0zkpiUX7FHk4YeM= From: Nuno Das Neves To: linux-hyperv@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, wei.liu@kernel.org, mhklinux@outlook.com, tglx@linutronix.de, bhelgaas@google.com, romank@linux.microsoft.com Cc: kys@microsoft.com, haiyangz@microsoft.com, decui@microsoft.com, catalin.marinas@arm.com, will@kernel.org, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, hpa@zytor.com, lpieralisi@kernel.org, kw@linux.com, robh@kernel.org, jinankjain@linux.microsoft.com, skinsburskii@linux.microsoft.com, mrathor@linux.microsoft.com, x86@kernel.org, Nuno Das Neves Subject: [PATCH v3 2/3] x86/hyperv: Expose hv_map_msi_interrupt() Date: Fri, 11 Jul 2025 12:18:51 -0700 Message-Id: <1752261532-7225-3-git-send-email-nunodasneves@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1752261532-7225-1-git-send-email-nunodasneves@linux.microsoft.com> References: <1752261532-7225-1-git-send-email-nunodasneves@linux.microsoft.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Stanislav Kinsburskii Move some of the logic of hv_irq_compose_irq_message() into hv_map_msi_interrupt(). Make hv_map_msi_interrupt() a globally-available helper function, which will be used to map PCI interrupts when running in the root partition. Signed-off-by: Stanislav Kinsburskii Signed-off-by: Nuno Das Neves Reviewed-by: Roman Kisel --- arch/x86/hyperv/irqdomain.c | 40 ++++++++++++++++++++++++--------- arch/x86/include/asm/mshyperv.h | 2 ++ 2 files changed, 31 insertions(+), 11 deletions(-) diff --git a/arch/x86/hyperv/irqdomain.c b/arch/x86/hyperv/irqdomain.c index ad4dff48cf14..090f5ac9f492 100644 --- a/arch/x86/hyperv/irqdomain.c +++ b/arch/x86/hyperv/irqdomain.c @@ -173,13 +173,34 @@ static union hv_device_id hv_build_pci_dev_id(struct = pci_dev *dev) return dev_id; } =20 -static int hv_map_msi_interrupt(struct pci_dev *dev, int cpu, int vector, - struct hv_interrupt_entry *entry) +/** + * hv_map_msi_interrupt() - "Map" the MSI IRQ in the hypervisor. + * @data: Describes the IRQ + * @out_entry: Hypervisor (MSI) interrupt entry (can be NULL) + * + * Map the IRQ in the hypervisor by issuing a MAP_DEVICE_INTERRUPT hyperca= ll. + * + * Return: 0 on success, -errno on failure + */ +int hv_map_msi_interrupt(struct irq_data *data, + struct hv_interrupt_entry *out_entry) { - union hv_device_id device_id =3D hv_build_pci_dev_id(dev); + struct irq_cfg *cfg =3D irqd_cfg(data); + struct hv_interrupt_entry dummy; + union hv_device_id device_id; + struct msi_desc *msidesc; + struct pci_dev *dev; + int cpu; =20 - return hv_map_interrupt(device_id, false, cpu, vector, entry); + msidesc =3D irq_data_get_msi_desc(data); + dev =3D msi_desc_to_pci_dev(msidesc); + device_id =3D hv_build_pci_dev_id(dev); + cpu =3D cpumask_first(irq_data_get_effective_affinity_mask(data)); + + return hv_map_interrupt(device_id, false, cpu, cfg->vector, + out_entry ? out_entry : &dummy); } +EXPORT_SYMBOL_GPL(hv_map_msi_interrupt); =20 static inline void entry_to_msi_msg(struct hv_interrupt_entry *entry, stru= ct msi_msg *msg) { @@ -192,11 +213,11 @@ static inline void entry_to_msi_msg(struct hv_interru= pt_entry *entry, struct msi static int hv_unmap_msi_interrupt(struct pci_dev *dev, struct hv_interrupt= _entry *old_entry); static void hv_irq_compose_msi_msg(struct irq_data *data, struct msi_msg *= msg) { - struct hv_interrupt_entry out_entry, *stored_entry; + struct hv_interrupt_entry *stored_entry; struct irq_cfg *cfg =3D irqd_cfg(data); struct msi_desc *msidesc; struct pci_dev *dev; - int cpu, ret; + int ret; =20 msidesc =3D irq_data_get_msi_desc(data); dev =3D msi_desc_to_pci_dev(msidesc); @@ -206,8 +227,6 @@ static void hv_irq_compose_msi_msg(struct irq_data *dat= a, struct msi_msg *msg) return; } =20 - cpu =3D cpumask_first(irq_data_get_effective_affinity_mask(data)); - if (data->chip_data) { /* * This interrupt is already mapped. Let's unmap first. @@ -234,15 +253,14 @@ static void hv_irq_compose_msi_msg(struct irq_data *d= ata, struct msi_msg *msg) return; } =20 - ret =3D hv_map_msi_interrupt(dev, cpu, cfg->vector, &out_entry); + ret =3D hv_map_msi_interrupt(data, stored_entry); if (ret) { kfree(stored_entry); return; } =20 - *stored_entry =3D out_entry; data->chip_data =3D stored_entry; - entry_to_msi_msg(&out_entry, msg); + entry_to_msi_msg(data->chip_data, msg); =20 return; } diff --git a/arch/x86/include/asm/mshyperv.h b/arch/x86/include/asm/mshyper= v.h index ab097a3a8b75..abc4659f5809 100644 --- a/arch/x86/include/asm/mshyperv.h +++ b/arch/x86/include/asm/mshyperv.h @@ -242,6 +242,8 @@ static inline void hv_apic_init(void) {} =20 struct irq_domain *hv_create_pci_msi_domain(void); =20 +int hv_map_msi_interrupt(struct irq_data *data, + struct hv_interrupt_entry *out_entry); int hv_map_ioapic_interrupt(int ioapic_id, bool level, int vcpu, int vecto= r, struct hv_interrupt_entry *entry); int hv_unmap_ioapic_interrupt(int ioapic_id, struct hv_interrupt_entry *en= try); --=20 2.34.1 From nobody Tue Oct 7 07:16:04 2025 Received: from linux.microsoft.com (linux.microsoft.com [13.77.154.182]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 578F81DF25C; Fri, 11 Jul 2025 19:19:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=13.77.154.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752261543; cv=none; b=bgf+2dYFsJtAArrroNt30JfATepsXYz3DfTZTQ+FdaqlNrEx2qA/ouuJ/9SJu0pqUJk85MO5I+2CRyfKHBvVZdSo0lSrtC4v92DvabPjd/+gfTolYUoGaHXPJ8wFeYQ+6fBmYK625HvJ3MTrFCP1ZoM9Z1Z+WG4ACRCcM/aOU7E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1752261543; c=relaxed/simple; bh=QUkbyCON0VpeI8tP5sCHWjm7eT5setVQNd21DT2Y+IA=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=PUKH55OY7JDhJlStmBVLBSWmJXC2TQdUfQsMpKkI6JYhHNc6XncstJeIkGuWZk6Ldu1L9XO4t6XEswdwswVuji0zluawUD1IIyino5R0m5BWWkUoxKmM+i3l9UJ6Rjwfha4eIB+oh5+3tTIyZbhjiPlKZ1Io5inTZ+toxbnoLiU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.microsoft.com; spf=pass smtp.mailfrom=linux.microsoft.com; dkim=pass (1024-bit key) header.d=linux.microsoft.com header.i=@linux.microsoft.com header.b=Wrwsu6LN; arc=none smtp.client-ip=13.77.154.182 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.microsoft.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.microsoft.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.microsoft.com header.i=@linux.microsoft.com header.b="Wrwsu6LN" Received: by linux.microsoft.com (Postfix, from userid 1032) id B270A2115816; Fri, 11 Jul 2025 12:18:55 -0700 (PDT) DKIM-Filter: OpenDKIM Filter v2.11.0 linux.microsoft.com B270A2115816 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.microsoft.com; s=default; t=1752261535; bh=IIMcAZzl2wgTkbzBnokzygglawosdc5xNO3bETXTgVM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Wrwsu6LNTCgtIS5fpawoc7PvXv78sQHf5s9fm0lCrHe58ADwkI5aYuQFp0uNenWyv M/QtuJG8oiPtOM0vx+QCZxs7jrN83E8RiRtkK150ACtIvOJLYeD3MvzVE4ItKLKGV9 i5GNj9anAUvJS4lX3UBRbAbROt63hvOeDxIznpa8= From: Nuno Das Neves To: linux-hyperv@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, wei.liu@kernel.org, mhklinux@outlook.com, tglx@linutronix.de, bhelgaas@google.com, romank@linux.microsoft.com Cc: kys@microsoft.com, haiyangz@microsoft.com, decui@microsoft.com, catalin.marinas@arm.com, will@kernel.org, mingo@redhat.com, bp@alien8.de, dave.hansen@linux.intel.com, hpa@zytor.com, lpieralisi@kernel.org, kw@linux.com, robh@kernel.org, jinankjain@linux.microsoft.com, skinsburskii@linux.microsoft.com, mrathor@linux.microsoft.com, x86@kernel.org, Nuno Das Neves Subject: [PATCH v3 3/3] PCI: hv: Use the correct hypercall for unmasking interrupts on nested Date: Fri, 11 Jul 2025 12:18:52 -0700 Message-Id: <1752261532-7225-4-git-send-email-nunodasneves@linux.microsoft.com> X-Mailer: git-send-email 1.8.3.1 In-Reply-To: <1752261532-7225-1-git-send-email-nunodasneves@linux.microsoft.com> References: <1752261532-7225-1-git-send-email-nunodasneves@linux.microsoft.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" From: Stanislav Kinsburskii Running as nested root on MSHV imposes a different requirement for the pci-hyperv controller. In this setup, the interrupt will first come to the L1 (nested) hypervisor, which will deliver it to the appropriate root CPU. Instead of issuing the RETARGET hypercall, issue the MAP_DEVICE_INTERRUPT hypercall to L1 to complete the setup. Rename hv_arch_irq_unmask() to hv_irq_retarget_interrupt(). Co-developed-by: Jinank Jain Signed-off-by: Jinank Jain Signed-off-by: Stanislav Kinsburskii Signed-off-by: Nuno Das Neves Reviewed-by: Roman Kisel Reviewed-by: Michael Kelley Acked-by: Bjorn Helgaas --- drivers/pci/controller/pci-hyperv.c | 18 ++++++++++++++++-- 1 file changed, 16 insertions(+), 2 deletions(-) diff --git a/drivers/pci/controller/pci-hyperv.c b/drivers/pci/controller/p= ci-hyperv.c index 275b23af3de2..13680363ff19 100644 --- a/drivers/pci/controller/pci-hyperv.c +++ b/drivers/pci/controller/pci-hyperv.c @@ -600,7 +600,7 @@ static unsigned int hv_msi_get_int_vector(struct irq_da= ta *data) #define hv_msi_prepare pci_msi_prepare =20 /** - * hv_arch_irq_unmask() - "Unmask" the IRQ by setting its current + * hv_irq_retarget_interrupt() - "Unmask" the IRQ by setting its current * affinity. * @data: Describes the IRQ * @@ -609,7 +609,7 @@ static unsigned int hv_msi_get_int_vector(struct irq_da= ta *data) * is built out of this PCI bus's instance GUID and the function * number of the device. */ -static void hv_arch_irq_unmask(struct irq_data *data) +static void hv_irq_retarget_interrupt(struct irq_data *data) { struct msi_desc *msi_desc =3D irq_data_get_msi_desc(data); struct hv_retarget_device_interrupt *params; @@ -714,6 +714,20 @@ static void hv_arch_irq_unmask(struct irq_data *data) dev_err(&hbus->hdev->device, "%s() failed: %#llx", __func__, res); } + +static void hv_arch_irq_unmask(struct irq_data *data) +{ + if (hv_root_partition()) + /* + * In case of the nested root partition, the nested hypervisor + * is taking care of interrupt remapping and thus the + * MAP_DEVICE_INTERRUPT hypercall is required instead of + * RETARGET_INTERRUPT. + */ + (void)hv_map_msi_interrupt(data, NULL); + else + hv_irq_retarget_interrupt(data); +} #elif defined(CONFIG_ARM64) /* * SPI vectors to use for vPCI; arch SPIs range is [32, 1019], but leaving= a bit --=20 2.34.1