[v2,0/2] efi: Fixes for EFI_MEMORY_SP memory on RISC-V and ARM64

Message ID 20240202180704.808766-1-abrestic@rivosinc.com
Headers
Series efi: Fixes for EFI_MEMORY_SP memory on RISC-V and ARM64 |

Message

Andrew Bresticker Feb. 2, 2024, 6:07 p.m. UTC
  Two small fixes to enable the use soft-reserved/special-purpose memory
(EFI_MEMORY_SP) with dax_kmem on RISC-V (and ARM64, I think, though I
don't have a platform to test it on).

Patch 1 fixes a trivial integer narrowing bug. Patch 2 prevents adding
memblocks for soft-reserved memory so that it can later be hotplugged by
dax_kmem.

Tested on a RISC-V platform that presents a range of EFI_MEMORY_SP with
Bjorn's MEMORY_HOTPLUG series[0] applied.

[0]: https://lore.kernel.org/lkml/20230512145737.985671-1-bjorn@kernel.org/

v1->v2: address comments from Ard

Andrew Bresticker (2):
  efi: runtime: Fix potential overflow of soft-reserved region size
  efi: Don't add memblocks for soft-reserved memory

 drivers/firmware/efi/arm-runtime.c   |  2 +-
 drivers/firmware/efi/efi-init.c      | 19 ++++++++++---------
 drivers/firmware/efi/riscv-runtime.c |  2 +-
 3 files changed, 12 insertions(+), 11 deletions(-)
  

Comments

Ard Biesheuvel Feb. 2, 2024, 6:28 p.m. UTC | #1
On Fri, 2 Feb 2024 at 19:07, Andrew Bresticker <abrestic@rivosinc.com> wrote:
>
> Two small fixes to enable the use soft-reserved/special-purpose memory
> (EFI_MEMORY_SP) with dax_kmem on RISC-V (and ARM64, I think, though I
> don't have a platform to test it on).
>
> Patch 1 fixes a trivial integer narrowing bug. Patch 2 prevents adding
> memblocks for soft-reserved memory so that it can later be hotplugged by
> dax_kmem.
>
> Tested on a RISC-V platform that presents a range of EFI_MEMORY_SP with
> Bjorn's MEMORY_HOTPLUG series[0] applied.
>
> [0]: https://lore.kernel.org/lkml/20230512145737.985671-1-bjorn@kernel.org/
>
> v1->v2: address comments from Ard
>
> Andrew Bresticker (2):
>   efi: runtime: Fix potential overflow of soft-reserved region size
>   efi: Don't add memblocks for soft-reserved memory
>

Thanks, I'll take these both as fixes.
  
Palmer Dabbelt Feb. 7, 2024, 1:04 a.m. UTC | #2
On Fri, 02 Feb 2024 10:28:54 PST (-0800), Ard Biesheuvel wrote:
> On Fri, 2 Feb 2024 at 19:07, Andrew Bresticker <abrestic@rivosinc.com> wrote:
>>
>> Two small fixes to enable the use soft-reserved/special-purpose memory
>> (EFI_MEMORY_SP) with dax_kmem on RISC-V (and ARM64, I think, though I
>> don't have a platform to test it on).
>>
>> Patch 1 fixes a trivial integer narrowing bug. Patch 2 prevents adding
>> memblocks for soft-reserved memory so that it can later be hotplugged by
>> dax_kmem.
>>
>> Tested on a RISC-V platform that presents a range of EFI_MEMORY_SP with
>> Bjorn's MEMORY_HOTPLUG series[0] applied.
>>
>> [0]: https://lore.kernel.org/lkml/20230512145737.985671-1-bjorn@kernel.org/
>>
>> v1->v2: address comments from Ard
>>
>> Andrew Bresticker (2):
>>   efi: runtime: Fix potential overflow of soft-reserved region size
>>   efi: Don't add memblocks for soft-reserved memory
>>
>
> Thanks, I'll take these both as fixes.

Acked-by: Palmer Dabbelt <palmer@rivosinc.com>

Thanks!