From: Oliver Upton <oliver.upton@linux.dev>
To: Marc Zyngier <maz@kernel.org>
Cc: kvmarm@lists.linux.dev, James Morse <james.morse@arm.com>,
Suzuki K Poulose <suzuki.poulose@arm.com>,
Zenghui Yu <yuzenghui@huawei.com>,
David Matlack <dmatlack@google.com>,
Reiji Watanabe <reijiw@google.com>,
stable@vger.kernel.org
Subject: Re: [PATCH 1/2] KVM: arm64: Infer the PA offset from IPA in stage-2 map walker
Date: Fri, 21 Apr 2023 09:35:37 +0000 [thread overview]
Message-ID: <ZEJY6Smz3A2uZ4Ne@linux.dev> (raw)
In-Reply-To: <86r0sdk2hx.wl-maz@kernel.org>
On Fri, Apr 21, 2023 at 10:28:58AM +0100, Marc Zyngier wrote:
[...]
> So my conclusion is that after these two patches, data->phys should
> never be updated, right?
Yep, that's the intention.
> Then I'd suggest an additional patch to constify a couple of things
> and make sure we don't accidentally update them. Something like the
> patch below (compile-tested only).
I'm always a fan of more idiot proofing, especially when I am said idiot
:)
> From a2eb08ce793c1cf01c79df13a619815e9d7c1d41 Mon Sep 17 00:00:00 2001
> From: Marc Zyngier <maz@kernel.org>
> Date: Fri, 21 Apr 2023 10:18:34 +0100
> Subject: [PATCH] KVM: arm64: Constify start/end/phys fields of the pgtable
> walker data
>
> As we are revamping the way the pgtable walker evaluates some of the
> data, make it clear that we rely on somew of the fields to be constant
> across the lifetime of a walk.
>
> For this, flag the start, end and pjys fields of the walk data as
typo: phys
> 'const', which will generate an error if we were to accidentally
> update these fields again.
>
> Signed-off-by: Marc Zyngier <maz@kernel.org>
Looks good.
Reviewed-by: Oliver Upton <oliver.upton@linux.dev>
Let's see if I've confused b4 into thinking I'm reviewing my own patches
:-P
> ---
> arch/arm64/kvm/hyp/pgtable.c | 8 ++++----
> 1 file changed, 4 insertions(+), 4 deletions(-)
>
> diff --git a/arch/arm64/kvm/hyp/pgtable.c b/arch/arm64/kvm/hyp/pgtable.c
> index 356a3fd5220c..5282cb9ca4cf 100644
> --- a/arch/arm64/kvm/hyp/pgtable.c
> +++ b/arch/arm64/kvm/hyp/pgtable.c
> @@ -58,9 +58,9 @@
> struct kvm_pgtable_walk_data {
> struct kvm_pgtable_walker *walker;
>
> - u64 start;
> + const u64 start;
> u64 addr;
> - u64 end;
> + const u64 end;
> };
>
> static bool kvm_phys_is_valid(u64 phys)
> @@ -352,7 +352,7 @@ int kvm_pgtable_get_leaf(struct kvm_pgtable *pgt, u64 addr,
> }
>
> struct hyp_map_data {
> - u64 phys;
> + const u64 phys;
> kvm_pte_t attr;
> };
>
> @@ -578,7 +578,7 @@ void kvm_pgtable_hyp_destroy(struct kvm_pgtable *pgt)
> }
>
> struct stage2_map_data {
> - u64 phys;
> + const u64 phys;
> kvm_pte_t attr;
> u8 owner_id;
>
> --
> 2.34.1
>
> --
> Without deviation from the norm, progress is not possible.
--
Thanks,
Oliver
next prev parent reply other threads:[~2023-04-21 9:35 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-04-21 7:16 [PATCH 0/2] KVM: arm64: Fix for mapping incorrect PA at stage-2 Oliver Upton
2023-04-21 7:16 ` [PATCH 1/2] KVM: arm64: Infer the PA offset from IPA in stage-2 map walker Oliver Upton
2023-04-21 9:28 ` Marc Zyngier
2023-04-21 9:35 ` Oliver Upton [this message]
2023-04-21 7:16 ` [PATCH 2/2] KVM: arm64: Infer PA offset from VA in hyp " Oliver Upton
2023-04-21 9:12 ` [PATCH 0/2] KVM: arm64: Fix for mapping incorrect PA at stage-2 Marc Zyngier
2023-04-21 9:29 ` Oliver Upton
2023-04-21 12:53 ` Marc Zyngier
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZEJY6Smz3A2uZ4Ne@linux.dev \
--to=oliver.upton@linux.dev \
--cc=dmatlack@google.com \
--cc=james.morse@arm.com \
--cc=kvmarm@lists.linux.dev \
--cc=maz@kernel.org \
--cc=reijiw@google.com \
--cc=stable@vger.kernel.org \
--cc=suzuki.poulose@arm.com \
--cc=yuzenghui@huawei.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.