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 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 smtp.lore.kernel.org (Postfix) with ESMTPS id 72752C433EF for ; Tue, 8 Mar 2022 11:37:37 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 020FA830AB; Tue, 8 Mar 2022 12:37:35 +0100 (CET) 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="I+Xraelm"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 1CDC7836C0; Tue, 8 Mar 2022 12:37:32 +0100 (CET) Received: from mail-pj1-x1033.google.com (mail-pj1-x1033.google.com [IPv6:2607:f8b0:4864:20::1033]) (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 D44E9830AB for ; Tue, 8 Mar 2022 12:37:26 +0100 (CET) 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-pj1-x1033.google.com with SMTP id mr24-20020a17090b239800b001bf0a375440so1936588pjb.4 for ; Tue, 08 Mar 2022 03:37:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=spO1eDXYziZ52rztoWbS0y2sJgwM/kJG8ObkJy/E1ic=; b=I+Xraelm+V9MOz7sS00YHdeeX5EtoauaAmG10rEne+N9yrTHVaBbKZPtrEaPUPMbmS QSkoYfzXNm11KFWyBVCRv3O1/uGDdiqk7v5Xz662so4ZMrrexwXt4JupyB/1pIWxp5y8 O2/m4aqUrKpHhW59R89LeORiip9hN4ExjYK8aT8IeK0pxa32ArXUpYLkHlaauxRSFo3a sCON0DmlW2dfe6806KHnsCv96W+xzr17at8TXTl0DNSTCVmwqOH8wav08IH4Do6pDk0R m+BJGuG1Yeneiwf71fWpAuEZK3iHtjCtLAm/mfm6jO2Csvr2qQC9DEkV/qedUbdmSzXA 4lmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=spO1eDXYziZ52rztoWbS0y2sJgwM/kJG8ObkJy/E1ic=; b=HYqDMrZGHqZYWjaMJrs8EgHmoloPgngVyaykVeQMqkXYzM3xLOhF6mny5FO1sLEUO6 LxKkChg0G2xvuRUEZfezX0GKHMhBkLGOFeASckJjxVhlaicTQSZOdxWNvbozKD2cxRka TNgoTl5JwvMDcwnfmx/+S5Qa+n+yxLiCYV4Say5zGSbMopeEYerZaA4KYkenbdPbRaLq G9J6KuRPloSOyW2CzCYL5nsfuWHoXKQiIM8lDogEOTVblIlWt6KyZcVoQoOZc0BBw132 TIv7b3HxoFNcZdvIjoB5iwd4864Ha8gGOEiDzZUBzlp6+mjQotkUmcvmvpdqe7Wdf24B yhcg== X-Gm-Message-State: AOAM531XoXyaI7ibE6bc8to7WcZn0BfT9Y7deZnA1YMxCHbC8P7NQ0eG 0hJRn7qM4PkRRqbzcO5nOP22Gw== X-Google-Smtp-Source: ABdhPJwhfLsUfP9WjTkzHcZJ7djBpMYuF2UvrGjE2KdHH3ayt1blQ4Y1KUG7Y48cVoIz2PiROGzz+w== X-Received: by 2002:a17:903:292:b0:149:460a:9901 with SMTP id j18-20020a170903029200b00149460a9901mr16929806plr.44.1646739444926; Tue, 08 Mar 2022 03:37:24 -0800 (PST) Received: from localhost.localdomain ([2400:4050:c3e1:100:b94a:f47a:3d51:185c]) by smtp.gmail.com with ESMTPSA id z2-20020a17090a170200b001bf2d530d64sm3434677pjd.2.2022.03.08.03.37.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Mar 2022 03:37:24 -0800 (PST) From: AKASHI Takahiro To: lukma@denx.de, peng.fan@nxp.com, jh80.chung@samsung.com, bmeng.cn@gmail.com, sr@denx.de, xypron.glpk@gmx.de, sjg@chromium.org, ilias.apalodimas@linaro.org Cc: masami.hiramatsu@linaro.org, u-boot@lists.denx.de, AKASHI Takahiro Subject: [PATCH v3 00/19] efi_loader: more tightly integrate UEFI disks to driver model Date: Tue, 8 Mar 2022 20:36:38 +0900 Message-Id: <20220308113657.221101-1-takahiro.akashi@linaro.org> X-Mailer: git-send-email 2.33.0 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.39 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.5 at phobos.denx.de X-Virus-Status: Clean With this patch set[1] applied, UEFI subsystem maintains a list of its disk objects dynamically at runtime based on block device's probing. (See "issues" below.) [1] https://github.com/t-akashi/u-boot/tree/efi/dm_disk For instance, => dm tree Class Index Probed Driver Name ----------------------------------------------------------- root 0 [ + ] root_driver root_driver ... pci 0 [ + ] pci_generic_ecam |-- pcie@10000000 ... ahci 0 [ ] ahci_pci | |-- ahci_pci scsi 0 [ ] ahci_scsi | | `-- ahci_scsi usb 0 [ ] xhci_pci | `-- xhci_pci ... => efi devices Missing RNG device for EFI_RNG_PROTOCOL No EFI system partition Unable to find TPMv2 device Device Device Path ================ ==================== 000000013eee88d0 /VenHw(..) 000000013ffeb798 /VenHw(..)/Uart(0,0,D,D) 000000013eeeb810 /VenHw(..)/MAC(525252525252,1) => scsi rescan ... => efi devices Device Device Path ================ ==================== 000000013eee88d0 /VenHw(..) 000000013ffeb798 /VenHw(..)/Uart(0,0,D,D) 000000013eeeb810 /VenHw(..)/MAC(525252525252,1) 000000013eefb730 /VenHw(..)/Scsi(0,0) 000000013eefb840 /VenHw(..)/Scsi(0,0)/HD(1,GPT,ce86c5a7-b32a-488f-a346-88fe698e0edc,0x22,0x4c2a) 000000013eefbc80 /VenHw(..)/Scsi(0,0)/HD(2,GPT,aa80aab9-33e6-42b6-b5db-def2cb8d7844,0x5000,0x1a800) => usb start ... => efi devices Device Device Path ================ ==================== 000000013eee88d0 /VenHw(..) 000000013ffeb798 /VenHw(..)/Uart(0,0,D,D) 000000013eeeb810 /VenHw(..)/MAC(525252525252,1) 000000013eefb730 /VenHw(..)/Scsi(0,0) 000000013eefb840 /VenHw(..)/Scsi(0,0)/HD(1,GPT,ce86c5a7-b32a-488f-a346-88fe698e0edc,0x22,0x4c2a) 000000013eefbc80 /VenHw(..)/Scsi(0,0)/HD(2,GPT,aa80aab9-33e6-42b6-b5db-def2cb8d7844,0x5000,0x1a800) 000000013ef01330 /VenHw(..)/UsbClass(0x0,0x0,0x9,0x0,0x3)/UsbClass(0x46f4,0x1,0x0,0x0,0x0) 000000013ef014b0 /VenHw(..)/UsbClass(0x0,0x0,0x9,0x0,0x3)/UsbClass(0x46f4,0x1,0x0,0x0,0x0)/HD(1,GPT,ce86c5a7-b32a-488f-a346-88fe698e0edc,0x22,0x4c2a) 000000013ef018f0 /VenHw(..)/UsbClass(0x0,0x0,0x9,0x0,0x3)/UsbClass(0x46f4,0x1,0x0,0x0,0x0)/HD(2,GPT,aa80aab9-33e6-42b6-b5db-def2cb8d7844,0x5000,0x1a800) => dm tree ... pci 0 [ + ] pci_generic_ecam |-- pcie@10000000 ... ahci 0 [ + ] ahci_pci | |-- ahci_pci scsi 0 [ + ] ahci_scsi | | `-- ahci_scsi blk 2 [ + ] scsi_blk | | `-- ahci_scsi.id0lun0 partition 0 [ + ] blk_partition | | |-- ahci_scsi.id0lun0:1 partition 1 [ + ] blk_partition | | `-- ahci_scsi.id0lun0:2 usb 0 [ + ] xhci_pci | `-- xhci_pci usb_hub 0 [ + ] usb_hub | `-- usb_hub usb_mass_s 0 [ + ] usb_mass_storage | |-- usb_mass_storage blk 3 [ + ] usb_storage_blk | | `-- usb_mass_storage.lun0 partition 2 [ + ] blk_partition | | |-- usb_mass_storage.lun0:1 partition 3 [ + ] blk_partition | | `-- usb_mass_storage.lun0:2 ... => usb stop stopping USB.. => efi devices Device Device Path ================ ==================== 000000013eee88d0 /VenHw(..) 000000013ffeb798 /VenHw(..)/Uart(0,0,D,D) 000000013eeeb810 /VenHw(..)/MAC(525252525252,1) 000000013eefb730 /VenHw(..)/Scsi(0,0) 000000013eefb840 /VenHw(..)/Scsi(0,0)/HD(1,GPT,ce86c5a7-b32a-488f-a346-88fe698e0edc,0x22,0x4c2a) 000000013eefbc80 /VenHw(..)/Scsi(0,0)/HD(2,GPT,aa80aab9-33e6-42b6-b5db-def2cb8d7844,0x5000,0x1a800) Issues: ======= * The image size of U-Boot may increase. CI build test complains, for instance, rcar3_salvator-x: "u-boot.img exceeds file size limit: ... excess: 0x79c bytes" phycore-rk3288: "SPL image is too large (size 0x8800 than 0x8000)" See [2]. * For removal case, we may need more consideration since removing handles unconditionally may end up breaking integrity of handles (as some may still be held and referenced to by a UEFI app). [2] https://dev.azure.com/u-boot/u-boot/_build/results?buildId=3770&view=results Prerequisite: ============= * Simon's event[3] [3] https://lists.denx.de/pipermail/u-boot/2022-March/476844.html Patchs: ======= For easy understandings, patches may be categorized into separate groups of changes. Patch#1-#7: DM: add device_probe() for later use of events Patch#8-#10: DM: add a new feature (DM tag) Patch#11-#15: UEFI: dynamically create/remove efi_disk's for a raw disk and its partitions Patch#16-#17: UEFI: use udevice read/write interfaces Patch#18-#19: UEFI: fix-up efi_driver, aligning with changes in DM integration Change history: =============== v3 (Mar 8, 2022) * rebased on 2022.04-rc3 * rebased on v2 of Simon's event patch (hence removed his patch from this patch set) * fix a spl-build error in mmc_blk_probe() (patch#3) * fix a build warning in fsl_ata_probe()/sil_pci_probe() (patch#5) * remove a problematic log message in efi_disk_probe() (patch#14) v2 (Feb 10, 2022) * add/revise an error message if device_probe() fails (patch#3,#5) * fix a build error in sandbox_spl_defconfig (patch#8) * fix warnings in 'make htmldocs' (patch#8,#9,#18) * new commit: split efi_init_obj_list() (patch#14) * new commit: simplify efi_capsule pytest (patch#21) v1 (Feb 2, 2022) * rebased on 2022.04-rc1 * drop patches that have already been merged * modify a tag-range check with "tag >= DM_TAG_COUNT" (patch#9) * move dmtag_list to GD (global data) (patch#9) * add function descriptions and a document about DM tag feature (patch#9,10) * add tests for DM tag support (patch#11) * change 'depends on EVENT' to 'select EVENT' for EFI_LOADER (patch#14) * migrate IF_TYPE_EFI to IF_TYPE_EFI_LOADER (patch#18) RFCv2 (Dec 10, 2021) * rebased on 2022-rc3 * re-order and merge some related commits into ones * call device_probe() in MMC (not bind, but) probe hook (patch#5) * fix a wrong name of variable (patch#7) * add patch#9 * invoke device_probe() for virtio devices (patch#10) * add DM event notification (from Simon) (patch#11) * add DM tag support (patch#12) * move UCLASS_PARTITION driver under disk/ (patch#13) * create partition's dp using its parent's. This change is necessary in particular for 'efi_blk' efi_disk (patch#13) * modify the code so that we will use new features like tags and event notification (patch#13,15,16,20) * rename new functions from blk_read/write() to dev_read/write() (patch#17,18) * isolate changes in efi_driver from the rest (in efi_loader) (patch#19) * drop the previous patch#22 ("efi_selftest: block device: adjust dp for a test") due to the fix in patch#13 RFC (Nov 16, 2021) * initial RFC AKASHI Takahiro (19): scsi: call device_probe() after scanning usb: storage: call device_probe() after scanning mmc: call device_probe() after scanning nvme: call device_probe() after scanning sata: call device_probe() after scanning block: ide: call device_probe() after scanning virtio: call device_probe() in scanning dm: add tag support dm: tag: add some document test: dm: add tests for tag support dm: disk: add UCLASS_PARTITION dm: blk: add a device-probe hook for scanning disk partitions efi_loader: split efi_init_obj_list() into two stages efi_loader: disk: a helper function to create efi_disk objects from udevice efi_loader: disk: a helper function to delete efi_disk objects dm: disk: add read/write interfaces with udevice efi_loader: disk: use udevice instead of blk_desc efi_loader: disk: not create BLK device for BLK(IF_TYPE_EFI_LOADER) devices efi_driver: align with efi_disk-dm integration cmd/virtio.c | 21 +- common/board_r.c | 2 +- common/main.c | 7 +- common/usb_storage.c | 4 + disk/Makefile | 3 + disk/disk-uclass.c | 247 +++++++++++++++++++++ doc/develop/driver-model/design.rst | 20 ++ drivers/ata/dwc_ahsata.c | 5 + drivers/ata/fsl_sata.c | 11 + drivers/ata/sata_mv.c | 5 + drivers/ata/sata_sil.c | 12 + drivers/block/blk-uclass.c | 4 + drivers/block/ide.c | 4 + drivers/core/Makefile | 2 +- drivers/core/root.c | 2 + drivers/core/tag.c | 139 ++++++++++++ drivers/mmc/mmc-uclass.c | 12 + drivers/nvme/nvme.c | 4 + drivers/scsi/scsi.c | 5 + include/asm-generic/global_data.h | 4 + include/dm/tag.h | 110 ++++++++++ include/dm/uclass-id.h | 1 + include/efi_loader.h | 6 +- include/part.h | 18 ++ lib/efi_driver/efi_block_device.c | 34 +-- lib/efi_loader/Kconfig | 3 + lib/efi_loader/efi_disk.c | 328 ++++++++++++++++++++-------- lib/efi_loader/efi_setup.c | 62 +++++- test/dm/Makefile | 1 + test/dm/tag.c | 84 +++++++ 30 files changed, 1029 insertions(+), 131 deletions(-) create mode 100644 disk/disk-uclass.c create mode 100644 drivers/core/tag.c create mode 100644 include/dm/tag.h create mode 100644 test/dm/tag.c -- 2.33.0