Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp2930016rwb; Mon, 15 Aug 2022 14:15:51 -0700 (PDT) X-Google-Smtp-Source: AA6agR4UgJtvlC0HdEYXWU7J4FQDTE4xPTyXllMRawgcm3XPQLsn8KDr+tB7VU85PSlbU4lxM39z X-Received: by 2002:a65:6949:0:b0:41c:cb9d:3d1f with SMTP id w9-20020a656949000000b0041ccb9d3d1fmr15389291pgq.334.1660598151116; Mon, 15 Aug 2022 14:15:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660598151; cv=none; d=google.com; s=arc-20160816; b=V9J9gm/n6WA++fcpqy45O0Auww2hSmiR0iesFijTsYPA099e82ww0D2PXJQK29ronC RA+tt8RbYJTeqThhkFHtx8pRz2urv2ZoK4b2yThDlntziE+crqN4YrHg4yg0RJbHgbyq hw9F9+xyWuRvTv75qoJXrpR81uAdu2+yNNCmRnYNct90s9yokgIN51g5TfJsX5CHltqe NZeVLuYuU0UsEwJKqPV4pvsLlFbj0U4OnTgMoBggYlnMnsaXW8eMqU9J1TVi3tdJOsfR JgWUitsN/oRQTP2zRA7r71PvdtugWU8hN0Q+d6MHtMFSrOCcPBtp6GiJ5708SULQQFSe 1YWw== 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=jpl/Xx8e5OaS3GORQj5MOZqNRIT5kF405WBtNBNW+S/YE7YQjMa+d7dHCgS2VMVv3O OKIKSupiBeKoc6tVo5ptQ8l579C5FXTbuqYfG0lvEFSz0OZTd/uISfhwGnetN40Lzfjb KPJMq7nhBq2fwZ44w0z37OBaMqneK8rHdIMVvlrvYUcVnG/TiGpXrO9+hEhFfTOmD5u5 uiT5iVdUjokIItYncHpQmSjZzuvhpf4hrBYv30DI3r/NijP7rlANvRyZV2QTvejwFao6 MYbaqr/u3qG1QZdCgBO2NMo2OaG/UWvjfLmelcAO6sVpiLqaXsMIUhlPMA5nY+aXF/Kw HV4w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=WCZVbsqQ; 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 17-20020a631651000000b0041e27a782a5si12595582pgw.144.2022.08.15.14.15.37; Mon, 15 Aug 2022 14:15:51 -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=WCZVbsqQ; 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 S1344670AbiHOVLr (ORCPT + 99 others); Mon, 15 Aug 2022 17:11:47 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45956 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347788AbiHOVHe (ORCPT ); Mon, 15 Aug 2022 17:07:34 -0400 Received: from sin.source.kernel.org (sin.source.kernel.org [IPv6:2604:1380:40e1:4800::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3D29CD5DFC; Mon, 15 Aug 2022 12:15:57 -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 sin.source.kernel.org (Postfix) with ESMTPS id C0D11CE12C5; Mon, 15 Aug 2022 19:15:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id A5DF5C433D7; Mon, 15 Aug 2022 19:15:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1660590954; bh=Q8Hc5xyH/xwarte89q54kVHnwt5Jx0tft9JuJvXgEEw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=WCZVbsqQ8W09FXShZlp49xw3HVlN0MpQ29i01U5FX5aHbBcXru/yOjfaD6i8Nk7eU fXErA1dqVe+NNIp5EVjEEw7aL5dM+XPWll/PpXd52IkfDv9lsYu5kw6fXtfRaxEtKT +JWaM/DzINMZv2MuSBTMZAqj1KyOyeHNa7y9pLnU= 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.18 0424/1095] drm/radeon: avoid bogus "vram limit (0) must be a power of 2" warning Date: Mon, 15 Aug 2022 19:57:03 +0200 Message-Id: <20220815180447.272844505@linuxfoundation.org> X-Mailer: git-send-email 2.37.2 In-Reply-To: <20220815180429.240518113@linuxfoundation.org> References: <20220815180429.240518113@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