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 {