From: "Ard Biesheuvel" <ard.biesheuvel@arm.com>
To: devel@edk2.groups.io, leif@nuviainc.com,
Ard Biesheuvel <ard.biesheuvel@linaro.org>
Subject: Re: [edk2-devel] [PATCH 1/5] ArmPkg/CpuDxe: use private copy of GetRootTranslationTableInfo()
Date: Thu, 2 Apr 2020 12:20:54 +0200 [thread overview]
Message-ID: <e23fe3a9-78e8-aab2-fe81-2078ad651eb2@arm.com> (raw)
In-Reply-To: <20200402101610.GL7468@vanye>
On 4/2/20 12:16 PM, Leif Lindholm via groups.io wrote:
> On Sat, Mar 28, 2020 at 11:43:17 +0100, Ard Biesheuvel wrote:
>> Before getting rid of GetRootTranslationTableInfo() and the related
>> LookupAddresstoRootTable() in AARCH64's version of ArmMmuLib, add a
>> version of the former to CpuDxe, which will be its only remaining
>> user. While at it, simplify it a bit, since in the CpuDxe cases,
>> both OUT arguments are always provided.
>>
>> Signed-off-by: Ard Biesheuvel <ard.biesheuvel@linaro.org>
>> ---
>> ArmPkg/Drivers/CpuDxe/AArch64/Mmu.c | 15 +++++++++++++++
>> ArmPkg/Drivers/CpuDxe/CpuDxe.h | 7 -------
>> 2 files changed, 15 insertions(+), 7 deletions(-)
>>
>> diff --git a/ArmPkg/Drivers/CpuDxe/AArch64/Mmu.c b/ArmPkg/Drivers/CpuDxe/AArch64/Mmu.c
>> index 3b6c5e733709..24eb1c4221e3 100644
>> --- a/ArmPkg/Drivers/CpuDxe/AArch64/Mmu.c
>> +++ b/ArmPkg/Drivers/CpuDxe/AArch64/Mmu.c
>> @@ -15,6 +15,21 @@ SPDX-License-Identifier: BSD-2-Clause-Patent
>>
>> #define TT_ATTR_INDX_INVALID ((UINT32)~0)
>>
>> +#define MIN_T0SZ 16
>> +#define BITS_PER_LEVEL 9
>> +
>> +STATIC
>> +VOID
>> +GetRootTranslationTableInfo (
>> + IN UINTN T0SZ,
>> + OUT UINTN *RootTableLevel,
>> + OUT UINTN *RootTableEntryCount
>> + )
>> +{
>> + *RootTableLevel = (T0SZ - MIN_T0SZ) / BITS_PER_LEVEL;
>> + *RootTableEntryCount = TT_ENTRY_COUNT >> (T0SZ - MIN_T0SZ) % BITS_PER_LEVEL;
>> +}
>> +
>> STATIC
>> UINT64
>> GetFirstPageAttribute (
>> diff --git a/ArmPkg/Drivers/CpuDxe/CpuDxe.h b/ArmPkg/Drivers/CpuDxe/CpuDxe.h
>> index b627c3c50ff8..3fe5c24d5e5b 100644
>> --- a/ArmPkg/Drivers/CpuDxe/CpuDxe.h
>> +++ b/ArmPkg/Drivers/CpuDxe/CpuDxe.h
>> @@ -134,13 +134,6 @@ GetMemoryRegion (
>> OUT UINTN *RegionAttributes
>> );
>>
>> -VOID
>> -GetRootTranslationTableInfo (
>
> So, this may be super picky, but:
> Deleting the prototype without making the definition also STATIC would
> cause build errors with -Wmissing-prototypes (which someone might be
> enabling explicitly or implicitly if say doing some code hardening on
> the side).
>
> Now, it's a valid point to say that -Wmissing-prototypes isn't in our
> current CFLAGS, but I think it would be a good habit to get into.
> So you get a:
>
> Reviewed-by: Leif Lindholm <leif@nuviainc.com>
>
> regardless, but I'd appreciate if you could sling a STATIC into
> ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibCore.c as well before
> pushing.
>
Well, while I see your point, please note that the prototype only exists
in a local header file that only gets included by CpuDxe, and not by any
of the other consumers of ArmMmuLib.
>> - IN UINTN T0SZ,
>> - OUT UINTN *TableLevel,
>> - OUT UINTN *TableEntryCount
>> - );
>> -
>> EFI_STATUS
>> SetGcdMemorySpaceAttributes (
>> IN EFI_GCD_MEMORY_SPACE_DESCRIPTOR *MemorySpaceMap,
>> --
>> 2.17.1
>>
>
>
>
next prev parent reply other threads:[~2020-04-02 10:20 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-28 10:43 [PATCH 0/5] ArmPkg: cosmetic cleanups for ArmMmuLib Ard Biesheuvel
2020-03-28 10:43 ` [PATCH 1/5] ArmPkg/CpuDxe: use private copy of GetRootTranslationTableInfo() Ard Biesheuvel
2020-04-02 10:16 ` Leif Lindholm
2020-04-02 10:20 ` Ard Biesheuvel [this message]
2020-04-02 10:28 ` [edk2-devel] " Leif Lindholm
2020-04-02 10:29 ` Ard Biesheuvel
2020-04-02 11:03 ` Leif Lindholm
2020-04-02 12:44 ` Ard Biesheuvel
2020-03-28 10:43 ` [PATCH 2/5] ArmPkg/CpuDxe: move PageAttributeToGcdAttribute() out of ArmMmuLib Ard Biesheuvel
2020-03-28 10:43 ` [PATCH 3/5] ArmPkg/ArmMmuLib: drop pointless LookupAddresstoRootTable() routine Ard Biesheuvel
2020-03-28 10:43 ` [PATCH 4/5] ArmPkg/ArmMmuLib: get rid of GetRootTranslationTableInfo() Ard Biesheuvel
2020-03-28 10:43 ` [PATCH 5/5] ArmPkg/ArmMmuLib: drop unused TT_ATTR_INDX_INVALID CPP symbol Ard Biesheuvel
2020-04-02 10:23 ` Leif Lindholm
2020-04-02 10:29 ` [edk2-devel] " Ard Biesheuvel
2020-04-02 10:57 ` Leif Lindholm
2020-04-02 11:05 ` 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=e23fe3a9-78e8-aab2-fe81-2078ad651eb2@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