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 X-Spam-Level: X-Spam-Status: No, score=-5.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C1390C47094 for ; Thu, 10 Jun 2021 12:59:31 +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 1F9D3613F1 for ; Thu, 10 Jun 2021 12:59:31 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1F9D3613F1 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id E7CAC82EAC; Thu, 10 Jun 2021 14:59: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="Z0AJrvjb"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 7B6C082EB2; Thu, 10 Jun 2021 14:59:26 +0200 (CEST) Received: from mail-pf1-x430.google.com (mail-pf1-x430.google.com [IPv6:2607:f8b0:4864:20::430]) (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 A805F82E55 for ; Thu, 10 Jun 2021 14:59:21 +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-x430.google.com with SMTP id k15so1557585pfp.6 for ; Thu, 10 Jun 2021 05:59:21 -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:content-transfer-encoding :in-reply-to; bh=QPoXBqsNakvuWJsWARlrsv33WUALTea+DoZ0NOaAJiY=; b=Z0AJrvjbcHcr8m6JA6QekBImKroiuoAsuq0BXulaJR0STHzMUf9HWoK4+ILtolrV7H GFaHmK9UzITR77haogmVaN8P+WVHbfuw49425eEiuXk3qAk6N+ntbViwe5dZmf60UVFr f3eA1oxEPllEpdb2uYQg4XkvE519rCVE6isElF7qZErZFgJVcWjgomzFrSuGkcWfTiin 7Ppsv1plyHgyRzaKqjWIgqTKlTjqhSNNu6qITR7liLwBwy7Cp0f4mQRmtVRh4RSKWno7 kdrkFVhfQ1VAA82sYXkQ9FX3jLVypw9GhZBoKVczkShcZJcLsXaJq/owqyrwYco3WYwd SOYg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :content-transfer-encoding:in-reply-to; bh=QPoXBqsNakvuWJsWARlrsv33WUALTea+DoZ0NOaAJiY=; b=O+mFiPrSdqTCS+2kN3WN19LpB+mm9JwmU7nwEhase+TbKHHoDM3bNkC347mvzaPHY9 2ZAf5av42wX29BLxfZf81RHCFB5LHetCkkR0GDP6xB68DkXR0TdXKaym5W5ATtxcigx7 d2CaZWq9Zh7C0ts8ZhuXUdIQDehLq2FFDtFcGzWBQ0k9lYEKKxUhnHJOu751JaUuLU2T 4DHJyw/F10iMa4JmFbQXXt7jCbVXN0fW9QDb0KjV3tC1wCWS82CD0+k8Gay9ldhsjDwf m/anakTYz9cos8dfXbfxyQeTFSGxuUyo78Xi05H1ojRHwzycNRqO7LQ7oUUSIGTixbfe V0mA== X-Gm-Message-State: AOAM5313w2J/RCwgESX0hstqljZ9S53SjTCEeLZM4y3WXQFR6fLwehfv XiM1927Rm1Yndov2StZf373jKQ== X-Google-Smtp-Source: ABdhPJzLwQ4ZTONufA5z5VWiy3+vst5AOER53vOXZCWBgvXEyWSpIjqULFXHo+7Gr/8LF5txRyoAwg== X-Received: by 2002:a63:309:: with SMTP id 9mr4799307pgd.351.1623329959693; Thu, 10 Jun 2021 05:59:19 -0700 (PDT) Received: from laputa (p3dd30534.tkyea130.ap.so-net.ne.jp. [61.211.5.52]) by smtp.gmail.com with ESMTPSA id h8sm2513043pfn.0.2021.06.10.05.59.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Jun 2021 05:59:19 -0700 (PDT) Date: Thu, 10 Jun 2021 21:59:15 +0900 From: AKASHI Takahiro To: Michal Simek Cc: Heinrich Schuchardt , Sughosh Ganu , U-Boot Mailing List , Ilias Apalodimas , Simon Glass Subject: Re: EFI from usb HDD Message-ID: <20210610125915.GA96492@laputa> Mail-Followup-To: AKASHI Takahiro , Michal Simek , Heinrich Schuchardt , Sughosh Ganu , U-Boot Mailing List , Ilias Apalodimas , Simon Glass References: <9c57a3c7-e609-91e8-cf33-5637ce4f9340@xilinx.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit 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.102.4 at phobos.denx.de X-Virus-Status: Clean On Thu, Jun 10, 2021 at 02:31:46PM +0200, Michal Simek wrote: > > > On 6/10/21 12:51 PM, Heinrich Schuchardt wrote: > > On 6/10/21 12:04 PM, Michal Simek wrote: > >> Hi, > >> > >> On 6/10/21 11:47 AM, Heinrich Schuchardt wrote: > >>> On 6/10/21 10:44 AM, Michal Simek wrote: > >>>> Hi, > >>>> > >>>> I am playing with booting from USB via EFI. And I see very weird > >>>> behavior. I have burnt image with grub to USB flashdisk and I have > >>>> tested it on 3 zynqmp boards. zcu102, zcu104 and SOM Kria board. > >>>> On zcu102 grub is going to boot menu and everything is working fine as > >>>> expected. > >>>> On zcu104 and SOM Kria I am able to get grub not to menu. When I list > >>>> partitions in grub I see that only SDs are listed: > >>>> grub> ls > >>>> (hd0) (hd0,msdos1) (hd1) (hd1,msdos1) > >>> > >>> Hello Michal, > >>> > >>> thanks for sharing your observations. > >>> > >>> What devices do hd0 and hd1 relate to? > >>> > >>>> > >>>> On zcu102(working board) I also see usb(gpt) partitions and SD. > >>>> grub> ls > >>>> (hd0) (hd0,gpt2) (hd0,gpt1) (hd1) (hd1,msdos1) > >>>> > >>> > >>> GPT and MBR partitioning are independent of the device type. > >>> > >>>> > >>>> On zcu104 I see one more error message > >>>> "PE image measurement failed" > >>> > >>> This is related to CONFIG_EFI_TCG2_PROTOCOL=y. Do you have a TPMv2? This > >>> will not stop disk enumeration. > >>> > >>>> But I can't see it on SOM. > >>>> > >>>> U-Boot image is just the same for all boards. I am using generic > >>>> xilinx_zynqmp_virt_defconfig. > >>>> > >>>> When I compare DT description for USB between zcu102 and zcu104 they > >>>> are > >>>> the same. SOM doesn't have usb enabled by default (but I enabled it) > >>>> but > >>>> grub starts which means that communication with USB is fine. > >>>> > >>>> It is based on my latest patches available here. > >>>> u-boot/custodians/u-boot-microblaze.git (usb-efi-issue branch) > >>>> > >>>> Also when I list usb I see all partitions just fine. > >>>> ZynqMP> part list usb 0 > >>>> > >>>> Partition Map for USB device 0  --   Partition Type: EFI > >>>> > >>>> Part    Start LBA       End LBA         Name > >>>>           Attributes > >>>>           Type GUID > >>>>           Partition GUID > >>>>     1     0x00000800      0x001007fe      "Microsoft basic data" > >>>>           attrs:  0x0000000000000000 > >>>>           type:   ebd0a0a2-b9e5-4433-87c0-68b6b72699c7 > >>>>           type:   data > >>>>           guid:   0e7f8b3d-296b-4720-be9d-c4687d3c4a77 > >>>>     2     0x00100800      0x001197fe      "Microsoft basic data" > >>>>           attrs:  0x0000000000000000 > >>>>           type:   ebd0a0a2-b9e5-4433-87c0-68b6b72699c7 > >>>>           type:   data > >>>>           guid:   8892eddc-231a-4e6e-a5e1-c310f4482fb7 > >>>> > >>>> > >>>> Do you have any idea why on one system is working fine to get to menu > >>>> and on others there is an issue to get all partitions even u-boot is > >>>> able to see them and can work with them. > >>>> > >>>> Thanks, > >>>> Michal > >>>> > >>> > >>> Where is the GRUB binary? - If it is in EFI/boot/bootaa64.efi, it could > >>> be that the USB sub-system is simply not initialized yet when the boot > >>> manager is called by distroboot. > >>> > >>> For testing partition detection in the UEFI sub-system it is enough > >>> to run > >>> > >>>      efidebug devices > >>> > >>> Until yesterday we had a problem with partition numbers >= 10, cf. > >>> > >>> efi_loader: partition numbers are hexadecimal > >>> https://source.denx.de/u-boot/u-boot/-/commit/3dca77b1dc1b6dbf9c8b51572fe4b0553cef009f > >>> > >>> > >>> > >>> Block devices are enumerated in efi_disk_register(). Please, try to add > >>> debug output there to elucidate the problem. > >> > >> I found where the problem is. First of all zcu102 didn't use the same > >> image as others (it wasn't updated properly). > >> When you have CONFIG_EFI_CAPSULE_ON_DISK_EARLY that efi_disk_register() > >> is called before usb block devices are detected and registered that's > >> why grub doesn't see them. > > > > The problem is CONFIG_EFI_SETUP_EARLY=y required by > > CONFIG_EFI_CAPSULE_ON_DISK_EARLY. > > > > Why is USB initialized later then MMC? > > It is not just usb. SCSI/sata are behaving in the same way too. > > > > > Overall we have a deficiency in the UEFI implementation in that we > > cannot deal with block devices added or removed after initialization. > > > > Here integration with the driver model is missing. > > Right. And also there are commands which can create MBR partitions and I > expect when you write image to SD and then run rescan or so you could > get other partitions too. > Maybe hook via part_init()? with removing efi_disk_register. For the record, I have proposed my ideas several times[1], [2]. I'm, however, no longer working on this issue as I have shifted my focus to UEFI secure boot and capsule update. -Takahiro Akashi [1] https://lists.denx.de/pipermail/u-boot/2018-November/347491.html [2] https://lists.denx.de/pipermail/u-boot/2019-February/357923.html > > > >> I was looking at adding usb start in preboot but preboot is called later. > >> How this should be solved? Any idea? > >> > >> Thanks, > >> Michal > >> > >> > > +cc Sughosh, Takahiro (who have developed the capsule code) > > Thanks, > Michal