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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id AEFF9EE6433 for ; Fri, 15 Sep 2023 08:02:00 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232355AbjIOICD (ORCPT ); Fri, 15 Sep 2023 04:02:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56664 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230454AbjIOICB (ORCPT ); Fri, 15 Sep 2023 04:02:01 -0400 X-Greylist: delayed 1202 seconds by postgrey-1.37 at lindbergh.monkeyblade.net; Fri, 15 Sep 2023 01:01:55 PDT Received: from 17.mo584.mail-out.ovh.net (17.mo584.mail-out.ovh.net [46.105.41.16]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8C19BAC for ; Fri, 15 Sep 2023 01:01:55 -0700 (PDT) Received: from director2.ghost.mail-out.ovh.net (unknown [10.108.16.216]) by mo584.mail-out.ovh.net (Postfix) with ESMTP id AAD2626F8B for ; Fri, 15 Sep 2023 07:25:48 +0000 (UTC) Received: from ghost-submission-6684bf9d7b-wk657 (unknown [10.110.208.116]) by director2.ghost.mail-out.ovh.net (Postfix) with ESMTPS id 5F6DE1FE5D; Fri, 15 Sep 2023 07:25:48 +0000 (UTC) Received: from RCM-web7.webmail.mail.ovh.net ([151.80.29.19]) by ghost-submission-6684bf9d7b-wk657 with ESMTPSA id f7YJF/wGBGUpJgAAKs0qSA (envelope-from ); Fri, 15 Sep 2023 07:25:48 +0000 MIME-Version: 1.0 Date: Fri, 15 Sep 2023 09:25:48 +0200 From: =?UTF-8?Q?Rafa=C5=82_Mi=C5=82ecki?= To: Florian Fainelli Cc: =?UTF-8?Q?Rafa=C5=82_Mi=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 , Scott Branden Subject: Re: [PATCH] nvmem: brcm_nvram: store a copy of NVRAM content In-Reply-To: <28fad55f-1253-deb2-9615-b32746129664@gmail.com> References: <20230914064922.3986-1-zajec5@gmail.com> <28fad55f-1253-deb2-9615-b32746129664@gmail.com> User-Agent: Roundcube Webmail/1.4.13 Message-ID: <58a017a92ee82f95972b0a14c604f313@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: 503277259095976943 X-VR-SPAMSTATE: OK X-VR-SPAMSCORE: -100 X-VR-SPAMCAUSE: gggruggvucftvghtrhhoucdtuddrgedviedrudejuddguddujecutefuodetggdotefrodftvfcurfhrohhfihhlvgemucfqggfjpdevjffgvefmvefgnecuuegrihhlohhuthemucehtddtnecusecvtfgvtghiphhivghnthhsucdlqddutddtmdenucfjughrpeggfffhvfevufgjfhgfkfigihgtgfesthekjhdttderjeenucfhrhhomheptfgrfhgrlhcuofhilhgvtghkihcuoehrrghfrghlsehmihhlvggtkhhirdhplheqnecuggftrfgrthhtvghrnhepgffhueeihfeitdettdehfefhieefffevkedvgeetteekteejtdeivddvhffgffffnecuffhomhgrihhnpehkvghrnhgvlhdrohhrghenucfkphepuddvjedrtddrtddruddpfedurdduuddrvddukedruddtiedpudehuddrkedtrddvledrudelnecuvehluhhsthgvrhfuihiivgeptdenucfrrghrrghmpehinhgvthepuddvjedrtddrtddruddpmhgrihhlfhhrohhmpeeorhgrfhgrlhesmhhilhgvtghkihdrphhlqedpnhgspghrtghpthhtohepuddprhgtphhtthhopehlihhnuhigqdhkvghrnhgvlhesvhhgvghrrdhkvghrnhgvlhdrohhrghdpoffvtefjohhsthepmhhoheekgedpmhhouggvpehsmhhtphhouhht Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2023-09-14 23:26, 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()? Good idea. Actual NVRAM data usually doesn't take much space, but it reserves quite a lot and we need all of that to full expose NVMEM device content. -- Rafał Miłecki