From patchwork Wed Dec 1 17:03:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Quentin Perret X-Patchwork-Id: 12694349 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 84214C433F5 for ; Wed, 1 Dec 2021 17:06:12 +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:Cc:To:From:Subject:References: Mime-Version:Message-Id:In-Reply-To:Date:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=eSDJ5Uv/XYhjE0iCM30uRR86W0rgJH6yUyqn7k1HE1g=; b=1EUCX7gusRr3zDR3E7iQJt8iDg ZS24L2Rn7+X7vGY61z2XWxPZaHN6ha+LBqIE9C1FkWnmhhrev+WbbsUJVqaLThW91ZFhAlw3tvjJZ bL+fbKQYU5BJLgllRgVGfGInckPRh3Q+ddGNf8CeIRMEkI48lvDsLYS31q16nNYrCA1bxjwLVq3N0 64a0imjuJiqSucbtuyjTeSovYX88toZhxIFxqGWoIZXBdY/KbZZVgWX6zDvL9k+OQFRGXnvorkjg3 i7VAOehCXIZQWGU1Z71eD84ObIIVKK+5Jdyq/2Jjmi3mCSoG8S+3CPAoapgWT38jRjvgsMM9+2UXd L0sU8oQg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1msT2C-009Rum-A5; Wed, 01 Dec 2021 17:04:44 +0000 Received: from mail-wm1-x349.google.com ([2a00:1450:4864:20::349]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1msT1r-009RpF-6Y for linux-arm-kernel@lists.infradead.org; Wed, 01 Dec 2021 17:04:24 +0000 Received: by mail-wm1-x349.google.com with SMTP id r129-20020a1c4487000000b00333629ed22dso132989wma.6 for ; Wed, 01 Dec 2021 09:04:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=5u4bcd8p5lWhOh9Twmw6ckk6rlz/H+k7Di86Nv+W7y0=; b=c2jCqyYJWi6j0q+TdDuz84phld5+VtSpY4m7fhUMjwZLascGKc4969abcgbluEB/Ze h/sY9sRt4zD8i/w/dPj//QCFbZ71q4VJxjSfwZNtAByXbmjpRHJ+yOLVXEcfb6s9kZIH NnaaFE1z0Ehl4VNNXPMVWuvl102KADwuQxFHzKv2d2JeQSOYpIVIs1BlfbuuZmb857DQ r30VAksuJc/Cbj3iGu3aZe7i20L+ENRdWzTjRz5xtASwajdp145hE153kJaS7HGrgjxj 8SIhH82RSlvwXFa2KohYPvS1mvjQCVQPZ51hqOt61AfOjEwOtzTvnuVJWbZIxCVcSEw1 GHXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=5u4bcd8p5lWhOh9Twmw6ckk6rlz/H+k7Di86Nv+W7y0=; b=u7QZkMIMHz6wquGSkmyUaToMNk5sECiScID9CjWtaLnZeWfS3ye/+dP8UFAs9H1F1+ VGc0rcNXsmFOhnJ8LNhBpRst5M2UqoQeqjywHdaCKIu76MG1EKklG57QbfaPriqchEfI Hr7NUu7kmrbVPYmxbRZXvKhlcjlZviraep3DqYkNCwVd/n/+yOjsmww/VXVhIQNaajAU 2vYiiGPdILkaIgTfRcIvBxAvXIRqlYgDVIOfXZ6E0crBXVlw8/w2Np9jGqvEnY7DaRvL /UcUvqk2TyRz06B6kJMRAB5Lok3bmRy7f23NPo60swWzFO58D5tcUpLVByvhl4zOwrBo HwJQ== X-Gm-Message-State: AOAM532Mem0rg3xQ7BQLhbkGv3e6+1LDJsB1jrzXNT2NnNL3jjttNub8 /gJ30sy+5JS/+lSRK1j1ZA6cBFHPZM8C X-Google-Smtp-Source: ABdhPJz8KqUSlppvt5PWeoeu8pXK06/96X8A4lVCiTuTfHGPzga9ENc8lxXkM7E2YtzgjN+WEGl+8JdtGsxP X-Received: from luke.lon.corp.google.com ([2a00:79e0:d:210:1cab:1a20:2ef1:ddde]) (user=qperret job=sendgmr) by 2002:a05:6000:23a:: with SMTP id l26mr8091897wrz.215.1638378261551; Wed, 01 Dec 2021 09:04:21 -0800 (PST) Date: Wed, 1 Dec 2021 17:03:56 +0000 In-Reply-To: <20211201170411.1561936-1-qperret@google.com> Message-Id: <20211201170411.1561936-3-qperret@google.com> Mime-Version: 1.0 References: <20211201170411.1561936-1-qperret@google.com> X-Mailer: git-send-email 2.34.0.rc2.393.gf8c9666880-goog Subject: [PATCH v3 02/15] KVM: arm64: Provide {get, put}_page() stubs for early hyp allocator From: Quentin Perret To: Marc Zyngier , James Morse , Alexandru Elisei , Suzuki K Poulose , Catalin Marinas , Will Deacon Cc: linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org, kernel-team@android.com X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211201_090423_266494_9D9364FD X-CRM114-Status: GOOD ( 11.98 ) 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: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org In nVHE protected mode, the EL2 code uses a temporary allocator during boot while re-creating its stage-1 page-table. Unfortunately, the hyp_vmmemap is not ready to use at this stage, so refcounting pages is not possible. That is not currently a problem because hyp stage-1 mappings are never removed, which implies refcounting of page-table pages is unnecessary. In preparation for allowing hypervisor stage-1 mappings to be removed, provide stub implementations for {get,put}_page() in the early allocator. Signed-off-by: Quentin Perret Acked-by: Will Deacon --- arch/arm64/kvm/hyp/nvhe/early_alloc.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/arch/arm64/kvm/hyp/nvhe/early_alloc.c b/arch/arm64/kvm/hyp/nvhe/early_alloc.c index 1306c430ab87..00de04153cc6 100644 --- a/arch/arm64/kvm/hyp/nvhe/early_alloc.c +++ b/arch/arm64/kvm/hyp/nvhe/early_alloc.c @@ -43,6 +43,9 @@ void *hyp_early_alloc_page(void *arg) return hyp_early_alloc_contig(1); } +static void hyp_early_alloc_get_page(void *addr) { } +static void hyp_early_alloc_put_page(void *addr) { } + void hyp_early_alloc_init(void *virt, unsigned long size) { base = cur = (unsigned long)virt; @@ -51,4 +54,6 @@ void hyp_early_alloc_init(void *virt, unsigned long size) hyp_early_alloc_mm_ops.zalloc_page = hyp_early_alloc_page; hyp_early_alloc_mm_ops.phys_to_virt = hyp_phys_to_virt; hyp_early_alloc_mm_ops.virt_to_phys = hyp_virt_to_phys; + hyp_early_alloc_mm_ops.get_page = hyp_early_alloc_get_page; + hyp_early_alloc_mm_ops.put_page = hyp_early_alloc_put_page; }