aboutsummaryrefslogtreecommitdiffstats
path: root/arch/s390/include/asm/pgtable.h
diff options
context:
space:
mode:
authorMartin Schwidefsky <schwidefsky@de.ibm.com>2013-05-17 08:41:33 -0400
committerGleb Natapov <gleb@redhat.com>2013-05-21 04:55:20 -0400
commit0d0dafc1e48fd254c22f75738def870a7ffd2c3e (patch)
tree8825dc5fe79f6958e198f10f439159d2410217e2 /arch/s390/include/asm/pgtable.h
parentdfcf7dc64237dbe1acc2147ad3552f793003874b (diff)
s390/kvm: rename RCP_xxx defines to PGSTE_xxx
The RCP byte is a part of the PGSTE value, the existing RCP_xxx names are inaccurate. As the defines describe bits and pieces of the PGSTE, the names should start with PGSTE_. The KVM_UR_BIT and KVM_UC_BIT are part of the PGSTE as well, give them better names as well. Signed-off-by: Martin Schwidefsky <schwidefsky@de.ibm.com> Signed-off-by: Christian Borntraeger <borntraeger@de.ibm.com> Signed-off-by: Gleb Natapov <gleb@redhat.com>
Diffstat (limited to 'arch/s390/include/asm/pgtable.h')
-rw-r--r--arch/s390/include/asm/pgtable.h82
1 files changed, 39 insertions, 43 deletions
diff --git a/arch/s390/include/asm/pgtable.h b/arch/s390/include/asm/pgtable.h
index 0f0de30e3e3f..1fc68d97be9d 100644
--- a/arch/s390/include/asm/pgtable.h
+++ b/arch/s390/include/asm/pgtable.h
@@ -299,18 +299,16 @@ extern unsigned long MODULES_END;
299#define _SEGMENT_ENTRY_EMPTY (_SEGMENT_ENTRY_INV) 299#define _SEGMENT_ENTRY_EMPTY (_SEGMENT_ENTRY_INV)
300 300
301/* Page status table bits for virtualization */ 301/* Page status table bits for virtualization */
302#define RCP_ACC_BITS 0xf0000000UL 302#define PGSTE_ACC_BITS 0xf0000000UL
303#define RCP_FP_BIT 0x08000000UL 303#define PGSTE_FP_BIT 0x08000000UL
304#define RCP_PCL_BIT 0x00800000UL 304#define PGSTE_PCL_BIT 0x00800000UL
305#define RCP_HR_BIT 0x00400000UL 305#define PGSTE_HR_BIT 0x00400000UL
306#define RCP_HC_BIT 0x00200000UL 306#define PGSTE_HC_BIT 0x00200000UL
307#define RCP_GR_BIT 0x00040000UL 307#define PGSTE_GR_BIT 0x00040000UL
308#define RCP_GC_BIT 0x00020000UL 308#define PGSTE_GC_BIT 0x00020000UL
309#define RCP_IN_BIT 0x00002000UL /* IPTE notify bit */ 309#define PGSTE_UR_BIT 0x00008000UL
310 310#define PGSTE_UC_BIT 0x00004000UL /* user dirty (migration) */
311/* User dirty / referenced bit for KVM's migration feature */ 311#define PGSTE_IN_BIT 0x00002000UL /* IPTE notify bit */
312#define KVM_UR_BIT 0x00008000UL
313#define KVM_UC_BIT 0x00004000UL
314 312
315#else /* CONFIG_64BIT */ 313#else /* CONFIG_64BIT */
316 314
@@ -367,18 +365,16 @@ extern unsigned long MODULES_END;
367 | _SEGMENT_ENTRY_SPLIT | _SEGMENT_ENTRY_CO) 365 | _SEGMENT_ENTRY_SPLIT | _SEGMENT_ENTRY_CO)
368 366
369/* Page status table bits for virtualization */ 367/* Page status table bits for virtualization */
370#define RCP_ACC_BITS 0xf000000000000000UL 368#define PGSTE_ACC_BITS 0xf000000000000000UL
371#define RCP_FP_BIT 0x0800000000000000UL 369#define PGSTE_FP_BIT 0x0800000000000000UL
372#define RCP_PCL_BIT 0x0080000000000000UL 370#define PGSTE_PCL_BIT 0x0080000000000000UL
373#define RCP_HR_BIT 0x0040000000000000UL 371#define PGSTE_HR_BIT 0x0040000000000000UL
374#define RCP_HC_BIT 0x0020000000000000UL 372#define PGSTE_HC_BIT 0x0020000000000000UL
375#define RCP_GR_BIT 0x0004000000000000UL 373#define PGSTE_GR_BIT 0x0004000000000000UL
376#define RCP_GC_BIT 0x0002000000000000UL 374#define PGSTE_GC_BIT 0x0002000000000000UL
377#define RCP_IN_BIT 0x0000200000000000UL /* IPTE notify bit */ 375#define PGSTE_UR_BIT 0x0000800000000000UL
378 376#define PGSTE_UC_BIT 0x0000400000000000UL /* user dirty (migration) */
379/* User dirty / referenced bit for KVM's migration feature */ 377#define PGSTE_IN_BIT 0x0000200000000000UL /* IPTE notify bit */
380#define KVM_UR_BIT 0x0000800000000000UL
381#define KVM_UC_BIT 0x0000400000000000UL
382 378
383#endif /* CONFIG_64BIT */ 379#endif /* CONFIG_64BIT */
384 380
@@ -618,8 +614,8 @@ static inline pgste_t pgste_get_lock(pte_t *ptep)
618 asm( 614 asm(
619 " lg %0,%2\n" 615 " lg %0,%2\n"
620 "0: lgr %1,%0\n" 616 "0: lgr %1,%0\n"
621 " nihh %0,0xff7f\n" /* clear RCP_PCL_BIT in old */ 617 " nihh %0,0xff7f\n" /* clear PCL bit in old */
622 " oihh %1,0x0080\n" /* set RCP_PCL_BIT in new */ 618 " oihh %1,0x0080\n" /* set PCL bit in new */
623 " csg %0,%1,%2\n" 619 " csg %0,%1,%2\n"
624 " jl 0b\n" 620 " jl 0b\n"
625 : "=&d" (old), "=&d" (new), "=Q" (ptep[PTRS_PER_PTE]) 621 : "=&d" (old), "=&d" (new), "=Q" (ptep[PTRS_PER_PTE])
@@ -632,7 +628,7 @@ static inline void pgste_set_unlock(pte_t *ptep, pgste_t pgste)
632{ 628{
633#ifdef CONFIG_PGSTE 629#ifdef CONFIG_PGSTE
634 asm( 630 asm(
635 " nihh %1,0xff7f\n" /* clear RCP_PCL_BIT */ 631 " nihh %1,0xff7f\n" /* clear PCL bit */
636 " stg %1,%0\n" 632 " stg %1,%0\n"
637 : "=Q" (ptep[PTRS_PER_PTE]) 633 : "=Q" (ptep[PTRS_PER_PTE])
638 : "d" (pgste_val(pgste)), "Q" (ptep[PTRS_PER_PTE]) : "cc"); 634 : "d" (pgste_val(pgste)), "Q" (ptep[PTRS_PER_PTE]) : "cc");
@@ -657,14 +653,14 @@ static inline pgste_t pgste_update_all(pte_t *ptep, pgste_t pgste)
657 else if (bits) 653 else if (bits)
658 page_reset_referenced(address); 654 page_reset_referenced(address);
659 /* Transfer page changed & referenced bit to guest bits in pgste */ 655 /* Transfer page changed & referenced bit to guest bits in pgste */
660 pgste_val(pgste) |= bits << 48; /* RCP_GR_BIT & RCP_GC_BIT */ 656 pgste_val(pgste) |= bits << 48; /* GR bit & GC bit */
661 /* Get host changed & referenced bits from pgste */ 657 /* Get host changed & referenced bits from pgste */
662 bits |= (pgste_val(pgste) & (RCP_HR_BIT | RCP_HC_BIT)) >> 52; 658 bits |= (pgste_val(pgste) & (PGSTE_HR_BIT | PGSTE_HC_BIT)) >> 52;
663 /* Transfer page changed & referenced bit to kvm user bits */ 659 /* Transfer page changed & referenced bit to kvm user bits */
664 pgste_val(pgste) |= bits << 45; /* KVM_UR_BIT & KVM_UC_BIT */ 660 pgste_val(pgste) |= bits << 45; /* PGSTE_UR_BIT & PGSTE_UC_BIT */
665 /* Clear relevant host bits in pgste. */ 661 /* Clear relevant host bits in pgste. */
666 pgste_val(pgste) &= ~(RCP_HR_BIT | RCP_HC_BIT); 662 pgste_val(pgste) &= ~(PGSTE_HR_BIT | PGSTE_HC_BIT);
667 pgste_val(pgste) &= ~(RCP_ACC_BITS | RCP_FP_BIT); 663 pgste_val(pgste) &= ~(PGSTE_ACC_BITS | PGSTE_FP_BIT);
668 /* Copy page access key and fetch protection bit to pgste */ 664 /* Copy page access key and fetch protection bit to pgste */
669 pgste_val(pgste) |= 665 pgste_val(pgste) |=
670 (unsigned long) (skey & (_PAGE_ACC_BITS | _PAGE_FP_BIT)) << 56; 666 (unsigned long) (skey & (_PAGE_ACC_BITS | _PAGE_FP_BIT)) << 56;
@@ -685,15 +681,15 @@ static inline pgste_t pgste_update_young(pte_t *ptep, pgste_t pgste)
685 /* Get referenced bit from storage key */ 681 /* Get referenced bit from storage key */
686 young = page_reset_referenced(pte_val(*ptep) & PAGE_MASK); 682 young = page_reset_referenced(pte_val(*ptep) & PAGE_MASK);
687 if (young) 683 if (young)
688 pgste_val(pgste) |= RCP_GR_BIT; 684 pgste_val(pgste) |= PGSTE_GR_BIT;
689 /* Get host referenced bit from pgste */ 685 /* Get host referenced bit from pgste */
690 if (pgste_val(pgste) & RCP_HR_BIT) { 686 if (pgste_val(pgste) & PGSTE_HR_BIT) {
691 pgste_val(pgste) &= ~RCP_HR_BIT; 687 pgste_val(pgste) &= ~PGSTE_HR_BIT;
692 young = 1; 688 young = 1;
693 } 689 }
694 /* Transfer referenced bit to kvm user bits and pte */ 690 /* Transfer referenced bit to kvm user bits and pte */
695 if (young) { 691 if (young) {
696 pgste_val(pgste) |= KVM_UR_BIT; 692 pgste_val(pgste) |= PGSTE_UR_BIT;
697 pte_val(*ptep) |= _PAGE_SWR; 693 pte_val(*ptep) |= _PAGE_SWR;
698 } 694 }
699#endif 695#endif
@@ -712,7 +708,7 @@ static inline void pgste_set_key(pte_t *ptep, pgste_t pgste, pte_t entry)
712 okey = nkey = page_get_storage_key(address); 708 okey = nkey = page_get_storage_key(address);
713 nkey &= ~(_PAGE_ACC_BITS | _PAGE_FP_BIT); 709 nkey &= ~(_PAGE_ACC_BITS | _PAGE_FP_BIT);
714 /* Set page access key and fetch protection bit from pgste */ 710 /* Set page access key and fetch protection bit from pgste */
715 nkey |= (pgste_val(pgste) & (RCP_ACC_BITS | RCP_FP_BIT)) >> 56; 711 nkey |= (pgste_val(pgste) & (PGSTE_ACC_BITS | PGSTE_FP_BIT)) >> 56;
716 if (okey != nkey) 712 if (okey != nkey)
717 page_set_storage_key(address, nkey, 0); 713 page_set_storage_key(address, nkey, 0);
718#endif 714#endif
@@ -801,8 +797,8 @@ static inline pgste_t pgste_ipte_notify(struct mm_struct *mm,
801 pte_t *ptep, pgste_t pgste) 797 pte_t *ptep, pgste_t pgste)
802{ 798{
803#ifdef CONFIG_PGSTE 799#ifdef CONFIG_PGSTE
804 if (pgste_val(pgste) & RCP_IN_BIT) { 800 if (pgste_val(pgste) & PGSTE_IN_BIT) {
805 pgste_val(pgste) &= ~RCP_IN_BIT; 801 pgste_val(pgste) &= ~PGSTE_IN_BIT;
806 gmap_do_ipte_notify(mm, addr, ptep); 802 gmap_do_ipte_notify(mm, addr, ptep);
807 } 803 }
808#endif 804#endif
@@ -970,8 +966,8 @@ static inline int ptep_test_and_clear_user_dirty(struct mm_struct *mm,
970 if (mm_has_pgste(mm)) { 966 if (mm_has_pgste(mm)) {
971 pgste = pgste_get_lock(ptep); 967 pgste = pgste_get_lock(ptep);
972 pgste = pgste_update_all(ptep, pgste); 968 pgste = pgste_update_all(ptep, pgste);
973 dirty = !!(pgste_val(pgste) & KVM_UC_BIT); 969 dirty = !!(pgste_val(pgste) & PGSTE_UC_BIT);
974 pgste_val(pgste) &= ~KVM_UC_BIT; 970 pgste_val(pgste) &= ~PGSTE_UC_BIT;
975 pgste_set_unlock(ptep, pgste); 971 pgste_set_unlock(ptep, pgste);
976 return dirty; 972 return dirty;
977 } 973 }
@@ -990,8 +986,8 @@ static inline int ptep_test_and_clear_user_young(struct mm_struct *mm,
990 if (mm_has_pgste(mm)) { 986 if (mm_has_pgste(mm)) {
991 pgste = pgste_get_lock(ptep); 987 pgste = pgste_get_lock(ptep);
992 pgste = pgste_update_young(ptep, pgste); 988 pgste = pgste_update_young(ptep, pgste);
993 young = !!(pgste_val(pgste) & KVM_UR_BIT); 989 young = !!(pgste_val(pgste) & PGSTE_UR_BIT);
994 pgste_val(pgste) &= ~KVM_UR_BIT; 990 pgste_val(pgste) &= ~PGSTE_UR_BIT;
995 pgste_set_unlock(ptep, pgste); 991 pgste_set_unlock(ptep, pgste);
996 } 992 }
997 return young; 993 return young;