From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail02.groups.io (mail02.groups.io [66.175.222.108]) by spool.mail.gandi.net (Postfix) with ESMTPS id 94131D802DB for ; Wed, 20 Sep 2023 15:41:47 +0000 (UTC) DKIM-Signature: a=rsa-sha256; bh=gIj1E1uNGzgbfoQgE22JhGJYXPBN/lcrZLG1OfRGWAQ=; c=relaxed/simple; d=groups.io; h=Date:From:To:CC:Subject:Message-ID:References:MIME-Version:In-Reply-To:Precedence:List-Subscribe:List-Help:Sender:List-Id:Mailing-List:Delivered-To:Reply-To:List-Unsubscribe-Post:List-Unsubscribe:Content-Type:Content-Disposition:Content-Transfer-Encoding; s=20140610; t=1695224506; v=1; b=K5KVInY4Odd5uZt8CK3qzaAUpqNi74mrLBnI8h7g6YS2WCgy32sljh5N+5N/yjMJoBiwLfrM 87ESC7gW7buh7Wavcp6E+6GxnAfG3n9erJaqIE93vOfqviNrh7JycvHxQ+9vYZw3SqtzgNeV1L5 9pwHDCSxjocCRhcjWssnIYQQ= X-Received: by 127.0.0.2 with SMTP id wFIdYY7687511xfnISRTi1tG; Wed, 20 Sep 2023 08:41:46 -0700 X-Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by mx.groups.io with SMTP id smtpd.web11.43282.1695224505481263409 for ; Wed, 20 Sep 2023 08:41:45 -0700 X-Received: from pps.filterd (m0279866.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 38KCNcPe004074; Wed, 20 Sep 2023 15:41:42 GMT X-Received: from nasanppmta03.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3t80pk8g3w-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 20 Sep 2023 15:41:42 +0000 X-Received: from nasanex01c.na.qualcomm.com (nasanex01c.na.qualcomm.com [10.45.79.139]) by NASANPPMTA03.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 38KFffWt014098 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 20 Sep 2023 15:41:41 GMT X-Received: from qc-i7.hemma.eciton.net (10.80.80.8) by nasanex01c.na.qualcomm.com (10.45.79.139) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1118.36; Wed, 20 Sep 2023 08:41:40 -0700 Date: Wed, 20 Sep 2023 16:41:37 +0100 From: "Leif Lindholm" To: Marcin Juszkiewicz CC: , Ard Biesheuvel , Sami Mujawar Subject: Re: [edk2-devel] [PATCH 1/1] ArmPkg/ArmLib: Add ArmHasVhe () helper function Message-ID: References: <20230920123928.274026-1-quic_llindhol@quicinc.com> MIME-Version: 1.0 In-Reply-To: X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nasanex01c.na.qualcomm.com (10.45.79.139) X-QCInternal: smtphost X-Proofpoint-GUID: CQrlPPtKQM9LKOr277GkT2PKs5MzBJfS X-Proofpoint-ORIG-GUID: CQrlPPtKQM9LKOr277GkT2PKs5MzBJfS X-MIME-Autoconverted: from 8bit to quoted-printable by mx0a-0031df01.pphosted.com id 38KCNcPe004074 Precedence: Bulk List-Subscribe: List-Help: Sender: devel@edk2.groups.io List-Id: Mailing-List: list devel@edk2.groups.io; contact devel+owner@edk2.groups.io Reply-To: devel@edk2.groups.io,quic_llindhol@quicinc.com List-Unsubscribe-Post: List-Unsubscribe=One-Click List-Unsubscribe: X-Gm-Message-State: AkvRTPWyM3oWskBZ0bS0p3GRx7686176AA= Content-Type: text/plain; charset="iso-8859-1" Content-Disposition: inline Content-Transfer-Encoding: quoted-printable X-GND-Status: LEGIT Authentication-Results: spool.mail.gandi.net; dkim=pass header.d=groups.io header.s=20140610 header.b=K5KVInY4; spf=pass (spool.mail.gandi.net: domain of bounce@groups.io designates 66.175.222.108 as permitted sender) smtp.mailfrom=bounce@groups.io; dmarc=fail reason="SPF not aligned (relaxed), DKIM not aligned (relaxed)" header.from=quicinc.com (policy=none) On Wed, Sep 20, 2023 at 15:51:23 +0200, Marcin Juszkiewicz wrote: > W dniu 20.09.2023 o=A014:39, Leif Lindholm pisze: > > Create a helper function to query whether ID_AA64MFR1_EL1 indicates > > presence of the Virtualization Host Extensions. This feature is only > > visible in AARCH64 state. > >=20 > > Signed-off-by: Leif Lindholm > > Cc: Ard Biesheuvel > > Cc: Sami Mujawar > > Cc: Marcin Juszkiewicz >=20 > Tested-by: Marcin Juszkiewicz Thanks both. Merged as 89dad77cfbff. / Leif > GTDT for SBSA Reference Platform will use it for NS EL2 virtual timer: >=20 > default: > Virtual EL2 Timer GSIV : 0x1C > Virtual EL2 Timer Flags : 0x6 >=20 > non-vhe cpu: > Virtual EL2 Timer GSIV : 0x0 > Virtual EL2 Timer Flags : 0x0 >=20 > > --- > > ArmPkg/Include/Chipset/AArch64.h | 3 +++ > > ArmPkg/Include/Library/ArmLib.h | 18 ++++++++++++++++++ > > ArmPkg/Library/ArmLib/AArch64/AArch64Lib.c | 15 +++++++++++++++ > > 3 files changed, 36 insertions(+) > >=20 > > diff --git a/ArmPkg/Include/Chipset/AArch64.h b/ArmPkg/Include/Chipset/= AArch64.h > > index 690433f68ec8..2e87917049f9 100644 > > --- a/ArmPkg/Include/Chipset/AArch64.h > > +++ b/ArmPkg/Include/Chipset/AArch64.h > > @@ -24,6 +24,9 @@ > > // Coprocessor Trap Register (CPTR) > > #define AARCH64_CPTR_TFP (1 << 10) > > +// ID_AA64MMFR1 - AArch64 Memory Model Feature Register 0 definitions > > +#define AARCH64_MMFR1_VH (0xF << 8) > > + > > // ID_AA64PFR0 - AArch64 Processor Feature Register 0 definitions > > #define AARCH64_PFR0_FP (0xF << 16) > > #define AARCH64_PFR0_GIC (0xF << 24) > > diff --git a/ArmPkg/Include/Library/ArmLib.h b/ArmPkg/Include/Library/A= rmLib.h > > index 6c5315d7f45f..0169dbc1092c 100644 > > --- a/ArmPkg/Include/Library/ArmLib.h > > +++ b/ArmPkg/Include/Library/ArmLib.h > > @@ -764,6 +764,24 @@ ArmHasCcidx ( > > VOID > > ); > > +#ifdef MDE_CPU_AARCH64 > > +/// > > +/// AArch64-only ID Register Helper functions > > +/// > > + > > +/** > > + Checks whether the CPU implements the Virtualization Host Extensions= . > > + > > + @retval TRUE FEAT_VHE is implemented. > > + @retval FALSE FEAT_VHE is not mplemented. > > +**/ > > +BOOLEAN > > +EFIAPI > > +ArmHasVhe ( > > + VOID > > + ); > > +#endif // MDE_CPU_AARCH64 > > + > > #ifdef MDE_CPU_ARM > > /// > > /// AArch32-only ID Register Helper functions > > diff --git a/ArmPkg/Library/ArmLib/AArch64/AArch64Lib.c b/ArmPkg/Librar= y/ArmLib/AArch64/AArch64Lib.c > > index 7ab28e3e05fe..da5755106e62 100644 > > --- a/ArmPkg/Library/ArmLib/AArch64/AArch64Lib.c > > +++ b/ArmPkg/Library/ArmLib/AArch64/AArch64Lib.c > > @@ -104,3 +104,18 @@ ArmHasCcidx ( > > Mmfr2 =3D ArmReadIdAA64Mmfr2 (); > > return (((Mmfr2 >> 20) & 0xF) =3D=3D 1) ? TRUE : FALSE; > > } > > + > > +/** > > + Checks whether the CPU implements the Virtualization Host Extensions= . > > + > > + @retval TRUE FEAT_VHE is implemented. > > + @retval FALSE FEAT_VHE is not mplemented. > > +**/ > > +BOOLEAN > > +EFIAPI > > +ArmHasVhe ( > > + VOID > > + ) > > +{ > > + return ((ArmReadIdAA64Mmfr1 () & AARCH64_MMFR1_VH) !=3D 0); > > +} >=20 -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D- Groups.io Links: You receive all messages sent to this group. View/Reply Online (#108919): https://edk2.groups.io/g/devel/message/108919 Mute This Topic: https://groups.io/mt/101477322/7686176 Group Owner: devel+owner@edk2.groups.io Unsubscribe: https://edk2.groups.io/g/devel/leave/12367111/7686176/19134562= 12/xyzzy [rebecca@openfw.io] -=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-=3D-