From nobody Thu Nov 28 04:47:56 2024 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 233B21DBB60; Fri, 4 Oct 2024 15:30:39 +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=1728055841; cv=none; b=MufixJqiPTDUgTwUd60EppHJpmCBRssjzd0W9JIekGxnm9TQkHtJ7k01YEjXmaiNbmH8gi37oAsD5gYuBpVyb1OKhgOzzsJu9/mCE7KuC+1I6bT1//zz56LnARmqP/P/Y9UI9npqzmeom5fC7UYQu0w1la60URCwKQMyouh8rSE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728055841; c=relaxed/simple; bh=YsPenijXatcQccxutucBfh5JrHmv3S9YrvK0Pttxhsk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=JqIFVsdv99QmlKX5W0KzeX98xxnsEaA2PO9x2iJ+cgwBlMN9iszCsz/cTexHJ+W5BlxWyJjzcZ3Mmvg8Q6DJJeEsqSJ1JDzk+ZiStiOe6ckIcG3M0U7bpdoRzRdfu+IQM9szM4ct9vODRTlXtCEJ6AJCPBx48QfeNB5wbjJnrUQ= 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 D731B1063; Fri, 4 Oct 2024 08:31:08 -0700 (PDT) Received: from e122027.cambridge.arm.com (unknown [10.1.25.25]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id B9A0B3F640; Fri, 4 Oct 2024 08:30:34 -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" Subject: [PATCH v5 31/43] arm64: rme: Prevent Device mappings for Realms Date: Fri, 4 Oct 2024 16:27:52 +0100 Message-Id: <20241004152804.72508-32-steven.price@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241004152804.72508-1-steven.price@arm.com> References: <20241004152804.72508-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" Physical device assignment is not yet supported by the RMM, so it doesn't make much sense to allow device mappings within the realm. Prevent them when the guest is a realm. Signed-off-by: Steven Price --- arch/arm64/kvm/mmu.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/arm64/kvm/mmu.c b/arch/arm64/kvm/mmu.c index 4f0403059c91..602c49eae90d 100644 --- a/arch/arm64/kvm/mmu.c +++ b/arch/arm64/kvm/mmu.c @@ -1142,6 +1142,10 @@ int kvm_phys_addr_ioremap(struct kvm *kvm, phys_addr= _t guest_ipa, if (is_protected_kvm_enabled()) return -EPERM; =20 + /* We don't support mapping special pages into a Realm */ + if (kvm_is_realm(kvm)) + return -EINVAL; + size +=3D offset_in_page(guest_ipa); guest_ipa &=3D PAGE_MASK; =20 --=20 2.34.1