grub-devel.gnu.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Kiper <dkiper@net-space.pl>
To: Stefan Berger <stefanb@linux.ibm.com>
Cc: grub-devel@gnu.org, hbathini@linux.ibm.com, pavrampu@in.ibm.com,
	mpe@ellerman.id.au, cpscherr@us.ibm.com, mahesh@linux.ibm.com,
	sourabhjain@linux.ibm.com, avnish.chouhan@ibm.com
Subject: Re: [PATCH v7 00/10] ppc64: Restrict memory allocations for kernel and initrd
Date: Thu, 30 Nov 2023 14:44:31 +0100	[thread overview]
Message-ID: <20231130134431.cabb7wdbrkjqrpzt@tomti.i.net-space.pl> (raw)
In-Reply-To: <20231127115853.718827-1-stefanb@linux.ibm.com>

On Mon, Nov 27, 2023 at 06:58:43AM -0500, Stefan Berger wrote:
> This series of patches converts the PowerPC ieee1275 memory allocator
> for kernel and initrd to use the (PowerPC) regions_claim memory allocator
> that takes into account memory regions that are not allowed to be used,
> such as the gap between 640MB and 768MB as well as memory regions beyond
> an address in case an fadump is present. Otherwise those two could be
> loaded into restricted memory regions and either cause a crash or
> corruption of the fadump.
> 
> I adjusted the kernel and initrd load in loader/powerpc/ieee1275 to use
> the new memory allocator only on PowerVM and PowerKVM since this code is
> shared with other platforms, such as old PowerMACs and i386.

This time the patch set breaks SPARC build... :-( I am attaching the
patch which fixes it and then all builds pass. Please merge the fix
into your patch set and resend it.

Daniel

diff --git a/grub-core/kern/ieee1275/ieee1275.c b/grub-core/kern/ieee1275/ieee1275.c
index fef3ccf1a..36ca2dbfc 100644
--- a/grub-core/kern/ieee1275/ieee1275.c
+++ b/grub-core/kern/ieee1275/ieee1275.c
@@ -590,8 +590,9 @@ grub_ieee1275_claim (grub_addr_t addr, grub_size_t size, unsigned int align,
     *result = args.base;
   if (args.base == IEEE1275_CELL_INVALID)
     return -1;
-  grub_dprintf ("mmap", "CLAIMED: 0x%x (%d MiB)  size: %d MiB\n",
-		args.base, args.base >> 20, ALIGN_UP(size, 1 << 20) >> 20);
+  grub_dprintf ("mmap", "CLAIMED: 0x%" PRIxGRUB_IEEE1275_CELL_T " (%"
+		PRIuGRUB_IEEE1275_CELL_T " MiB)  size: %" PRIuGRUB_SIZE " MiB\n",
+		args.base, args.base >> 20, ALIGN_UP (size, 1 << 20) >> 20);
   return 0;
 }
 
diff --git a/include/grub/powerpc/ieee1275/ieee1275.h b/include/grub/powerpc/ieee1275/ieee1275.h
index 3c7683fad..4eb207018 100644
--- a/include/grub/powerpc/ieee1275/ieee1275.h
+++ b/include/grub/powerpc/ieee1275/ieee1275.h
@@ -25,4 +25,7 @@
 #define GRUB_IEEE1275_CELL_SIZEOF 4
 typedef grub_uint32_t grub_ieee1275_cell_t;
 
+#define PRIxGRUB_IEEE1275_CELL_T	PRIxGRUB_UINT32_T
+#define PRIuGRUB_IEEE1275_CELL_T	PRIuGRUB_UINT32_T
+
 #endif /* ! GRUB_IEEE1275_MACHINE_HEADER */
diff --git a/include/grub/sparc64/ieee1275/ieee1275.h b/include/grub/sparc64/ieee1275/ieee1275.h
index 4b18468d8..ccc71aac6 100644
--- a/include/grub/sparc64/ieee1275/ieee1275.h
+++ b/include/grub/sparc64/ieee1275/ieee1275.h
@@ -25,6 +25,9 @@
 #define GRUB_IEEE1275_CELL_SIZEOF 8
 typedef grub_uint64_t grub_ieee1275_cell_t;
 
+#define PRIxGRUB_IEEE1275_CELL_T	PRIxGRUB_UINT64_T
+#define PRIuGRUB_IEEE1275_CELL_T	PRIuGRUB_UINT64_T
+
 /* Encoding of 'mode' argument to grub_ieee1275_map_physical() */
 #define IEEE1275_MAP_WRITE	0x0001 /* Writable */
 #define IEEE1275_MAP_READ	0x0002 /* Readable */

_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

      parent reply	other threads:[~2023-11-30 13:45 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-27 11:58 [PATCH v7 00/10] ppc64: Restrict memory allocations for kernel and initrd Stefan Berger
2023-11-27 11:58 ` [PATCH v7 01/10] kern/ieee1275/init: ppc64: Introduce a request for regions_claim Stefan Berger
2023-11-27 11:58 ` [PATCH v7 02/10] kern/ieee1275/init: ppc64: Decide by request whether to initialize region Stefan Berger
2023-11-27 11:58 ` [PATCH v7 03/10] kern/ieee1275/init: ppc64: Return allocated address using context Stefan Berger
2023-11-27 11:58 ` [PATCH v7 04/10] kern/ieee1275/init: ppc64: Add support for alignment requirements Stefan Berger
2023-11-27 11:58 ` [PATCH v7 05/10] kern/ieee1275/init: ppc64: Rename regions_claim to grub_regions_claim Stefan Berger
2023-11-27 11:58 ` [PATCH v7 06/10] kern/ieee1275/cmain: ppc64: Introduce flags to identify KVM and Power VM Stefan Berger
2023-11-27 11:58 ` [PATCH v7 07/10] loader/powerpc/ieee1275: Use new allocation function for kernel and initrd Stefan Berger
2023-11-27 11:58 ` [PATCH v7 08/10] kern/ieee1275/ieee1275: debug: Display successful memory claims Stefan Berger
2023-11-27 11:58 ` [PATCH v7 09/10] kern/ieee1275/init: ppc64: Fix a comment Stefan Berger
2023-11-27 11:58 ` [PATCH v7 10/10] kern/ieee1275/init: ppc64: Display upper_mem_limit for debugging Stefan Berger
2023-11-27 12:10 ` [PATCH v7 00/10] ppc64: Restrict memory allocations for kernel and initrd John Paul Adrian Glaubitz
2023-11-27 14:46   ` Stefan Berger
2023-11-27 15:09     ` Stefan Berger
2023-11-27 14:26 ` Stefan Berger
2023-11-30 13:44 ` Daniel Kiper [this message]

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=20231130134431.cabb7wdbrkjqrpzt@tomti.i.net-space.pl \
    --to=dkiper@net-space.pl \
    --cc=avnish.chouhan@ibm.com \
    --cc=cpscherr@us.ibm.com \
    --cc=grub-devel@gnu.org \
    --cc=hbathini@linux.ibm.com \
    --cc=mahesh@linux.ibm.com \
    --cc=mpe@ellerman.id.au \
    --cc=pavrampu@in.ibm.com \
    --cc=sourabhjain@linux.ibm.com \
    --cc=stefanb@linux.ibm.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;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).