public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Leif Lindholm" <leif.lindholm@linaro.org>
To: Ard Biesheuvel <ard.biesheuvel@linaro.org>
Cc: devel@edk2.groups.io
Subject: Re: [PATCH edk2-platforms v2 5/8] Silicon/AMD/StyxDtbLoaderLib: add interrupt-affinity property to PMU node
Date: Thu, 28 Nov 2019 13:22:44 +0000	[thread overview]
Message-ID: <20191128132244.GO7359@bivouac.eciton.net> (raw)
In-Reply-To: <20191127184439.16793-6-ard.biesheuvel@linaro.org>

On Wed, Nov 27, 2019 at 19:44:36 +0100, Ard Biesheuvel wrote:
> AMD Seattle uses a range of SPIs to signal PMU events, and this requires
> a description in the DT which SPI maps to which CPU. This requires us to
> defer the generation of the PMU node to a point where the CPU phandles
> have been allocated.

Ah, so these were previously populated with garbage? Oops.

> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>

Reviewed-by: Leif Lindholm <leif.lindholm@linaro.org>

> ---
>  Silicon/AMD/Styx/Library/StyxDtbLoaderLib/StyxDtbLoaderLib.c | 55 ++++++++++----------
>  1 file changed, 28 insertions(+), 27 deletions(-)
> 
> diff --git a/Silicon/AMD/Styx/Library/StyxDtbLoaderLib/StyxDtbLoaderLib.c b/Silicon/AMD/Styx/Library/StyxDtbLoaderLib/StyxDtbLoaderLib.c
> index 261b5f59c8df..2f7b5e2a7b25 100644
> --- a/Silicon/AMD/Styx/Library/StyxDtbLoaderLib/StyxDtbLoaderLib.c
> +++ b/Silicon/AMD/Styx/Library/StyxDtbLoaderLib/StyxDtbLoaderLib.c
> @@ -331,33 +331,6 @@ PrepareFdt (
>    // Get Id from primary CPU
>    MpId = (UINTN)ArmReadMpidr ();
>  
> -  // Create /pmu node
> -  PmuNode = fdt_add_subnode(Fdt, 0, "pmu");
> -  if (PmuNode >= 0) {
> -    fdt_setprop_string (Fdt, PmuNode, "compatible", "arm,armv8-pmuv3");
> -
> -    // append PMU interrupts
> -    for (Index = 0; Index < ArmCoreCount; Index++) {
> -      MpId = (UINTN)GET_MPID (ArmCoreInfoTable[Index].ClusterId,
> -                              ArmCoreInfoTable[Index].CoreId);
> -
> -      Status = AmdMpCoreInfoProtocol->GetPmuSpiFromMpId (MpId, &PmuInt.IntId);
> -      if (EFI_ERROR (Status)) {
> -        DEBUG ((DEBUG_ERROR,
> -          "FDT: Error getting PMU interrupt for MpId '0x%x'\n", MpId));
> -        return Status;
> -      }
> -
> -      PmuInt.Flag = cpu_to_fdt32 (PMU_INT_FLAG_SPI);
> -      PmuInt.IntId = cpu_to_fdt32 (PmuInt.IntId);
> -      PmuInt.Type = cpu_to_fdt32 (PMU_INT_TYPE_HIGH_LEVEL);
> -      fdt_appendprop (Fdt, PmuNode, "interrupts", &PmuInt, sizeof(PmuInt));
> -    }
> -  } else {
> -    DEBUG ((DEBUG_ERROR, "FDT: Error creating 'pmu' node\n"));
> -    return EFI_INVALID_PARAMETER;
> -  }
> -
>    // Create /cpus noide
>    Node = fdt_add_subnode (Fdt, 0, "cpus");
>    if (Node >= 0) {
> @@ -449,6 +422,34 @@ PrepareFdt (
>      return EFI_INVALID_PARAMETER;
>    }
>  
> +  // Create /pmu node
> +  PmuNode = fdt_add_subnode(Fdt, 0, "pmu");
> +  if (PmuNode >= 0) {
> +    fdt_setprop_string (Fdt, PmuNode, "compatible", "arm,armv8-pmuv3");
> +
> +    // append PMU interrupts
> +    for (Index = 0; Index < ArmCoreCount; Index++) {
> +      MpId = (UINTN)GET_MPID (ArmCoreInfoTable[Index].ClusterId,
> +                              ArmCoreInfoTable[Index].CoreId);
> +
> +      Status = AmdMpCoreInfoProtocol->GetPmuSpiFromMpId (MpId, &PmuInt.IntId);
> +      if (EFI_ERROR (Status)) {
> +        DEBUG ((DEBUG_ERROR,
> +          "FDT: Error getting PMU interrupt for MpId '0x%x'\n", MpId));
> +        return Status;
> +      }
> +
> +      PmuInt.Flag = cpu_to_fdt32 (PMU_INT_FLAG_SPI);
> +      PmuInt.IntId = cpu_to_fdt32 (PmuInt.IntId);
> +      PmuInt.Type = cpu_to_fdt32 (PMU_INT_TYPE_HIGH_LEVEL);
> +      fdt_appendprop (Fdt, PmuNode, "interrupts", &PmuInt, sizeof(PmuInt));
> +      fdt_appendprop_cell (Fdt, PmuNode, "interrupt-affinity", Phandle[Index]);
> +    }
> +  } else {
> +    DEBUG ((DEBUG_ERROR, "FDT: Error creating 'pmu' node\n"));
> +    return EFI_INVALID_PARAMETER;
> +  }
> +
>    SetSocIdStatus (Fdt);
>    SetXgbeStatus (Fdt);
>  
> -- 
> 2.17.1
> 

  reply	other threads:[~2019-11-28 13:22 UTC|newest]

Thread overview: 20+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-27 18:44 [PATCH edk2-platforms v2 0/8] fixes and updates for AMD OverDrive Ard Biesheuvel
2019-11-27 18:44 ` [PATCH edk2-platforms v2 1/8] Platform/Overdrive: add missing resolution for FileHandleLib Ard Biesheuvel
2019-11-27 18:44 ` [PATCH edk2-platforms v2 2/8] Platform/Overdrive: clean up stream ID descriptions in DT Ard Biesheuvel
2019-11-27 18:44 ` [PATCH edk2-platforms v2 3/8] Platform/Overdrive: fix a typo in the DT Ard Biesheuvel
2019-11-28 12:32   ` Leif Lindholm
2019-11-28 13:32     ` Ard Biesheuvel
2019-11-27 18:44 ` [PATCH edk2-platforms v2 4/8] Silicon/AMD/Styx: clean up stream ID mappings for SMMU Ard Biesheuvel
2019-11-27 18:44 ` [PATCH edk2-platforms v2 5/8] Silicon/AMD/StyxDtbLoaderLib: add interrupt-affinity property to PMU node Ard Biesheuvel
2019-11-28 13:22   ` Leif Lindholm [this message]
2019-11-28 13:29     ` Ard Biesheuvel
2019-11-27 18:44 ` [PATCH edk2-platforms v2 6/8] Silicon/AMD/StyxDtbLoaderLib: add description of the cache topology Ard Biesheuvel
2019-11-28 13:24   ` Leif Lindholm
2019-11-27 18:44 ` [PATCH edk2-platforms v2 7/8] Silicon/AMD/StyxDtbLoaderLib: use Cortex-A57 IDs instead of generic ARMv8 Ard Biesheuvel
2019-11-28 13:37   ` Leif Lindholm
2019-11-28 13:39     ` Ard Biesheuvel
2019-11-28 13:40       ` Leif Lindholm
2019-11-28 15:07         ` Ard Biesheuvel
2019-11-27 18:44 ` [PATCH edk2-platforms v2 8/8] Silicon/AMD/StyxDtbLoaderLib: omit linux,phandle properties Ard Biesheuvel
2019-11-28 13:38   ` Leif Lindholm
2019-11-28 15:48 ` [PATCH edk2-platforms v2 0/8] fixes and updates for AMD OverDrive Ard Biesheuvel

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-list 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=20191128132244.GO7359@bivouac.eciton.net \
    --to=devel@edk2.groups.io \
    /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