From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 710E63BB126; Thu, 16 Jul 2026 09:37:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784194651; cv=none; b=pCYDv+9WBWsGhKA9dKT6hiVgRPLN0mJFuT8uA2r1rQdF5D5KHv/lXkpQMv9lANNWFJvYw4nk7yqpkqSSdOHaDaZEPKjGkwxFkncB8lEB9W7avAB5IQqj7qaa+hyYdr5quBwdg5MheNPEgNiByzGUZd+jx5qgrflbugt+MVadowY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1784194651; c=relaxed/simple; bh=GozKNxM+V0o39iZwsloK/FOhTaRmLabJa9h/vKm+xkU=; h=Date:Message-ID:From:To:Cc:Subject:In-Reply-To:References: MIME-Version:Content-Type; b=q6oO1DhhyUcN1iCmPou3HaVdTfRypF6bBYN+vh8tPTSgguv+efqIImbT7nogaaQl/ZqCqiGuIzh1oysV+DOhOs6YQtKbQ2dp2qGCZhsdZj7A7f3qx2+Q5BhBaYxKpsKkyXz67ufIFg+52sArfUw6TTeYqqRjkHdUiHfhp8YfE/Q= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=bLOfCpsh; arc=none smtp.client-ip=100.103.45.18 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="bLOfCpsh" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 000121F000E9; Thu, 16 Jul 2026 09:37:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1784194650; bh=EPFwJ3WEuBcm2rx9cZEvteDwo2+iijOpn/63IcGELo4=; h=Date:From:To:Cc:Subject:In-Reply-To:References; b=bLOfCpshJI9arPQk13D/3FzzjPN5KW7Lwe2sFGx9PbCCHlW5Nwh+GGSY1Y8/Vz+f/ /aWunZGjzog0ejKw+sqk4c7Da/L/uOGrjrJKvnzNItOUdk3U7WAB0zSw2AD1q0IBu6 s2Zr2R6l3yo9DPObKM5TmY18oKkz8dp3xEM/w3QK8V0Pw2I4ccPA4gtSHmnzXOzvoI 0hZlaif37EuuKP/s4boMscRXhDaFJYMVCordJwTO2dLdiUaCTXoC9YUCE3bM83zM3S 7MAlPtOKNqvPzT6t7jJf3NHdxPAmk0W8SMTiREEDaU/MzyiXlpVVDFSpn/u5v+dp2m OMeccACFs6rYA== Received: from sofa.misterjones.org ([185.219.108.64] helo=goblin-girl.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.98.2) (envelope-from ) id 1wkIX1-00000005ccs-1RQq; Thu, 16 Jul 2026 09:37:27 +0000 Date: Thu, 16 Jul 2026 10:37:21 +0100 Message-ID: <86fr1jff72.wl-maz@kernel.org> From: Marc Zyngier To: Steven Price Cc: kvm@vger.kernel.org, kvmarm@lists.linux.dev, Catalin Marinas , Will Deacon , James Morse , Oliver Upton , Suzuki K Poulose , Zenghui Yu , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Joey Gouly , Alexandru Elisei , Christoffer Dall , Fuad Tabba , linux-coco@lists.linux.dev, Ganapatrao Kulkarni , Gavin Shan , Shanker Donthineni , Alper Gun , "Aneesh Kumar K . V" , Emi Kisanuki , Vishal Annapurve , WeiLin.Chang@arm.com, Lorenzo Pieralisi Subject: Re: [PATCH v15 09/37] KVM: arm64: CCA: Allow passing the machine type in KVM creation In-Reply-To: <9eb4e4c0-f1f6-4ab9-956a-0b233d1656c9@arm.com> References: <20260715142841.80544-1-steven.price@arm.com> <20260715142841.80544-10-steven.price@arm.com> <87zezs44cf.wl-maz@kernel.org> <9eb4e4c0-f1f6-4ab9-956a-0b233d1656c9@arm.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/30.1 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: steven.price@arm.com, kvm@vger.kernel.org, kvmarm@lists.linux.dev, catalin.marinas@arm.com, will@kernel.org, james.morse@arm.com, oliver.upton@linux.dev, suzuki.poulose@arm.com, yuzenghui@huawei.com, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, joey.gouly@arm.com, alexandru.elisei@arm.com, christoffer.dall@arm.com, tabba@google.com, linux-coco@lists.linux.dev, gankulkarni@os.amperecomputing.com, gshan@redhat.com, sdonthineni@nvidia.com, alpergun@google.com, aneesh.kumar@kernel.org, fj0570is@fujitsu.com, vannapurve@google.com, WeiLin.Chang@arm.com, lpieralisi@kernel.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false On Thu, 16 Jul 2026 10:17:21 +0100, Steven Price wrote: > > On 15/07/2026 17:14, Marc Zyngier wrote: > > On Wed, 15 Jul 2026 15:28:11 +0100, > > Steven Price wrote: > >> > >> Previously machine type was used purely for specifying the physical > >> address size of the guest. Reserve the higher bits to specify an ARM > >> specific machine type and declare a new type 'KVM_VM_TYPE_ARM_REALM' > >> used to create a realm guest. > >> > >> Signed-off-by: Steven Price > >> --- > >> Changes since v13: > >> * Rework to use the two top bits for the machine type now that pKVM has > >> merged and used the top bit for KVM_VM_TYPE_ARM_PROTECTED. > >> * Update the documentation to include KVM_VM_TYPE_ARM_PROTECTED as > >> well. > >> Changes since v9: > >> * Explictly set realm.state to REALM_STATE_NONE rather than rely on the > >> zeroing of the structure. > >> Changes since v7: > >> * Add some documentation explaining the new machine type. > >> Changes since v6: > >> * Make the check for kvm_rme_is_available more visible and report an > >> error code of -EPERM (instead of -EINVAL) to make it explicit that > >> the kernel supports RME, but the platform doesn't. > >> --- > >> Documentation/virt/kvm/api.rst | 18 ++++++++++++++++-- > >> arch/arm64/kvm/arm.c | 11 +++++++++++ > >> include/uapi/linux/kvm.h | 7 ++++++- > >> 3 files changed, 33 insertions(+), 3 deletions(-) > >> > >> diff --git a/Documentation/virt/kvm/api.rst b/Documentation/virt/kvm/api.rst > >> index b38e090ad95d..e39d146b34a3 100644 > >> --- a/Documentation/virt/kvm/api.rst > >> +++ b/Documentation/virt/kvm/api.rst > >> @@ -181,8 +181,22 @@ flag KVM_VM_MIPS_VZ. > >> ARM64: > >> ^^^^^^ > >> > >> -On arm64, the physical address size for a VM (IPA Size limit) is limited > >> -to 40bits by default. The limit can be configured if the host supports the > >> +On arm64, the machine type identifier is used to encode a type and the > >> +physical address size for the VM. The lower byte (bits[7-0]) encode the > >> +address size and the upper bits[30-31] encode a machine type. The machine > >> +types that might be available are: > >> + > >> + ========================= ============================================ > >> + KVM_VM_TYPE_ARM_NORMAL A standard VM > >> + KVM_VM_TYPE_ARM_REALM A "Realm" VM using the Arm Confidential > >> + Compute extensions, the VM's memory is > >> + protected from the host. > >> + KVM_VM_TYPE_ARM_PROTECTED A "protected" VM using pKVM to isolate the > >> + VM from the host. > >> + ========================= ============================================ > >> + > > > > Probably worth mentioning that REALM+PROTECTED is an illegal > > combination. > > The original intention was that these were enum values not separate bit > fields. Having to adapt to the pKVM changes when they were merged has > somewhat messed this up. I'll add a clarification, but hopefully we > haven't actually burnt the combination in case we have a 4th type in the > future. A good way to avoid ambiguity would be to list the actual values for the [31:30] field (0b00, 0b01, 0b10). Thanks, M. -- Without deviation from the norm, progress is not possible.