From patchwork Mon Feb 14 10:07:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Josef Johansson X-Patchwork-Id: 12745374 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EFAD5C433F5 for ; Mon, 14 Feb 2022 10:46:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1349097AbiBNKqs (ORCPT ); Mon, 14 Feb 2022 05:46:48 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:38800 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1349022AbiBNKpc (ORCPT ); Mon, 14 Feb 2022 05:45:32 -0500 Received: from office.oderland.com (office.oderland.com [91.201.60.5]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0F07574DC1 for ; Mon, 14 Feb 2022 02:07:53 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=oderland.se ; s=default; h=Content-Transfer-Encoding:Content-Type:Cc:To:Subject:From: MIME-Version:Date:Message-ID:Sender:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: In-Reply-To:References:List-Id:List-Help:List-Unsubscribe:List-Subscribe: List-Post:List-Owner:List-Archive; bh=DBcZFOZFOzAo0487ORwdyo67faVNaoS7BuODPg0NpSc=; b=G2iBx9UAIY7r4NBbcXyTDLChbw Zgw1vyY89SDtdMDHqsdCOLiyD0ju+cpr2blUyln1I+Lq8jk+Pugfx0BpX9MHsjvZGwlvDOY8EdrcN jGT5YBha3W4hhznMoEJ4ehSglNSQ0Mbplhw5Ws2ylCjociLp6FRMi3kOkO3pHh8eBlAtoVvEMFKlT pNH6WgHV7uuMd1VUyrROPx8wiCaTbNyzotCCp5sYdwznYq0yp4Q6OceiB1Nb56b5Uk+DtayFC/NpD uSpOYKz3sPZBukIkgAMdmvd7rCyiCiXWueogd/tWwZjkfgr3VCdmLV1E7dsuX3F10b7HqVqhgSNZj uBVcE0Wg==; Received: from [193.180.18.160] (port=46784 helo=[10.137.0.14]) by office.oderland.com with esmtpsa (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.94.2) (envelope-from ) id 1nJYGq-00FJ2L-Q4; Mon, 14 Feb 2022 11:07:48 +0100 Message-ID: Date: Mon, 14 Feb 2022 11:07:47 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:97.0) Gecko/20100101 Thunderbird/97.0 From: Josef Johansson Subject: [PATCH v2] PCI/MSI: Correct use of can_mask in msi_add_msi_desc() To: Thomas Gleixner , Bjorn Helgaas , linux-pci@vger.kernel.org, Jason Gunthorpe Cc: xen-devel Content-Language: en-US X-AntiAbuse: This header was added to track abuse, please include it with any abuse report X-AntiAbuse: Primary Hostname - office.oderland.com X-AntiAbuse: Original Domain - vger.kernel.org X-AntiAbuse: Originator/Caller UID/GID - [47 12] / [47 12] X-AntiAbuse: Sender Address Domain - oderland.se X-Get-Message-Sender-Via: office.oderland.com: authenticated_id: josjoh@oderland.se X-Authenticated-Sender: office.oderland.com: josjoh@oderland.se Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org From: Josef Johansson PCI/MSI: Correct use of can_mask in msi_add_msi_desc() Commit 71020a3c0dff4 ("PCI/MSI: Use msi_add_msi_desc()") modifies the logic of checking msi_attrib.can_mask, without any reason. This commits restores that logic. Fixes: 71020a3c0dff4 ("PCI/MSI: Use msi_add_msi_desc()") Signed-off-by: Josef Johansson Reviewed-by: Jason Gunthorpe --- v2: Changing subject line to fit earlier commits. Trying to fix a NULL BUG in the NVMe MSIX implementation I stumbled upon this code, which ironically was what my last MSI patch resulted into. I don't see any reason why this logic was change, and it did not break anything correcting the logic. CC xen-devel since it very much relates to Xen kernel (via pci_msi_ignore_mask). --- -- 2.31.1 diff --git a/drivers/pci/msi/msi.c b/drivers/pci/msi/msi.c index c19c7ca58186..146e7b9a01cc 100644 --- a/drivers/pci/msi/msi.c +++ b/drivers/pci/msi/msi.c @@ -526,7 +526,7 @@ static int msix_setup_msi_descs(struct pci_dev *dev, void __iomem *base, desc.pci.msi_attrib.can_mask = !pci_msi_ignore_mask && !desc.pci.msi_attrib.is_virtual; - if (!desc.pci.msi_attrib.can_mask) { + if (desc.pci.msi_attrib.can_mask) { addr = pci_msix_desc_addr(&desc); desc.pci.msix_ctrl = readl(addr + PCI_MSIX_ENTRY_VECTOR_CTRL); }