From: Mukesh Ojha <mojha@codeaurora.org>
To: keescook@chromium.org, anton@enomsg.org, ccross@android.com,
tony.luck@intel.com, linux-kernel@vger.kernel.org
Cc: "Isaac J. Manjarres" <isaacm@codeaurora.org>,
Mukesh Ojha <mojha@codeaurora.org>
Subject: [PATCH] pstore/ram: Rework logic for detecting ramoops reserved memory region
Date: Fri, 25 Jun 2021 16:47:18 +0530 [thread overview]
Message-ID: <1624619838-2578-1-git-send-email-mojha@codeaurora.org> (raw)
From: "Isaac J. Manjarres" <isaacm@codeaurora.org>
The reserved memory region for ramoops is assumed to be at a fixed
and known location when read from the devicetree. This is not desirable
in environments where it is preferred for the region to be dynamically
allocated at runtime, as opposed to it being fixed at compile time.
Change the logic for detecting the start and size of the ramoops
memory region by looking up the reserved memory region instead of
using platform_get_resource(), which assumes that the location
of the memory is known ahead of time.
Signed-off-by: Isaac J. Manjarres <isaacm@codeaurora.org>
Signed-off-by: Mukesh Ojha <mojha@codeaurora.org>
---
fs/pstore/ram.c | 11 ++++++-----
1 file changed, 6 insertions(+), 5 deletions(-)
diff --git a/fs/pstore/ram.c b/fs/pstore/ram.c
index fefe3d3..5f90455 100644
--- a/fs/pstore/ram.c
+++ b/fs/pstore/ram.c
@@ -21,6 +21,7 @@
#include <linux/pstore_ram.h>
#include <linux/of.h>
#include <linux/of_address.h>
+#include <linux/of_reserved_mem.h>
#include "internal.h"
#define RAMOOPS_KERNMSG_HDR "===="
@@ -633,21 +634,21 @@ static int ramoops_parse_dt(struct platform_device *pdev,
{
struct device_node *of_node = pdev->dev.of_node;
struct device_node *parent_node;
- struct resource *res;
+ struct reserved_mem *rmem;
u32 value;
int ret;
dev_dbg(&pdev->dev, "using Device Tree\n");
- res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
- if (!res) {
+ rmem = of_reserved_mem_lookup(of_node);
+ if (!rmem) {
dev_err(&pdev->dev,
"failed to locate DT /reserved-memory resource\n");
return -EINVAL;
}
- pdata->mem_size = resource_size(res);
- pdata->mem_address = res->start;
+ pdata->mem_size = rmem->size;
+ pdata->mem_address = rmem->base;
/*
* Setting "unbuffered" is deprecated and will be ignored if
* "mem_type" is also specified.
--
Qualcomm India Private Limited, on behalf of Qualcomm Innovation Center,
Inc. is a member of the Code Aurora Forum, a Linux Foundation Collaborative Project
next reply other threads:[~2021-06-25 11:18 UTC|newest]
Thread overview: 2+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-06-25 11:17 Mukesh Ojha [this message]
2021-07-05 10:39 ` Mukesh Ojha
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=1624619838-2578-1-git-send-email-mojha@codeaurora.org \
--to=mojha@codeaurora.org \
--cc=anton@enomsg.org \
--cc=ccross@android.com \
--cc=isaacm@codeaurora.org \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=tony.luck@intel.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®