From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from muminek.juszkiewicz.com.pl (muminek.juszkiewicz.com.pl [213.251.184.221]) by mx.groups.io with SMTP id smtpd.web10.1373.1685947079352378158 for ; Sun, 04 Jun 2023 23:37:59 -0700 Authentication-Results: mx.groups.io; dkim=missing; spf=softfail (domain: linaro.org, ip: 213.251.184.221, mailfrom: marcin.juszkiewicz@linaro.org) Received: from localhost (localhost [127.0.0.1]) by muminek.juszkiewicz.com.pl (Postfix) with ESMTP id E62FA260B92; Mon, 5 Jun 2023 08:37:57 +0200 (CEST) X-Virus-Scanned: Debian amavisd-new at juszkiewicz.com.pl Received: from muminek.juszkiewicz.com.pl ([127.0.0.1]) by localhost (muminek.juszkiewicz.com.pl [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id KVpUDITLQ6fo; Mon, 5 Jun 2023 08:37:56 +0200 (CEST) Received: from applejack.lan (83.21.93.182.ipv4.supernova.orange.pl [83.21.93.182]) by muminek.juszkiewicz.com.pl (Postfix) with ESMTPSA id 993ED26069C; Mon, 5 Jun 2023 08:37:52 +0200 (CEST) From: "Marcin Juszkiewicz" To: devel@edk2.groups.io Cc: Sami Mujawar , Ard Biesheuvel , Leif Lindholm , Marcin Juszkiewicz Subject: [PATCH v2 6/8] ArmPkg: handle SVE/SME in ArmCpuInfo Date: Mon, 5 Jun 2023 08:37:41 +0200 Message-Id: <20230605063743.405487-8-marcin.juszkiewicz@linaro.org> X-Mailer: git-send-email 2.40.1 In-Reply-To: <20230605063743.405487-1-marcin.juszkiewicz@linaro.org> References: <20230605063743.405487-1-marcin.juszkiewicz@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable If cpu supports SVE or SME then display information of supported features. Signed-off-by: Marcin Juszkiewicz --- ArmPkg/Application/ArmCpuInfo/ArmCpuInfo.c | 344 +++++++++++++++++++++ 1 file changed, 344 insertions(+) diff --git a/ArmPkg/Application/ArmCpuInfo/ArmCpuInfo.c b/ArmPkg/Applicat= ion/ArmCpuInfo/ArmCpuInfo.c index c2ed6b93d968..ab1cc70933e1 100644 --- a/ArmPkg/Application/ArmCpuInfo/ArmCpuInfo.c +++ b/ArmPkg/Application/ArmCpuInfo/ArmCpuInfo.c @@ -2353,6 +2353,333 @@ HandleAa64Pfr1 ( // 63:40 are reserved } =20 +/** + Handle ID_AA64SMFR0_EL1 system register. + + @param[in] Aa64Smfr0, value of ID_AA64SMFR0_EL1 system register +**/ +VOID +HandleAa64Smfr0 ( + CONST UINT64 Aa64Smfr0 + ) +{ + UINT64 Value; + STATIC CONST CHAR8 RegName[] =3D "SMFR0"; + CONST CHAR8 *Description; + CONST CHAR8 *Bits; + + // 31:0 reserved + + Bits =3D " 32"; + Value =3D (Aa64Smfr0 >> 32) & 0x1; + switch (Value) { + case 0: + Description =3D "SME F32F32 not implemented."; + break; + case 1: + Description =3D "SME F32F32 implemented."; + break; + default: + Description =3D "unknown"; + break; + } + + PrintValues (RegName, Bits, Value, Description); + + // 33 reserved + + Bits =3D " 34"; + Value =3D (Aa64Smfr0 >> 34) & 0x1; + switch (Value) { + case 0: + Description =3D "SME B16F32 not implemented."; + break; + case 1: + Description =3D "SME B16F32 implemented."; + break; + default: + Description =3D "unknown"; + break; + } + + PrintValues (RegName, Bits, Value, Description); + + Bits =3D " 35"; + Value =3D (Aa64Smfr0 >> 35) & 0x1; + switch (Value) { + case 0: + Description =3D "SME F16F32 not implemented."; + break; + case 1: + Description =3D "SME F16F32 implemented."; + break; + default: + Description =3D "unknown"; + break; + } + + PrintValues (RegName, Bits, Value, Description); + + Bits =3D "39:36"; + Value =3D (Aa64Smfr0 >> 36) & 0xf; + switch (Value) { + case b0000: + Description =3D "SME I8I32 not implemented."; + break; + case b1111: + Description =3D "SME I8I32 implemented."; + break; + default: + Description =3D "unknown"; + break; + } + + PrintValues (RegName, Bits, Value, Description); + + // 47:40 reserved + + Bits =3D " 48"; + Value =3D (Aa64Smfr0 >> 48) & 0x1; + switch (Value) { + case 0: + Description =3D "SME F64F64 not implemented."; + break; + case 1: + Description =3D "SME F64F64 implemented."; + break; + default: + Description =3D "unknown"; + break; + } + + PrintValues (RegName, Bits, Value, Description); + + // 51:49 reserved + + Bits =3D "55:52"; + Value =3D (Aa64Smfr0 >> 52) & 0xf; + switch (Value) { + case b0000: + Description =3D "SME I16I64 not implemented"; + break; + case b1111: + Description =3D "SME I16I64 implemented"; + break; + default: + Description =3D "unknown"; + break; + } + + PrintValues (RegName, Bits, Value, Description); + + Bits =3D "59:56"; + Value =3D (Aa64Smfr0 >> 56) & 0xf; + switch (Value) { + case b0000: + Description =3D "Mandatory SME instructions are implemented."; + break; + default: + Description =3D "unknown"; + break; + } + + PrintValues (RegName, Bits, Value, Description); + + // 62:60 reserved + + Bits =3D " 63"; + Value =3D (Aa64Smfr0 >> 63) & 0x1; + switch (Value) { + case 0: + Description =3D "SME_FA64 not implemented."; + break; + case 1: + Description =3D "SME_FA64 implemented."; + break; + default: + Description =3D "unknown"; + break; + } + + PrintValues (RegName, Bits, Value, Description); +} + +/** + Handle ID_AA64ZFR0_EL1 system register. + + @param[in] Aa64Zfr0, value of ID_AA64ZFR0_EL1 system register +**/ +VOID +HandleAa64Zfr0 ( + CONST UINT64 Aa64Zfr0 + ) +{ + UINT64 Value; + STATIC CONST CHAR8 RegName[] =3D "ZFR0"; + CONST CHAR8 *Description; + CONST CHAR8 *Bits; + + Bits =3D "3:0 "; + Value =3D Aa64Zfr0 & 0xf; + switch (Value) { + case b0000: + Description =3D "FEAT_SVE implemented."; + break; + case b0001: + Description =3D "FEAT_SVE2 implemented."; + break; + default: + Description =3D "unknown"; + break; + } + + PrintValues (RegName, Bits, Value, Description); + + Bits =3D "7:4 "; + Value =3D (Aa64Zfr0 >> 4) & 0xf; + switch (Value) { + case b0000: + Description =3D "FEAT_SVE_AES not implemented."; + break; + case b0001: + Description =3D "FEAT_SVE_AES implemented."; + break; + case b0010: + Description =3D "FEAT_SVE_AES and FEAT_SVE_PMULL128 implemented."; + break; + default: + Description =3D "unknown"; + break; + } + + PrintValues (RegName, Bits, Value, Description); + + // 15:8 reserved + + Bits =3D "19:16"; + Value =3D (Aa64Zfr0 >> 16) & 0xf; + switch (Value) { + case b0000: + Description =3D "FEAT_SVE_BitPerm not implemented."; + break; + case b0001: + Description =3D "FEAT_SVE_BitPerm implemented."; + break; + default: + Description =3D "unknown"; + break; + } + + PrintValues (RegName, Bits, Value, Description); + + Bits =3D "23:20"; + Value =3D (Aa64Zfr0 >> 20) & 0xf; + switch (Value) { + case b0000: + Description =3D "SVE BFloat16 not implemented."; + break; + case b0001: + Description =3D "FEAT_BF16 SVE implemented."; + break; + case b0010: + Description =3D "FEAT_EBF16 SVE implemented."; + break; + default: + Description =3D "unknown"; + break; + } + + PrintValues (RegName, Bits, Value, Description); + + // 31:24 reserved + + Bits =3D "35:32"; + Value =3D (Aa64Zfr0 >> 32) & 0xf; + switch (Value) { + case b0000: + Description =3D "FEAT_SVE_SHA3 not implemented."; + break; + case b0001: + Description =3D "FEAT_SVE_SHA3 implemented."; + break; + default: + Description =3D "unknown"; + break; + } + + PrintValues (RegName, Bits, Value, Description); + + // 39:36 reserved + + Bits =3D "43:40"; + Value =3D (Aa64Zfr0 >> 40) & 0xf; + switch (Value) { + case b0000: + Description =3D "FEAT_SVE_SM4 not implemented."; + break; + case b0001: + Description =3D "FEAT_SVE_SM4 implemented."; + break; + default: + Description =3D "unknown"; + break; + } + + PrintValues (RegName, Bits, Value, Description); + + Bits =3D "47:44"; + Value =3D (Aa64Zfr0 >> 44) & 0xf; + switch (Value) { + case b0000: + Description =3D "FEAT_I8MM SVE not implemented."; + break; + case b0001: + Description =3D "FEAT_I8MM SVE implemented."; + break; + default: + Description =3D "unknown"; + break; + } + + PrintValues (RegName, Bits, Value, Description); + + // 51:48 reserved + + Bits =3D "55:52"; + Value =3D (Aa64Zfr0 >> 52) & 0xf; + switch (Value) { + case b0000: + Description =3D "FEAT_F32MM SVE not implemented"; + break; + case b0001: + Description =3D "FEAT_F32MM SVE implemented"; + break; + default: + Description =3D "unknown"; + break; + } + + PrintValues (RegName, Bits, Value, Description); + + Bits =3D "59:56"; + Value =3D (Aa64Zfr0 >> 56) & 0xf; + switch (Value) { + case b0000: + Description =3D "FEAT_F64MM SVE not implemented"; + break; + case b0001: + Description =3D "FEAT_F64MM SVE implemented"; + break; + default: + Description =3D "unknown"; + break; + } + + PrintValues (RegName, Bits, Value, Description); + + // 63:60 reserved +} + /** The user Entry Point for Application. The user code starts with this f= unction as the real entry point for the application. @@ -2380,6 +2707,8 @@ UefiMain ( UINT64 Aa64Mmfr2; UINT64 Aa64Pfr0; UINT64 Aa64Pfr1; + UINT64 Aa64Smfr0; + UINT64 Aa64Zfr0; =20 Aa64Dfr0 =3D ArmReadIdAA64Dfr0 (); Aa64Isar0 =3D ArmReadIdAA64Isar0 (); @@ -2390,6 +2719,8 @@ UefiMain ( Aa64Mmfr2 =3D ArmReadIdAA64Mmfr2 (); Aa64Pfr0 =3D ArmReadIdAA64Pfr0 (); Aa64Pfr1 =3D ArmReadIdAA64Pfr1 (); + Aa64Smfr0 =3D ArmReadIdAA64Smfr0 (); + Aa64Zfr0 =3D ArmReadIdAA64Zfr0 (); =20 AsciiPrint ("ID_AA64MMFR0_EL1 =3D 0x%016lx\n", Aa64Mmfr0); AsciiPrint ("ID_AA64MMFR1_EL1 =3D 0x%016lx\n", Aa64Mmfr1); @@ -2400,6 +2731,8 @@ UefiMain ( AsciiPrint ("ID_AA64ISAR1_EL1 =3D 0x%016lx\n", Aa64Isar1); AsciiPrint ("ID_AA64ISAR2_EL1 =3D 0x%016lx\n", Aa64Isar2); AsciiPrint ("ID_AA64DFR0_EL1 =3D 0x%016lx\n", Aa64Dfr0); + AsciiPrint ("ID_AA64SMFR0_EL1 =3D 0x%016lx\n", Aa64Smfr0); + AsciiPrint ("ID_AA64ZFR0_EL1 =3D 0x%016lx\n", Aa64Zfr0); AsciiPrint ("\n"); =20 PrintText ("Register", "Bits", "Value", "Feature"); @@ -2440,6 +2773,17 @@ UefiMain ( } =20 HandleAa64Dfr0 (Aa64Dfr0); + PrintSpacer (); + + if (Aa64Smfr0) { + HandleAa64Smfr0 (Aa64Smfr0); + PrintSpacer (); + } + + if (Aa64Zfr0) { + HandleAa64Zfr0 (Aa64Zfr0); + PrintSpacer (); + } =20 return EFI_SUCCESS; } --=20 2.40.1