Skip to content

Commit 97ca7bf

Browse files
borntraegerMartin Schwidefsky
authored andcommitted
s390/mm: set change and reference bit on lazy key enablement
When we enable storage keys for a guest lazily, we reset the ACC and F values. That is correct assuming that these are 0 on a clear reset and the guest obviously has not used any key setting instruction. We also zero out the change and reference bit. This is not correct as the architecture prefers over-indication instead of under-indication for the keyless->keyed transition. This patch fixes the behaviour and always sets guest change and guest reference for all guest storage keys on the keyless -> keyed switch. Signed-off-by: Christian Borntraeger <[email protected]> Reviewed-by: Claudio Imbrenda <[email protected]> Signed-off-by: Martin Schwidefsky <[email protected]>
1 parent 2daace7 commit 97ca7bf

File tree

1 file changed

+3
-3
lines changed

1 file changed

+3
-3
lines changed

arch/s390/mm/pgtable.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -591,11 +591,11 @@ void ptep_zap_key(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
591591
unsigned long ptev;
592592
pgste_t pgste;
593593

594-
/* Clear storage key */
594+
/* Clear storage key ACC and F, but set R/C */
595595
preempt_disable();
596596
pgste = pgste_get_lock(ptep);
597-
pgste_val(pgste) &= ~(PGSTE_ACC_BITS | PGSTE_FP_BIT |
598-
PGSTE_GR_BIT | PGSTE_GC_BIT);
597+
pgste_val(pgste) &= ~(PGSTE_ACC_BITS | PGSTE_FP_BIT);
598+
pgste_val(pgste) |= PGSTE_GR_BIT | PGSTE_GC_BIT;
599599
ptev = pte_val(*ptep);
600600
if (!(ptev & _PAGE_INVALID) && (ptev & _PAGE_WRITE))
601601
page_set_storage_key(ptev & PAGE_MASK, PAGE_DEFAULT_KEY, 1);

0 commit comments

Comments
 (0)