From nobody Thu Oct 2 21:54:42 2025 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.13]) (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 CE7212D1920; Thu, 11 Sep 2025 07:58:11 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.13 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757577493; cv=none; b=ojpWq5PkcIVVvhY3eeiCDelpFBBdIiNR/xUeXinlM6DUSkdDTlkXeLKAJlMx9xRla9mhfEnlPrpGYrhebuiPdfHHaMvFiawYK94i/6C+mrwH0mKRoox5TyMUhqn/6YKxwAc8iR0iKcBnYhnNOjeqqN6t1PtwaPTfOAfsh7AiHhM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1757577493; c=relaxed/simple; bh=q2NXdCfaeaFt2pL13ZzURnlQpqmRN3okCj9x9FdK8gQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version:Content-Type; b=qOOHWsFe6Ow7Bw1vmJ1rcjABBW2Lux9b5Jjqc1M9kZqZngxPNzI3wZmSoymPoaMr7oq5IdyNzQxolPlPu4A9oj7qIvzVIRC/O/dnlBb8oOd3+JL5OgCsjPZyQvPQwjhvd1tXg23RU+S6QpB3mGfTUPYwpOu8i4egMKpcTSTA2do= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=PS5UoEbe; arc=none smtp.client-ip=198.175.65.13 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="PS5UoEbe" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1757577492; x=1789113492; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=q2NXdCfaeaFt2pL13ZzURnlQpqmRN3okCj9x9FdK8gQ=; b=PS5UoEbeR5CAVO7jblvHnljVTUgV5DGDgNw1l71s9vt0YnwKYdwetgP0 HXKUXtR3Ko9jMkbkkwTZSVc6QxwSyxOR/z8GhmrzsXLQ8AqXfdiz0Nfr/ xsOA6tqad5djeU39svZhXHIjrC3973sZucReWMjImJZStqOnL6AAbCA8f mB39DRGxp5O1Nj18otCyo4aaLKMm3a9L9PKy69xM/ppyFa2PuwhEXBkQL YWC4KqQZRdnCwYm4koy787UDOoBO1EyWKUiSCrbi6Odla2ASnyirt0hj7 OStSjL7FQXhjv2Ax6gIZjg8eksaURp3ICeHN5DYHD3LZ28UKuUs+LNRuu A==; X-CSE-ConnectionGUID: hJPwi93PRsacRuRApNOmOQ== X-CSE-MsgGUID: 8ty6pSxMRV6QuG9RC64LhA== X-IronPort-AV: E=McAfee;i="6800,10657,11549"; a="70999336" X-IronPort-AV: E=Sophos;i="6.18,256,1751266800"; d="scan'208";a="70999336" Received: from orviesa009.jf.intel.com ([10.64.159.149]) by orvoesa105.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Sep 2025 00:57:38 -0700 X-CSE-ConnectionGUID: 1fbS3G9UQve8bxL1wG4n3Q== X-CSE-MsgGUID: QzCydIx8QAioJE/gvKEiGg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.18,256,1751266800"; d="scan'208";a="173186274" Received: from ijarvine-mobl1.ger.corp.intel.com (HELO localhost) ([10.245.245.187]) by orviesa009-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 11 Sep 2025 00:57:31 -0700 From: =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= To: linux-pci@vger.kernel.org, Bjorn Helgaas , =?UTF-8?q?Krzysztof=20Wilczy=C5=84ski?= , =?UTF-8?q?Christian=20K=C3=B6nig?= , =?UTF-8?q?Micha=C5=82=20Winiarski?= , Alex Deucher , amd-gfx@lists.freedesktop.org, David Airlie , dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org, Jani Nikula , Joonas Lahtinen , Lucas De Marchi , Rodrigo Vivi , Simona Vetter , Tvrtko Ursulin , ?UTF-8?q?Thomas=20Hellstr=C3=B6m?= , linux-kernel@vger.kernel.org Cc: linux-doc@vger.kernel.org, =?UTF-8?q?Ilpo=20J=C3=A4rvinen?= Subject: [PATCH 06/11] drm/i915/gt: Use pci_rebar_size_supported() Date: Thu, 11 Sep 2025 10:56:00 +0300 Message-Id: <20250911075605.5277-7-ilpo.jarvinen@linux.intel.com> X-Mailer: git-send-email 2.39.5 In-Reply-To: <20250911075605.5277-1-ilpo.jarvinen@linux.intel.com> References: <20250911075605.5277-1-ilpo.jarvinen@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable PCI core provides pci_rebar_size_supported() that helps in checking if a BAR Size is supported for the BAR or not. Use it in i915_resize_lmem_bar() to simplify code. Signed-off-by: Ilpo J=C3=A4rvinen --- drivers/gpu/drm/i915/gt/intel_region_lmem.c | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/i915/gt/intel_region_lmem.c b/drivers/gpu/drm/= i915/gt/intel_region_lmem.c index 51bb27e10a4f..69c65fc8a72d 100644 --- a/drivers/gpu/drm/i915/gt/intel_region_lmem.c +++ b/drivers/gpu/drm/i915/gt/intel_region_lmem.c @@ -61,16 +61,12 @@ static void i915_resize_lmem_bar(struct drm_i915_privat= e *i915, resource_size_t current_size =3D roundup_pow_of_two(pci_resource_len(pdev, GEN12_LMEM_BAR= )); =20 if (i915->params.lmem_bar_size) { - u32 bar_sizes; - - rebar_size =3D i915->params.lmem_bar_size * - (resource_size_t)SZ_1M; - bar_sizes =3D pci_rebar_get_possible_sizes(pdev, GEN12_LMEM_BAR); - + rebar_size =3D i915->params.lmem_bar_size * (resource_size_t)SZ_1M; if (rebar_size =3D=3D current_size) return; =20 - if (!(bar_sizes & BIT(pci_rebar_bytes_to_size(rebar_size))) || + if (!pci_rebar_size_supported(pdev, GEN12_LMEM_BAR, + pci_rebar_bytes_to_size(rebar_size)) || rebar_size >=3D roundup_pow_of_two(lmem_size)) { rebar_size =3D lmem_size; =20 --=20 2.39.5