Received: by 2002:ab2:784b:0:b0:1fd:adc2:8405 with SMTP id m11csp373419lqp; Mon, 10 Jun 2024 06:52:09 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUkk0Bz9YBotJzGsji11qN6xFzholBvjjiJtjMIIYGp5UKu07cNtaVmHGwMk3V7hHuIezqFvj73TnjXW+wlFd0Og6mM1YgEVVSsfv4THA== X-Google-Smtp-Source: AGHT+IE1lIk9TP1UsdzTZQxxnD1CWO1cV77KrhzqSwl9ufC8F66NjnVEojGoIlAVNADrXzsY1cet X-Received: by 2002:a05:6214:5c01:b0:6b0:7970:e3e0 with SMTP id 6a1803df08f44-6b0797107e3mr26644916d6.20.1718027528735; Mon, 10 Jun 2024 06:52:08 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1718027528; cv=pass; d=google.com; s=arc-20160816; b=Uqg6VuyXqij8xYVT5wI2q8pzHfo6TQrDduqwn3E289jSCuUpH+r0jQ5hqZH7KZiKr8 1TikIreS3BjrOmZqKRYoTTs+nZSkPWCweW26+SD9or3ekBypiGl4MjUz9bW5jALmjxd2 iKaFSB32nb0WbmnE7gMtgK1eZDW9b3wCERrkXGxdeefSMthwV9z1U3H2f7uE7bPDanGK EU7mnny5i65iZ3+4c8x2OuG2fwMzhFn1es3sWPLgfPtMLSGUS56mWM0VKx1M7IqOq/if Ma/MRWT8tHB9Jb7bb/KYcmgFzAT1WXoSTB2vIEn4ZLUgew5G+oBwgxEuCxVJSO6VJOer Le8A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=jMX2ah1W88OIr5ImBezhqVHWfzn21rkT1v+ckgA362Y=; fh=NDCPdPn2hiqHaiIRDYQAzsW9PK20CTia4nECGof6enU=; b=nZfMvPM6vq2RP0BcFbjCNqAz5NCLJm244hsqF8trdA7nWvEbfdqCKbBzINOmvC52+x ZckLOqitFrrpFClEVPAAZKKkyTlj9O4YxY2uCOhlEF/FGpBVS+Rx/m7RdWy4Ug9ZrNAv 9cEQ+OXb3H2XHs58/KjNGYuQC74kdAUKHZ6gRzZheZZCBmSSm3hODfBmzeeZ8eiaed1a 1u4411xxzYw4pCN6wpj8jSdyTlOu+dPoc4z95g24yAYalEWRRsRC2BIY0YvcPKy2nZh+ U2OCnbW6F/TQw089RNJ2JPLMNHocbgxIoW4q27k035g4mKn3+724gKRydNu/cgWHQwa3 +fKQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-208278-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-208278-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id 6a1803df08f44-6b06cb600b9si54071076d6.413.2024.06.10.06.52.08 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 10 Jun 2024 06:52:08 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-208278-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-208278-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-208278-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ny.mirrors.kernel.org (Postfix) with ESMTPS id 708301C2258F for ; Mon, 10 Jun 2024 13:52:08 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id BC54F156862; Mon, 10 Jun 2024 13:44:02 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id EE34515665D; Mon, 10 Jun 2024 13:44:00 +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=1718027042; cv=none; b=Tw6XqFyuwe6XnON4LlicYgliT+OE+ACKITzJWMSToJcsh1zN6qVsdOifW/FIRxdfiE6Bhu4pHdmxXobkfhf3FaIcWJKl9rVoddalj0DWSb4YH7YkU02X1c2L5pGmbUSyBcZ3/uyFQc0Bpwf0LZgzM87tnvSZ2CizsyjNsFMHr7U= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1718027042; c=relaxed/simple; bh=13ZhzlK7yZTRudjjlNhyyKirmNf0Xpq9L9RS7GQ1sPU=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=YaQsjmKAGRghfsBaMGeeEo8RnZhbLRzUY7weXjvMFATtGAeQPMga6F2YeXZe3tzG5lYdAHnJUxxXaa/c4Ktt/IU/fm0IhI/82C7ngC77+uRTq0GMXtBitgQEnUBbf9NthJCmND2aHvSBXD9djjYmWd2aq9xqySwLJE0RMEoFZ1c= 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 F278E12FC; Mon, 10 Jun 2024 06:44:24 -0700 (PDT) Received: from e122027.cambridge.arm.com (e122027.cambridge.arm.com [10.1.35.41]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 472313F58B; Mon, 10 Jun 2024 06:43:58 -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 Subject: [PATCH v3 31/43] arm64: rme: Prevent Device mappings for Realms Date: Mon, 10 Jun 2024 14:41:50 +0100 Message-Id: <20240610134202.54893-32-steven.price@arm.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240610134202.54893-1-steven.price@arm.com> References: <20240610134202.54893-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: 8bit 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 cdbd5a29539a..b3793c2b8499 100644 --- a/arch/arm64/kvm/mmu.c +++ b/arch/arm64/kvm/mmu.c @@ -1101,6 +1101,10 @@ int kvm_phys_addr_ioremap(struct kvm *kvm, phys_addr_t guest_ipa, if (is_protected_kvm_enabled()) return -EPERM; + /* We don't support mapping special pages into a Realm */ + if (kvm_is_realm(kvm)) + return -EINVAL; + size += offset_in_page(guest_ipa); guest_ipa &= PAGE_MASK; -- 2.34.1