[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <58a017a92ee82f95972b0a14c604f313@milecki.pl>
Date: Fri, 15 Sep 2023 09:25:48 +0200
From: Rafał Miłecki <rafal@...ecki.pl>
To: Florian Fainelli <f.fainelli@...il.com>
Cc: Rafał Miłecki <zajec5@...il.com>,
Srinivas Kandagatla <srinivas.kandagatla@...aro.org>,
linux-mtd@...ts.infradead.org,
linux-arm-kernel@...ts.infradead.org, linux-kernel@...r.kernel.org,
Arınç ÜNAL <arinc.unal@...nc9.com>,
Florian Fainelli <florian.fainelli@...adcom.com>,
Scott Branden <scott.branden@...adcom.com>
Subject: Re: [PATCH] nvmem: brcm_nvram: store a copy of NVRAM content
On 2023-09-14 23:26, Florian Fainelli wrote:
> On 9/13/23 23:49, Rafał Miłecki wrote:
>> From: Rafał Miłecki <rafal@...ecki.pl>
>>
>> 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 <arinc.unal@...nc9.com>
>> Cc: Florian Fainelli <florian.fainelli@...adcom.com>
>> Cc: Scott Branden <scott.branden@...adcom.com>
>> Signed-off-by: Rafał Miłecki <rafal@...ecki.pl>
>> ---
> [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
Powered by blists - more mailing lists