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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9BCD2C433FE for ; Fri, 11 Nov 2022 16:18:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234026AbiKKQSn (ORCPT ); Fri, 11 Nov 2022 11:18:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49490 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233225AbiKKQSj (ORCPT ); Fri, 11 Nov 2022 11:18:39 -0500 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8015D60367 for ; Fri, 11 Nov 2022 08:18:38 -0800 (PST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 1DE7C62033 for ; Fri, 11 Nov 2022 16:18:38 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 69024C433C1; Fri, 11 Nov 2022 16:18:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668183517; bh=L89Hr+ljyUENcI1eClc4CbdoM3pzCEgsZLVHlK+QCJ4=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=ktuZEblksZhWVaABUiHCcOEo0f0h0MmDm6XRF3Bu6SWpQfUiUAhpihuCg3ngwlbkx I1G8NQ+ebW81YPSbxSrViTYRW8vFz+mx9bZ4amd2BHqQ8rwxxy6o2RjScATofAWeh3 QHuDRvQ/hfBQo5pjpw9QCzRLpM7wryopfMssfmwWOR3aUqBWMeYRmTeUx2KmMKMdhn aYsomSOopKcgzjINmNs/FneA5mhU+0fW0kQpytbUvDiLU+1GZ80l1ZO2nZeCdzifwy fXeOTQT1RlBc3JRP66cs8mIfRT/gEmuCnWnA+hqPPzYerLmxkRDNUhu2IMwNRhhthh sup2Mj+oCOb8g== Received: from sofa.misterjones.org ([185.219.108.64] helo=goblin-girl.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1otWjj-005T44-1a; Fri, 11 Nov 2022 16:18:35 +0000 Date: Fri, 11 Nov 2022 16:18:34 +0000 Message-ID: <86fseppiqt.wl-maz@kernel.org> From: Marc Zyngier To: Wei-Lin Chang Cc: james.morse@arm.com, alexandru.elisei@arm.com, suzuki.poulose@arm.com, oliver.upton@linux.dev, catalin.marinas@arm.com, will@kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org Subject: Re: [PATCH] KVM: arm64: Update comment of create_hyp_mappings In-Reply-To: <20221103053228.961591-1-r09922117@csie.ntu.edu.tw> References: <20221103053228.961591-1-r09922117@csie.ntu.edu.tw> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/27.1 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: r09922117@csie.ntu.edu.tw, james.morse@arm.com, alexandru.elisei@arm.com, suzuki.poulose@arm.com, oliver.upton@linux.dev, catalin.marinas@arm.com, will@kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 03 Nov 2022 05:32:28 +0000, Wei-Lin Chang wrote: > > HYP_PAGE_OFFSET is removed since 4.8, and the method for generating Hyp > VAs has evolved. Update the functional description of > create_hyp_mappings accordingly. > > Signed-off-by: Wei-Lin Chang > --- > arch/arm64/kvm/mmu.c | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) > > diff --git a/arch/arm64/kvm/mmu.c b/arch/arm64/kvm/mmu.c > index c9a13e487..a9ae4a3f9 100644 > --- a/arch/arm64/kvm/mmu.c > +++ b/arch/arm64/kvm/mmu.c > @@ -424,9 +424,10 @@ void kvm_unshare_hyp(void *from, void *to) > * @to: The virtual kernel end address of the range (exclusive) > * @prot: The protection to be applied to this range > * > - * The same virtual address as the kernel virtual address is also used > - * in Hyp-mode mapping (modulo HYP_PAGE_OFFSET) to the same underlying > - * physical pages. > + * The Hyp virtual address is generated by masking the kernel VA with > + * va_mask then inserting tag_val for the higher bits starting from > + * tag_lsb. See kvm_compute_layout() in va_layout.c for more info. > + * Both Hyp VA and kernel VA ranges map to the same underlying physical pages. My problem with this comment is that neither va_mask, tag_val, nor tag_lsb mean anything in this context. All this is purely internal to kvm_compute_layout(), and is unnecessary here. I'd rather you have something along the lines of: diff --git a/arch/arm64/kvm/mmu.c b/arch/arm64/kvm/mmu.c index 60ee3d9f01f8..6d04818a1a5b 100644 --- a/arch/arm64/kvm/mmu.c +++ b/arch/arm64/kvm/mmu.c @@ -460,7 +460,7 @@ void kvm_unshare_hyp(void *from, void *to) * @prot: The protection to be applied to this range * * The same virtual address as the kernel virtual address is also used - * in Hyp-mode mapping (modulo HYP_PAGE_OFFSET) to the same underlying + * in Hyp-mode mapping (modulo a random offset) to the same underlying * physical pages. */ int create_hyp_mappings(void *from, void *to, enum kvm_pgtable_prot prot) Whoever is interested in understanding the generation of the offset can follow kern_hyp_va(). Thanks, M. -- Without deviation from the norm, progress is not possible. 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 mm01.cs.columbia.edu (mm01.cs.columbia.edu [128.59.11.253]) by smtp.lore.kernel.org (Postfix) with ESMTP id 46925C4332F for ; Fri, 11 Nov 2022 16:18:47 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 8CA264B8ED; Fri, 11 Nov 2022 11:18:46 -0500 (EST) 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=@kernel.org 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 pcor-S6E3ggX; Fri, 11 Nov 2022 11:18:45 -0500 (EST) Received: from mm01.cs.columbia.edu (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 59A044B830; Fri, 11 Nov 2022 11:18:45 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 3297A4B81C for ; Fri, 11 Nov 2022 11:18:44 -0500 (EST) 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 UVStPvYV8qZO for ; Fri, 11 Nov 2022 11:18:43 -0500 (EST) Received: from sin.source.kernel.org (sin.source.kernel.org [145.40.73.55]) by mm01.cs.columbia.edu (Postfix) with ESMTPS id 93CCB4B783 for ; Fri, 11 Nov 2022 11:18:42 -0500 (EST) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 4BE53CE2843; Fri, 11 Nov 2022 16:18:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 69024C433C1; Fri, 11 Nov 2022 16:18:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668183517; bh=L89Hr+ljyUENcI1eClc4CbdoM3pzCEgsZLVHlK+QCJ4=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=ktuZEblksZhWVaABUiHCcOEo0f0h0MmDm6XRF3Bu6SWpQfUiUAhpihuCg3ngwlbkx I1G8NQ+ebW81YPSbxSrViTYRW8vFz+mx9bZ4amd2BHqQ8rwxxy6o2RjScATofAWeh3 QHuDRvQ/hfBQo5pjpw9QCzRLpM7wryopfMssfmwWOR3aUqBWMeYRmTeUx2KmMKMdhn aYsomSOopKcgzjINmNs/FneA5mhU+0fW0kQpytbUvDiLU+1GZ80l1ZO2nZeCdzifwy fXeOTQT1RlBc3JRP66cs8mIfRT/gEmuCnWnA+hqPPzYerLmxkRDNUhu2IMwNRhhthh sup2Mj+oCOb8g== Received: from sofa.misterjones.org ([185.219.108.64] helo=goblin-girl.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1otWjj-005T44-1a; Fri, 11 Nov 2022 16:18:35 +0000 Date: Fri, 11 Nov 2022 16:18:34 +0000 Message-ID: <86fseppiqt.wl-maz@kernel.org> From: Marc Zyngier To: Wei-Lin Chang Subject: Re: [PATCH] KVM: arm64: Update comment of create_hyp_mappings In-Reply-To: <20221103053228.961591-1-r09922117@csie.ntu.edu.tw> References: <20221103053228.961591-1-r09922117@csie.ntu.edu.tw> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/27.1 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: r09922117@csie.ntu.edu.tw, james.morse@arm.com, alexandru.elisei@arm.com, suzuki.poulose@arm.com, oliver.upton@linux.dev, catalin.marinas@arm.com, will@kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Cc: will@kernel.org, linux-kernel@vger.kernel.org, catalin.marinas@arm.com, kvmarm@lists.linux.dev, kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org 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 On Thu, 03 Nov 2022 05:32:28 +0000, Wei-Lin Chang wrote: > > HYP_PAGE_OFFSET is removed since 4.8, and the method for generating Hyp > VAs has evolved. Update the functional description of > create_hyp_mappings accordingly. > > Signed-off-by: Wei-Lin Chang > --- > arch/arm64/kvm/mmu.c | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) > > diff --git a/arch/arm64/kvm/mmu.c b/arch/arm64/kvm/mmu.c > index c9a13e487..a9ae4a3f9 100644 > --- a/arch/arm64/kvm/mmu.c > +++ b/arch/arm64/kvm/mmu.c > @@ -424,9 +424,10 @@ void kvm_unshare_hyp(void *from, void *to) > * @to: The virtual kernel end address of the range (exclusive) > * @prot: The protection to be applied to this range > * > - * The same virtual address as the kernel virtual address is also used > - * in Hyp-mode mapping (modulo HYP_PAGE_OFFSET) to the same underlying > - * physical pages. > + * The Hyp virtual address is generated by masking the kernel VA with > + * va_mask then inserting tag_val for the higher bits starting from > + * tag_lsb. See kvm_compute_layout() in va_layout.c for more info. > + * Both Hyp VA and kernel VA ranges map to the same underlying physical pages. My problem with this comment is that neither va_mask, tag_val, nor tag_lsb mean anything in this context. All this is purely internal to kvm_compute_layout(), and is unnecessary here. I'd rather you have something along the lines of: diff --git a/arch/arm64/kvm/mmu.c b/arch/arm64/kvm/mmu.c index 60ee3d9f01f8..6d04818a1a5b 100644 --- a/arch/arm64/kvm/mmu.c +++ b/arch/arm64/kvm/mmu.c @@ -460,7 +460,7 @@ void kvm_unshare_hyp(void *from, void *to) * @prot: The protection to be applied to this range * * The same virtual address as the kernel virtual address is also used - * in Hyp-mode mapping (modulo HYP_PAGE_OFFSET) to the same underlying + * in Hyp-mode mapping (modulo a random offset) to the same underlying * physical pages. */ int create_hyp_mappings(void *from, void *to, enum kvm_pgtable_prot prot) Whoever is interested in understanding the generation of the offset can follow kern_hyp_va(). Thanks, M. -- Without deviation from the norm, progress is not possible. _______________________________________________ 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 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 D1249C4332F for ; Fri, 11 Nov 2022 16:19:51 +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:MIME-Version:References:In-Reply-To: Subject:Cc:To:From:Message-ID:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=12qClb5tB/wXOkTZ7RWrgmKmYCa/udjf7vzPghEa1uo=; b=I/NfrVzbbhkew/ yPV6+Zu0ILSlRIe4C7/e4f6co9O3bAKQertWCpNYcS+jgbKD21UNrKSQqNBGtQ33HUSwOx7bHoFLD sRUPt0IqImZNV7oy2WdMxWCcu3YnOqFWr7QP58jaHHQL1yXXZdtR5YyPtqGPQV2vWprdU5d2d/Yua 0u+CLsieMDmmB72Mwrw1wRFauDqkJup6NVEvjqXL9kkdrKSkaeoVApqjUxYlKfJ0QTj4rihpT9/ZK A+3b9TRuPsUvtaGToKSiAmWPVyYfEXqKeI93vN0ydKeJXYXTflyP26Sf7NSp9oSTPjlkhLvyj1HgM a//0SaJMp240JeFLTMWw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1otWjs-00GrUS-Og; Fri, 11 Nov 2022 16:18:44 +0000 Received: from sin.source.kernel.org ([145.40.73.55]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1otWjp-00GrSx-HX for linux-arm-kernel@lists.infradead.org; Fri, 11 Nov 2022 16:18:43 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sin.source.kernel.org (Postfix) with ESMTPS id 4BE53CE2843; Fri, 11 Nov 2022 16:18:39 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 69024C433C1; Fri, 11 Nov 2022 16:18:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1668183517; bh=L89Hr+ljyUENcI1eClc4CbdoM3pzCEgsZLVHlK+QCJ4=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=ktuZEblksZhWVaABUiHCcOEo0f0h0MmDm6XRF3Bu6SWpQfUiUAhpihuCg3ngwlbkx I1G8NQ+ebW81YPSbxSrViTYRW8vFz+mx9bZ4amd2BHqQ8rwxxy6o2RjScATofAWeh3 QHuDRvQ/hfBQo5pjpw9QCzRLpM7wryopfMssfmwWOR3aUqBWMeYRmTeUx2KmMKMdhn aYsomSOopKcgzjINmNs/FneA5mhU+0fW0kQpytbUvDiLU+1GZ80l1ZO2nZeCdzifwy fXeOTQT1RlBc3JRP66cs8mIfRT/gEmuCnWnA+hqPPzYerLmxkRDNUhu2IMwNRhhthh sup2Mj+oCOb8g== Received: from sofa.misterjones.org ([185.219.108.64] helo=goblin-girl.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.95) (envelope-from ) id 1otWjj-005T44-1a; Fri, 11 Nov 2022 16:18:35 +0000 Date: Fri, 11 Nov 2022 16:18:34 +0000 Message-ID: <86fseppiqt.wl-maz@kernel.org> From: Marc Zyngier To: Wei-Lin Chang Cc: james.morse@arm.com, alexandru.elisei@arm.com, suzuki.poulose@arm.com, oliver.upton@linux.dev, catalin.marinas@arm.com, will@kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org Subject: Re: [PATCH] KVM: arm64: Update comment of create_hyp_mappings In-Reply-To: <20221103053228.961591-1-r09922117@csie.ntu.edu.tw> References: <20221103053228.961591-1-r09922117@csie.ntu.edu.tw> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 EasyPG/1.0.0 Emacs/27.1 (aarch64-unknown-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") X-SA-Exim-Connect-IP: 185.219.108.64 X-SA-Exim-Rcpt-To: r09922117@csie.ntu.edu.tw, james.morse@arm.com, alexandru.elisei@arm.com, suzuki.poulose@arm.com, oliver.upton@linux.dev, catalin.marinas@arm.com, will@kernel.org, linux-arm-kernel@lists.infradead.org, kvmarm@lists.linux.dev, kvmarm@lists.cs.columbia.edu, linux-kernel@vger.kernel.org X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221111_081841_977091_544DBB00 X-CRM114-Status: GOOD ( 24.96 ) 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 Thu, 03 Nov 2022 05:32:28 +0000, Wei-Lin Chang wrote: > > HYP_PAGE_OFFSET is removed since 4.8, and the method for generating Hyp > VAs has evolved. Update the functional description of > create_hyp_mappings accordingly. > > Signed-off-by: Wei-Lin Chang > --- > arch/arm64/kvm/mmu.c | 7 ++++--- > 1 file changed, 4 insertions(+), 3 deletions(-) > > diff --git a/arch/arm64/kvm/mmu.c b/arch/arm64/kvm/mmu.c > index c9a13e487..a9ae4a3f9 100644 > --- a/arch/arm64/kvm/mmu.c > +++ b/arch/arm64/kvm/mmu.c > @@ -424,9 +424,10 @@ void kvm_unshare_hyp(void *from, void *to) > * @to: The virtual kernel end address of the range (exclusive) > * @prot: The protection to be applied to this range > * > - * The same virtual address as the kernel virtual address is also used > - * in Hyp-mode mapping (modulo HYP_PAGE_OFFSET) to the same underlying > - * physical pages. > + * The Hyp virtual address is generated by masking the kernel VA with > + * va_mask then inserting tag_val for the higher bits starting from > + * tag_lsb. See kvm_compute_layout() in va_layout.c for more info. > + * Both Hyp VA and kernel VA ranges map to the same underlying physical pages. My problem with this comment is that neither va_mask, tag_val, nor tag_lsb mean anything in this context. All this is purely internal to kvm_compute_layout(), and is unnecessary here. I'd rather you have something along the lines of: diff --git a/arch/arm64/kvm/mmu.c b/arch/arm64/kvm/mmu.c index 60ee3d9f01f8..6d04818a1a5b 100644 --- a/arch/arm64/kvm/mmu.c +++ b/arch/arm64/kvm/mmu.c @@ -460,7 +460,7 @@ void kvm_unshare_hyp(void *from, void *to) * @prot: The protection to be applied to this range * * The same virtual address as the kernel virtual address is also used - * in Hyp-mode mapping (modulo HYP_PAGE_OFFSET) to the same underlying + * in Hyp-mode mapping (modulo a random offset) to the same underlying * physical pages. */ int create_hyp_mappings(void *from, void *to, enum kvm_pgtable_prot prot) Whoever is interested in understanding the generation of the offset can follow kern_hyp_va(). Thanks, M. -- Without deviation from the norm, progress is not possible. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel