Message ID | 20210319100146.1149909-16-qperret@google.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <SRS0=5UrE=IR=lists.infradead.org=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@kernel.org> X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-17.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id A2585C433E0 for <linux-arm-kernel@archiver.kernel.org>; Fri, 19 Mar 2021 10:08:08 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0C40960235 for <linux-arm-kernel@archiver.kernel.org>; Fri, 19 Mar 2021 10:08:08 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0C40960235 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=desiato.20200630; 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=DquW+wGPaFUhQWM3ko4KGNyTzVfvzMz2W3NRZbZMaX4=; b=D/ebyFivLn9Ipo 1kKVLj8bkLcgZ0t7+i747uZngwTbwOt+0L9LfeYtlZEf8NvEkuL74pIgU8bCRKVk9k6SmYNhNCKA0 rSCOU2NA2A7F0i0zOyoMKcYwyhpVFwJc8naWhtIuYmcN45P61aQ2tSiPglE6XF4yn4ybSGNcNK+vm pMRlqz/tYZI2KLpbquxqUysZbdi9kc543JTshlbOxNH2Hfz94lcoworN/V8yqT/3CwjZByfVihip3 uSov5mh9emwIFTqOqYEikbl1ppSuwSK07MN7uNoBxCa6QUoUI7J33i1rL593YS8DhcV4LrdnSy/kP nyYIG5pLKkxMjD6M+rjw==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lNC1K-007270-J6; Fri, 19 Mar 2021 10:06:18 +0000 Received: from mail-wm1-x34a.google.com ([2a00:1450:4864:20::34a]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lNBxX-0070EM-EG for linux-arm-kernel@lists.infradead.org; Fri, 19 Mar 2021 10:02:26 +0000 Received: by mail-wm1-x34a.google.com with SMTP id c7so12699082wml.8 for <linux-arm-kernel@lists.infradead.org>; Fri, 19 Mar 2021 03:02:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=lQIT7boSH7VaErqDHVKDpxnX/gbqPaNn5BvEtRgavP4=; b=R1/pDoZJyieTAINWUHqJoxtobG4lEwFQR3LiF39XqzeO2APFzvrm447dISZFMa5jN7 ralzLICmmDoKTbqiXrdoIhH3YbSQfHVyHM7gyVJXnMeiXw4sVkkOvXLy5DiPTO4FJjlr jluGERC+t2g6RW11lAmE1IcXrWoIXzwtaUaebUn0887cdfteVkcof7S7fA8ddF5RjJP4 4a5lvx2Sh1FoITa/6m/lBQxTdh/ixJnn1kcXkU0r0/VXeMbhuQ2xZNT8yXrBaZ+8F9QG 4RlDO8lK+Rih1F9KEBbIiEspgKm/W414x3ejf9UHiT42ojTLirs1UKNSsx2FJ84umEh3 YNcg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=lQIT7boSH7VaErqDHVKDpxnX/gbqPaNn5BvEtRgavP4=; b=qJtHcDA4LHi05bXLs59kN0ECr/2lwFdvsRfYq18JmXcoH8Ahv9kOv4gqoL2dL6yX0y BHbntkrh1nKm+qHV+lquAayidVhyRGSqSSmf+n4/2HG0xo/SqlISv6wpsMcIxivzn8AN E0ah6Fa7rsnIBLdYPYbO6ZnDsSSVqnawcWiJa6vu6GjW9JVxB50xmN9cGSGLmi8IaI02 w5NY9FMZTrqtHIYv7t59xNcJSol8IQ7IDkabLBYs4p4E2E9BUffduiGu8Wl7uPDYb/lr P6zFzHSD8HvYzYUM6VMJ10eHr2GeKti+DXjGav7D50iXKOOJIJnVL0wNZa7oOlLz4zLo s1lQ== X-Gm-Message-State: AOAM533vQudw/2Duck6nqVmq8VTew/S0GZWpKzjFJnm6cFSgEFdsow07 Hy3xn1O8PD1rGVHjG24hsUnjV71UrXtK X-Google-Smtp-Source: ABdhPJyQMa86XBPHTBxCw2e2CfDITisuclXMKQ6iyrl3usqkGpaB9PrWjBHq73sQDPJD4lcQRuD2rBE8WJiW X-Received: from r2d2-qp.c.googlers.com ([fda3:e722:ac3:10:28:9cb1:c0a8:1652]) (user=qperret job=sendgmr) by 2002:a1c:7210:: with SMTP id n16mr2895100wmc.13.1616148141857; Fri, 19 Mar 2021 03:02:21 -0700 (PDT) Date: Fri, 19 Mar 2021 10:01:23 +0000 In-Reply-To: <20210319100146.1149909-1-qperret@google.com> Message-Id: <20210319100146.1149909-16-qperret@google.com> Mime-Version: 1.0 References: <20210319100146.1149909-1-qperret@google.com> X-Mailer: git-send-email 2.31.0.rc2.261.g7f71774620-goog Subject: [PATCH v6 15/38] KVM: arm64: Factor out vector address calculation From: Quentin Perret <qperret@google.com> To: catalin.marinas@arm.com, will@kernel.org, maz@kernel.org, james.morse@arm.com, julien.thierry.kdev@gmail.com, suzuki.poulose@arm.com Cc: android-kvm@google.com, seanjc@google.com, mate.toth-pal@arm.com, linux-kernel@vger.kernel.org, robh+dt@kernel.org, linux-arm-kernel@lists.infradead.org, kernel-team@android.com, kvmarm@lists.cs.columbia.edu, tabba@google.com, ardb@kernel.org, mark.rutland@arm.com, dbrazdil@google.com, qperret@google.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210319_100224_358142_09216EB8 X-CRM114-Status: GOOD ( 11.32 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: <linux-arm-kernel.lists.infradead.org> List-Unsubscribe: <http://lists.infradead.org/mailman/options/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=unsubscribe> List-Archive: <http://lists.infradead.org/pipermail/linux-arm-kernel/> List-Post: <mailto:linux-arm-kernel@lists.infradead.org> List-Help: <mailto:linux-arm-kernel-request@lists.infradead.org?subject=help> List-Subscribe: <http://lists.infradead.org/mailman/listinfo/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=subscribe> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" <linux-arm-kernel-bounces@lists.infradead.org> Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org |
Series |
KVM: arm64: Stage-2 for the host
|
expand
|
diff --git a/arch/arm64/include/asm/kvm_mmu.h b/arch/arm64/include/asm/kvm_mmu.h index 90873851f677..5c42ec023cc7 100644 --- a/arch/arm64/include/asm/kvm_mmu.h +++ b/arch/arm64/include/asm/kvm_mmu.h @@ -168,6 +168,14 @@ phys_addr_t kvm_mmu_get_httbr(void); phys_addr_t kvm_get_idmap_vector(void); int kvm_mmu_init(void); +static inline void *__kvm_vector_slot2addr(void *base, + enum arm64_hyp_spectre_vector slot) +{ + int idx = slot - (slot != HYP_VECTOR_DIRECT); + + return base + (idx * SZ_2K); +} + struct kvm; #define kvm_flush_dcache_to_poc(a,l) __flush_dcache_area((a), (l)) diff --git a/arch/arm64/kvm/arm.c b/arch/arm64/kvm/arm.c index 22d6df525254..e2c471117bff 100644 --- a/arch/arm64/kvm/arm.c +++ b/arch/arm64/kvm/arm.c @@ -1350,16 +1350,9 @@ static unsigned long nvhe_percpu_order(void) /* A lookup table holding the hypervisor VA for each vector slot */ static void *hyp_spectre_vector_selector[BP_HARDEN_EL2_SLOTS]; -static int __kvm_vector_slot2idx(enum arm64_hyp_spectre_vector slot) -{ - return slot - (slot != HYP_VECTOR_DIRECT); -} - static void kvm_init_vector_slot(void *base, enum arm64_hyp_spectre_vector slot) { - int idx = __kvm_vector_slot2idx(slot); - - hyp_spectre_vector_selector[slot] = base + (idx * SZ_2K); + hyp_spectre_vector_selector[slot] = __kvm_vector_slot2addr(base, slot); } static int kvm_init_vector_slots(void)