From nobody Sat May 4 13:35:07 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1606405999; cv=none; d=zohomail.com; s=zohoarc; b=TvXniitYl1imKIFr+mFszxn1yGNmC/93QTCMzema5hajaJZX8KdcvlvochvzEfHBUXW0A15y66t1b7kYKjZ4vJjLVedr8vRX28YeU35lhonRaMxKAGdBeDjpfP0k0EwqLbHNszP9Xx7p7fS3FK4rAbPXaaTn/IbcUCTbMaTx0AY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1606405999; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=uCw4CqBiaF81bee+haKLt9FDMsMvGZEz4hRLvr47Z5Q=; b=J+emEbA9X8SToe8805UnA5GfVejRlKw56gEiahfrdzFiJxC+vuOzrr1ZQcqu+fB84+iN8g64qwqOsRxzxcJ6z13jZ4WjLaJaH6pSvgYy7Zoa7r56dAYkCEoq9Db/VdRe1olL3MCBE92sdbxa4GEJMNbLraqEmlMSHHc+pwQJiIk= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1606405999138147.73581715633827; Thu, 26 Nov 2020 07:53:19 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.38695.71443 (Exim 4.92) (envelope-from ) id 1kiJZw-0004Cw-PY; Thu, 26 Nov 2020 15:53:04 +0000 Received: by outflank-mailman (output) from mailman id 38695.71443; Thu, 26 Nov 2020 15:53:04 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kiJZw-0004Cp-Lg; Thu, 26 Nov 2020 15:53:04 +0000 Received: by outflank-mailman (input) for mailman id 38695; Thu, 26 Nov 2020 15:53:03 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kiJZv-0004Ch-LO for xen-devel@lists.xenproject.org; Thu, 26 Nov 2020 15:53:03 +0000 Received: from foss.arm.com (unknown [217.140.110.172]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTP id d1e24fff-4259-4dc0-a40e-aafde6250990; Thu, 26 Nov 2020 15:53:02 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 923E131B; Thu, 26 Nov 2020 07:53:02 -0800 (PST) Received: from e109506-lin.cambridge.arm.com (e109506-lin.cambridge.arm.com [10.1.199.1]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id C7A693F23F; Thu, 26 Nov 2020 07:53:01 -0800 (PST) Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kiJZv-0004Ch-LO for xen-devel@lists.xenproject.org; Thu, 26 Nov 2020 15:53:03 +0000 Received: from foss.arm.com (unknown [217.140.110.172]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTP id d1e24fff-4259-4dc0-a40e-aafde6250990; Thu, 26 Nov 2020 15:53:02 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 923E131B; Thu, 26 Nov 2020 07:53:02 -0800 (PST) Received: from e109506-lin.cambridge.arm.com (e109506-lin.cambridge.arm.com [10.1.199.1]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id C7A693F23F; Thu, 26 Nov 2020 07:53:01 -0800 (PST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: d1e24fff-4259-4dc0-a40e-aafde6250990 From: Bertrand Marquis To: xen-devel@lists.xenproject.org Cc: Stefano Stabellini , Julien Grall , Volodymyr Babchuk Subject: [PATCH 1/7] xen/arm: Add ID registers and complete cpufinfo Date: Thu, 26 Nov 2020 15:51:03 +0000 Message-Id: <181f3157e2895498b09790d02555e5530adec6ad.1606317985.git.bertrand.marquis@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Add definition and entries in cpuinfo for ID registers introduced in newer Arm Architecture reference manual: - ID_PFR2: processor feature register 2 - ID_DFR1: debug feature register 1 - ID_MMFR4 and ID_MMFR5: Memory model feature registers 4 and 5 - ID_ISA6: ISA Feature register 6 Add more bitfield definitions in PFR fields of cpuinfo. Add MVFR2 register definition for aarch32. Add mvfr values in cpuinfo. Add some registers definition for arm64 in sysregs as some are not always know by compilers. Initialize the new values added in cpuinfo in identify_cpu during init. Signed-off-by: Bertrand Marquis --- xen/arch/arm/cpufeature.c | 16 ++++++++ xen/include/asm-arm/arm64/sysregs.h | 22 +++++++++++ xen/include/asm-arm/cpregs.h | 10 +++++ xen/include/asm-arm/cpufeature.h | 61 +++++++++++++++++++++++++---- 4 files changed, 101 insertions(+), 8 deletions(-) diff --git a/xen/arch/arm/cpufeature.c b/xen/arch/arm/cpufeature.c index 44126dbf07..c0adf848c5 100644 --- a/xen/arch/arm/cpufeature.c +++ b/xen/arch/arm/cpufeature.c @@ -114,13 +114,17 @@ void identify_cpu(struct cpuinfo_arm *c) =20 c->mm64.bits[0] =3D READ_SYSREG64(ID_AA64MMFR0_EL1); c->mm64.bits[1] =3D READ_SYSREG64(ID_AA64MMFR1_EL1); + c->mm64.bits[2] =3D READ_SYSREG64(ID_AA64MMFR2_EL1); =20 c->isa64.bits[0] =3D READ_SYSREG64(ID_AA64ISAR0_EL1); c->isa64.bits[1] =3D READ_SYSREG64(ID_AA64ISAR1_EL1); + + c->zfr64.bits[0] =3D READ_SYSREG64(ID_AA64ZFR0_EL1); #endif =20 c->pfr32.bits[0] =3D READ_SYSREG32(ID_PFR0_EL1); c->pfr32.bits[1] =3D READ_SYSREG32(ID_PFR1_EL1); + c->pfr32.bits[2] =3D READ_SYSREG32(ID_PFR2_EL1); =20 c->dbg32.bits[0] =3D READ_SYSREG32(ID_DFR0_EL1); =20 @@ -130,6 +134,8 @@ void identify_cpu(struct cpuinfo_arm *c) c->mm32.bits[1] =3D READ_SYSREG32(ID_MMFR1_EL1); c->mm32.bits[2] =3D READ_SYSREG32(ID_MMFR2_EL1); c->mm32.bits[3] =3D READ_SYSREG32(ID_MMFR3_EL1); + c->mm32.bits[4] =3D READ_SYSREG32(ID_MMFR4_EL1); + c->mm32.bits[5] =3D READ_SYSREG32(ID_MMFR5_EL1); =20 c->isa32.bits[0] =3D READ_SYSREG32(ID_ISAR0_EL1); c->isa32.bits[1] =3D READ_SYSREG32(ID_ISAR1_EL1); @@ -137,6 +143,16 @@ void identify_cpu(struct cpuinfo_arm *c) c->isa32.bits[3] =3D READ_SYSREG32(ID_ISAR3_EL1); c->isa32.bits[4] =3D READ_SYSREG32(ID_ISAR4_EL1); c->isa32.bits[5] =3D READ_SYSREG32(ID_ISAR5_EL1); + c->isa32.bits[6] =3D READ_SYSREG32(ID_ISAR6_EL1); + +#ifdef CONFIG_ARM_64 + c->mvfr.bits[0] =3D READ_SYSREG64(MVFR0_EL1); + c->mvfr.bits[1] =3D READ_SYSREG64(MVFR1_EL1); + c->mvfr.bits[2] =3D READ_SYSREG64(MVFR2_EL1); +#else + c->mvfr.bits[0] =3D READ_CP32(MVFR0); + c->mvfr.bits[1] =3D READ_CP32(MVFR1); +#endif } =20 /* diff --git a/xen/include/asm-arm/arm64/sysregs.h b/xen/include/asm-arm/arm6= 4/sysregs.h index c60029d38f..fd0b25b9c7 100644 --- a/xen/include/asm-arm/arm64/sysregs.h +++ b/xen/include/asm-arm/arm64/sysregs.h @@ -57,6 +57,28 @@ #define ICH_AP1R2_EL2 __AP1Rx_EL2(2) #define ICH_AP1R3_EL2 __AP1Rx_EL2(3) =20 +/* + * Define ID coprocessor registers if they are not + * already defined by the compiler. + * + * Values picked from linux kernel + */ +#ifndef ID_AA64MMFR2_EL1 +#define ID_AA64MMFR2_EL1 S3_0_C0_C7_2 +#endif +#ifndef ID_PFR2_EL1 +#define ID_PFR2_EL1 S3_0_C0_C3_4 +#endif +#ifndef ID_MMFR5_EL1 +#define ID_MMFR5_EL1 S3_0_C0_C3_6 +#endif +#ifndef ID_ISAR6_EL1 +#define ID_ISAR6_EL1 S3_0_C0_C2_7 +#endif +#ifndef ID_AA64ZFR0_EL1 +#define ID_AA64ZFR0_EL1 S3_0_C0_C4_4 +#endif + /* Access to system registers */ =20 #define READ_SYSREG32(name) ((uint32_t)READ_SYSREG64(name)) diff --git a/xen/include/asm-arm/cpregs.h b/xen/include/asm-arm/cpregs.h index 8fd344146e..aa8fc1d4a3 100644 --- a/xen/include/asm-arm/cpregs.h +++ b/xen/include/asm-arm/cpregs.h @@ -63,6 +63,7 @@ #define FPSID p10,7,c0,c0,0 /* Floating-Point System ID Regist= er */ #define FPSCR p10,7,c1,c0,0 /* Floating-Point Status and Contr= ol Register */ #define MVFR0 p10,7,c7,c0,0 /* Media and VFP Feature Register = 0 */ +#define MVFR1 p10,7,c6,c0,0 /* Media and VFP Feature Register = 1 */ #define FPEXC p10,7,c8,c0,0 /* Floating-Point Exception Contro= l Register */ #define FPINST p10,7,c9,c0,0 /* Floating-Point Instruction Regi= ster */ #define FPINST2 p10,7,c10,c0,0 /* Floating-point Instruction Regi= ster 2 */ @@ -108,18 +109,23 @@ #define MPIDR p15,0,c0,c0,5 /* Multiprocessor Affinity Registe= r */ #define ID_PFR0 p15,0,c0,c1,0 /* Processor Feature Register 0 */ #define ID_PFR1 p15,0,c0,c1,1 /* Processor Feature Register 1 */ +#define ID_PFR2 p15,0,c0,c3,4 /* Processor Feature Register 2 */ #define ID_DFR0 p15,0,c0,c1,2 /* Debug Feature Register 0 */ +#define ID_DFR1 p15,0,c0,c3,5 /* Debug Feature Register 1 */ #define ID_AFR0 p15,0,c0,c1,3 /* Auxiliary Feature Register 0 */ #define ID_MMFR0 p15,0,c0,c1,4 /* Memory Model Feature Register 0= */ #define ID_MMFR1 p15,0,c0,c1,5 /* Memory Model Feature Register 1= */ #define ID_MMFR2 p15,0,c0,c1,6 /* Memory Model Feature Register 2= */ #define ID_MMFR3 p15,0,c0,c1,7 /* Memory Model Feature Register 3= */ +#define ID_MMFR4 p15,0,c0,c2,6 /* Memory Model Feature Register 4= */ +#define ID_MMFR5 p15,0,c0,c3,6 /* Memory Model Feature Register 5= */ #define ID_ISAR0 p15,0,c0,c2,0 /* ISA Feature Register 0 */ #define ID_ISAR1 p15,0,c0,c2,1 /* ISA Feature Register 1 */ #define ID_ISAR2 p15,0,c0,c2,2 /* ISA Feature Register 2 */ #define ID_ISAR3 p15,0,c0,c2,3 /* ISA Feature Register 3 */ #define ID_ISAR4 p15,0,c0,c2,4 /* ISA Feature Register 4 */ #define ID_ISAR5 p15,0,c0,c2,5 /* ISA Feature Register 5 */ +#define ID_ISAR6 p15,0,c0,c2,7 /* ISA Feature Register 6 */ #define CCSIDR p15,1,c0,c0,0 /* Cache Size ID Registers */ #define CLIDR p15,1,c0,c0,1 /* Cache Level ID Register */ #define CSSELR p15,2,c0,c0,0 /* Cache Size Selection Register */ @@ -318,12 +324,16 @@ #define ID_ISAR3_EL1 ID_ISAR3 #define ID_ISAR4_EL1 ID_ISAR4 #define ID_ISAR5_EL1 ID_ISAR5 +#define ID_ISAR6_EL1 ID_ISAR6 #define ID_MMFR0_EL1 ID_MMFR0 #define ID_MMFR1_EL1 ID_MMFR1 #define ID_MMFR2_EL1 ID_MMFR2 #define ID_MMFR3_EL1 ID_MMFR3 +#define ID_MMFR4_EL1 ID_MMFR4 +#define ID_MMFR5_EL1 ID_MMFR5 #define ID_PFR0_EL1 ID_PFR0 #define ID_PFR1_EL1 ID_PFR1 +#define ID_PFR2_EL1 ID_PFR2 #define IFSR32_EL2 IFSR #define MDCR_EL2 HDCR #define MIDR_EL1 MIDR diff --git a/xen/include/asm-arm/cpufeature.h b/xen/include/asm-arm/cpufeat= ure.h index c7b5052992..1862c14e37 100644 --- a/xen/include/asm-arm/cpufeature.h +++ b/xen/include/asm-arm/cpufeature.h @@ -148,6 +148,7 @@ struct cpuinfo_arm { union { uint64_t bits[2]; struct { + /* PFR0 */ unsigned long el0:4; unsigned long el1:4; unsigned long el2:4; @@ -155,9 +156,23 @@ struct cpuinfo_arm { unsigned long fp:4; /* Floating Point */ unsigned long simd:4; /* Advanced SIMD */ unsigned long gic:4; /* GIC support */ - unsigned long __res0:28; + unsigned long ras:4; + unsigned long sve:4; + unsigned long sel2:4; + unsigned long mpam:4; + unsigned long amu:4; + unsigned long dit:4; + unsigned long __res0:4; unsigned long csv2:4; - unsigned long __res1:4; + unsigned long cvs3:4; + + /* PFR1 */ + unsigned long bt:4; + unsigned long ssbs:4; + unsigned long mte:4; + unsigned long ras_frac:4; + unsigned long mpam_frac:4; + unsigned long __res1:44; }; } pfr64; =20 @@ -170,7 +185,7 @@ struct cpuinfo_arm { } aux64; =20 union { - uint64_t bits[2]; + uint64_t bits[3]; struct { unsigned long pa_range:4; unsigned long asid_bits:4; @@ -190,6 +205,8 @@ struct cpuinfo_arm { unsigned long pan:4; unsigned long __res1:8; unsigned long __res2:32; + + unsigned long __res3:64; }; } mm64; =20 @@ -197,6 +214,10 @@ struct cpuinfo_arm { uint64_t bits[2]; } isa64; =20 + struct { + uint64_t bits[1]; + } zfr64; + #endif =20 /* @@ -204,20 +225,33 @@ struct cpuinfo_arm { * when running in 32-bit mode. */ union { - uint32_t bits[2]; + uint32_t bits[3]; struct { + /* PFR0 */ unsigned long arm:4; unsigned long thumb:4; unsigned long jazelle:4; unsigned long thumbee:4; - unsigned long __res0:16; + unsigned long csv2:4; + unsigned long amu:4; + unsigned long dit:4; + unsigned long ras:4; =20 + /* PFR1 */ unsigned long progmodel:4; unsigned long security:4; unsigned long mprofile:4; unsigned long virt:4; unsigned long gentimer:4; - unsigned long __res1:12; + unsigned long sec_frac:4; + unsigned long virt_frac:4; + unsigned long gic:4; + + /* PFR2 */ + unsigned long csv3:4; + unsigned long ssbs:4; + unsigned long ras_frac:4; + unsigned long __res2:20; }; } pfr32; =20 @@ -230,12 +264,23 @@ struct cpuinfo_arm { } aux32; =20 struct { - uint32_t bits[4]; + uint32_t bits[6]; } mm32; =20 struct { - uint32_t bits[6]; + uint32_t bits[7]; } isa32; + +#ifdef CONFIG_ARM_64 + struct { + uint64_t bits[3]; + } mvfr; +#else + /* Only MVFR0 and MVFR1 exist on armv7 */ + struct { + uint32_t bits[2]; + } mvfr; +#endif }; =20 extern struct cpuinfo_arm boot_cpu_data; --=20 2.17.1 From nobody Sat May 4 13:35:07 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1606406002; cv=none; d=zohomail.com; s=zohoarc; b=SiF3BGxyYh3z5ALhq1FWlpVpgc+Y52/AJ4sm6i6Pcj4Wx3Lj90z9x+2ouOi0eJx7zDTtWoJIkLeidm64+J3jVIW3eFN/i2OA4MOEa+8tCxDdjS2ptYBfQg1UCqW2P6Wpg/v4ZGVZ3y0LffxTc6hvESb6vzvpmvsbDwt+IhA1HWs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1606406002; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=27iRn2U3Y8MySI0MCtbva+6/JmurNKktlyt/1FroIUc=; b=WvykCT30hTDGrDCKBc4aNrq7m0mb58DzdB51ZJPX9T1IXLlLYZ0xHKY9cOrpw8MNMkzf9CY5LdpT2yeeNaIHiShc2ZOnzAwduxvkwNkZFwvL1CZ/7zi5zDWKu2FXx4ezn9nI4n29jdWlOGY455aDiY7U95R5Xg+gkGWROXw74Os= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 160640600286537.80373632380508; Thu, 26 Nov 2020 07:53:22 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.38698.71467 (Exim 4.92) (envelope-from ) id 1kiJa2-0004Ia-CC; Thu, 26 Nov 2020 15:53:10 +0000 Received: by outflank-mailman (output) from mailman id 38698.71467; Thu, 26 Nov 2020 15:53:10 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kiJa2-0004IS-7A; Thu, 26 Nov 2020 15:53:10 +0000 Received: by outflank-mailman (input) for mailman id 38698; Thu, 26 Nov 2020 15:53:08 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kiJa0-0004Ch-Ha for xen-devel@lists.xenproject.org; Thu, 26 Nov 2020 15:53:08 +0000 Received: from foss.arm.com (unknown [217.140.110.172]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTP id 82f708c1-3d7d-41ff-933d-f670bfb3023d; Thu, 26 Nov 2020 15:53:03 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 74EAD1516; Thu, 26 Nov 2020 07:53:03 -0800 (PST) Received: from e109506-lin.cambridge.arm.com (e109506-lin.cambridge.arm.com [10.1.199.1]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id C5C943F23F; Thu, 26 Nov 2020 07:53:02 -0800 (PST) Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kiJa0-0004Ch-Ha for xen-devel@lists.xenproject.org; Thu, 26 Nov 2020 15:53:08 +0000 Received: from foss.arm.com (unknown [217.140.110.172]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTP id 82f708c1-3d7d-41ff-933d-f670bfb3023d; Thu, 26 Nov 2020 15:53:03 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 74EAD1516; Thu, 26 Nov 2020 07:53:03 -0800 (PST) Received: from e109506-lin.cambridge.arm.com (e109506-lin.cambridge.arm.com [10.1.199.1]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id C5C943F23F; Thu, 26 Nov 2020 07:53:02 -0800 (PST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 82f708c1-3d7d-41ff-933d-f670bfb3023d From: Bertrand Marquis To: xen-devel@lists.xenproject.org Cc: Stefano Stabellini , Julien Grall , Volodymyr Babchuk Subject: [PATCH 2/7] xen/arm: Add arm64 ID registers definitions Date: Thu, 26 Nov 2020 15:51:04 +0000 Message-Id: <5609f33f446fa08f83109a2f6f96b53cff672d4b.1606151462.git.bertrand.marquis@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Add coprocessor registers definitions for all ID registers trapped through the TID3 bit of HSR. Those are the one that will be emulated in Xen to only publish to guests the features that are supported by Xen and that are accessible to guests. Signed-off-by: Bertrand Marquis --- xen/include/asm-arm/arm64/hsr.h | 37 +++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) diff --git a/xen/include/asm-arm/arm64/hsr.h b/xen/include/asm-arm/arm64/hs= r.h index ca931dd2fe..e691d41c17 100644 --- a/xen/include/asm-arm/arm64/hsr.h +++ b/xen/include/asm-arm/arm64/hsr.h @@ -110,6 +110,43 @@ #define HSR_SYSREG_CNTP_CTL_EL0 HSR_SYSREG(3,3,c14,c2,1) #define HSR_SYSREG_CNTP_CVAL_EL0 HSR_SYSREG(3,3,c14,c2,2) =20 +/* Those registers are used when HCR_EL2.TID3 is set */ +#define HSR_SYSREG_ID_PFR0_EL1 HSR_SYSREG(3,0,c0,c1,0) +#define HSR_SYSREG_ID_PFR1_EL1 HSR_SYSREG(3,0,c0,c1,1) +#define HSR_SYSREG_ID_PFR2_EL1 HSR_SYSREG(3,0,c0,c3,4) +#define HSR_SYSREG_ID_DFR0_EL1 HSR_SYSREG(3,0,c0,c1,2) +#define HSR_SYSREG_ID_DFR1_EL1 HSR_SYSREG(3,0,c0,c3,5) +#define HSR_SYSREG_ID_AFR0_EL1 HSR_SYSREG(3,0,c0,c1,3) +#define HSR_SYSREG_ID_MMFR0_EL1 HSR_SYSREG(3,0,c0,c1,4) +#define HSR_SYSREG_ID_MMFR1_EL1 HSR_SYSREG(3,0,c0,c1,5) +#define HSR_SYSREG_ID_MMFR2_EL1 HSR_SYSREG(3,0,c0,c1,6) +#define HSR_SYSREG_ID_MMFR3_EL1 HSR_SYSREG(3,0,c0,c1,7) +#define HSR_SYSREG_ID_MMFR4_EL1 HSR_SYSREG(3,0,c0,c2,6) +#define HSR_SYSREG_ID_MMFR5_EL1 HSR_SYSREG(3,0,c0,c3,6) +#define HSR_SYSREG_ID_ISAR0_EL1 HSR_SYSREG(3,0,c0,c2,0) +#define HSR_SYSREG_ID_ISAR1_EL1 HSR_SYSREG(3,0,c0,c2,1) +#define HSR_SYSREG_ID_ISAR2_EL1 HSR_SYSREG(3,0,c0,c2,2) +#define HSR_SYSREG_ID_ISAR3_EL1 HSR_SYSREG(3,0,c0,c2,3) +#define HSR_SYSREG_ID_ISAR4_EL1 HSR_SYSREG(3,0,c0,c2,4) +#define HSR_SYSREG_ID_ISAR5_EL1 HSR_SYSREG(3,0,c0,c2,5) +#define HSR_SYSREG_ID_ISAR6_EL1 HSR_SYSREG(3,0,c0,c2,7) +#define HSR_SYSREG_MVFR0_EL1 HSR_SYSREG(3,0,c0,c3,0) +#define HSR_SYSREG_MVFR1_EL1 HSR_SYSREG(3,0,c0,c3,1) +#define HSR_SYSREG_MVFR2_EL1 HSR_SYSREG(3,0,c0,c3,2) + +#define HSR_SYSREG_ID_AA64PFR0_EL1 HSR_SYSREG(3,0,c0,c4,0) +#define HSR_SYSREG_ID_AA64PFR1_EL1 HSR_SYSREG(3,0,c0,c4,1) +#define HSR_SYSREG_ID_AA64DFR0_EL1 HSR_SYSREG(3,0,c0,c5,0) +#define HSR_SYSREG_ID_AA64DFR1_EL1 HSR_SYSREG(3,0,c0,c5,1) +#define HSR_SYSREG_ID_AA64ISAR0_EL1 HSR_SYSREG(3,0,c0,c6,0) +#define HSR_SYSREG_ID_AA64ISAR1_EL1 HSR_SYSREG(3,0,c0,c6,1) +#define HSR_SYSREG_ID_AA64MMFR0_EL1 HSR_SYSREG(3,0,c0,c7,0) +#define HSR_SYSREG_ID_AA64MMFR1_EL1 HSR_SYSREG(3,0,c0,c7,1) +#define HSR_SYSREG_ID_AA64MMFR2_EL1 HSR_SYSREG(3,0,c0,c7,2) +#define HSR_SYSREG_ID_AA64AFR0_EL1 HSR_SYSREG(3,0,c0,c5,4) +#define HSR_SYSREG_ID_AA64AFR1_EL1 HSR_SYSREG(3,0,c0,c5,5) +#define HSR_SYSREG_ID_AA64ZFR0_EL1 HSR_SYSREG(3,0,c0,c4,4) + #endif /* __ASM_ARM_ARM64_HSR_H */ =20 /* --=20 2.17.1 From nobody Sat May 4 13:35:07 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1606405998; cv=none; d=zohomail.com; s=zohoarc; b=MTCVyAK9+ozGWrdXnNPbF/fahQgeo59cRm45ksLlw9oNvlsp4m05plTuVbrovsrIwM2VPrmdBh6h74aYwMXJMYie+YSmbMc/KIUQbM/5XkgagHLM99anaMDCVrx3ADz0rD3d0mZsCYNlSgx252YAKXAkOcJGac+TlzWBtQQ3fYI= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1606405998; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=usHeCGpJQ9v47pV+sODsFuB2H09nWrxwsz2WO9pkS4Q=; b=OQ121m8mDXrS2LtuSjpg1dE6Xm1spkplcJHN5gbmm+EcILR+nwMWM0lSbcZO3ih0EtpZItZHa4pn3mDip8OtiHlhMOrPlBr29Ik5TiCmsZJ7a3aNwn5PDmLkiyAOZ9lGrXx+modFQI9utjHYRp7EgsW68Ol/Y4uJYSqOKduMruA= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 160640599852564.92246424813482; Thu, 26 Nov 2020 07:53:18 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.38697.71455 (Exim 4.92) (envelope-from ) id 1kiJZy-0004EL-20; Thu, 26 Nov 2020 15:53:06 +0000 Received: by outflank-mailman (output) from mailman id 38697.71455; Thu, 26 Nov 2020 15:53:06 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kiJZx-0004EC-Te; Thu, 26 Nov 2020 15:53:05 +0000 Received: by outflank-mailman (input) for mailman id 38697; Thu, 26 Nov 2020 15:53:05 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kiJZx-0004Dd-9k for xen-devel@lists.xenproject.org; Thu, 26 Nov 2020 15:53:05 +0000 Received: from foss.arm.com (unknown [217.140.110.172]) by us1-rack-iad1.inumbo.com (Halon) with ESMTP id 902b8efa-1484-4e62-a926-245695ab5dfb; Thu, 26 Nov 2020 15:53:04 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 5777631B; Thu, 26 Nov 2020 07:53:04 -0800 (PST) Received: from e109506-lin.cambridge.arm.com (e109506-lin.cambridge.arm.com [10.1.199.1]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id A85963F23F; Thu, 26 Nov 2020 07:53:03 -0800 (PST) Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kiJZx-0004Dd-9k for xen-devel@lists.xenproject.org; Thu, 26 Nov 2020 15:53:05 +0000 Received: from foss.arm.com (unknown [217.140.110.172]) by us1-rack-iad1.inumbo.com (Halon) with ESMTP id 902b8efa-1484-4e62-a926-245695ab5dfb; Thu, 26 Nov 2020 15:53:04 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 5777631B; Thu, 26 Nov 2020 07:53:04 -0800 (PST) Received: from e109506-lin.cambridge.arm.com (e109506-lin.cambridge.arm.com [10.1.199.1]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id A85963F23F; Thu, 26 Nov 2020 07:53:03 -0800 (PST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 902b8efa-1484-4e62-a926-245695ab5dfb From: Bertrand Marquis To: xen-devel@lists.xenproject.org Cc: Stefano Stabellini , Julien Grall , Volodymyr Babchuk Subject: [PATCH 3/7] xen/arm: create a cpuinfo structure for guest Date: Thu, 26 Nov 2020 15:51:05 +0000 Message-Id: <538c6319adadd9944187fcb9df52f66af079cf13.1606151462.git.bertrand.marquis@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Create a cpuinfo structure for guest and mask into it the features that we do not support in Xen or that we do not want to publish to guests. Modify some values in the cpuinfo structure for guests to mask some features which we do not want to allow to guests (like AMU) or we do not support (like SVE). The code is trying to group together registers modifications for the same feature to be able in the long term to easily enable/disable a feature depending on user parameters or add other registers modification in the same place (like enabling/disabling HCR bits). Signed-off-by: Bertrand Marquis --- xen/arch/arm/cpufeature.c | 51 ++++++++++++++++++++++++++++++++ xen/include/asm-arm/cpufeature.h | 2 ++ 2 files changed, 53 insertions(+) diff --git a/xen/arch/arm/cpufeature.c b/xen/arch/arm/cpufeature.c index 835c48ca28..4cc4ebc78a 100644 --- a/xen/arch/arm/cpufeature.c +++ b/xen/arch/arm/cpufeature.c @@ -24,6 +24,8 @@ =20 DECLARE_BITMAP(cpu_hwcaps, ARM_NCAPS); =20 +struct cpuinfo_arm __read_mostly guest_cpuinfo; + void update_cpu_capabilities(const struct arm_cpu_capabilities *caps, const char *info) { @@ -155,6 +157,55 @@ void identify_cpu(struct cpuinfo_arm *c) #endif } =20 +/* + * This function is creating a cpuinfo structure with values modified to m= ask + * all cpu features that should not be published to guest. + * The created structure is then used to provide ID registers values to gu= ests. + */ +static int __init create_guest_cpuinfo(void) +{ + /* + * TODO: The code is currently using only the features detected on the= boot + * core. In the long term we should try to compute values containing o= nly + * features supported by all cores. + */ + identify_cpu(&guest_cpuinfo); + +#ifdef CONFIG_ARM_64 + /* Disable MPAM as xen does not support it */ + guest_cpuinfo.pfr64.mpam =3D 0; + guest_cpuinfo.pfr64.mpam_frac =3D 0; + + /* Disable SVE as Xen does not support it */ + guest_cpuinfo.pfr64.sve =3D 0; + guest_cpuinfo.zfr64.bits[0] =3D 0; + + /* Disable MTE as Xen does not support it */ + guest_cpuinfo.pfr64.mte =3D 0; +#endif + + /* Disable AMU */ +#ifdef CONFIG_ARM_64 + guest_cpuinfo.pfr64.amu =3D 0; +#endif + guest_cpuinfo.pfr32.amu =3D 0; + + /* Disable RAS as Xen does not support it */ +#ifdef CONFIG_ARM_64 + guest_cpuinfo.pfr64.ras =3D 0; + guest_cpuinfo.pfr64.ras_frac =3D 0; +#endif + guest_cpuinfo.pfr32.ras =3D 0; + guest_cpuinfo.pfr32.ras_frac =3D 0; + + return 0; +} +/* + * This function needs to be run after all smp are started to have + * cpuinfo structures for all cores. + */ +__initcall(create_guest_cpuinfo); + /* * Local variables: * mode: C diff --git a/xen/include/asm-arm/cpufeature.h b/xen/include/asm-arm/cpufeat= ure.h index 1862c14e37..f03aca3d90 100644 --- a/xen/include/asm-arm/cpufeature.h +++ b/xen/include/asm-arm/cpufeature.h @@ -290,6 +290,8 @@ extern void identify_cpu(struct cpuinfo_arm *); extern struct cpuinfo_arm cpu_data[]; #define current_cpu_data cpu_data[smp_processor_id()] =20 +extern struct cpuinfo_arm guest_cpuinfo; + #endif /* __ASSEMBLY__ */ =20 #endif --=20 2.17.1 From nobody Sat May 4 13:35:07 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1606406008; cv=none; d=zohomail.com; s=zohoarc; b=mIFeZmaO+3JSeetXkdbQPa/LX+xbgULrwzP0O9gjyhzwL3XcuO1coD2Ul0KR7K/zvAQgmx7v4FTSXTzSlSHmGXdx5bxKUDPxWLA1PzLfXeDpMI4HbKF0ynkRifl3EXpEVhgq4uOuSePegNP4zt3BqCO49Da3IsFxyNi2VOai2T0= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1606406008; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=m69nWxx7jLi4Gu4BiqmiIc6PVdwaLLavYdPi6vQGrwI=; b=cpDXVeaa/06/1o8RujQdPEgi2VH8CojC8YuHNR1GfQfcaWYLhNwbN2MMatKgjzEeV6V2VNsYTKUHNbu0VooYDUBNSo8TIuNVMMowqgydXAPry+YjTd7Myf8nFE/3NPuHoCuRrrFdPJfUJwp6xdz6IU0M6YR7NqgI6w4Mg5b4Bbw= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1606406008439378.77027011535847; Thu, 26 Nov 2020 07:53:28 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.38700.71491 (Exim 4.92) (envelope-from ) id 1kiJa7-0004QC-0L; Thu, 26 Nov 2020 15:53:15 +0000 Received: by outflank-mailman (output) from mailman id 38700.71491; Thu, 26 Nov 2020 15:53:14 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kiJa6-0004Q0-RF; Thu, 26 Nov 2020 15:53:14 +0000 Received: by outflank-mailman (input) for mailman id 38700; Thu, 26 Nov 2020 15:53:13 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kiJa5-0004Ch-Hu for xen-devel@lists.xenproject.org; Thu, 26 Nov 2020 15:53:13 +0000 Received: from foss.arm.com (unknown [217.140.110.172]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTP id f0c60b78-2f02-4709-a42d-d384f03bdf94; Thu, 26 Nov 2020 15:53:05 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 39FEB1516; Thu, 26 Nov 2020 07:53:05 -0800 (PST) Received: from e109506-lin.cambridge.arm.com (e109506-lin.cambridge.arm.com [10.1.199.1]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 8AF283F23F; Thu, 26 Nov 2020 07:53:04 -0800 (PST) Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kiJa5-0004Ch-Hu for xen-devel@lists.xenproject.org; Thu, 26 Nov 2020 15:53:13 +0000 Received: from foss.arm.com (unknown [217.140.110.172]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTP id f0c60b78-2f02-4709-a42d-d384f03bdf94; Thu, 26 Nov 2020 15:53:05 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 39FEB1516; Thu, 26 Nov 2020 07:53:05 -0800 (PST) Received: from e109506-lin.cambridge.arm.com (e109506-lin.cambridge.arm.com [10.1.199.1]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 8AF283F23F; Thu, 26 Nov 2020 07:53:04 -0800 (PST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: f0c60b78-2f02-4709-a42d-d384f03bdf94 From: Bertrand Marquis To: xen-devel@lists.xenproject.org Cc: Stefano Stabellini , Julien Grall , Volodymyr Babchuk Subject: [PATCH 4/7] xen/arm: Add handler for ID registers on arm64 Date: Thu, 26 Nov 2020 15:51:06 +0000 Message-Id: <2db0532f50eafdce50b62b22b58ae04072a4a56a.1606151462.git.bertrand.marquis@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Add vsysreg emulation for registers trapped when TID3 bit is activated in HSR. The emulation is returning the value stored in cpuinfo_guest structure for most values and the hardware value for registers not stored in the structure (those are mostly registers existing only as a provision for feature use but who have no definition right now). Signed-off-by: Bertrand Marquis --- xen/arch/arm/arm64/vsysreg.c | 49 ++++++++++++++++++++++++++++++++++++ 1 file changed, 49 insertions(+) diff --git a/xen/arch/arm/arm64/vsysreg.c b/xen/arch/arm/arm64/vsysreg.c index 8a85507d9d..970ef51603 100644 --- a/xen/arch/arm/arm64/vsysreg.c +++ b/xen/arch/arm/arm64/vsysreg.c @@ -69,6 +69,14 @@ TVM_REG(CONTEXTIDR_EL1) break; \ } =20 +/* Macro to generate easily case for ID co-processor emulation */ +#define GENERATE_TID3_INFO(reg,field,offset) \ + case HSR_SYSREG_##reg: \ + { \ + return handle_ro_read_val(regs, regidx, hsr.sysreg.read, hsr, \ + 1, guest_cpuinfo.field.bits[offset]); \ + } + void do_sysreg(struct cpu_user_regs *regs, const union hsr hsr) { @@ -259,6 +267,47 @@ void do_sysreg(struct cpu_user_regs *regs, */ return handle_raz_wi(regs, regidx, hsr.sysreg.read, hsr, 1); =20 + /* + * HCR_EL2.TID3 + * + * This is trapping most Identification registers used by a guest + * to identify the processor features + */ + GENERATE_TID3_INFO(ID_PFR0_EL1, pfr32, 0) + GENERATE_TID3_INFO(ID_PFR1_EL1, pfr32, 1) + GENERATE_TID3_INFO(ID_PFR2_EL1, pfr32, 2) + GENERATE_TID3_INFO(ID_DFR0_EL1, dbg32, 0) + GENERATE_TID3_INFO(ID_DFR1_EL1, dbg32, 1) + GENERATE_TID3_INFO(ID_AFR0_EL1, aux32, 0) + GENERATE_TID3_INFO(ID_MMFR0_EL1, mm32, 0) + GENERATE_TID3_INFO(ID_MMFR1_EL1, mm32, 1) + GENERATE_TID3_INFO(ID_MMFR2_EL1, mm32, 2) + GENERATE_TID3_INFO(ID_MMFR3_EL1, mm32, 3) + GENERATE_TID3_INFO(ID_MMFR4_EL1, mm32, 4) + GENERATE_TID3_INFO(ID_MMFR5_EL1, mm32, 5) + GENERATE_TID3_INFO(ID_ISAR0_EL1, isa32, 0) + GENERATE_TID3_INFO(ID_ISAR1_EL1, isa32, 1) + GENERATE_TID3_INFO(ID_ISAR2_EL1, isa32, 2) + GENERATE_TID3_INFO(ID_ISAR3_EL1, isa32, 3) + GENERATE_TID3_INFO(ID_ISAR4_EL1, isa32, 4) + GENERATE_TID3_INFO(ID_ISAR5_EL1, isa32, 5) + GENERATE_TID3_INFO(ID_ISAR6_EL1, isa32, 6) + GENERATE_TID3_INFO(MVFR0_EL1, mvfr, 0) + GENERATE_TID3_INFO(MVFR1_EL1, mvfr, 1) + GENERATE_TID3_INFO(MVFR2_EL1, mvfr, 2) + GENERATE_TID3_INFO(ID_AA64PFR0_EL1, pfr64, 0) + GENERATE_TID3_INFO(ID_AA64PFR1_EL1, pfr64, 1) + GENERATE_TID3_INFO(ID_AA64DFR0_EL1, dbg64, 0) + GENERATE_TID3_INFO(ID_AA64DFR1_EL1, dbg64, 1) + GENERATE_TID3_INFO(ID_AA64ISAR0_EL1, isa64, 0) + GENERATE_TID3_INFO(ID_AA64ISAR1_EL1, isa64, 1) + GENERATE_TID3_INFO(ID_AA64MMFR0_EL1, mm64, 0) + GENERATE_TID3_INFO(ID_AA64MMFR1_EL1, mm64, 1) + GENERATE_TID3_INFO(ID_AA64MMFR2_EL1, mm64, 2) + GENERATE_TID3_INFO(ID_AA64AFR0_EL1, aux64, 0) + GENERATE_TID3_INFO(ID_AA64AFR1_EL1, aux64, 1) + GENERATE_TID3_INFO(ID_AA64ZFR0_EL1, zfr64, 0) + /* * HCR_EL2.TIDCP * --=20 2.17.1 From nobody Sat May 4 13:35:07 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1606406015; cv=none; d=zohomail.com; s=zohoarc; b=dLMuHBi66j4zVR59psZBck7ZhZFJ7xH/zy+3xiJgSmAjW/swYujQPlRh1xH90YlsOr1o1bKuLGoVQndisr8zpv65D5SpW6Q1nFJvX03qa9vgIshAdMSKEYpufqeUuU+Tj9QctUZUgjpVonw8FX0v9HWktIUF78C55D3+BsgCd6s= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1606406015; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=TyeLHi6VDkMTZJvogLcmAfg4/of2PvDULqi7e66NvS8=; b=GI3z6uoDrzWMaWBrcr7XhCEyg8gn6EHqqm24FzZQZBaibyh0Y3uBl/aYdaVM7Yha4eKBEpaYGKS9xW7r2QH0HFcRk8Qd0stkjRIhoXHRUo0Iia7sVpgsKNfGF7y5kuz+b2B+AasOHT0R3T7mavrL49UND8HbnWMmmoEIc8Pd+/A= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 160640601597879.46970267869108; Thu, 26 Nov 2020 07:53:35 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.38701.71503 (Exim 4.92) (envelope-from ) id 1kiJaC-0004Xl-Fo; Thu, 26 Nov 2020 15:53:20 +0000 Received: by outflank-mailman (output) from mailman id 38701.71503; Thu, 26 Nov 2020 15:53:20 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kiJaC-0004Xc-BN; Thu, 26 Nov 2020 15:53:20 +0000 Received: by outflank-mailman (input) for mailman id 38701; Thu, 26 Nov 2020 15:53:18 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kiJaA-0004Ch-IS for xen-devel@lists.xenproject.org; Thu, 26 Nov 2020 15:53:18 +0000 Received: from foss.arm.com (unknown [217.140.110.172]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTP id f5a14498-556f-4d9b-bcff-08e943744578; Thu, 26 Nov 2020 15:53:06 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 1C7B331B; Thu, 26 Nov 2020 07:53:06 -0800 (PST) Received: from e109506-lin.cambridge.arm.com (e109506-lin.cambridge.arm.com [10.1.199.1]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 6D6863F23F; Thu, 26 Nov 2020 07:53:05 -0800 (PST) Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kiJaA-0004Ch-IS for xen-devel@lists.xenproject.org; Thu, 26 Nov 2020 15:53:18 +0000 Received: from foss.arm.com (unknown [217.140.110.172]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTP id f5a14498-556f-4d9b-bcff-08e943744578; Thu, 26 Nov 2020 15:53:06 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 1C7B331B; Thu, 26 Nov 2020 07:53:06 -0800 (PST) Received: from e109506-lin.cambridge.arm.com (e109506-lin.cambridge.arm.com [10.1.199.1]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 6D6863F23F; Thu, 26 Nov 2020 07:53:05 -0800 (PST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: f5a14498-556f-4d9b-bcff-08e943744578 From: Bertrand Marquis To: xen-devel@lists.xenproject.org Cc: Stefano Stabellini , Julien Grall , Volodymyr Babchuk Subject: [PATCH 5/7] xen/arm: Add handler for cp15 ID registers Date: Thu, 26 Nov 2020 15:51:07 +0000 Message-Id: X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Add support for emulation of cp15 based ID registers (on arm32 or when running a 32bit guest on arm64). The handlers are returning the values stored in the guest_cpuinfo structure. In the current status the MVFR registers are no supported. Signed-off-by: Bertrand Marquis --- xen/arch/arm/vcpreg.c | 35 +++++++++++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/xen/arch/arm/vcpreg.c b/xen/arch/arm/vcpreg.c index cdc91cdf5b..d0c6406f34 100644 --- a/xen/arch/arm/vcpreg.c +++ b/xen/arch/arm/vcpreg.c @@ -155,6 +155,14 @@ TVM_REG32(CONTEXTIDR, CONTEXTIDR_EL1) break; \ } =20 +/* Macro to generate easily case for ID co-processor emulation */ +#define GENERATE_TID3_INFO(reg,field,offset) \ + case HSR_CPREG32(reg): \ + { \ + return handle_ro_read_val(regs, regidx, cp32.read, hsr, \ + 1, guest_cpuinfo.field.bits[offset]); \ + } + void do_cp15_32(struct cpu_user_regs *regs, const union hsr hsr) { const struct hsr_cp32 cp32 =3D hsr.cp32; @@ -286,6 +294,33 @@ void do_cp15_32(struct cpu_user_regs *regs, const unio= n hsr hsr) */ return handle_raz_wi(regs, regidx, cp32.read, hsr, 1); =20 + /* + * HCR_EL2.TID3 + * + * This is trapping most Identification registers used by a guest + * to identify the processor features + */ + GENERATE_TID3_INFO(ID_PFR0, pfr32, 0) + GENERATE_TID3_INFO(ID_PFR1, pfr32, 1) + GENERATE_TID3_INFO(ID_PFR2, pfr32, 2) + GENERATE_TID3_INFO(ID_DFR0, dbg32, 0) + GENERATE_TID3_INFO(ID_DFR1, dbg32, 1) + GENERATE_TID3_INFO(ID_AFR0, aux32, 0) + GENERATE_TID3_INFO(ID_MMFR0, mm32, 0) + GENERATE_TID3_INFO(ID_MMFR1, mm32, 1) + GENERATE_TID3_INFO(ID_MMFR2, mm32, 2) + GENERATE_TID3_INFO(ID_MMFR3, mm32, 3) + GENERATE_TID3_INFO(ID_MMFR4, mm32, 4) + GENERATE_TID3_INFO(ID_MMFR5, mm32, 5) + GENERATE_TID3_INFO(ID_ISAR0, isa32, 0) + GENERATE_TID3_INFO(ID_ISAR1, isa32, 1) + GENERATE_TID3_INFO(ID_ISAR2, isa32, 2) + GENERATE_TID3_INFO(ID_ISAR3, isa32, 3) + GENERATE_TID3_INFO(ID_ISAR4, isa32, 4) + GENERATE_TID3_INFO(ID_ISAR5, isa32, 5) + GENERATE_TID3_INFO(ID_ISAR6, isa32, 6) + /* MVFR registers are in cp10 no cp15 */ + /* * HCR_EL2.TIDCP * --=20 2.17.1 From nobody Sat May 4 13:35:07 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1606406008; cv=none; d=zohomail.com; s=zohoarc; b=Po2YTO9jduBiSY+NUqrSyNptgOqg+ffPwcZ+cU8FIM1gMJKjQ3BqoEgB17o4mbCJUktiwoVi+OfY4frDLtXzjPh641Mxs7Z6CwApnQEdJTXzfxYvc1EOHIJ5drMhXEJnzWRyzwtYbEzB7/ZBHOdD2a0Ds6TZcI0eprK21aiGIJs= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1606406008; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=BcMSXBDWNa3zaY9ZljlkO7Ec1c33ECOjCzv4E0FMKD4=; b=PfCq2y7Fr74RPmzyDQAA9v4GUyytwRAvLji2N76zSTenFVByyMSiIdWc4mUz0/hzccLvDh5SgTjxY9i0S4H+zsmraObdTkt4nxBN9LxPPBGh69k5hwWcUQYGxYnWbc1HweLR97nyi9dKS6DiY01wMcp3VOHLB8KJuu+pvurvFXA= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1606406008946819.9316595502615; Thu, 26 Nov 2020 07:53:28 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.38699.71479 (Exim 4.92) (envelope-from ) id 1kiJa3-0004Lb-KE; Thu, 26 Nov 2020 15:53:11 +0000 Received: by outflank-mailman (output) from mailman id 38699.71479; Thu, 26 Nov 2020 15:53:11 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kiJa3-0004LN-GT; Thu, 26 Nov 2020 15:53:11 +0000 Received: by outflank-mailman (input) for mailman id 38699; Thu, 26 Nov 2020 15:53:10 +0000 Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kiJa2-0004Dd-8F for xen-devel@lists.xenproject.org; Thu, 26 Nov 2020 15:53:10 +0000 Received: from foss.arm.com (unknown [217.140.110.172]) by us1-rack-iad1.inumbo.com (Halon) with ESMTP id c67c59f9-4127-43c7-83f7-6e995a80dadc; Thu, 26 Nov 2020 15:53:07 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id F3B9531B; Thu, 26 Nov 2020 07:53:06 -0800 (PST) Received: from e109506-lin.cambridge.arm.com (e109506-lin.cambridge.arm.com [10.1.199.1]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 4F7FA3F23F; Thu, 26 Nov 2020 07:53:06 -0800 (PST) Received: from us1-rack-iad1.inumbo.com ([172.99.69.81]) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kiJa2-0004Dd-8F for xen-devel@lists.xenproject.org; Thu, 26 Nov 2020 15:53:10 +0000 Received: from foss.arm.com (unknown [217.140.110.172]) by us1-rack-iad1.inumbo.com (Halon) with ESMTP id c67c59f9-4127-43c7-83f7-6e995a80dadc; Thu, 26 Nov 2020 15:53:07 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id F3B9531B; Thu, 26 Nov 2020 07:53:06 -0800 (PST) Received: from e109506-lin.cambridge.arm.com (e109506-lin.cambridge.arm.com [10.1.199.1]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 4F7FA3F23F; Thu, 26 Nov 2020 07:53:06 -0800 (PST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: c67c59f9-4127-43c7-83f7-6e995a80dadc From: Bertrand Marquis To: xen-devel@lists.xenproject.org Cc: Stefano Stabellini , Julien Grall , Volodymyr Babchuk Subject: [PATCH 6/7] xen/arm: Add CP10 exception support to handle VMFR Date: Thu, 26 Nov 2020 15:51:08 +0000 Message-Id: <18f51a4276f50e270f80d1d7d13b156509233cac.1606151462.git.bertrand.marquis@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Add support for cp10 exceptions decoding to be able to emulate the values for VMFR0 and VMFR1 when TID3 bit of HSR is activated. This is required for aarch32 guests accessing VMFR0 and VMFR1 using vmrs and vmsr instructions. Signed-off-by: Bertrand Marquis --- xen/arch/arm/traps.c | 5 +++++ xen/arch/arm/vcpreg.c | 38 ++++++++++++++++++++++++++++++++ xen/include/asm-arm/perfc_defn.h | 1 + xen/include/asm-arm/traps.h | 1 + 4 files changed, 45 insertions(+) diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c index 22bd1bd4c6..28d9d64558 100644 --- a/xen/arch/arm/traps.c +++ b/xen/arch/arm/traps.c @@ -2097,6 +2097,11 @@ void do_trap_guest_sync(struct cpu_user_regs *regs) perfc_incr(trap_cp14_dbg); do_cp14_dbg(regs, hsr); break; + case HSR_EC_CP10: + GUEST_BUG_ON(!psr_mode_is_32bit(regs)); + perfc_incr(trap_cp10); + do_cp10(regs, hsr); + break; case HSR_EC_CP: GUEST_BUG_ON(!psr_mode_is_32bit(regs)); perfc_incr(trap_cp); diff --git a/xen/arch/arm/vcpreg.c b/xen/arch/arm/vcpreg.c index d0c6406f34..9d6a36ca5d 100644 --- a/xen/arch/arm/vcpreg.c +++ b/xen/arch/arm/vcpreg.c @@ -634,6 +634,44 @@ void do_cp14_dbg(struct cpu_user_regs *regs, const uni= on hsr hsr) inject_undef_exception(regs, hsr); } =20 +void do_cp10(struct cpu_user_regs *regs, const union hsr hsr) +{ + const struct hsr_cp32 cp32 =3D hsr.cp32; + int regidx =3D cp32.reg; + + if ( !check_conditional_instr(regs, hsr) ) + { + advance_pc(regs, hsr); + return; + } + + switch ( hsr.bits & HSR_CP32_REGS_MASK ) + { + /* + * HSR.TID3 is trapping access to MVFR register used to identify the + * VFP/Simd using VMRS/VMSR instructions. + * In this case MVFR2 is not supported as the instruction does not sup= port + * it. + * Exception encoding is using MRC/MCR standard with the reg field in = Crn + * as are declared MVFR0 and MVFR1 in cpregs.h + */ + GENERATE_TID3_INFO(MVFR0, mvfr, 0) + GENERATE_TID3_INFO(MVFR1, mvfr, 1) + + default: + gdprintk(XENLOG_ERR, + "%s p10, %d, r%d, cr%d, cr%d, %d @ 0x%"PRIregister"\n", + cp32.read ? "mrc" : "mcr", + cp32.op1, cp32.reg, cp32.crn, cp32.crm, cp32.op2, regs->p= c); + gdprintk(XENLOG_ERR, "unhandled 32-bit CP10 access %#x\n", + hsr.bits & HSR_CP32_REGS_MASK); + inject_undef_exception(regs, hsr); + return; + } + + advance_pc(regs, hsr); +} + void do_cp(struct cpu_user_regs *regs, const union hsr hsr) { const struct hsr_cp cp =3D hsr.cp; diff --git a/xen/include/asm-arm/perfc_defn.h b/xen/include/asm-arm/perfc_d= efn.h index 6a83185163..31f071222b 100644 --- a/xen/include/asm-arm/perfc_defn.h +++ b/xen/include/asm-arm/perfc_defn.h @@ -11,6 +11,7 @@ PERFCOUNTER(trap_cp15_64, "trap: cp15 64-bit access") PERFCOUNTER(trap_cp14_32, "trap: cp14 32-bit access") PERFCOUNTER(trap_cp14_64, "trap: cp14 64-bit access") PERFCOUNTER(trap_cp14_dbg, "trap: cp14 dbg access") +PERFCOUNTER(trap_cp10, "trap: cp10 access") PERFCOUNTER(trap_cp, "trap: cp access") PERFCOUNTER(trap_smc32, "trap: 32-bit smc") PERFCOUNTER(trap_hvc32, "trap: 32-bit hvc") diff --git a/xen/include/asm-arm/traps.h b/xen/include/asm-arm/traps.h index 997c37884e..c4a3d0fb1b 100644 --- a/xen/include/asm-arm/traps.h +++ b/xen/include/asm-arm/traps.h @@ -62,6 +62,7 @@ void do_cp15_64(struct cpu_user_regs *regs, const union h= sr hsr); void do_cp14_32(struct cpu_user_regs *regs, const union hsr hsr); void do_cp14_64(struct cpu_user_regs *regs, const union hsr hsr); void do_cp14_dbg(struct cpu_user_regs *regs, const union hsr hsr); +void do_cp10(struct cpu_user_regs *regs, const union hsr hsr); void do_cp(struct cpu_user_regs *regs, const union hsr hsr); =20 /* SMCCC handling */ --=20 2.17.1 From nobody Sat May 4 13:35:07 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail(p=none dis=none) header.from=arm.com ARC-Seal: i=1; a=rsa-sha256; t=1606406016; cv=none; d=zohomail.com; s=zohoarc; b=SvSS+jqxwacn2iCz5MwFGr8jlXbj8kCX5c5uvGrKLiUqj69+XA6vgX4g7AMq6NAIIAvRri7T1YY8WkOmcIXrN58KQ8eIgAMutzY/eEqyjiAk8iPe0kBWDmvfAU72WLb/jAdXPZd8gS9pXuFp6t/GIg+ytLPq8Pbiu2X8alMk9Js= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1606406016; h=Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:Message-ID:References:Sender:Subject:To; bh=YWPKqPfcARpI2RxD9UWSgSD2OZKE76zkOoqnyYaYxxk=; b=h5Zfz/6UxUAP5dJHzMzDPZrVnck5/V0IBLJssJWD8lYeIoWl3KqVpO9bhBug3Lfb6uc72t0E9fKCMiEAzb6u7duQUBQtSn0wy2Be6lg27oKKiP0y24SYSD79GRupiVzyM1Q37jQnKb4V9Dl45fyVOa8NS32vjcth7mjIb3t7pcM= ARC-Authentication-Results: i=1; mx.zohomail.com; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail header.from= (p=none dis=none) header.from= Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1606406016084736.1228092373977; Thu, 26 Nov 2020 07:53:36 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.38708.71527 (Exim 4.92) (envelope-from ) id 1kiJaG-0004fP-83; Thu, 26 Nov 2020 15:53:24 +0000 Received: by outflank-mailman (output) from mailman id 38708.71527; Thu, 26 Nov 2020 15:53:24 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kiJaG-0004f6-0u; Thu, 26 Nov 2020 15:53:24 +0000 Received: by outflank-mailman (input) for mailman id 38708; Thu, 26 Nov 2020 15:53:23 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kiJaF-0004Ch-IV for xen-devel@lists.xenproject.org; Thu, 26 Nov 2020 15:53:23 +0000 Received: from foss.arm.com (unknown [217.140.110.172]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTP id a4884ce1-4f93-440f-a742-a98e93937557; Thu, 26 Nov 2020 15:53:08 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id D67FA31B; Thu, 26 Nov 2020 07:53:07 -0800 (PST) Received: from e109506-lin.cambridge.arm.com (e109506-lin.cambridge.arm.com [10.1.199.1]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 330C63F23F; Thu, 26 Nov 2020 07:53:07 -0800 (PST) Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1kiJaF-0004Ch-IV for xen-devel@lists.xenproject.org; Thu, 26 Nov 2020 15:53:23 +0000 Received: from foss.arm.com (unknown [217.140.110.172]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTP id a4884ce1-4f93-440f-a742-a98e93937557; Thu, 26 Nov 2020 15:53:08 +0000 (UTC) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id D67FA31B; Thu, 26 Nov 2020 07:53:07 -0800 (PST) Received: from e109506-lin.cambridge.arm.com (e109506-lin.cambridge.arm.com [10.1.199.1]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 330C63F23F; Thu, 26 Nov 2020 07:53:07 -0800 (PST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: a4884ce1-4f93-440f-a742-a98e93937557 From: Bertrand Marquis To: xen-devel@lists.xenproject.org Cc: Stefano Stabellini , Julien Grall , Volodymyr Babchuk Subject: [PATCH 7/7] xen/arm: Activate TID3 in HCR_EL2 Date: Thu, 26 Nov 2020 15:51:09 +0000 Message-Id: <4d48107fb864222aa6f32ebf691e169a14c3e6b9.1606151462.git.bertrand.marquis@arm.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: References: In-Reply-To: References: Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Activate TID3 bit in HSR register when starting a guest. This will trap all coprecessor ID registers so that we can give to guest values corresponding to what they can actually use and mask some features to guests even though they would be supported by the underlying hardware (like SVE or MPAM). Signed-off-by: Bertrand Marquis --- xen/arch/arm/traps.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c index 28d9d64558..c1a9ad6056 100644 --- a/xen/arch/arm/traps.c +++ b/xen/arch/arm/traps.c @@ -98,7 +98,7 @@ register_t get_default_hcr_flags(void) { return (HCR_PTW|HCR_BSU_INNER|HCR_AMO|HCR_IMO|HCR_FMO|HCR_VM| (vwfi !=3D NATIVE ? (HCR_TWI|HCR_TWE) : 0) | - HCR_TSC|HCR_TAC|HCR_SWIO|HCR_TIDCP|HCR_FB|HCR_TSW); + HCR_TID3|HCR_TSC|HCR_TAC|HCR_SWIO|HCR_TIDCP|HCR_FB|HCR_TSW); } =20 static enum { --=20 2.17.1