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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 997A1C433EF for ; Thu, 21 Oct 2021 10:07:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 80535610FF for ; Thu, 21 Oct 2021 10:07:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231695AbhJUKKK (ORCPT ); Thu, 21 Oct 2021 06:10:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34672 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231371AbhJUKKJ (ORCPT ); Thu, 21 Oct 2021 06:10:09 -0400 Received: from mail-wr1-x42b.google.com (mail-wr1-x42b.google.com [IPv6:2a00:1450:4864:20::42b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AAE78C06161C for ; Thu, 21 Oct 2021 03:07:53 -0700 (PDT) Received: by mail-wr1-x42b.google.com with SMTP id d13so129001wrf.11 for ; Thu, 21 Oct 2021 03:07:53 -0700 (PDT) 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=F1oNJbu4pHa0grSs6d/Ns7GwUCGiFMszmkl6//VgeII=; b=CngsNRHpP3xh6N7S6PHF34+fDeYjB5qMaxxKiYNqOUXnACoEzVHxqk0VkPKPnKHdvg hd4xZGhEWkmGTe3+vQq37jqfz+2B9jgU1f/k29IhjSEbTzNY7VEqfRaS4czCiwcWWGQH hXOGa460Fr6GCQuBFg4AjhGLfykL+N3ebKY/x9cgLPB6Ped+HppYo7wg08pEjqSiwrGp rn445z1qcoCtgA/5Sga/yWZjrpnftJ6gvgdJ62aFqCndEfK2v4R7Lp14sVp98mjJLlrY FFldqfowPeNnj06Bs88tiUuL2Aub10yszfkjfJtC0IAk+/dtVc1HWqv5Nos5Cep8XPMq FepQ== 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=F1oNJbu4pHa0grSs6d/Ns7GwUCGiFMszmkl6//VgeII=; b=WX9krUYJ72AMLnOtr+0X2pEfGea3XskSPNJwsPYoMS/OvAUvKApgCCWObUXF0xdGAG 7OvQcMZTp6bZARxsmjsS25KGTDJrpbVlwYdzdoRcJCFXfCuEcl8IOAVeaQ6gLjdDi9Vs 8Y3N0R9prj8KQQRvknGoZ2gnuQ+w0oPxYMBuurPUQ7wPnUNBd2AzsLWwGHsiZFYNi4L3 5CT2CC10xWO+C1fWI/nLTIsCgzL/pCDbw1eVmOuKjLQoZyri/C/HA1PMBYxPtBX4U/Dc PiRW+2EsF7CCK7GPSiiIb81qiSIQn+ITvYhDgKAcjrJR6ecs8nfPkmE+AmFTdj22gJAv Gv5Q== X-Gm-Message-State: AOAM532bovSe7AY+uXmgJykjEy6LhFtUd5aTGDSwm9syS0bwrSElokDW EJeFfiflorGZJm+bZYy6pbW8mg== X-Google-Smtp-Source: ABdhPJx0Ugn18uahMeYKsgvnxSDyUIvip8FsoCCPzC5FJhL12HE7Bbu4dUtEydRB1ms/fxFX8qmiVQ== X-Received: by 2002:adf:a10f:: with SMTP id o15mr6411916wro.286.1634810872098; Thu, 21 Oct 2021 03:07:52 -0700 (PDT) Received: from google.com (216.131.76.34.bc.googleusercontent.com. [34.76.131.216]) by smtp.gmail.com with ESMTPSA id n12sm5422554wri.22.2021.10.21.03.07.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Oct 2021 03:07:51 -0700 (PDT) Date: Thu, 21 Oct 2021 10:07:47 +0000 From: David Brazdil To: Quentin Perret Cc: Marc Zyngier , James Morse , Alexandru Elisei , Suzuki K Poulose , Catalin Marinas , Will Deacon , Fuad Tabba , Andrew Walbran , linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org, kernel-team@android.com Subject: Re: [PATCH v2 07/15] KVM: arm64: Introduce kvm_share_hyp() Message-ID: References: <20211019121304.2732332-1-qperret@google.com> <20211019121304.2732332-8-qperret@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20211019121304.2732332-8-qperret@google.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Quentin, > diff --git a/arch/arm64/kvm/mmu.c b/arch/arm64/kvm/mmu.c > index 0019b2309f70..0cc4b295e525 100644 > --- a/arch/arm64/kvm/mmu.c > +++ b/arch/arm64/kvm/mmu.c > @@ -299,6 +299,17 @@ 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; > + > + if (kvm_host_owns_hyp_mappings()) > + return create_hyp_mappings(from, to, PAGE_HYP); > + > + return pkvm_share_hyp(kvm_kaddr_to_phys(from), kvm_kaddr_to_phys(to)); We should be careful about vmalloc memory here. kvm_kaddr_to_phys will happily return the physical address but the range is not guaranteed to be physically contiguous. It doesn't look like this series ever shares vmalloc memory, but we should make it harder for users of this function to shoot themselves in the foot. One option would be to turn this into a loop and call pkvm_share_hyp on each physical page. But since the hypervisor has no means of making those pages virtually contigous anyway, probably not the right approach. We could make it possible to share vmalloc buffer that fit into a page and reject others. There we still need to be careful about the upper bound because the way it's written now, 'to' can be treated as exclusive and 'kvm_kaddr_to_phys(to)' would not always return the page after 'kvm_kaddr_to_phys(from)'. -David 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EEAA7C433F5 for ; Thu, 21 Oct 2021 10:08:01 +0000 (UTC) Received: from mm01.cs.columbia.edu (mm01.cs.columbia.edu [128.59.11.253]) by mail.kernel.org (Postfix) with ESMTP id 677AC610FF for ; Thu, 21 Oct 2021 10:08:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 677AC610FF Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=lists.cs.columbia.edu Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id C21534B18F; Thu, 21 Oct 2021 06:08:00 -0400 (EDT) X-Virus-Scanned: at lists.cs.columbia.edu Authentication-Results: mm01.cs.columbia.edu (amavisd-new); dkim=softfail (fail, message has been altered) header.i=@google.com Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id bnIHRni7U0pP; Thu, 21 Oct 2021 06:07:59 -0400 (EDT) Received: from mm01.cs.columbia.edu (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 5EBBE4B166; Thu, 21 Oct 2021 06:07:59 -0400 (EDT) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 1AE2F4B0F5 for ; Thu, 21 Oct 2021 06:07:58 -0400 (EDT) X-Virus-Scanned: at lists.cs.columbia.edu Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id 4lTtpNw8hK3y for ; Thu, 21 Oct 2021 06:07:53 -0400 (EDT) Received: from mail-wr1-f54.google.com (mail-wr1-f54.google.com [209.85.221.54]) by mm01.cs.columbia.edu (Postfix) with ESMTPS id 492B34B0C0 for ; Thu, 21 Oct 2021 06:07:53 -0400 (EDT) Received: by mail-wr1-f54.google.com with SMTP id r10so119692wra.12 for ; Thu, 21 Oct 2021 03:07:53 -0700 (PDT) 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=F1oNJbu4pHa0grSs6d/Ns7GwUCGiFMszmkl6//VgeII=; b=CngsNRHpP3xh6N7S6PHF34+fDeYjB5qMaxxKiYNqOUXnACoEzVHxqk0VkPKPnKHdvg hd4xZGhEWkmGTe3+vQq37jqfz+2B9jgU1f/k29IhjSEbTzNY7VEqfRaS4czCiwcWWGQH hXOGa460Fr6GCQuBFg4AjhGLfykL+N3ebKY/x9cgLPB6Ped+HppYo7wg08pEjqSiwrGp rn445z1qcoCtgA/5Sga/yWZjrpnftJ6gvgdJ62aFqCndEfK2v4R7Lp14sVp98mjJLlrY FFldqfowPeNnj06Bs88tiUuL2Aub10yszfkjfJtC0IAk+/dtVc1HWqv5Nos5Cep8XPMq FepQ== 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=F1oNJbu4pHa0grSs6d/Ns7GwUCGiFMszmkl6//VgeII=; b=bIsDN5h50cjYoU2LqpUljfTEyX28OUsbNQzLeiBvF41JGa8VOyMwRQJT/2NW3lII0a MXh+eokco1oYSijzNkmc6cmpKSlguYcSbOpwklLlij2xto4bRW68LJt4cXrG5mReqcWr NjDqHjBjy/VGoP+oEcgNjLu0qE9Qi9PHtINCYkKveDEp5qs9fjfZcR+0Ba71MCkDTcLd 8emMWE+r6pPLDy1LUB5rqex9e8F21l5XjPpTaSgREpbK4jQObJlKfDIX33ex7XTENhe5 j08UohsKtBRVyUUNzKKWNbNYISv/xFPG7/FgCCg3+PHGIK9QVg3akaqtyxZLmWpnAgky bCwA== X-Gm-Message-State: AOAM531L52NUHzEtbK1oaGMcCne6KxRwFoe4Cs+19bvQGIoMpK2T+/gM 9aHRkOhKBLzSyq6Yei5kOVK4WA== X-Google-Smtp-Source: ABdhPJx0Ugn18uahMeYKsgvnxSDyUIvip8FsoCCPzC5FJhL12HE7Bbu4dUtEydRB1ms/fxFX8qmiVQ== X-Received: by 2002:adf:a10f:: with SMTP id o15mr6411916wro.286.1634810872098; Thu, 21 Oct 2021 03:07:52 -0700 (PDT) Received: from google.com (216.131.76.34.bc.googleusercontent.com. [34.76.131.216]) by smtp.gmail.com with ESMTPSA id n12sm5422554wri.22.2021.10.21.03.07.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Oct 2021 03:07:51 -0700 (PDT) Date: Thu, 21 Oct 2021 10:07:47 +0000 From: David Brazdil To: Quentin Perret Subject: Re: [PATCH v2 07/15] KVM: arm64: Introduce kvm_share_hyp() Message-ID: References: <20211019121304.2732332-1-qperret@google.com> <20211019121304.2732332-8-qperret@google.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20211019121304.2732332-8-qperret@google.com> Cc: kernel-team@android.com, Andrew Walbran , Marc Zyngier , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Catalin Marinas , Will Deacon , kvmarm@lists.cs.columbia.edu X-BeenThere: kvmarm@lists.cs.columbia.edu X-Mailman-Version: 2.1.14 Precedence: list List-Id: Where KVM/ARM decisions are made List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: kvmarm-bounces@lists.cs.columbia.edu Sender: kvmarm-bounces@lists.cs.columbia.edu Hi Quentin, > diff --git a/arch/arm64/kvm/mmu.c b/arch/arm64/kvm/mmu.c > index 0019b2309f70..0cc4b295e525 100644 > --- a/arch/arm64/kvm/mmu.c > +++ b/arch/arm64/kvm/mmu.c > @@ -299,6 +299,17 @@ 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; > + > + if (kvm_host_owns_hyp_mappings()) > + return create_hyp_mappings(from, to, PAGE_HYP); > + > + return pkvm_share_hyp(kvm_kaddr_to_phys(from), kvm_kaddr_to_phys(to)); We should be careful about vmalloc memory here. kvm_kaddr_to_phys will happily return the physical address but the range is not guaranteed to be physically contiguous. It doesn't look like this series ever shares vmalloc memory, but we should make it harder for users of this function to shoot themselves in the foot. One option would be to turn this into a loop and call pkvm_share_hyp on each physical page. But since the hypervisor has no means of making those pages virtually contigous anyway, probably not the right approach. We could make it possible to share vmalloc buffer that fit into a page and reject others. There we still need to be careful about the upper bound because the way it's written now, 'to' can be treated as exclusive and 'kvm_kaddr_to_phys(to)' would not always return the page after 'kvm_kaddr_to_phys(from)'. -David _______________________________________________ kvmarm mailing list kvmarm@lists.cs.columbia.edu https://lists.cs.columbia.edu/mailman/listinfo/kvmarm 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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1C571C433EF for ; Thu, 21 Oct 2021 10:09:16 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id E24EF610C8 for ; Thu, 21 Oct 2021 10:09:15 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org E24EF610C8 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=lists.infradead.org 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=TxGk3JpcsBpBLtmh6rLrQ10HZM8guhZuUY663nN7XhI=; b=vUE+bc/LtlTrQo yQTRTwD6kXmp0EzQ7Y3GYcygsQI+2Q12roE+VDojogEajpHbksMYfgMYTApvb4KGlwAo6hkBwEl5L 2ENEnqiKunCpnS5afLfXciyOyn84fsUop2UUzm2AquUjULr55Yq4/4Sec42WBnBpDpePb8+ms48Ol eB5OfkPEuBalz2FGbngoW72N3E2Au3beujjq2/tPCqMvUKAUh9sXOZEx7+tUv7X3XBH42e52JlX5g ylymiOYNKZjTbLHU41sIawJhR5MUxfAyRgv1u22WFXPmjIaJBzbEKTCdXjoKnJpa7I3KpebEDqI94 Ao0fw/LRAnQ25JLfNZgA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1mdUzP-0079uj-B4; Thu, 21 Oct 2021 10:07:59 +0000 Received: from mail-wr1-x42f.google.com ([2a00:1450:4864:20::42f]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1mdUzK-0079sP-P2 for linux-arm-kernel@lists.infradead.org; Thu, 21 Oct 2021 10:07:56 +0000 Received: by mail-wr1-x42f.google.com with SMTP id m22so311463wrb.0 for ; Thu, 21 Oct 2021 03:07:53 -0700 (PDT) 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=F1oNJbu4pHa0grSs6d/Ns7GwUCGiFMszmkl6//VgeII=; b=CngsNRHpP3xh6N7S6PHF34+fDeYjB5qMaxxKiYNqOUXnACoEzVHxqk0VkPKPnKHdvg hd4xZGhEWkmGTe3+vQq37jqfz+2B9jgU1f/k29IhjSEbTzNY7VEqfRaS4czCiwcWWGQH hXOGa460Fr6GCQuBFg4AjhGLfykL+N3ebKY/x9cgLPB6Ped+HppYo7wg08pEjqSiwrGp rn445z1qcoCtgA/5Sga/yWZjrpnftJ6gvgdJ62aFqCndEfK2v4R7Lp14sVp98mjJLlrY FFldqfowPeNnj06Bs88tiUuL2Aub10yszfkjfJtC0IAk+/dtVc1HWqv5Nos5Cep8XPMq FepQ== 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=F1oNJbu4pHa0grSs6d/Ns7GwUCGiFMszmkl6//VgeII=; b=QmhC9HIcTRSi57YvjWn9kiL7ydvbw5yDBOBUKyQvozk/uyzp2hotwJBYoFJXOdqUMr VShKL+9yxrd0kD9AmUEZnaBZN6dKR4zhhS2perLy8ogSouoh+NXfv+4d6jAD62pN8f3Z NoDHwvKcoIBIiLa2LxmODuMsqjgudYxRosLLyuZptJc7F28OHemkhxX+1oyjqThI8Ma2 0r/jmMQObm/Nb6+b01l+HoVhlUVFEHdYNXwuQD0PVC0t3vu6zw4e+O3gN/WKrTvP2LDV v+IrlLBH4pVNLhexBMPW4Y8BXtxQbhmNahsoBnVKBgVmIH62rBN70tfrEu29b3U82tqb hjZw== X-Gm-Message-State: AOAM530GlNMDA+HAaCPrMgJkqRKvrerUIeiozZbJYI9jHY2xcsvChnOl JSX/BioPsydKDm2WTNqH7PAxUA== X-Google-Smtp-Source: ABdhPJx0Ugn18uahMeYKsgvnxSDyUIvip8FsoCCPzC5FJhL12HE7Bbu4dUtEydRB1ms/fxFX8qmiVQ== X-Received: by 2002:adf:a10f:: with SMTP id o15mr6411916wro.286.1634810872098; Thu, 21 Oct 2021 03:07:52 -0700 (PDT) Received: from google.com (216.131.76.34.bc.googleusercontent.com. [34.76.131.216]) by smtp.gmail.com with ESMTPSA id n12sm5422554wri.22.2021.10.21.03.07.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Oct 2021 03:07:51 -0700 (PDT) Date: Thu, 21 Oct 2021 10:07:47 +0000 From: David Brazdil To: Quentin Perret Cc: Marc Zyngier , James Morse , Alexandru Elisei , Suzuki K Poulose , Catalin Marinas , Will Deacon , Fuad Tabba , Andrew Walbran , linux-arm-kernel@lists.infradead.org, kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org, kernel-team@android.com Subject: Re: [PATCH v2 07/15] KVM: arm64: Introduce kvm_share_hyp() Message-ID: References: <20211019121304.2732332-1-qperret@google.com> <20211019121304.2732332-8-qperret@google.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20211019121304.2732332-8-qperret@google.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20211021_030754_862991_0F704653 X-CRM114-Status: GOOD ( 17.84 ) 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 Hi Quentin, > diff --git a/arch/arm64/kvm/mmu.c b/arch/arm64/kvm/mmu.c > index 0019b2309f70..0cc4b295e525 100644 > --- a/arch/arm64/kvm/mmu.c > +++ b/arch/arm64/kvm/mmu.c > @@ -299,6 +299,17 @@ 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; > + > + if (kvm_host_owns_hyp_mappings()) > + return create_hyp_mappings(from, to, PAGE_HYP); > + > + return pkvm_share_hyp(kvm_kaddr_to_phys(from), kvm_kaddr_to_phys(to)); We should be careful about vmalloc memory here. kvm_kaddr_to_phys will happily return the physical address but the range is not guaranteed to be physically contiguous. It doesn't look like this series ever shares vmalloc memory, but we should make it harder for users of this function to shoot themselves in the foot. One option would be to turn this into a loop and call pkvm_share_hyp on each physical page. But since the hypervisor has no means of making those pages virtually contigous anyway, probably not the right approach. We could make it possible to share vmalloc buffer that fit into a page and reject others. There we still need to be careful about the upper bound because the way it's written now, 'to' can be treated as exclusive and 'kvm_kaddr_to_phys(to)' would not always return the page after 'kvm_kaddr_to_phys(from)'. -David _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel