[0/5] of: reserved_mem: Provide more control about allocation behavior

Message ID 20230510-dt-resv-bottom-up-v1-0-3bf68873dbed@gerhold.net
Headers
Series of: reserved_mem: Provide more control about allocation behavior |

Message

Stephan Gerhold May 15, 2023, 10:12 a.m. UTC
  Provide more control about the allocation behavior for dynamically 
allocated reserved memory by adding a "alloc-bottom-up" and 
"alloc-top-down" option and by making the allocation order 
deterministic.

The motivation for this patch series are the many different reserved 
firmware regions on Qualcomm platforms. Currently it is often necessary 
to duplicate them into each board DT, because minor differences for 
some of the firmware regions (e.g. the firmware size) requires shifting
the base address of all following firmware regions as well.

I propose describing the actual requirements (size, alignment, 
alloc-ranges) instead and allocating the reserved regions at runtime. 
This allows defining only the actual device-specific part in the board 
DT and having everything else shared in the SoC.dtsi.

The series starts with two minor additions to the of_reserved_mem code. 
The last two patches are examples that are meant to show the motivation
more clearly for the MSM8916 SoC. PATCH 4/5 shows the current (static) 
approach, then PATCH 5/5 switches to the dynamic allocation based on
the first 3 patches.

If the first 3 patches are accepted I would send the full MSM8916 DT
changes in a separate series.

Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
---
Stephan Gerhold (5):
      dt-bindings: reserved-memory: Add alloc-{bottom-up,top-down}
      of: reserved_mem: Implement alloc-{bottom-up,top-down}
      of: reserved_mem: Use stable allocation order
      [RFC] arm64: dts: qcom: msm8916: Enable modem on two phones
      [RFC] arm64: dts: qcom: msm8916: Reserve firmware memory dynamically

 .../bindings/reserved-memory/reserved-memory.yaml  | 39 ++++++++++++++++++++
 arch/arm64/boot/dts/qcom/apq8016-sbc.dts           | 13 +++++++
 .../boot/dts/qcom/msm8916-longcheer-l8150.dts      | 31 ++++++++++++++--
 .../boot/dts/qcom/msm8916-samsung-serranove.dts    | 21 +++++++++++
 arch/arm64/boot/dts/qcom/msm8916-ufi.dtsi          | 29 ++++++++-------
 arch/arm64/boot/dts/qcom/msm8916.dtsi              | 42 ++++++++++++++++------
 drivers/of/of_reserved_mem.c                       | 14 +++++++-
 7 files changed, 163 insertions(+), 26 deletions(-)
---
base-commit: 715abedee4cd660ad390659aefa7482f05275bbd
change-id: 20230510-dt-resv-bottom-up-68d71ff6628f

Best regards,
  

Comments

Konrad Dybcio May 17, 2023, 7:25 p.m. UTC | #1
On 15.05.2023 12:12, Stephan Gerhold wrote:
> Provide more control about the allocation behavior for dynamically 
> allocated reserved memory by adding a "alloc-bottom-up" and 
> "alloc-top-down" option and by making the allocation order 
> deterministic.
> 
> The motivation for this patch series are the many different reserved 
> firmware regions on Qualcomm platforms. Currently it is often necessary 
> to duplicate them into each board DT, because minor differences for 
> some of the firmware regions (e.g. the firmware size) requires shifting
> the base address of all following firmware regions as well.
> 
> I propose describing the actual requirements (size, alignment, 
> alloc-ranges) instead and allocating the reserved regions at runtime. 
> This allows defining only the actual device-specific part in the board 
> DT and having everything else shared in the SoC.dtsi.
> 
> The series starts with two minor additions to the of_reserved_mem code. 
> The last two patches are examples that are meant to show the motivation
> more clearly for the MSM8916 SoC. PATCH 4/5 shows the current (static) 
> approach, then PATCH 5/5 switches to the dynamic allocation based on
> the first 3 patches.
> 
> If the first 3 patches are accepted I would send the full MSM8916 DT
> changes in a separate series.
> 
> Signed-off-by: Stephan Gerhold <stephan@gerhold.net>
> ---
Sounds great!

Konrad
> Stephan Gerhold (5):
>       dt-bindings: reserved-memory: Add alloc-{bottom-up,top-down}
>       of: reserved_mem: Implement alloc-{bottom-up,top-down}
>       of: reserved_mem: Use stable allocation order
>       [RFC] arm64: dts: qcom: msm8916: Enable modem on two phones
>       [RFC] arm64: dts: qcom: msm8916: Reserve firmware memory dynamically
> 
>  .../bindings/reserved-memory/reserved-memory.yaml  | 39 ++++++++++++++++++++
>  arch/arm64/boot/dts/qcom/apq8016-sbc.dts           | 13 +++++++
>  .../boot/dts/qcom/msm8916-longcheer-l8150.dts      | 31 ++++++++++++++--
>  .../boot/dts/qcom/msm8916-samsung-serranove.dts    | 21 +++++++++++
>  arch/arm64/boot/dts/qcom/msm8916-ufi.dtsi          | 29 ++++++++-------
>  arch/arm64/boot/dts/qcom/msm8916.dtsi              | 42 ++++++++++++++++------
>  drivers/of/of_reserved_mem.c                       | 14 +++++++-
>  7 files changed, 163 insertions(+), 26 deletions(-)
> ---
> base-commit: 715abedee4cd660ad390659aefa7482f05275bbd
> change-id: 20230510-dt-resv-bottom-up-68d71ff6628f
> 
> Best regards,