Skip to content

Commit 6fc3a49

Browse files
Marc Zyngieroupton
authored andcommitted
KVM: arm64: Fix S1/S2 combination when FWB==1 and S2 has Device memory type
The G.a revision of the ARM ARM had it pretty clear that HCR_EL2.FWB had no influence on "The way that stage 1 memory types and attributes are combined with stage 2 Device type and attributes." (D5.5.5). However, this wording was lost in further revisions of the architecture. Restore the intended behaviour, which is to take the strongest memory type of S1 and S2 in this case, as if FWB was 0. The specification is being fixed accordingly. Fixes: be04ceb ("KVM: arm64: nv: Add emulation of AT S12E{0,1}{R,W}") Signed-off-by: Marc Zyngier <maz@kernel.org> Link: https://lore.kernel.org/r/20241125094756.609590-1-maz@kernel.org Signed-off-by: Oliver Upton <oliver.upton@linux.dev>
1 parent d798bc6 commit 6fc3a49

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

arch/arm64/kvm/at.c

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -739,8 +739,15 @@ static u64 compute_par_s12(struct kvm_vcpu *vcpu, u64 s1_par,
739739
final_attr = s1_parattr;
740740
break;
741741
default:
742-
/* MemAttr[2]=0, Device from S2 */
743-
final_attr = s2_memattr & GENMASK(1,0) << 2;
742+
/*
743+
* MemAttr[2]=0, Device from S2.
744+
*
745+
* FWB does not influence the way that stage 1
746+
* memory types and attributes are combined
747+
* with stage 2 Device type and attributes.
748+
*/
749+
final_attr = min(s2_memattr_to_attr(s2_memattr),
750+
s1_parattr);
744751
}
745752
} else {
746753
/* Combination of R_HMNDG, R_TNHFM and R_GQFSF */

0 commit comments

Comments
 (0)