From: Michael Ellerman <mpe@ellerman.id.au>
To: Anton Blanchard <anton@samba.org>
Cc: paulus@samba.org, linuxppc-dev@lists.ozlabs.org,
Ulrich.Weigand@de.ibm.com
Subject: Re: [PATCH 8/8] powerpc: Fix endian issues in crash dump code
Date: Wed, 18 Dec 2013 15:45:27 +1100 [thread overview]
Message-ID: <1387341927.20735.1.camel@concordia> (raw)
In-Reply-To: <1386824381-14032-9-git-send-email-anton@samba.org>
On Thu, 2013-12-12 at 15:59 +1100, Anton Blanchard wrote:
> A couple more device tree properties that need byte swapping.
>
> Signed-off-by: Anton Blanchard <anton@samba.org>
> ---
> arch/powerpc/kernel/crash_dump.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/arch/powerpc/kernel/crash_dump.c b/arch/powerpc/kernel/crash_dump.c
> index 779a78c..11c1d06 100644
> --- a/arch/powerpc/kernel/crash_dump.c
> +++ b/arch/powerpc/kernel/crash_dump.c
> @@ -124,15 +124,15 @@ ssize_t copy_oldmem_page(unsigned long pfn, char *buf,
> void crash_free_reserved_phys_range(unsigned long begin, unsigned long end)
> {
> unsigned long addr;
> - const u32 *basep, *sizep;
> + const __be32 *basep, *sizep;
> unsigned int rtas_start = 0, rtas_end = 0;
>
> basep = of_get_property(rtas.dev, "linux,rtas-base", NULL);
> sizep = of_get_property(rtas.dev, "rtas-size", NULL);
>
> if (basep && sizep) {
> - rtas_start = *basep;
> - rtas_end = *basep + *sizep;
> + rtas_start = be32_to_cpup(basep);
> + rtas_end = rtas_start + be32_to_cpup(sizep);
> }
>
> for (addr = begin; addr < end; addr += PAGE_SIZE) {
Not my favourite colour :D What about this instead?
We could also add of_property_read_u32(), with an implied index of zero?
I don't like the rc handling, but couldn't come up with anything I liked
better.
cheers
diff --git a/arch/powerpc/kernel/crash_dump.c b/arch/powerpc/kernel/crash_dump.c
index 11c1d06..60fd0aa 100644
--- a/arch/powerpc/kernel/crash_dump.c
+++ b/arch/powerpc/kernel/crash_dump.c
@@ -124,15 +124,16 @@ ssize_t copy_oldmem_page(unsigned long pfn, char *buf,
void crash_free_reserved_phys_range(unsigned long begin, unsigned long end)
{
unsigned long addr;
- const __be32 *basep, *sizep;
+ u32 base, size;
unsigned int rtas_start = 0, rtas_end = 0;
+ int rc;
- basep = of_get_property(rtas.dev, "linux,rtas-base", NULL);
- sizep = of_get_property(rtas.dev, "rtas-size", NULL);
+ rc = of_property_read_u32_index(rtas.dev, "linux,rtas-base", 0, &base);
+ rc |= of_property_read_u32_index(rtas.dev, "rtas-size", 0, &size);
- if (basep && sizep) {
- rtas_start = be32_to_cpup(basep);
- rtas_end = rtas_start + be32_to_cpup(sizep);
+ if (rc == 0) {
+ rtas_start = base;
+ rtas_end = rtas_start + size;
}
for (addr = begin; addr < end; addr += PAGE_SIZE) {
next prev parent reply other threads:[~2013-12-18 4:45 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2013-12-12 4:59 [PATCH 0/8] ppc64 little endian bug fixes Anton Blanchard
2013-12-12 4:59 ` [PATCH 1/8] powerpc: PTRACE_PEEKUSR always returns FPR0 Anton Blanchard
2013-12-12 4:59 ` [PATCH 2/8] powerpc: Fix endian issue in setup-common.c Anton Blanchard
2013-12-12 4:59 ` [PATCH 3/8] powerpc: Fix topology core_id endian issue on LE builds Anton Blanchard
2013-12-12 4:59 ` [PATCH 4/8] powerpc/pseries: Fix endian issues in /proc/ppc64/lparcfg Anton Blanchard
2013-12-12 4:59 ` [PATCH 5/8] powerpc/pseries: Fix endian issues in nvram code Anton Blanchard
2013-12-12 4:59 ` [PATCH 6/8] powerpc/pseries: Fix PCIE link speed endian issue Anton Blanchard
2013-12-12 4:59 ` [PATCH 7/8] powerpc/pseries: Fix endian issues in MSI code Anton Blanchard
2013-12-12 4:59 ` [PATCH 8/8] powerpc: Fix endian issues in crash dump code Anton Blanchard
2013-12-18 4:45 ` Michael Ellerman [this message]
2014-01-22 10:42 ` Anton Blanchard
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=1387341927.20735.1.camel@concordia \
--to=mpe@ellerman.id.au \
--cc=Ulrich.Weigand@de.ibm.com \
--cc=anton@samba.org \
--cc=linuxppc-dev@lists.ozlabs.org \
--cc=paulus@samba.org \
/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;
as well as URLs for NNTP newsgroup(s).