From patchwork Wed Oct 11 18:00:59 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miguel Luis X-Patchwork-Id: 13417697 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 9CE10CDB473 for ; Wed, 11 Oct 2023 18:02:39 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=E+UOYxNv1O1nUnf5gmd57DuAhsy28mV0NV9UukBW2d8=; b=P9hkVysNW07ShO /PNNsxGSlNWp+22kJO2Y3ygcKpD/2/Z0J45hLxOdA07l9Y1qfZ6V6eCZ78/sLN88Zfz1isFbz10CK oRpQRGPg4/RWZ2LaoXzA9Eicy0dAzgbPDg0igtLWO8KZFVf9zbEs8RXKaNfNu+9uYhD42o/PzjvC6 xQ6ME+zQiWbxbn0WPAhWk/1uE9b5f+WbCtx519LTAgYx1td0BjLBJ+I2ktLqPpPuVmHcqETNvYHXY gZlJAwYCQg+PeA8uf/S2LQ1+cPV0tJOYCdufTlANNeqOJVVZGxsNasONeWXpGOvg49/uTOWIhWsy/ bArXJ7GPdIsC/M3e5f5w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qqdX8-00GPKz-0I; Wed, 11 Oct 2023 18:02:10 +0000 Received: from mx0b-00069f02.pphosted.com ([205.220.177.32]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qqdX5-00GPK6-1A for linux-arm-kernel@lists.infradead.org; Wed, 11 Oct 2023 18:02:09 +0000 Received: from pps.filterd (m0246631.ppops.net [127.0.0.1]) by mx0b-00069f02.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 39BHE2Ku020157; Wed, 11 Oct 2023 18:01:42 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oracle.com; h=from : to : cc : subject : date : message-id : mime-version : content-transfer-encoding; s=corp-2023-03-30; bh=LANmNJdueyvQi7c+RbU1YOnVyO963av3fCML/59OnNg=; b=O3lSyLLCbj4f96Jv4+r7OqeiTyynS/aleT1b1LCzjeLQ+9NT6NjqkqvWj8KEDNr/oLCK yPfokbmH2DDEOHbkeaN2okWNlpNKDs2J/eti1VBwkAQyaCJvxHPlVLlKBVQ9xaNrWWDm ujXo52LdSew/4MCE0EoAz5nZvLP77gYhO1I3vqQnEzpjD7+XMWaWHeHiiTGoaEI27wEV 1EydeADLcnvmW3VW6iE8faOBf9NGMUr+W6VBamQCDWVV5vJETnGTKya+E8/7bHiIadnN a8PONg/o5ZBWsEsdx4UUOkHle1+6SKvd0E3Xm4XQ8az/VCUe2hP3crEZLj+M8DlGW8+1 Dw== Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.appoci.oracle.com [130.35.100.223]) by mx0b-00069f02.pphosted.com (PPS) with ESMTPS id 3tjx43rypq-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 11 Oct 2023 18:01:41 +0000 Received: from pps.filterd (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (8.17.1.19/8.17.1.19) with ESMTP id 39BGjwdH002618; Wed, 11 Oct 2023 18:01:41 GMT Received: from pps.reinject (localhost [127.0.0.1]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTPS id 3tjwsedrkh-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Wed, 11 Oct 2023 18:01:40 +0000 Received: from iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com [127.0.0.1]) by pps.reinject (8.17.1.5/8.17.1.5) with ESMTP id 39BI1eE0029797; Wed, 11 Oct 2023 18:01:40 GMT Received: from mlluis-mac.uk.oracle.com (dhcp-10-175-192-63.vpn.oracle.com [10.175.192.63]) by iadpaimrmta01.imrmtpd1.prodappiadaev1.oraclevcn.com (PPS) with ESMTP id 3tjwsedrg7-1; Wed, 11 Oct 2023 18:01:39 +0000 From: Miguel Luis To: Catalin Marinas , Will Deacon , Marc Zyngier , Oliver Upton , James Morse , Suzuki K Poulose , Zenghui Yu , Jing Zhang , Eric Auger , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kvmarm@lists.linux.dev Cc: miguel.luis@oracle.com Subject: [PATCH v3 0/3] Fine grain sysregs allowed to trap for nested virtualization Date: Wed, 11 Oct 2023 18:00:59 +0000 Message-Id: <20231011180103.91774-1-miguel.luis@oracle.com> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.267,Aquarius:18.0.980,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-10-11_12,2023-10-11_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=notspam policy=default score=0 mlxscore=0 spamscore=0 adultscore=0 suspectscore=0 mlxlogscore=999 phishscore=0 bulkscore=0 malwarescore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2309180000 definitions=main-2310110159 X-Proofpoint-ORIG-GUID: xzf-n6Ewm7oFwSQkaKcFwZ04a9JY1xaN X-Proofpoint-GUID: xzf-n6Ewm7oFwSQkaKcFwZ04a9JY1xaN X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231011_110207_540249_5C56F975 X-CRM114-Status: GOOD ( 14.15 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The current HCR_EL2 description defines ranges of system register encodings in which accesses should trap for NV. These ranges include encodings which aren't defined in the reference manual. In order avoid this, let's rather implement a more fine grained approach excluding those undefined. Changes v2 -> v3 patch 1: Fix BRBCR_EL12. (Eric) Add Eric's R-b. Thanks! patch 2: New patch to add missing _EL2 encodings for patch 3. patch 3: Previously patch 2 in v2. Add Fixes tag. (Eric) Merge contiguous ranges and exclude undefined encodings. (Eric) v1 -> v2 patch 1: fix indentation patch 2: improve commit message (Marc) fix indentation (Marc) follow kernel comment format (Marc) describe LRs in ranges (Marc) include AMEVCNTVOFF0_EL2 and AMEVCNTVOFF1_EL2 patch 3: drop. Excluded IMPDEF range is trapped by HCR_EL2.TIDCP v2: https://lore.kernel.org/kvmarm/20230925162057.27548-1-miguel.luis@oracle.com/ v1: https://lore.kernel.org/kvmarm/20230913185209.32282-1-miguel.luis@oracle.com/ Miguel Luis (3): arm64: Add missing _EL12 encodings arm64: Add missing _EL2 encodings arm64/kvm: Fine grain _EL2 system registers list that affect nested virtualization arch/arm64/include/asm/sysreg.h | 48 ++++++++++++++++++ arch/arm64/kvm/emulate-nested.c | 88 ++++++++++++++++++++++++++++++--- 2 files changed, 130 insertions(+), 6 deletions(-) --- 2.39.2