From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from CY7PR03CU001.outbound.protection.outlook.com (mail-westcentralusazon11010037.outbound.protection.outlook.com [40.93.198.37]) (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 D618A3B19C2; Mon, 20 Apr 2026 21:46:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.93.198.37 ARC-Seal:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776721589; cv=fail; b=s/85qnVFQ6MzLkOvc2DkuxGouOtlN/gZaPRfzeAyA1BC5KqZLNBvhjLKvDAv3qcGO9bDVdOskeR+JslJvQUZH3YIo804F9X2fe8FDiO3fp3TROmNuv3GiCNaxlfqGi5fgbjL6kzXFxm3/xH4fdA1D5B4ML3FbHdYzd9hg61hThw= ARC-Message-Signature:i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776721589; c=relaxed/simple; bh=uT56L2Fl3e6QJcrwkaqV0dgO1h/l8IG1B1IvmZxNlCk=; h=Message-ID:Date:Subject:To:Cc:References:From:In-Reply-To: Content-Type:MIME-Version; b=W8Qlo3Z24In5JGRXguzEAEWdIn8+2zfX6hAXRmxrPhjeaD64JJbWtOjKqH+xt6VmrvZi0jUVe1ysWMiuECvJqX+ApL+fp3uVKkPHJoe9IvPUb/WMkaJiZHLQj//KAqNzz+S7x/+k6g1zsTgd2QoV4D5CqbqUtaqtGDtuELUxvXM= ARC-Authentication-Results:i=2; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=nvidia.com; spf=fail smtp.mailfrom=nvidia.com; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b=nUEMSzAH; arc=fail smtp.client-ip=40.93.198.37 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 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=Nvidia.com header.i=@Nvidia.com header.b="nUEMSzAH" ARC-Seal: i=1; a=rsa-sha256; s=arcselector10001; d=microsoft.com; cv=none; b=tVY3kHAsDbIfh+JjpUJqOV8nJsfPRNmxX7hFndBi8D4RBCdmFyE2bYuT+sWpv+eu6FOL1QCj7OP19XHaKh5bPawp0FdRUl8Uu0W3LobJn8jETL795706qe+bL0dt23kjUMkcStCS1u5i6dd8X+4lGO5YXgKXBYsEQz+h4Ux75NTUDb3PLiWgstJp2tnUVXKtuP5R14ElkVGyCAngoSoTwn4Gy1UFAbupI41RHy3C3CrkJZlYcjSBTP8KaiTSJ+oVyvb0MZHpbEGtanbwnqI8hvB0zD9/44CQ0B0ZD5AmFezf9ArKXvwj2C0PdMlyJOhzrMrbskpm4nw5zkRIfg1Umw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector10001; 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=40dg/orMlf8PELDzBLNO3f/QYSwg9ywOFJYlTjYlyag=; b=Ny6PJe37Gvc0/ZjmeIRSP7f8KQ65ymWtgoAI+7XVMW2JlhJj2u11gn2q5jLRt++5jXLbDITwSNzrQWl7T+Rg3F9ngn+YuHVWI92OQz5kcyy0mshYNzj5/jn+1zBogmxQndWLLX0b1y8UMRFHB9FthR716bYkOrmGD5m5iY3duWS1pw2pvM/7l5msiq54EgNuwZrzRuUOlsUxAoJrAAv2rfPGjEemcVYbSFnhvLbYA7Pr0ZZHY61dFZ4VhfEKP9A8f2Zr4gC6fkU3LzXk0wF1BnxhS11PlD6EEG3pmteIsHWohNlqS4NkldXsSmZ923FhU3vtJYZWiq5kcgrZPhNTfA== 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=40dg/orMlf8PELDzBLNO3f/QYSwg9ywOFJYlTjYlyag=; b=nUEMSzAHPSvJxSP/sMwnNoHygPn0Z+Hpc2RaxS7kAqZETRz/iwRldon5Us218vz+Kn29tdG1r5jm0NjhQBpRcZbKC0R43snjKixOay+QgrSApXBAwhhen0E6yen4bzTDFSu6qvfBIFy6QSA68OmGDd3nn9uS/WEEt504D3D4B2MQr2qAjjalQlg9VXEJQi17RpUxrj9tkwYCM2p3rWwYuExsgamGpXrtmMPVXumbQoXnHxKS1OXxWiCbKgyrB/B4+D5c0nc/Rqb8QQwin8EhD9ul3k6T4MJHfXwrF9BB37208HZ0lTWCa6hwqq6kbrx1o3ktGPAZZUdiuKOuAUhDfA== Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nvidia.com; Received: from DS0PR12MB6486.namprd12.prod.outlook.com (2603:10b6:8:c5::21) by MN2PR12MB4437.namprd12.prod.outlook.com (2603:10b6:208:26f::17) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.9846.15; Mon, 20 Apr 2026 21:46:21 +0000 Received: from DS0PR12MB6486.namprd12.prod.outlook.com ([fe80::88a9:f314:c95f:8b33]) by DS0PR12MB6486.namprd12.prod.outlook.com ([fe80::88a9:f314:c95f:8b33%4]) with mapi id 15.20.9846.011; Mon, 20 Apr 2026 21:46:21 +0000 Message-ID: Date: Mon, 20 Apr 2026 17:46:19 -0400 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH v2 08/11] gpu: nova-core: vbios: compute FWSEC-relative Falcon data offset To: Eliot Courtney , Danilo Krummrich , Alice Ryhl , Alexandre Courbot , David Airlie , Simona Vetter Cc: John Hubbard , Alistair Popple , Timur Tabi , rust-for-linux@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org References: <20260414-fix-vbios-v2-0-705d30d16bba@nvidia.com> <20260414-fix-vbios-v2-8-705d30d16bba@nvidia.com> <54b13fa0-9405-4fc8-ae41-fd1d310c7aa9@nvidia.com> Content-Language: en-US From: Joel Fernandes In-Reply-To: Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit X-ClientProxiedBy: MN0P222CA0002.NAMP222.PROD.OUTLOOK.COM (2603:10b6:208:531::7) To DS0PR12MB6486.namprd12.prod.outlook.com (2603:10b6:8:c5::21) Precedence: bulk X-Mailing-List: rust-for-linux@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DS0PR12MB6486:EE_|MN2PR12MB4437:EE_ X-MS-Office365-Filtering-Correlation-Id: cefe2eb4-11d3-4b16-c2da-08de9f2642b2 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230040|366016|376014|1800799024|22082099003|56012099003|18002099003; X-Microsoft-Antispam-Message-Info: 5B1SHYsTcuPumK6f1Jp8QEsb0lxo0uCCpN6bCEpeWks/oivIx+2QW8aVHYSMso4XXyNQC91Q36kaDpoGqhPVpffe9LsWvckyWanp+kQyaYVG/gN2ymOgE01HnNCD9mcW5qfIwe2qRytNZJn8IuSOU0ledVPniSmUOVh8eGsr6VmKEit8h+O55F/bn9y6cRm6iBL2CngqSrFpuH4LE7P64bNCQjcD/1IMI0fBrkJZX1IwVXeu7v2M7khSGLqGxZr+Tiga/T3u3GKGU6pNtRXoXKS83yCwHXq9zz8c2GcSYIxVDBZXY3ilS3ystKJaBRmdlDZIX4tWjL7kQgLz/CWrtz1TXCUeDiCZIA/TyeI8dY2yYty/22V3KB/Wj+FVNzMcp0UBXIyYKqPSmWuSOu1e7tHrIpx4vzHsB3aYBZqwxSTqpWDUv4bTRqOeSFy2Hngix8b/r7/ZeGyguaGOgw5d6FIOmErrHyBHKF5Sbm6GX3riupYlKUhK4NcABGwj32JC5ihm11fExCYKeezBDeCeK3PZuvylARGNtty8dhXgF5yj7Xd6mUncEUki6YttYvCGGdas+MWghDIt4Iwel9sDeWfjr26scORM+07MBhL3lN6+0xyVds5K+bmBvjr6ifZvXT75omc9hrhLGmi3P4h2zCcZ/8sk83k8O6a1pu9JUe5XRIqCn3qwxyQeBHMk4hBIHQNu5Q4ZP/VDqK5KRhf2hX+utXKrj/zvRyT03EgDs9I= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DS0PR12MB6486.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230040)(366016)(376014)(1800799024)(22082099003)(56012099003)(18002099003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?dFVoZ201ZFFnYWhBWkpvYTRqYm1TRDNoUDFHUFJVa1g4eDAzUDFmdG1BcE5h?= =?utf-8?B?aUFqUzM1bTdQY1F4TkJ2K2dqVjUzSzFkZEZDdTZLbmNSQVN2UHgzNGhiOWxh?= =?utf-8?B?VVhHLzRsbG13emZQTGxZUzM3REppWDdTUllQWTI1SGp6VUVweGE3YnR3Qys2?= =?utf-8?B?bng3NmpFejFrZHlqRnRZVmpGSHNKYWhPNmo0K2cra3A0N2lFb3d2cGdhUWZy?= =?utf-8?B?WHJsdkgzQ1dTb0h5bU5hb0hVOXhjZEVXcmVPZ3ZZT1A0M0d3WGFMdk1BQm1m?= =?utf-8?B?Z09KQU5HYlB0N2RCRi9RTHNBY1V6cE1kK1FTUExOb2c3Y3M5NkhSUGNIM3cv?= =?utf-8?B?Sm04UEwzSXJ2dmdaTFA0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lYWNGUnN5bnor?= =?utf-8?B?NnJObk1raXo3Vld1U0FpQzlJQkdmRGhENy95UlNCKzdCMDNTdWo3ZDRCWmZY?= =?utf-8?B?ZmFqb3lkWWJIdGFKaDhLaCt3SmFHWmxNVVZxbDRXNXBlL0lWN1kyL3kzTkZv?= =?utf-8?B?L1NyaHRHRFlJcWNIZHNjc0E1M1Q3SjZYOHNSeURBeVJ3MWRxV1FEdz09?= X-OriginatorOrg: Nvidia.com X-MS-Exchange-CrossTenant-Network-Message-Id: cefe2eb4-11d3-4b16-c2da-08de9f2642b2 X-MS-Exchange-CrossTenant-AuthSource: DS0PR12MB6486.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 20 Apr 2026 21:46:21.1444 (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: wvEfUJFTPrEmqgRGg6hKziGQEOmaY/1tNPD6AYq+u8E/q5/vX7E96nPAiKo7ka07j6636AHMMhGpuFuOlVMWsw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: MN2PR12MB4437 On 4/16/2026 10:41 PM, Eliot Courtney wrote: > On Fri Apr 17, 2026 at 1:13 AM JST, Joel Fernandes wrote: >> On 4/14/2026 7:54 AM, Eliot Courtney wrote: >>> Push the computation of the falcon data offset into a helper function. >>> The subtraction to create the offset should be checked, and by doing >>> this the check can be folded into the existing check in >>> `falcon_data_ptr`. >>> >>> Signed-off-by: Eliot Courtney >>> --- >>> drivers/gpu/nova-core/vbios.rs | 48 +++++++++++++++++------------------------- >>> 1 file changed, 19 insertions(+), 29 deletions(-) >>> >>> diff --git a/drivers/gpu/nova-core/vbios.rs b/drivers/gpu/nova-core/vbios.rs >>> index 01f65d50cbb3..0c0e0402e715 100644 >>> --- a/drivers/gpu/nova-core/vbios.rs >>> +++ b/drivers/gpu/nova-core/vbios.rs >>> @@ -765,33 +765,29 @@ fn get_bit_token(&self, token_id: u8) -> Result { >>> BitToken::from_id(self, token_id) >>> } >>> >>> - /// Find the Falcon data pointer structure in the [`PciAtBiosImage`]. >>> + /// Find the Falcon data offset from the start of the FWSEC region. >> >> The comment change is incorrect, this subtraction is just for normalizing. >> It basically normalizes the pointer wrt the PciAt image. >> >> It is only after the following in the caller that we get the true offset >> within the FWSEC. >> offset -= first_fwsec.base.data.len(); >> >> I suggest, let us rename falcon_data_offset() to >> falcon_normalize_fwsec_offset() and update the comment above. > > Thanks for your reviews! W.r.t. this, my understanding is that the > layout is something like: > > PCI-AT | Efi? | FWSEC | FWSEC > > And that the falcon data pointer that we get out of PCI-AT starts off > like this (indicated by ^): > > ^ PCI-AT | Efi? | FWSEC | FWSEC > > But the actual "address space" it's in is: > > ^ PCI-AT | FWSEC | FWSEC > > Because it doesn't count whatever images are between PCI-AT and the > first FWSEC as part of that space. So by subtracting the PCI-AT size, we > convert it to this logical space: > > ^ FWSEC | FWSEC > > Based on the above understanding doesn't it make sense to say that > `falcon_data_offset` transforms the pointer to be relative from the > start of the FWSEC region? Once we subtract off the first fwsec image > length, it's then relative to the second FWSEC image. Please LMK if I've > missed something. We could also emphasise in the doc that the "FWSEC > region" means the contiguous region defined by the first two FWSEC > images. WDYT? You did not miss anything, your explanation above is spot-on. You could also keep your function name and add a comment on top of `falcon_data_offset()`. Something like "offset from the end of PCI-AT (i.e., the start of the combined FWSEC region)". Sounds good? thanks, -- Joel Fernandes