Received: by 2002:a05:7412:e794:b0:fa:551:50a7 with SMTP id o20csp1151839rdd; Wed, 10 Jan 2024 10:05:47 -0800 (PST) X-Google-Smtp-Source: AGHT+IHU8S/QMWZaq778//y4kH6AAtW0xWN2BCM60h24KhbcGYhEhFbcMGeZL16y4eSk7udFL0yR X-Received: by 2002:a05:6358:339f:b0:175:98ac:e538 with SMTP id i31-20020a056358339f00b0017598ace538mr789172rwd.65.1704909947187; Wed, 10 Jan 2024 10:05:47 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1704909947; cv=pass; d=google.com; s=arc-20160816; b=EYYe+SKJcUMCOx0w92XARAv4WvU3fioF37YoY474sHP2rWRYj6n3COWp1gXOdXiTdr cNhQE4khZ8Ah6u/mvG4eLhaEfZCtYcWNrSYhHKTDLdZZE0bHOWDcmN3vboRcbC2ILS7n Th9pddnRx0sM1dtIoAR8zh+3u8eeHQuBl/O4q6ZILlHeMXMarLIvyr84osBLkLK9SDBY k2Cp5ChhPQuH5J6iWKh6fo/mzfIMU26Bk6Zq9/6sG84GW/HnourGzaqVNmTY6sRZ5Jca 0f7ZFHS8Jlc8YcipNiB0e7IACUp0hB2Np1uFX8ukuD44cPNRwdMC5HhK18zeoC+VNzNl Z9Hw== 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=uMWkfihxxTu3W2TX9ECBGfwju2JpNceN/YlAxjjyZEI=; fh=7n8YreW6JCnP4dQGGdGLBkCzgs7D8zRKbWI2Pj0Fd0o=; b=I+GySY5UlNI+x5qCz2oC5pcmYajt2c2BAMPgI5CYljeHMRdP7E4r7g8Pfgnmbb03o5 4+aXxe+ecLyjoCNKuTjHncCRKJNoKxmCAFizI8840rY7UQAIkGU1E0gaS2fYnzeCnYuS 6uu0vpQoMdhl1ESr9wajyhkbv0AdA4Z+Dwmvn+RAq6sJdPJ8YzoAb669G/cT53qW5oqJ +GGlHOWbBxdMq4e2+fv9pAV2d6aM6/2dxAuHlR1ZbFgkIItTSuh42Djf2QEVEFSx5c6y f7EM1h+iqMBdjqWxB/9/uTTRTz8J8rzsTBqhzMjkHkXzjmsPl592CJtH7R63d+ZWSaUR HDlA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=qhqwQxCW; 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-22584-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-22584-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. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id y5-20020a655285000000b005740b4723f9si4002568pgp.811.2024.01.10.10.05.46 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 10 Jan 2024 10:05:47 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-22584-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@Nvidia.com header.s=selector2 header.b=qhqwQxCW; 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-22584-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-22584-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 1E2522842A2 for ; Wed, 10 Jan 2024 18:05:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0CD5D4D12E; Wed, 10 Jan 2024 18:05:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="qhqwQxCW" Received: from NAM04-MW2-obe.outbound.protection.outlook.com (mail-mw2nam04on2086.outbound.protection.outlook.com [40.107.101.86]) (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 76A6E4CDEA; Wed, 10 Jan 2024 18:04:58 +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=XdiTOo7V1G0yXkjMGcZoXKbW53Nmji5QETg5w984jA/ZdIIDFHmKJvKYOesHoA/TDwivRrLwrsX8d/QeBU55GQIVWfkJ44r6GbU+0PYZb2Jg5U0wDnwe32SOxhH1teA6Y3iaCn0onsN5bfWE1Lf32UFIyS4SKhBZjNyEpJUAbehw+vW/Wbn72ZFIexn7IBL/ESDmu/rTQJ4UBgFXoztzks4P07xQuSugEszKY6KS+1D2HWnh1TmGPAeWRcNmimEoCL3nkBjEkzhHSFw+TXwUST662UU5T3ZBB8Fe3F2bdj5NPoaq63bHb7IYVv70ypG+mSNYRdzLeISwOAyx0yvncg== 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=uMWkfihxxTu3W2TX9ECBGfwju2JpNceN/YlAxjjyZEI=; b=mv6Cl6Tizx5S+R4m9qrSC6h6OGBfAnN7hTS9MZxeSWJLeRqDY7OK22TGr7qYMEtOFyOZaFlPzuQJAq5045jKZDrT7uMUWIrBsvKHerZGwkv/hlSVgW7+xda+INzZw0a3YuWClMF8WVQ6lpEy5UQURGlnwC3DsKVb4GNHl6am9BKbbc0VdnJuVkUnd7le3yYqHKucTOkoGrOLj4PwAZeJdNeSk17QUVqq9QrF5Y65EXmmQDtCMSBZGxhZ0QFDR9/TIXQBRNTXumZcplIx2rLbZ9yWUtQrO7nBmFH/iimArfgyBssPlNp0nvG8LljLCJ0iuNqlXIFEmTdt8kleepDiaQ== 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=uMWkfihxxTu3W2TX9ECBGfwju2JpNceN/YlAxjjyZEI=; b=qhqwQxCWSKL39SEkYcYqHMG/jQdi2qPpAx4l0EVpy4RyiBp6f5PLwjiyYLMnPN2qtaYVwmUQ5oxioES6GWR9GTQdfNEL9WmO8hKkjkic3/upiGpegWaakZ+UUKx/BsdjvtDEu1nFfHZkr2IfFDOJA3yziSfZtNq+d6xqm6rGEjSm/mEO23zwAJaZ8tsNl0flgi/qZPEjBkfA9sUavm/Mlc6Vcc2M0GVWttVZSqlcZDelJ6CcOBQNcIhG/1r69Lwkw+VulxCXMbcuOWdOtCA1G5YSnHFOcvf5dLLn3jE7cNoB2ttu2PsEoX+2TPwE+2HZHxjIbq7Gge7/lfOc+uospg== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from PH8PR12MB6674.namprd12.prod.outlook.com (2603:10b6:510:1c1::18) by PH7PR12MB8121.namprd12.prod.outlook.com (2603:10b6:510:2b5::20) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7159.23; Wed, 10 Jan 2024 18:04:54 +0000 Received: from PH8PR12MB6674.namprd12.prod.outlook.com ([fe80::55f7:f35f:a684:bf3c]) by PH8PR12MB6674.namprd12.prod.outlook.com ([fe80::55f7:f35f:a684:bf3c%4]) with mapi id 15.20.7159.020; Wed, 10 Jan 2024 18:04:54 +0000 Message-ID: <9db8310c-e74f-4f66-bc4e-7af795ec5879@nvidia.com> Date: Wed, 10 Jan 2024 23:34:44 +0530 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH V2] PCI/MSI: Fix MSI hwirq truncation To: Thomas Gleixner , bhelgaas@google.com, rdunlap@infradead.org, ilpo.jarvinen@linux.intel.com 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, sagar.tv@gmail.com, Marc Zyngier References: <20240105134339.3091497-1-vidyas@nvidia.com> <20240108120522.1368240-1-vidyas@nvidia.com> <87il41jy48.ffs@tglx> Content-Language: en-US From: Vidya Sagar In-Reply-To: <87il41jy48.ffs@tglx> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-ClientProxiedBy: MA0P287CA0013.INDP287.PROD.OUTLOOK.COM (2603:1096:a01:d9::13) To PH8PR12MB6674.namprd12.prod.outlook.com (2603:10b6:510:1c1::18) 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: PH8PR12MB6674:EE_|PH7PR12MB8121:EE_ X-MS-Office365-Filtering-Correlation-Id: 81160bc9-927c-4973-35a6-08dc1206a587 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: It3WSr8TSdXzfDrwiU6W4DaD3i8Fp+Glsw3uezBmtlwUycnYaUFLR3qLwBoWg0Wym76hEm3D6iTk2trdEyQXhweRkvKHndaTD6dlYK5gDG4bIuqo2TQt52zy4PpFPHG9T1OjllNmavEp23PA4/v0R7+Cw7emonmA4Dc7/I7Zb0nwoL5Xd6OH5Ih7PpspAOOkMo8p9dawpi15d2w/Np1lBLe1jcN4qwBeNCrw34s+gV9p1/iHGbNeithQrhdoPLlGmakAROV8YdHckhbOIT4C9xGdlIw4fk+LSJRw5+qVtZ7+bYCCvv0jS7PT0h/9i6K8v/vVvIyjJ/d1EGtuZ2h9GhGTHZOgczfEYpqUeQ/Jw2sE00aC+PCk2vNjdpyZ7BaRZRhahCV2Wl4lddNLIzfVt7NLNlfi+4lFGbUDJIXPU2qbhIFZY5OTk8em2lMclu+T5Igd49wWWsn4DEOE/K1GZprPpA4tCZ++MgS5jw4itzPhW6wAkzzH0mTIyu4hElDIMoWoBgtqO2kL8ml7xUtW7gL+Wdz3F8TUoNtWw5m5psuL/kh4nLHRX0zrLZxliorNKERhjXKa1DXhd/dd5DbrreAfxRN7HCWtB1sPwHRT2mJU+Kk3ewMHAZCFlILMxmkMb0TXd91Y0EMP11+jeFrrroW8Qvdf0sqQY0IyNA5qljd/MDcKVGJydfXpbrbwhp3B X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:PH8PR12MB6674.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(366004)(346002)(136003)(396003)(376002)(39860400002)(230922051799003)(230173577357003)(230273577357003)(451199024)(1800799012)(186009)(64100799003)(2906002)(5660300002)(41300700001)(83380400001)(478600001)(6486002)(2616005)(26005)(38100700002)(6512007)(53546011)(31686004)(6506007)(6666004)(31696002)(86362001)(8676002)(8936002)(4326008)(36756003)(66476007)(66556008)(66946007)(316002)(45980500001)(43740500002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?cEM1Q2lOWUg4SmRidExId3kwUlI5S1NUVTRQZ04yUFNlUk9Oc2NzbEp6bzFW?= =?utf-8?B?MWN5MEFzbCtJR0xkbHJ5bEp5RktIRlNsTnNMYmlrT0FxZjRCT3h3cFgwbmU2?= =?utf-8?B?bE4vNEFMSFBTV0cvU3ZLT0l4QTREU0pnZnpYZE5UNzlJbDlObjA5MHIvTW44?= =?utf-8?B?dXlYUFRuYTk4MFA1cXNVSFNoLzBiTnQvZXAzS0xlWXp0cXpsMlhwMWp4Sjh3?= =?utf-8?B?WjRYMGlIWTIzb2hIVUZXS0ZqaFN6ZzF0MUxzR3NpcGFtTmw3am1qaDIrTGRn?= =?utf-8?B?OGRyTWhkRTloYldJZm1yODJJazk5SjVwbTViT2psZzlKcWIrVGdpOXZKV1c2?= =?utf-8?B?UklVcHFyNHhpWFRDTmh1anFORm9VNGdYUGtkOFRFVm9XcUxYZUlFd0VMY1ZU?= =?utf-8?B?U2NCNEJmc0hEMmZjQmE2bUZ4WERabmdOK0E4YVF6NnQwdnpTRVM0dXl0NllZ?= =?utf-8?B?UElCc0h3MnBRdEYwZStFRW1rdXdsWlE2R0xLcERmUUlpZkd0WUlWeVJ0a0tw?= =?utf-8?B?ZCtiUTRtZ3M2QkJ3YkxRUmFtUnE0L05aUUpYa1c0UmNRQ2cwOHp3RjRDSE1D?= =?utf-8?B?S1FTRVYrR25qdkthVTJ0ckdpR04yWXJFZUhIUDRuaWVrYVZHN0NZc2VMRmpj?= =?utf-8?B?L2NMR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vb1NjTXlR?= =?utf-8?B?MWF1cHoyWnhuUG1EWWNXN2k1bitzQWVaWCtTR1pLdnY3eWExbENLTGhnK3hw?= =?utf-8?B?ZmtXNVhPYmdieTBSdVIrVHNVai8ycGtEN2I4TmNZdU50ZDdpM1I3MWl4MHZD?= =?utf-8?B?dW1VN2JXS0Z0WjlKNGpQalg2VEFaVGx4dVJjNE5lUGlZdGJ6bmIrdXJveDFn?= =?utf-8?B?MzdXSzB4MUNxYkVhZU5YbHp6SVBXdHhyMUp4SkdqbW5MNFhZZFljbCtHemZH?= =?utf-8?B?ZnEzZmJ3SmswTDRzOXIwUXY1bGxFRW96Rk5rQ2hUbDUyb2kzWmNqTWpUQXg4?= =?utf-8?B?d0ZyWVhlTnZJbFJ1VXYzOUdnMVlsR3Z4c2dxamVYRGwxenFHVHA2aEhLTlBC?= =?utf-8?B?YWp6aWFpU2JlZXBTUU45ek1ZeWRVUzk5UEZML2FlSWtIZElqYUNFMVV6TUZ3?= =?utf-8?B?MHJrN29rbFM3M296OTFmMmxUeFFsTDQ1Y1ZvNC9GZDBWL0RLdDc3bk1lU0dl?= =?utf-8?B?VDJYaTc5QUVkVGMwUndvbzJOcjQ5aVBaUzZBSFRUMzVqbDNIOUFHYittKzl2?= =?utf-8?Q?VLiCKatYXTYY7NOONshmzonuo?= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: 81160bc9-927c-4973-35a6-08dc1206a587 X-MS-Exchange-CrossTenant-AuthSource: PH8PR12MB6674.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 10 Jan 2024 18:04:54.0452 (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: rZPlH5cZDir2p77tGT0CSBPEv6XR+cIWRleWqey8wyV27SKrz/R9cETiv2E9dvbZtBgz2GwhCHzotrQLK1NmmA== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH7PR12MB8121 On 1/10/2024 3:42 PM, Thomas Gleixner wrote: > External email: Use caution opening links or attachments > > > On Mon, Jan 08 2024 at 17:35, 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; > > This is not casting to u64. It's casting to unsigned long: > > typedef unsigned long irq_hw_number_t; > > So this works only correctly on 64bit. On 32bit kernels unsigned long is > still 32bit. It's probably arguable that the 32bit case is not a > problem, but the changelog and the change do not match. This needs a > proper explanation why we don't care about this on 32bit. Agree that the change and the commit message do not match. I'll update the commit message to use 'irq_hw_number_t' instead of u64. Thanks, Vidya Sagar > > Thanks, > > tglx