From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 75341C54F54 for ; Tue, 28 Jul 2026 17:01:21 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id CFD5E10E5E5; Tue, 28 Jul 2026 17:01:20 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=kernel.org header.i=@kernel.org header.b="BlspHBOW"; dkim-atps=neutral Received: from sea.source.kernel.org (sea.source.kernel.org [172.234.252.31]) by gabe.freedesktop.org (Postfix) with ESMTPS id 7910910E5FE for ; Tue, 28 Jul 2026 17:01:20 +0000 (UTC) Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) by sea.source.kernel.org (Postfix) with ESMTP id 5489440187; Tue, 28 Jul 2026 17:01:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id C524D1F000E9; Tue, 28 Jul 2026 17:01:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1785258079; bh=MvOyPm0OvxaBHSilVu7AshLW8XnoVziVrisixs/IqO8=; h=Date:Subject:Cc:To:From:References:In-Reply-To; b=BlspHBOWZYLezf3OfdCf9nATqVDX9JgadDA+zhTJ+rvVUXVhS1QHNTxehILUmMgjj A8djzFY3yhwu7mT0liyuqBs9QW6/2rrWJc8S7c/V6YaWx+W/bOAWjD+GGD1KEsz4/y ADKWPmf8+li8WTshvYsnEud4PSTBToaNYGp4ODCf1xogVtrcjnJe0WK2rH3NaA/huB JtulGZ3UJ8oVdxZlgQ5t8gpQ8Tk3YyJCkUK6u8QIkEJz8roAITzDE9BvnXLBHdT3Fl uvl9365qrvzZHNxqYDTRIMDH8gh/ccEfWwqszPSjMo1wcrIOwMXXocGHSV00929ZGv e5a0/BAYSUniQ== Mime-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset=UTF-8 Date: Tue, 28 Jul 2026 19:01:13 +0200 Message-Id: Subject: Re: [PATCH 08/10] gpu: nova-core: use projection for PFALCON and PFALCON2 registers Cc: "Gary Guo" , "Alice Ryhl" , "Daniel Almeida" , "Miguel Ojeda" , "Boqun Feng" , =?utf-8?q?Bj=C3=B6rn_Roy_Baron?= , "Benno Lossin" , "Andreas Hindborg" , "Trevor Gross" , "Tamir Duberstein" , =?utf-8?q?Onur_=C3=96zkan?= , "David Airlie" , "Simona Vetter" , "Bjorn Helgaas" , =?utf-8?q?Krzysztof_Wilczy=C5=84ski?= , , , , , , To: "Alexandre Courbot" From: "Danilo Krummrich" References: <20260721-typed_register-v1-0-452d72b60262@garyguo.net> <20260721-typed_register-v1-8-452d72b60262@garyguo.net> In-Reply-To: X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" On Tue Jul 28, 2026 at 5:09 PM CEST, Alexandre Courbot wrote: > Great, keeping this commit purely mechanical sounds good to me if you > prefer it that way (although one can argue that the refactor itself is > also mostly mechanical as the end result shouldn't be more complex). I don't really see much value in this intermediate change; it's not really = less invasive than to do the refactor I think, so let's do that. >>> And I suspect that once this is generalized, `Falcon` won't even need t= o >>> store a reference to the `Bar0` (and potentially poke the I/O of other >>> engines) anymore. >>> >>> Actually I would like to push that even further and replace the >>> `pfalcon()` and `pfalcon2()` trait methods by associated constants used >>> to construct the projected view in `Falcon::new`, since the projections >>> are all constructed the same way, but doing so requires >>> `generic_const_exprs`. :/ Yes, that'd be best. >>> We could make it work by moving the `OFFSET` generic argument of >>> `subregion` into a regular argument and enforcing its invariants using >>> `build_assert!`, but that would require `subregion` to be >>> `#[inline(always)]`. I don't know if there is another trick we can use, >>> if not otherwise I guess the trait methods are ok, especially if they >>> are only called once in the constructor. I think this is fine if, as Alex says as well, we expose it as another vari= ant of subregion(). (In general, I'd like to avoid introducing more build_asser= t!() if there's not much value though.) In the nova-core case it would be a specific workaround for generic_const_e= xprs not being stable, so a separate subregion() variant that is specifically targeted at this seems fine. >> This was definitely one option that I have considered, however as `NEW_S= IZE` >> still needs to be generic so we're not entirely turbofish-free. But if m= aking >> `offset` become an effective const parameter helps nova impl, it might m= ake >> sense to use `build_assert!` for this. As mentioned I'd like to avoid additional build_assert!() if not needed, th= e turbofish doesn't hurt too much here. > Maybe we can have another variant of `subregion` that operates that way, > but your call. I don't see any obvious flaw with the current > implementation, it's just that the `FalconEngine` methods should not be > useful outside of the constructor eventually, so it seems a bit > superfluous to have them visible to the whole crate. I may have a slight preference for a separate subregion() variant for the purpose of working around generic_const_exprs, as it probably is a bit clos= er to the final solution, but trait methods are fine with me too.