All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] KVM: arm64: Update comment of create_hyp_mappings
@ 2022-10-27  9:15 ` Wei-Lin Chang
  0 siblings, 0 replies; 12+ messages in thread
From: Wei-Lin Chang @ 2022-10-27  9:15 UTC (permalink / raw)
  To: maz
  Cc: james.morse, alexandru.elisei, suzuki.poulose, oliver.upton,
	catalin.marinas, will, linux-arm-kernel, kvmarm, kvmarm,
	linux-kernel, Wei-Lin Chang

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 <r09922117@csie.ntu.edu.tw>
---
 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.
  */
 int create_hyp_mappings(void *from, void *to, enum kvm_pgtable_prot prot)
 {
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH] KVM: arm64: Update comment of create_hyp_mappings
@ 2022-10-27  9:15 ` Wei-Lin Chang
  0 siblings, 0 replies; 12+ messages in thread
From: Wei-Lin Chang @ 2022-10-27  9:15 UTC (permalink / raw)
  To: maz
  Cc: james.morse, alexandru.elisei, suzuki.poulose, oliver.upton,
	catalin.marinas, will, linux-arm-kernel, kvmarm, kvmarm,
	linux-kernel, Wei-Lin Chang

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 <r09922117@csie.ntu.edu.tw>
---
 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.
  */
 int create_hyp_mappings(void *from, void *to, enum kvm_pgtable_prot prot)
 {
-- 
2.34.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH] KVM: arm64: Update comment of create_hyp_mappings
  2022-11-11 16:18   ` Marc Zyngier
@ 2022-11-16  9:48     ` 章瑋麟
  -1 siblings, 0 replies; 12+ messages in thread
From: 章瑋麟 @ 2022-11-16  9:48 UTC (permalink / raw)
  To: Marc Zyngier
  Cc: james.morse, alexandru.elisei, suzuki.poulose, oliver.upton,
	catalin.marinas, will, linux-arm-kernel, kvmarm, kvmarm,
	linux-kernel

On Sat, Nov 12, 2022 at 12:18 AM Marc Zyngier <maz@kernel.org> wrote:
> 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().

Yes I agree, thanks for the advice.
I'll update the patch.

Wei-Lin Chang

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] KVM: arm64: Update comment of create_hyp_mappings
@ 2022-11-16  9:48     ` 章瑋麟
  0 siblings, 0 replies; 12+ messages in thread
From: 章瑋麟 @ 2022-11-16  9:48 UTC (permalink / raw)
  To: Marc Zyngier
  Cc: james.morse, alexandru.elisei, suzuki.poulose, oliver.upton,
	catalin.marinas, will, linux-arm-kernel, kvmarm, kvmarm,
	linux-kernel

On Sat, Nov 12, 2022 at 12:18 AM Marc Zyngier <maz@kernel.org> wrote:
> 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().

Yes I agree, thanks for the advice.
I'll update the patch.

Wei-Lin Chang

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] KVM: arm64: Update comment of create_hyp_mappings
  2022-11-03  5:32 ` Wei-Lin Chang
  (?)
@ 2022-11-11 16:18   ` Marc Zyngier
  -1 siblings, 0 replies; 12+ messages in thread
From: Marc Zyngier @ 2022-11-11 16:18 UTC (permalink / raw)
  To: Wei-Lin Chang
  Cc: james.morse, alexandru.elisei, suzuki.poulose, oliver.upton,
	catalin.marinas, will, linux-arm-kernel, kvmarm, kvmarm,
	linux-kernel

On Thu, 03 Nov 2022 05:32:28 +0000,
Wei-Lin Chang <r09922117@csie.ntu.edu.tw> 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 <r09922117@csie.ntu.edu.tw>
> ---
>  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.

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH] KVM: arm64: Update comment of create_hyp_mappings
@ 2022-11-11 16:18   ` Marc Zyngier
  0 siblings, 0 replies; 12+ messages in thread
From: Marc Zyngier @ 2022-11-11 16:18 UTC (permalink / raw)
  To: Wei-Lin Chang
  Cc: will, linux-kernel, catalin.marinas, kvmarm, kvmarm, linux-arm-kernel

On Thu, 03 Nov 2022 05:32:28 +0000,
Wei-Lin Chang <r09922117@csie.ntu.edu.tw> 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 <r09922117@csie.ntu.edu.tw>
> ---
>  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

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH] KVM: arm64: Update comment of create_hyp_mappings
@ 2022-11-11 16:18   ` Marc Zyngier
  0 siblings, 0 replies; 12+ messages in thread
From: Marc Zyngier @ 2022-11-11 16:18 UTC (permalink / raw)
  To: Wei-Lin Chang
  Cc: james.morse, alexandru.elisei, suzuki.poulose, oliver.upton,
	catalin.marinas, will, linux-arm-kernel, kvmarm, kvmarm,
	linux-kernel

On Thu, 03 Nov 2022 05:32:28 +0000,
Wei-Lin Chang <r09922117@csie.ntu.edu.tw> 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 <r09922117@csie.ntu.edu.tw>
> ---
>  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

^ permalink raw reply related	[flat|nested] 12+ messages in thread

* Re: [PATCH] KVM: arm64: Update comment of create_hyp_mappings
  2022-11-03  5:32 ` Wei-Lin Chang
  (?)
@ 2022-11-03 13:07   ` Marc Zyngier
  -1 siblings, 0 replies; 12+ messages in thread
From: Marc Zyngier @ 2022-11-03 13:07 UTC (permalink / raw)
  To: Wei-Lin Chang
  Cc: will, linux-kernel, catalin.marinas, kvmarm, kvmarm, linux-arm-kernel

On Thu, 03 Nov 2022 05:32:28 +0000,
Wei-Lin Chang <r09922117@csie.ntu.edu.tw> 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 <r09922117@csie.ntu.edu.tw>
> ---
>  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.
>   */
>  int create_hyp_mappings(void *from, void *to, enum kvm_pgtable_prot prot)
>  {

What's the difference with the previous instance of this patch?

       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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] KVM: arm64: Update comment of create_hyp_mappings
@ 2022-11-03 13:07   ` Marc Zyngier
  0 siblings, 0 replies; 12+ messages in thread
From: Marc Zyngier @ 2022-11-03 13:07 UTC (permalink / raw)
  To: Wei-Lin Chang
  Cc: james.morse, alexandru.elisei, suzuki.poulose, oliver.upton,
	catalin.marinas, will, linux-arm-kernel, kvmarm, kvmarm,
	linux-kernel

On Thu, 03 Nov 2022 05:32:28 +0000,
Wei-Lin Chang <r09922117@csie.ntu.edu.tw> 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 <r09922117@csie.ntu.edu.tw>
> ---
>  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.
>   */
>  int create_hyp_mappings(void *from, void *to, enum kvm_pgtable_prot prot)
>  {

What's the difference with the previous instance of this patch?

       M.

-- 
Without deviation from the norm, progress is not possible.

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [PATCH] KVM: arm64: Update comment of create_hyp_mappings
@ 2022-11-03 13:07   ` Marc Zyngier
  0 siblings, 0 replies; 12+ messages in thread
From: Marc Zyngier @ 2022-11-03 13:07 UTC (permalink / raw)
  To: Wei-Lin Chang
  Cc: james.morse, alexandru.elisei, suzuki.poulose, oliver.upton,
	catalin.marinas, will, linux-arm-kernel, kvmarm, kvmarm,
	linux-kernel

On Thu, 03 Nov 2022 05:32:28 +0000,
Wei-Lin Chang <r09922117@csie.ntu.edu.tw> 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 <r09922117@csie.ntu.edu.tw>
> ---
>  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.
>   */
>  int create_hyp_mappings(void *from, void *to, enum kvm_pgtable_prot prot)
>  {

What's the difference with the previous instance of this patch?

       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

^ permalink raw reply	[flat|nested] 12+ messages in thread

* [PATCH] KVM: arm64: Update comment of create_hyp_mappings
@ 2022-11-03  5:32 ` Wei-Lin Chang
  0 siblings, 0 replies; 12+ messages in thread
From: Wei-Lin Chang @ 2022-11-03  5:32 UTC (permalink / raw)
  To: maz
  Cc: james.morse, alexandru.elisei, suzuki.poulose, oliver.upton,
	catalin.marinas, will, linux-arm-kernel, kvmarm, kvmarm,
	linux-kernel, Wei-Lin Chang

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 <r09922117@csie.ntu.edu.tw>
---
 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.
  */
 int create_hyp_mappings(void *from, void *to, enum kvm_pgtable_prot prot)
 {
-- 
2.34.1


^ permalink raw reply related	[flat|nested] 12+ messages in thread

* [PATCH] KVM: arm64: Update comment of create_hyp_mappings
@ 2022-11-03  5:32 ` Wei-Lin Chang
  0 siblings, 0 replies; 12+ messages in thread
From: Wei-Lin Chang @ 2022-11-03  5:32 UTC (permalink / raw)
  To: maz
  Cc: james.morse, alexandru.elisei, suzuki.poulose, oliver.upton,
	catalin.marinas, will, linux-arm-kernel, kvmarm, kvmarm,
	linux-kernel, Wei-Lin Chang

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 <r09922117@csie.ntu.edu.tw>
---
 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.
  */
 int create_hyp_mappings(void *from, void *to, enum kvm_pgtable_prot prot)
 {
-- 
2.34.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2022-11-16  9:49 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-10-27  9:15 [PATCH] KVM: arm64: Update comment of create_hyp_mappings Wei-Lin Chang
2022-10-27  9:15 ` Wei-Lin Chang
2022-11-03  5:32 Wei-Lin Chang
2022-11-03  5:32 ` Wei-Lin Chang
2022-11-03 13:07 ` Marc Zyngier
2022-11-03 13:07   ` Marc Zyngier
2022-11-03 13:07   ` Marc Zyngier
2022-11-11 16:18 ` Marc Zyngier
2022-11-11 16:18   ` Marc Zyngier
2022-11-11 16:18   ` Marc Zyngier
2022-11-16  9:48   ` 章瑋麟
2022-11-16  9:48     ` 章瑋麟

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.