All of lore.kernel.org
 help / color / mirror / Atom feed
From: AKASHI Takahiro <takahiro.akashi@linaro.org>
To: Ilias Apalodimas <ilias.apalodimas@linaro.org>
Cc: Heinrich Schuchardt <xypron.glpk@gmx.de>,
	u-boot@lists.denx.de, agraf@csgraf.de, sjg@chromium.org
Subject: Re: [resent RFC 00/22] efi_loader: more tightly integrate UEFI disks to device model
Date: Tue, 5 Oct 2021 11:27:37 +0900	[thread overview]
Message-ID: <20211005022737.GE39521@laputa> (raw)
In-Reply-To: <YVtC5/SLwY6/kZL1@enceladus>

On Mon, Oct 04, 2021 at 09:07:35PM +0300, Ilias Apalodimas wrote:
> On Mon, Oct 04, 2021 at 04:47:53PM +0200, Heinrich Schuchardt wrote:
> > 
> > 
> > > 
> 
> [...]
> 
> > > My approach in this RFC:
> > > ========================
> > > Due to functional differences in semantics, it would be difficult
> > > to identify "udevice" structure as a handle in UEFI world. Instead, we will
> > > have to somehow maintain a relationship between a udevice and a handle.
> > > 
> > > 1-1. add a dedicated uclass, UCLASS_PARTITION, for partitions
> > >     Currently, the uclass for paritions is not a UCLASS_BLK.
> > >     It can be possible to define partitions as UCLASS_BLK
> > >     (with IF_TYPE_PARTION?), but
> > >     I'm afraid that it may introduce some chaos since udevice(UCLASS_BLK)
> > >     is tightly coupled with 'struct blk_desc' data which is still used
> > >     as a "structure to a whole disk" in a lot of interfaces.
> > >     (I hope that you understand what it means.)
> 
> I think it makes more sense the way it's currently defined.  I don;t see a
> point in hiding partitions within UCLASS_BLK

Yeah. But even with my UCLASS_PARTITION, it provides block-level io's
through blk_read/blk_write() APIs.
So someone may wonder why two different type of udevices have the same
interfaces :)

> > > 
> > >     In DM tree, a UCLASS_PARTITON instance has a UCLASS_BLK parent:
> > >     For instance,
> > >         UCLASS_SCSI  --- UCLASS_BLK       --- UCLASS_PARTITION
> > > 			 (IF_TYPE_SCSI)        |
> > >                            +- struct blk_desc   +- struct disk_part
> > > 			  +- scsi_blk_ops      +- blk_part_ops
> > > 
> > > 1-2. create partition udevices in the context of device_probe()
> > >     part_init() is already called in blk_post_probe(). See the commit
> > >     d0851c893706 ("blk: Call part_init() in the post_probe() method").
> > >     Why not enumelate partitions as well in there.
> > > 
> > > 2. add new block access interfaces, which takes "udevice" as a target device,
> > >     in U-Boot and use those functions to implement efi_disk operations
> > >     (i.e. EFI_BLOCK_IO_PROTOCOL).
> > > 
> > > 3-1. maintain a bi-directional link by adding
> > >     - a UEFI handle pointer in "struct udevice"
> > >     - a udevice pointer in UEFI handle (in fact, in "struct efi_disk_obj")
> > 
> > An EFI application can create handles with any combination of protocols,
> > e.g. a handle with both the block IO protocol and the simple network
> > protocol. This means that a udevice cannot be assigned to a handle
> > created by an EFI application.
> > 
> > When the EFI application calls ConnectController() for the handle,
> > U-Boot can create child controllers. If U-Boot creates a udevice for
> > such a child controller, it has to store the udevice pointer.
> > lib/efi_driver/efi_block_device.c uses a private data section but you it
> > could be preferable to use a field in struct efi_obj.
> > 
> 
> I agree with Heinrich here.  Basically U-Boot has to be in charge of that.
> Once ConnectController has been called U-Boot should create an 1:1 mapping
> between udevice <-> handle and shouldn't be allowed to change that.

Again, are you sure you're talking about the implementation of efi_disk for
U-Boot's block device (the path(1) in my previous reply to Heinrich)?

-Takahiro Akashi

> > > 
> > > 3-2. use device model's post_probe/pre_remove hook to synchronize the lifetime
> > >     of efi_disk objects in UEFI world with the device model.
> > > 
> > > 4. I have no answer to issue(4) and (5) yet.
> > 
> > 4) A udevice shall only exist for the child controller handle created by
> > U-Boot and not for the controller handle created by an EFI application.
> > 
> > 5) The stop() method of the driver binding protocol has to take care of
> > destroying the child controllers and the associated udevices.
> > 
> > Best regards
> > 
> > Heinrich
> 
> Thanks
> /Ilias

  reply	other threads:[~2021-10-05  2:27 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-10-04  3:44 [resent RFC 00/22] efi_loader: more tightly integrate UEFI disks to device model AKASHI Takahiro
2021-10-04  3:44 ` [resent RFC 01/22] part: call part_init() in blk_get_device_by_str() only for MMC AKASHI Takahiro
2021-10-04  3:44 ` [resent RFC 02/22] scsi: call device_probe() after scanning AKASHI Takahiro
2021-10-04  3:44 ` [resent RFC 03/22] usb: storage: " AKASHI Takahiro
2021-10-04  3:44 ` [resent RFC 04/22] mmc: " AKASHI Takahiro
2021-10-04  3:44 ` [resent RFC 05/22] nvme: " AKASHI Takahiro
2021-10-04  3:44 ` [resent RFC 06/22] sata: " AKASHI Takahiro
2021-10-04 18:45   ` Ilias Apalodimas
2021-10-05  1:06     ` AKASHI Takahiro
2021-10-08  5:44       ` Ilias Apalodimas
2021-10-04  3:44 ` [resent RFC 07/22] block: ide: " AKASHI Takahiro
2021-10-04  3:44 ` [resent RFC 08/22] dm: blk: add UCLASS_PARTITION AKASHI Takahiro
2021-10-04 18:40   ` Ilias Apalodimas
2021-10-05  1:30     ` AKASHI Takahiro
2021-10-04  3:44 ` [resent RFC 09/22] dm: blk: add a device-probe hook for scanning disk partitions AKASHI Takahiro
2021-10-04  3:44 ` [resent RFC 10/22] dm: blk: add read/write interfaces with udevice AKASHI Takahiro
2021-10-04  3:44 ` [resent RFC 11/22] efi_loader: disk: use udevice instead of blk_desc AKASHI Takahiro
2021-10-04  3:44 ` [resent RFC 12/22] dm: add a hidden link to efi object AKASHI Takahiro
2021-10-04  3:44 ` [resent RFC 13/22] efi_loader: remove !CONFIG_BLK code from efi_disk AKASHI Takahiro
2021-10-04  3:44 ` [resent RFC 14/22] efi_loader: disk: a helper function to create efi_disk objects from udevice AKASHI Takahiro
2021-10-04 18:50   ` Ilias Apalodimas
2021-10-05  1:37     ` AKASHI Takahiro
2021-10-04  3:44 ` [resent RFC 15/22] dm: blk: call efi's device-probe hook AKASHI Takahiro
2021-10-04  3:44 ` [resent RFC 16/22] efi_loader: cleanup after efi_disk-dm integration AKASHI Takahiro
2021-10-04  3:44 ` [resent RFC 17/22] efi_loader: add efi_remove_handle() AKASHI Takahiro
2021-10-12  8:16   ` Ilias Apalodimas
2021-10-13  0:55     ` AKASHI Takahiro
2021-10-04  3:44 ` [resent RFC 18/22] efi_loader: efi_disk: a helper function to delete efi_disk objects AKASHI Takahiro
2021-10-04  3:44 ` [resent RFC 19/22] dm: blk: call efi's device-removal hook AKASHI Takahiro
2021-10-04  3:44 ` [resent RFC 20/22] efi_driver: align with efi_disk-dm integration AKASHI Takahiro
2021-10-04  3:44 ` [resent RFC 21/22] efi_driver: cleanup after " AKASHI Takahiro
2021-10-04  3:44 ` [resent RFC 22/22] efi_selftest: block device: adjust dp for a test disk AKASHI Takahiro
2021-10-04 14:47 ` [resent RFC 00/22] efi_loader: more tightly integrate UEFI disks to device model Heinrich Schuchardt
2021-10-04 18:07   ` Ilias Apalodimas
2021-10-05  2:27     ` AKASHI Takahiro [this message]
2021-10-05  2:14   ` AKASHI Takahiro
2021-10-04 23:45 ` Simon Glass

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211005022737.GE39521@laputa \
    --to=takahiro.akashi@linaro.org \
    --cc=agraf@csgraf.de \
    --cc=ilias.apalodimas@linaro.org \
    --cc=sjg@chromium.org \
    --cc=u-boot@lists.denx.de \
    --cc=xypron.glpk@gmx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.