Skip to content

Commit 1ea2441

Browse files
author
Marc Zyngier
committed
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 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>
1 parent 39bc95b commit 1ea2441

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

arch/arm64/kvm/hyp/pgtable.c

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,9 +58,9 @@
5858
struct kvm_pgtable_walk_data {
5959
struct kvm_pgtable_walker *walker;
6060

61-
u64 start;
61+
const u64 start;
6262
u64 addr;
63-
u64 end;
63+
const u64 end;
6464
};
6565

6666
static bool kvm_phys_is_valid(u64 phys)
@@ -352,7 +352,7 @@ int kvm_pgtable_get_leaf(struct kvm_pgtable *pgt, u64 addr,
352352
}
353353

354354
struct hyp_map_data {
355-
u64 phys;
355+
const u64 phys;
356356
kvm_pte_t attr;
357357
};
358358

@@ -578,7 +578,7 @@ void kvm_pgtable_hyp_destroy(struct kvm_pgtable *pgt)
578578
}
579579

580580
struct stage2_map_data {
581-
u64 phys;
581+
const u64 phys;
582582
kvm_pte_t attr;
583583
u8 owner_id;
584584

0 commit comments

Comments
 (0)