From nobody Sun Sep 14 03:54:59 2025 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 7319A3570A2; Wed, 20 Aug 2025 14:59:52 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755701993; cv=none; b=Bqup58vfEpMh1VDd1WtMNnUJwLxqm8qUbn0sCIMmQodKts1H+yheiZkYxyS1D/mr5ECEZ3KhXHVsR15lZjHsohx6OZbZ/HROAxNCK8czZIPLgzJ+Ba3XCYFh8gsggR/3JM7as1aFN5vNz6bGxbMlEpfCC2HKjx4KuJwuHSD3GPQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1755701993; c=relaxed/simple; bh=Y28hHzqUXrTOA9M2TvwlFwxY80bF/F6FkEKagp/4K/o=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=sD4DnAaRwiJGBSGuPwMLp6DZO3O8AkvtHDY5mGy6ZKJEWknnfrDdkua8BIJ2Ae8y3cByL4+h6OBoPHjoVJspC3BXm1LKiK0trC3WHDsMl1OK9eiCN0YUCcxiBWU9TlmG+6zwmoL2W8QANeqTfqfPn5VgqSOU+61tQida6SYS8UU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com 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 952372C3D; Wed, 20 Aug 2025 07:59:43 -0700 (PDT) Received: from e122027.arm.com (unknown [10.57.2.58]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 4D9663F738; Wed, 20 Aug 2025 07:59:48 -0700 (PDT) From: Steven Price To: kvm@vger.kernel.org, kvmarm@lists.linux.dev Cc: Steven Price , Catalin Marinas , Marc Zyngier , 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 Subject: [PATCH v10 33/43] arm64: RME: Hide KVM_CAP_READONLY_MEM for realm guests Date: Wed, 20 Aug 2025 15:55:53 +0100 Message-ID: <20250820145606.180644-34-steven.price@arm.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20250820145606.180644-1-steven.price@arm.com> References: <20250820145606.180644-1-steven.price@arm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" For protected memory read only isn't supported by the RMM. While it may be possible to support read only for unprotected memory, this isn't supported at the present time. Note that this does mean that ROM (or flash) data cannot be emulated correctly by the VMM as the stage 2 mappings are either always read/write or are trapped as MMIO (so don't support operations where the syndrome information doesn't allow emulation, e.g. load/store pair). This restriction can be lifted in the future by allowing the unprotected stage 2 mappings to be made read only. Signed-off-by: Steven Price Reviewed-by: Gavin Shan Reviewed-by: Suzuki K Poulose --- Changes since v7: * Updated commit message to spell out the impact on ROM/flash emulation. --- arch/arm64/kvm/arm.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/arm64/kvm/arm.c b/arch/arm64/kvm/arm.c index a090e9a74b46..23e87076330e 100644 --- a/arch/arm64/kvm/arm.c +++ b/arch/arm64/kvm/arm.c @@ -341,7 +341,6 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long = ext) case KVM_CAP_ONE_REG: case KVM_CAP_ARM_PSCI: case KVM_CAP_ARM_PSCI_0_2: - case KVM_CAP_READONLY_MEM: case KVM_CAP_MP_STATE: case KVM_CAP_IMMEDIATE_EXIT: case KVM_CAP_VCPU_EVENTS: @@ -356,6 +355,7 @@ int kvm_vm_ioctl_check_extension(struct kvm *kvm, long = ext) r =3D 1; break; case KVM_CAP_COUNTER_OFFSET: + case KVM_CAP_READONLY_MEM: case KVM_CAP_SET_GUEST_DEBUG: r =3D !kvm_is_realm(kvm); break; --=20 2.43.0