@@ -252,6 +252,7 @@ DEFINE_UNCORE_FORMAT_ATTR(inv, inv, "config:23");
252252DEFINE_UNCORE_FORMAT_ATTR (cmask5 , cmask , "config:24-28" );
253253DEFINE_UNCORE_FORMAT_ATTR (cmask8 , cmask , "config:24-31" );
254254DEFINE_UNCORE_FORMAT_ATTR (threshold , threshold , "config:24-29" );
255+ DEFINE_UNCORE_FORMAT_ATTR (threshold2 , threshold , "config:24-31" );
255256
256257/* Sandy Bridge uncore support */
257258static void snb_uncore_msr_enable_event (struct intel_uncore_box * box , struct perf_event * event )
@@ -746,6 +747,34 @@ void mtl_uncore_cpu_init(void)
746747 uncore_msr_uncores = mtl_msr_uncores ;
747748}
748749
750+ static struct intel_uncore_type * lnl_msr_uncores [] = {
751+ & mtl_uncore_cbox ,
752+ & mtl_uncore_arb ,
753+ NULL
754+ };
755+
756+ #define LNL_UNC_MSR_GLOBAL_CTL 0x240e
757+
758+ static void lnl_uncore_msr_init_box (struct intel_uncore_box * box )
759+ {
760+ if (box -> pmu -> pmu_idx == 0 )
761+ wrmsrl (LNL_UNC_MSR_GLOBAL_CTL , SNB_UNC_GLOBAL_CTL_EN );
762+ }
763+
764+ static struct intel_uncore_ops lnl_uncore_msr_ops = {
765+ .init_box = lnl_uncore_msr_init_box ,
766+ .disable_event = snb_uncore_msr_disable_event ,
767+ .enable_event = snb_uncore_msr_enable_event ,
768+ .read_counter = uncore_msr_read_counter ,
769+ };
770+
771+ void lnl_uncore_cpu_init (void )
772+ {
773+ mtl_uncore_cbox .num_boxes = 4 ;
774+ mtl_uncore_cbox .ops = & lnl_uncore_msr_ops ;
775+ uncore_msr_uncores = lnl_msr_uncores ;
776+ }
777+
749778enum {
750779 SNB_PCI_UNCORE_IMC ,
751780};
@@ -1716,3 +1745,107 @@ void adl_uncore_mmio_init(void)
17161745}
17171746
17181747/* end of Alder Lake MMIO uncore support */
1748+
1749+ /* Lunar Lake MMIO uncore support */
1750+ #define LNL_UNCORE_PCI_SAFBAR_OFFSET 0x68
1751+ #define LNL_UNCORE_MAP_SIZE 0x1000
1752+ #define LNL_UNCORE_SNCU_BASE 0xE4B000
1753+ #define LNL_UNCORE_SNCU_CTR 0x390
1754+ #define LNL_UNCORE_SNCU_CTRL 0x398
1755+ #define LNL_UNCORE_SNCU_BOX_CTL 0x380
1756+ #define LNL_UNCORE_GLOBAL_CTL 0x700
1757+ #define LNL_UNCORE_HBO_BASE 0xE54000
1758+ #define LNL_UNCORE_HBO_OFFSET -4096
1759+ #define LNL_UNCORE_HBO_CTR 0x570
1760+ #define LNL_UNCORE_HBO_CTRL 0x550
1761+ #define LNL_UNCORE_HBO_BOX_CTL 0x548
1762+
1763+ #define LNL_UNC_CTL_THRESHOLD 0xff000000
1764+ #define LNL_UNC_RAW_EVENT_MASK (SNB_UNC_CTL_EV_SEL_MASK | \
1765+ SNB_UNC_CTL_UMASK_MASK | \
1766+ SNB_UNC_CTL_EDGE_DET | \
1767+ SNB_UNC_CTL_INVERT | \
1768+ LNL_UNC_CTL_THRESHOLD)
1769+
1770+ static struct attribute * lnl_uncore_formats_attr [] = {
1771+ & format_attr_event .attr ,
1772+ & format_attr_umask .attr ,
1773+ & format_attr_edge .attr ,
1774+ & format_attr_inv .attr ,
1775+ & format_attr_threshold2 .attr ,
1776+ NULL
1777+ };
1778+
1779+ static const struct attribute_group lnl_uncore_format_group = {
1780+ .name = "format" ,
1781+ .attrs = lnl_uncore_formats_attr ,
1782+ };
1783+
1784+ static void lnl_uncore_hbo_init_box (struct intel_uncore_box * box )
1785+ {
1786+ uncore_get_box_mmio_addr (box , LNL_UNCORE_HBO_BASE ,
1787+ LNL_UNCORE_PCI_SAFBAR_OFFSET ,
1788+ LNL_UNCORE_HBO_OFFSET );
1789+ }
1790+
1791+ static struct intel_uncore_ops lnl_uncore_hbo_ops = {
1792+ .init_box = lnl_uncore_hbo_init_box ,
1793+ MMIO_UNCORE_COMMON_OPS ()
1794+ };
1795+
1796+ static struct intel_uncore_type lnl_uncore_hbo = {
1797+ .name = "hbo" ,
1798+ .num_counters = 4 ,
1799+ .num_boxes = 2 ,
1800+ .perf_ctr_bits = 64 ,
1801+ .perf_ctr = LNL_UNCORE_HBO_CTR ,
1802+ .event_ctl = LNL_UNCORE_HBO_CTRL ,
1803+ .event_mask = LNL_UNC_RAW_EVENT_MASK ,
1804+ .box_ctl = LNL_UNCORE_HBO_BOX_CTL ,
1805+ .mmio_map_size = LNL_UNCORE_MAP_SIZE ,
1806+ .ops = & lnl_uncore_hbo_ops ,
1807+ .format_group = & lnl_uncore_format_group ,
1808+ };
1809+
1810+ static void lnl_uncore_sncu_init_box (struct intel_uncore_box * box )
1811+ {
1812+ uncore_get_box_mmio_addr (box , LNL_UNCORE_SNCU_BASE ,
1813+ LNL_UNCORE_PCI_SAFBAR_OFFSET ,
1814+ 0 );
1815+
1816+ if (box -> io_addr )
1817+ writel (ADL_UNCORE_IMC_CTL_INT , box -> io_addr + LNL_UNCORE_GLOBAL_CTL );
1818+ }
1819+
1820+ static struct intel_uncore_ops lnl_uncore_sncu_ops = {
1821+ .init_box = lnl_uncore_sncu_init_box ,
1822+ MMIO_UNCORE_COMMON_OPS ()
1823+ };
1824+
1825+ static struct intel_uncore_type lnl_uncore_sncu = {
1826+ .name = "sncu" ,
1827+ .num_counters = 2 ,
1828+ .num_boxes = 1 ,
1829+ .perf_ctr_bits = 64 ,
1830+ .perf_ctr = LNL_UNCORE_SNCU_CTR ,
1831+ .event_ctl = LNL_UNCORE_SNCU_CTRL ,
1832+ .event_mask = LNL_UNC_RAW_EVENT_MASK ,
1833+ .box_ctl = LNL_UNCORE_SNCU_BOX_CTL ,
1834+ .mmio_map_size = LNL_UNCORE_MAP_SIZE ,
1835+ .ops = & lnl_uncore_sncu_ops ,
1836+ .format_group = & lnl_uncore_format_group ,
1837+ };
1838+
1839+ static struct intel_uncore_type * lnl_mmio_uncores [] = {
1840+ & adl_uncore_imc ,
1841+ & lnl_uncore_hbo ,
1842+ & lnl_uncore_sncu ,
1843+ NULL
1844+ };
1845+
1846+ void lnl_uncore_mmio_init (void )
1847+ {
1848+ uncore_mmio_uncores = lnl_mmio_uncores ;
1849+ }
1850+
1851+ /* end of Lunar Lake MMIO uncore support */
0 commit comments