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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 82347C433F5 for ; Tue, 12 Oct 2021 02:09:32 +0000 (UTC) Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id A96D560EE9 for ; Tue, 12 Oct 2021 02:09:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org A96D560EE9 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 76AFE834C1; Tue, 12 Oct 2021 04:09:28 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="RvdO6LYB"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 3809083704; Tue, 12 Oct 2021 04:09:26 +0200 (CEST) Received: from mail-pg1-x52a.google.com (mail-pg1-x52a.google.com [IPv6:2607:f8b0:4864:20::52a]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 37D3783473 for ; Tue, 12 Oct 2021 04:09:18 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=takahiro.akashi@linaro.org Received: by mail-pg1-x52a.google.com with SMTP id m21so12421442pgu.13 for ; Mon, 11 Oct 2021 19:09:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:mail-followup-to:references :mime-version:content-disposition:in-reply-to; bh=NEbQ+c21xAAYxb+V8Wr+dKSyhrcRL9dDG/BECzwJ5so=; b=RvdO6LYBzutLbughUKAV3qzruLHZj+LfEzq+HQRltl1asjxFxvjvNb+PE88YixJEBY HkuoJTa9gYOPzVPJBvuzrNGrw7V4n0fB2Q/aUjn1Dut3tdyCW0hYrqO755c7kvZnE5z8 3AQdDsYn+muXHTz5peLTlV31mcu/irx5h9vNUNpcBI46RIioplAWlT0YfwwgppMPvMdN vFHtkgSBo2k+DNL5Uw4ebkrB2SaFCAWDckYvWi1nnvXHv31qdxkW6igBcM+YPL4s9jxh B7tcjkNnyplc3eeqOdIXzMi1iIh7WKUgUz7VXj5+5dwWFaI73Gy3tGKLFYVzE/VVKSpI hbQA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :in-reply-to; bh=NEbQ+c21xAAYxb+V8Wr+dKSyhrcRL9dDG/BECzwJ5so=; b=eCzKHZOoZMO71YZdhEujJ6dEixN7HRoVoaqA68If3i/5t4dCQzU1PvcP3nNNM7KvZS AG+DQG5PJf5LEpfm97g6wEtcp7s7TQols/fP3B0oKpveQtJ/97BpqUOekVmPi60EkNJD 0i8LckmYf3qYH2odQDRtQT+Ns01fRxPVJ4nQCRPRdm50YhAZWb9AibYSdOdMh2ayV8oo K7PBBAMAvuJjTF3melBmZ++3HuFcfYMNT+/chjXxEhT9AtOD6HNFnsECR8Dvq8fHmMCe cCLW+xa2sSa+mICJPf5h47gkD10PmhMsn7z80tm+o5d98nxHJxd2cUx30HiwYh42jRQS Mrkg== X-Gm-Message-State: AOAM532HXavff3zE+kR1T4jUjCT08kFSEDXauXQ2TRU4Ouo7Mu9N4Zrk nZ0LZy7wrz+9hoR7fJL4JmWFnQ== X-Google-Smtp-Source: ABdhPJxR61Dbnsbv9i/wHRdeWGGLgc+Bsl+/vd6PfaTVDM53GAjvT+HCA5k4LMjdSetom46lNQRMZA== X-Received: by 2002:a62:3387:0:b0:44d:7ec:906a with SMTP id z129-20020a623387000000b0044d07ec906amr13622048pfz.69.1634004555807; Mon, 11 Oct 2021 19:09:15 -0700 (PDT) Received: from laputa ([2400:4050:c3e1:100:dbc:a6fe:8374:7fdb]) by smtp.gmail.com with ESMTPSA id w19sm724929pjy.9.2021.10.11.19.09.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 11 Oct 2021 19:09:15 -0700 (PDT) Date: Tue, 12 Oct 2021 11:09:11 +0900 From: AKASHI Takahiro To: Simon Glass Cc: Heinrich Schuchardt , Alex Graf , Ilias Apalodimas , U-Boot Mailing List Subject: Re: [RFC 12/22] dm: add a hidden link to efi object Message-ID: <20211012020911.GD38222@laputa> Mail-Followup-To: AKASHI Takahiro , Simon Glass , Heinrich Schuchardt , Alex Graf , Ilias Apalodimas , U-Boot Mailing List References: <20211001050228.55183-1-takahiro.akashi@linaro.org> <20211001050228.55183-24-takahiro.akashi@linaro.org> <20211011064336.GH44356@laputa> <6c6bec49-dbfd-c352-be21-4319d24db32c@gmx.de> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.103.2 at phobos.denx.de X-Virus-Status: Clean On Mon, Oct 11, 2021 at 10:09:19AM -0600, Simon Glass wrote: > Hi Heinrich, > > On Mon, 11 Oct 2021 at 09:31, Heinrich Schuchardt wrote: > > > > > > > > On 10/11/21 16:54, Simon Glass wrote: > > > Hi Takahiro, > > > > > > On Mon, 11 Oct 2021 at 00:43, AKASHI Takahiro > > > wrote: > > >> > > >> Simon, > > >> > > >> On Sun, Oct 10, 2021 at 08:14:18AM -0600, Simon Glass wrote: > > >>> Hi Takahiro, > > >>> > > >>> On Thu, 30 Sept 2021 at 23:04, AKASHI Takahiro > > >>> wrote: > > >>>> > > >>>> This member field in udevice will be used to dereference from udevice > > >>>> to efi_object (or efi_handle). > > >>>> > > >>>> Signed-off-by: AKASHI Takahiro > > >>>> --- > > >>>> include/dm/device.h | 4 ++++ > > >>>> 1 file changed, 4 insertions(+) > > >>> > > >>> I think this should be generalised. > > >>> > > >>> Can we add a simple API for attaching things to devices? Something like: > > >> > > >> Ok. > > >> > > >> > > >>> config DM_TAG > > >>> bool "Support tags attached to devices" > > >>> > > >>> enum dm_tag_t { > > >>> DM_TAG_EFI = 0, > > >>> > > >>> DM_TAG_COUNT, > > >>> }; > > >>> > > >>> ret = dev_tag_set_ptr(dev, DM_TAG_EFI, ptr); > > >>> > > >>> void *ptr = dev_tag_get_ptr(dev, DM_TAG_EFI); > > >>> > > >>> ulong val = dev_tag_get_val(dev, DM_TAG_EFI); > > >>> > > >>> Under the hood I think for now we could have a simple list of tags for > > >>> all of DM: > > >>> > > >>> struct dmtag_node { > > >>> struct list_head sibling; > > >>> struct udevice *dev; > > >>> enum dm_tag_t tag; > > >>> union { > > >>> void *ptr; > > >>> ulong val; > > >>> }; > > >>> }; > > >> > > >> Just let me make sure; Do you intend that we have a *single* list of tags > > >> in the system instead of maintaining a list *per udevice*? > > > > > > Yes I would prefer not to have a list per udevice, although the API > > > could be adjusted to iterate through all tags for a particular > > > udevice, if that is needed (dev_tag_first...() dev_tag_next...(). > > > > There will never be more than one UEFI handle for one udevice. > > We need a single field that points to the the handle if such a handle > > exists. But there will be devices for which UEFI protocols don't exist > > and where we need no handle. In this case the value can be NULL. > > > > Why should we complicate the picture with a list of tags? > > Let's not talk about complexity while we are discussing UEFI :-) > > There are other cases where we need to add info to a device. We cover > almost all the cases with the uclass-private, plat and priv data > attached to each device. But in some cases that is not enough, While I'm not sure whether it is "not enough", I used to think of using 'priv_auto' (or per_device_auto of UCLASS) to hold a pointer to efi_object, but we might see a conflicting situation in the future where some driver may also want to use 'priv_auto' for their own purpose. That is why I added an extra member to udevice. # The real benefit might be to keep the size of udevice unchanged? -Takahiro Akashi > as with > EFI. I have hit this before in a few other places but have tried to > work around it rather than extending driver model and adding to the > already-large struct udevice. But I think we are at the end of the > road on that. > > I'd also like to look at how much (for example) uclass-plat data is > used for devices, in case it would be more efficient to move it to a > tag model. > > I should also point out you are talking about the implementation > rather than the API. We can always change the impl later, so long as > we have a suitable API. > > > > > > > Looking at some of your other patches I think you might need to > > > support multiple tags for EFI, if there are different things. But > > > perhaps a list is necesary. > > > > > >> > > >> -Takahiro Akashi > > >> > > >> > > >>> This can be useful in other situations, for example I think we need to > > >>> be able to send an event when a device is probed so that other devices > > >>> (with tags attached) can take action. But in any case, it makes the > > >>> API separate from the data structure, so aids refactoring later. > > >>> > > >>> If we find that this is slow we can change the impl, but I doubt it > > >>> will matter fornow. > > >>> > > Regards, > Simon