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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 79C08C433F5 for ; Mon, 1 Nov 2021 00:36:17 +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 9A77460F24 for ; Mon, 1 Nov 2021 00:36:16 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 9A77460F24 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.denx.de Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 2384A82D85; Mon, 1 Nov 2021 01:36:14 +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="qyVDglyv"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id E7D8E83323; Mon, 1 Nov 2021 01:36:11 +0100 (CET) Received: from mail-pj1-x1030.google.com (mail-pj1-x1030.google.com [IPv6:2607:f8b0:4864:20::1030]) (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 1800D82982 for ; Mon, 1 Nov 2021 01:36:07 +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-x1030.google.com with SMTP id np3so767773pjb.4 for ; Sun, 31 Oct 2021 17:36:06 -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:in-reply-to; bh=A2ZcF9DXfoQGX76arSWTBNDB9U3BU88q0ugegk4AxmU=; b=qyVDglyvvbOrbk6GttucX8eDRxeDR65XZXzk0SXMrAoN4/s5m6shTol3mr8II5VETJ aMV/kBB2ySGP/AxETI6SEDfL4BO91zEDVjU4RqZWjYqXZ4EPX5Wo9ry/7z0uNpGmNJHe YdB2gfSE0eZi3Q/qZXMbg+Qvi+r09v1cTGw3KEyyxD6FlX6XiC1OclS8Y9y8PnC1Mbmk VIqLNFq4vO8lF7/7O3mwI9Y2nc1jjbMpyJ2arzOSUTaA9xwfxykvuiqnONiAosI4jk55 yDZrcW1/eSoHRc2Toihf6MOEbo1JIW40N7SSaHv1t4J/w6K351cSCmNf24gtJGAI+ivO F1sQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id :mail-followup-to:references:mime-version:content-disposition :in-reply-to; bh=A2ZcF9DXfoQGX76arSWTBNDB9U3BU88q0ugegk4AxmU=; b=LdlWEXw7yHvlsPoCdTClCG/W1Rzr8U52Stj16mzEqzSMno0vQm4IZf6RaIWR+CYN6W COao7zHiy68DBv/wIYrN9ry531uZh7kRusWwZrFgww0+DLVSFlE87arHUJPwgqfmBEkk 3FTKMFJWYc/+QNM7K4ROnIItyeE5rZiOUCou0aDDzHjRnWkAMkGYReH524DQJGsAOBad 7QbQJW+snYHc1AlOQwQP0U1M2UBROOZ3A8IQfSz6La31XCfmpyubyTXD8SXKQLWg5Nq5 shjc86JMabPdN1pGi+7/4IRGj6/k31ec/kkCOrSlKz92dCPriXhmS/fqLDg9D7ZB8Gh8 vgGg== X-Gm-Message-State: AOAM531RA0bq7tVlRg1Uhk82bakXEsXGzMM85oclzbZpnhBRtCab9yfC bkfrKO5E+jScShoOb8EXN1Pm8A== X-Google-Smtp-Source: ABdhPJyuirz5DciMa++pbsVx1k+hTnyIB5V9P9LlNNxO/a+/gbp3WLT3vFXfm+83pZG7vNT5ni+UIw== X-Received: by 2002:a17:90b:3717:: with SMTP id mg23mr7722989pjb.107.1635726965078; Sun, 31 Oct 2021 17:36:05 -0700 (PDT) Received: from laputa ([2400:4050:c3e1:100:dc0a:c58e:bb9a:563a]) by smtp.gmail.com with ESMTPSA id 145sm5889926pfx.87.2021.10.31.17.36.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 31 Oct 2021 17:36:04 -0700 (PDT) Date: Mon, 1 Nov 2021 09:36:00 +0900 From: AKASHI Takahiro To: Heinrich Schuchardt Cc: Simon Glass , Tom Rini , U-Boot Mailing List , Ilias Apalodimas , Alex Graf Subject: Re: [RFC 07/22] dm: blk: add UCLASS_PARTITION Message-ID: <20211101003600.GB25300@laputa> Mail-Followup-To: AKASHI Takahiro , Heinrich Schuchardt , Simon Glass , Tom Rini , U-Boot Mailing List , Ilias Apalodimas , Alex Graf References: <20211014080316.GA22860@laputa> <20211028085217.GA98815@laputa> <111f3160-3b5e-302e-c0ca-86c66093207e@gmx.de> <20211029061556.GD33977@laputa> 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.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.103.2 at phobos.denx.de X-Virus-Status: Clean On Sat, Oct 30, 2021 at 07:45:14AM +0200, Heinrich Schuchardt wrote: > > > Am 29. Oktober 2021 23:17:56 MESZ schrieb Simon Glass : > >Hi, > > > >On Fri, 29 Oct 2021 at 13:26, Heinrich Schuchardt wrote: > >> > >> > >> > >> Am 29. Oktober 2021 08:15:56 MESZ schrieb AKASHI Takahiro : > >> >On Fri, Oct 29, 2021 at 06:57:24AM +0200, Heinrich Schuchardt wrote: > >> >> > >> >> > >> >> > I agree with Heinrich that we are better to leave BLK as it is, both > >> >> > in name and meaning. I think maybe I am missing the gist of your > >> >> > argument. > >> >> > > >> >> > If we use UCLASS_PART, for example, can we have that refer to both s/w > >> >> > and h/w partitions, as Herinch seems to allude to below? What would > >> >> > the picture look like the, and would it get us closer to agreement? > >> >> > >> >> In the driver model: > >> >> > >> >> A UCLASS is a class of drivers that share the same interface. > >> >> A UDEVICE is a logical device that belongs to exactly one UCLASS and is > >> >> accessed through this UCLASS's interface. > >> > > >> >Please be careful about "accessed through" which is a quite confusing > >> >expression. I don't always agree with this view. > >> > > >> >> A hardware partition is an object that exposes only a single interface > >> >> for block IO. > >> >> > >> >> A software partition is an object that may expose two interfaces: one > >> >> for block IO, the other for file IO. > >> > > >> >Are you talking about UEFI world or U-Boot? > >> >Definitely, a hw partitions can provide a file system > >> >if you want. > >> >It's a matter of usage. > >> > > >> >I remember that we had some discussion about whether block devices > >> >on UEFI system should always have a (sw) partition table or not. > >> >But it is a different topic. > >> > > >> >> The UEFI model does not have a problem with this because on a handle you > >> >> can install as many different protocols as you wish. But U-Boot's driver > >> >> model only allows a single interface per device. Up to now U-Boot has > >> >> overcome this limitation by creating child devices for the extra interfaces. > >> > > >> >> We have the following logical levels: > >> >> > >> >> Controller | Block device | Software Partition| File system > >> >> ----------------+--------------+-------------------+------------ > >> >> NVMe Drive | Namespace | Partition 1..n | FAT, EXT4 > >> >> ATA Controller | ATA-Drive | | > >> >> SCSI Controller | LUN | | > >> >> MMC Controller | HW-Partition | | > >> >> MMC Controller | SD-Card | | > >> >> USB-Node | USB-Drive | | > >> >> > >> >> In the device tree this could be modeled as: > >> >> > >> >> |-- Controller (UCLASS_CTRL) > >> >> | |-- Block device / HW Partition (UCLASS_BLK) (A) > >> >> | | |-- Partition table (UCLASS_PARTITION_TABLE) (B) > >> >> | | |-- Software Partition (UCLASS_BLK) > >> >> | | |-- File system (UCLASS_FS) > >> >> | | > >> >> | |-- Block device (UCLASS_BLK) > >> >> | |-- File system (UCLASS_FS) > >> > > >> >I don't know why we expect PARTITION_TABLE and FS to appear in DM tree. > >> >What is the benefit? > >> >(A) and (B) always have 1:1 relationship. > >> > >> No. You can have a bare device without a partition table. > > > >I can have a DOS partition that covers the whole device, without a > >partition table. This is supported in U-Boot and Linux. > > > >> > >> We have several partition table drivers: DOS, GPT, OSX, ... . In future we should also have one for the NOR Flash partitions. All of these drivers have a common interface. As the partition table type is mostly independent of the block device type we should use separate uclasses and udevices. > >> > >> >I also remember that you claimed that not all efi objects(handles and > >> >protocols like SIMPE_FILE_SYSTEM_PROTOCOL) need to have corresponding > >> >U-Boot counterparts in our 2019 discussion. > >> > > >> >If we *need* PARTITION_TALBLE, why don't we have HW_PARTITION_TABLE, > >> >which should support other type of hw partitions as well? > >> > >> How hardware partitions, LUNs, ATA drives are enumerated is specific to the type of controller while the type of software partition table is independent of the block device. > >> > >> > > >> >|-- eMMC controller (UCLASS_MMC) > >> >| |-- eMMC device1 / Physical media (UCLASS_HW_PARTITION_TABLE?) > >> >| |-- Block device / HW Partition:user data (UCLASS_BLK) > >> >| | |-- Partition table (UCLASS_PARTITION_TABLE) > >> >| | |-- Software Partition (UCLASS_BLK) > >> >| | |-- File system (UCLASS_FS) > >> >| | > >> >| |-- Block device / HW Partition:boot0 (UCLASS_BLK) > >> >| |-- Block device / HW Partition:boot1 (UCLASS_BLK) > >> > ... > >> >| |-- eMMC device2 / Physical media (UCLASS_HW_PARTITION_TABLE?) > >> > > >> >|-- scsi controller (UCLASS_SCSI) > >> >| |-- scsi disk / Physical media (UCLASS_HW_PARTITION_TABLE?) > >> >| |-- scsi LUN1 (UCLASS_HW_PARTITION_TABLE?) > >> >| | |-- Partition table (UCLASS_PARTITION_TABLE) > >> >| | |-- Software Partition (UCLASS_BLK) > >> >| |-- scsi LUN2 (UCLASS_HW_PARTITION_TABLE?) > >> > ... > >> > > >> >(Here I ignored scsi buses/channels which make things more complicated.) > >> > > >> >This kind of complex hierarchy doesn't benefit anybody. > >> > >> All these levels exist already. We simply do not model them yet in the DM way. > >> > >> The device tree depth is the outcome of the udevice exposing always only a single interface defined by the uclass. > >> > >> The UEFI design allows installing multiple protocol interfaces on a single handle. This may result in simpler device trees in some cases. > > > >Yes, the complexity has to go somewhere. With driver model I chose to > >have a single interface per uclass, since it is simpler to understand, > >no need to request a protocol for a device, etc. > > > >Our current setup is similar to this > > > >|-- Controller (UCLASS_MMC) > >| |-- Block device (UCLASS_BLK) - 'usual' HW partition > >| |-- Block device (UCLASS_BLK) - e.g. for a different HW partition* > > > >* although I don't think the MMC code actually supports it - SCSI does though > > > >We want to add devices for the partition table and the filesystem, so could do: > > > >|-- Controller (UCLASS_MMC) > >| |-- Block device (UCLASS_BLK) - 'usual' HW partition (the whole device) > >| | |-- Partition table (UCLASS_PART) - DOS partition (or EFI) > >| | | |-- Block device (UCLASS_BLK) - partition 1 > >| | | | |-- Filesystem (UCLASS_FS) - DOS filesystem > >| | | |-- Block device (UCLASS_BLK) - partition 2 > >| | | | |-- Filesystem (UCLASS_FS) - ext5 filesystem > >| |-- Block device (UCLASS_BLK) - e.g. for a different HW > >partition (the whole device) > > > >This is similar to Heinrich's, but without the top-level > >UCLASS_HW_PARTITION_TABLE which I am not sure is necessary. > > Are further MMC hw partitions, multiple SCSI LUNs and multiple NVME namespaces already treated as separate BLK devices? Yes. What I meant to say is that, if we don't need a partition table 'udevice' for hw partitions, we don't need such a device for sw partitions neither. Meanwhile, what about UCLASS_FS? Why do we need this? -Takahiro Akashi > Regards > > Heinrich > > > > > >It is compatible with what we have now and we could enable/disable the > >extra devices with a Kconfig. > > > >Regards, > >Simon > > > > > > > >> > > >> >> UCLASS_PARTITION_TABLE would be for the drivers in disk/. > >> >> UCLASS_FS would be for the drivers in fs/. > >> >> UCLASS_BLK will be for any objects exposing raw block IO. A software > >> >> partition does the same. It is created by the partition table driver as > >> >> child of the partition table udevice. > >> >> > >> >> In this model an eMMC device will not be a UCLASS_BLK device because it > >> >> does not expose block IO. It is the hardware partition that exposes this > >> >> interface. > >> >> > >> >> The suggested model will allow a clean description of nested partition > >> >> tables. > >> >> > >> >> In the UEFI world the software partition and its file system must be > >> >> mapped to a single handle with device path node type HD(). For the > >> >> parent block device we may create a child handle with partition number 0 > >> >> (HD(0)). For the partition table we will not create a handle. > >> >> > >> >> Best regards > >> >> > >> >> Heinrich