public inbox for devel@edk2.groups.io
 help / color / mirror / Atom feed
From: "Sami Mujawar" <sami.mujawar@arm.com>
To: Pedro Falcato <pedro.falcato@gmail.com>
Cc: devel@edk2.groups.io, ardb+tianocore@kernel.org,
	quic_llindhol@quicinc.com, neil.jones@blaize.com,
	pierre.gondois@arm.com, Matteo.Carlini@arm.com,
	Akanksha.Jain2@arm.com, Ben.Adderson@arm.com,
	Sibel.Allinson@arm.com, nd@arm.com
Subject: Re: [PATCH v1 02/12] ArmPkg: Fix data type used for GicInterruptInterfaceBase
Date: Tue, 23 May 2023 16:16:41 +0100	[thread overview]
Message-ID: <872d7d4e-b1af-9f5a-d694-54b533b49a61@arm.com> (raw)
In-Reply-To: <CAKbZUD0aKUeZhbuhvxsfrDSA-_jCe+Wceg30cGDWTsgJZsVzUg@mail.gmail.com>

Hi Pedro,

Thank you for the feedback.

Please see my response inline marked [SAMI].

Regards,

Sami Mujawar

On 23/05/2023 02:35 pm, Pedro Falcato wrote:
> On Tue, May 23, 2023 at 2:04 PM Sami Mujawar <sami.mujawar@arm.com> wrote:
>> The data type used by variables representing the
>> GicInterruptInterfaceBase has been inconsistently
>> used in the ArmGic driver and the library.
>> The PCD defined for the GIC Interrupt interface
>> base address is UINT64. However, the data types
>> for the variables used is UINTN, INTN, and at
>> some places UINT32.
>>
>> Therefore, update the data types to use UINTN and
>> add necessary typecasts when reading values from
>> the PCD. This should then be consistent across
>> AArch32 and AArch64 builds.
>>
>> Signed-off-by: Sami Mujawar <sami.mujawar@arm.com>
>> ---
>>   ArmPkg/Drivers/ArmGic/ArmGicLib.c               | 13 ++++++++++---
>>   ArmPkg/Drivers/ArmGic/GicV2/ArmGicV2Dxe.c       |  2 +-
>>   ArmPkg/Drivers/ArmGic/GicV2/ArmGicV2NonSecLib.c |  6 +++---
>>   ArmPkg/Include/Library/ArmGicLib.h              | 18 +++++++++---------
>>   4 files changed, 23 insertions(+), 16 deletions(-)
>>
>> diff --git a/ArmPkg/Drivers/ArmGic/ArmGicLib.c b/ArmPkg/Drivers/ArmGic/ArmGicLib.c
>> index 6e44e89390fcdaa89302d6505f75c43c84ce3535..78edc7e76a087caa5b91d896f9bd316d6530a668 100644
>> --- a/ArmPkg/Drivers/ArmGic/ArmGicLib.c
>> +++ b/ArmPkg/Drivers/ArmGic/ArmGicLib.c
>> @@ -104,10 +104,17 @@ GicGetCpuRedistributorBase (
>>     return 0;
>>   }
>>
>> +/**
>> +  Return the GIC CPU Interrupt Interface ID.
>> +
>> +  @param GicInterruptInterfaceBase  Base address of the GIC Interrupt Interface.
>> +
>> +  @retval CPU Interface Identification information.
>> +**/
>>   UINTN
>>   EFIAPI
>>   ArmGicGetInterfaceIdentification (
>> -  IN  INTN  GicInterruptInterfaceBase
>> +  IN  UINTN  GicInterruptInterfaceBase
>>     )
>>   {
>>     // Read the GIC Identification Register
>> @@ -400,7 +407,7 @@ ArmGicDisableDistributor (
>>   VOID
>>   EFIAPI
>>   ArmGicEnableInterruptInterface (
>> -  IN  INTN  GicInterruptInterfaceBase
>> +  IN  UINTN  GicInterruptInterfaceBase
>>     )
>>   {
>>     ARM_GIC_ARCH_REVISION  Revision;
>> @@ -418,7 +425,7 @@ ArmGicEnableInterruptInterface (
>>   VOID
>>   EFIAPI
>>   ArmGicDisableInterruptInterface (
>> -  IN  INTN  GicInterruptInterfaceBase
>> +  IN  UINTN  GicInterruptInterfaceBase
>>     )
>>   {
>>     ARM_GIC_ARCH_REVISION  Revision;
>> diff --git a/ArmPkg/Drivers/ArmGic/GicV2/ArmGicV2Dxe.c b/ArmPkg/Drivers/ArmGic/GicV2/ArmGicV2Dxe.c
>> index b7d67d830e46b663e4054990e7456660fb22cda9..b952c3ae31c060ecbb43c0800d34e57664a8262a 100644
>> --- a/ArmPkg/Drivers/ArmGic/GicV2/ArmGicV2Dxe.c
>> +++ b/ArmPkg/Drivers/ArmGic/GicV2/ArmGicV2Dxe.c
>> @@ -400,7 +400,7 @@ GicV2DxeInitialize (
>>     // the system.
>>     ASSERT_PROTOCOL_ALREADY_INSTALLED (NULL, &gHardwareInterruptProtocolGuid);
>>
>> -  mGicInterruptInterfaceBase = PcdGet64 (PcdGicInterruptInterfaceBase);
>> +  mGicInterruptInterfaceBase = (UINTN)PcdGet64 (PcdGicInterruptInterfaceBase);
>>     mGicDistributorBase        = (UINTN)PcdGet64 (PcdGicDistributorBase);
>>     mGicNumInterrupts          = ArmGicGetMaxNumInterrupts (mGicDistributorBase);
>>
> ASSERT'ing for PCD <= MAX_UINTN may be desirable here, for both bases?
[SAMI] I will address this in the v2 series.
>
>> diff --git a/ArmPkg/Drivers/ArmGic/GicV2/ArmGicV2NonSecLib.c b/ArmPkg/Drivers/ArmGic/GicV2/ArmGicV2NonSecLib.c
>> index 85c2a920a54a1acaccb98a94b5591ce36d20697c..832f21644233655ef2f359f1e175071d2a493b7c 100644
>> --- a/ArmPkg/Drivers/ArmGic/GicV2/ArmGicV2NonSecLib.c
>> +++ b/ArmPkg/Drivers/ArmGic/GicV2/ArmGicV2NonSecLib.c
>> @@ -1,6 +1,6 @@
>>   /** @file
>>   *
>> -*  Copyright (c) 2011-2014, ARM Limited. All rights reserved.
>> +*  Copyright (c) 2011-2021, Arm Limited. All rights reserved.
>>   *
>>   *  SPDX-License-Identifier: BSD-2-Clause-Patent
>>   *
>> @@ -13,7 +13,7 @@
>>   VOID
>>   EFIAPI
>>   ArmGicV2EnableInterruptInterface (
>> -  IN  INTN  GicInterruptInterfaceBase
>> +  IN  UINTN  GicInterruptInterfaceBase
>>     )
>>   {
>>     /*
>> @@ -26,7 +26,7 @@ ArmGicV2EnableInterruptInterface (
>>   VOID
>>   EFIAPI
>>   ArmGicV2DisableInterruptInterface (
>> -  IN  INTN  GicInterruptInterfaceBase
>> +  IN  UINTN  GicInterruptInterfaceBase
>>     )
>>   {
>>     // Disable Gic Interface
>> diff --git a/ArmPkg/Include/Library/ArmGicLib.h b/ArmPkg/Include/Library/ArmGicLib.h
>> index 72dbd1ca8d626c69d9bb8727d77fd34b4ab3af28..41bbf1da6a6cbb683df4bb30c4b1a1762dc7814f 100644
>> --- a/ArmPkg/Include/Library/ArmGicLib.h
>> +++ b/ArmPkg/Include/Library/ArmGicLib.h
>> @@ -113,7 +113,7 @@
>>   UINTN
>>   EFIAPI
>>   ArmGicGetInterfaceIdentification (
>> -  IN  INTN  GicInterruptInterfaceBase
>> +  IN  UINTN  GicInterruptInterfaceBase
>>     );
>>
>>   // GIC Secure interfaces
>> @@ -122,7 +122,7 @@ EFIAPI
>>   ArmGicSetupNonSecure (
>>     IN  UINTN  MpId,
>>     IN  UINTN  GicDistributorBase,
>> -  IN  INTN   GicInterruptInterfaceBase
>> +  IN  UINTN  GicInterruptInterfaceBase
>>     );
>>
>>   VOID
>> @@ -136,13 +136,13 @@ ArmGicSetSecureInterrupts (
>>   VOID
>>   EFIAPI
>>   ArmGicEnableInterruptInterface (
>> -  IN  INTN  GicInterruptInterfaceBase
>> +  IN  UINTN  GicInterruptInterfaceBase
>>     );
>>
>>   VOID
>>   EFIAPI
>>   ArmGicDisableInterruptInterface (
>> -  IN  INTN  GicInterruptInterfaceBase
>> +  IN  UINTN  GicInterruptInterfaceBase
>>     );
>>
>>   VOID
>> @@ -203,8 +203,8 @@ ArmGicEndOfInterrupt (
>>   UINTN
>>   EFIAPI
>>   ArmGicSetPriorityMask (
>> -  IN  INTN  GicInterruptInterfaceBase,
>> -  IN  INTN  PriorityMask
>> +  IN  UINTN  GicInterruptInterfaceBase,
>> +  IN  INTN   PriorityMask
>>     );
>>
>>   VOID
>> @@ -252,19 +252,19 @@ EFIAPI
>>   ArmGicV2SetupNonSecure (
>>     IN  UINTN  MpId,
>>     IN  UINTN  GicDistributorBase,
>> -  IN  INTN   GicInterruptInterfaceBase
>> +  IN  UINTN  GicInterruptInterfaceBase
>>     );
>>
>>   VOID
>>   EFIAPI
>>   ArmGicV2EnableInterruptInterface (
>> -  IN  INTN  GicInterruptInterfaceBase
>> +  IN  UINTN  GicInterruptInterfaceBase
>>     );
>>
>>   VOID
>>   EFIAPI
>>   ArmGicV2DisableInterruptInterface (
>> -  IN  INTN  GicInterruptInterfaceBase
>> +  IN  UINTN  GicInterruptInterfaceBase
>>     );
>>
>>   UINTN
>> --
>> 'Guid(CE165669-3EF3-493F-B85D-6190EE5B9759)'
>>
>

  reply	other threads:[~2023-05-23 15:17 UTC|newest]

Thread overview: 25+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-05-23 13:04 [PATCH v1 00/12] ArmPkg: Arm GIC Library and Driver improvements Sami Mujawar
2023-05-23 13:04 ` [PATCH v1 01/12] ArmPkg: Fix data type used for GicDistributorBase Sami Mujawar
2023-05-23 13:29   ` Ard Biesheuvel
2023-05-23 13:04 ` [PATCH v1 02/12] ArmPkg: Fix data type used for GicInterruptInterfaceBase Sami Mujawar
2023-05-23 13:35   ` Pedro Falcato
2023-05-23 15:16     ` Sami Mujawar [this message]
2023-05-23 13:36   ` Ard Biesheuvel
2023-05-23 13:04 ` [PATCH v1 03/12] ArmPkg: Fix ArmGicSendSgiTo() parameters Sami Mujawar
2023-05-23 13:04 ` [PATCH v1 04/12] ArmPkg: Fix Non-Boolean comparison in ArmGicEnableDistributor Sami Mujawar
2023-05-23 13:32   ` Ard Biesheuvel
2023-05-23 15:16     ` Sami Mujawar
2023-05-23 13:04 ` [PATCH v1 05/12] ArmPkg: Fix return type for ArmGicGetInterfaceIdentification Sami Mujawar
2023-05-23 13:04 ` [PATCH v1 06/12] ArmPkg: Make variables used for GicInterrupt UINTN Sami Mujawar
2023-05-23 13:04 ` [PATCH v1 07/12] ArmPkg: Fix return value for ArmGicV2AcknowledgeInterrupt Sami Mujawar
2023-05-23 13:32   ` Pedro Falcato
2023-05-23 15:17     ` Sami Mujawar
2023-05-23 13:04 ` [PATCH v1 08/12] ArmPkg: Typecast IntID to UINT32 in ArmGicV2EndOfInterrupt Sami Mujawar
2023-05-23 13:26   ` [edk2-devel] " Ard Biesheuvel
2023-05-23 15:16     ` Sami Mujawar
2023-05-23 13:04 ` [PATCH v1 09/12] ArmPkg: Remove unused function declarations Sami Mujawar
2023-05-23 13:04 ` [PATCH v1 10/12] ArmPkg: Prevent SgiId from setting RES0 bits of GICD_SGIR Sami Mujawar
2023-05-23 13:37   ` Ard Biesheuvel
2023-05-23 13:04 ` [PATCH v1 11/12] ArmPkg: Adjust variable type and cast for RegShift & RegOffset Sami Mujawar
2023-05-23 13:04 ` [PATCH v1 12/12] ArmPkg: Fix ArmGicAcknowledgeInterrupt () for GICv3 Sami Mujawar
2023-05-23 13:38   ` 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=872d7d4e-b1af-9f5a-d694-54b533b49a61@arm.com \
    --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