Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp31805913rwd; Fri, 7 Jul 2023 04:53:50 -0700 (PDT) X-Google-Smtp-Source: APBJJlFUmESKXMATrKTJFvLORdE55Meo0PRRzRsQfMC9cRy8VbR7lwiHhYVz9yHdwYnjz6+3a1ja X-Received: by 2002:a17:906:100e:b0:968:236:eb17 with SMTP id 14-20020a170906100e00b009680236eb17mr4299384ejm.24.1688730830326; Fri, 07 Jul 2023 04:53:50 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1688730830; cv=pass; d=google.com; s=arc-20160816; b=yUNL9Whk79hTobCAlpEHlcIuHG89gc8fHcsGu07F7OSYNxKwbhTCpQQU32xMCZNaKb IfyrMCNNBDILoT0mkiggkKQqNXdSwVH2wyL1akl2vBLebiaLJCbmTooIxVFvMpYe5MHz G5tQWHCi8wgHdrjp3/PBjfkxHdAKQoVZ8YYigfHT32UERaRkTmGppya3VzbOOqKvTAt9 +xSMgsMfR7FwysAQvJPFcCyi8QReyUePRMmXztwwnRU0Da0zcs0txTxiPzcmzGYloy3p g8n0Rwr/QSd/GXWw5AEyMcq10tk9Z1NJA3bBsCklvcG9AkILo5Wx57LkT/4nZ40107Zv K3TQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :in-reply-to:from:references:cc:to:content-language:subject :user-agent:date:message-id:dkim-signature; bh=qZbSH6GeZu3srC+GdbtTg2oAHRVOJPBiweUAIaclw60=; fh=q4DcQRX99PLf3Eqq4FSY/6kzaLM9PN9r50F0Z0Ztbls=; b=R1e/d2lG5pVII0W+uUvEe3OZRlGn//R61AN2XyV/74cAoavsAgvAqPm3a8cz+qXWXr 4oXfeLZnqEdb6nHXNFXIasI9JtT3XJ0jpIRhZjvmsDI9mUNpYKIrFAafiIh4GgUR+ds4 00WDEbLavMfLkmVZ5qKcwBFIBH1xIDwDK4FKDSWmn21Eqw6DbKbJGUoK5etAjea72ur9 PuGVNwYrNscqdzrvAma07LukrA3Yk1uMHJv6AkzgMrmt+tLb4huArGatU9QBf/7ca9uo TShgtW1pxWs2xvC+ZUQ6sTqJznklk9MxuWG7coWHg87aEDMXIJkLCaF7HSuNuSEHiRk0 gXyg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b="tnmni/nC"; arc=pass (i=1 spf=pass spfdomain=amd.com dkim=pass dkdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id fi25-20020a170906da1900b009936880c9afsi1545986ejb.377.2023.07.07.04.53.26; Fri, 07 Jul 2023 04:53:50 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@amd.com header.s=selector1 header.b="tnmni/nC"; arc=pass (i=1 spf=pass spfdomain=amd.com dkim=pass dkdomain=amd.com dmarc=pass fromdomain=amd.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=QUARANTINE sp=QUARANTINE dis=NONE) header.from=amd.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230372AbjGGLrV (ORCPT + 99 others); Fri, 7 Jul 2023 07:47:21 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45932 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229649AbjGGLrU (ORCPT ); Fri, 7 Jul 2023 07:47:20 -0400 Received: from NAM12-BN8-obe.outbound.protection.outlook.com (mail-bn8nam12on2047.outbound.protection.outlook.com [40.107.237.47]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 233D0E53 for ; Fri, 7 Jul 2023 04:47:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dfpRTPKImpyQIFi1LW/t50VP1fA4kV0nQ2hcreCseLDzGa68YX9oSlRy+tBvA7ook3hhGgS1og6z+OuUu4pwrSAvP32ndhl3MyKcPA5VCEEgq514imbv4DFUl9fTNC9HnQoxrT9NvDhdxozAa44RTld7mz4XtFsz9jRQNpmgmm1vTTyT/U1JiQKYUKx0EHmMuXBhrtOn31a+A8UZxt0MlvgVQh+kUvl9nNllcctpT4vI+6JvtI5JY+pL1cuqjQzWhHE4hR6iP9R/AZ1mdq16OHB18FXwsJU/3nS/U+8Xj1wAVKExUF141jXmMQdaQJZVoT80tZDxPTwY/OZ3ttXgPA== 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=qZbSH6GeZu3srC+GdbtTg2oAHRVOJPBiweUAIaclw60=; b=ij5EHHWAvv9BofHcdHP3CPFZChQTJIaNdyMIjJ5xmP2QyAltxuiKedauOvMETJd5bkQdaID7dG88+Jc2mZON1w2o/LmrNFY2yjLfzpZGu9k3/U09iGshYcqx47vFnPLi/7+0ww4REtUU40TH3q6lDGlxZfn7IuSqPojhXEgxASdc4BBBTXsbZ8+j+keLC/5TIOJoMpdMLpA+yNng8LUUvNkPT+rhcoYe1iDrrZGmbVvKdPQNHtpGVMVz1KIcM+vVOy4fAJB42fF9pYwUq3wHbqcpY8AzuoYqiA4sKDVLcAa6IIxpnWNarawmFCVsmf+ImIiFYXuhyhCPXzV86z4BeA== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=qZbSH6GeZu3srC+GdbtTg2oAHRVOJPBiweUAIaclw60=; b=tnmni/nC5sYnXdDd1zgpiOe1JHArfhrM4rBDlXqL0ZTzRnI6cdUZk4YJcqyXrqI2euBKyT1KeO1A4Nfm0t7pveEqxuxwxqKNEfkz6nzkaCSfRQb/RkCtqEVkS4Hw14RJYQIMdrm6Th9i64Vy7Wfbsobcme77CvRff6IhjaCRQOA= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; Received: from BN8PR12MB3587.namprd12.prod.outlook.com (2603:10b6:408:43::13) by BN9PR12MB5339.namprd12.prod.outlook.com (2603:10b6:408:104::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6565.25; Fri, 7 Jul 2023 11:47:16 +0000 Received: from BN8PR12MB3587.namprd12.prod.outlook.com ([fe80::e8c1:b961:25c0:1fb0]) by BN8PR12MB3587.namprd12.prod.outlook.com ([fe80::e8c1:b961:25c0:1fb0%6]) with mapi id 15.20.6565.025; Fri, 7 Jul 2023 11:47:16 +0000 Message-ID: Date: Fri, 7 Jul 2023 13:47:09 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Subject: Re: [PATCH] [v2] drm/amdgpu: avoid integer overflow warning in amdgpu_device_resize_fb_bar() Content-Language: en-US To: Arnd Bergmann , Alex Deucher , "Pan, Xinhui" , David Airlie , Daniel Vetter Cc: Arnd Bergmann , Hawking Zhang , Lijo Lazar , Mario Limonciello , YiPeng Chai , Le Ma , Bokun Zhang , Srinivasan Shanmugam , Shiwu Zhang , amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org References: <20230707111157.209432-1-arnd@kernel.org> From: =?UTF-8?Q?Christian_K=c3=b6nig?= In-Reply-To: <20230707111157.209432-1-arnd@kernel.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-ClientProxiedBy: FR0P281CA0212.DEUP281.PROD.OUTLOOK.COM (2603:10a6:d10:ac::11) To BN8PR12MB3587.namprd12.prod.outlook.com (2603:10b6:408:43::13) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: BN8PR12MB3587:EE_|BN9PR12MB5339:EE_ X-MS-Office365-Filtering-Correlation-Id: eb4db5d6-41c1-41bd-a048-08db7edfe8c5 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: ncLggLZDVf7Fu6KSVLwfpm80V7bSHbHVW6BRTc4kG6oIxnXJzBGLDtxDzItBjAGvklR2/xkF9dCU9hXo2ujT+6va4E90esJRBSmCYCVrV7PMYr7FcreyR1LdRsPtiz2D6xeZSmXhwy7Ytu1UMkngslQww7f74Axnj1OelqwGcaVCE5u1ZIXKj2TYZ85YkktNxVDE8bp1vn4+5ISnRtoUD9gEkB8N9Xi3kclB6HycryUoEcI6pHfxXH4S4QjaGl/yDQhTLxdcvP+wz/ouBonrFNNQTpptCVfdMFuwigvpoe4HbY50vXx363uQvRi5oq9hcIQIFPNRcsCsZseUSHh+WHnAF9fTNIqI6o18N3A6/HzSF94WP9gpqSkxzn3CC9iqd7fdUWdffWD3Mcp+lVR9MF0FzA26ntO8TCIlXboVa6c5XWfty7kn/nZHlznlCBr5hhpp6HIefwQgSTAInur8eHP1tpeUsM/a0gBjnc+ULApklNKHWd/yLbLKDZJcHqEh0PfxbubUSkbbJDBNkm4CqZ8IbqhIavimfvCaMoK0r9XC6znSC/amYuZ+enVCA1Zw6qqBFNLz3cEN2yxcRTXDxkM9rxdk3Qilu9kEBRVCiBap2RfCsLL2BVnWT7KKUnPN/IVy5lFfKadB5cyNBDHvoQ== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:BN8PR12MB3587.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(366004)(346002)(376002)(39860400002)(396003)(136003)(451199021)(316002)(8676002)(66574015)(83380400001)(2616005)(2906002)(66556008)(4326008)(66476007)(66946007)(6666004)(110136005)(6486002)(54906003)(478600001)(5660300002)(6512007)(186003)(6506007)(41300700001)(8936002)(38100700002)(36756003)(31696002)(86362001)(31686004)(45980500001)(43740500002);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?B?NHJOVG41d0I5YW52UDNhMDh3SGx1ZThmWFZNRFZ4WXh5QndCWkVFUzlrZ0xp?= =?utf-8?B?UVdTd243WjdtWHU3dmp4bGhNcEZsaGFleW4zZFFiQVJFVUtaRk5YUHk0bUlq?= =?utf-8?B?SkRxM3NUM2RiM0JPVWNXL1lraHNVd200cmU2UTFrUmZTaTMrWE55ZDl0ejdR?= =?utf-8?B?bDYzYUJxandVZEttMTRPdzhUdUk0UllkV0Q5V0NsZDhrNWJhY1VSQk1nV293?= =?utf-8?B?WlFYaVJDZXNkTlZjU3pqV3p0OW9xK3QwVHd4czhtOVZYNlp3SHJnQ21wVUhK?= =?utf-8?B?K3hnWlJGTnl6TVU4cC9HVHlINVR1QmxzZkNnTnBBN3Y3R1RqWVpnWkM3UndF?= =?utf-8?B?UHB4TXBsUjJYQlM5RXhvMUh2RzMreFZZTWtTWTBwV2JueGZtYnovQjNiQjIy?= =?utf-8?B?NkVhd0hYZjR0QU9UMDV1bFppZW1FcmxnMmtwSzFXUktR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d-a048-08db7edfe8c5 X-MS-Exchange-CrossTenant-AuthSource: BN8PR12MB3587.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Jul 2023 11:47:15.4349 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: KEvr45XkBTWLT4Kr3yCVJ+VZZCDF5jlAWBDwptgmRuyZGjIWjxYV4Prbwyc+/xUN X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN9PR12MB5339 X-Spam-Status: No, score=-1.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FORGED_SPF_HELO,NICE_REPLY_A, RCVD_IN_DNSWL_NONE,RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_NONE, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Am 07.07.23 um 13:11 schrieb Arnd Bergmann: > From: Arnd Bergmann > > On 32-bit architectures comparing a resource against a value larger than > U32_MAX can cause a warning: > > drivers/gpu/drm/amd/amdgpu/amdgpu_device.c:1344:18: error: result of comparison of constant 4294967296 with expression of type 'resource_size_t' (aka 'unsigned int') is always false [-Werror,-Wtautological-constant-out-of-range-compare] > res->start > 0x100000000ull) > ~~~~~~~~~~ ^ ~~~~~~~~~~~~~~ > > As gcc does not warn about this in dead code, add an IS_ENABLED() check at > the start of the function. This will always return success but not actually resize > the BAR on 32-bit architectures without high memory, which is exactly what > we want here, as the driver can fall back to bank switching the VRAM > access. > > Fixes: 31b8adab3247e ("drm/amdgpu: require a root bus window above 4GB for BAR resize") > Signed-off-by: Arnd Bergmann Reviewed-by: Christian König > --- > v2: return early instead of shutting up the warning with a cast and > running into a failure > --- > drivers/gpu/drm/amd/amdgpu/amdgpu_device.c | 3 +++ > 1 file changed, 3 insertions(+) > > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c > index 7f069e1731fee..fcf5f07c47751 100644 > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_device.c > @@ -1325,6 +1325,9 @@ int amdgpu_device_resize_fb_bar(struct amdgpu_device *adev) > u16 cmd; > int r; > > + if (!IS_ENABLED(CONFIG_PHYS_ADDR_T_64BIT)) > + return 0; > + > /* Bypass for VF */ > if (amdgpu_sriov_vf(adev)) > return 0;