[PATCH v2 0/3] Bli: fix hidden module dependency

2023-11-15 Thread Oliver Steffen
The bli module has a hidden/implicit dependency on the part_gpt module. The part_gpt module has to be loaded before the bli module. This dependency is not picked up automatically by the build system because the bli module does not use any function of part_gpt. It just expects Grub to be able to par

[PATCH v2 1/3] Allow explicit module dependencies

2023-11-15 Thread Oliver Steffen
The build system deduces inter-module dependencies from the symbols required and exported by the modules. This works well, except for some rare cases where the dependency is indirect or hidden. A module might not make use of any function of some other module, but still expect its functionality to b

[PATCH v2 3/3] bli: Improve documentation

2023-11-15 Thread Oliver Steffen
Improve the documentation of the bli module, explain in more detail what it does. Make clear that GPT formatted drives are expected and other partition formats are ignored. Also reorder and reword this section a bit. Signed-off-by: Oliver Steffen --- docs/grub.texi | 17 + 1 file

[PATCH v2 2/3] bli: Add explicit dependency on the part_gpt module

2023-11-15 Thread Oliver Steffen
The bli module has a "hidden" dependency on the part_gpt module, which is not picked up automatically by the build system. One purpose of the bli module is to communicate the GPT UUID of the partition Grub was launched from to Linux user-space (systemd-gpt-auto-generator). Without the part_gpt modu

Re: [PATCH v5 00/10] ppc64: Restrict memory allocations for kernel and initrd

2023-11-15 Thread Stefan Berger
Daniel, please do not merge this series yet. Regards, Stefan On 11/15/23 10:59, 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 a

[PATCH v5 01/10] kern/ieee1275/init: ppc64: Introduce a request for regions_claim

2023-11-15 Thread Stefan Berger
The regions_claim() function limits the allocation of memory regions by excluding certain memory areas from being used by GRUB. This for example includes a gap between 640MB and 768MB as well as an upper limit beyond which no memory may be used when an fadump is present. However, the ieee1275 loade

[PATCH v5 03/10] kern/ieee1275/init: ppc64: Return allocated address using context

2023-11-15 Thread Stefan Berger
Return the allocated address of the memory block in the request structure if a memory allocation was actually done. Leave the address untouched otherwise. This enables a caller who wants to use the allocated memory directly (rather than adding the memory to the heap) to see where memory was allocat

[PATCH v5 00/10] ppc64: Restrict memory allocations for kernel and initrd

2023-11-15 Thread Stefan Berger
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

[PATCH v5 02/10] kern/ieee1275/init: ppc64: Decide by request whether to initialize region

2023-11-15 Thread Stefan Berger
Let the regions_claim() request structure's init_region determine whether to call grub_mm_init_region() on it. This allows for adding memory to GRUB's memory heap if init_region is set to true, or direct usage of the memory otherwise. Set all current callers' init_region to true since they want to

[PATCH v5 05/10] kern/ieee1275/init: ppc64: Rename regions_claim to grub_regions_claim

2023-11-15 Thread Stefan Berger
Rename regions_claim() to grub_regions_claim() to make it available for memory allocation. The ieee1275 loader will use this function on PowerVM and KVM on Power and thus avoid usage of memory that it is not allowed to use. Signed-off-by: Stefan Berger Reviewed-by: Daniel Kiper Cc: Hari Bathini

[PATCH v5 06/10] kern/ieee1275/cmain: ppc64: Introduce flags to identify KVM and Power VM

2023-11-15 Thread Stefan Berger
Introduce flags to identify PowerVM and KVM on Power and set them where each type of host has been detected. Signed-off-by: Stefan Berger Reviewed-by: Daniel Kiper Cc: Hari Bathini Cc: Pavithra Prakash Cc: Michael Ellerman Cc: Carolyn Scherrer Cc: Mahesh Salgaonkar Cc: Sourabh Jain --- gr

[PATCH v5 10/10] kern/ieee1275/init: ppc64: Display upper_mem_limit for debugging

2023-11-15 Thread Stefan Berger
Display upper_mem_limit and its rounded-down value in MiB. Signed-off-by: Stefan Berger --- grub-core/kern/ieee1275/init.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/grub-core/kern/ieee1275/init.c b/grub-core/kern/ieee1275/init.c index 164cccb2a..72e0292a3 100644 --- a/grub-core/kern

[PATCH v5 07/10] loader/powerpc/ieee1275: Use new allocation function for kernel and initrd

2023-11-15 Thread Stefan Berger
On PowerVM and KVM on Power use the new memory allocation function that honors restrictions on which memory GRUB can actually use. In the request structure indicate the request for a single memory block along with address alignment restrictions. Request direct usage of the memory block by setting i

[PATCH v5 09/10] kern/ieee1275/init: ppc64: Fix a comment

2023-11-15 Thread Stefan Berger
Signed-off-by: Stefan Berger --- grub-core/kern/ieee1275/init.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/grub-core/kern/ieee1275/init.c b/grub-core/kern/ieee1275/init.c index 5d9d86c12..164cccb2a 100644 --- a/grub-core/kern/ieee1275/init.c +++ b/grub-core/kern/ieee1275/

[PATCH v5 04/10] kern/ieee1275/init: ppc64: Add support for alignment requirements

2023-11-15 Thread Stefan Berger
Add support for memory alignment requirements and adjust a candidate address to it before checking whether the block is large enough. This must be done in this order since the alignment adjustment can make a block smaller than what was requested. None of the current callers has memory alignment re

[PATCH v5 08/10] kern/ieee1275/ieee1275: debug: Display successful memory claims

2023-11-15 Thread Stefan Berger
Display successful memory claims with exact address and rounded-down MiB location and rounded-up size in MiB. Signed-off-by: Stefan Berger Reviewed-by: Daniel Kiper Cc: Eric Snowberg Cc: Hari Bathini Cc: Pavithra Prakash Cc: Michael Ellerman Cc: Carolyn Scherrer Cc: Mahesh Salgaonkar Cc: S

Re: [PATCH 0/2] Bli: fix hidden module dependency

2023-11-15 Thread Oliver Steffen
Quoting Daniel Kiper (2023-11-15 15:14:50) > On Wed, Nov 15, 2023 at 03:12:44AM -0800, Oliver Steffen wrote: > > Quoting Vladimir 'phcoder' Serbinenko (2023-11-14 19:21:49) > > > In general series looks good. Few comments: > > > * I'm unsure about the name. It seems to suggest that people put the >

Re: [PATCH 0/2] Bli: fix hidden module dependency

2023-11-15 Thread Daniel Kiper
On Wed, Nov 15, 2023 at 03:12:44AM -0800, Oliver Steffen wrote: > Quoting Vladimir 'phcoder' Serbinenko (2023-11-14 19:21:49) > > In general series looks good. Few comments: > > * I'm unsure about the name. It seems to suggest that people put the > > dependencies there by default while in fact it's

Re: [PATCH 0/2] Bli: fix hidden module dependency

2023-11-15 Thread Oliver Steffen
Quoting Vladimir 'phcoder' Serbinenko (2023-11-14 19:21:49) > In general series looks good. Few comments: > * I'm unsure about the name. It seems to suggest that people put the > dependencies there by default while in fact it's the last place for it. Maybe > extra_deps.lst? > Sounds good to me. Ar