From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wr1-f65.google.com (mail-wr1-f65.google.com [209.85.221.65]) by mx.groups.io with SMTP id smtpd.web10.3220.1585822574685627915 for ; Thu, 02 Apr 2020 03:16:15 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@nuviainc-com.20150623.gappssmtp.com header.s=20150623 header.b=DGHTUo35; spf=pass (domain: nuviainc.com, ip: 209.85.221.65, mailfrom: leif@nuviainc.com) Received: by mail-wr1-f65.google.com with SMTP id m17so3441235wrw.11 for ; Thu, 02 Apr 2020 03:16:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nuviainc-com.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=4l+GF0OhVfuWSI6ZXQlO3cYAHZCUfzWRV+qD+QjbqH8=; b=DGHTUo35+J1YvivDVa21BZh5S1TFxh51cpBAVpFzO7t5Q6ADlFVd5nly46vWL0vP/G frXsPPMtTNsk/GV+MA5Uukq7Gz4QV4bkwz4Bh6HplMw1Cznl+R0zgyRtMLciuqZqCvD0 aAyQt7y3HF6uZhSzfOO41WtMYUh8J636vwMoMeKcpMajQ4pmMzTJFuKoDW3+shm96i/v vn3lBxZ5Vaj6KsJ2hDrWA1xhX/0BKzNm5J0TfvlVVL4o9mu2m7lLKwcW+qe2UZ+vADRB jwoYd7SgC5X5dVNcQvKTkdux5WfVVGp42wHl7PqjjGipQOwcDT/Lth3Wm0bkXHO+lxxh 8PAQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=4l+GF0OhVfuWSI6ZXQlO3cYAHZCUfzWRV+qD+QjbqH8=; b=PGJXKDGU/0SNP6aT2cbS83yTHlbwMoHSpFy7xJWMsK5wnXi7uvHOsEzDExO8ZiHsFW ASxVY7pFry/13NYK4KUbAGIdqBSaeAheNR0pyQt517k7M7RsdfMdQBpZHU+v9+uYhA4S cRwnT3vh9X4Q6A0AjXSIBk49MfH98Kx0JpS6r6S0ygFWs5x6gk8b1JkpmEjPeq82iolr ml4yCwqA6S61oenxmmp728nAN2CLKyuJWcicTUm8oH/OmeLwqxswiU4SCa+Retb1X+vY FllBNvQvkr2UuKIGyrITEL4BHfAuRdNQTSYPA/vj3Lay4NMJIT+E1I4wZsLg4Q8ZPXFo EHpA== X-Gm-Message-State: AGi0PublNZ3fyan2dNvUymTvIwAqEI/ZH8Ud2jil2h/biUHQRQ4JWZz+ k0M872oPGx4oHPoT8w2KcIQbBQ== X-Google-Smtp-Source: APiQypKjgYqTMkUbl1+R2Zw++0FujHTy2nsx9fVf2fXEOp9FdKENmP0NSDnWwOPkPMdxLRRxTmZfgg== X-Received: by 2002:adf:9e8c:: with SMTP id a12mr2691068wrf.273.1585822573205; Thu, 02 Apr 2020 03:16:13 -0700 (PDT) Return-Path: Received: from vanye ([2001:470:1f09:12f0:b26e:bfff:fea9:f1b8]) by smtp.gmail.com with ESMTPSA id b203sm6614959wmc.45.2020.04.02.03.16.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 02 Apr 2020 03:16:12 -0700 (PDT) Date: Thu, 2 Apr 2020 11:16:10 +0100 From: "Leif Lindholm" To: Ard Biesheuvel Cc: devel@edk2.groups.io Subject: Re: [PATCH 1/5] ArmPkg/CpuDxe: use private copy of GetRootTranslationTableInfo() Message-ID: <20200402101610.GL7468@vanye> References: <20200328104321.8668-1-ard.biesheuvel@linaro.org> <20200328104321.8668-2-ard.biesheuvel@linaro.org> MIME-Version: 1.0 In-Reply-To: <20200328104321.8668-2-ard.biesheuvel@linaro.org> User-Agent: Mutt/1.10.1 (2018-07-13) Content-Type: text/plain; charset=us-ascii Content-Disposition: inline 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 > --- > 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 regardless, but I'd appreciate if you could sling a STATIC into ArmPkg/Library/ArmMmuLib/AArch64/ArmMmuLibCore.c as well before pushing. > - IN UINTN T0SZ, > - OUT UINTN *TableLevel, > - OUT UINTN *TableEntryCount > - ); > - > EFI_STATUS > SetGcdMemorySpaceAttributes ( > IN EFI_GCD_MEMORY_SPACE_DESCRIPTOR *MemorySpaceMap, > -- > 2.17.1 >