Skip to content

Commit 0a0f25b

Browse files
author
Marc Zyngier
committed
KVM: arm64: nv: Turn upper_attr for S2 walk into the full descriptor
The upper_attr attribute has been badly named, as it most of the time carries the full "last walked descriptor". Rename it to "desc" and make ti contain the full 64bit descriptor. This will be used by the S1 PTW. Signed-off-by: Marc Zyngier <maz@kernel.org>
1 parent 4155539 commit 0a0f25b

2 files changed

Lines changed: 8 additions & 8 deletions

File tree

arch/arm64/include/asm/kvm_nested.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@ struct kvm_s2_trans {
8585
bool readable;
8686
int level;
8787
u32 esr;
88-
u64 upper_attr;
88+
u64 desc;
8989
};
9090

9191
static inline phys_addr_t kvm_s2_trans_output(struct kvm_s2_trans *trans)
@@ -115,7 +115,7 @@ static inline bool kvm_s2_trans_writable(struct kvm_s2_trans *trans)
115115

116116
static inline bool kvm_s2_trans_executable(struct kvm_s2_trans *trans)
117117
{
118-
return !(trans->upper_attr & BIT(54));
118+
return !(trans->desc & BIT(54));
119119
}
120120

121121
extern int kvm_walk_nested_s2(struct kvm_vcpu *vcpu, phys_addr_t gipa,

arch/arm64/kvm/nested.c

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -256,7 +256,7 @@ static int walk_nested_s2_pgd(phys_addr_t ipa,
256256
/* Check for valid descriptor at this point */
257257
if (!(desc & 1) || ((desc & 3) == 1 && level == 3)) {
258258
out->esr = compute_fsc(level, ESR_ELx_FSC_FAULT);
259-
out->upper_attr = desc;
259+
out->desc = desc;
260260
return 1;
261261
}
262262

@@ -266,7 +266,7 @@ static int walk_nested_s2_pgd(phys_addr_t ipa,
266266

267267
if (check_output_size(wi, desc)) {
268268
out->esr = compute_fsc(level, ESR_ELx_FSC_ADDRSZ);
269-
out->upper_attr = desc;
269+
out->desc = desc;
270270
return 1;
271271
}
272272

@@ -278,19 +278,19 @@ static int walk_nested_s2_pgd(phys_addr_t ipa,
278278

279279
if (level < first_block_level) {
280280
out->esr = compute_fsc(level, ESR_ELx_FSC_FAULT);
281-
out->upper_attr = desc;
281+
out->desc = desc;
282282
return 1;
283283
}
284284

285285
if (check_output_size(wi, desc)) {
286286
out->esr = compute_fsc(level, ESR_ELx_FSC_ADDRSZ);
287-
out->upper_attr = desc;
287+
out->desc = desc;
288288
return 1;
289289
}
290290

291291
if (!(desc & BIT(10))) {
292292
out->esr = compute_fsc(level, ESR_ELx_FSC_ACCESS);
293-
out->upper_attr = desc;
293+
out->desc = desc;
294294
return 1;
295295
}
296296

@@ -304,7 +304,7 @@ static int walk_nested_s2_pgd(phys_addr_t ipa,
304304
out->readable = desc & (0b01 << 6);
305305
out->writable = desc & (0b10 << 6);
306306
out->level = level;
307-
out->upper_attr = desc & GENMASK_ULL(63, 52);
307+
out->desc = desc;
308308
return 0;
309309
}
310310

0 commit comments

Comments
 (0)