Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp2883573imw; Wed, 6 Jul 2022 13:24:58 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vAQFZoOhl9MQbTkHh5H7X5Akrt0z5KUWaYpvfRY5BPQcDZCX29J7kaZ1zaMfxpHJB+jgGV X-Received: by 2002:a05:6a00:2306:b0:528:3d9f:80e7 with SMTP id h6-20020a056a00230600b005283d9f80e7mr28851112pfh.77.1657139098716; Wed, 06 Jul 2022 13:24:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657139098; cv=none; d=google.com; s=arc-20160816; b=mMbSpzs5h3BHxs+oK7m4Ka9MykWg3g0AGviX5ez/AROcLrBBIaMzPOnCYQE+MaJ2QP dQgaaV68f7Z2js4f0kTuUk1FCsB/d2gAfQEBGdEOoi1Iogag4iKo5FMGk2llBPMbWu23 BZAdKPedSzeTbDtTd+Bmazvfga5aEnBb6FoXMcM/e5uTW29UyrNX7G9zLXNZmSyoYAtG 0C6dr9NuB74E4Cb6j289UwDJAkUNseUWQPobcjE7qe8K9WgvXSKJvq839NWG0iLHFFNT XJKuK3kvfyMSywplZyjaR+l5ltUD+O8wsuUzGPccFQ+6duWtZYGmbIcL5gAD5tOpwuRO LEgQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=/S//IAWVRTbBPPNIHjPWh5PsIkJnvKQ93EBXncvo+ss=; b=HDPPbImoFoI3U9hnvrk/OOk8L5lfwhaQCQXBklW6+tfet7xKF5yXgQUVISgq4iXo7U YQBSypR5p6gZGJZOFLzVuEGpOt5+DZHlo9T4gmwILYURDsGtyRF9pam1+mRwQ0ZL+v9u 0o/UwQf44iFI7LlxaOEQoHTKDvg5i5Nk5qTGexFf/5INTB/NhorNlsPrUR1SPrHaoMKc nDytXJnAlWKWR+v47AX4wm8RCa7OgdKvRYluK9bhBN2nkTE6uBJKLgskaEzvOFlnJ6oa ueO6z1omApFVFVsn89eXAepXkoocRTehj5xLjKqBSvMxIq8/i1npfUfCG07wEMLXmsed 8SpA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass (test mode) header.i=@o2.pl header.s=1024a header.b="jYN/rGww"; 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=NONE sp=NONE dis=NONE) header.from=o2.pl Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y72-20020a638a4b000000b004127d6a495esi6874729pgd.666.2022.07.06.13.24.46; Wed, 06 Jul 2022 13:24:58 -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 (test mode) header.i=@o2.pl header.s=1024a header.b="jYN/rGww"; 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=NONE sp=NONE dis=NONE) header.from=o2.pl Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233748AbiGFUC1 (ORCPT + 99 others); Wed, 6 Jul 2022 16:02:27 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48490 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233879AbiGFUC0 (ORCPT ); Wed, 6 Jul 2022 16:02:26 -0400 Received: from mx-out.tlen.pl (mx-out.tlen.pl [193.222.135.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 880BB186CA for ; Wed, 6 Jul 2022 13:02:23 -0700 (PDT) Received: (wp-smtpd smtp.tlen.pl 19338 invoked from network); 6 Jul 2022 22:02:20 +0200 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=o2.pl; s=1024a; t=1657137740; bh=/S//IAWVRTbBPPNIHjPWh5PsIkJnvKQ93EBXncvo+ss=; h=From:To:Cc:Subject; b=jYN/rGwwnfPbTq9wy+40wbPLVoq6ZBRLrtb1nxN5pLMzk5x8EGxQbl5DtjHfS4wkK N4WYuQK8PeX5IDE/limNYstVfuEcmZSwTf8ZxHahhhIHxh1bbWGRyR+kBx+WNDd+Io APIBanZVIdh1VXKmxMcLRAw7tBT9d4rE4TZfM9rA= Received: from aafi210.neoplus.adsl.tpnet.pl (HELO localhost.localdomain) (mat.jonczyk@o2.pl@[83.4.138.210]) (envelope-sender ) by smtp.tlen.pl (WP-SMTPD) with SMTP for ; 6 Jul 2022 22:02:20 +0200 From: =?UTF-8?q?Mateusz=20Jo=C5=84czyk?= To: amd-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Cc: =?UTF-8?q?Mateusz=20Jo=C5=84czyk?= , Alex Deucher , =?UTF-8?q?Christian=20K=C3=B6nig?= , "Pan, Xinhui" , David Airlie , Daniel Vetter , Jonathan Gray Subject: [PATCH] drm/radeon: avoid bogus "vram limit (0) must be a power of 2" warning Date: Wed, 6 Jul 2022 22:01:44 +0200 Message-Id: <20220706200144.68851-1-mat.jonczyk@o2.pl> X-Mailer: git-send-email 2.25.1 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-WP-MailID: e277a5e13a496bf62bb0d4eefa7f83b2 X-WP-AV: skaner antywirusowy Poczty o2 X-WP-SPAM: NO 0000000 [cfO0] X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham 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 I was getting the following message on boot on Linux 5.19-rc5: radeon 0000:01:05.0: vram limit (0) must be a power of 2 (I didn't use any radeon.vramlimit commandline parameter). This is caused by commit 8c2d34eb53b9 ("drm/radeon: use kernel is_power_of_2 rather than local version") which removed radeon_check_pot_argument() and converted its users to is_power_of_2(). The two functions differ in its handling of 0, which is the default value of radeon_vram_limit: radeon_check_pot_argument() "incorrectly" considered it a power of 2, while is_power_of_2() does not. An appropriate conditional silences the warning message. It is not necessary to add a similar test to other callers of is_power_of_2() in radeon_device.c. The matching commit in amdgpu: commit 761175078466 ("drm/amdgpu: use kernel is_power_of_2 rather than local version") is unaffected by this bug. Tested on Radeon HD 3200. Not ccing stable, this is not serious enough. Fixes: 8c2d34eb53b9 ("drm/radeon: use kernel is_power_of_2 rather than local version") Cc: Alex Deucher Cc: Christian König Cc: "Pan, Xinhui" Cc: David Airlie Cc: Daniel Vetter Cc: Jonathan Gray Signed-off-by: Mateusz Jończyk --- drivers/gpu/drm/radeon/radeon_device.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/radeon/radeon_device.c b/drivers/gpu/drm/radeon/radeon_device.c index 15692cb241fc..429644d5ddc6 100644 --- a/drivers/gpu/drm/radeon/radeon_device.c +++ b/drivers/gpu/drm/radeon/radeon_device.c @@ -1113,7 +1113,7 @@ static int radeon_gart_size_auto(enum radeon_family family) static void radeon_check_arguments(struct radeon_device *rdev) { /* vramlimit must be a power of two */ - if (!is_power_of_2(radeon_vram_limit)) { + if (radeon_vram_limit != 0 && !is_power_of_2(radeon_vram_limit)) { dev_warn(rdev->dev, "vram limit (%d) must be a power of 2\n", radeon_vram_limit); radeon_vram_limit = 0; base-commit: 88084a3df1672e131ddc1b4e39eeacfd39864acf -- 2.25.1