From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 598CE2773EC for ; Tue, 22 Sep 2026 19:40:41 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.168.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790106043; cv=none; b=tjjScCSRpltPoUawwEbSyF1TujejlBXxavTvNRxgHG0jjrZrVOQY/QFNLU4PLNqMrdzu2oqla8jr+iSl+nFH2X9EM5XhBaWBiRRStZWiijn9c80pxCw0hzFyS2YloRM5F5Yy27nEZ/VpULI35HvWJ2GbnEL/6Clo7uZlq7iqYFg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1790106043; c=relaxed/simple; bh=VfZhuL2X1gTRZxO0OzhM4JExH2t49JX4CNGTbuUaWiA=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=DWq7zOiLAc1EYcNaysvDoG2c7X6dxrHyWTbMwSd/WswJ6iPRBEQ3KrS1WQ014TjANEiywr9z/XRfz4h9fpMzLgx6ebuO9wO0iq2alxt67afYqIoWtdhbmhu0mQW6X1VW2rPTYizMrn3tbk3Ye22LdswkS1JsYmnnJm2cKi73mJ4= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=MCpZrl2X; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=dXoXzPHu; arc=none smtp.client-ip=205.220.168.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="MCpZrl2X"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="dXoXzPHu" Received: from pps.filterd (m0279862.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 68MI7Cs2368041 for ; Tue, 22 Sep 2026 19:40:40 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:in-reply-to :message-id:mime-version:references:subject:to; s=qcppdkim1; bh= isSEF0IU9c1OXuHxBNGq9pSATtA3AQIYhgVBzOHtvqs=; b=MCpZrl2XliLUV5m+ AwX/zkHOD/sII1crCEGtG2U/jgpLCl9R5xl7SrsC9BMPS8yupRZaRWKjoSPcfPr1 G+zk8nVeK5HU3gGbbimKtGhjfcB7JoInF0tNJb+6FNetlQpNQBt5qKW7rHavrjBQ kng7Ib17Sxzb4DCO4X0lKQv7HIR0DRlKG41W9jQGC1kpLBZfLxU36+a0/t6N+XvA kx3fALA9mTbiRnv0fp89c0relqYJ1KxDBP1EpWE4H4FCFMukDUHfMMSyo/UcI5jZ ylDWRa5BwwCWg2GQvwmoLWMtT+zUqPbUTBsfFLPwAt3NMJG1jsSw6iLmigngpwMP wU2fSQ== Received: from mail-dy1-f197.google.com (mail-dy1-f197.google.com [74.125.82.197]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4gurntahjk-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Tue, 22 Sep 2026 19:40:40 +0000 (GMT) Received: by mail-dy1-f197.google.com with SMTP id 5a478bee46e88-33310847fcaso232676eec.1 for ; Tue, 22 Sep 2026 12:40:40 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1790106040; x=1790710840; darn=vger.kernel.org; h=content-transfer-encoding:content-type:mime-version:organization :references:in-reply-to:message-id:subject:cc:to:from:date:from:to :cc:subject:date:message-id:reply-to:content-type; bh=isSEF0IU9c1OXuHxBNGq9pSATtA3AQIYhgVBzOHtvqs=; b=dXoXzPHu00H6QXZ4W62UlASH+KCXoGsshg84SyvgU5TBQwA2z7n3TpXZO+c4hXZK+U HAMKGLw93+P268nX/JY1XzEZ7vpfmhI3XRyGufr2W3YJm+Jsb83yzYoW3jyq5Zi/eFn4 7EwAleJndcyZZue86hpmijBxLzztsjAKIlSdnEB0DochwSA0QhZjNn0Bl3B9WHW3rNhm FekeXLCjOGo8/esSqoqsslNxkbBUD29BKQzRwxe40ndFfSIiaxm/dOpRftmqS3xDnck9 G3R+1dL+ZefDD9/+5wFir2WKcxpDwdVCwSmybqI9hSpUN7ZEd/V/h5iSlNqnRiU+rdQk mUgA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1790106040; x=1790710840; h=content-transfer-encoding:content-type:mime-version:organization :references:in-reply-to:message-id:subject:cc:to:from:date:x-gm-gg :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to :content-type; bh=isSEF0IU9c1OXuHxBNGq9pSATtA3AQIYhgVBzOHtvqs=; b=if/D46Fs27IitiudV+LDnmymJ4NVovgsIguVfzJY4yxzqc5lMINBwhMXU3KPqE9OGz wxBNVvFRbyIH5s/zc21tX3vBa/nUFzCKycfckgtccvxFbd3wy3rJ1Yu54BVW1579Nfgx ngv5PD9A4WkHkjTmHaCBVX2vLgBHDV3VZIU4cbK6l9ulkaTqPwPr1hZfaXuikoxYiwIK taUViPcOanQAGLnA8habCysuxMXQ+pi0ivlfa53efyrQm+ckxcGNpUMjKs7UUiMdjBTq pfizay6H9wL9MMu8jfaFuoI14++B39dS7xZzRFwMVZTONjrMS7mSmqV1AfNJ2lt5Rucz 6CWA== X-Forwarded-Encrypted: i=1; AKwUvBxGX6q4t17rTkvMqr5ZJXDGfGwrNi0entjC3ryohffohQcdOadFffSHYSkzdh9+DyXN+2DGJJufi/PPtvs=@vger.kernel.org X-Gm-Message-State: AFuF++nJfl4zlUGXSlsapjKj/gXK++VbwCv63bJKmOZRZZQcNiTAVJ/T 84wOX68iGqb4VYtZZveyBD9wXyF4bFW0KmfY6SuP9fNl+JlxveVsUDRfRBQKZ6GuWlgRQ+NZSoN q4i02L+YIzQrXa9f0qODjYIYDwGrEfczxSRKKueLXi9bYin+iZd73I+oAHf6Tfvo0VBE= X-Gm-Gg: AYBFou22XZLCXL0NwE/YH/UMzlRVHhwo0sxgHfCaALGvHaNqoScYjefZGlIJU4XTt+q M0XoR9HmcjmHYD0o+YEzJwgbRdwT+nnR8jcWsJcJ2gG5iMYsptSrWmmPKiWKydywAKERpx8Xs4m Ig7RFirdAhj6lqejTwGZeU+IIaALB3H2lvGxW3HGhNABe/dg2Un+/SiHAUmS+1ndPI62JQrbYEO bjGvO7OrZYYGo5XSdO7TtDnn66KY+aegu8w1wciFPGzpUdrJpdSSD7WWaIMIUh1+OGeI8eb3BT4 06T+1hgn80N2J8OY3fal8tEgs97rKi/HvZ+HmpssBdAdhszsIfmKrYkHMH39MVdWF73hoX8pCeY yF+5gacObdPLtdIO88sx/qXykBI0BQtThOQwKuNH26w87WL7hszhSTA== X-Received: by 2002:a05:693c:83c3:10b0:33b:e842:c0ff with SMTP id 5a478bee46e88-33e88b2f9cemr356553eec.0.1790106039625; Tue, 22 Sep 2026 12:40:39 -0700 (PDT) X-Received: by 2002:a05:693c:83c3:10b0:33b:e842:c0ff with SMTP id 5a478bee46e88-33e88b2f9cemr356508eec.0.1790106038976; Tue, 22 Sep 2026 12:40:38 -0700 (PDT) Received: from localhost (i-global254.qualcomm.com. [199.106.103.254]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-33e95c7c63bsm412187eec.10.2026.09.22.12.40.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 22 Sep 2026 12:40:38 -0700 (PDT) Date: Tue, 22 Sep 2026 12:40:33 -0700 From: Jonathan Cameron To: Suzuki K Poulose Cc: kvm@vger.kernel.org, kvmarm@lists.linux.dev, maz@kernel.org, will@kernel.org, catalin.marinas@arm.com, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, steven.price@arm.com, aneesh.kumar@kernel.org, oupton@kernel.org, gshan@redhat.com, joey.gouly@arm.com, tabba@google.com, yuzenghui@huawei.com, linux-coco@lists.linux.dev, gankulkarni@os.amperecomputing.com, sdonthineni@nvidia.com, alpergun@google.com, fj0570is@fujitsu.com, WeiLin.Chang@arm.com, lpieralisi@kernel.org, enju.kohei@fujitsu.com Subject: Re: [PATCH v19 05/20] KVM: arm64: Track the type of VM in kvm_arch Message-ID: <20260922123928.0000443e@oss.qualcomm.com> In-Reply-To: <20260920212845.707-6-suzuki.poulose@arm.com> References: <20260920212845.707-1-suzuki.poulose@arm.com> <20260920212845.707-6-suzuki.poulose@arm.com> Organization: Qualcomm X-Mailer: Claws Mail 4.4.0 (GTK 3.24.51; x86_64-w64-mingw32) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Proofpoint-ORIG-GUID: RK0tyhDGcls93j6qs_Lw6PthYI_FW0F6 X-Authority-Analysis: v=2.4 cv=eauo7LEH c=1 sm=1 tr=0 ts=6ab2d9b8 cx=c_pps a=Uww141gWH0fZj/3QKPojxA==:117 a=JYp8KDb2vCoCEuGobkYCKw==:17 a=kj9zAlcOel0A:10 a=VdqzKS8jKosA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=_K5XuSEh1TEqbUxoQ0s3:22 a=7CQSdrXTAAAA:8 a=VwQbUJbxAAAA:8 a=EUspDBNiAAAA:8 a=Rj_uqbnfv5dchc8eNrcA:9 a=CjuIK1q_8ugA:10 a=PxkB5W3o20Ba91AHUih5:22 a=a-qgeE7W1pNrGK8U0ZQC:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwOTIyMDI4OCBTYWx0ZWRfX5h+65rs3KDBV qI7AetlwGUcyVZG8hn8e7G/Tc9SIcxNAaYSJJm1gQ2T/lx5HQ1dTCOyLNAEMBCyYr0Dm5pX3pDa TxEveClsrxekoQgNfmgzaVOQT+HnY19dGGfOMSKBD8k23wtTo8G01OyjZxNEpiNS0/CeAuJW78C eU6Gb25ldSionD1gzCDH8Q61kqRBFM7TEbWwPIlRgR/86ke/Gecax/iwXKcVqDW9vuChd+ST2CI uLR10y7JqJa53EzmgpkLYutOIt3KdxDnbQkX8PXs89r5xkZ/iZIx0m+HSyZ/5Jg+3CSFUUZjsZM JDq2oA4eCo/FnWZdWxhzE3hI5zrSlme0oAofhO/ZK8R8r9+RNOkg3oQjEbKRrKDDsuqgQcpEVAQ BQMY2DllViOEB6tfx1cFkLXeIWocrib1l5zkUzFIOdWDnwqH7ZGEfC4qIufnYGv+8BSaSYaJ8aU nc15n/h7tHli05+WNeQ== X-Proofpoint-Spam-Info: AW1haW4tMjYwOTIyMDI4OCBTYWx0ZWRfX4ZLDV6b5TtxA HNTIYjtgLdyeCn7LO0Dgzf3tXA/9mBAjlgkEHv5Ocss1RNoX76w8x7/B1GRrvAKanvFunzS4TRK Cx0s5A7tzPC/3JOYVzU2SwMPfJMG5qs= X-Proofpoint-GUID: RK0tyhDGcls93j6qs_Lw6PthYI_FW0F6 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-09-22_03,2026-09-21_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 suspectscore=0 phishscore=0 lowpriorityscore=0 impostorscore=0 clxscore=1015 spamscore=0 malwarescore=0 bulkscore=0 adultscore=0 priorityscore=1501 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2609040000 definitions=main-2609220288 On Sun, 20 Sep 2026 22:28:30 +0100 Suzuki K Poulose wrote: > KVM arm64 has different types of VMs with all the different modes in which > the hypervisor code can be run. e.g., VHE, nVHE, pKVM etc. Then there is > protected VM and normal VMs with pKVM. We might soon add other types, > e.g., Arm CCA Realm. Let's have some optimism! > > Realms support is restricted to VHE host and thus "kvm_vm_is_protected()" > checks in the pkvm hyp specific code doesn't need to change, as the only > protected guests it deals with is "protected pKVM" guests. To tighten this > init_pkvm_hyp_vm() restricts the hyp copy of the vm_flavor to the ones it > supports. > > Suggested-by: Marc Zyngier > Signed-off-by: Suzuki K Poulose Seems sensible to me. One trivial thing inline. Reviewed-by: Jonathan Cameron > --- > arch/arm64/include/asm/kvm_host.h | 22 +++++++++++++++++++--- > arch/arm64/include/asm/kvm_pkvm.h | 4 ++-- > arch/arm64/kvm/arm.c | 31 ++++++++++++++++++++++++++----- > arch/arm64/kvm/handle_exit.c | 2 +- > arch/arm64/kvm/hyp/nvhe/pkvm.c | 6 +++++- > arch/arm64/kvm/mmu.c | 2 +- > arch/arm64/kvm/pkvm.c | 6 ++---- > 7 files changed, 56 insertions(+), 17 deletions(-) > > diff --git a/arch/arm64/include/asm/kvm_host.h b/arch/arm64/include/asm/kvm_host.h > index 286489a69dff5..9b1cf9c59e81f 100644 > --- a/arch/arm64/include/asm/kvm_host.h > +++ b/arch/arm64/include/asm/kvm_host.h > @@ -257,7 +257,6 @@ struct kvm_protected_vm { > pkvm_handle_t handle; > struct kvm_hyp_memcache teardown_mc; > struct kvm_hyp_memcache stage2_teardown_mc; > - bool is_protected; > bool is_created; > > /* > @@ -306,9 +305,19 @@ enum fgt_group_id { > __NR_FGT_GROUP_IDS__ > }; > > +enum kvm_arm_vm_flavor { > + VM_NVHE, > + VM_VHE, > + VM_PKVM, /* Normal guests on pKVM */ > + MARKER(__VM_PROTECTED), > + VM_PROTECTED_PKVM, /* Protected VM */ > + VM_FLAVOR_MAX, Trivial but given whole point is this is an end marker, drop the trailing , No point in making it easy to break the ordering! > +}; > +