Received: by 2002:a05:7412:31a9:b0:e2:908c:2ebd with SMTP id et41csp3484747rdb; Wed, 13 Sep 2023 13:33:09 -0700 (PDT) X-Google-Smtp-Source: AGHT+IHQuPKQX2FuXF61UoyImeCLUDfJq2B8vTG4e155kB7yAK/himuPPpYQcSLnJEomup9PEaXu X-Received: by 2002:a05:6a21:3d86:b0:154:3f13:1bb7 with SMTP id bj6-20020a056a213d8600b001543f131bb7mr2702283pzc.49.1694637188949; Wed, 13 Sep 2023 13:33:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1694637188; cv=none; d=google.com; s=arc-20160816; b=0NANIrpgRbYTKICSbP2QZU6JBpi4yzVcU0Nt2+kXQsdBxMq4GuC4X4fnXdTkeDwkdz l0CRL+Pa/rvL8q5xrwIyh6yj9a9+bYBLto9f8bJXXUZbswkBwYkWAgi91Sf4cFvqSNLz o7suBeSigyXBqB6MVZzOJZnJhNJ7A3j4azPj/JRBrSMZ9+bCZT1MIlYMHAiEoNMANKDi xXKmAkkiGVzXw8k/Yg2IjGZzSV99j8lICXnm7zWmvszWkb0fqzufSae69hLG4C3vGQXk 9qLms1RC2AMhJVfOy/VN8yIz+HAZioVmMDB0++sksY9OCnK/o3TDhNBptc46vR5KPQeV sA4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=WvnFDh8VGVX/yU+Sr+zbmMR9RVMpMl1pTRBM4gjviOE=; fh=UEH6cFyH1ghvNrfwViNbncCn5r9iy89nkA/jfjQrZCI=; b=NwYWjFOilL6708JN9atdU3SNtG94fEzsIEbSBZC9F6PQZgbp0Ky2tE/uNCKwVrTGjM bEWR6LJe1AJSdcF+228/ckpYO8V6gF4gO8FDcgdFA1YCMXCS0zxJBykvyabGLiJWOFMK q33yWYqL5gpzDPc3QG67L8pWSpNitt9ye53VVYLAQJAU3mMcbHQdqFBsLG4mmQFdrII0 hbbUw0ktx1nt1JACJsBgKwnjBWHHuFO+JHKZq6TZWeFTdLNYg0KhUzqTG0Y95oWasGp7 7gjPEYY0euqlkEb6ZzYDNOZt85Kpi1BYWxufNzW6oEaYU7CeHdbmYxp9UBj24fGNGTrg toXw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-03-30 header.b=NMuwXlq9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Return-Path: Received: from snail.vger.email (snail.vger.email. [23.128.96.37]) by mx.google.com with ESMTPS id cd26-20020a056a00421a00b0068e2b1d5651si3902796pfb.281.2023.09.13.13.33.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 13 Sep 2023 13:33:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) client-ip=23.128.96.37; Authentication-Results: mx.google.com; dkim=pass header.i=@oracle.com header.s=corp-2023-03-30 header.b=NMuwXlq9; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.37 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=oracle.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id CF212822CEB1; Wed, 13 Sep 2023 11:53:52 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231931AbjIMSxh (ORCPT + 99 others); Wed, 13 Sep 2023 14:53:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56122 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232036AbjIMSxd (ORCPT ); Wed, 13 Sep 2023 14:53:33 -0400 Received: from mx0b-00069f02.pphosted.com (mx0b-00069f02.pphosted.com [205.220.177.32]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3C1FB1BC9 for ; Wed, 13 Sep 2023 11:53:29 -0700 (PDT) Received: from pps.filterd (m0333520.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 38DFWIsp029849; Wed, 13 Sep 2023 18:53:12 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : in-reply-to : references : mime-version : content-transfer-encoding; s=corp-2023-03-30; bh=WvnFDh8VGVX/yU+Sr+zbmMR9RVMpMl1pTRBM4gjviOE=; b=NMuwXlq9NfKpmcXFVR1MMSbr/Y1axUS9esvC1WZNAahpB9wmgXZr76nj2xCcGI7HWEx/ u4VzQ21ybwDHnD0lk4fyujfGfoVrR3XZUwQgjw04JFukpktw7qIhvluUeKRAcoxs0Ie6 qMwXZ1PEXQJGHtJNvoukrmzs6zCUN/Yz1MCgZxQNJGktQEYfU5oNrW2X0IKKQZLHVeDD SZrLtuIjgr7ZkjGv1utvL1wBE5XUUlboo9/G2sS7UjYtj6Sk36e4OgVI6aeB6KubIJ/8 h96pA42lSFXMP+/rqw/3FiJ5YjqRH58aTATJc1ZLfdewZg5hH/GUxKyoVfHHljb4IuFe aA== Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.appoci.oracle.com [130.35.103.27]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3t2y7rb2f7-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 13 Sep 2023 18:53:11 +0000 Received: from pps.filterd (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 38DHhnGB033088; Wed, 13 Sep 2023 18:53:11 GMT Received: from pps.reinject (localhost [127.0.0.1]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3t0wkgxrep-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 13 Sep 2023 18:53:11 +0000 Received: from iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 38DIqniu015352; Wed, 13 Sep 2023 18:53:10 GMT Received: from mlluis-mac.uk.oracle.com (dhcp-10-175-187-203.vpn.oracle.com [10.175.187.203]) by iadpaimrmta03.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTP id 3t0wkgxqyp-4; Wed, 13 Sep 2023 18:53:10 +0000 From: Miguel Luis To: Catalin Marinas , Will Deacon , Marc Zyngier , Oliver Upton , James Morse , Suzuki K Poulose , Zenghui Yu , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kvmarm@lists.linux.dev Cc: miguel.luis@oracle.com Subject: [PATCH 3/3] KVM: arm64: nv: Handle all _EL02 and _EL12 registers Date: Wed, 13 Sep 2023 18:52:08 +0000 Message-Id: <20230913185209.32282-4-miguel.luis@oracle.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20230913185209.32282-1-miguel.luis@oracle.com> References: <20230913185209.32282-1-miguel.luis@oracle.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.980,Hydra:6.0.601,FMLib:17.11.176.26 definitions=2023-09-13_13,2023-09-13_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 adultscore=0 phishscore=0 spamscore=0 mlxlogscore=919 bulkscore=0 suspectscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2308100000 definitions=main-2309130158 X-Proofpoint-ORIG-GUID: NESHB0hhIH2rACbKdDapKjxhrgfZITx3 X-Proofpoint-GUID: NESHB0hhIH2rACbKdDapKjxhrgfZITx3 Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 13 Sep 2023 11:53:52 -0700 (PDT) Specify both _EL02 and _EL12 system registers. Signed-off-by: Miguel Luis --- arch/arm64/kvm/emulate-nested.c | 35 +++++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-) diff --git a/arch/arm64/kvm/emulate-nested.c b/arch/arm64/kvm/emulate-nested.c index 9aa1c06abdb7..957afd97e488 100644 --- a/arch/arm64/kvm/emulate-nested.c +++ b/arch/arm64/kvm/emulate-nested.c @@ -690,10 +690,37 @@ static const struct encoding_to_trap_config encoding_to_cgt[] __initconst = { SR_RANGE_TRAP(sys_reg(3, 4, 14, 0, 3), sys_reg(3, 4, 14, 5, 2), CGT_HCR_NV), /* All _EL02, _EL12 registers */ - SR_RANGE_TRAP(sys_reg(3, 5, 0, 0, 0), - sys_reg(3, 5, 10, 15, 7), CGT_HCR_NV), - SR_RANGE_TRAP(sys_reg(3, 5, 12, 0, 0), - sys_reg(3, 5, 14, 15, 7), CGT_HCR_NV), + SR_TRAP(SYS_SCTLR_EL12, CGT_HCR_NV), + SR_TRAP(SYS_CPACR_EL12, CGT_HCR_NV), + SR_TRAP(SYS_SCTLR2_EL12, CGT_HCR_NV), + SR_TRAP(SYS_ZCR_EL12, CGT_HCR_NV), + SR_TRAP(SYS_TRFCR_EL12, CGT_HCR_NV), + SR_TRAP(SYS_SMCR_EL12, CGT_HCR_NV), + SR_TRAP(SYS_TTBR0_EL12, CGT_HCR_NV), + SR_TRAP(SYS_TTBR1_EL12, CGT_HCR_NV), + SR_TRAP(SYS_TCR_EL12, CGT_HCR_NV), + SR_TRAP(SYS_TCR2_EL12, CGT_HCR_NV), + SR_TRAP(SYS_SPSR_EL12, CGT_HCR_NV), + SR_TRAP(SYS_ELR_EL12, CGT_HCR_NV), + SR_TRAP(SYS_AFSR0_EL12, CGT_HCR_NV), + SR_TRAP(SYS_AFSR1_EL12, CGT_HCR_NV), + SR_TRAP(SYS_ESR_EL12, CGT_HCR_NV), + SR_TRAP(SYS_TFSR_EL12, CGT_HCR_NV), + SR_TRAP(SYS_FAR_EL12, CGT_HCR_NV), + SR_TRAP(SYS_BRBCR_EL12, CGT_HCR_NV), + SR_TRAP(SYS_PMSCR_EL12, CGT_HCR_NV), + SR_TRAP(SYS_MAIR_EL12, CGT_HCR_NV), + SR_TRAP(SYS_AMAIR_EL12, CGT_HCR_NV), + SR_TRAP(SYS_VBAR_EL12, CGT_HCR_NV), + SR_TRAP(SYS_CONTEXTIDR_EL12, CGT_HCR_NV), + SR_TRAP(SYS_SCXTNUM_EL12, CGT_HCR_NV), + SR_TRAP(SYS_CNTKCTL_EL12, CGT_HCR_NV), + SR_TRAP(SYS_CNTP_TVAL_EL02, CGT_HCR_NV), + SR_TRAP(SYS_CNTP_CTL_EL02, CGT_HCR_NV), + SR_TRAP(SYS_CNTP_CVAL_EL02, CGT_HCR_NV), + SR_TRAP(SYS_CNTV_TVAL_EL02, CGT_HCR_NV), + SR_TRAP(SYS_CNTV_CTL_EL02, CGT_HCR_NV), + SR_TRAP(SYS_CNTV_CVAL_EL02, CGT_HCR_NV), SR_TRAP(OP_AT_S1E2R, CGT_HCR_NV), SR_TRAP(OP_AT_S1E2W, CGT_HCR_NV), SR_TRAP(OP_AT_S12E1R, CGT_HCR_NV), -- 2.39.2