Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp388908pxk; Thu, 3 Sep 2020 02:22:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwy15NM5ouwMxO3FwHbV+MkcGbAJDs2o1JBnEwjC1Xm8pni+BKlSqY7xKvk5yiXCAlE6E7l X-Received: by 2002:a05:6402:1b0f:: with SMTP id by15mr1972830edb.289.1599124952640; Thu, 03 Sep 2020 02:22:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1599124952; cv=none; d=google.com; s=arc-20160816; b=YGZWQLnzTCk8B1xe9nBBX3lbCwEzgZEY4FhKRJKHm9vBecNcJFY+eMJ+bNU/jdmCtS ejGMs0iZVJF63t5cOLK65e3yBjAnAGnEUGxwV8Kgn4ObAzpzz4w156XlhMPWTu4GYTw/ nyJxvpijTr5GPP8Z3smvXTMALiCrWxs9/L75B7Gs0FuEu514XaaEtMIfRzPy9r/kFlkM LnxRAa/zSeGBTiKCKha36+qZzAgpf5LK1uA2A3O4xuH6bxED7oq19ChU04pJ1hE8SyuU H8UrhRyq4Xk7wuDV0hyqSJyvzNQ89id7KlPOneqXV77eNgPnvcVb0HpVX7eEIpoz8wkw 8H6A== 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=NQv+tl4uppeFkb8OE5qw190d9LgQJYKQj0zpEykuMCM=; b=SHfCxwpGke8e8Uua3nAwCwa2qFRdge1y/JIk4mZjUnEXYGTjFx6btQAVWI4WylcL1y Gv3e2XBD9UixH6MXj+QHzDVHqfM0s51PQdxGH/KaoPIGddKdSvuiv13nAmbaf98vE8T8 69/kSR0NNcJNfCYR0PN+bsyPJZqYsngSG1oaCOiIOXXh6kURkCO9V68s60YA1cMq1ZIa k4ODOIMV41q67dZFjFwXPtD01xW2EQ7hbR1QvSpNQ0LASrBovKcb7xTzJmcmbWlh9TF/ NaGVV6oijEZGQXF42djeGg79yhy4InP2RJzW7cp1dJk7UeU+BUkDqqTvKrRnuwIk9YDy K/GA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=WGeAJLDM; 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 qw1si1479911ejb.144.2020.09.03.02.22.08; Thu, 03 Sep 2020 02:22:32 -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=WGeAJLDM; 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 S1728390AbgICJSc (ORCPT + 99 others); Thu, 3 Sep 2020 05:18:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44510 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728322AbgICJSD (ORCPT ); Thu, 3 Sep 2020 05:18:03 -0400 Received: from mail-ej1-x643.google.com (mail-ej1-x643.google.com [IPv6:2a00:1450:4864:20::643]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C868DC06124F for ; Thu, 3 Sep 2020 02:18:02 -0700 (PDT) Received: by mail-ej1-x643.google.com with SMTP id i22so2833160eja.5 for ; Thu, 03 Sep 2020 02:18:02 -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=NQv+tl4uppeFkb8OE5qw190d9LgQJYKQj0zpEykuMCM=; b=WGeAJLDMsRVumT9Q9ux6Nast3r0JswgFOC70ZutZNZBpf4GDOxF1Vq6GaxB6cpDZ45 Ubq1CjFd9RyDJye5zoVo0+QI21IJuR8D5K5NTSCX0bfI9NOKTkGvpRSdqjbbeU8lOgnD tJC8vPxb//wpf1qUbLuSg0l8hrW/1r/jrioS74dOFucWmTNYEf6D0j0FI538lwVoZMfU 6nmWYHKuc7tfuY983RwJ7bm/dKm2mVyjPAIdqZoonp/ofsHcYNliONbyDgPpLGYp45Oa CHQHOnDIGMvH+AX91mPbZluIWwNyPlz47HjPqLMi0Ot2VIwY+bVwfHvG9y4br0BODeiC d9rw== 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=NQv+tl4uppeFkb8OE5qw190d9LgQJYKQj0zpEykuMCM=; b=a/N7MOBk00WzUyMd2/oW4t4s14G1qoDJQ74fWKeSoddB4rqoSSZEUrE0b7DrR/+VH5 FfpmRrRlA/i0U05yAwPCl+cw8GER+ZC9EfBY1XHt6y+JkWdR35RqL12BcTvmfhN8mTW8 5lYWmPpe+duOjQW7zj6mwkLIS8OKenepLrGu1K7bOSOS9KpV9Y5uavKZp6r882BQzbnN k4rupNIa6ySk0RBzEhR/cTmuv0AHnzVQtBHSPr0cCmj+2M39JSc1LNlRJAdQlWEicXMi DqDravAAAXCCE3tU+jystI1kgR7XmMuO7biWyH0uHv5lQaIMwSq7wNEy/TBjcpyJzr03 iRGg== X-Gm-Message-State: AOAM533gDkDwvAAXUpp02Ki7X6rjLO2OildLjyLf45KXDhOwT+QxnSgk BYwle2yAYh8FzrDTTnqjapjGlQ== X-Received: by 2002:a17:906:3ac4:: with SMTP id z4mr1065800ejd.65.1599124681204; Thu, 03 Sep 2020 02:18:01 -0700 (PDT) Received: from localhost (dynamic-2a00-1028-919a-a06e-64ac-0036-822c-68d3.ipv6.broadband.iol.cz. [2a00:1028:919a:a06e:64ac:36:822c:68d3]) by smtp.gmail.com with ESMTPSA id x25sm2429769edv.42.2020.09.03.02.17.59 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 03 Sep 2020 02:18:00 -0700 (PDT) From: David Brazdil To: Marc Zyngier , Catalin Marinas , Will Deacon , 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@android.com, David Brazdil Subject: [PATCH v2 10/10] kvm: arm64: Remove unnecessary hyp mappings Date: Thu, 3 Sep 2020 11:17:12 +0200 Message-Id: <20200903091712.46456-11-dbrazdil@google.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200903091712.46456-1-dbrazdil@google.com> References: <20200903091712.46456-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 9db93da35606..bbe9df76ff42 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 df7d133056ce..dfe1baa5bbb7 100644 --- a/arch/arm64/kvm/arm.c +++ b/arch/arm64/kvm/arm.c @@ -1631,22 +1631,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.28.0.402.g5ffc5be6b7-goog