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 23573C32771 for ; Fri, 16 Sep 2022 00:58:19 +0000 (UTC) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 3745484934; Fri, 16 Sep 2022 02:58:17 +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="IEakbk2V"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 20BB180E94; Fri, 16 Sep 2022 02:58:15 +0200 (CEST) Received: from mail-pg1-x534.google.com (mail-pg1-x534.google.com [IPv6:2607:f8b0:4864:20::534]) (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 1373180E94 for ; Fri, 16 Sep 2022 02:58:12 +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-pg1-x534.google.com with SMTP id i19so15614486pgi.1 for ; Thu, 15 Sep 2022 17:58:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=in-reply-to:content-disposition:mime-version:references :mail-followup-to:message-id:subject:cc:to:from:date:from:to:cc :subject:date; bh=9O6yFCPa+opE1KB241PwZMcWAUGSwFG7Km+8TgZgNw0=; b=IEakbk2Vlh6aFboFlTNem8e0jGt8y89+vHIPIG7XHgr89owBnp40PYHld4e2sDjmlr aAnqOn4ci3BMZbfr6GgH4ptP/jUqOzrEx3DIvqaM69PLa/00kxiDZxydNhMwqA/Yg5wq aRvcubdjJ64e11GSsPJdM5CxFe1M8QcPvqTC2TkkpvLqShEoWzNM/7MXGGcFnf5The/U iNtnkr7UnI98hi0VWqHelWHTWmA4DDTwP6Vhi9IsHe3mqd+SDSmBpxSLtXPxnpBn5nqh PlllXNpgcQC0w8LQ3qKa5GQGRJr48cdTrjKDU5cf0cZmSvN2HCC6sdvuD4Fhwg0VaiNp s/Gw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; 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; bh=9O6yFCPa+opE1KB241PwZMcWAUGSwFG7Km+8TgZgNw0=; b=NKaQj1KVQLQOJiS9XLOJ9x1qPjStYrwUZqns8X+4UJKhj0YgG2ayqGrDLYv4enTurq RogouSYvGdwSdcON7bHrtBfcOEhQM1gEOLIDvYUdeobBeaePAx6x1cEoDoEAOmlKUiHB RcpzIUpFlZ0wsfVU9dsHjWD+/repJMd6FUkAX6aXr4AYbXm9XlwLU0w4dv2YKnaNIVTm lmb+z7KmtuW7JEckTY/afdobYxqS3qbV5THrW3p/ZCj01BB0Fe27dWskWEGgQ+muUnl9 +RPUsxC9sX+Iilwa7DA3v7iHKmNn3wYs8VB06T515KxOwg7q7WCnveJa212ZsYd5UyY7 de5A== X-Gm-Message-State: ACrzQf2wALX0kJppvPLPLmrPHMkgVb6AeZt771pO3xbpAZcqV1hjWVOt rLY5/fDmMtT3D/kMTyVuWhMh9w== X-Google-Smtp-Source: AMsMyM4r3yGKK56covLkha5lBWmCJNPC1cN284TBHecGlCPzi8qUEGwEpstxMoISVbNurWsDNp0SnA== X-Received: by 2002:a62:3347:0:b0:53d:f935:9f01 with SMTP id z68-20020a623347000000b0053df9359f01mr2574185pfz.8.1663289890115; Thu, 15 Sep 2022 17:58:10 -0700 (PDT) Received: from laputa ([2400:4050:c3e1:100:7508:af96:6167:f80d]) by smtp.gmail.com with ESMTPSA id x22-20020aa79ad6000000b0053e20a0333fsm13498467pfp.93.2022.09.15.17.58.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 15 Sep 2022 17:58:09 -0700 (PDT) Date: Fri, 16 Sep 2022 09:58:05 +0900 From: AKASHI Takahiro To: Heinrich Schuchardt Cc: Simon Glass , Ilias Apalodimas , Masahisa Kojima , u-boot@lists.denx.de Subject: Re: [PATCH 0/2] efi_loader: provide media ID Message-ID: <20220916005805.GA45676@laputa> Mail-Followup-To: AKASHI Takahiro , Heinrich Schuchardt , Simon Glass , Ilias Apalodimas , Masahisa Kojima , u-boot@lists.denx.de References: <20220915200242.18358-1-heinrich.schuchardt@canonical.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20220915200242.18358-1-heinrich.schuchardt@canonical.com> 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.6 at phobos.denx.de X-Virus-Status: Clean On Thu, Sep 15, 2022 at 10:02:40PM +0200, Heinrich Schuchardt wrote: > The medium a device like 'mmc 0' or 'usb 0' points to may change over > time. Hence device type and number are not sufficient to identify the > inserted medium. The same is true for the device path generated for > such a device. Well, it depends on how a device path is generated in U-Boot's UEFI implementation. I believe that a device path represents an "unique path" to a given device however this device is enumerated. In this sense, the current dp_fill()/efi_dp_from_part() is not a right implementation as it relies on device numbers. Furthermore, a generated device path here is different from one generated by EDK2 (even if both software are run on the same board). This is an issue that I used to tackle in https://lists.denx.de/pipermail/u-boot/2021-November/468216.html although I have since had no progress. > This is why the EFI_BLOCK_IO_PROTOCOL provides a field > MediaId. > > Whenever a removable medium is changed or a new block device with a > previously used device path is created we should provide a different > MediaID. > > This series adds a field media_id to the block device descriptor and fills > it after probing. The value of the field is then copied to the > EFI_BLOCK_IO_PROTOCOL. I'm afraid that your patch doesn't always work as you expect. When "scsi rescan" or "usb stop; usb start", for instance, is invoked, all the existing devices and associated blk_desc structures are once freed and even if nothing is changed, i.e. a device is neither removed nor added, the exact same structures will be re-created. With your patch applied, however, a new (and different) "media_id" will be assigned to an existing device. UEFI User may be notified of "media change". (To be honest, this is quite unlikely because the current UEFI implementation doesn't use BLOCK_IO_PROTOCOL internally, say, for file system access.) -Takahiro Akashi > With future patches we can refine this in sub-systems like USB, MMC, SCSI > to indicate media changes > > Heinrich Schuchardt (2): > dm: blk: assign media ID to block devices > efi_loader: fill media_id from block device descriptor > > drivers/block/blk-uclass.c | 16 +++++++++++++++- > include/blk.h | 11 +++++++++++ > lib/efi_loader/efi_disk.c | 6 +----- > 3 files changed, 27 insertions(+), 6 deletions(-) > > -- > 2.37.2 >