Received: by 2002:a05:7412:98c1:b0:fa:551:50a7 with SMTP id kc1csp1646542rdb; Mon, 8 Jan 2024 06:09:38 -0800 (PST) X-Google-Smtp-Source: AGHT+IGK+UlW3c7i8FagfrgigyB9OdLn+iUPOPb9mdxJ/To6s5PHDtxaLXHnbw/NME02BN1va9gP X-Received: by 2002:a17:90a:8681:b0:28c:5a10:f327 with SMTP id p1-20020a17090a868100b0028c5a10f327mr1015932pjn.56.1704722978629; Mon, 08 Jan 2024 06:09:38 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1704722978; cv=pass; d=google.com; s=arc-20160816; b=fjuHDwGWKXa6Q2TkINnpea97qIEzdHY3XkQvzu28K9kDexPJP4bXGknH2qLeywUSdL tBOnghdhXsksqUgIhXjSGHR5xC5R12PFPANqWuklCBL+8y4fhfHCapYvtZE55Clmap2C KOWxTJHSIU5wETGk5aZ3ui5iYCgTlmXSiiwZ5Uxm3uwoLmbJY9MROFTAOzBPTUyIl4bO uqUAYoMyNRIk28hTe7nbQqEanpT9pxkGw/KNGgwBL90a/+VnR/NNArDWtnvetBPUe0Wa 6YO3BMH9wEBa24Qa8QGbRcV4AiiklwPRgLDekb7kqiag+/PZrHv4d0GQ4M0FeekWGaRz VgNA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=mime-version:list-unsubscribe:list-subscribe:list-id:precedence :content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:date:message-id:dkim-signature; bh=MDC3WEVPbSKBpj1G+4UbtIapV1vDPxVnC712S9xOcHE=; fh=pXB7ZwslviZjrUWy+UMq1bYkjmtXZwpLMUKrETgzFSs=; b=O8LR9nh1XVEMxZl79rn0wCbydOvAnZzb9SuwpH28lifzVc8A1q7VQfUmti//is+eGA iQdlKd+BJrXNhr99uN/tWSJaSzeJXCoo2buvOUnTBPEB8Q6/HdO99xa+msemLEX58ttZ EWKo29lBCAIhQ9DGXVcpsokNHma3kbCKYLHzJapt36skfnRsQ+blnFSUeAP2EIE1ikMf xvkudeZoWMnOTHTfngD9jL11DPFPTqGIYAHVWo8Ii3yMagKJ0v0BnuuvfsWBHH72+BLl AYwJ7wjwUp22XfjnZNvI4tehEAFwZvOPaGMEODuexciitGKZ5+1/9xxc/V0Dz60wKTx8 FrMQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=iDRZlDxk; arc=pass (i=1 spf=pass spfdomain=nvidia.com dkim=pass dkdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); spf=pass (google.com: domain of linux-kernel+bounces-19677-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-19677-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=nvidia.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id w13-20020a17090a4f4d00b0028b36fac18csi5707458pjl.84.2024.01.08.06.09.38 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Jan 2024 06:09:38 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-19677-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=iDRZlDxk; arc=pass (i=1 spf=pass spfdomain=nvidia.com dkim=pass dkdomain=nvidia.com dmarc=pass fromdomain=nvidia.com); spf=pass (google.com: domain of linux-kernel+bounces-19677-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-19677-linux.lists.archive=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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 44B2B282917 for ; Mon, 8 Jan 2024 14:09:38 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 758D146549; Mon, 8 Jan 2024 14:09:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="iDRZlDxk" X-Original-To: linux-kernel@vger.kernel.org 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 2633A46B89; Mon, 8 Jan 2024 14:09:27 +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=hfLE4kbAYFDdLrkfkvwlGRz+M8Ak2yIEdtXj/xz+L5G4NNR4NcMW4b7c0aYQvA8wcKu91LwoLfGwSZTn2OAHc6+weFSRbxkDOo2ZlcN5n54v7Hnffhe1b5TfQr/KUPMVAviWrOXJVi/rcSEyxQEvnYbVBkabFDkk1OpsRCe2e2n1dJzFgxDnxcJyChvvNbdrRjbRQFtp84ZDcMgocSjAQy0RwhnqN8149gH+GdVoqIRBGM+kMMhN5J+GLn3O/+0/DkxD+D7+HsgQ71bFOzD2aXauORsyRtoCl/shl9l6tXrzaXJ3Fy9Q8wtvMY6JC3gFgawID0d6FURnp4S5JxA3Bg== 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=MDC3WEVPbSKBpj1G+4UbtIapV1vDPxVnC712S9xOcHE=; b=Roelnbw7ZCwbY0mm/dN5HvoxYttaVMC+RtyLTxuJ8uF53sodBwxwTnewlF3p+wZL3Tq9FXE7RWBixZQeZRK+5jUB34cH7XduR51Rgk0iFfLCHhLfwXizOm72h9+X9gcds8IUlzwPY3UQH9yrVzOwUddCWJnljrEOSr45TlYirpIvu+1CgWWjJk/tIAxGOjT4i+H71HI90vRz9P01zUn8zUUuDLjfUkLzJ07ER9Uk17PDLv9z3iWOUx3OKRqIxosuL0h9qkZmkNyMjGt/RCiBkiq/cTl4xfcrTcLtKI9U1rdUuA/OpJYuMZgu5DxDKzDMgRtnwBkyJxxs8OTVHdgYoA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nvidia.com; dmarc=pass action=none header.from=nvidia.com; dkim=pass header.d=nvidia.com; arc=none 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=MDC3WEVPbSKBpj1G+4UbtIapV1vDPxVnC712S9xOcHE=; b=iDRZlDxk8tZI1LK89oFWYwItWzysuP98L0aEt1qhnWsI7ZJnAQHa/381QhPMD4pUs17BEgR4zeSIr51Z/XlhGwcdUbYu8AS/ccqb0iiz7f4U/BLXS5l7D2eqZ8QPVEM2VqTsWoFNsGzAOx69gQcGUzQLao3hNa/ZXV/OJIstaOCh046tngPAPlwZdY5J2E/WM5IUt+eakohWx2fIwarYS3MTmq3YvtnQ+WIwxaxsGZa6gTidRRwR0vb+AmZhs9s23sN7QbrEAlU6TTLXTeKZ/L248kU1o8btnu2zF7O0tKnm3JgiO2DDXrvKkLZ2Q5dHQnznRTjIz3paJro3SrqodA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from MN0PR12MB5762.namprd12.prod.outlook.com (2603:10b6:208:375::12) by CH0PR12MB5123.namprd12.prod.outlook.com (2603:10b6:610:be::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7159.23; Mon, 8 Jan 2024 14:09:24 +0000 Received: from MN0PR12MB5762.namprd12.prod.outlook.com ([fe80::8217:c0b2:9fe3:6304]) by MN0PR12MB5762.namprd12.prod.outlook.com ([fe80::8217:c0b2:9fe3:6304%3]) with mapi id 15.20.7159.020; Mon, 8 Jan 2024 14:09:24 +0000 Message-ID: Date: Mon, 8 Jan 2024 08:09:19 -0600 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH V2] PCI/MSI: Fix MSI hwirq truncation To: Vidya Sagar , bhelgaas@google.com, rdunlap@infradead.org, ilpo.jarvinen@linux.intel.com, tglx@linutronix.de, jiang.liu@linux.intel.com Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, treding@nvidia.com, jonathanh@nvidia.com, kthota@nvidia.com, mmaddireddy@nvidia.com, sagar.tv@gmail.com References: <20240105134339.3091497-1-vidyas@nvidia.com> <20240108120522.1368240-1-vidyas@nvidia.com> Content-Language: en-US From: Shanker Donthineni In-Reply-To: <20240108120522.1368240-1-vidyas@nvidia.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: BYAPR05CA0101.namprd05.prod.outlook.com (2603:10b6:a03:e0::42) To MN0PR12MB5762.namprd12.prod.outlook.com (2603:10b6:208:375::12) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: MN0PR12MB5762:EE_|CH0PR12MB5123:EE_ X-MS-Office365-Filtering-Correlation-Id: 749ef92d-6fe6-4a43-b7a4-08dc10536af1 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: 3etJEuXzRmAKRy8/guwjjvFCQEADD8L14fibhDcNzR9usihQeW1uI0II+vNi/gFZrAtizQMR5fIkpyboqNvg3BwFfuO22Mg7oEtOkP2TQFbJWq2vDQb2jH47NgfBdP1RK6jfO6NLCTapqboaYjtjaLchgloMOf/g3A66KpLKsIPHt+phISTm9kqZMf5krfjGgJp8IL30mImAwyViadnNpBrG0jMeEIkK3024ytdWU8jUxYrIPqDkFR6+Uy4f9bfZpokf6fcS0km1cCPyMSn8oz4xBld5DcQ8wpipfi9HOAk4K8z0VPr/6kNR0zEk3tKPvWsIDwL50Pn4ed7ZRiKCUoe+r5J152TF1ZLHZqQp5saF25nONclIg2HDiDRePGi05S7zIfc2yZUvznccKWKp3XvFZalHNUTC50mtmaCTOIBgCGdeswjC7qZFrZIVo/uTaGTSFbFx/OwSsEQT4DuOOFkagz3DSYsdMT8Mh+7f/Fdtep3TUd/2ldhq/aGy15n074CBkqNfJVsOAe6QZLjdoNJCJ/Gtbr+z/wyB26KldtXKckSKotKye2Jje4YptkH6hr4p5y70cGgww7+swc+0N+JwmB1RirlgbTbjaskMGc/2BvTnKt+fBE1fE7WSU/1obyMtRznqHl7pP3/sNE1FPQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MN0PR12MB5762.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(346002)(39860400002)(396003)(366004)(136003)(376002)(230922051799003)(64100799003)(186009)(451199024)(1800799012)(41300700001)(86362001)(6486002)(8676002)(8936002)(31686004)(31696002)(5660300002)(2906002)(2616005)(26005)(316002)(66476007)(36756003)(66556008)(66946007)(478600001)(6512007)(83380400001)(6666004)(53546011)(6506007)(38100700002)(4326008)(45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lvcm5EcFlXL0VvTEFlOTV5Sm1EVUgxNXRRQ042Ukgra0tX?= =?utf-8?B?VTZuZjMrVnFZMURkU3N0Z0Q0bXg3YStod3hPbyszQzZmSXBFTmRFYUJPNzRu?= =?utf-8?B?alhldmNSQVN6bk80RWxTVFVYaHJyT3FVS3hGRkl2Z3ZPZzNhcmNqTW5IR3hJ?= =?utf-8?B?d0hFcndZenZwdVZyYzFmSWpzakFuMmRWanUvbDltMXA4SlR5UjFQSVNHcUZn?= =?utf-8?B?WXR3dEJWQ0Y4d2s3UThhbWIzRTNmUzBhMDErbm84aDNCOEVxUFFBWkQ5dkhl?= =?utf-8?B?NEVZK2tob1FCR3FxNEpnR2E1ZjZEUzdrSUl3UENaNXFXOFovYiszV2ltN3dT?= =?utf-8?B?WU5hdzFhNXU2emxzL3h6SStHclRwTXZFOS9mSy90V3hvalhXVGxISms0L3Z3?= =?utf-8?Q?+dom+JXEVmJrjAnFznFQKv3qg?= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 749ef92d-6fe6-4a43-b7a4-08dc10536af1 X-MS-Exchange-CrossTenant-AuthSource: MN0PR12MB5762.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 08 Jan 2024 14:09:24.5310 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 43083d15-7273-40c1-b7db-39efd9ccc17a X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: sy66cyNnFlTOFnjYwk8eMq3/ti4O4v6PXCimJ8fnLUfeZaBogIcFLoQTC4Jh3UL7uY+rU1FHPJUuPIw0sLX16w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CH0PR12MB5123 Thanks Vidya. Tested-By: Shanker Donthineni -ShankerD On 1/8/24 06:05, 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 u32. 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 u64 before left shifting it to > calculate hwirq number. > > Fixes: 3878eaefb89a ("PCI/MSI: Enhance core to support hierarchy irqdomain") > Signed-off-by: Vidya Sagar > --- > 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,