Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp168486pxj; Thu, 10 Jun 2021 18:20:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw4FgwAoBOVEcR/+Y29QSQoWIth1lwB4iLwACoTvoN0dfpS0qovdw7tKe4iMIITfX9JuP6e X-Received: by 2002:a17:906:6814:: with SMTP id k20mr1057005ejr.455.1623374410685; Thu, 10 Jun 2021 18:20:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623374410; cv=none; d=google.com; s=arc-20160816; b=fR8se8ldY7Q73w8NMp5wcZidmrq2ZKUKoX6WPq75aI5znIh2o48K99DHi5swjj0yMs fHWBmW6jh2F4kniKbXEmJ9DxuqJygFaXwcP0INK8xtu+MWKEteQ05PZJ9S0j9P/U69E2 CpxEuSx8Y4xyJWLxaM5LyBJ9NOip5gDEUhqiLVu6WY1x17/40LFbuWi7W0hig2s5yIPE XW7d423aekoZYfzcUgQuoC0Yyep6rMjjN91EE/b5EqzpPJQFs6XLXBmcNfErcnYttwU1 B9neCDcPI3XW5vgjkcVqxkU1rwifmGuzV6m3NUVrUKdAMgEnhAhrUojt/Bm7c4uI0yD6 lcmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:subject:cc:to:from:date:references:in-reply-to :message-id:mime-version:user-agent:dkim-signature:dkim-signature; bh=4sxdG4q+15yHQGW5lRuvgFSziTf+hurlcQZJNxGSOEQ=; b=Ws6t8YHnaZV00CjJgddLTQmyDrKsmUSS21eL9AuPQbH54+br9Rk6kOcAVZHXDZs8X3 M86HJbBgJqMiL7XjIeep6SGjlG7j3Njz4F4/EjtvoEg6sxHce0VeTFCQWBDAUg48r0av Mc3Kk75/yEiy/bBDkcA8J3/oh7UxwY1rcKPCOp0sPlkQ4LGjZ08MXJUMN+A/4QUYMtcN 5nXGwBjS/9z3wcsTMRw7eqjxTn9sBCfPVWybNH8axo3gR4IyO2gVqPe90+t3RTUrrT5C /CJPvmGZw+4EnZJqQDFWsgrDIPfMIp2883JdY7TNVEqyjDuqxJpjeFR8M/u+nxG01Jxl hsXg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@fastmail.com.au header.s=fm3 header.b=Jq9FWY4M; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=jltkaWtX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=fastmail.com.au Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d4si3713487ejo.252.2021.06.10.18.19.46; Thu, 10 Jun 2021 18:20:10 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@fastmail.com.au header.s=fm3 header.b=Jq9FWY4M; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=jltkaWtX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=fastmail.com.au Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230450AbhFKBTE (ORCPT + 99 others); Thu, 10 Jun 2021 21:19:04 -0400 Received: from wout4-smtp.messagingengine.com ([64.147.123.20]:48825 "EHLO wout4-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230232AbhFKBTD (ORCPT ); Thu, 10 Jun 2021 21:19:03 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id DDE8D1DF6; Thu, 10 Jun 2021 21:17:05 -0400 (EDT) Received: from imap4 ([10.202.2.54]) by compute4.internal (MEProxy); Thu, 10 Jun 2021 21:17:06 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=fastmail.com.au; h=mime-version:message-id:in-reply-to:references:date:from:to :cc:subject:content-type; s=fm3; bh=4sxdG4q+15yHQGW5lRuvgFSziTf+ hurlcQZJNxGSOEQ=; b=Jq9FWY4M1upTIJVLDh/s1xWjGgFyjmLU4seS8WY7qxiz FfAgm02+WnN/rGcHACnas4Tdb3e4rBVwZiECoFd1+fNNGgo1uuNLU4AAfVcHwPSa Y+l6Rz+zBSuXfWJ3KEcDmq8haQUpYdu7Yci4Jr4Ljg7BeBByMNCSF+xK6zMhg7uk tZKvwtansddJ5yoxpDC33wkPm9oP4qCSyeY1kPn8kX1UcC7ADy1GEI+++fwwpR/C xNpFVZPoNPDZKMCAOhBgPuyxPPQJYJ/ro5AQGE+u0F7J0BUoXpMrdruSjaOXJBZ9 nsPi5pb4I3yf4RsFTrp0OkhA2QpDxd2WXqH4Q5GXRA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to:x-me-proxy :x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s=fm3; bh=4sxdG4 q+15yHQGW5lRuvgFSziTf+hurlcQZJNxGSOEQ=; b=jltkaWtXugPkCc4ZCtw/I3 PygpJ4nHPCt07sKPUc8nOXZqPbCoqqlL9ld/Tldk+qbVjrXwoT+Aqa20VpyeVEfm ioTTRlDvbS0KMu0U8XmURcnCl0m7VXsMwP8TMpCy9rqKOJPhIYLFhy2dlEvTuW9Y h80pYvsyGdE6TNhLCS+MC9vitkITdCNZHHjtnpZMB6/kLxixdLdWo6K6mE3NUOQS GXF/1XekotziUHo4I7UhtgtEJWoi8lAVFGnHPvv+uSIvmhSEdZEeDdalnHOJs7vf jNi9YI3PD5Whi/dAcDrilWYLfwvQQgmEixoTvcJeqyCvbXKcJ168F2a8ixSEaekQ == X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgeduledrfeduiedggeefucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucesvcftvggtihhpihgvnhhtshculddquddttddmne cujfgurhepofgfggfkjghffffhvffutgesthdtredtreertdenucfhrhhomhepfdflohhh nhcuvfhhohhmshhonhdfuceoghhithesjhhohhhnthhhohhmshhonhdrfhgrshhtmhgrih hlrdgtohhmrdgruheqnecuggftrfgrthhtvghrnhepffduudeffeegfffghfdvleevudei leelfeegffefgeeileekieeftddvueehffdtnecuvehluhhsthgvrhfuihiivgeptdenuc frrghrrghmpehmrghilhhfrhhomhepghhithesjhhohhhnthhhohhmshhonhdrfhgrshht mhgrihhlrdgtohhmrdgruh X-ME-Proxy: Received: by mailuser.nyi.internal (Postfix, from userid 501) id BBEA816013E; Thu, 10 Jun 2021 21:17:03 -0400 (EDT) X-Mailer: MessagingEngine.com Webmail Interface User-Agent: Cyrus-JMAP/3.5.0-alpha0-519-g27a961944e-fm-20210531.001-g27a96194 Mime-Version: 1.0 Message-Id: <55d28fea-c20e-4e60-8b5b-b5a03ccea0cf@www.fastmail.com> In-Reply-To: <20210610100759.v57c5wa46ky33waj@ti.com> References: <20210608040719.14431-1-git@johnthomson.fastmail.com.au> <20210610100759.v57c5wa46ky33waj@ti.com> Date: Fri, 11 Jun 2021 01:15:24 +0000 From: "John Thomson" To: "Pratyush Yadav" Cc: "Miquel Raynal" , "Richard Weinberger" , "Vignesh Raghavendra" , "Tudor Ambarus" , "Michael Walle" , linux-mtd@lists.infradead.org, linux-kernel@vger.kernel.org, "kernel test robot" , "Dan Carpenter" Subject: Re: [PATCH] mtd: spi-nor: write support for minor aligned partitions Content-Type: text/plain Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 10 Jun 2021, at 10:08, Pratyush Yadav wrote: > On 08/06/21 02:07PM, John Thomson wrote: > > Do not prevent writing to mtd partitions where a partition boundary sits > > on a minor erasesize boundary. > > This addresses a FIXME that has been present since the start of the > > linux git history: > > /* Doesn't start on a boundary of major erase size */ > > /* FIXME: Let it be writable if it is on a boundary of > > * _minor_ erase size though */ > > > > Allow a uniform erase region spi-nor device to be configured > > to use the non-uniform erase regions code path for an erase with: > > CONFIG_MTD_SPI_NOR_USE_VARIABLE_ERASE=y > > > > On supporting hardware (SECT_4K: majority of current SPI-NOR device) > > provide the facility for an erase to use the least number > > of SPI-NOR operations, as well as access to 4K erase without > > requiring CONFIG_MTD_SPI_NOR_USE_4K_SECTORS > > > > Introduce erasesize_minor to the mtd struct, > > the smallest erasesize supported by the device > > Instead of having just a major and minor erase size, wouldn't it make > more sense to have a list of all supported erases on a sector? That is, > instead of hard coding two erase size instead of one, how about > generalizing the erase machinery to allow any number of erase sizes on a > sector and then choosing the most efficient one on run time? > > For example, imagine a device can support 4K, 64K, and 256K erases on > each sector. Then you should be able to use 2 x 4K erases if you want to > erase 8K, 2 x 64K + 1 x 4K erases for 132K and so on. Thank for you the feedback Pratyush, Yes, this is what I am attempting to do. mtdpart only sets if the partition can be writeable, it does not do the erasing. Due to this, I thought that only the smallest erasesize should matter to mtdpart. The erase is carried out by the mtd device, so for an SPI-NOR device, spi_nor_erase_multi_sectors can be used to select and action the best combination of erases. This is done by this patch when CONFIG_MTD_SPI_NOR_USE_VARIABLE_ERASE=y Cheers, -- John Thomson