@@ -1542,6 +1542,151 @@ static int tm_spr_set(struct task_struct *target,
1542
1542
2 * sizeof (u64 ), 3 * sizeof (u64 ));
1543
1543
return ret ;
1544
1544
}
1545
+
1546
+ static int tm_tar_active (struct task_struct * target ,
1547
+ const struct user_regset * regset )
1548
+ {
1549
+ if (!cpu_has_feature (CPU_FTR_TM ))
1550
+ return - ENODEV ;
1551
+
1552
+ if (MSR_TM_ACTIVE (target -> thread .regs -> msr ))
1553
+ return regset -> n ;
1554
+
1555
+ return 0 ;
1556
+ }
1557
+
1558
+ static int tm_tar_get (struct task_struct * target ,
1559
+ const struct user_regset * regset ,
1560
+ unsigned int pos , unsigned int count ,
1561
+ void * kbuf , void __user * ubuf )
1562
+ {
1563
+ int ret ;
1564
+
1565
+ if (!cpu_has_feature (CPU_FTR_TM ))
1566
+ return - ENODEV ;
1567
+
1568
+ if (!MSR_TM_ACTIVE (target -> thread .regs -> msr ))
1569
+ return - ENODATA ;
1570
+
1571
+ ret = user_regset_copyout (& pos , & count , & kbuf , & ubuf ,
1572
+ & target -> thread .tm_tar , 0 , sizeof (u64 ));
1573
+ return ret ;
1574
+ }
1575
+
1576
+ static int tm_tar_set (struct task_struct * target ,
1577
+ const struct user_regset * regset ,
1578
+ unsigned int pos , unsigned int count ,
1579
+ const void * kbuf , const void __user * ubuf )
1580
+ {
1581
+ int ret ;
1582
+
1583
+ if (!cpu_has_feature (CPU_FTR_TM ))
1584
+ return - ENODEV ;
1585
+
1586
+ if (!MSR_TM_ACTIVE (target -> thread .regs -> msr ))
1587
+ return - ENODATA ;
1588
+
1589
+ ret = user_regset_copyin (& pos , & count , & kbuf , & ubuf ,
1590
+ & target -> thread .tm_tar , 0 , sizeof (u64 ));
1591
+ return ret ;
1592
+ }
1593
+
1594
+ static int tm_ppr_active (struct task_struct * target ,
1595
+ const struct user_regset * regset )
1596
+ {
1597
+ if (!cpu_has_feature (CPU_FTR_TM ))
1598
+ return - ENODEV ;
1599
+
1600
+ if (MSR_TM_ACTIVE (target -> thread .regs -> msr ))
1601
+ return regset -> n ;
1602
+
1603
+ return 0 ;
1604
+ }
1605
+
1606
+
1607
+ static int tm_ppr_get (struct task_struct * target ,
1608
+ const struct user_regset * regset ,
1609
+ unsigned int pos , unsigned int count ,
1610
+ void * kbuf , void __user * ubuf )
1611
+ {
1612
+ int ret ;
1613
+
1614
+ if (!cpu_has_feature (CPU_FTR_TM ))
1615
+ return - ENODEV ;
1616
+
1617
+ if (!MSR_TM_ACTIVE (target -> thread .regs -> msr ))
1618
+ return - ENODATA ;
1619
+
1620
+ ret = user_regset_copyout (& pos , & count , & kbuf , & ubuf ,
1621
+ & target -> thread .tm_ppr , 0 , sizeof (u64 ));
1622
+ return ret ;
1623
+ }
1624
+
1625
+ static int tm_ppr_set (struct task_struct * target ,
1626
+ const struct user_regset * regset ,
1627
+ unsigned int pos , unsigned int count ,
1628
+ const void * kbuf , const void __user * ubuf )
1629
+ {
1630
+ int ret ;
1631
+
1632
+ if (!cpu_has_feature (CPU_FTR_TM ))
1633
+ return - ENODEV ;
1634
+
1635
+ if (!MSR_TM_ACTIVE (target -> thread .regs -> msr ))
1636
+ return - ENODATA ;
1637
+
1638
+ ret = user_regset_copyin (& pos , & count , & kbuf , & ubuf ,
1639
+ & target -> thread .tm_ppr , 0 , sizeof (u64 ));
1640
+ return ret ;
1641
+ }
1642
+
1643
+ static int tm_dscr_active (struct task_struct * target ,
1644
+ const struct user_regset * regset )
1645
+ {
1646
+ if (!cpu_has_feature (CPU_FTR_TM ))
1647
+ return - ENODEV ;
1648
+
1649
+ if (MSR_TM_ACTIVE (target -> thread .regs -> msr ))
1650
+ return regset -> n ;
1651
+
1652
+ return 0 ;
1653
+ }
1654
+
1655
+ static int tm_dscr_get (struct task_struct * target ,
1656
+ const struct user_regset * regset ,
1657
+ unsigned int pos , unsigned int count ,
1658
+ void * kbuf , void __user * ubuf )
1659
+ {
1660
+ int ret ;
1661
+
1662
+ if (!cpu_has_feature (CPU_FTR_TM ))
1663
+ return - ENODEV ;
1664
+
1665
+ if (!MSR_TM_ACTIVE (target -> thread .regs -> msr ))
1666
+ return - ENODATA ;
1667
+
1668
+ ret = user_regset_copyout (& pos , & count , & kbuf , & ubuf ,
1669
+ & target -> thread .tm_dscr , 0 , sizeof (u64 ));
1670
+ return ret ;
1671
+ }
1672
+
1673
+ static int tm_dscr_set (struct task_struct * target ,
1674
+ const struct user_regset * regset ,
1675
+ unsigned int pos , unsigned int count ,
1676
+ const void * kbuf , const void __user * ubuf )
1677
+ {
1678
+ int ret ;
1679
+
1680
+ if (!cpu_has_feature (CPU_FTR_TM ))
1681
+ return - ENODEV ;
1682
+
1683
+ if (!MSR_TM_ACTIVE (target -> thread .regs -> msr ))
1684
+ return - ENODATA ;
1685
+
1686
+ ret = user_regset_copyin (& pos , & count , & kbuf , & ubuf ,
1687
+ & target -> thread .tm_dscr , 0 , sizeof (u64 ));
1688
+ return ret ;
1689
+ }
1545
1690
#endif /* CONFIG_PPC_TRANSACTIONAL_MEM */
1546
1691
1547
1692
/*
@@ -1565,6 +1710,9 @@ enum powerpc_regset {
1565
1710
REGSET_TM_CVMX , /* TM checkpointed VMX registers */
1566
1711
REGSET_TM_CVSX , /* TM checkpointed VSX registers */
1567
1712
REGSET_TM_SPR , /* TM specific SPR registers */
1713
+ REGSET_TM_CTAR , /* TM checkpointed TAR register */
1714
+ REGSET_TM_CPPR , /* TM checkpointed PPR register */
1715
+ REGSET_TM_CDSCR , /* TM checkpointed DSCR register */
1568
1716
#endif
1569
1717
};
1570
1718
@@ -1626,6 +1774,21 @@ static const struct user_regset native_regsets[] = {
1626
1774
.size = sizeof (u64 ), .align = sizeof (u64 ),
1627
1775
.active = tm_spr_active , .get = tm_spr_get , .set = tm_spr_set
1628
1776
},
1777
+ [REGSET_TM_CTAR ] = {
1778
+ .core_note_type = NT_PPC_TM_CTAR , .n = 1 ,
1779
+ .size = sizeof (u64 ), .align = sizeof (u64 ),
1780
+ .active = tm_tar_active , .get = tm_tar_get , .set = tm_tar_set
1781
+ },
1782
+ [REGSET_TM_CPPR ] = {
1783
+ .core_note_type = NT_PPC_TM_CPPR , .n = 1 ,
1784
+ .size = sizeof (u64 ), .align = sizeof (u64 ),
1785
+ .active = tm_ppr_active , .get = tm_ppr_get , .set = tm_ppr_set
1786
+ },
1787
+ [REGSET_TM_CDSCR ] = {
1788
+ .core_note_type = NT_PPC_TM_CDSCR , .n = 1 ,
1789
+ .size = sizeof (u64 ), .align = sizeof (u64 ),
1790
+ .active = tm_dscr_active , .get = tm_dscr_get , .set = tm_dscr_set
1791
+ },
1629
1792
#endif
1630
1793
};
1631
1794
@@ -1878,6 +2041,21 @@ static const struct user_regset compat_regsets[] = {
1878
2041
.size = sizeof (u64 ), .align = sizeof (u64 ),
1879
2042
.active = tm_spr_active , .get = tm_spr_get , .set = tm_spr_set
1880
2043
},
2044
+ [REGSET_TM_CTAR ] = {
2045
+ .core_note_type = NT_PPC_TM_CTAR , .n = 1 ,
2046
+ .size = sizeof (u64 ), .align = sizeof (u64 ),
2047
+ .active = tm_tar_active , .get = tm_tar_get , .set = tm_tar_set
2048
+ },
2049
+ [REGSET_TM_CPPR ] = {
2050
+ .core_note_type = NT_PPC_TM_CPPR , .n = 1 ,
2051
+ .size = sizeof (u64 ), .align = sizeof (u64 ),
2052
+ .active = tm_ppr_active , .get = tm_ppr_get , .set = tm_ppr_set
2053
+ },
2054
+ [REGSET_TM_CDSCR ] = {
2055
+ .core_note_type = NT_PPC_TM_CDSCR , .n = 1 ,
2056
+ .size = sizeof (u64 ), .align = sizeof (u64 ),
2057
+ .active = tm_dscr_active , .get = tm_dscr_get , .set = tm_dscr_set
2058
+ },
1881
2059
#endif
1882
2060
};
1883
2061
0 commit comments