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 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id F11CBC433EF for ; Fri, 10 Dec 2021 14:38:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=op68xK2Eb2LLxWYy3qj5iD91pESDHfPFeW5rVGxJACo=; b=F42KSEFl79G+h5 njhp4+7kGzWtuzicoMDi4qK5/1FUwcDRW1MbiXQvu3wf9OjWpEGugMMSHLtXXdaidcMCRQN77UWx/ SXK8ld/SyljoPhjWI3cWWxdtjxJGb5TZoBnxnkZs9oCNj3UNzgG0VIp2WOyahpEmOVK8VsTQsWzUb K7GpI9o6ChYA+mrWYsGjo5zJqGrGOZ+63SfCrUidjId4N3GeMfmlGuH8uvq/c3B4KFi1vqQkauSqq n/YYiznA/GYYq2BND/9YrCmG2dupzeL8fwwvzgMpMaLAi54DJ2TuhJgI63z4hmEuWseVfKrRyRTo2 kb6xMluIODmXnBWlNh3w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mvh1f-002EGc-0O; Fri, 10 Dec 2021 14:37:31 +0000 Received: from mail-wm1-x329.google.com ([2a00:1450:4864:20::329]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mvh1a-002EFn-TV for linux-arm-kernel@lists.infradead.org; Fri, 10 Dec 2021 14:37:28 +0000 Received: by mail-wm1-x329.google.com with SMTP id c6-20020a05600c0ac600b0033c3aedd30aso6774417wmr.5 for ; Fri, 10 Dec 2021 06:37:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=iT+nRlkqP8ujdkhR1yHcmqTSB9Hb9nBGvw1m1PwYrU4=; b=LJW+Qg/MN2vlQ4hC5d84O4HWpmjzzbl+hwt4dYAELPT880hHpRFAZikcPqMVDWcaW5 JtAe4D8wz5kZWyjyAB/+4xUZrgpNpozYFtRRLLKkMoU6/EmouGTvY6FPkA77kQoyvs/v aFr3sL11apWy0rCQjdfNzXf7eDGBYaG1f36x9tlciYdd8W99tguVUtOddHdFZoXklmgR 9YEkIUxD3OWUv4I+T0ggbI7kTKXI2RtL7uOBPtbJhCb7AGimn/5ScmHknajg8CHl0fKD arVUYOpYX5UgcPQV8y9cCLcRZwdZQQrt5Sny0Bc2WwyHMnHoqBa3R++EnZ4LEG0SoY/p xrXw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=iT+nRlkqP8ujdkhR1yHcmqTSB9Hb9nBGvw1m1PwYrU4=; b=vcmxUQg0Wb1kc5tPv1Zv+i+EoHZYxkxF5sGPXQYQoMYofgwMTImvS8ab9O2QyRO74y d4IwXE7xLp3RUeKcbdFgm2I0b/oB6V59Pq3s0nWwi0M4jWgYOd2rA0+bvUnckr9vk1oc pSdUfYBxaO59iEVR1L1h1rii1O3V9ts1zcbyTFfWoV4qQiyreN0cV0tfjGord5XdG7R6 r2C3umx0m2ZF7jPfqdZFEfTrP5dcxkGh0Ki+oLjdce9OCdjvxn20uiMc254RninlZ/VD IUV4yiCkS540cjfMLA4XzNPDxe0copw+LAJPt9WrjyIs/ddwGj2ge+puf1UUfLy4Nnxr 9xiQ== X-Gm-Message-State: AOAM5328oUgzgok51QH0+FZeidDLPtvd08D84bl83lk+cvMAhh7KMlbQ NLKAodYBjm1sOnjzDEK0Z63dbQ== X-Google-Smtp-Source: ABdhPJzpmKQ+A4NRlPF6u1SVizDawCpgts4j/A6org/QHTlhW19yx/bTp0VUSDuxuLTJUFIurktC1A== X-Received: by 2002:a05:600c:296:: with SMTP id 22mr17315115wmk.135.1639147044652; Fri, 10 Dec 2021 06:37:24 -0800 (PST) Received: from google.com ([2a00:79e0:d:210:76c1:fb36:1e22:8677]) by smtp.gmail.com with ESMTPSA id g5sm3758412wri.45.2021.12.10.06.37.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Dec 2021 06:37:24 -0800 (PST) Date: Fri, 10 Dec 2021 14:37:21 +0000 From: Quentin Perret To: Will Deacon Cc: Marc Zyngier , James Morse , Alexandru Elisei , Suzuki K Poulose , Catalin Marinas , linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org, kernel-team@android.com Subject: Re: [PATCH v3 07/15] KVM: arm64: Introduce kvm_share_hyp() Message-ID: References: <20211201170411.1561936-1-qperret@google.com> <20211201170411.1561936-8-qperret@google.com> <20211209111309.GB1912@willie-the-truck> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20211209111309.GB1912@willie-the-truck> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211210_063726_976212_63A84255 X-CRM114-Status: GOOD ( 26.75 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , 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 On Thursday 09 Dec 2021 at 11:13:10 (+0000), Will Deacon wrote: > On Wed, Dec 01, 2021 at 05:04:01PM +0000, Quentin Perret wrote: > > The create_hyp_mappings() function can currently be called at any point > > in time. However, its behaviour in protected mode changes widely > > depending on when it is being called. Prior to KVM init, it is used to > > create the temporary page-table used to bring-up the hypervisor, and > > later on it is transparently turned into a 'share' hypercall when the > > kernel has lost control over the hypervisor stage-1. In order to prepare > > the ground for also unsharing pages with the hypervisor during guest > > teardown, introduce a kvm_share_hyp() function to make it clear in which > > places a share hypercall should be expected, as we will soon need a > > matching unshare hypercall in all those places. > > > > Signed-off-by: Quentin Perret > > --- > > arch/arm64/include/asm/kvm_mmu.h | 1 + > > arch/arm64/kvm/arm.c | 4 ++-- > > arch/arm64/kvm/fpsimd.c | 2 +- > > arch/arm64/kvm/mmu.c | 27 +++++++++++++++++++++------ > > arch/arm64/kvm/reset.c | 2 +- > > 5 files changed, 26 insertions(+), 10 deletions(-) > > [...] > > > diff --git a/arch/arm64/kvm/mmu.c b/arch/arm64/kvm/mmu.c > > index f8f1096a297f..fd868fb9d922 100644 > > --- a/arch/arm64/kvm/mmu.c > > +++ b/arch/arm64/kvm/mmu.c > > @@ -299,6 +299,25 @@ static int pkvm_share_hyp(phys_addr_t start, phys_addr_t end) > > return 0; > > } > > > > +int kvm_share_hyp(void *from, void *to) > > +{ > > + if (is_kernel_in_hyp_mode()) > > + return 0; > > + > > + /* > > + * The share hcall maps things in the 'fixed-offset' region of the hyp > > + * VA space, so we can only share physically contiguous data-structures > > + * for now. > > + */ > > + if (is_vmalloc_addr(from) || is_vmalloc_addr(to)) > > + return -EINVAL; > > If we're adding these sanity checks, perhaps is_vmalloc_or_module_addr() > would be worth using instead? Ack, I'll fix that up. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel