From patchwork Sun Nov 17 23:48:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: dullfire@yahoo.com X-Patchwork-Id: 13877992 Received: from sonic304-10.consmr.mail.bf2.yahoo.com (sonic304-10.consmr.mail.bf2.yahoo.com [74.6.128.33]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 627E838B for ; Mon, 18 Nov 2024 00:10:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.6.128.33 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731888607; cv=none; b=Rts/xHq482/M63kJGn55HnYO1iNXjqQEjPW1EEH/CxmbbHoHr03hr6oapr6yiAIW//7SM0HemshEdZNIHe3rPZBNOoikFVT3ZDPpgdfnWo7JogHpXKH79xc33m79UTnnYxZ5SWOLUvcLDS8LQR0jSP9nJSm//oTbpArSOZtXEEU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731888607; c=relaxed/simple; bh=IvWoevXXpmOe+XQTPhPlMfQe/45LyI5ZKS9WsLqakXc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=rK25rkCIQovCuYH8kwFtW9edn5rr5WwiOzDf/BwtdjJQ/sFbCFn9sWXqK6l8CQ3GZ4MxvGojBfgpaUuZemqsbLxxjQ7/kJp6jyBVev1t5ls1/qBGTMeAibfTkoMxgMUNYcHfuWDN7A9TBN++Wfq6pNbxuEB2GXxiwvuy1RhFmuQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=yahoo.com; spf=pass smtp.mailfrom=yahoo.com; dkim=pass (2048-bit key) header.d=yahoo.com header.i=@yahoo.com header.b=tfKkfvCZ; arc=none smtp.client-ip=74.6.128.33 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=yahoo.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=yahoo.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=yahoo.com header.i=@yahoo.com header.b="tfKkfvCZ" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1731888605; bh=r8BNRTgQmSesSBBIr5W5/aasZKD6i/fztbdUkMyjEmU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From:Subject:Reply-To; b=tfKkfvCZAgJMHl+BS4l36i17K3Dk2JSkGWNHvjHb7Ha90WtCQiT++yihb4AWdBMtWNR38oqVR0H4PcxV602pIinKe9vp8mb89emWEh3ucnHHOwJmBbBVVl+ZV6+Gxq35DrPwE1JQuyHtmD/OgoR9cDDkCghVzKwVM3HsRNEJKvYG5zr6ICDvAKy/3EOs6Z/LGDaruRydoh/6mYfgmimlEUIeEd7e3fVuzfBdUmnfPgJnbnCQgfWuo+4wdqoqLcKZfyyKZPcD+ivxT+N6iGmI8fFgaDYKgaBMrfJLfwez+DYHslIQY7KcJhIswDAB0JbAMNlupUEfWeON2DepOmCYVQ== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1731888605; bh=BVzDAncCZPAECNYBRxg+S+zYoylTJK9IzpdL1x+bI2g=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=t5UWJ7GmUCFcT4ehqGzsjsvp7qvYR87G1Dx3MKK4XW7AtQ/lgujwHOZleTJBTDg45wgZVPap7EIlNhfiTdVotmO/8D80EWiZw2vpKD/KZkxt1pa1fxMefm9n4sGBu40pbfNv/iIkZiDU9fYwTJXSA7LkNInvzxNo1K2XatKwFOznt8nhjMRPZcQIGyidV7YEkX9Biv+ZIn/547eESPENqleAuoefhqgHG+iiBD0FdOotXbF/gedITnVaEAffGEgZICcmDE/bSmEBnD4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6woI64XVGwgcebu.zO0f2t51WU1M_k7aHrmjS4J1_g6utr6YTj3rPTWwuTibCCA97_SqnWH x7ypaRyx9dfHO8QCoRrBvDx8tcWq1GmJ9uLftNI_diNMnb4jxe2TKzk7lwldKWknkpELA0zGGWCT rX4.f3HXLa4pAOE5wUaXJnb9wJC4CO7ft0BSLvNF57vxfdCJPcintJiw9haKO5zU7KjB3XRV.cOn a09nwGVVI6h.EcelZy0U4gBaVxvEbAeNvJJ4JlUILX36qM56t7hmZqymFA2Q4sn_drAO2RmWln9K cYFgLzC.QaA-- X-Sonic-MF: X-Sonic-ID: 70525826-f25d-4d3f-9322-0992ef71de14 Received: from sonic.gate.mail.ne1.yahoo.com by sonic304.consmr.mail.bf2.yahoo.com with HTTP; Mon, 18 Nov 2024 00:10:05 +0000 Received: by hermes--production-ne1-bfc75c9cd-n46s2 (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID c49c6779fa1a016527bc8d82f3fd465e; Sun, 17 Nov 2024 23:49:47 +0000 (UTC) From: dullfire@yahoo.com To: "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Bjorn Helgaas , Jacob Keller , Simon Horman , Thomas Gleixner , Mostafa Saleh , Marc Zyngier , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org Cc: Jonathan Currier , stable@vger.kernel.org Subject: [PATCH 1/2] PCI/MSI: Add MSIX option to write to ENTRY_DATA before any reads Date: Sun, 17 Nov 2024 17:48:42 -0600 Message-ID: <20241117234843.19236-2-dullfire@yahoo.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241117234843.19236-1-dullfire@yahoo.com> References: <20241117234843.19236-1-dullfire@yahoo.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 From: Jonathan Currier Commit 7d5ec3d36123 ("PCI/MSI: Mask all unused MSI-X entries") introduces a readl() from ENTRY_VECTOR_CTRL before the writel() to ENTRY_DATA. This is correct, however some hardware, like the Sun Neptune chips, the niu module, will cause an error and/or fatal trap if any MSIX table entry is read before the corresponding ENTRY_DATA field is written to. This patch adds an optional early writel() in msix_prepare_msi_desc(). Cc: stable@vger.kernel.org Signed-off-by: Jonathan Currier --- drivers/pci/msi/msi.c | 2 ++ include/linux/pci.h | 2 ++ 2 files changed, 4 insertions(+) diff --git a/drivers/pci/msi/msi.c b/drivers/pci/msi/msi.c index 3a45879d85db..50d87fb5e37f 100644 --- a/drivers/pci/msi/msi.c +++ b/drivers/pci/msi/msi.c @@ -611,6 +611,8 @@ void msix_prepare_msi_desc(struct pci_dev *dev, struct msi_desc *desc) if (desc->pci.msi_attrib.can_mask) { void __iomem *addr = pci_msix_desc_addr(desc); + if (dev->dev_flags & PCI_DEV_FLAGS_MSIX_TOUCH_ENTRY_DATA_FIRST) + writel(0, addr + PCI_MSIX_ENTRY_DATA); desc->pci.msix_ctrl = readl(addr + PCI_MSIX_ENTRY_VECTOR_CTRL); } } diff --git a/include/linux/pci.h b/include/linux/pci.h index 37d97bef060f..b8b95b58d522 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -245,6 +245,8 @@ enum pci_dev_flags { PCI_DEV_FLAGS_NO_RELAXED_ORDERING = (__force pci_dev_flags_t) (1 << 11), /* Device does honor MSI masking despite saying otherwise */ PCI_DEV_FLAGS_HAS_MSI_MASKING = (__force pci_dev_flags_t) (1 << 12), + /* Device requires write to PCI_MSIX_ENTRY_DATA before any MSIX reads */ + PCI_DEV_FLAGS_MSIX_TOUCH_ENTRY_DATA_FIRST = (__force pci_dev_flags_t) (1 << 13), }; enum pci_irq_reroute_variant { From patchwork Sun Nov 17 23:48:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: dullfire@yahoo.com X-Patchwork-Id: 13877991 X-Patchwork-Delegate: kuba@kernel.org Received: from sonic304-10.consmr.mail.bf2.yahoo.com (sonic304-10.consmr.mail.bf2.yahoo.com [74.6.128.33]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0E5BD4437 for ; Mon, 18 Nov 2024 00:00:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.6.128.33 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731888015; cv=none; b=OobtZfZiwMvU7iZmbArWWsczAMReK/8rCI9uE304ur/35XGinsNDLSttwMe4KggPa90EoJczz2bAThqBVeK93ZzNhLMLLOaudGx6cazxojySFqVvUE3aE3bu/mPaWvrGCEDtXf6dynXeaLLkHEctANTDxEIC9e7ZHQFYmoo4gGg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1731888015; c=relaxed/simple; bh=YUce759kQ7h05bVUbjxEdZsIcSJvZgYa1EEcx85iesg=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=UMkxXZgzdozuLZ7xyeb4cfeKDoNk88dfIAlh6YS2AGzWzo4Ty6t8UTs9tAN1bdNUISMF1EKD/RIiJzi0Eu0TbMOJh20fvkG757aeSu2Km9t85+MIiMg7q5ULvdJDxtQwEL4G+EwgNzdD33Xj5Yjrxw1VQ5GqCvjDbhz8m8yVpIE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=yahoo.com; spf=pass smtp.mailfrom=yahoo.com; dkim=pass (2048-bit key) header.d=yahoo.com header.i=@yahoo.com header.b=FRvxydlV; arc=none smtp.client-ip=74.6.128.33 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=yahoo.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=yahoo.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=yahoo.com header.i=@yahoo.com header.b="FRvxydlV" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1731888013; bh=sRhtt7tAu+00jSTS4pSlYyOtlC3u9JS4ZajQtj5R2sU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From:Subject:Reply-To; b=FRvxydlVb9DnHyEB0Qd/+Jdbm0txBdhQGXsrLlDLRK934aF5HsgdrG9p5Hh/GxMw5Yo9xlnyoS0IEHTeu8JDsRpa0eg1BK2T9cvd8JrVMnM31a/DYYVKTaahOw9TjRziqTLBtpPCkIZ4Rsdkve22qSlSHmPTRLZBLHKte/1UkUJoad1vRDRLo3T2nmEC2SPfEoC/ar0ZxDIVosPX/smOrb5LdsN0WeOf9atLEXHtfDvxCbO2MpgA32BzFpEP7s4UImM4XX+8S7dMSh7sEMaydLfGNkehiFEAg/iOtTdzqBxdFzuI9M/JSwqItn4yu3HvlG/P904NUnpKdPIjxiI+Dg== X-SONIC-DKIM-SIGN: v=1; a=rsa-sha256; c=relaxed/relaxed; d=yahoo.com; s=s2048; t=1731888013; bh=86UgW5vsC9UFrjd/hPlhn2JVBmMFjshctjO7PaDmBy3=; h=X-Sonic-MF:From:To:Subject:Date:From:Subject; b=r40Bvl7ZitVnSHPk9YSFgJnTr7vUsE07pS9a66BSzakWztGzsyoBRa5okAqwJCMaFKV5xnKLG7bJPFlk1J9KC4DoLSQwGULvtpNDo9OfbjRqZFDrbp4XXwFhgXN8g6dBABeoeaUmBujMzHsXHTPVx0JATzgqBAPr36uD2ZfAUozh+s+brDCtosyJFspssiR2QhlYWtpcLOGXnHOsl3vQN3oaKq8UMzzH9LEnRNq52cQdHcrwRmvxQtIQeDPJRrPe6qJs3uK8A/yLIqFQTUWE+URiFnkuuzxPpu7BdVKnddGGbdIzZ7NKvHOxqPYNj0fGU7BfuvINKyYUbKkhQwi3tQ== X-YMail-OSG: S28iDfEVM1noTl7odYQW8JPO9sf.F5u2nsp1airlMe9S31uaNGAvXgAoPzFtXl2 9oreKtx2ZNdofsk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z2V4GLvyEm0jNIKAVoOoZirS_MVWB896H1WqY9yLdJUkJ_1o73VEIf4VmyUxJ86Fb Na5SOQDQIkhj5DHSgwGTV5R967U4dzs.dTUPuj3XIfsGx8fYGU8Ie6d3XbuSu0CNedazwqlzDaov cC.aNhpdN X-Sonic-MF: X-Sonic-ID: fdd3bdbc-4c3b-4a06-a8ff-2ca1c6d1e07c Received: from sonic.gate.mail.ne1.yahoo.com by sonic304.consmr.mail.bf2.yahoo.com with HTTP; Mon, 18 Nov 2024 00:00:13 +0000 Received: by hermes--production-ne1-bfc75c9cd-n46s2 (Yahoo Inc. Hermes SMTP Server) with ESMTPA ID c49c6779fa1a016527bc8d82f3fd465e; Sun, 17 Nov 2024 23:50:01 +0000 (UTC) From: dullfire@yahoo.com To: "David S . Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Bjorn Helgaas , Jacob Keller , Simon Horman , Thomas Gleixner , Mostafa Saleh , Marc Zyngier , netdev@vger.kernel.org, linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org Cc: Jonathan Currier , stable@vger.kernel.org Subject: [PATCH 2/2] net/niu: niu requires MSIX ENTRY_DATA fields touch before entry reads Date: Sun, 17 Nov 2024 17:48:43 -0600 Message-ID: <20241117234843.19236-3-dullfire@yahoo.com> X-Mailer: git-send-email 2.45.2 In-Reply-To: <20241117234843.19236-1-dullfire@yahoo.com> References: <20241117234843.19236-1-dullfire@yahoo.com> Precedence: bulk X-Mailing-List: netdev@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Patchwork-Delegate: kuba@kernel.org From: Jonathan Currier Fix niu_try_msix() to not cause a fatal trap on sparc systems. Set PCI_DEV_FLAGS_MSIX_TOUCH_ENTRY_DATA_FIRST on the struct pci_dev to work around a bug in the hardware or firmware. For each vector entry in the msix table, niu chips will cause a fatal trap if any registers in that entry are read before that entries' ENTRY_DATA register is written to. Testing indicates writes to other registers are not sufficient to prevent the fatal trap, however the value does not appear to matter. This only needs to happen once after power up, so simply rebooting into a kernel lacking this fix will NOT cause the trap. NON-RESUMABLE ERROR: Reporting on cpu 64 NON-RESUMABLE ERROR: TPC [0x00000000005f6900] NON-RESUMABLE ERROR: RAW [4010000000000016:00000e37f93e32ff:0000000202000080:ffffffffffffffff NON-RESUMABLE ERROR: 0000000800000000:0000000000000000:0000000000000000:0000000000000000] NON-RESUMABLE ERROR: handle [0x4010000000000016] stick [0x00000e37f93e32ff] NON-RESUMABLE ERROR: type [precise nonresumable] NON-RESUMABLE ERROR: attrs [0x02000080] < ASI sp-faulted priv > NON-RESUMABLE ERROR: raddr [0xffffffffffffffff] NON-RESUMABLE ERROR: insn effective address [0x000000c50020000c] NON-RESUMABLE ERROR: size [0x8] NON-RESUMABLE ERROR: asi [0x00] CPU: 64 UID: 0 PID: 745 Comm: kworker/64:1 Not tainted 6.11.5 #63 Workqueue: events work_for_cpu_fn TSTATE: 0000000011001602 TPC: 00000000005f6900 TNPC: 00000000005f6904 Y: 00000000 Not tainted TPC: g0: 00000000000002e9 g1: 000000000000000c g2: 000000c50020000c g3: 0000000000000100 g4: ffff8000470307c0 g5: ffff800fec5be000 g6: ffff800047a08000 g7: 0000000000000000 o0: ffff800014feb000 o1: ffff800047a0b620 o2: 0000000000000011 o3: ffff800047a0b620 o4: 0000000000000080 o5: 0000000000000011 sp: ffff800047a0ad51 ret_pc: 00000000005f7128 RPC: <__pci_enable_msix_range+0x3cc/0x460> l0: 000000000000000d l1: 000000000000c01f l2: ffff800014feb0a8 l3: 0000000000000020 l4: 000000000000c000 l5: 0000000000000001 l6: 0000000020000000 l7: ffff800047a0b734 i0: ffff800014feb000 i1: ffff800047a0b730 i2: 0000000000000001 i3: 000000000000000d i4: 0000000000000000 i5: 0000000000000000 i6: ffff800047a0ae81 i7: 00000000101888b0 I7: Call Trace: [<00000000101888b0>] niu_try_msix.constprop.0+0xc0/0x130 [niu] [<000000001018f840>] niu_get_invariants+0x183c/0x207c [niu] [<00000000101902fc>] niu_pci_init_one+0x27c/0x2fc [niu] [<00000000005ef3e4>] local_pci_probe+0x28/0x74 [<0000000000469240>] work_for_cpu_fn+0x8/0x1c [<000000000046b008>] process_scheduled_works+0x144/0x210 [<000000000046b518>] worker_thread+0x13c/0x1c0 [<00000000004710e0>] kthread+0xb8/0xc8 [<00000000004060c8>] ret_from_fork+0x1c/0x2c [<0000000000000000>] 0x0 Kernel panic - not syncing: Non-resumable error. Fixes: 7d5ec3d36123 ("PCI/MSI: Mask all unused MSI-X entries") Cc: stable@vger.kernel.org Signed-off-by: Jonathan Currier --- drivers/net/ethernet/sun/niu.c | 2 ++ 1 file changed, 2 insertions(+) diff --git a/drivers/net/ethernet/sun/niu.c b/drivers/net/ethernet/sun/niu.c index 41a27ae58ced..f5449b73b9a7 100644 --- a/drivers/net/ethernet/sun/niu.c +++ b/drivers/net/ethernet/sun/niu.c @@ -9058,6 +9058,8 @@ static void niu_try_msix(struct niu *np, u8 *ldg_num_map) msi_vec[i].entry = i; } + pdev->dev_flags |= PCI_DEV_FLAGS_MSIX_TOUCH_ENTRY_DATA_FIRST; + num_irqs = pci_enable_msix_range(pdev, msi_vec, 1, num_irqs); if (num_irqs < 0) { np->flags &= ~NIU_FLAGS_MSIX;