Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3081561rwb; Mon, 15 Aug 2022 17:40:22 -0700 (PDT) X-Google-Smtp-Source: AA6agR77sDPSNfOj/EZAxUtL3gW57XybLflu99HVZUG8mIwl1QVBjP4QehQeQLStj9TSRJdpl/1P X-Received: by 2002:a17:907:28d6:b0:731:5d0:4401 with SMTP id en22-20020a17090728d600b0073105d04401mr11831909ejc.765.1660610422370; Mon, 15 Aug 2022 17:40:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660610422; cv=none; d=google.com; s=arc-20160816; b=ECPC1FWil5AG7BOSpYzFVHr2hpCMNuW7ajCS5kCH6ws60ytyNOvmT7HEQoCG9vqYf/ TzBayI8tg7NKSnrPPdZoIbqVMoKcDPLqlCQP/1Orv+JLqhQYjjdlDGzQaLNFe7h0kqc6 um097cVImQXCRFXl59V99imUV2buPdkD7O+R1e7fvTW1XTBN5BNwXgqJir/mNOhe59dP Ojj9RaghcOwjX0BiiZowm08KBMUw32tu27T4Ow+fTKjF8X0i9G5LVTov2BjtqxmiJoqn Xsa1PY0hI+6QeGNs15vfp6JFNQAWLwu/+iYxhaa1ciVg9rWvQjBJNNtaVkKvKYZYPWg0 Umfg== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=c6mkpSr4KUob3L1EvHkL5sJTSiTwP/dyqSrlB7jlakY=; b=hs074NJcmfq9PQbeO5pKS2YFeJbDmpEx8yW7s9kpXiA0O5911MtoLTDEOxbjNtMGCi cNB9xdNJUjQSiO4jiQMYsWsaOo84TGLq4S2Qo8FtPoKHzUuJ5k1NITzy8sgyt5LChBKJ keBIJNgMnKPfJgVxNl4PWXSpJy4+vP1ohVgWWHu8UuIfSv6KTIP9oLs3RJ1AypCbXbf3 MzjrJ7NmktwYejqiqXjDK2JtrK0MgdrCZquGF+pWKY7XMH19DyU3aROv30bFpyhN4rmW 1FJlGxqT395ZFzHfOOvfYNU31GvIyo4mcwxnVB+90WjjHyxdkXpDC5APunQPoxcYkQb5 eWig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=uEn6+iCZ; 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=linuxfoundation.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id ej27-20020a056402369b00b00443b1e53479si3782651edb.374.2022.08.15.17.39.57; Mon, 15 Aug 2022 17:40:22 -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=@linuxfoundation.org header.s=korg header.b=uEn6+iCZ; 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=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1355294AbiHOXvs (ORCPT + 99 others); Mon, 15 Aug 2022 19:51:48 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44916 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1354346AbiHOXoR (ORCPT ); Mon, 15 Aug 2022 19:44:17 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2929986C19; Mon, 15 Aug 2022 13:14:08 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 972D560B6E; Mon, 15 Aug 2022 20:14:07 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A0C51C433C1; Mon, 15 Aug 2022 20:14:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660594447; bh=Q8Hc5xyH/xwarte89q54kVHnwt5Jx0tft9JuJvXgEEw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=uEn6+iCZXbQqlQYln1QJuQXXaG1JW9H03U2asc82dlwsmSZzMkz60mPUAY2cdCALJ ZGNCJLDRndDGjLi3OE21jIYyIHAAGb8derSj1Y9dl9gJypg06WPq14JTbX2UC543Qu Bqeb+tSnlzuwEBS4oyjRUX/EbsgKtAtv0H6bAs4A= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Alex Deucher , =?UTF-8?q?Christian=20K=C3=B6nig?= , "Pan, Xinhui" , David Airlie , Daniel Vetter , Jonathan Gray , =?UTF-8?q?Mateusz=20Jo=C5=84czyk?= , Sasha Levin Subject: [PATCH 5.19 0451/1157] drm/radeon: avoid bogus "vram limit (0) must be a power of 2" warning Date: Mon, 15 Aug 2022 19:56:47 +0200 Message-Id: <20220815180457.638063331@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180439.416659447@linuxfoundation.org> References: <20220815180439.416659447@linuxfoundation.org> User-Agent: quilt/0.67 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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 From: Mateusz Jończyk [ Upstream commit 9da2902609f7519c48eda84f953f72fee53f2b71 ] 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 Signed-off-by: Alex Deucher Signed-off-by: Sasha Levin --- 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; -- 2.35.1