Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp4400976rdb; Fri, 15 Sep 2023 00:28:40 -0700 (PDT) X-Google-Smtp-Source: AGHT+IEYqxeeDfA8exCUy70O5b99zI2NNZKnS4TP2VaxxERoXJzqeFZtvVsxxpYO5v/nErU9zIQn X-Received: by 2002:a17:902:d2cd:b0:1c3:e5bf:a9f8 with SMTP id n13-20020a170902d2cd00b001c3e5bfa9f8mr1073743plc.19.1694762919693; Fri, 15 Sep 2023 00:28:39 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694762919; cv=none; d=google.com; s=arc-20160816; b=Oa9XHFXXH9ZLy6RmNUdo90W3hZ0CsQnH9ymX6bBj/SbdvATOOpCT10sUmqFf+KetxY wMbgjlp2WfKpksl+HdGq1w/DXGTTnNjvbZJnciYgghluAjCFbitvjgVAYdkD8oEIQKcu KmVvVTgO5HggS69bmGw2PjreOhtyOZ0anqFTLz6VOMWRZoew9ZZ+qKHwL/OTq5FqIETU 6oLI29ak9UuyZm5xn4AV5d7FF11YQ0o6CD2ZVxG8q4y2bMBj32Rsz4VmIPJaBftNsMR9 4l1rB5AeLCiNtKWooEnhxslsG4YcuCh5e2nb0BSH8A4zGgGz4/Gdl3aZg4PSNoxx9oAK BGgw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:message-id:user-agent :references:in-reply-to:subject:cc:to:from:date:mime-version; bh=p9f18GB7KuBpZyc10N5HA7wh+f6cafqbqsTdpB9i/kQ=; fh=Qotc+b0wb+3Cu647kqddmS5R1VwOwWYx58Z++Eya+NA=; b=zi4UkVd+MQjLrGMFQOBxXX0QXXQ5rSitifF2ddGfg0oMED+Ke19NraN/P8379WVqz6 bm6QTr4lJRX2M8HVrZbTWAYkzqyeqvv/Hnyt+TTRLfVOjqz852bV7ZF8T6Fac7CUR0PJ 41/OkG2w2YoG0QsPzpIVR0J3OvH7JWQ17rtjHu0atelbMjgMw1Euytjkq77lFJcH0LPi CLcrA2TTIYYypcSRnUrtWVVeaE2gvI47QaUgXC0gtOZHGX41A2L20pKStDUjdq7kij5w K0NOffJ2Qm+uNxsAwD92NzTHMLfGC2piNtx/925uNa/ZjG2SLtljhGunDJmhv3DSTZou pUdA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from fry.vger.email (fry.vger.email. [2620:137:e000::3:8]) by mx.google.com with ESMTPS id s12-20020a170903200c00b001b829a32f2dsi2827354pla.457.2023.09.15.00.28.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Sep 2023 00:28:39 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) client-ip=2620:137:e000::3:8; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:8 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by fry.vger.email (Postfix) with ESMTP id 61EA6839233E; Fri, 15 Sep 2023 00:28:37 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at fry.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232400AbjIOH2h (ORCPT + 99 others); Fri, 15 Sep 2023 03:28:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58388 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229767AbjIOH2g (ORCPT ); Fri, 15 Sep 2023 03:28:36 -0400 Received: from 1.mo576.mail-out.ovh.net (1.mo576.mail-out.ovh.net [178.33.251.173]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8CF5E19A5 for ; Fri, 15 Sep 2023 00:28:23 -0700 (PDT) Received: from director3.ghost.mail-out.ovh.net (unknown [10.109.138.157]) by mo576.mail-out.ovh.net (Postfix) with ESMTP id A629526D12 for ; Fri, 15 Sep 2023 07:28:21 +0000 (UTC) Received: from ghost-submission-6684bf9d7b-kmpnv (unknown [10.110.171.251]) by director3.ghost.mail-out.ovh.net (Postfix) with ESMTPS id 863E91FEBC; Fri, 15 Sep 2023 07:28:20 +0000 (UTC) Received: from RCM-web7.webmail.mail.ovh.net ([151.80.29.19]) by ghost-submission-6684bf9d7b-kmpnv with ESMTPSA id 3NYNH5QHBGUBRAAAnwAMdg (envelope-from ); Fri, 15 Sep 2023 07:28:20 +0000 MIME-Version: 1.0 Date: Fri, 15 Sep 2023 09:28:20 +0200 From: =?UTF-8?Q?Rafa=C5=82_Mi=C5=82ecki?= To: Scott Branden Cc: Florian Fainelli , =?UTF-8?Q?Rafa=C5=82_Mi?= =?UTF-8?Q?=C5=82ecki?= , Srinivas Kandagatla , linux-mtd@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, =?UTF-8?Q?Ar=C4=B1n=C3=A7_=C3=9CNAL?= , Florian Fainelli Subject: Re: [PATCH] nvmem: brcm_nvram: store a copy of NVRAM content In-Reply-To: References: <20230914064922.3986-1-zajec5@gmail.com> <28fad55f-1253-deb2-9615-b32746129664@gmail.com> User-Agent: Roundcube Webmail/1.4.13 Message-ID: <24ab9df46703695cfa7402695a5dc5a2@milecki.pl> X-Sender: rafal@milecki.pl X-Originating-IP: 31.11.218.106 X-Webmail-UserID: rafal@milecki.pl Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit X-Ovh-Tracer-Id: 546342932523559692 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedviedrudejuddguddukecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemucehtddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpeggfffhvfevufgjfhgfkfigihgtgfesthekjhdttderjeenucfhrhhomheptfgrfhgrlhcuofhilhgvtghkihcuoehrrghfrghlsehmihhlvggtkhhirdhplheqnecuggftrfgrthhtvghrnhepgffhueeihfeitdettdehfefhieefffevkedvgeetteekteejtdeivddvhffgffffnecuffhomhgrihhnpehkvghrnhgvlhdrohhrghenucfkphepuddvjedrtddrtddruddpfedurdduuddrvddukedruddtiedpudehuddrkedtrddvledrudelnecuvehluhhsthgvrhfuihiivgepudenucfrrghrrghmpehinhgvthepuddvjedrtddrtddruddpmhgrihhlfhhrohhmpeeorhgrfhgrlhesmhhilhgvtghkihdrphhlqedpnhgspghrtghpthhtohepuddprhgtphhtthhopehlihhnuhigqdhkvghrnhgvlhesvhhgvghrrdhkvghrnhgvlhdrohhrghdpoffvtefjohhsthepmhhoheejiedpmhhouggvpehsmhhtphhouhht X-Spam-Status: No, score=-0.8 required=5.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on fry.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (fry.vger.email [0.0.0.0]); Fri, 15 Sep 2023 00:28:37 -0700 (PDT) On 2023-09-14 23:30, Scott Branden wrote: > On Thu, Sep 14, 2023 at 2:26 PM Florian Fainelli > wrote: >> >> On 9/13/23 23:49, Rafał Miłecki wrote: >> > From: Rafał Miłecki >> > >> > This driver uses MMIO access for reading NVRAM from a flash device. >> > Underneath there is a flash controller that reads data and provides >> > mapping window. >> > >> > Using MMIO interface affects controller configuration and may break real >> > controller driver. It was reported by multiple users of devices with >> > NVRAM stored on NAND. >> > >> > Modify driver to read & cache all NVRAM content during init and use that >> > copy to provide NVMEM data when requested. >> > >> > Link: https://lore.kernel.org/linux-mtd/CACna6rwf3_9QVjYcM+847biTX=K0EoWXuXcSMkJO1Vy_5vmVqA@mail.gmail.com/ >> > Cc: Arınç ÜNAL >> > Cc: Florian Fainelli >> > Cc: Scott Branden >> > Signed-off-by: Rafał Miłecki >> > --- >> [snip] >> > - priv->base = devm_platform_get_and_ioremap_resource(pdev, 0, &res); >> > - if (IS_ERR(priv->base)) >> > - return PTR_ERR(priv->base); >> > + base = devm_platform_get_and_ioremap_resource(pdev, 0, &res); >> > + if (IS_ERR(base)) >> > + return PTR_ERR(base); >> > + >> > + priv->size = resource_size(res); >> > + >> > + priv->data = devm_kzalloc(dev, priv->size, GFP_KERNEL); >> >> These can conceivably quite big data structures, how about using >> kvmalloc()? > Why do we even need to expose MMIO interface to NAND though? Why not > always go through the controller driver. I don't see how the MMIO > access would be used given bad blocks aren't handled? We need to read NVMRAM *early* for booting purposes. Some vendors store there information about used firmware in case of having main one and fallback one. That info is required for partitioning which happens during mtd initialization before we have NAND driver fully initialized. -- Rafał Miłecki