@@ -75,7 +75,7 @@ struct its_node {
75
75
raw_spinlock_t lock ;
76
76
struct list_head entry ;
77
77
void __iomem * base ;
78
- unsigned long phys_base ;
78
+ phys_addr_t phys_base ;
79
79
struct its_cmd_block * cmd_base ;
80
80
struct its_cmd_block * cmd_write ;
81
81
struct its_baser tables [GITS_BASER_NR_REGS ];
@@ -115,6 +115,7 @@ struct its_device {
115
115
static LIST_HEAD (its_nodes );
116
116
static DEFINE_SPINLOCK (its_lock );
117
117
static struct rdists * gic_rdists ;
118
+ static struct irq_domain * its_parent ;
118
119
119
120
#define gic_data_rdist () (raw_cpu_ptr(gic_rdists->rdist))
120
121
#define gic_data_rdist_rd_base () (gic_data_rdist()->rd_base)
@@ -1614,8 +1615,7 @@ static void its_enable_quirks(struct its_node *its)
1614
1615
gic_enable_quirks (iidr , its_quirks , its );
1615
1616
}
1616
1617
1617
- static int its_init_domain (struct device_node * node , struct its_node * its ,
1618
- struct irq_domain * parent )
1618
+ static int its_init_domain (struct fwnode_handle * handle , struct its_node * its )
1619
1619
{
1620
1620
struct irq_domain * inner_domain ;
1621
1621
struct msi_domain_info * info ;
@@ -1624,13 +1624,13 @@ static int its_init_domain(struct device_node *node, struct its_node *its,
1624
1624
if (!info )
1625
1625
return - ENOMEM ;
1626
1626
1627
- inner_domain = irq_domain_add_tree ( node , & its_domain_ops , its );
1627
+ inner_domain = irq_domain_create_tree ( handle , & its_domain_ops , its );
1628
1628
if (!inner_domain ) {
1629
1629
kfree (info );
1630
1630
return - ENOMEM ;
1631
1631
}
1632
1632
1633
- inner_domain -> parent = parent ;
1633
+ inner_domain -> parent = its_parent ;
1634
1634
inner_domain -> bus_token = DOMAIN_BUS_NEXUS ;
1635
1635
info -> ops = & its_msi_domain_ops ;
1636
1636
info -> data = its ;
@@ -1639,43 +1639,35 @@ static int its_init_domain(struct device_node *node, struct its_node *its,
1639
1639
return 0 ;
1640
1640
}
1641
1641
1642
- static int __init its_probe (struct device_node * node ,
1643
- struct irq_domain * parent )
1642
+ static int __init its_probe_one (struct resource * res ,
1643
+ struct fwnode_handle * handle , int numa_node )
1644
1644
{
1645
- struct resource res ;
1646
1645
struct its_node * its ;
1647
1646
void __iomem * its_base ;
1648
1647
u32 val ;
1649
1648
u64 baser , tmp ;
1650
1649
int err ;
1651
1650
1652
- err = of_address_to_resource (node , 0 , & res );
1653
- if (err ) {
1654
- pr_warn ("%s: no regs?\n" , node -> full_name );
1655
- return - ENXIO ;
1656
- }
1657
-
1658
- its_base = ioremap (res .start , resource_size (& res ));
1651
+ its_base = ioremap (res -> start , resource_size (res ));
1659
1652
if (!its_base ) {
1660
- pr_warn ("%s: unable to map registers\n" , node -> full_name );
1653
+ pr_warn ("ITS@%pa: Unable to map ITS registers\n" , & res -> start );
1661
1654
return - ENOMEM ;
1662
1655
}
1663
1656
1664
1657
val = readl_relaxed (its_base + GITS_PIDR2 ) & GIC_PIDR2_ARCH_MASK ;
1665
1658
if (val != 0x30 && val != 0x40 ) {
1666
- pr_warn ("%s: no ITS detected, giving up\n" , node -> full_name );
1659
+ pr_warn ("ITS@%pa: No ITS detected, giving up\n" , & res -> start );
1667
1660
err = - ENODEV ;
1668
1661
goto out_unmap ;
1669
1662
}
1670
1663
1671
1664
err = its_force_quiescent (its_base );
1672
1665
if (err ) {
1673
- pr_warn ("%s: failed to quiesce, giving up\n" ,
1674
- node -> full_name );
1666
+ pr_warn ("ITS@%pa: Failed to quiesce, giving up\n" , & res -> start );
1675
1667
goto out_unmap ;
1676
1668
}
1677
1669
1678
- pr_info ("ITS: %s \n" , node -> full_name );
1670
+ pr_info ("ITS %pR \n" , res );
1679
1671
1680
1672
its = kzalloc (sizeof (* its ), GFP_KERNEL );
1681
1673
if (!its ) {
@@ -1687,9 +1679,9 @@ static int __init its_probe(struct device_node *node,
1687
1679
INIT_LIST_HEAD (& its -> entry );
1688
1680
INIT_LIST_HEAD (& its -> its_device_list );
1689
1681
its -> base = its_base ;
1690
- its -> phys_base = res . start ;
1682
+ its -> phys_base = res -> start ;
1691
1683
its -> ite_size = ((readl_relaxed (its_base + GITS_TYPER ) >> 4 ) & 0xf ) + 1 ;
1692
- its -> numa_node = of_node_to_nid ( node ) ;
1684
+ its -> numa_node = numa_node ;
1693
1685
1694
1686
its -> cmd_base = kzalloc (ITS_CMD_QUEUE_SZ , GFP_KERNEL );
1695
1687
if (!its -> cmd_base ) {
@@ -1736,7 +1728,7 @@ static int __init its_probe(struct device_node *node,
1736
1728
writeq_relaxed (0 , its -> base + GITS_CWRITER );
1737
1729
writel_relaxed (GITS_CTLR_ENABLE , its -> base + GITS_CTLR );
1738
1730
1739
- err = its_init_domain (node , its , parent );
1731
+ err = its_init_domain (handle , its );
1740
1732
if (err )
1741
1733
goto out_free_tables ;
1742
1734
@@ -1754,7 +1746,7 @@ static int __init its_probe(struct device_node *node,
1754
1746
kfree (its );
1755
1747
out_unmap :
1756
1748
iounmap (its_base );
1757
- pr_err ("ITS: failed probing %s (%d)\n" , node -> full_name , err );
1749
+ pr_err ("ITS@%pa : failed probing (%d)\n" , & res -> start , err );
1758
1750
return err ;
1759
1751
}
1760
1752
@@ -1782,10 +1774,10 @@ static struct of_device_id its_device_id[] = {
1782
1774
{},
1783
1775
};
1784
1776
1785
- int __init its_init (struct device_node * node , struct rdists * rdists ,
1786
- struct irq_domain * parent_domain )
1777
+ static int __init its_of_probe (struct device_node * node )
1787
1778
{
1788
1779
struct device_node * np ;
1780
+ struct resource res ;
1789
1781
1790
1782
for (np = of_find_matching_node (node , its_device_id ); np ;
1791
1783
np = of_find_matching_node (np , its_device_id )) {
@@ -1795,8 +1787,27 @@ int __init its_init(struct device_node *node, struct rdists *rdists,
1795
1787
continue ;
1796
1788
}
1797
1789
1798
- its_probe (np , parent_domain );
1790
+ if (of_address_to_resource (np , 0 , & res )) {
1791
+ pr_warn ("%s: no regs?\n" , np -> full_name );
1792
+ continue ;
1793
+ }
1794
+
1795
+ its_probe_one (& res , & np -> fwnode , of_node_to_nid (np ));
1799
1796
}
1797
+ return 0 ;
1798
+ }
1799
+
1800
+ int __init its_init (struct fwnode_handle * handle , struct rdists * rdists ,
1801
+ struct irq_domain * parent_domain )
1802
+ {
1803
+ struct device_node * of_node ;
1804
+
1805
+ its_parent = parent_domain ;
1806
+ of_node = to_of_node (handle );
1807
+ if (of_node )
1808
+ its_of_probe (of_node );
1809
+ else
1810
+ return - ENODEV ;
1800
1811
1801
1812
if (list_empty (& its_nodes )) {
1802
1813
pr_warn ("ITS: No ITS available, not enabling LPIs\n" );
0 commit comments