From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: 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=-15.7 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=unavailable 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 EF0CDC433E2 for ; Wed, 16 Sep 2020 17:38:13 +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 8A96620708 for ; Wed, 16 Sep 2020 17:38:13 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="iCNZ1BAL"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="XBpFPnVn" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 8A96620708 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=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=Z9/G6R23NQovlivhdrFw950UwDU01vAMxJfhNyBF0fY=; b=iCNZ1BALxhbZKC9cwfnAyCfA/ wQWtJvJ/giz864nLfI2Xm4gm1o19waAGWRlgpXh8NA5vDlvDYOXseBnl9OpgJIzx4Hb3YQwB6p4Sp kJu7U72i+h9eHZiUmKTaSfM8KeWbgfrwy3pbhDAv68YRgBguSPEiCZzWLubw83j1YX5yK3OIqlXBl 3F0DvzZrdgQgIJdJx5JEcDwUq/ZDD3rIzOKiOyPZNYj9KzVhxHXxrwDXEFEYKzGFFvVF5Z3GVTzgV SvqJ2mgaVd1zFStnVoT1w/ps5lUp2fJpM+Y/t4e+K3i3PlRuXdFPwcKtdEoBdovzMqOEirUBtPffE 38CjK6StA==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kIbM5-0001RM-8c; Wed, 16 Sep 2020 17:36:29 +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 1kIbKm-0000xO-8M for linux-arm-kernel@lists.infradead.org; Wed, 16 Sep 2020 17:35:09 +0000 Received: by mail-wr1-x444.google.com with SMTP id k15so7761777wrn.10 for ; Wed, 16 Sep 2020 10:35:08 -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=EdexJTeSJ1yzSq2NB9sPeJusVOkXFFsSU8w5tX+wAoY=; b=XBpFPnVnEXotZ9h7Vi96uiegtXa9f6RsxKZhjfRsj/bVOPdAq6fxcKcQEAWKY2yP/+ j3PWyy1esATPnLP3uevSBbvUQKYvsCxNVoLaiGC/5iqudT2qc6itwteJuDQZN39vdob3 QaDJj5Fg7ELcwgZceR5AuZcuIyWWmWGJn9h8tuNgYqFXJvF9GfV92xXB911rmrSm3IJz DEVO8XTVwMYWDmqJ1lvnk1kAgNDeDDzO49zUONaiMZF3cfbTO5K+56OTvnR1AU7UXbMn LvmycZKfMnvi9K9gtcHdirkVA7EoQe+EhLFDqe8HnRz+8V1xqmA+BY1XfOsJpaZD8LH6 UDzA== 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=EdexJTeSJ1yzSq2NB9sPeJusVOkXFFsSU8w5tX+wAoY=; b=SHjtmGHGjwkcCdCnCYOVDBT6Rn7+oplaeFQHe0CYEDmqGO70CpWdBEarH6JeUoeeIV 75VzoUNTNElBKaILSvNz4K/ySmvyJPIcUD3Rc1FREqR03jGMiDH7GLn5ow2kb/tNqmXW a5WDjRVfnzSAnXyA7pt9B2QDDAVbqn1bsE2EBOxgntScXeRqtzrNgdR+BYwjtJ9AmiCH LzDrObtSc+290YVVLJYTRRytQRwyMccG3KNf/bOYR8RdV6F8YV1yOlOshUhOKRJSXWHS hPnFZnAksEvpxBBPqDYtmKdXdWul6/SAyICE1+DGy6ZIqeyULQLeoR2FansPbUDoxZdN 4jLg== X-Gm-Message-State: AOAM532DU3JJ41/5rGQ3HFZF8xTiti1LIlpsD/fBQ3mCsrL13RewVXGm +MQ4a9vpL5LkryuNUXqig++zAA== X-Google-Smtp-Source: ABdhPJxiNME7o6IoYWEvolPBp1wwKcDxQ2PJwQacH0w0glnZjPPICPGldNZPzVdYDrWU7SS+rM/Ucw== X-Received: by 2002:adf:92c2:: with SMTP id 60mr29983169wrn.220.1600277707032; Wed, 16 Sep 2020 10:35:07 -0700 (PDT) Received: from localhost ([2a01:4b00:8523:2d03:e49d:f6be:d31b:ad3c]) by smtp.gmail.com with ESMTPSA id j10sm35693576wrn.2.2020.09.16.10.35.05 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 16 Sep 2020 10:35:05 -0700 (PDT) From: David Brazdil To: kvmarm@lists.cs.columbia.edu Subject: [PATCH v3 11/11] kvm: arm64: Remove unnecessary hyp mappings Date: Wed, 16 Sep 2020 18:34:39 +0100 Message-Id: <20200916173439.32265-12-dbrazdil@google.com> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20200916173439.32265-1-dbrazdil@google.com> References: <20200916173439.32265-1-dbrazdil@google.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20200916_133508_525450_99D1F4E3 X-CRM114-Status: GOOD ( 16.36 ) 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: kernel-team@android.com, Suzuki K Poulose , Catalin Marinas , linux-kernel@vger.kernel.org, James Morse , linux-arm-kernel@lists.infradead.org, Marc Zyngier , Tejun Heo , Dennis Zhou , Christoph Lameter , David Brazdil , Will Deacon , Julien Thierry , Andrew Scull Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.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. Acked-by: Andrew Scull Signed-off-by: David Brazdil --- arch/arm64/include/asm/kvm_mmu.h | 19 +++++-------------- arch/arm64/kvm/arm.c | 17 +---------------- 2 files changed, 6 insertions(+), 30 deletions(-) diff --git a/arch/arm64/include/asm/kvm_mmu.h b/arch/arm64/include/asm/kvm_mmu.h index 9db93da35606..7d1581bc8b97 100644 --- a/arch/arm64/include/asm/kvm_mmu.h +++ b/arch/arm64/include/asm/kvm_mmu.h @@ -531,28 +531,19 @@ 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; + /* Copy arm64_ssbd_callback_required values from kernel to hyp. */ for_each_possible_cpu(cpu) { - u64 *ptr; + u64 *ptr = per_cpu_ptr_nvhe(arm64_ssbd_callback_required, cpu); - 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; } #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 8293319a32e7..4483b6aca5d7 100644 --- a/arch/arm64/kvm/arm.c +++ b/arch/arm64/kvm/arm.c @@ -1634,22 +1634,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.618.gf4bc123cb7-goog _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel