Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp654422ybh; Wed, 22 Jul 2020 09:46:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxeUb87GTRQYdANoCiHP+GE7GPCKaaFC65dODLNTL+jEbhqJbOMJa46XxKBO/oHeAz2kd8l X-Received: by 2002:a05:6402:b10:: with SMTP id bm16mr376275edb.92.1595436375903; Wed, 22 Jul 2020 09:46:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1595436375; cv=none; d=google.com; s=arc-20160816; b=IN1cC/XxeOxMz6dd/FoMi5veCRLtrURTf5F36dgtQNcrvRAgkIumQW1yUskQrn7eE2 FZt+Ez9hHcTYFOtSkqgVcy5U/OPVRt/fFq8dK0RU07GYa77ockRAKaIxv19DVbuAWkm8 cJtev9wpoHhYoaMBTwPTqiGe0oHxIEPH8nqhTrUJ82r1nMLya0/OpCmeXzz3hL1NOlTV LAm19Eh/T5FuTklvJ/oCz2zCf53wGW0DaEVb/K3P3FtCssLbx45E2GC7JafqojZWRSEt MJLHQQAjTYrHegq2By2jqlnVDRYTODYKkW6z5lOMfDN3px1gSPh5JcPcs4frDU0x3T+m Memw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=0Zoc4jT5D/PnpX6Ge9Fh8+yTlt5xAHFadpjWGBF1q0w=; b=cXc9fIhwLz7qxfrKpA7dTSg/oUWdg1lUbi0hafjM52C9dm/Z7GeLRGSGfEzwwh2Y0f ft7daMQDdHTYe2hLwK5041nGVKNLjReGrmU3GJLfbQ8okGKV5v6PZvsW0STUAQq98ZRj 6IPxjwl9C+SwUaKjOp6gEh7qd06Hsr7rnywsJcD4eaS+KI2I2If7V7BRgmzmdFakpML1 ZzwTlExniv5SJNKsYYhXQeI3Vvhr8koLRfoo5BrkJPXaM8cboGuCTRFBoHr9gJd25+OZ 3HUP0sgTQa/i0fPbQ5nZCtVndM4fYhMUu0UeS28y/BeYFEbUf3l4YvZ523Q+QUIlfKHO dUjQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=EHDURTcB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id oz19si372729ejb.202.2020.07.22.09.45.53; Wed, 22 Jul 2020 09:46:15 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=EHDURTcB; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728299AbgGVQpW (ORCPT + 99 others); Wed, 22 Jul 2020 12:45:22 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44882 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731298AbgGVQpQ (ORCPT ); Wed, 22 Jul 2020 12:45:16 -0400 Received: from mail-wr1-x442.google.com (mail-wr1-x442.google.com [IPv6:2a00:1450:4864:20::442]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 651CEC0619E1 for ; Wed, 22 Jul 2020 09:45:16 -0700 (PDT) Received: by mail-wr1-x442.google.com with SMTP id f18so2576813wrs.0 for ; Wed, 22 Jul 2020 09:45:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=0Zoc4jT5D/PnpX6Ge9Fh8+yTlt5xAHFadpjWGBF1q0w=; b=EHDURTcBkVhJJVi3ujf/kQeTfFBT7h/B9rxoO/V6rVCgVwVesI6SzZIa06WBR4XrFl EEc9WcBPE7DBmvVrqXAG2TZ6AgH9fDPkjcr/cpkZ3YeIKVPt1DBo+pvWJi6VB3G/JmeX fSgzbviAYvO/KtVcj8dE8gdhqC3wxBnOf4JlONMDO93pAlrrfS5v4nv9Avm7ELmCflWd 3AltLvlQCDsboajAG8AeCOm8lC6ewgH11gH6xtNGdjO5UFpz3uUW8GRmqYaHIa02jYdR vH1wWLWsSKtXiU7d9T/LJrWMnSBWw2shzP30T5TVW0Z4QbYHatf6n/Uz3oyeSyz0QFKE 7YXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=0Zoc4jT5D/PnpX6Ge9Fh8+yTlt5xAHFadpjWGBF1q0w=; b=XvvsSE3zQglYVq1SJJ/MH/u9mH06IgORKIJxw/6CvDcyM4H6vhdxowuLRxexcgE0zB kVIGk7AG4zST6M3Cb8EqSSryjhy2t9f+8vGFRZJPHIK7d9FPvXTgYNZ5qFYVag5ZhpXm xHHMSszQMuaYvWJUTxgKzfEiT4dKlnkrPS2SYG2wMUErrCXQrws9XDoZMX61bW87Culm YQvs9TCUrbFCRijGVE2iZWDOuUtgAaJBJKX0Rr+ysAa1Fxjx1kcSsdZypeRQf5fI0inr JiZ38BPyxcBbr1cffeSk4rkCvCqP18iOn7C4wk0YhFyAzLhbets7upVVxUXAHYi710Ke 1Ekw== X-Gm-Message-State: AOAM530BZ5HELZdAqXoA5ke1Irbx9A6fR8kw4Yvz9bCJHPFvE5TtKp0V 85FxxdTM9zpcDf0Bn9ge5ZWpgQ== X-Received: by 2002:a5d:548f:: with SMTP id h15mr365969wrv.331.1595436314869; Wed, 22 Jul 2020 09:45:14 -0700 (PDT) Received: from localhost ([2a01:4b00:8523:2d03:b0ee:900a:e004:b9d0]) by smtp.gmail.com with ESMTPSA id t2sm242165wma.43.2020.07.22.09.45.13 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 22 Jul 2020 09:45:14 -0700 (PDT) From: David Brazdil To: Catalin Marinas , Will Deacon , Marc Zyngier , Dennis Zhou , Tejun Heo , Christoph Lameter , Arnd Bergmann Cc: James Morse , Julien Thierry , Suzuki K Poulose , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kvmarm@lists.cs.columbia.edu, linux-arch@vger.kernel.org, kernel-team@google.com, David Brazdil Subject: [PATCH 9/9] kvm: arm64: Remove unnecessary hyp mappings Date: Wed, 22 Jul 2020 17:44:24 +0100 Message-Id: <20200722164424.42225-10-dbrazdil@google.com> X-Mailer: git-send-email 2.27.0 In-Reply-To: <20200722164424.42225-1-dbrazdil@google.com> References: <20200722164424.42225-1-dbrazdil@google.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org With all nVHE per-CPU variables being part of the hyp per-CPU region, mapping them individual is not necessary any longer. They are mapped to hyp as part of the overall per-CPU region. Signed-off-by: David Brazdil --- arch/arm64/include/asm/kvm_mmu.h | 25 +++++++------------------ arch/arm64/kvm/arm.c | 17 +---------------- 2 files changed, 8 insertions(+), 34 deletions(-) diff --git a/arch/arm64/include/asm/kvm_mmu.h b/arch/arm64/include/asm/kvm_mmu.h index e9e5875274cb..1a66089cf4f4 100644 --- a/arch/arm64/include/asm/kvm_mmu.h +++ b/arch/arm64/include/asm/kvm_mmu.h @@ -531,28 +531,17 @@ static inline int kvm_map_vectors(void) DECLARE_PER_CPU_READ_MOSTLY(u64, arm64_ssbd_callback_required); DECLARE_KVM_NVHE_PER_CPU(u64, arm64_ssbd_callback_required); -static inline int hyp_init_aux_data(void) +static inline void hyp_init_aux_data(void) { - int cpu, err; + int cpu; - for_each_possible_cpu(cpu) { - u64 *ptr; - - ptr = per_cpu_ptr_nvhe(arm64_ssbd_callback_required, cpu); - err = create_hyp_mappings(ptr, ptr + 1, PAGE_HYP); - if (err) - return err; - - /* Copy value from kernel to hyp. */ - *ptr = per_cpu(arm64_ssbd_callback_required, cpu); - } - return 0; + /* Copy arm64_ssbd_callback_required values from kernel to hyp. */ + for_each_possible_cpu(cpu) + *(per_cpu_ptr_nvhe(arm64_ssbd_callback_required, cpu)) = + per_cpu(arm64_ssbd_callback_required, cpu); } #else -static inline int hyp_init_aux_data(void) -{ - return 0; -} +static inline void hyp_init_aux_data(void) {} #endif #define kvm_phys_to_vttbr(addr) phys_to_ttbr(addr) diff --git a/arch/arm64/kvm/arm.c b/arch/arm64/kvm/arm.c index bbbc5c1519a9..f2e537d99d2b 100644 --- a/arch/arm64/kvm/arm.c +++ b/arch/arm64/kvm/arm.c @@ -1628,22 +1628,7 @@ static int init_hyp_mode(void) } } - for_each_possible_cpu(cpu) { - kvm_host_data_t *cpu_data; - - cpu_data = per_cpu_ptr_hyp(kvm_host_data, cpu); - err = create_hyp_mappings(cpu_data, cpu_data + 1, PAGE_HYP); - - if (err) { - kvm_err("Cannot map host CPU state: %d\n", err); - goto out_err; - } - } - - err = hyp_init_aux_data(); - if (err) - kvm_err("Cannot map host auxiliary data: %d\n", err); - + hyp_init_aux_data(); return 0; out_err: -- 2.27.0