Commit 0a0f25b7 authored by Marc Zyngier's avatar Marc Zyngier

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: default avatarMarc Zyngier <maz@kernel.org>
parent 4155539b
...@@ -85,7 +85,7 @@ struct kvm_s2_trans { ...@@ -85,7 +85,7 @@ struct kvm_s2_trans {
bool readable; bool readable;
int level; int level;
u32 esr; u32 esr;
u64 upper_attr; u64 desc;
}; };
static inline phys_addr_t kvm_s2_trans_output(struct kvm_s2_trans *trans) 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) ...@@ -115,7 +115,7 @@ static inline bool kvm_s2_trans_writable(struct kvm_s2_trans *trans)
static inline bool kvm_s2_trans_executable(struct kvm_s2_trans *trans) static inline bool kvm_s2_trans_executable(struct kvm_s2_trans *trans)
{ {
return !(trans->upper_attr & BIT(54)); return !(trans->desc & BIT(54));
} }
extern int kvm_walk_nested_s2(struct kvm_vcpu *vcpu, phys_addr_t gipa, extern int kvm_walk_nested_s2(struct kvm_vcpu *vcpu, phys_addr_t gipa,
......
...@@ -256,7 +256,7 @@ static int walk_nested_s2_pgd(phys_addr_t ipa, ...@@ -256,7 +256,7 @@ static int walk_nested_s2_pgd(phys_addr_t ipa,
/* Check for valid descriptor at this point */ /* Check for valid descriptor at this point */
if (!(desc & 1) || ((desc & 3) == 1 && level == 3)) { if (!(desc & 1) || ((desc & 3) == 1 && level == 3)) {
out->esr = compute_fsc(level, ESR_ELx_FSC_FAULT); out->esr = compute_fsc(level, ESR_ELx_FSC_FAULT);
out->upper_attr = desc; out->desc = desc;
return 1; return 1;
} }
...@@ -266,7 +266,7 @@ static int walk_nested_s2_pgd(phys_addr_t ipa, ...@@ -266,7 +266,7 @@ static int walk_nested_s2_pgd(phys_addr_t ipa,
if (check_output_size(wi, desc)) { if (check_output_size(wi, desc)) {
out->esr = compute_fsc(level, ESR_ELx_FSC_ADDRSZ); out->esr = compute_fsc(level, ESR_ELx_FSC_ADDRSZ);
out->upper_attr = desc; out->desc = desc;
return 1; return 1;
} }
...@@ -278,19 +278,19 @@ static int walk_nested_s2_pgd(phys_addr_t ipa, ...@@ -278,19 +278,19 @@ static int walk_nested_s2_pgd(phys_addr_t ipa,
if (level < first_block_level) { if (level < first_block_level) {
out->esr = compute_fsc(level, ESR_ELx_FSC_FAULT); out->esr = compute_fsc(level, ESR_ELx_FSC_FAULT);
out->upper_attr = desc; out->desc = desc;
return 1; return 1;
} }
if (check_output_size(wi, desc)) { if (check_output_size(wi, desc)) {
out->esr = compute_fsc(level, ESR_ELx_FSC_ADDRSZ); out->esr = compute_fsc(level, ESR_ELx_FSC_ADDRSZ);
out->upper_attr = desc; out->desc = desc;
return 1; return 1;
} }
if (!(desc & BIT(10))) { if (!(desc & BIT(10))) {
out->esr = compute_fsc(level, ESR_ELx_FSC_ACCESS); out->esr = compute_fsc(level, ESR_ELx_FSC_ACCESS);
out->upper_attr = desc; out->desc = desc;
return 1; return 1;
} }
...@@ -304,7 +304,7 @@ static int walk_nested_s2_pgd(phys_addr_t ipa, ...@@ -304,7 +304,7 @@ static int walk_nested_s2_pgd(phys_addr_t ipa,
out->readable = desc & (0b01 << 6); out->readable = desc & (0b01 << 6);
out->writable = desc & (0b10 << 6); out->writable = desc & (0b10 << 6);
out->level = level; out->level = level;
out->upper_attr = desc & GENMASK_ULL(63, 52); out->desc = desc;
return 0; return 0;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment