@@ -1485,6 +1485,29 @@ void hash_preload(struct mm_struct *mm, unsigned long ea,
1485
1485
local_irq_restore (flags );
1486
1486
}
1487
1487
1488
+ #ifdef CONFIG_PPC_TRANSACTIONAL_MEM
1489
+ static inline void tm_flush_hash_page (int local )
1490
+ {
1491
+ /*
1492
+ * Transactions are not aborted by tlbiel, only tlbie. Without, syncing a
1493
+ * page back to a block device w/PIO could pick up transactional data
1494
+ * (bad!) so we force an abort here. Before the sync the page will be
1495
+ * made read-only, which will flush_hash_page. BIG ISSUE here: if the
1496
+ * kernel uses a page from userspace without unmapping it first, it may
1497
+ * see the speculated version.
1498
+ */
1499
+ if (local && cpu_has_feature (CPU_FTR_TM ) && current -> thread .regs &&
1500
+ MSR_TM_ACTIVE (current -> thread .regs -> msr )) {
1501
+ tm_enable ();
1502
+ tm_abort (TM_CAUSE_TLBI );
1503
+ }
1504
+ }
1505
+ #else
1506
+ static inline void tm_flush_hash_page (int local )
1507
+ {
1508
+ }
1509
+ #endif
1510
+
1488
1511
/* WARNING: This is called from hash_low_64.S, if you change this prototype,
1489
1512
* do not forget to update the assembly call site !
1490
1513
*/
@@ -1511,21 +1534,7 @@ void flush_hash_page(unsigned long vpn, real_pte_t pte, int psize, int ssize,
1511
1534
ssize , local );
1512
1535
} pte_iterate_hashed_end ();
1513
1536
1514
- #ifdef CONFIG_PPC_TRANSACTIONAL_MEM
1515
- /* Transactions are not aborted by tlbiel, only tlbie.
1516
- * Without, syncing a page back to a block device w/ PIO could pick up
1517
- * transactional data (bad!) so we force an abort here. Before the
1518
- * sync the page will be made read-only, which will flush_hash_page.
1519
- * BIG ISSUE here: if the kernel uses a page from userspace without
1520
- * unmapping it first, it may see the speculated version.
1521
- */
1522
- if (local && cpu_has_feature (CPU_FTR_TM ) &&
1523
- current -> thread .regs &&
1524
- MSR_TM_ACTIVE (current -> thread .regs -> msr )) {
1525
- tm_enable ();
1526
- tm_abort (TM_CAUSE_TLBI );
1527
- }
1528
- #endif
1537
+ tm_flush_hash_page (local );
1529
1538
}
1530
1539
1531
1540
#ifdef CONFIG_TRANSPARENT_HUGEPAGE
@@ -1582,22 +1591,7 @@ void flush_hash_hugepage(unsigned long vsid, unsigned long addr,
1582
1591
MMU_PAGE_16M , ssize , local );
1583
1592
}
1584
1593
tm_abort :
1585
- #ifdef CONFIG_PPC_TRANSACTIONAL_MEM
1586
- /* Transactions are not aborted by tlbiel, only tlbie.
1587
- * Without, syncing a page back to a block device w/ PIO could pick up
1588
- * transactional data (bad!) so we force an abort here. Before the
1589
- * sync the page will be made read-only, which will flush_hash_page.
1590
- * BIG ISSUE here: if the kernel uses a page from userspace without
1591
- * unmapping it first, it may see the speculated version.
1592
- */
1593
- if (local && cpu_has_feature (CPU_FTR_TM ) &&
1594
- current -> thread .regs &&
1595
- MSR_TM_ACTIVE (current -> thread .regs -> msr )) {
1596
- tm_enable ();
1597
- tm_abort (TM_CAUSE_TLBI );
1598
- }
1599
- #endif
1600
- return ;
1594
+ tm_flush_hash_page (local );
1601
1595
}
1602
1596
#endif /* CONFIG_TRANSPARENT_HUGEPAGE */
1603
1597
0 commit comments