@@ -173,10 +173,10 @@ static inline pgste_t pgste_update_all(pte_t pte, pgste_t pgste,
173
173
skey = (unsigned long ) page_get_storage_key (address );
174
174
bits = skey & (_PAGE_CHANGED | _PAGE_REFERENCED );
175
175
/* 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 */
177
177
/* 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 ) ;
180
180
#endif
181
181
return pgste ;
182
182
@@ -220,7 +220,7 @@ static inline pgste_t pgste_set_pte(pte_t *ptep, pgste_t pgste, pte_t entry)
220
220
}
221
221
if (!(pte_val (entry ) & _PAGE_PROTECT ))
222
222
/* This pte allows write access, set user-dirty */
223
- pgste_val ( pgste ) |= PGSTE_UC_BIT ;
223
+ pgste = set_pgste_bit ( pgste , PGSTE_UC_BIT ) ;
224
224
}
225
225
#endif
226
226
set_pte (ptep , entry );
@@ -236,7 +236,7 @@ static inline pgste_t pgste_pte_notify(struct mm_struct *mm,
236
236
237
237
bits = pgste_val (pgste ) & (PGSTE_IN_BIT | PGSTE_VSIE_BIT );
238
238
if (bits ) {
239
- pgste_val (pgste ) ^= bits ;
239
+ pgste = __pgste ( pgste_val (pgste ) ^ bits ) ;
240
240
ptep_notify (mm , addr , ptep , bits );
241
241
}
242
242
#endif
@@ -609,7 +609,7 @@ void ptep_set_pte_at(struct mm_struct *mm, unsigned long addr,
609
609
/* the mm_has_pgste() check is done in set_pte_at() */
610
610
preempt_disable ();
611
611
pgste = pgste_get_lock (ptep );
612
- pgste_val ( pgste ) &= ~ _PGSTE_GPS_ZERO ;
612
+ pgste = clear_pgste_bit ( pgste , _PGSTE_GPS_ZERO ) ;
613
613
pgste_set_key (ptep , pgste , entry , mm );
614
614
pgste = pgste_set_pte (ptep , pgste , entry );
615
615
pgste_set_unlock (ptep , pgste );
@@ -622,7 +622,7 @@ void ptep_set_notify(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
622
622
623
623
preempt_disable ();
624
624
pgste = pgste_get_lock (ptep );
625
- pgste_val ( pgste ) |= PGSTE_IN_BIT ;
625
+ pgste = set_pgste_bit ( pgste , PGSTE_IN_BIT ) ;
626
626
pgste_set_unlock (ptep , pgste );
627
627
preempt_enable ();
628
628
}
@@ -667,7 +667,7 @@ int ptep_force_prot(struct mm_struct *mm, unsigned long addr,
667
667
entry = clear_pte_bit (entry , __pgprot (_PAGE_INVALID ));
668
668
entry = set_pte_bit (entry , __pgprot (_PAGE_PROTECT ));
669
669
}
670
- pgste_val ( pgste ) |= bit ;
670
+ pgste = set_pgste_bit ( pgste , bit ) ;
671
671
pgste = pgste_set_pte (ptep , pgste , entry );
672
672
pgste_set_unlock (ptep , pgste );
673
673
return 0 ;
@@ -687,7 +687,7 @@ int ptep_shadow_pte(struct mm_struct *mm, unsigned long saddr,
687
687
if (!(pte_val (spte ) & _PAGE_INVALID ) &&
688
688
!((pte_val (spte ) & _PAGE_PROTECT ) &&
689
689
!(pte_val (pte ) & _PAGE_PROTECT ))) {
690
- pgste_val ( spgste ) |= PGSTE_VSIE_BIT ;
690
+ spgste = set_pgste_bit ( spgste , PGSTE_VSIE_BIT ) ;
691
691
tpgste = pgste_get_lock (tptep );
692
692
tpte = __pte ((pte_val (spte ) & PAGE_MASK ) |
693
693
(pte_val (pte ) & _PAGE_PROTECT ));
@@ -745,7 +745,7 @@ void ptep_zap_unused(struct mm_struct *mm, unsigned long addr,
745
745
pte_clear (mm , addr , ptep );
746
746
}
747
747
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 );
749
749
pgste_set_unlock (ptep , pgste );
750
750
preempt_enable ();
751
751
}
@@ -758,8 +758,8 @@ void ptep_zap_key(struct mm_struct *mm, unsigned long addr, pte_t *ptep)
758
758
/* Clear storage key ACC and F, but set R/C */
759
759
preempt_disable ();
760
760
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 ) ;
763
763
ptev = pte_val (* ptep );
764
764
if (!(ptev & _PAGE_INVALID ) && (ptev & _PAGE_WRITE ))
765
765
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,
780
780
781
781
pgste = pgste_get_lock (ptep );
782
782
dirty = !!(pgste_val (pgste ) & PGSTE_UC_BIT );
783
- pgste_val ( pgste ) &= ~ PGSTE_UC_BIT ;
783
+ pgste = clear_pgste_bit ( pgste , PGSTE_UC_BIT ) ;
784
784
pte = * ptep ;
785
785
if (dirty && (pte_val (pte ) & _PAGE_PRESENT )) {
786
786
pgste = pgste_pte_notify (mm , addr , ptep , pgste );
@@ -842,11 +842,11 @@ int set_guest_storage_key(struct mm_struct *mm, unsigned long addr,
842
842
if (!ptep )
843
843
goto again ;
844
844
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 );
847
847
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 ) ;
850
850
if (!(pte_val (* ptep ) & _PAGE_INVALID )) {
851
851
unsigned long bits , skey ;
852
852
@@ -857,12 +857,12 @@ int set_guest_storage_key(struct mm_struct *mm, unsigned long addr,
857
857
/* Set storage key ACC and FP */
858
858
page_set_storage_key (paddr , skey , !nq );
859
859
/* Merge host changed & referenced into pgste */
860
- pgste_val ( new ) |= bits << 52 ;
860
+ new = set_pgste_bit ( new , bits << 52 ) ;
861
861
}
862
862
/* changing the guest storage key is considered a change of the page */
863
863
if ((pgste_val (new ) ^ pgste_val (old )) &
864
864
(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 ) ;
866
866
867
867
pgste_set_unlock (ptep , new );
868
868
pte_unmap_unlock (ptep , ptl );
@@ -950,19 +950,19 @@ int reset_guest_reference_bit(struct mm_struct *mm, unsigned long addr)
950
950
goto again ;
951
951
new = old = pgste_get_lock (ptep );
952
952
/* Reset guest reference bit only */
953
- pgste_val ( new ) &= ~ PGSTE_GR_BIT ;
953
+ new = clear_pgste_bit ( new , PGSTE_GR_BIT ) ;
954
954
955
955
if (!(pte_val (* ptep ) & _PAGE_INVALID )) {
956
956
paddr = pte_val (* ptep ) & PAGE_MASK ;
957
957
cc = page_reset_referenced (paddr );
958
958
/* 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 ) ;
960
960
}
961
961
/* Reflect guest's logical view, not physical */
962
962
cc |= (pgste_val (old ) & (PGSTE_GR_BIT | PGSTE_GC_BIT )) >> 49 ;
963
963
/* Changing the guest storage key is considered a change of the page */
964
964
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 ) ;
966
966
967
967
pgste_set_unlock (ptep , new );
968
968
pte_unmap_unlock (ptep , ptl );
@@ -1126,7 +1126,7 @@ int pgste_perform_essa(struct mm_struct *mm, unsigned long hva, int orc,
1126
1126
if (res )
1127
1127
pgstev |= _PGSTE_GPS_ZERO ;
1128
1128
1129
- pgste_val ( pgste ) = pgstev ;
1129
+ pgste = __pgste ( pgstev ) ;
1130
1130
pgste_set_unlock (ptep , pgste );
1131
1131
pte_unmap_unlock (ptep , ptl );
1132
1132
return res ;
@@ -1159,8 +1159,8 @@ int set_pgste_bits(struct mm_struct *mm, unsigned long hva,
1159
1159
return - EFAULT ;
1160
1160
new = pgste_get_lock (ptep );
1161
1161
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 ) ;
1164
1164
1165
1165
pgste_set_unlock (ptep , new );
1166
1166
pte_unmap_unlock (ptep , ptl );
0 commit comments