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 4A617EB64DC for ; Mon, 10 Jul 2023 02:28:32 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 1C00D84F74; Mon, 10 Jul 2023 04:28:31 +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="EE7Hml4y"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 1499D86290; Mon, 10 Jul 2023 04:28:30 +0200 (CEST) Received: from mail-pf1-x42f.google.com (mail-pf1-x42f.google.com [IPv6:2607:f8b0:4864:20::42f]) (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 E95B685F3D for ; Mon, 10 Jul 2023 04:28:26 +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-pf1-x42f.google.com with SMTP id d2e1a72fcca58-682a5465e9eso575529b3a.1 for ; Sun, 09 Jul 2023 19:28:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1688956105; x=1691548105; h=in-reply-to:content-disposition:mime-version:references :mail-followup-to:message-id:subject:cc:to:from:date:from:to:cc :subject:date:message-id:reply-to; bh=PxK4vjQ9obVwDOJmG7D7bBShXTOqe7A79jeR3H273g8=; b=EE7Hml4ypIRbUMbTXsBW5/E2y2xM+FzvwgFPreSfTP5u4a9lUke69Qc05DEF87FJ+q jNzqnOuYvyumifY8f6Tjpz1WqHHxubuiz3p9wKXn+kBndrXqhY0oDBPi/i4fC4Mmz3P/ jTQjelWocCkIqCZyFXhE8St2195Yg02Qs6XoW7Eow5/XwV7SCHuikqGlTrE6mV9YvoaT r1cA0GynR6ONYE8GckpyOC3w7iUVorRi9DnuRn0HBShDOVh+39mN1D3QfJm39+D+PaF8 Yd4/80S0KTqCfIdaADzRNmacjb0KKvKpmaucoGC3qTwjGJAcYz5+b6apvY82jljTFLU2 METw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1688956105; x=1691548105; h=in-reply-to:content-disposition:mime-version:references :mail-followup-to:message-id:subject:cc:to:from:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=PxK4vjQ9obVwDOJmG7D7bBShXTOqe7A79jeR3H273g8=; b=JrjL4YjsrIu98Zg9Ka4tiHtDRt5qxihAHAsdgBYdR3rI8ZfV0vFNgSxBSjARKmwedI uzJhqQXYh3v+mnZi0y8B22pLS1f+AxTvu+bTwVM8HNvP88+GbRpthZQsKltPYW0p8OLn r7rluYBOLxirf5kWra827Qigeh39stu0rFTwqBVa6iZQXiUOB6ObT9LZRZ0Dg2FmMfS/ pEMnjVKGatkiuRb0DW8VGvY/6gySKnqaz8n0krqUm2BA9purONbKe+1VxvDGyiM9EY// HCPjCbyWN2YUTeoLZlQLZ2u+xMQQkBEyB9TvdZWo6vgOYt8mlgNCo1/NFP5dkmXW7ywU nkXQ== X-Gm-Message-State: ABy/qLbWXqzvg58naN/32FLpZ0AZ7WLqiuyQx51F0T2M7GkgTHLfHKBd 4RujP2SgCu5ChClh6ziHmWt3KQ== X-Google-Smtp-Source: APBJJlFJtx6+FlXQcf9/pRNyeYDF46sXF8C2UWrkg9tMmzs2AkhqUrN5r2HjzSZr4NVbgwOpiRzWRQ== X-Received: by 2002:a05:6a20:8421:b0:12e:f6e6:882b with SMTP id c33-20020a056a20842100b0012ef6e6882bmr15365056pzd.1.1688956104972; Sun, 09 Jul 2023 19:28:24 -0700 (PDT) Received: from laputa ([2400:4050:c3e1:100:dcbb:ee54:813e:ed94]) by smtp.gmail.com with ESMTPSA id s2-20020a639242000000b00553c09cc795sm6282409pgn.50.2023.07.09.19.28.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 09 Jul 2023 19:28:24 -0700 (PDT) Date: Mon, 10 Jul 2023 11:28:21 +0900 From: AKASHI Takahiro To: Masahisa Kojima Cc: Heinrich Schuchardt , Ilias Apalodimas , u-boot@lists.denx.de, Simon Glass Subject: Re: [PATCH 0/4] introduce EFI_RAM_DISK_PROTOCOL Message-ID: Mail-Followup-To: AKASHI Takahiro , Masahisa Kojima , Heinrich Schuchardt , Ilias Apalodimas , u-boot@lists.denx.de, Simon Glass References: <20230707040045.485790-1-masahisa.kojima@linaro.org> <3bab3fdc-23d1-85fd-5cc8-7ed9c77097a4@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.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.8 at phobos.denx.de X-Virus-Status: Clean On Mon, Jul 10, 2023 at 11:13:12AM +0900, Masahisa Kojima wrote: > On Fri, 7 Jul 2023 at 18:12, AKASHI Takahiro wrote: > > > > On Fri, Jul 07, 2023 at 05:19:33PM +0900, Masahisa Kojima wrote: > > > Hi Akashi-san, > > > > > > On Fri, 7 Jul 2023 at 16:16, AKASHI Takahiro wrote: > > > > > > > > On Fri, Jul 07, 2023 at 08:29:12AM +0200, Heinrich Schuchardt wrote: > > > > > On 7/7/23 06:00, Masahisa Kojima wrote: > > > > > > This series introduces the EFI_RAM_DISK_PROTOCOL implementation. > > > > > > The major purpose of this series is a preparation for EFI HTTP(S) boot. > > > > > > > > > > > > Now U-Boot can download the distro installer ISO image > > > > > > via wget or tftpboot commands, but U-Boot can not mount > > > > > > the downloaded ISO image. > > > > > > By calling EFI_RAM_DISK_PROTOCOL->register API, user can > > > > > > mount the ISO image and boot the distro installer. > > > > > > > > > > If I understand you correctly, with your design RAM disks will only > > > > > exist in the EFI sub-system. > > > > > > > > Probably, not. As Kojima-san's "dm tree" shows, there is a U-Boot > > > > block device (and associated partition devices) thanks to your > > > > efi_driver framework. > > > > > > Read/Write the RAM disk is expected to be called from the EFI context, so > > > > An associated U-Boot block device should work as well on top of your > > RAW_DISK_PROTOCOL via a generated RAM disk object (efi_disk). > > That is why SYMPLE_FILE_SYSTEM_PROTOCOL, which solely relies on U-Boot's proper > > filesystem subsystem, is installed to the RAM disk object. > > I now realize that my RAM_DISK_PROTOCOL implementation happens to work > thanks to the block cache. > When I disable CONFIG_BLOCK_CACHE and load some EFI application(it > does set 'app_gd') > before calling RAM_DISK_PROTOCOL service, RAM_DISK_PROTOCOL does not work. > ConnectController fails. > > > > > > native U-Boot can not access the RAM disk. > > > > I believe that, in theory, "fatls efidisk 0 1" (or efi_disk as an interface?) > > should work even under your current implementation. > > "fatls efiloader 0:2" does not work. > I think "efiloader" device is designed to be accessed from EFI application only > even if it is listed by "dm tree". I don't believe so. (the interface name may be "efi_blk" or "efiblk", though.) If the command fails, it's a bug. Must be fixed. > I understand that ramdisk as UCLASS_BLK driver is required as Heinrich said. That said, I agree to starting with UCLASS_BLK from the viewpoint of U-Boot driver model/UEFI integration. -Takahiro Akashi > > Thanks, > Masahisa Kojima > > > > > -Takahiro Akashi > > > > > # Honestly speaking, I'm not sure how U-Boot prohibits the access to > > > the EFI RAM disk > > > because the udevices are created for the RAM disk. > > > > > > Thanks, > > > Masahisa Kojima > > > > > > > > > > > > We strive to synchronize what is happening on the driver model level and > > > > > on the UEFI level. I would prefer a design where we have a UCLASS_BLK > > > > > driver ram disks and the EFI_RAM_DISK_PROTOCOL is a one method of > > > > > managing ram disk devices. > > > > > > > > That said, I agree to starting with U-Boot block device implementation, > > > > UEFI_DISK comes automatically. It benefits both U-Boot proper and > > > > UEFI subsystem equally as well. > > > > (That is also what I meant to say in my first response.) > > > > > > > > > A big issue we have is RAM management. malloc() can only assign limited > > > > > amount of memory which is probably too small for the RAM disk you are > > > > > looking at. We manage page sized memory in the EFI sub-system but this > > > > > is not integrated with the LMB memory checks. > > > > > > > > Not sure, is it enough simply to add some restrictions on the start size > > > > and the size when a memory region is specified for a raw disk? > > > > > > > > -Takahiro Akashi > > > > > > > > > The necessary sequence of development is probably: > > > > > > > > > > * Rework memory management > > > > > * Implement ramdisks as UCLASS_BLK driver > > > > > * Implement the EFI_RAM_DISK_PROTOCOL based on the UCLASS_BLK driver. > > > > > > > > > > Best regards > > > > > > > > > > Heinrich > > > > > > > > > > > > > > > > > Note that the installation process may not proceed > > > > > > after the distro installer calls ExitBootServices() > > > > > > since there is no hand-off process for the block device of > > > > > > memory mapped ISO image. > > > > > > > > > > > > The EFI_RAM_DISK_PROTOCOL was tested with the > > > > > > debian network installer[1] on qemu_arm64 platform. > > > > > > The example procedure is as follows. > > > > > > => tftpboot 41000000 mini.iso > > > > > > => efidebug disk load 41000000 $filesize > > > > > > > > > > > > After these commands, ISO image is mounted like: > > > > > > > > > > > > => efidebug dh > > > > > > > > > > > > 000000007eec5910 (efiblk#0) > > > > > > /RamDisk(0x41000000,4974afff,3d5abd30-4175-87ce-6d64-d2ade523c4bb,0x0) > > > > > > Block IO > > > > > > > > > > > > 000000007eec6140 (efiblk#0:1) > > > > > > /RamDisk(0x41000000,4974afff,3d5abd30-4175-87ce-6d64-d2ade523c4bb,0x0)/HD(1,0x01,0,0x0,0x33800) > > > > > > Block IO > > > > > > > > > > > > 000000007eec62b0 (efiblk#0:2) > > > > > > /RamDisk(0x41000000,4974afff,3d5abd30-4175-87ce-6d64-d2ade523c4bb,0x0)/HD(2,0x01,0,0x33800,0x10000) > > > > > > Block IO > > > > > > System Partition > > > > > > Simple File System > > > > > > > > > > > > => dm tree > > > > > > > > > > > > blk 0 [ + ] efi_blk `-- efiblk#0 > > > > > > partition 0 [ + ] blk_partition |-- efiblk#0:1 > > > > > > partition 1 [ + ] blk_partition `-- efiblk#0:2 > > > > > > > > > > > > Debian can be successfully installed with this RAM disk on QEMU. > > > > > > > > > > > > [TODO] > > > > > > - udevices created in ./lib/efi_driver/efi_block_device.c::efi_bl_bind() > > > > > > are not removed when the efi_handle is removed. > > > > > > So after unload the RAM disk, udevices still exist. > > > > > > I plan to add a udevice removal process in ./lib/efi_driver/efi_uclass.c::efi_uc_stop(). > > > > > > In addition, I also plan to add unbind() callback in struct efi_driver_ops. > > > > > > > > > > > > > > > > > > [1] https://deb.debian.org/debian/dists/bookworm/main/installer-arm64/current/images/netboot/mini.iso > > > > > > > > > > > > Masahisa Kojima (4): > > > > > > efi_loader: add RAM disk device path > > > > > > efi_loader: add EFI_RAM_DISK_PROTOCOL implementation > > > > > > cmd: efidebug: add RAM disk mount command > > > > > > efi_selftest: add EFI_RAM_DISK_PROTOCOL selftest > > > > > > > > > > > > cmd/efidebug.c | 117 ++++++ > > > > > > include/efi_api.h | 32 ++ > > > > > > include/efi_loader.h | 4 + > > > > > > lib/efi_driver/efi_uclass.c | 7 +- > > > > > > lib/efi_loader/Kconfig | 6 + > > > > > > lib/efi_loader/Makefile | 1 + > > > > > > lib/efi_loader/efi_device_path_to_text.c | 14 + > > > > > > lib/efi_loader/efi_ram_disk.c | 334 +++++++++++++++ > > > > > > lib/efi_loader/efi_setup.c | 6 + > > > > > > lib/efi_selftest/Makefile | 1 + > > > > > > lib/efi_selftest/efi_selftest_ram_disk.c | 511 +++++++++++++++++++++++ > > > > > > lib/uuid.c | 4 + > > > > > > 12 files changed, 1035 insertions(+), 2 deletions(-) > > > > > > create mode 100644 lib/efi_loader/efi_ram_disk.c > > > > > > create mode 100644 lib/efi_selftest/efi_selftest_ram_disk.c > > > > > > > > > > > > > > > > > > base-commit: e2e2aea5733f0d23cd9593bbefe5c803c552dcb9 > > > > >