From patchwork Wed Jul 22 16:44:24 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: David Brazdil X-Patchwork-Id: 11678945 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 64D8B138A for ; Wed, 22 Jul 2020 16:47:45 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 3D2AB207CD for ; Wed, 22 Jul 2020 16:47:45 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="xdAJ15Pr"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="EHDURTcB" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 3D2AB207CD 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+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=/OpAjPzwD3KKwmZY5LenazGFkJFjYRMc6ZsYEINh3O4=; b=xdAJ15Prtmd+XN4QLTfduFbMr yea3+77ssRJqps9EXmxYHGbFiNHZ/IWvLTrCl4oSuy1N0XRKGnZv9eFwl0oid+x0hd5WzPaqG/3QL oRrMA7h5cMNWGyRiKu8F2n9ar7CbCUfX/U7NTQ5L7AK5h6fX0o02YesByDuAszqsRSK2y5r9axZn0 3f2b50lwAuMnJC7qd+3JwvbQQEFccCu23vhKFYdmFahtKXvslSahvLn6TH0dYGSYADpVp9DqL9JS8 iF/JLu6gX/IRGEou6wIeN+vsSscvzpMUFkI/TDvm8H6CqEl/JVU+wqBemS08tuz/1k8/XlwV53ouG +piV8ppcw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1jyHsn-0002JK-Dj; Wed, 22 Jul 2020 16:46:17 +0000 Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1jyHro-0001xE-2d for linux-arm-kernel@lists.infradead.org; Wed, 22 Jul 2020 16:45:17 +0000 Received: by mail-wr1-x444.google.com with SMTP id s10so2533985wrw.12 for ; Wed, 22 Jul 2020 09:45:15 -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=LQBHpct+nZnv+h2lU9RNtaZH4oqMI9d999GBhrGizCQRXCmnF1KxL1oybGXp1y9w1M qgm/0010AJWxTXcSS/I/GN3iIroWxImQJOPm/XhGOuMB31Qg2qv65Kjr7uYlFsD+I2nr xYK8HL4VYw8+r+KIRdfkOG//HVhS+IyiMNqzNCTvIQlcqkfM9PR3N4TfEnK7yZDypMJD iBRrNaZ2h7cVQ/xuHS1aXGqXMqho7vB7kq2bRoDIHS3r2GX+TjlXE0mdCKR98kE03r0/ rvb5fqzfylnl9YqGKH/0FprCv6vIYtDTnlRAetP1sKNp8qGoZNya7F2Pjk6NVgl2Tjvj dfXA== X-Gm-Message-State: AOAM533jOSPozGZgxOL7pzJCEQt5kW808gWRJI/oe6a88NybI6+pKa/q OUghwFnPTxZokklCjjsnTAS8Fw== X-Google-Smtp-Source: ABdhPJzLKmKG9pub1HFuNdCsYrh8zqcSQp68qHq5cvDc4U/7vFwUWtKwLOPhPUQibgTF3FLak/t0vg== 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 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200722_124516_218944_09B3A0E4 X-CRM114-Status: GOOD ( 15.39 ) X-Spam-Score: -15.7 (---------------) X-Spam-Report: SpamAssassin version 3.4.4 on merlin.infradead.org summary: Content analysis details: (-15.7 points) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 RCVD_IN_DNSWL_NONE RBL: Sender listed at https://www.dnswl.org/, no trust [2a00:1450:4864:20:0:0:0:444 listed in] [list.dnswl.org] -7.5 USER_IN_DEF_DKIM_WL From: address is in the default DKIM white-list -7.5 USER_IN_DEF_SPF_WL From: address is in the default SPF white-list 0.0 SPF_HELO_NONE SPF: HELO does not publish an SPF Record -0.0 SPF_PASS SPF: sender matches SPF record -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.5 ENV_AND_HDR_SPF_MATCH Env and Hdr From used in default SPF WL Match -0.0 DKIMWL_WL_MED DKIMwl.org - Medium sender X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-arch@vger.kernel.org, Suzuki K Poulose , linux-kernel@vger.kernel.org, kernel-team@google.com, James Morse , Julien Thierry , David Brazdil , kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.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: