diff --git a/sdk_container/src/third_party/coreos-overlay/sys-kernel/coreos-sources/coreos-sources-5.15.58.ebuild b/sdk_container/src/third_party/coreos-overlay/sys-kernel/coreos-sources/coreos-sources-5.15.58.ebuild index dc919028a5..e9a1883c76 100644 --- a/sdk_container/src/third_party/coreos-overlay/sys-kernel/coreos-sources/coreos-sources-5.15.58.ebuild +++ b/sdk_container/src/third_party/coreos-overlay/sys-kernel/coreos-sources/coreos-sources-5.15.58.ebuild @@ -40,4 +40,6 @@ UNIPATCH_LIST=" ${PATCH_DIR}/z0003-PCI-hv-Make-the-code-arch-neutral-by-adding-arch-spe.patch \ ${PATCH_DIR}/z0004-PCI-hv-Add-arm64-Hyper-V-vPCI-support.patch \ ${PATCH_DIR}/z0005-Drivers-hv-vmbus-Propagate-VMbus-coherence-to-each-V.patch \ + ${PATCH_DIR}/z0006-PCI-hv-Avoid-the-retarget-interrupt-hypercall-in-irq.patch \ + ${PATCH_DIR}/z0007-PCI-hv-Remove-unused-hv_set_msi_entry_from_desc.patch \ " diff --git a/sdk_container/src/third_party/coreos-overlay/sys-kernel/coreos-sources/files/5.15/z0001-kbuild-derive-relative-path-for-srctree-from-CURDIR.patch b/sdk_container/src/third_party/coreos-overlay/sys-kernel/coreos-sources/files/5.15/z0001-kbuild-derive-relative-path-for-srctree-from-CURDIR.patch index ad52a76d67..e82a1e084f 100644 --- a/sdk_container/src/third_party/coreos-overlay/sys-kernel/coreos-sources/files/5.15/z0001-kbuild-derive-relative-path-for-srctree-from-CURDIR.patch +++ b/sdk_container/src/third_party/coreos-overlay/sys-kernel/coreos-sources/files/5.15/z0001-kbuild-derive-relative-path-for-srctree-from-CURDIR.patch @@ -1,7 +1,7 @@ -From d51a152409430036e6d939cec2ef73f4fd68bd75 Mon Sep 17 00:00:00 2001 +From 5ae7cedb969c1a392e29653e7a1275ee5ffa9e50 Mon Sep 17 00:00:00 2001 From: Vito Caputo Date: Wed, 25 Nov 2015 02:59:45 -0800 -Subject: [PATCH 1/5] kbuild: derive relative path for srctree from CURDIR +Subject: [PATCH 1/7] kbuild: derive relative path for srctree from CURDIR This enables relocating source and build trees to different roots, provided they stay reachable relative to one another. Useful for diff --git a/sdk_container/src/third_party/coreos-overlay/sys-kernel/coreos-sources/files/5.15/z0002-tools-objtool-Makefile-Don-t-fail-on-fallthrough-wit.patch b/sdk_container/src/third_party/coreos-overlay/sys-kernel/coreos-sources/files/5.15/z0002-tools-objtool-Makefile-Don-t-fail-on-fallthrough-wit.patch index 2ce4f2a5be..af70221f4c 100644 --- a/sdk_container/src/third_party/coreos-overlay/sys-kernel/coreos-sources/files/5.15/z0002-tools-objtool-Makefile-Don-t-fail-on-fallthrough-wit.patch +++ b/sdk_container/src/third_party/coreos-overlay/sys-kernel/coreos-sources/files/5.15/z0002-tools-objtool-Makefile-Don-t-fail-on-fallthrough-wit.patch @@ -1,7 +1,7 @@ -From 17f850fda11ee63a18bb9b16e4760bbfc33b3020 Mon Sep 17 00:00:00 2001 +From f654ed34d7082cad0b0105b8f54fc9d78b982eef Mon Sep 17 00:00:00 2001 From: David Michael Date: Thu, 8 Feb 2018 21:23:12 -0500 -Subject: [PATCH 2/5] tools/objtool/Makefile: Don't fail on fallthrough with +Subject: [PATCH 2/7] tools/objtool/Makefile: Don't fail on fallthrough with new GCCs --- diff --git a/sdk_container/src/third_party/coreos-overlay/sys-kernel/coreos-sources/files/5.15/z0003-PCI-hv-Make-the-code-arch-neutral-by-adding-arch-spe.patch b/sdk_container/src/third_party/coreos-overlay/sys-kernel/coreos-sources/files/5.15/z0003-PCI-hv-Make-the-code-arch-neutral-by-adding-arch-spe.patch index 2dd60f52a8..82866e511e 100644 --- a/sdk_container/src/third_party/coreos-overlay/sys-kernel/coreos-sources/files/5.15/z0003-PCI-hv-Make-the-code-arch-neutral-by-adding-arch-spe.patch +++ b/sdk_container/src/third_party/coreos-overlay/sys-kernel/coreos-sources/files/5.15/z0003-PCI-hv-Make-the-code-arch-neutral-by-adding-arch-spe.patch @@ -1,7 +1,7 @@ -From 41b844d9f633b26dea32242217fdaabc8d11a645 Mon Sep 17 00:00:00 2001 +From 80f4d4e5e1042ea78c527d39f44ee16f5a2d3e5a Mon Sep 17 00:00:00 2001 From: Sunil Muthuswamy Date: Wed, 5 Jan 2022 11:32:35 -0800 -Subject: [PATCH 3/5] PCI: hv: Make the code arch neutral by adding arch +Subject: [PATCH 3/7] PCI: hv: Make the code arch neutral by adding arch specific interfaces Encapsulate arch dependencies in Hyper-V vPCI through a set of @@ -25,10 +25,10 @@ Reviewed-by: Boqun Feng Reviewed-by: Marc Zyngier Reviewed-by: Michael Kelley --- - arch/x86/include/asm/hyperv-tlfs.h | 33 +++++++++ - drivers/pci/controller/pci-hyperv.c | 101 ++++++++++++++++------------ - include/asm-generic/hyperv-tlfs.h | 33 --------- - 3 files changed, 92 insertions(+), 75 deletions(-) + arch/x86/include/asm/hyperv-tlfs.h | 33 ++++++++++ + drivers/pci/controller/pci-hyperv.c | 94 ++++++++++++++++------------- + include/asm-generic/hyperv-tlfs.h | 33 ---------- + 3 files changed, 85 insertions(+), 75 deletions(-) diff --git a/arch/x86/include/asm/hyperv-tlfs.h b/arch/x86/include/asm/hyperv-tlfs.h index 2322d6bd5883..fdf3d28fbdd5 100644 @@ -75,7 +75,7 @@ index 2322d6bd5883..fdf3d28fbdd5 100644 #endif diff --git a/drivers/pci/controller/pci-hyperv.c b/drivers/pci/controller/pci-hyperv.c -index 9b54715a4b63..dbbe8417e35e 100644 +index 9b54715a4b63..601d06fe1adc 100644 --- a/drivers/pci/controller/pci-hyperv.c +++ b/drivers/pci/controller/pci-hyperv.c @@ -43,9 +43,6 @@ @@ -88,7 +88,7 @@ index 9b54715a4b63..dbbe8417e35e 100644 #include #include #include -@@ -583,6 +580,51 @@ struct hv_pci_compl { +@@ -583,6 +580,44 @@ struct hv_pci_compl { static void hv_pci_onchannelcallback(void *context); @@ -114,13 +114,6 @@ index 9b54715a4b63..dbbe8417e35e 100644 + return cfg->vector; +} + -+static void hv_set_msi_entry_from_desc(union hv_msi_entry *msi_entry, -+ struct msi_desc *msi_desc) -+{ -+ msi_entry->address.as_uint32 = msi_desc->msg.address_lo; -+ msi_entry->data.as_uint32 = msi_desc->msg.data; -+} -+ +static int hv_msi_prepare(struct irq_domain *domain, struct device *dev, + int nvec, msi_alloc_info_t *info) +{ @@ -140,7 +133,7 @@ index 9b54715a4b63..dbbe8417e35e 100644 /** * hv_pci_generic_compl() - Invoked for a completion packet * @context: Set up by the sender of the packet. -@@ -1195,41 +1237,11 @@ static void hv_msi_free(struct irq_domain *domain, struct msi_domain_info *info, +@@ -1195,41 +1230,11 @@ static void hv_msi_free(struct irq_domain *domain, struct msi_domain_info *info, put_pcichild(hpdev); } @@ -182,7 +175,7 @@ index 9b54715a4b63..dbbe8417e35e 100644 /** * hv_irq_unmask() - "Unmask" the IRQ by setting its current * affinity. -@@ -1243,7 +1255,6 @@ static int hv_msi_prepare(struct irq_domain *domain, struct device *dev, +@@ -1243,7 +1248,6 @@ static int hv_msi_prepare(struct irq_domain *domain, struct device *dev, static void hv_irq_unmask(struct irq_data *data) { struct msi_desc *msi_desc = irq_data_get_msi_desc(data); @@ -190,7 +183,7 @@ index 9b54715a4b63..dbbe8417e35e 100644 struct hv_retarget_device_interrupt *params; struct tran_int_desc *int_desc; struct hv_pcibus_device *hbus; -@@ -1275,7 +1286,7 @@ static void hv_irq_unmask(struct irq_data *data) +@@ -1275,7 +1279,7 @@ static void hv_irq_unmask(struct irq_data *data) (hbus->hdev->dev_instance.b[7] << 8) | (hbus->hdev->dev_instance.b[6] & 0xf8) | PCI_FUNC(pdev->devfn); @@ -199,7 +192,7 @@ index 9b54715a4b63..dbbe8417e35e 100644 /* * Honoring apic->delivery_mode set to APIC_DELIVERY_MODE_FIXED by -@@ -1376,7 +1387,7 @@ static u32 hv_compose_msi_req_v1( +@@ -1376,7 +1380,7 @@ static u32 hv_compose_msi_req_v1( int_pkt->wslot.slot = slot; int_pkt->int_desc.vector = vector; int_pkt->int_desc.vector_count = vector_count; @@ -208,7 +201,7 @@ index 9b54715a4b63..dbbe8417e35e 100644 /* * Create MSI w/ dummy vCPU set, overwritten by subsequent retarget in -@@ -1406,7 +1417,7 @@ static u32 hv_compose_msi_req_v2( +@@ -1406,7 +1410,7 @@ static u32 hv_compose_msi_req_v2( int_pkt->wslot.slot = slot; int_pkt->int_desc.vector = vector; int_pkt->int_desc.vector_count = vector_count; @@ -217,7 +210,7 @@ index 9b54715a4b63..dbbe8417e35e 100644 cpu = hv_compose_msi_req_get_cpu(affinity); int_pkt->int_desc.processor_array[0] = hv_cpu_number_to_vp_number(cpu); -@@ -1426,7 +1437,7 @@ static u32 hv_compose_msi_req_v3( +@@ -1426,7 +1430,7 @@ static u32 hv_compose_msi_req_v3( int_pkt->int_desc.vector = vector; int_pkt->int_desc.reserved = 0; int_pkt->int_desc.vector_count = vector_count; @@ -226,7 +219,7 @@ index 9b54715a4b63..dbbe8417e35e 100644 cpu = hv_compose_msi_req_get_cpu(affinity); int_pkt->int_desc.processor_array[0] = hv_cpu_number_to_vp_number(cpu); -@@ -1660,7 +1671,7 @@ static void hv_compose_msi_msg(struct irq_data *data, struct msi_msg *msg) +@@ -1660,7 +1664,7 @@ static void hv_compose_msi_msg(struct irq_data *data, struct msi_msg *msg) static struct irq_chip hv_msi_irq_chip = { .name = "Hyper-V PCIe MSI", .irq_compose_msi_msg = hv_compose_msi_msg, @@ -235,7 +228,7 @@ index 9b54715a4b63..dbbe8417e35e 100644 .irq_ack = irq_chip_ack_parent, .irq_mask = hv_irq_mask, .irq_unmask = hv_irq_unmask, -@@ -1691,12 +1702,12 @@ static int hv_pcie_init_irq_domain(struct hv_pcibus_device *hbus) +@@ -1691,12 +1695,12 @@ static int hv_pcie_init_irq_domain(struct hv_pcibus_device *hbus) hbus->msi_info.flags = (MSI_FLAG_USE_DEF_DOM_OPS | MSI_FLAG_USE_DEF_CHIP_OPS | MSI_FLAG_MULTI_PCI_MSI | MSI_FLAG_PCI_MSIX); @@ -251,7 +244,7 @@ index 9b54715a4b63..dbbe8417e35e 100644 if (!hbus->irq_domain) { dev_err(&hbus->hdev->device, "Failed to build an MSI IRQ domain\n"); -@@ -3626,9 +3637,15 @@ static void __exit exit_hv_pci_drv(void) +@@ -3626,9 +3630,15 @@ static void __exit exit_hv_pci_drv(void) static int __init init_hv_pci_drv(void) { diff --git a/sdk_container/src/third_party/coreos-overlay/sys-kernel/coreos-sources/files/5.15/z0004-PCI-hv-Add-arm64-Hyper-V-vPCI-support.patch b/sdk_container/src/third_party/coreos-overlay/sys-kernel/coreos-sources/files/5.15/z0004-PCI-hv-Add-arm64-Hyper-V-vPCI-support.patch index a168f02aa9..05d66b9d6b 100644 --- a/sdk_container/src/third_party/coreos-overlay/sys-kernel/coreos-sources/files/5.15/z0004-PCI-hv-Add-arm64-Hyper-V-vPCI-support.patch +++ b/sdk_container/src/third_party/coreos-overlay/sys-kernel/coreos-sources/files/5.15/z0004-PCI-hv-Add-arm64-Hyper-V-vPCI-support.patch @@ -1,7 +1,7 @@ -From 3f4698886b7c3bcc95de4aea5c852d4e5ab59544 Mon Sep 17 00:00:00 2001 +From 802291ee132c756996438afb97dd9d25f9fa5d08 Mon Sep 17 00:00:00 2001 From: Sunil Muthuswamy Date: Wed, 5 Jan 2022 11:32:36 -0800 -Subject: [PATCH 4/5] PCI: hv: Add arm64 Hyper-V vPCI support +Subject: [PATCH 4/7] PCI: hv: Add arm64 Hyper-V vPCI support Add arm64 Hyper-V vPCI support by implementing the arch specific interfaces. Introduce an IRQ domain and chip specific to Hyper-v vPCI that @@ -70,7 +70,7 @@ index 326f7d13024f..b24edba0b870 100644 The Hyper-V PCI Interface is a helper driver allows other drivers to have a common interface with the Hyper-V PCI frontend driver. diff --git a/drivers/pci/controller/pci-hyperv.c b/drivers/pci/controller/pci-hyperv.c -index dbbe8417e35e..e123cf8a2b3c 100644 +index 601d06fe1adc..42c625bc5944 100644 --- a/drivers/pci/controller/pci-hyperv.c +++ b/drivers/pci/controller/pci-hyperv.c @@ -47,6 +47,8 @@ @@ -82,7 +82,7 @@ index dbbe8417e35e..e123cf8a2b3c 100644 #include /* -@@ -623,7 +625,230 @@ static int hv_msi_prepare(struct irq_domain *domain, struct device *dev, +@@ -616,7 +618,230 @@ static int hv_msi_prepare(struct irq_domain *domain, struct device *dev, return ret; } @@ -314,7 +314,7 @@ index dbbe8417e35e..e123cf8a2b3c 100644 /** * hv_pci_generic_compl() - Invoked for a completion packet -@@ -1240,6 +1465,8 @@ static void hv_msi_free(struct irq_domain *domain, struct msi_domain_info *info, +@@ -1233,6 +1458,8 @@ static void hv_msi_free(struct irq_domain *domain, struct msi_domain_info *info, static void hv_irq_mask(struct irq_data *data) { pci_msi_mask_irq(data); @@ -323,7 +323,7 @@ index dbbe8417e35e..e123cf8a2b3c 100644 } /** -@@ -1359,6 +1586,8 @@ static void hv_irq_unmask(struct irq_data *data) +@@ -1352,6 +1579,8 @@ static void hv_irq_unmask(struct irq_data *data) dev_err(&hbus->hdev->device, "%s() failed: %#llx", __func__, res); @@ -332,7 +332,7 @@ index dbbe8417e35e..e123cf8a2b3c 100644 pci_msi_unmask_irq(data); } -@@ -1672,7 +1901,11 @@ static struct irq_chip hv_msi_irq_chip = { +@@ -1665,7 +1894,11 @@ static struct irq_chip hv_msi_irq_chip = { .name = "Hyper-V PCIe MSI", .irq_compose_msi_msg = hv_compose_msi_msg, .irq_set_affinity = irq_chip_set_affinity_parent, diff --git a/sdk_container/src/third_party/coreos-overlay/sys-kernel/coreos-sources/files/5.15/z0005-Drivers-hv-vmbus-Propagate-VMbus-coherence-to-each-V.patch b/sdk_container/src/third_party/coreos-overlay/sys-kernel/coreos-sources/files/5.15/z0005-Drivers-hv-vmbus-Propagate-VMbus-coherence-to-each-V.patch index fdc7b68c61..7e5588a061 100644 --- a/sdk_container/src/third_party/coreos-overlay/sys-kernel/coreos-sources/files/5.15/z0005-Drivers-hv-vmbus-Propagate-VMbus-coherence-to-each-V.patch +++ b/sdk_container/src/third_party/coreos-overlay/sys-kernel/coreos-sources/files/5.15/z0005-Drivers-hv-vmbus-Propagate-VMbus-coherence-to-each-V.patch @@ -1,7 +1,7 @@ -From 75baa46a53a465668cbb875ceef03e659ff29694 Mon Sep 17 00:00:00 2001 +From cdbc1cd23ea659b8fc8f67fa0d88654eb90a01fe Mon Sep 17 00:00:00 2001 From: Michael Kelley Date: Thu, 24 Mar 2022 09:14:51 -0700 -Subject: [PATCH 5/5] Drivers: hv: vmbus: Propagate VMbus coherence to each +Subject: [PATCH 5/7] Drivers: hv: vmbus: Propagate VMbus coherence to each VMbus device VMbus synthetic devices are not represented in the ACPI DSDT -- only diff --git a/sdk_container/src/third_party/coreos-overlay/sys-kernel/coreos-sources/files/5.15/z0006-PCI-hv-Avoid-the-retarget-interrupt-hypercall-in-irq.patch b/sdk_container/src/third_party/coreos-overlay/sys-kernel/coreos-sources/files/5.15/z0006-PCI-hv-Avoid-the-retarget-interrupt-hypercall-in-irq.patch new file mode 100644 index 0000000000..e95fbd646c --- /dev/null +++ b/sdk_container/src/third_party/coreos-overlay/sys-kernel/coreos-sources/files/5.15/z0006-PCI-hv-Avoid-the-retarget-interrupt-hypercall-in-irq.patch @@ -0,0 +1,302 @@ +From 72b9ec2f281657bd50c8acfc0aa297ccd9a9f260 Mon Sep 17 00:00:00 2001 +From: Boqun Feng +Date: Thu, 17 Feb 2022 11:45:19 +0800 +Subject: [PATCH 6/7] PCI: hv: Avoid the retarget interrupt hypercall in + irq_unmask() on ARM64 +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +On ARM64 Hyper-V guests, SPIs are used for the interrupts of virtual PCI +devices, and SPIs can be managed directly via GICD registers. Therefore +the retarget interrupt hypercall is not needed on ARM64. + +An arch-specific interface hv_arch_irq_unmask() is introduced to handle +the architecture level differences on this. For x86, the behavior +remains unchanged, while for ARM64 no hypercall is invoked when +unmasking an irq for virtual PCI devices. + +Link: https://lore.kernel.org/r/20220217034525.1687678-1-boqun.feng@gmail.com +Signed-off-by: Boqun Feng +Signed-off-by: Lorenzo Pieralisi +Reviewed-by: Michael Kelley + +jepio: Upstream commit d06957d7a6929e6a4aa959cb59d66f0c095fc974+squashed +455880dfe292a2bdd3b4ad6a107299fce610e64b into this. 5.15 contains 455880d +(35d24b115a407c0a1a73900d025da77be2763ed3) but not the rest of ARM64+PCI +enablement (which we carry) so without this patch there is a build failure: + + drivers/pci/controller/pci-hyperv.c:1509:37: error: request for member ���as_uint32��� in something not a structure or union +--- + drivers/pci/controller/pci-hyperv.c | 239 +++++++++++++++------------- + 1 file changed, 125 insertions(+), 114 deletions(-) + +diff --git a/drivers/pci/controller/pci-hyperv.c b/drivers/pci/controller/pci-hyperv.c +index 42c625bc5944..165dfb98d3d8 100644 +--- a/drivers/pci/controller/pci-hyperv.c ++++ b/drivers/pci/controller/pci-hyperv.c +@@ -618,6 +618,124 @@ static int hv_msi_prepare(struct irq_domain *domain, struct device *dev, + + return ret; + } ++ ++/** ++ * hv_arch_irq_unmask() - "Unmask" the IRQ by setting its current ++ * affinity. ++ * @data: Describes the IRQ ++ * ++ * Build new a destination for the MSI and make a hypercall to ++ * update the Interrupt Redirection Table. "Device Logical ID" ++ * 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) ++{ ++ struct msi_desc *msi_desc = irq_data_get_msi_desc(data); ++ struct hv_retarget_device_interrupt *params; ++ struct tran_int_desc *int_desc; ++ struct hv_pcibus_device *hbus; ++ struct cpumask *dest; ++ cpumask_var_t tmp; ++ struct pci_bus *pbus; ++ struct pci_dev *pdev; ++ unsigned long flags; ++ u32 var_size = 0; ++ int cpu, nr_bank; ++ u64 res; ++ ++ dest = irq_data_get_effective_affinity_mask(data); ++ pdev = msi_desc_to_pci_dev(msi_desc); ++ pbus = pdev->bus; ++ hbus = container_of(pbus->sysdata, struct hv_pcibus_device, sysdata); ++ int_desc = data->chip_data; ++ ++ spin_lock_irqsave(&hbus->retarget_msi_interrupt_lock, flags); ++ ++ params = &hbus->retarget_msi_interrupt_params; ++ memset(params, 0, sizeof(*params)); ++ params->partition_id = HV_PARTITION_ID_SELF; ++ params->int_entry.source = HV_INTERRUPT_SOURCE_MSI; ++ params->int_entry.msi_entry.address.as_uint32 = int_desc->address & 0xffffffff; ++ params->int_entry.msi_entry.data.as_uint32 = int_desc->data; ++ params->device_id = (hbus->hdev->dev_instance.b[5] << 24) | ++ (hbus->hdev->dev_instance.b[4] << 16) | ++ (hbus->hdev->dev_instance.b[7] << 8) | ++ (hbus->hdev->dev_instance.b[6] & 0xf8) | ++ PCI_FUNC(pdev->devfn); ++ params->int_target.vector = hv_msi_get_int_vector(data); ++ ++ /* ++ * Honoring apic->delivery_mode set to APIC_DELIVERY_MODE_FIXED by ++ * setting the HV_DEVICE_INTERRUPT_TARGET_MULTICAST flag results in a ++ * spurious interrupt storm. Not doing so does not seem to have a ++ * negative effect (yet?). ++ */ ++ ++ if (hbus->protocol_version >= PCI_PROTOCOL_VERSION_1_2) { ++ /* ++ * PCI_PROTOCOL_VERSION_1_2 supports the VP_SET version of the ++ * HVCALL_RETARGET_INTERRUPT hypercall, which also coincides ++ * with >64 VP support. ++ * ms_hyperv.hints & HV_X64_EX_PROCESSOR_MASKS_RECOMMENDED ++ * is not sufficient for this hypercall. ++ */ ++ params->int_target.flags |= ++ HV_DEVICE_INTERRUPT_TARGET_PROCESSOR_SET; ++ ++ if (!alloc_cpumask_var(&tmp, GFP_ATOMIC)) { ++ res = 1; ++ goto exit_unlock; ++ } ++ ++ cpumask_and(tmp, dest, cpu_online_mask); ++ nr_bank = cpumask_to_vpset(¶ms->int_target.vp_set, tmp); ++ free_cpumask_var(tmp); ++ ++ if (nr_bank <= 0) { ++ res = 1; ++ goto exit_unlock; ++ } ++ ++ /* ++ * var-sized hypercall, var-size starts after vp_mask (thus ++ * vp_set.format does not count, but vp_set.valid_bank_mask ++ * does). ++ */ ++ var_size = 1 + nr_bank; ++ } else { ++ for_each_cpu_and(cpu, dest, cpu_online_mask) { ++ params->int_target.vp_mask |= ++ (1ULL << hv_cpu_number_to_vp_number(cpu)); ++ } ++ } ++ ++ res = hv_do_hypercall(HVCALL_RETARGET_INTERRUPT | (var_size << 17), ++ params, NULL); ++ ++exit_unlock: ++ spin_unlock_irqrestore(&hbus->retarget_msi_interrupt_lock, flags); ++ ++ /* ++ * During hibernation, when a CPU is offlined, the kernel tries ++ * to move the interrupt to the remaining CPUs that haven't ++ * been offlined yet. In this case, the below hv_do_hypercall() ++ * always fails since the vmbus channel has been closed: ++ * refer to cpu_disable_common() -> fixup_irqs() -> ++ * irq_migrate_all_off_this_cpu() -> migrate_one_irq(). ++ * ++ * Suppress the error message for hibernation because the failure ++ * during hibernation does not matter (at this time all the devices ++ * have been frozen). Note: the correct affinity info is still updated ++ * into the irqdata data structure in migrate_one_irq() -> ++ * irq_do_set_affinity() -> hv_set_affinity(), so later when the VM ++ * resumes, hv_pci_restore_msi_state() is able to correctly restore ++ * the interrupt with the correct affinity. ++ */ ++ if (!hv_result_success(res) && hbus->state != hv_pcibus_removing) ++ dev_err(&hbus->hdev->device, ++ "%s() failed: %#llx", __func__, res); ++} + #elif defined(CONFIG_ARM64) + /* + * SPI vectors to use for vPCI; arch SPIs range is [32, 1019], but leaving a bit +@@ -841,6 +959,12 @@ static struct irq_domain *hv_pci_get_root_domain(void) + { + return hv_msi_gic_irq_domain; + } ++ ++/* ++ * SPIs are used for interrupts of PCI devices and SPIs is managed via GICD ++ * registers which Hyper-V already supports, so no hypercall needed. ++ */ ++static void hv_arch_irq_unmask(struct irq_data *data) { } + #endif /* CONFIG_ARM64 */ + + /** +@@ -1462,122 +1586,9 @@ static void hv_irq_mask(struct irq_data *data) + irq_chip_mask_parent(data); + } + +-/** +- * hv_irq_unmask() - "Unmask" the IRQ by setting its current +- * affinity. +- * @data: Describes the IRQ +- * +- * Build new a destination for the MSI and make a hypercall to +- * update the Interrupt Redirection Table. "Device Logical ID" +- * is built out of this PCI bus's instance GUID and the function +- * number of the device. +- */ + static void hv_irq_unmask(struct irq_data *data) + { +- struct msi_desc *msi_desc = irq_data_get_msi_desc(data); +- struct hv_retarget_device_interrupt *params; +- struct tran_int_desc *int_desc; +- struct hv_pcibus_device *hbus; +- struct cpumask *dest; +- cpumask_var_t tmp; +- struct pci_bus *pbus; +- struct pci_dev *pdev; +- unsigned long flags; +- u32 var_size = 0; +- int cpu, nr_bank; +- u64 res; +- +- dest = irq_data_get_effective_affinity_mask(data); +- pdev = msi_desc_to_pci_dev(msi_desc); +- pbus = pdev->bus; +- hbus = container_of(pbus->sysdata, struct hv_pcibus_device, sysdata); +- int_desc = data->chip_data; +- +- spin_lock_irqsave(&hbus->retarget_msi_interrupt_lock, flags); +- +- params = &hbus->retarget_msi_interrupt_params; +- memset(params, 0, sizeof(*params)); +- params->partition_id = HV_PARTITION_ID_SELF; +- params->int_entry.source = HV_INTERRUPT_SOURCE_MSI; +- params->int_entry.msi_entry.address.as_uint32 = int_desc->address & 0xffffffff; +- params->int_entry.msi_entry.data.as_uint32 = int_desc->data; +- params->device_id = (hbus->hdev->dev_instance.b[5] << 24) | +- (hbus->hdev->dev_instance.b[4] << 16) | +- (hbus->hdev->dev_instance.b[7] << 8) | +- (hbus->hdev->dev_instance.b[6] & 0xf8) | +- PCI_FUNC(pdev->devfn); +- params->int_target.vector = hv_msi_get_int_vector(data); +- +- /* +- * Honoring apic->delivery_mode set to APIC_DELIVERY_MODE_FIXED by +- * setting the HV_DEVICE_INTERRUPT_TARGET_MULTICAST flag results in a +- * spurious interrupt storm. Not doing so does not seem to have a +- * negative effect (yet?). +- */ +- +- if (hbus->protocol_version >= PCI_PROTOCOL_VERSION_1_2) { +- /* +- * PCI_PROTOCOL_VERSION_1_2 supports the VP_SET version of the +- * HVCALL_RETARGET_INTERRUPT hypercall, which also coincides +- * with >64 VP support. +- * ms_hyperv.hints & HV_X64_EX_PROCESSOR_MASKS_RECOMMENDED +- * is not sufficient for this hypercall. +- */ +- params->int_target.flags |= +- HV_DEVICE_INTERRUPT_TARGET_PROCESSOR_SET; +- +- if (!alloc_cpumask_var(&tmp, GFP_ATOMIC)) { +- res = 1; +- goto exit_unlock; +- } +- +- cpumask_and(tmp, dest, cpu_online_mask); +- nr_bank = cpumask_to_vpset(¶ms->int_target.vp_set, tmp); +- free_cpumask_var(tmp); +- +- if (nr_bank <= 0) { +- res = 1; +- goto exit_unlock; +- } +- +- /* +- * var-sized hypercall, var-size starts after vp_mask (thus +- * vp_set.format does not count, but vp_set.valid_bank_mask +- * does). +- */ +- var_size = 1 + nr_bank; +- } else { +- for_each_cpu_and(cpu, dest, cpu_online_mask) { +- params->int_target.vp_mask |= +- (1ULL << hv_cpu_number_to_vp_number(cpu)); +- } +- } +- +- res = hv_do_hypercall(HVCALL_RETARGET_INTERRUPT | (var_size << 17), +- params, NULL); +- +-exit_unlock: +- spin_unlock_irqrestore(&hbus->retarget_msi_interrupt_lock, flags); +- +- /* +- * During hibernation, when a CPU is offlined, the kernel tries +- * to move the interrupt to the remaining CPUs that haven't +- * been offlined yet. In this case, the below hv_do_hypercall() +- * always fails since the vmbus channel has been closed: +- * refer to cpu_disable_common() -> fixup_irqs() -> +- * irq_migrate_all_off_this_cpu() -> migrate_one_irq(). +- * +- * Suppress the error message for hibernation because the failure +- * during hibernation does not matter (at this time all the devices +- * have been frozen). Note: the correct affinity info is still updated +- * into the irqdata data structure in migrate_one_irq() -> +- * irq_do_set_affinity() -> hv_set_affinity(), so later when the VM +- * resumes, hv_pci_restore_msi_state() is able to correctly restore +- * the interrupt with the correct affinity. +- */ +- if (!hv_result_success(res) && hbus->state != hv_pcibus_removing) +- dev_err(&hbus->hdev->device, +- "%s() failed: %#llx", __func__, res); ++ hv_arch_irq_unmask(data); + + if (data->parent_data->chip->irq_unmask) + irq_chip_unmask_parent(data); +-- +2.34.1 + diff --git a/sdk_container/src/third_party/coreos-overlay/sys-kernel/coreos-sources/files/5.15/z0007-PCI-hv-Remove-unused-hv_set_msi_entry_from_desc.patch b/sdk_container/src/third_party/coreos-overlay/sys-kernel/coreos-sources/files/5.15/z0007-PCI-hv-Remove-unused-hv_set_msi_entry_from_desc.patch new file mode 100644 index 0000000000..4fb50b3db4 --- /dev/null +++ b/sdk_container/src/third_party/coreos-overlay/sys-kernel/coreos-sources/files/5.15/z0007-PCI-hv-Remove-unused-hv_set_msi_entry_from_desc.patch @@ -0,0 +1,50 @@ +From d840bda57a70e672dcd2d5adbac5ef1f76c3082a Mon Sep 17 00:00:00 2001 +From: YueHaibing +Date: Thu, 17 Mar 2022 16:51:30 +0800 +Subject: [PATCH 7/7] PCI: hv: Remove unused hv_set_msi_entry_from_desc() +MIME-Version: 1.0 +Content-Type: text/plain; charset=UTF-8 +Content-Transfer-Encoding: 8bit + +Fix the following build error: + + drivers/pci/controller/pci-hyperv.c:769:13: error: ‘hv_set_msi_entry_from_desc’ defined but not used [-Werror=unused-function] + 769 | static void hv_set_msi_entry_from_desc(union hv_msi_entry *msi_entry, + +The arm64 implementation of hv_set_msi_entry_from_desc() is not used after +d06957d7a692 ("PCI: hv: Avoid the retarget interrupt hypercall in +irq_unmask() on ARM64"), so remove it. + +Fixes: d06957d7a692 ("PCI: hv: Avoid the retarget interrupt hypercall in irq_unmask() on ARM64") +Link: https://lore.kernel.org/r/20220317085130.36388-1-yuehaibing@huawei.com +Signed-off-by: YueHaibing +Signed-off-by: Bjorn Helgaas +Reviewed-by: Nathan Chancellor +Acked-by: Boqun Feng +(cherry picked from commit 22ef7ee3eeb2a41e07f611754ab9a2663232fedf) +--- + drivers/pci/controller/pci-hyperv.c | 8 -------- + 1 file changed, 8 deletions(-) + +diff --git a/drivers/pci/controller/pci-hyperv.c b/drivers/pci/controller/pci-hyperv.c +index 165dfb98d3d8..2db98b4fbc1f 100644 +--- a/drivers/pci/controller/pci-hyperv.c ++++ b/drivers/pci/controller/pci-hyperv.c +@@ -771,14 +771,6 @@ static unsigned int hv_msi_get_int_vector(struct irq_data *irqd) + return irqd->parent_data->hwirq; + } + +-static void hv_set_msi_entry_from_desc(union hv_msi_entry *msi_entry, +- struct msi_desc *msi_desc) +-{ +- msi_entry->address = ((u64)msi_desc->msg.address_hi << 32) | +- msi_desc->msg.address_lo; +- msi_entry->data = msi_desc->msg.data; +-} +- + /* + * @nr_bm_irqs: Indicates the number of IRQs that were allocated from + * the bitmap. +-- +2.34.1 +