From patchwork Thu May 19 13:41:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Will Deacon X-Patchwork-Id: 12855170 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 79727C433EF for ; Thu, 19 May 2022 14:28:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=SS0+qbmHlf3Oa8v/HMqiZBkyr2b2mRVVTx5q32QrO90=; b=MXIU1jYqQC24F3 8GL12uACUwy2GtaNSEDMApHWOjvK1KBRXcNVcND+Oi4v5y73FrNGyTiyNdSrcYLkgEroz5DWDI8Or si9/AbN/tvojnoNj2WYCEXn5vdbAsjMuPcyVfpSOMH8Ye915GX5L9VBwkgw1FNzRJeMvMC2pKrm0Q 5LrxLtbPfKXQRT4JfUitPdDs3414wK9mkuhjF/vEvk4yckElOzPYlS2sgRXhPGiRPmKwkiyGa5spr aYRupxSKXWMySVwmJlk4P6XaqcboE9WF6sZxZNyP3c9S3Pi7aDWt+7x+yeNaIAFmCkmVgh1u6MsNO Fksgki4qKZP0fT7qcw1A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nrh7j-007Pmo-MN; Thu, 19 May 2022 14:27:32 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nrgTr-0076lE-UK for linux-arm-kernel@lists.infradead.org; Thu, 19 May 2022 13:46:23 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 7DF04617D7; Thu, 19 May 2022 13:46:19 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id D2E56C36AE3; Thu, 19 May 2022 13:46:15 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1652967979; bh=B36GaRnGRujL+MHDMxoxbcIaaln4Kn+Z0GYJ4GdQl5g=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=g/cD/rpj+xe2AzYsja4gh8SJLDatcI9W6clm8PO0qstElAz/8qaq/DJmS1qfFiyTY SZ9d5rK+4KSZ4MdWaFdgHMlZNyBQl71XC/ZhqBRJJyZSjEfNWhRBIE4rsHV//YJqly agcpCwUC+8yYKpN63DB5DpNsWYIi+UH/rQ+M7vtGVMG8hjgwCK2vhWMw63Ubq+d7B1 gEdDkdBYB4AOvMBe05r2ST2rPp+sbdisS3rQVDf+AZpNh99DNpB1Gyw6u/JLuCyWxB 9SDet6wxT1EHJtRAV8toHQMYWGxDr4IhOezHOipLbuA2xYvILtTSCNwiMvCQftzW+8 dTtLc1xekzv5A== From: Will Deacon To: kvmarm@lists.cs.columbia.edu Cc: Will Deacon , Ard Biesheuvel , Sean Christopherson , Alexandru Elisei , Andy Lutomirski , Catalin Marinas , James Morse , Chao Peng , Quentin Perret , Suzuki K Poulose , Michael Roth , Mark Rutland , Fuad Tabba , Oliver Upton , Marc Zyngier , kernel-team@android.com, kvm@vger.kernel.org, linux-arm-kernel@lists.infradead.org Subject: [PATCH 59/89] KVM: arm64: Do not support MTE for protected VMs Date: Thu, 19 May 2022 14:41:34 +0100 Message-Id: <20220519134204.5379-60-will@kernel.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20220519134204.5379-1-will@kernel.org> References: <20220519134204.5379-1-will@kernel.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220519_064620_063812_037C1F02 X-CRM114-Status: GOOD ( 13.54 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Fuad Tabba Return an error (-EINVAL) if trying to enable MTE on a protected vm. Signed-off-by: Fuad Tabba Signed-off-by: Peter Collingbourne --- arch/arm64/kvm/arm.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/arm64/kvm/arm.c b/arch/arm64/kvm/arm.c index 10e036bf06e3..8a1b4ba1dfa7 100644 --- a/arch/arm64/kvm/arm.c +++ b/arch/arm64/kvm/arm.c @@ -90,7 +90,9 @@ int kvm_vm_ioctl_enable_cap(struct kvm *kvm, break; case KVM_CAP_ARM_MTE: mutex_lock(&kvm->lock); - if (!system_supports_mte() || kvm->created_vcpus) { + if (!system_supports_mte() || + kvm_vm_is_protected(kvm) || + kvm->created_vcpus) { r = -EINVAL; } else { r = 0;