From nobody Tue Oct 11 12:10:10 2022 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4Mmvk02HdNz4fbpm; Tue, 11 Oct 2022 12:10:16 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Mmvk01gBVz3YhM; Tue, 11 Oct 2022 12:10:16 +0000 (UTC) (envelope-from bz@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1665490216; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=36S59VKaAK2JMAp2sI8kTqXMHK3QZL79yOMNmA5XROI=; b=NoUkL93vuU3jS+NEOIw3B8/NRB9s1fuHo1ncDVsRJxLgeTiKpwzmGPbksPqyhAWMQQ29DY E7HJYdg3rzA1CsdLisdD6xSA1CjhwkEytxoz/Yp+zW/Kl4KyuGF96QocUjI1vsZkohRQLP ODS6fGeiFdh7KOHBUJm076aUdmLrt0nFeGHdW2icXNpIfEktQ8VtZmXJJMRBlQCyj8OCAm 1DWQQ5Wxd2wSxw+bgV6glIJTFIk7/+XV6aOyFuFCCEha0IGeEBcdsl/WmLT81XG5aMzpAR pR++uLnZFnJ6tdzuYHjKjN9MGKBlwZNv2eEhYJGBgnBrlUG373e9pu3/4fPl3g== Received: from mx1.sbone.de (mx1.sbone.de [IPv6:2a01:4f8:13b:39f::9f:25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mx1.sbone.de", Issuer "SBone.DE" (not verified)) (Authenticated sender: bz/mail) by smtp.freebsd.org (Postfix) with ESMTPSA id 4Mmvjz67yZzydy; Tue, 11 Oct 2022 12:10:15 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mail.sbone.de (mail.sbone.de [IPv6:fde9:577b:c1a9:4902:0:7404:2:1025]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mx1.sbone.de (Postfix) with ESMTPS id 9505B8D4A142; Tue, 11 Oct 2022 12:10:13 +0000 (UTC) Received: from content-filter.t4-02.sbone.de (content-filter.t4-02.sbone.de [IPv6:fde9:577b:c1a9:4902:0:7404:2:2742]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPS id D0DB65C3A831; Tue, 11 Oct 2022 12:10:12 +0000 (UTC) X-Virus-Scanned: amavisd-new at sbone.de Received: from mail.sbone.de ([IPv6:fde9:577b:c1a9:4902:0:7404:2:1025]) by content-filter.t4-02.sbone.de (content-filter.t4-02.sbone.de [IPv6:fde9:577b:c1a9:4902:0:7404:2:2742]) (amavisd-new, port 10024) with ESMTP id aiFsPhzPAaae; Tue, 11 Oct 2022 12:10:11 +0000 (UTC) Received: from strong-em0.sbone.de (strong-em0.sbone.de [IPv6:fde9:577b:c1a9:4902:8e16:45ff:fe98:8635]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPSA id EA5175C3A82F; Tue, 11 Oct 2022 12:10:10 +0000 (UTC) Date: Tue, 11 Oct 2022 12:10:10 +0000 (UTC) From: "Bjoern A. Zeeb" To: Jessica Clarke cc: "src-committers@freebsd.org" , "dev-commits-src-all@freebsd.org" , "dev-commits-src-main@freebsd.org" Subject: Re: git: 99e6980fcf5e - main - device_get_property: add a HANDLE case In-Reply-To: <9C2F0D00-829F-4EF6-9F27-AC4242C60A3A@freebsd.org> Message-ID: References: <202210092153.299LriCA024248@gitrepo.freebsd.org> <9C2F0D00-829F-4EF6-9F27-AC4242C60A3A@freebsd.org> X-OpenPGP-Key-Id: 0x14003F198FEFA3E77207EE8D2B58B8F83CCF1842 List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: multipart/mixed; boundary="1098556516-148085405-1665490211=:2458" ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1665490216; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: in-reply-to:in-reply-to:references:references; bh=36S59VKaAK2JMAp2sI8kTqXMHK3QZL79yOMNmA5XROI=; b=G1xhgI+iY4Pf1sXF8LTzEBhqttoukGKtFzDC9TKW/nrpKYG+wkBM0X297fxPfm/CtBqIM2 ypRBWM/bwi8aFwGeNGUE3p747Wqr3UpdlQuYU64oIk5Uxb1LzHyJG205ytadVtQEAupedt 6TE2m+61V4ffHvYcl9PsINZkq5KnSEj89bXKVneCI6iv8apw1g52068NATh8IcSGByKcYx rByf9BjFSEbJj0M/wBYq1hcaQwzlGWfNJnTJVBMMYBFAzRKmmYtbf2xO/uwmlGgGCYcCua QHdxL7jd33CgbyvgJ9KESf8J09njIaKfDNl8vd48bSq5K0SKzI1JcprzND4i1g== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1665490216; a=rsa-sha256; cv=none; b=Sfgyt+z79B0bEuDeqUWnR9iu7PPxROF8aF7RMOpDfOYpVaOdLtJVBPeiZkvClcPT5xkmr9 7xivV3hCzVeEARzs3uAoDeHCNf1LJb8zrwj7a/EdqNgr/kEIkZUMWMCFNLe1jXMZGYmTW2 3lAOFSPOBLSHwXxN0U/GETp3QBGHKEzE3u7RU2FMxW88GsW7qEsUW6n/TCGKZcs8qlbTmN s8WOZOLqQvGoThCDhEnnBQ4GC/vXASj1aKEV66c3ePQT+h5bnl7/mFGkcoWKOEJieTpnmq 0crUhv3+UFGt7m6zpURmOQEtjiEVeYi2o7BVujSfehLyx5MGJtp0/MbciHwAYQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N This message is in MIME format. The first part should be readable text, while the remaining parts are likely unreadable without MIME-aware tools. --1098556516-148085405-1665490211=:2458 Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8BIT On Tue, 11 Oct 2022, Jessica Clarke wrote: > On 9 Oct 2022, at 22:53, Bjoern A. Zeeb wrote: >> >> The branch main has been updated by bz: >> >> URL: https://cgit.FreeBSD.org/src/commit/?id=99e6980fcf5e12654c3e89b97b774de807d740a4 >> >> commit 99e6980fcf5e12654c3e89b97b774de807d740a4 >> Author: Bjoern A. Zeeb >> AuthorDate: 2022-09-29 12:41:58 +0000 >> Commit: Bjoern A. Zeeb >> CommitDate: 2022-10-09 21:51:25 +0000 >> >> device_get_property: add a HANDLE case >> >> This will resolve a reference and return the appropriate handle, a node >> on the simplebus or an ACPI_HANDLE for ACPI. For now we do not try to >> further abstract the return type. > > How’s this supposed to be used though? phandle_t is a uint32_t and > ACPI_HANDLE is a void *, which are not the same size (aside from > ILP32), let alone the same type. The existing interface lets you not > care about the bus because the type corresponds to what you ask for > (string or fixed-width integer), but this totally breaks that. This > really should be abstracting the type as well, presumably to a > uintptr_t. While that is all true, basic types are always easier to handle :) All known use cases so far have entirely different code paths in ACPI and FDT as they are "described" differently and there would be more work to be done to harmonize these cases. Making it a uintptr_t wouldn't solve that problem and that later code has to deal with the appropriate type still and call non-bus-bus-specific functions (e.g., acpi_get_device vs. OF_device_from_xref) with the appropriate type and I'd almost vote for extending this to return a device instead rather than a handle, but that may be highly dependent on the use case I am aware of. In earlier code I used the DEVICE_PROP_ANY with the bus-sized encoded handle. Now we get at least proper size checks on each bus, and avoid putting ACPI-internal code into drivers and avoid code duplication there and we have a way to track the use-cases. mw@ had initially asked for this to be broken out of another review and said he's working on more code (I haven't seen) which will hopefully benefit from this and I assume once we get there and some more bus-abstractions may be dealt with, we may be able to refine this. Hence the "For now ..." in the commit message. I'll highly likely defer the MFC for longer than specified for those reasons but I like to have the email to not forget about it. /bz -- Bjoern A. Zeeb r15:7 --1098556516-148085405-1665490211=:2458--