Skip to content

Commit

Permalink
KVM: arm64: Constify start/end/phys fields of the pgtable walker data
Browse files Browse the repository at this point in the history
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 phys fields of the walk data as
'const', which will generate an error if we were to accidentally
update these fields again.

Reviewed-by: Oliver Upton <oliver.upton@linux.dev>
Signed-off-by: Marc Zyngier <maz@kernel.org>
  • Loading branch information
Marc Zyngier committed Apr 21, 2023
1 parent 39bc95b commit 1ea2441
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions arch/arm64/kvm/hyp/pgtable.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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;
};

Expand Down Expand Up @@ -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;

Expand Down

0 comments on commit 1ea2441

Please sign in to comment.