提交 7bc9ccec 编写于 作者: J John Crispin 提交者: David S. Miller

net-next: mediatek: add IRQ locking

The code that enables and disables IRQs is missing proper locking. After
adding the IRQ grouping patch and routing the RX and TX IRQs to different
cores we experienced IRQ stalls. Fix this by adding proper locking.
We use a dedicated lock to reduce the latency if the IRQ code.
Signed-off-by: NJohn Crispin <john@phrozen.org>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 eece71e8
...@@ -328,18 +328,24 @@ static void mtk_mdio_cleanup(struct mtk_eth *eth) ...@@ -328,18 +328,24 @@ static void mtk_mdio_cleanup(struct mtk_eth *eth)
static inline void mtk_irq_disable(struct mtk_eth *eth, u32 mask) static inline void mtk_irq_disable(struct mtk_eth *eth, u32 mask)
{ {
unsigned long flags;
u32 val; u32 val;
spin_lock_irqsave(&eth->irq_lock, flags);
val = mtk_r32(eth, MTK_QDMA_INT_MASK); val = mtk_r32(eth, MTK_QDMA_INT_MASK);
mtk_w32(eth, val & ~mask, MTK_QDMA_INT_MASK); mtk_w32(eth, val & ~mask, MTK_QDMA_INT_MASK);
spin_unlock_irqrestore(&eth->irq_lock, flags);
} }
static inline void mtk_irq_enable(struct mtk_eth *eth, u32 mask) static inline void mtk_irq_enable(struct mtk_eth *eth, u32 mask)
{ {
unsigned long flags;
u32 val; u32 val;
spin_lock_irqsave(&eth->irq_lock, flags);
val = mtk_r32(eth, MTK_QDMA_INT_MASK); val = mtk_r32(eth, MTK_QDMA_INT_MASK);
mtk_w32(eth, val | mask, MTK_QDMA_INT_MASK); mtk_w32(eth, val | mask, MTK_QDMA_INT_MASK);
spin_unlock_irqrestore(&eth->irq_lock, flags);
} }
static int mtk_set_mac_address(struct net_device *dev, void *p) static int mtk_set_mac_address(struct net_device *dev, void *p)
...@@ -1760,6 +1766,7 @@ static int mtk_probe(struct platform_device *pdev) ...@@ -1760,6 +1766,7 @@ static int mtk_probe(struct platform_device *pdev)
return PTR_ERR(eth->base); return PTR_ERR(eth->base);
spin_lock_init(&eth->page_lock); spin_lock_init(&eth->page_lock);
spin_lock_init(&eth->irq_lock);
eth->ethsys = syscon_regmap_lookup_by_phandle(pdev->dev.of_node, eth->ethsys = syscon_regmap_lookup_by_phandle(pdev->dev.of_node,
"mediatek,ethsys"); "mediatek,ethsys");
......
...@@ -373,6 +373,7 @@ struct mtk_eth { ...@@ -373,6 +373,7 @@ struct mtk_eth {
void __iomem *base; void __iomem *base;
struct reset_control *rstc; struct reset_control *rstc;
spinlock_t page_lock; spinlock_t page_lock;
spinlock_t irq_lock;
struct net_device dummy_dev; struct net_device dummy_dev;
struct net_device *netdev[MTK_MAX_DEVS]; struct net_device *netdev[MTK_MAX_DEVS];
struct mtk_mac *mac[MTK_MAX_DEVS]; struct mtk_mac *mac[MTK_MAX_DEVS];
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册