@@ -173,10 +173,10 @@ static inline pgste_t pgste_update_all(pte_t pte, pgste_t pgste,
173173 skey = (unsigned long ) page_get_storage_key (address );
174174 bits = skey & (_PAGE_CHANGED | _PAGE_REFERENCED );
175175 /* Transfer page changed & referenced bit to guest bits in pgste */
176- pgste_val ( pgste ) |= bits << 48 ; /* GR bit & GC bit */
176+ pgste = set_pgste_bit ( pgste , bits << 48 ); /* GR bit & GC bit */
177177 /* Copy page access key and fetch protection bit to pgste */
178- pgste_val ( pgste ) &= ~( PGSTE_ACC_BITS | PGSTE_FP_BIT );
179- pgste_val ( pgste ) |= ( skey & (_PAGE_ACC_BITS | _PAGE_FP_BIT )) << 56 ;
178+ pgste = clear_pgste_bit ( pgste , PGSTE_ACC_BITS | PGSTE_FP_BIT );
179+ pgste = set_pgste_bit ( pgste , ( skey & (_PAGE_ACC_BITS | _PAGE_FP_BIT )) << 56 ) ;
180180#endif
181181 return pgste ;
182182
@@ -220,7 +220,7 @@ static inline pgste_t pgste_set_pte(pte_t *ptep, pgste_t pgste, pte_t entry)
220220 }
221221 if (!(pte_val (entry ) & _PAGE_PROTECT ))
222222 /* This pte allows write access, set user-dirty */
223- pgste_val ( pgste ) |= PGSTE_UC_BIT ;
223+ pgste = set_pgste_bit ( pgste , PGSTE_UC_BIT ) ;
224224 }
225225#endif
226226 set_pte (ptep , entry );
@@ -236,7 +236,7 @@ static inline pgste_t pgste_pte_notify(struct mm_struct *mm,
236236
237237 bits = pgste_val (pgste ) & (PGSTE_IN_BIT | PGSTE_VSIE_BIT );
238238 if (bits ) {
239- pgste_val (pgste ) ^= bits ;
239+ pgste = __pgste ( pgste_val (pgste ) ^ bits ) ;
240240 ptep_notify (mm , addr , ptep , bits );
241241 }
242242#endif
@@ -609,7 +609,7 @@ void ptep_set_pte_at(struct mm_struct *mm, unsigned long addr,
609609 /* the mm_has_pgste() check is done in set_pte_at() */
610610 preempt_disable ();
611611 pgste = pgste_get_lock (ptep );
612- pgste_val ( pgste ) &= ~ _PGSTE_GPS_ZERO ;
612+ pgste = clear_pgste_bit ( pgste , _PGSTE_GPS_ZERO ) ;
613613 pgste_set_key (ptep , pgste , entry , mm );
614614 pgste = pgste_set_pte (ptep , pgste , entry );
615615 pgste_set_unlock (ptep , pgste );
@@ -622,7 +622,7 @@ void ptep_set_notify(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
622622
623623 preempt_disable ();
624624 pgste = pgste_get_lock (ptep );
625- pgste_val ( pgste ) |= PGSTE_IN_BIT ;
625+ pgste = set_pgste_bit ( pgste , PGSTE_IN_BIT ) ;
626626 pgste_set_unlock (ptep , pgste );
627627 preempt_enable ();
628628}
@@ -667,7 +667,7 @@ int ptep_force_prot(struct mm_struct *mm, unsigned long addr,
667667 entry = clear_pte_bit (entry , __pgprot (_PAGE_INVALID ));
668668 entry = set_pte_bit (entry , __pgprot (_PAGE_PROTECT ));
669669 }
670- pgste_val ( pgste ) |= bit ;
670+ pgste = set_pgste_bit ( pgste , bit ) ;
671671 pgste = pgste_set_pte (ptep , pgste , entry );
672672 pgste_set_unlock (ptep , pgste );
673673 return 0 ;
@@ -687,7 +687,7 @@ int ptep_shadow_pte(struct mm_struct *mm, unsigned long saddr,
687687 if (!(pte_val (spte ) & _PAGE_INVALID ) &&
688688 !((pte_val (spte ) & _PAGE_PROTECT ) &&
689689 !(pte_val (pte ) & _PAGE_PROTECT ))) {
690- pgste_val ( spgste ) |= PGSTE_VSIE_BIT ;
690+ spgste = set_pgste_bit ( spgste , PGSTE_VSIE_BIT ) ;
691691 tpgste = pgste_get_lock (tptep );
692692 tpte = __pte ((pte_val (spte ) & PAGE_MASK ) |
693693 (pte_val (pte ) & _PAGE_PROTECT ));
@@ -745,7 +745,7 @@ void ptep_zap_unused(struct mm_struct *mm, unsigned long addr,
745745 pte_clear (mm , addr , ptep );
746746 }
747747 if (reset )
748- pgste_val ( pgste ) &= ~( _PGSTE_GPS_USAGE_MASK | _PGSTE_GPS_NODAT );
748+ pgste = clear_pgste_bit ( pgste , _PGSTE_GPS_USAGE_MASK | _PGSTE_GPS_NODAT );
749749 pgste_set_unlock (ptep , pgste );
750750 preempt_enable ();
751751}
@@ -758,8 +758,8 @@ void ptep_zap_key(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
758758 /* Clear storage key ACC and F, but set R/C */
759759 preempt_disable ();
760760 pgste = pgste_get_lock (ptep );
761- pgste_val ( pgste ) &= ~( PGSTE_ACC_BITS | PGSTE_FP_BIT );
762- pgste_val ( pgste ) |= PGSTE_GR_BIT | PGSTE_GC_BIT ;
761+ pgste = clear_pgste_bit ( pgste , PGSTE_ACC_BITS | PGSTE_FP_BIT );
762+ pgste = set_pgste_bit ( pgste , PGSTE_GR_BIT | PGSTE_GC_BIT ) ;
763763 ptev = pte_val (* ptep );
764764 if (!(ptev & _PAGE_INVALID ) && (ptev & _PAGE_WRITE ))
765765 page_set_storage_key (ptev & PAGE_MASK , PAGE_DEFAULT_KEY , 0 );
@@ -780,7 +780,7 @@ bool ptep_test_and_clear_uc(struct mm_struct *mm, unsigned long addr,
780780
781781 pgste = pgste_get_lock (ptep );
782782 dirty = !!(pgste_val (pgste ) & PGSTE_UC_BIT );
783- pgste_val ( pgste ) &= ~ PGSTE_UC_BIT ;
783+ pgste = clear_pgste_bit ( pgste , PGSTE_UC_BIT ) ;
784784 pte = * ptep ;
785785 if (dirty && (pte_val (pte ) & _PAGE_PRESENT )) {
786786 pgste = pgste_pte_notify (mm , addr , ptep , pgste );
@@ -842,11 +842,11 @@ int set_guest_storage_key(struct mm_struct *mm, unsigned long addr,
842842 if (!ptep )
843843 goto again ;
844844 new = old = pgste_get_lock (ptep );
845- pgste_val ( new ) &= ~( PGSTE_GR_BIT | PGSTE_GC_BIT |
846- PGSTE_ACC_BITS | PGSTE_FP_BIT );
845+ new = clear_pgste_bit ( new , PGSTE_GR_BIT | PGSTE_GC_BIT |
846+ PGSTE_ACC_BITS | PGSTE_FP_BIT );
847847 keyul = (unsigned long ) key ;
848- pgste_val ( new ) |= ( keyul & (_PAGE_CHANGED | _PAGE_REFERENCED )) << 48 ;
849- pgste_val ( new ) |= ( keyul & (_PAGE_ACC_BITS | _PAGE_FP_BIT )) << 56 ;
848+ new = set_pgste_bit ( new , ( keyul & (_PAGE_CHANGED | _PAGE_REFERENCED )) << 48 ) ;
849+ new = set_pgste_bit ( new , ( keyul & (_PAGE_ACC_BITS | _PAGE_FP_BIT )) << 56 ) ;
850850 if (!(pte_val (* ptep ) & _PAGE_INVALID )) {
851851 unsigned long bits , skey ;
852852
@@ -857,12 +857,12 @@ int set_guest_storage_key(struct mm_struct *mm, unsigned long addr,
857857 /* Set storage key ACC and FP */
858858 page_set_storage_key (paddr , skey , !nq );
859859 /* Merge host changed & referenced into pgste */
860- pgste_val ( new ) |= bits << 52 ;
860+ new = set_pgste_bit ( new , bits << 52 ) ;
861861 }
862862 /* changing the guest storage key is considered a change of the page */
863863 if ((pgste_val (new ) ^ pgste_val (old )) &
864864 (PGSTE_ACC_BITS | PGSTE_FP_BIT | PGSTE_GR_BIT | PGSTE_GC_BIT ))
865- pgste_val ( new ) |= PGSTE_UC_BIT ;
865+ new = set_pgste_bit ( new , PGSTE_UC_BIT ) ;
866866
867867 pgste_set_unlock (ptep , new );
868868 pte_unmap_unlock (ptep , ptl );
@@ -950,19 +950,19 @@ int reset_guest_reference_bit(struct mm_struct *mm, unsigned long addr)
950950 goto again ;
951951 new = old = pgste_get_lock (ptep );
952952 /* Reset guest reference bit only */
953- pgste_val ( new ) &= ~ PGSTE_GR_BIT ;
953+ new = clear_pgste_bit ( new , PGSTE_GR_BIT ) ;
954954
955955 if (!(pte_val (* ptep ) & _PAGE_INVALID )) {
956956 paddr = pte_val (* ptep ) & PAGE_MASK ;
957957 cc = page_reset_referenced (paddr );
958958 /* Merge real referenced bit into host-set */
959- pgste_val ( new ) |= (( unsigned long ) cc << 53 ) & PGSTE_HR_BIT ;
959+ new = set_pgste_bit ( new , (( unsigned long )cc << 53 ) & PGSTE_HR_BIT ) ;
960960 }
961961 /* Reflect guest's logical view, not physical */
962962 cc |= (pgste_val (old ) & (PGSTE_GR_BIT | PGSTE_GC_BIT )) >> 49 ;
963963 /* Changing the guest storage key is considered a change of the page */
964964 if ((pgste_val (new ) ^ pgste_val (old )) & PGSTE_GR_BIT )
965- pgste_val ( new ) |= PGSTE_UC_BIT ;
965+ new = set_pgste_bit ( new , PGSTE_UC_BIT ) ;
966966
967967 pgste_set_unlock (ptep , new );
968968 pte_unmap_unlock (ptep , ptl );
@@ -1126,7 +1126,7 @@ int pgste_perform_essa(struct mm_struct *mm, unsigned long hva, int orc,
11261126 if (res )
11271127 pgstev |= _PGSTE_GPS_ZERO ;
11281128
1129- pgste_val ( pgste ) = pgstev ;
1129+ pgste = __pgste ( pgstev ) ;
11301130 pgste_set_unlock (ptep , pgste );
11311131 pte_unmap_unlock (ptep , ptl );
11321132 return res ;
@@ -1159,8 +1159,8 @@ int set_pgste_bits(struct mm_struct *mm, unsigned long hva,
11591159 return - EFAULT ;
11601160 new = pgste_get_lock (ptep );
11611161
1162- pgste_val ( new ) &= ~ bits ;
1163- pgste_val ( new ) |= value & bits ;
1162+ new = clear_pgste_bit ( new , bits ) ;
1163+ new = set_pgste_bit ( new , value & bits ) ;
11641164
11651165 pgste_set_unlock (ptep , new );
11661166 pte_unmap_unlock (ptep , ptl );
0 commit comments