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 D8B18C433EF for ; Mon, 11 Oct 2021 16:09:42 +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 BC6EB60EB6 for ; Mon, 11 Oct 2021 16:09:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org BC6EB60EB6 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.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 D3AF082EA5; Mon, 11 Oct 2021 18:09:37 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; unprotected) header.d=chromium.org header.i=@chromium.org header.b="Rb08/14w"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 6B16583246; Mon, 11 Oct 2021 18:09:35 +0200 (CEST) Received: from mail-ua1-x932.google.com (mail-ua1-x932.google.com [IPv6:2607:f8b0:4864:20::932]) (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 AA77A80644 for ; Mon, 11 Oct 2021 18:09:31 +0200 (CEST) Authentication-Results: phobos.denx.de; dmarc=pass (p=none dis=none) header.from=chromium.org Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=sjg@google.com Received: by mail-ua1-x932.google.com with SMTP id e7so13768379ual.11 for ; Mon, 11 Oct 2021 09:09:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=/rFvRijW5OXReVlVbZFU4gFbdnhH/+IxYtA93M/3FpQ=; b=Rb08/14weRa3MFVlcxrnRLMNQacpjU9BO9amKepH3sgN3tlcJoZnsjtocsXDykQfXQ nZlOzxEW4t2KKvSy6VkTK7cNW+hEEaLv0k9rbW84bH66JZa27Q+2gKiaf4ya0TF/QuF/ voD1IRQ2kj5R9FNUCXgxUv7VyvWVq+jS7qXBQ= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=/rFvRijW5OXReVlVbZFU4gFbdnhH/+IxYtA93M/3FpQ=; b=WjuK5V7bAPeYJ2oRQ32cVK36ahTi4CIe/PJDrCo8/cuCJ26zmRyz7WkXn1IuYjJMxV iZPA/kELaALbt7+07PdVcwnlqKQYjUh2AooEPoX681NtxQiwo1+8tBZmfSNsBXXqOHak KgNNOwTkn33a51cxWKUvUWqDALUtZBK/R1Lliq1l2m8fsxrURxzHeBCFAJ6qMVn2sEGP jmprKWge0P99mLAJB1R+soZbDOkvSPoCluyPt7JdStxwdMi2n2oIrzkHz+2GX/86fwey neun+FSxZIKQrvM31LqaRcr8+0ktYDEXG0ZQdYno472/3s3eeRwLryQ/sZfjHBoViP4o ugUg== X-Gm-Message-State: AOAM533uTO3rsbpXKdjjXHr1fP6zWunO/5rMGEairCz2yT/bWjKDPmA6 YBYN414lPINdhCfo9dxf454s8VRX5LsYOFeGmtAWsw== X-Google-Smtp-Source: ABdhPJx6INqJur8NFYT1HBJd/znBQKpH66eI66nCPTYcb0Gd3QY/gAa85Vfo323XZvYMfcgpiddJmKKKVqsNVKetFw4= X-Received: by 2002:a67:e998:: with SMTP id b24mr959192vso.58.1633968570159; Mon, 11 Oct 2021 09:09:30 -0700 (PDT) MIME-Version: 1.0 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> In-Reply-To: <6c6bec49-dbfd-c352-be21-4319d24db32c@gmx.de> From: Simon Glass Date: Mon, 11 Oct 2021 10:09:19 -0600 Message-ID: Subject: Re: [RFC 12/22] dm: add a hidden link to efi object To: Heinrich Schuchardt Cc: AKASHI Takahiro , Alex Graf , Ilias Apalodimas , U-Boot Mailing List Content-Type: text/plain; charset="UTF-8" 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 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, 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