From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f45.google.com (mail-wm1-f45.google.com [209.85.128.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 682493C3C0E for ; Thu, 18 Jun 2026 18:41:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.45 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781808097; cv=none; b=YKoRFSt2F/qX2dUY/NCWO4UsIZ147oHi/VTAPAUzxPCyS4P2+jZ3tQBSFx/dwJUEzjmDAvpDHvHNKJsk1YvGfSoq5bJzFZOG3YcPT+axu9SDFTwdlOdBmDipwvoGlfqKgJDhMxj0MGAmKJQp3uvGdfJFN2cj6c7vXcKvz0QFeHQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781808097; c=relaxed/simple; bh=OO1QTmlMzomaVHk7a4oyDG+06Lam2mD/Z+C47a7oTrs=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=dp8y+EG2RH2Tox5MRxFdBnbXgoxBb7zJpOz658v0ObS6pdah2oXKohCEsZWd1foO2b44dnD5nxxn3UiOO84L68EY6+M46+P8OLS/rePok0mglj4c3Iqm7tLuSfXrX0G6aiDywz6oKZ6OAA+6czWkzMSg+s62F1FZ/doZ7dKW/S4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ursulin.net; spf=pass smtp.mailfrom=ursulin.net; dkim=pass (2048-bit key) header.d=ursulin.net header.i=@ursulin.net header.b=b48xVDeB; arc=none smtp.client-ip=209.85.128.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=ursulin.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=ursulin.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=ursulin.net header.i=@ursulin.net header.b="b48xVDeB" Received: by mail-wm1-f45.google.com with SMTP id 5b1f17b1804b1-490ac357c55so11901955e9.1 for ; Thu, 18 Jun 2026 11:41:32 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ursulin.net; s=google; t=1781808090; x=1782412890; darn=vger.kernel.org; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=hFv3GlUYs5wNN+O537Q1dHtRqP7co1Grb9v+N2l5i1U=; b=b48xVDeB/OKnPmi/Oe0ZtqzqL3EqxYUFQs8fDlja1maz0r9AioiDKQdPxPQ+dOfasM gujDHJLoyHLCu3zu2FG4vI/GVQFoZsrH+GpLPaomZoWg5P5iYs7DBCzSMeTgJNNS0GU1 M3TTtpGP50aGt7m8vBYdX0gaj//BXwHD4Cq9Tvc7ylUWZ5D2hUfng1rMliRE/jZRK/Qb xDE0jBkHjExoBK5LAQHe7w8T72G9Fb2hpHRRp8H5I6S62o5Oxix+3ifl6v7sHbMNTvxL WCndYnrKC7c+H5/vfFHHuwUIdnMHG4MiPZHYkaVgk66P8EWgqWGh4gdc9QC2GkE5x83Z i3Qw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1781808090; x=1782412890; h=content-transfer-encoding:in-reply-to:from:content-language :references:cc:to:subject:user-agent:mime-version:date:message-id :x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=hFv3GlUYs5wNN+O537Q1dHtRqP7co1Grb9v+N2l5i1U=; b=rqTJsgc/6fK4HKM4gSCBcyKTF4a8tP2K80LYSuXpCXLtqKnmNO1tthsggspMzl5342 i8LWeNsNQt5+iRAOUm82IJUEylxSdfwAb8wTHU6jKePoQ6xGPG7Zyhz0W1rwRLWcTrpf vmSuFt4RDZFG7HFAfGAKcIApAriX8eyeANwQFF7HSrCQV4p0YaLj31quMolA3Rw4nZ4U SHaYvhkmz6LkshbHH4fuGuWRV2iUjqGTP3G9KReTzCwUuhPzMNB65vBhZdn5MauEsqlz nfXnoNhfjaRgbOgSc9XwwRPyHgAdPl127hMp11CKt9l3wSLrFNbATNmN0lADHXE6nEiX 04qQ== X-Forwarded-Encrypted: i=1; AFNElJ9iVjSeJe0WbmM2ZHrFWWRKClOyD0endSNZ1ikJX0HKCXkia1ddpG2bGfF9wAMPTXxsBMWH1uJSroj9/E0=@vger.kernel.org X-Gm-Message-State: AOJu0YzWSxALyxi1A7ah6QIYRggiQwwx/wbssNkRQ0OflhcodtMosrk4 4j/Pf6g7FyeYsiSLfSPv7kAbLpEgkLkn6+5x4kJ60rXXuYhhivkEg+3azdED5r16RlA= X-Gm-Gg: AfdE7cn5Yb1kKkI0UPUEbSz2/d31Y7Jm+aUUgASpZSQ7aKpzNQ0JVqTlAtnMuKe4L3E AwPG1zsWAEPWE0L059WyWJv6Q85y5ubQrfnjlNR6VFX7fRqZiM9zf3KreyWtCbkyfGtwgFR4DgB ywZUss8NBb7Bi80bQ0uw7NcwSgVOkkMhMEm3T4KiMu97941+W0cF+QDYwlitkCTAB+0z4J11T+U jlUl1MJLKbBpCsbAQ6tM0ThQoyrJbYwB1NQFBVqHzQ/lTs15u2FXNLjeZ2zQ3AWRYE73krn5nJ+ 9DzMIY5mlN7P9jSPOSW+vSliBFgS8Jiw/RMSYIINHPJtLzhyC8cHw6wkARu+8VQTjB9VQdMWYXT +N8zIiH7TJbvHjEdkQEEZRvS99CxFXzczRS4pqQMvAQ2gO24x+M3iIdN5VKcomNlD9BPu1hqQKT u50Ef6zpO7dbbkvSAhi+dZzwFwJhlPHmgEww== X-Received: by 2002:a05:600c:1c1c:b0:492:1e36:552b with SMTP id 5b1f17b1804b1-49240e7f307mr1905325e9.36.1781808089941; Thu, 18 Jun 2026 11:41:29 -0700 (PDT) Received: from [172.16.30.123] ([37.209.163.134]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-4650b76e7c9sm865703f8f.21.2026.06.18.11.41.28 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 18 Jun 2026 11:41:29 -0700 (PDT) Message-ID: <1544040a-578f-41b0-9660-5a6f470f031f@ursulin.net> Date: Thu, 18 Jun 2026 20:41:28 +0200 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] drm/ttm: rename ttm_place::fpfn/lpfn to param1/param2 To: Arunpravin Paneer Selvam , christian.koenig@amd.com, dri-devel@lists.freedesktop.org, intel-gfx@lists.freedesktop.org, intel-xe@lists.freedesktop.org, amd-gfx@lists.freedesktop.org, nouveau@lists.freedesktop.org, linux-kernel@vger.kernel.org Cc: alexander.deucher@amd.com, =?UTF-8?Q?Thomas_Hellstr=C3=B6m?= , Matthew Auld , Matthew Brost References: <20260618133908.2761908-1-Arunpravin.PaneerSelvam@amd.com> Content-Language: en-GB From: Tvrtko Ursulin In-Reply-To: <20260618133908.2761908-1-Arunpravin.PaneerSelvam@amd.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 18/06/2026 15:39, Arunpravin Paneer Selvam wrote: > The fpfn/lpfn fields in struct ttm_place were named after page frame > numbers, but they are really just placement parameters passed to the > backend resource manager. Rename them to the generic param1/param2 > and document that their interpretation is backend-defined. The VRAM > range manager continues to treat them as the first and last valid > page frame number, so behaviour is unchanged. > > This decouples the API from PFN/range-specific semantics so that > these fields can be used more flexibly in the future (e.g., > mask-based or segment-aware placement constraints). No functional > change. > > Suggested-by: Christian König > Cc: Christian König > Cc: Thomas Hellström > Cc: Matthew Auld > Cc: Matthew Brost > Signed-off-by: Arunpravin Paneer Selvam > --- > drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.c | 16 +++--- > drivers/gpu/drm/amd/amdgpu/amdgpu_gmc.h | 4 +- > drivers/gpu/drm/amd/amdgpu/amdgpu_gtt_mgr.c | 8 +-- > drivers/gpu/drm/amd/amdgpu/amdgpu_object.c | 46 +++++++-------- > drivers/gpu/drm/amd/amdgpu/amdgpu_ttm.c | 24 ++++---- > drivers/gpu/drm/amd/amdgpu/amdgpu_uvd.c | 4 +- > drivers/gpu/drm/amd/amdgpu/amdgpu_vce.c | 16 +++--- > drivers/gpu/drm/amd/amdgpu/amdgpu_vm.c | 6 +- > drivers/gpu/drm/amd/amdgpu/amdgpu_vram_mgr.c | 32 +++++------ > drivers/gpu/drm/amd/amdkfd/kfd_svm.c | 2 +- > .../gpu/drm/amd/ras/ras_mgr/amdgpu_ras_cmd.c | 2 +- > drivers/gpu/drm/drm_gem_vram_helper.c | 4 +- > drivers/gpu/drm/i915/gem/i915_gem_ttm.c | 18 +++--- > drivers/gpu/drm/i915/i915_ttm_buddy_manager.c | 56 +++++++++---------- > drivers/gpu/drm/i915/intel_region_ttm.c | 14 ++--- > drivers/gpu/drm/loongson/lsdc_ttm.c | 4 +- > drivers/gpu/drm/nouveau/nouveau_bo.c | 22 ++++---- > drivers/gpu/drm/nouveau/nouveau_mem.c | 8 +-- > drivers/gpu/drm/qxl/qxl_object.c | 4 +- > drivers/gpu/drm/qxl/qxl_ttm.c | 4 +- > drivers/gpu/drm/radeon/radeon_object.c | 28 +++++----- > drivers/gpu/drm/radeon/radeon_ttm.c | 18 +++--- > drivers/gpu/drm/radeon/radeon_uvd.c | 8 +-- > drivers/gpu/drm/ttm/tests/ttm_kunit_helpers.c | 16 +++--- > drivers/gpu/drm/ttm/tests/ttm_mock_manager.c | 8 +-- > drivers/gpu/drm/ttm/ttm_bo_util.c | 4 +- > drivers/gpu/drm/ttm/ttm_range_manager.c | 18 +++--- > drivers/gpu/drm/vmwgfx/vmwgfx_bo.c | 30 +++++----- > drivers/gpu/drm/vmwgfx/vmwgfx_ttm_buffer.c | 8 +-- > drivers/gpu/drm/xe/xe_bo.c | 24 ++++---- > drivers/gpu/drm/xe/xe_ttm_vram_mgr.c | 40 ++++++------- > include/drm/ttm/ttm_placement.h | 15 +++-- > 32 files changed, 259 insertions(+), 252 deletions(-) > if (unlikely(ret)) { > @@ -124,8 +124,8 @@ static bool ttm_range_man_intersects(struct ttm_resource_manager *man, > u32 num_pages = PFN_UP(size); > > /* Don't evict BOs outside of the requested placement range */ > - if (place->fpfn >= (node->start + num_pages) || > - (place->lpfn && place->lpfn <= node->start)) > + if (place->param1 >= (node->start + num_pages) || > + (place->param2 && place->param2 <= node->start)) > return false; > > return true; > @@ -139,8 +139,8 @@ static bool ttm_range_man_compatible(struct ttm_resource_manager *man, > struct drm_mm_node *node = &to_ttm_range_mgr_node(res)->mm_nodes[0]; > u32 num_pages = PFN_UP(size); > > - if (node->start < place->fpfn || > - (place->lpfn && (node->start + num_pages) > place->lpfn)) > + if (node->start < place->param1 || > + (place->param2 && (node->start + num_pages) > place->param2)) > return false; > Not very readable ie. good for ease of maintenance - how about an union? Would also avoid having to touch all the drivers. Something like: union {     struct {         u64 fpfn;         u64 lpfn;     };     u64 drvparam[2]; }; Regards, Tvrtko > diff --git a/include/drm/ttm/ttm_placement.h b/include/drm/ttm/ttm_placement.h > index ab2639e42c54..2c38674be102 100644 > --- a/include/drm/ttm/ttm_placement.h > +++ b/include/drm/ttm/ttm_placement.h > @@ -73,16 +73,23 @@ > /** > * struct ttm_place > * > - * @fpfn: first valid page frame number to put the object > - * @lpfn: last valid page frame number to put the object > + * @param1: generic placement parameter, interpretation depends on the > + * backend resource manager. For range-based managers (e.g. the > + * VRAM range manager, the buddy managers in amdgpu/i915/xe and > + * the TTM range manager) this is the start of the allowed range, > + * typically expressed as a page frame number. > + * @param2: generic placement parameter, interpretation depends on the > + * backend resource manager. For range-based managers this is the > + * exclusive end of the allowed range (a value of 0 means > + * "no upper bound"). > * @mem_type: One of TTM_PL_* where the resource should be allocated from. > * @flags: memory domain and caching flags for the object > * > * Structure indicating a possible place to put an object. > */ > struct ttm_place { > - uint64_t fpfn; > - uint64_t lpfn; > + uint64_t param1; > + uint64_t param2; > uint32_t mem_type; > uint32_t flags; > }; > >