From patchwork Wed Dec 8 15:22:55 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Quentin Perret X-Patchwork-Id: 12695377 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 61DDDC433F5 for ; Wed, 8 Dec 2021 15:33:11 +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:Cc:To:From:Subject:References: Mime-Version:Message-Id:In-Reply-To:Date:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=NPQS8Qx5lDSu+CVUtyQTfmflU7cMcOu2I//PdIRwzmM=; b=P4qHaMZ1Soa3MFVmvi3aHHYAlS mlG7t+tOezwfPVBRydVhUfCNcXkmjgtzQK9mokopqu8EsokcUNWM9a+9pBXQmTaKX9TEQya/WzAQn K+07Se7ylDuT1l/pqZ4hgQ91/cJ0T5w0SG5wjzu5Y+PguPluDcB66xHXL49gcGt7V7GUeP5oWcpd/ bYUhoZDOojpwcp/egjEFe0IDpDo2d29houiwz9ou1vNLISJlAk+wck8GoGdDp7/+eBfsKkQRaOVZE vNUT9444jxIavH980nr8LgKypSVMiGp/tGymflQ1OhFr+27OvSSe//iAu3DqWi3DWNtq3Y5Tm5F08 mvBMx3ig==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1muyui-00DGa5-J9; Wed, 08 Dec 2021 15:31:26 +0000 Received: from mail-wm1-x349.google.com ([2a00:1450:4864:20::349]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1muymm-00DChQ-Lf for linux-arm-kernel@lists.infradead.org; Wed, 08 Dec 2021 15:23:14 +0000 Received: by mail-wm1-x349.google.com with SMTP id g81-20020a1c9d54000000b003330e488323so1294417wme.0 for ; Wed, 08 Dec 2021 07:23:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=WFv2lXz9eCHT3yd+CF6ElCbrsux6py5SHwDqlqAaTn4=; b=ZDiX6clEZwsCO576ptI4p+U8abQdk4d/G9Oef955pfW4K0FAUmdqldx2WNOMkcw9ak 5qSvscHuqPi9DAOEf9QVnnWjJ0eeoJurD1kc1Ea5jfSWXTNnLJWLVDBU6AJOV7sIIG8/ Pj1j4AYMPQGGlZR/X4DymKwUQpNV1Upw0xVjLfOPKCa+hA/UhqGSyjcFm2+Act+iJqI5 GSAuAGgG5gFc8GwslklSGNlNKa08cXanws+vPcdHC51+MWHmwmFsAbRHed6kq+FwtS8Q SRgV/L9TyhcBHOZLXurecAnFAJEuOgoccyWzRd6O1ChhBQV/YHcSQeEYlhC+TfRaL5Je kYtw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=WFv2lXz9eCHT3yd+CF6ElCbrsux6py5SHwDqlqAaTn4=; b=h2YUMWoUWT5asdRa10VIKEb2T/XwVwromynwPI4mQsjGXOFURjlimGvbJncDW1cBFv ckVEmt1fuvXLDsvGSHU03dSwjvA/YoQ16CQBmCAU0hfSvELLUkrpmcdbBXvfj2ia4+wd IGghkEtXv0jEZK46aLlOAd+tIcX4B4BC/WUUO3QgFLkXyd4aNWR985wGJqXI8jTLQb+9 QiNik5/CME3jYi5DzUlTMERKTwpJWbFXgr6qTAmIrj9VAT8Vg5L4HSPF2qoGdZqhp8rl X/s592YRawYVvJo9r1OAFilzkrTKg3rtDYekiIDGrbLXKXVc/XKO3MC3b9ArZGbMWmb6 466w== X-Gm-Message-State: AOAM531duPg9gxCsDsIncJQhOlIh7lfuvqBprrTvC73uwAeQgcnnwyFX JUEwLHk7673Wpx0RGvC6o38EtJ99kZJf X-Google-Smtp-Source: ABdhPJxSs8eDEFE+1XbumupLfjxLtoH5gK9ACn6/1cAzmR58bQj+dtBX/daKqvo9wufYXRpz+sc7M4xxqTKl X-Received: from luke.lon.corp.google.com ([2a00:79e0:d:210:c718:14b8:982a:57d5]) (user=qperret job=sendgmr) by 2002:a05:600c:1c1a:: with SMTP id j26mr17342732wms.28.1638976988812; Wed, 08 Dec 2021 07:23:08 -0800 (PST) Date: Wed, 8 Dec 2021 15:22:55 +0000 In-Reply-To: <20211208152300.2478542-1-qperret@google.com> Message-Id: <20211208152300.2478542-3-qperret@google.com> Mime-Version: 1.0 References: <20211208152300.2478542-1-qperret@google.com> X-Mailer: git-send-email 2.34.1.400.ga245620fadb-goog Subject: [PATCH 2/6] KVM: arm64: pkvm: Disable GICv2 support From: Quentin Perret To: Marc Zyngier , James Morse , Alexandru Elisei , Suzuki K Poulose , Catalin Marinas , Will Deacon Cc: linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org, kernel-team@android.com, qperret@google.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211208_072312_765383_DFA637D4 X-CRM114-Status: GOOD ( 13.58 ) 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 GICv2 requires having device mappings in guests and the hypervisor, which is incompatible with the current pKVM EL2 page ownership model which only covers memory. While it would be desirable to support pKVM with GICv2, this will require a lot more work, so let's make the current assumption clear until then. Co-developed-by: Marc Zyngier Signed-off-by: Marc Zyngier Signed-off-by: Quentin Perret Acked-by: Will Deacon --- arch/arm64/kvm/vgic/vgic-v2.c | 5 +++++ arch/arm64/kvm/vgic/vgic-v3.c | 2 +- 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/arch/arm64/kvm/vgic/vgic-v2.c b/arch/arm64/kvm/vgic/vgic-v2.c index 95a18cec14a3..8e337a0d7817 100644 --- a/arch/arm64/kvm/vgic/vgic-v2.c +++ b/arch/arm64/kvm/vgic/vgic-v2.c @@ -345,6 +345,11 @@ int vgic_v2_probe(const struct gic_kvm_info *info) int ret; u32 vtr; + if (is_protected_kvm_enabled()) { + kvm_err("GICv2 not supported in protected mode\n"); + return -ENXIO; + } + if (!info->vctrl.start) { kvm_err("GICH not present in the firmware table\n"); return -ENXIO; diff --git a/arch/arm64/kvm/vgic/vgic-v3.c b/arch/arm64/kvm/vgic/vgic-v3.c index 04f62c4b07fb..debad4e6e6c9 100644 --- a/arch/arm64/kvm/vgic/vgic-v3.c +++ b/arch/arm64/kvm/vgic/vgic-v3.c @@ -651,7 +651,7 @@ int vgic_v3_probe(const struct gic_kvm_info *info) } else if (!PAGE_ALIGNED(info->vcpu.start)) { pr_warn("GICV physical address 0x%llx not page aligned\n", (unsigned long long)info->vcpu.start); - } else { + } else if (kvm_get_mode() != KVM_MODE_PROTECTED) { kvm_vgic_global_state.vcpu_base = info->vcpu.start; kvm_vgic_global_state.can_emulate_gicv2 = true; ret = kvm_register_vgic_device(KVM_DEV_TYPE_ARM_VGIC_V2);