Skip to content

Commit a488e75

Browse files
author
Claudio Imbrenda
committed
KVM: s390: vsie: Fix redundant rmap entries
The address passed to the gmap rmap was not being masked. As a consequence several different (but functionally equivalent) rmap entries were being created for each shadowed table. Fix this by properly masking the address depending on the table level. Signed-off-by: Claudio Imbrenda <imbrenda@linux.ibm.com> Fixes: a2c17f9 ("KVM: s390: New gmap code") Reviewed-by: Christian Borntraeger <borntraeger@linux.ibm.com> Signed-off-by: Christian Borntraeger <borntraeger@linux.ibm.com>
1 parent 2d505c2 commit a488e75

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

arch/s390/kvm/gmap.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1025,6 +1025,7 @@ int gmap_insert_rmap(struct gmap *sg, gfn_t p_gfn, gfn_t r_gfn, int level)
10251025
int gmap_protect_rmap(struct kvm_s390_mmu_cache *mc, struct gmap *sg, gfn_t p_gfn, gfn_t r_gfn,
10261026
kvm_pfn_t pfn, int level, bool wr)
10271027
{
1028+
unsigned long bitmask;
10281029
union crste *crstep;
10291030
union pgste pgste;
10301031
union pte *ptep;
@@ -1041,8 +1042,9 @@ int gmap_protect_rmap(struct kvm_s390_mmu_cache *mc, struct gmap *sg, gfn_t p_gf
10411042
if (rc)
10421043
return rc;
10431044
if (level <= TABLE_TYPE_REGION1) {
1045+
bitmask = -1UL << (8 + 11 * level);
10441046
scoped_guard(spinlock, &sg->host_to_rmap_lock)
1045-
rc = gmap_insert_rmap(sg, p_gfn, r_gfn, level);
1047+
rc = gmap_insert_rmap(sg, p_gfn, r_gfn & bitmask, level);
10461048
}
10471049
if (rc)
10481050
return rc;

0 commit comments

Comments
 (0)