Message ID | 20240115135649.708536-1-vidyas@nvidia.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-26063-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2614:b0:101:6a76:bbe3 with SMTP id mm20csp1715499dyc; Mon, 15 Jan 2024 05:57:23 -0800 (PST) X-Google-Smtp-Source: AGHT+IHfTNtsIQbg53rH6k75UTICkyI/O3Fei0k56AyZ789NiPAy2qvj8ETDVM3in8gLl91Ct6hu X-Received: by 2002:aa7:c418:0:b0:557:38dc:3052 with SMTP id j24-20020aa7c418000000b0055738dc3052mr1438955edq.164.1705327043301; Mon, 15 Jan 2024 05:57:23 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1705327043; cv=pass; d=google.com; s=arc-20160816; b=pQCwenGGyvnHkR+PwEywjfqpOYkkGbEktdXQ6ZzsJNzCClBypceEzihRVH7rekZrBg 8LKpJ4qY6HtXmyZAzS/qg0YIwz4z8dMSUK6db8NrLQhvga1N+xwU+1dSis6ZZg88cXn4 JrWS84tTj24TYJ5CELcZcbqZmnvb4j/NVEc2uCpPCqPvAb+AgC6SOZtUPu1BsBEi9Me/ FJH2mifocKa0le0mVItN82Fd5p3TE22fQKYg31MenUNH53AiSSFj+RR/19GzxvtbS5u4 jPPBn0KsIOvDafuWMqHT3HEGX/ZpBgsL/h3XiJIWZZoofussF7NZq2qYJ+5peVZiMjC9 XowA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=AK34ZKqKDlUqCk2ZpO9Fwx6cd/5UWQ6FI6dB+/GvFzA=; fh=JyLIORa4LF26jyUBO/SrapBPsnwQ0aPqD8hjjUe2IGw=; b=zZ5OlTCBfok9J7UTfWtrTRXylFe4eY0gs2cix/XUWnNCUJlKrNd+PQ64VktxH4i98B 2QDNBlWDLroMWuefsVy7LBYPwYNceSKnETnk5RSKkT3lE4M0AdXdir+BExH5PhXfl5sh zOm4UrP3SCI+4phbyaIVJZVJLsj4fOvw4hrLBs0JTNVsSMBuYZ02myfq4VKwXcSDE9vS Cklq0OOVBOWnNmhJou1jSBPzJGk9ls9wsDhYehR9dGkiD83e2MYhPar0zmn7aS1lOzS6 3sHyHehlHRiYBqW3Bqk9CoAJzFSsASz5cwHuKWvS4jh+HnjQfFuwgQp4SgqctX4bViEf TFTw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=JZA5ACCj; arc=pass (i=1 spf=pass spfdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); spf=pass (google.com: domain of linux-kernel+bounces-26063-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-26063-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id r20-20020a056402235400b005573b37b5d5si3792429eda.228.2024.01.15.05.57.23 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 15 Jan 2024 05:57:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-26063-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=JZA5ACCj; arc=pass (i=1 spf=pass spfdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); spf=pass (google.com: domain of linux-kernel+bounces-26063-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-26063-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id BBA7D1F21211 for <ouuuleilei@gmail.com>; Mon, 15 Jan 2024 13:57:22 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 8A8F71758F; Mon, 15 Jan 2024 13:57:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="JZA5ACCj" Received: from NAM11-BN8-obe.outbound.protection.outlook.com (mail-bn8nam11on2040.outbound.protection.outlook.com [40.107.236.40]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 932821754C; Mon, 15 Jan 2024 13:57:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com Authentication-Results: smtp.subspace.kernel.org; spf=fail smtp.mailfrom=nvidia.com ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=HFnP9jWqKX+/rGz+HfT/EQt5AMb3ZvM1CAt4m/fGgp0g7lqXZsLQJBQw3xDPNhODq+j8fhxFqSMhUn/+WgmI0MV4FHm39pBVX4SLYYtxZ1d2xCuY2BcnMDG1lMeGpzmyWsGcWpm8iCvvU5AhKjyHC9LWD+wWcvkj14zp2JHXx1K03BMLWh3XF1PDhPiuGmJWVAFmB1skctyLzBiJVsEn/J7IBclpZ6y+PYC9r/sj8wswx4AvoNQfQEswGZViVFkXvdTiTERcWonRGsFoJbQGzx9j0nitdXnfc8R5EUdKyq1+s6ZKWrVI+1BlAts34ChupuC1Kqcrx1cmOt4eKJ99lA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=AK34ZKqKDlUqCk2ZpO9Fwx6cd/5UWQ6FI6dB+/GvFzA=; b=K03ceaTPiwqLQAixohEUbeqe/E21+eo417Po+OJ4WEae3mrn/0QhOvy8KWetAdHTD6jCFTNvtSAn3Et5QrnXZIiuscxSubLe7+/4VI8SRSVvpV4ZQS7ngtn0zci4l5UN2+HwCxUriN4hRZQQXmEbAZrWIkN4yqcQwdFY5tmGl8/t/U1/o+NZRtgD8gNjhYEfd7OwzqbEXoEC9SVAsuhqEBCNjm9zGDbrYDZZEmLiW55hdzDGgsIBI+C2PUeG5aVsd0GVKisleh3nmYCzKfQL884McXd0A0meiw1TZD3A2NCWgS1hhPx2JDFHS450sLOBu1bTSq/9Xb8QaUmH+A8yow== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass (sender ip is 216.228.118.233) smtp.rcpttodomain=google.com smtp.mailfrom=nvidia.com; dmarc=pass (p=reject sp=reject pct=100) action=none header.from=nvidia.com; dkim=none (message not signed); arc=none (0) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=Nvidia.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=AK34ZKqKDlUqCk2ZpO9Fwx6cd/5UWQ6FI6dB+/GvFzA=; b=JZA5ACCjSPup9Gd834hkX+Tammlx7uXFVF0delJr4QMouFlySl84JsHojNvCqD8n09XCe20hb3DUn0QJgEi0w6TzHFg8Y997jGcs5UhA861iirk28qcXhK6aYe468gJ45j+K0XwoiAb5Ss2z4LOGpNSp1NkbvykGSabPcyKS62RawTS81cBUQLaMAmhYTiYQf4raHklJqScrmlfrYUIIfBUYO0cP8Y0NCm2/Or40ns7IyeAnk3pqJFb1iKGQRxz+QXhmi6r7Ob3JgOJTPEiRK+CDuwJK+0MrxXUvqmgpJjyE9RanFAwPVQcn3fwgId17pFevbvqf/7vvxir0wuTaSw== Received: from MW4PR04CA0311.namprd04.prod.outlook.com (2603:10b6:303:82::16) by SA0PR12MB4384.namprd12.prod.outlook.com (2603:10b6:806:9f::22) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7181.26; Mon, 15 Jan 2024 13:57:00 +0000 Received: from CO1PEPF000044EF.namprd05.prod.outlook.com (2603:10b6:303:82:cafe::c) by MW4PR04CA0311.outlook.office365.com (2603:10b6:303:82::16) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7181.26 via Frontend Transport; Mon, 15 Jan 2024 13:57:00 +0000 X-MS-Exchange-Authentication-Results: spf=pass (sender IP is 216.228.118.233) smtp.mailfrom=nvidia.com; dkim=none (message not signed) header.d=none;dmarc=pass action=none header.from=nvidia.com; Received-SPF: Pass (protection.outlook.com: domain of nvidia.com designates 216.228.118.233 as permitted sender) receiver=protection.outlook.com; client-ip=216.228.118.233; helo=mail.nvidia.com; pr=C Received: from mail.nvidia.com (216.228.118.233) by CO1PEPF000044EF.mail.protection.outlook.com (10.167.241.69) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7202.16 via Frontend Transport; Mon, 15 Jan 2024 13:57:00 +0000 Received: from drhqmail202.nvidia.com (10.126.190.181) by mail.nvidia.com (10.127.129.6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Mon, 15 Jan 2024 05:56:56 -0800 Received: from drhqmail202.nvidia.com (10.126.190.181) by drhqmail202.nvidia.com (10.126.190.181) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.41; Mon, 15 Jan 2024 05:56:55 -0800 Received: from vidyas-desktop.nvidia.com (10.127.8.9) by mail.nvidia.com (10.126.190.181) with Microsoft SMTP Server id 15.2.986.41 via Frontend Transport; Mon, 15 Jan 2024 05:56:52 -0800 From: Vidya Sagar <vidyas@nvidia.com> To: <bhelgaas@google.com>, <rdunlap@infradead.org>, <ilpo.jarvinen@linux.intel.com>, <tglx@linutronix.de> CC: <linux-pci@vger.kernel.org>, <linux-kernel@vger.kernel.org>, <treding@nvidia.com>, <jonathanh@nvidia.com>, <sdonthineni@nvidia.com>, <kthota@nvidia.com>, <mmaddireddy@nvidia.com>, <vidyas@nvidia.com>, <sagar.tv@gmail.com> Subject: [PATCH V4] PCI/MSI: Fix MSI hwirq truncation Date: Mon, 15 Jan 2024 19:26:49 +0530 Message-ID: <20240115135649.708536-1-vidyas@nvidia.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240111052814.713016-1-vidyas@nvidia.com> References: <20240111052814.713016-1-vidyas@nvidia.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 X-NVConfidentiality: public Content-Transfer-Encoding: 8bit Content-Type: text/plain X-NV-OnPremToCloud: ExternallySecured X-EOPAttributedMessage: 0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: CO1PEPF000044EF:EE_|SA0PR12MB4384:EE_ X-MS-Office365-Filtering-Correlation-Id: e43b50c1-718b-4840-2e40-08dc15d1d86e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: uA++PuQQ126KySYPf1STiDarV3NLMVsXJJb6VeQP5cgyleRUx1+GqgYqAgnIpDpVtWk33lRR+f6miuG55d2Saqi9TPB8kGHkCPd8gdHWVxZkG0Vp/mAl9byXdDmdr2k9E1zeNmEqUzkBNs0HnGOTbPfqiUNiy0nAt4sgaeineRH4WOcGUbQq9662BShJwHE/+ufvHvll6YyxFzyrwkbe+CD1X5f6MSCmB0Mnso3k3egJtoOHz6z1EzThkF2hQW9lHYjcxGbdx/CrLZQ6M/3OfuO/JmBV+NTCSlT1mgK3LGSex3hsLGq7Fb/iP3cFyrBeYxT9qo14ycw6TTQYNG08KHaEnGQaTzhkmOemj3Um78/zOiTOYPwR08uSVhqmel6EaF17pX57mmlVsTTqrEs/2A8bSU+dj1VzQlV8krH7vHFpq0lb+zpKQVCVgf7X2ADbqV/BqG4IJ+Ppj1odIQ5W9zmaFRSCAUOglB28rWEMFK4tW9iWuX5dXyR24aScYIkMDTf8C/9A3xEutuDu4Iia2I/Mmruje2EeJ8PbanN0nuWecHS8bYATTSzn3zo9Io/i0rBmjxQahYWiKROMMVc1ICSQQVSTpteOz3lNT7utwzGu4J69rPBSEa7bDOFVTo2p+qeOYddKJpzkff3cl+FgFAt24SHFvRvz41ATxgawtpBNTRGqlzecAyFdu04EFFcGo/vgWm/oprAthB62x/1flnhpxPtOyt8bzN76rP5XgLVEV4i1jfwKsu0dgzs/JIET X-Forefront-Antispam-Report: CIP:216.228.118.233;CTRY:US;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:mail.nvidia.com;PTR:dc7edge2.nvidia.com;CAT:NONE;SFS:(13230031)(4636009)(396003)(39860400002)(346002)(136003)(376002)(230922051799003)(64100799003)(451199024)(1800799012)(82310400011)(186009)(36840700001)(46966006)(40470700004)(478600001)(6666004)(7696005)(426003)(336012)(26005)(1076003)(2616005)(2906002)(5660300002)(110136005)(70586007)(70206006)(54906003)(316002)(8936002)(4326008)(8676002)(36756003)(86362001)(36860700001)(83380400001)(41300700001)(47076005)(82740400003)(7636003)(356005)(40460700003)(40480700001);DIR:OUT;SFP:1101; X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 15 Jan 2024 13:57:00.2434 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e43b50c1-718b-4840-2e40-08dc15d1d86e X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=43083d15-7273-40c1-b7db-39efd9ccc17a;Ip=[216.228.118.233];Helo=[mail.nvidia.com] X-MS-Exchange-CrossTenant-AuthSource: CO1PEPF000044EF.namprd05.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Anonymous X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: SA0PR12MB4384 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1787258208088612268 X-GMAIL-MSGID: 1788165009597192787 |
Series |
[V4] PCI/MSI: Fix MSI hwirq truncation
|
|
Commit Message
Vidya Sagar
Jan. 15, 2024, 1:56 p.m. UTC
While calculating the hwirq number for an MSI interrupt, the higher bits (i.e. from bit-5 onwards a.k.a domain_nr >= 32) of the PCI domain number gets truncated because of the shifted value casting to return type of pci_domain_nr() which is 'int'. This for example is resulting in same hwirq number for devices 0019:00:00.0 and 0039:00:00.0. So, cast the PCI domain number to 'irq_hw_number_t' before left shifting it to calculate hwirq number. Please note that this fixes the issue only on 64-bit systems and doesn't change the behavior in 32-bit systems i.e. the 32-bit systems continue to have the issue. Since the issue surfaces only if there are too many PCIe controllers in the system which usually is the case in modern server systems and they don't tend to run 32-bit kernels. Fixes: 3878eaefb89a ("PCI/MSI: Enhance core to support hierarchy irqdomain") Tested-by: Shanker Donthineni <sdonthineni@nvidia.com> Signed-off-by: Vidya Sagar <vidyas@nvidia.com> --- V4: * Added extra information in the change log about the impact of this patch in a 32-bit system as suggested by Thomas V3: * Addressed review comments from Thomas Gleixner * Added Tested-By: Shanker Donthineni <sdonthineni@nvidia.com> V2: * Added Fixes tag drivers/pci/msi/irqdomain.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Comments
Hi Thomas, Does this patch look fine to you? If yes, would you mind giving an Ack? Thanks, Vidya Sagar On 1/15/2024 7:26 PM, Vidya Sagar wrote: > While calculating the hwirq number for an MSI interrupt, the higher > bits (i.e. from bit-5 onwards a.k.a domain_nr >= 32) of the PCI domain > number gets truncated because of the shifted value casting to return > type of pci_domain_nr() which is 'int'. This for example is resulting > in same hwirq number for devices 0019:00:00.0 and 0039:00:00.0. > > So, cast the PCI domain number to 'irq_hw_number_t' before left shifting > it to calculate hwirq number. Please note that this fixes the issue only > on 64-bit systems and doesn't change the behavior in 32-bit systems i.e. > the 32-bit systems continue to have the issue. Since the issue surfaces > only if there are too many PCIe controllers in the system which usually > is the case in modern server systems and they don't tend to run 32-bit > kernels. > > Fixes: 3878eaefb89a ("PCI/MSI: Enhance core to support hierarchy irqdomain") > Tested-by: Shanker Donthineni <sdonthineni@nvidia.com> > Signed-off-by: Vidya Sagar <vidyas@nvidia.com> > --- > V4: > * Added extra information in the change log about the impact of this patch > in a 32-bit system as suggested by Thomas > > V3: > * Addressed review comments from Thomas Gleixner > * Added Tested-By: Shanker Donthineni <sdonthineni@nvidia.com> > > V2: > * Added Fixes tag > > drivers/pci/msi/irqdomain.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/pci/msi/irqdomain.c b/drivers/pci/msi/irqdomain.c > index c8be056c248d..cfd84a899c82 100644 > --- a/drivers/pci/msi/irqdomain.c > +++ b/drivers/pci/msi/irqdomain.c > @@ -61,7 +61,7 @@ static irq_hw_number_t pci_msi_domain_calc_hwirq(struct msi_desc *desc) > > return (irq_hw_number_t)desc->msi_index | > pci_dev_id(dev) << 11 | > - (pci_domain_nr(dev->bus) & 0xFFFFFFFF) << 27; > + ((irq_hw_number_t)(pci_domain_nr(dev->bus) & 0xFFFFFFFF)) << 27; > } > > static void pci_msi_domain_set_desc(msi_alloc_info_t *arg,
Hi Thomas, Sorry to bother you. Would you mind giving an Ack to this patch? Thanks, Vidya Sagar On 1/23/2024 9:31 PM, Vidya Sagar wrote: > Hi Thomas, > Does this patch look fine to you? > If yes, would you mind giving an Ack? > > Thanks, > Vidya Sagar > > On 1/15/2024 7:26 PM, Vidya Sagar wrote: >> While calculating the hwirq number for an MSI interrupt, the higher >> bits (i.e. from bit-5 onwards a.k.a domain_nr >= 32) of the PCI domain >> number gets truncated because of the shifted value casting to return >> type of pci_domain_nr() which is 'int'. This for example is resulting >> in same hwirq number for devices 0019:00:00.0 and 0039:00:00.0. >> >> So, cast the PCI domain number to 'irq_hw_number_t' before left shifting >> it to calculate hwirq number. Please note that this fixes the issue only >> on 64-bit systems and doesn't change the behavior in 32-bit systems i.e. >> the 32-bit systems continue to have the issue. Since the issue surfaces >> only if there are too many PCIe controllers in the system which usually >> is the case in modern server systems and they don't tend to run 32-bit >> kernels. >> >> Fixes: 3878eaefb89a ("PCI/MSI: Enhance core to support hierarchy >> irqdomain") >> Tested-by: Shanker Donthineni <sdonthineni@nvidia.com> >> Signed-off-by: Vidya Sagar <vidyas@nvidia.com> >> --- >> V4: >> * Added extra information in the change log about the impact of this >> patch >> in a 32-bit system as suggested by Thomas >> >> V3: >> * Addressed review comments from Thomas Gleixner >> * Added Tested-By: Shanker Donthineni <sdonthineni@nvidia.com> >> >> V2: >> * Added Fixes tag >> >> drivers/pci/msi/irqdomain.c | 2 +- >> 1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/drivers/pci/msi/irqdomain.c b/drivers/pci/msi/irqdomain.c >> index c8be056c248d..cfd84a899c82 100644 >> --- a/drivers/pci/msi/irqdomain.c >> +++ b/drivers/pci/msi/irqdomain.c >> @@ -61,7 +61,7 @@ static irq_hw_number_t >> pci_msi_domain_calc_hwirq(struct msi_desc *desc) >> return (irq_hw_number_t)desc->msi_index | >> pci_dev_id(dev) << 11 | >> - (pci_domain_nr(dev->bus) & 0xFFFFFFFF) << 27; >> + ((irq_hw_number_t)(pci_domain_nr(dev->bus) & 0xFFFFFFFF)) << 27; >> } >> static void pci_msi_domain_set_desc(msi_alloc_info_t *arg,
Hi Thomas / Bjorn, Can you please guide me on getting this patch merged? Thanks, Vidya Sagar On 1/31/2024 8:45 AM, Vidya Sagar wrote: > Hi Thomas, > Sorry to bother you. > Would you mind giving an Ack to this patch? > > Thanks, > Vidya Sagar > > On 1/23/2024 9:31 PM, Vidya Sagar wrote: >> Hi Thomas, >> Does this patch look fine to you? >> If yes, would you mind giving an Ack? >> >> Thanks, >> Vidya Sagar >> >> On 1/15/2024 7:26 PM, Vidya Sagar wrote: >>> While calculating the hwirq number for an MSI interrupt, the higher >>> bits (i.e. from bit-5 onwards a.k.a domain_nr >= 32) of the PCI domain >>> number gets truncated because of the shifted value casting to return >>> type of pci_domain_nr() which is 'int'. This for example is resulting >>> in same hwirq number for devices 0019:00:00.0 and 0039:00:00.0. >>> >>> So, cast the PCI domain number to 'irq_hw_number_t' before left shifting >>> it to calculate hwirq number. Please note that this fixes the issue only >>> on 64-bit systems and doesn't change the behavior in 32-bit systems i.e. >>> the 32-bit systems continue to have the issue. Since the issue surfaces >>> only if there are too many PCIe controllers in the system which usually >>> is the case in modern server systems and they don't tend to run 32-bit >>> kernels. >>> >>> Fixes: 3878eaefb89a ("PCI/MSI: Enhance core to support hierarchy >>> irqdomain") >>> Tested-by: Shanker Donthineni <sdonthineni@nvidia.com> >>> Signed-off-by: Vidya Sagar <vidyas@nvidia.com> >>> --- >>> V4: >>> * Added extra information in the change log about the impact of this >>> patch >>> in a 32-bit system as suggested by Thomas >>> >>> V3: >>> * Addressed review comments from Thomas Gleixner >>> * Added Tested-By: Shanker Donthineni <sdonthineni@nvidia.com> >>> >>> V2: >>> * Added Fixes tag >>> >>> drivers/pci/msi/irqdomain.c | 2 +- >>> 1 file changed, 1 insertion(+), 1 deletion(-) >>> >>> diff --git a/drivers/pci/msi/irqdomain.c b/drivers/pci/msi/irqdomain.c >>> index c8be056c248d..cfd84a899c82 100644 >>> --- a/drivers/pci/msi/irqdomain.c >>> +++ b/drivers/pci/msi/irqdomain.c >>> @@ -61,7 +61,7 @@ static irq_hw_number_t >>> pci_msi_domain_calc_hwirq(struct msi_desc *desc) >>> return (irq_hw_number_t)desc->msi_index | >>> pci_dev_id(dev) << 11 | >>> - (pci_domain_nr(dev->bus) & 0xFFFFFFFF) << 27; >>> + ((irq_hw_number_t)(pci_domain_nr(dev->bus) & 0xFFFFFFFF)) << >>> 27; >>> } >>> static void pci_msi_domain_set_desc(msi_alloc_info_t *arg,
On Wed, Feb 07 2024 at 12:29, Vidya Sagar wrote: > Hi Thomas / Bjorn, > Can you please guide me on getting this patch merged? It's in my backlog...
diff --git a/drivers/pci/msi/irqdomain.c b/drivers/pci/msi/irqdomain.c index c8be056c248d..cfd84a899c82 100644 --- a/drivers/pci/msi/irqdomain.c +++ b/drivers/pci/msi/irqdomain.c @@ -61,7 +61,7 @@ static irq_hw_number_t pci_msi_domain_calc_hwirq(struct msi_desc *desc) return (irq_hw_number_t)desc->msi_index | pci_dev_id(dev) << 11 | - (pci_domain_nr(dev->bus) & 0xFFFFFFFF) << 27; + ((irq_hw_number_t)(pci_domain_nr(dev->bus) & 0xFFFFFFFF)) << 27; } static void pci_msi_domain_set_desc(msi_alloc_info_t *arg,