diff options
author | David Hildenbrand <dahi@linux.vnet.ibm.com> | 2016-05-09 05:15:32 -0400 |
---|---|---|
committer | Christian Borntraeger <borntraeger@de.ibm.com> | 2016-06-10 06:07:27 -0400 |
commit | 8d6037a7b4f21708451d4aec14828f9ebe77b37a (patch) | |
tree | 1e8a6e953c0485c6c88cc3676ba69e9256ae6244 /arch/s390/mm | |
parent | d3ed1ceeace311af9973d17a07a114bfaf0ca1b1 (diff) |
s390/mm: simplify get_guest_storage_key
We can safe a few LOC and make that function easier to understand
by rewriting existing code.
Reviewed-by: Christian Borntraeger <borntraeger@de.ibm.com>
Signed-off-by: David Hildenbrand <dahi@linux.vnet.ibm.com>
Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com>
Diffstat (limited to 'arch/s390/mm')
-rw-r--r-- | arch/s390/mm/pgtable.c | 17 |
1 files changed, 4 insertions, 13 deletions
diff --git a/arch/s390/mm/pgtable.c b/arch/s390/mm/pgtable.c index 7612a7c3a3a8..4c8d572d59cc 100644 --- a/arch/s390/mm/pgtable.c +++ b/arch/s390/mm/pgtable.c | |||
@@ -551,20 +551,11 @@ unsigned long get_guest_storage_key(struct mm_struct *mm, unsigned long addr) | |||
551 | return -EFAULT; | 551 | return -EFAULT; |
552 | 552 | ||
553 | pgste = pgste_get_lock(ptep); | 553 | pgste = pgste_get_lock(ptep); |
554 | if (pte_val(*ptep) & _PAGE_INVALID) { | 554 | key = (pgste_val(pgste) & (PGSTE_ACC_BITS | PGSTE_FP_BIT)) >> 56; |
555 | key = (pgste_val(pgste) & PGSTE_ACC_BITS) >> 56; | 555 | if (!(pte_val(*ptep) & _PAGE_INVALID)) |
556 | key |= (pgste_val(pgste) & PGSTE_FP_BIT) >> 56; | ||
557 | key |= (pgste_val(pgste) & PGSTE_GR_BIT) >> 48; | ||
558 | key |= (pgste_val(pgste) & PGSTE_GC_BIT) >> 48; | ||
559 | } else { | ||
560 | key = page_get_storage_key(pte_val(*ptep) & PAGE_MASK); | 556 | key = page_get_storage_key(pte_val(*ptep) & PAGE_MASK); |
561 | 557 | /* Reflect guest's logical view, not physical */ | |
562 | /* Reflect guest's logical view, not physical */ | 558 | key |= (pgste_val(pgste) & (PGSTE_GR_BIT | PGSTE_GC_BIT)) >> 48; |
563 | if (pgste_val(pgste) & PGSTE_GR_BIT) | ||
564 | key |= _PAGE_REFERENCED; | ||
565 | if (pgste_val(pgste) & PGSTE_GC_BIT) | ||
566 | key |= _PAGE_CHANGED; | ||
567 | } | ||
568 | pgste_set_unlock(ptep, pgste); | 559 | pgste_set_unlock(ptep, pgste); |
569 | pte_unmap_unlock(ptep, ptl); | 560 | pte_unmap_unlock(ptep, ptl); |
570 | return key; | 561 | return key; |