<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/drivers/pci/controller/pcie-mediatek.c, branch linux-5.4.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-5.4.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-5.4.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2024-02-23T07:24:47Z</updated>
<entry>
<title>PCI: mediatek: Clear interrupt status before dispatching handler</title>
<updated>2024-02-23T07:24:47Z</updated>
<author>
<name>qizhong cheng</name>
</author>
<published>2023-12-11T09:49:23Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=2ed05a8cc9b0e090694bb4902c2efea53e8ed08c'/>
<id>urn:sha1:2ed05a8cc9b0e090694bb4902c2efea53e8ed08c</id>
<content type='text'>
[ Upstream commit 4e11c29873a8a296a20f99b3e03095e65ebf897d ]

We found a failure when using the iperf tool during WiFi performance
testing, where some MSIs were received while clearing the interrupt
status, and these MSIs cannot be serviced.

The interrupt status can be cleared even if the MSI status remains pending.
As such, given the edge-triggered interrupt type, its status should be
cleared before being dispatched to the handler of the underling device.

[kwilczynski: commit log, code comment wording]
Link: https://lore.kernel.org/linux-pci/20231211094923.31967-1-jianjun.wang@mediatek.com
Fixes: 43e6409db64d ("PCI: mediatek: Add MSI support for MT2712 and MT7622")
Signed-off-by: qizhong cheng &lt;qizhong.cheng@mediatek.com&gt;
Signed-off-by: Jianjun Wang &lt;jianjun.wang@mediatek.com&gt;
Signed-off-by: Krzysztof Wilczyński &lt;kwilczynski@kernel.org&gt;
[bhelgaas: rewrap comment]
Signed-off-by: Bjorn Helgaas &lt;bhelgaas@google.com&gt;
Reviewed-by: AngeloGioacchino Del Regno &lt;angelogioacchino.delregno@collabora.com&gt;
Cc:  &lt;stable@vger.kernel.org&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>PCI: mediatek: Add missing of_node_put() to fix reference leak</title>
<updated>2021-03-17T16:03:44Z</updated>
<author>
<name>Krzysztof Wilczyński</name>
</author>
<published>2021-01-20T18:48:10Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=e622e01d44e4fb17a8eb21e5d791400ae789674e'/>
<id>urn:sha1:e622e01d44e4fb17a8eb21e5d791400ae789674e</id>
<content type='text'>
[ Upstream commit 42814c438aac79746d310f413a27d5b0b959c5de ]

The for_each_available_child_of_node helper internally makes use of the
of_get_next_available_child() which performs an of_node_get() on each
iteration when searching for next available child node.

Should an available child node be found, then it would return a device
node pointer with reference count incremented, thus early return from
the middle of the loop requires an explicit of_node_put() to prevent
reference count leak.

To stop the reference leak, explicitly call of_node_put() before
returning after an error occurred.

Link: https://lore.kernel.org/r/20210120184810.3068794-1-kw@linux.com
Signed-off-by: Krzysztof Wilczyński &lt;kw@linux.com&gt;
Signed-off-by: Lorenzo Pieralisi &lt;lorenzo.pieralisi@arm.com&gt;
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>Merge branch 'pci/trivial'</title>
<updated>2019-09-23T21:10:31Z</updated>
<author>
<name>Bjorn Helgaas</name>
</author>
<published>2019-09-23T21:10:31Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=c5048a73b4770304699cb15e3ffcb97acab685f7'/>
<id>urn:sha1:c5048a73b4770304699cb15e3ffcb97acab685f7</id>
<content type='text'>
  - Fix typos and whitespace errors (Bjorn Helgaas, Krzysztof Wilczynski)

  - Remove unnecessary "return" statements (Krzysztof Wilczynski)

  - Correct of_irq_parse_pci() function documentation (Lubomir Rintel)

* pci/trivial:
  PCI: Remove unnecessary returns
  PCI: OF: Correct of_irq_parse_pci() documentation
  PCI: Fix typos and whitespace errors
</content>
</entry>
<entry>
<title>PCI: Remove unnecessary returns</title>
<updated>2019-08-30T19:00:34Z</updated>
<author>
<name>Krzysztof Wilczynski</name>
</author>
<published>2019-08-25T22:10:39Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=55507aea58824578610eb0cb5c250a0c997987c9'/>
<id>urn:sha1:55507aea58824578610eb0cb5c250a0c997987c9</id>
<content type='text'>
Remove unnecessary "return" statements at the end of void functions.  No
functional change intended.

Link: https://lore.kernel.org/r/20190825221039.6977-1-kw@linux.com
Link: https://lore.kernel.org/r/20190826095143.21353-1-kw@linux.com
Signed-off-by: Krzysztof Wilczynski &lt;kw@linux.com&gt;
Signed-off-by: Bjorn Helgaas &lt;bhelgaas@google.com&gt;
</content>
</entry>
<entry>
<title>PCI: mediatek: Add controller support for MT7629</title>
<updated>2019-08-07T10:34:01Z</updated>
<author>
<name>Jianjun Wang</name>
</author>
<published>2019-06-28T07:34:25Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=0cccd42e6193e168cbecc271dae464e4a53fd7b3'/>
<id>urn:sha1:0cccd42e6193e168cbecc271dae464e4a53fd7b3</id>
<content type='text'>
MT7629 is an ARM platform SoC which has the same PCIe IP as MT7622.

The HW default value of its PCI host controller Device ID is invalid,
fix it to match the hardware implementation.

Signed-off-by: Jianjun Wang &lt;jianjun.wang@mediatek.com&gt;
[lorenzo.pieralisi@arm.com: commit log/minor spelling update]
Signed-off-by: Lorenzo Pieralisi &lt;lorenzo.pieralisi@arm.com&gt;
Reviewed-by: Andrew Murray &lt;andrew.murray@arm.com&gt;
Acked-by: Ryder Lee &lt;ryder.lee@mediatek.com&gt;
</content>
</entry>
<entry>
<title>Merge branch 'remotes/lorenzo/pci/misc'</title>
<updated>2019-05-13T23:34:44Z</updated>
<author>
<name>Bjorn Helgaas</name>
</author>
<published>2019-05-13T23:34:44Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=ee6df38da8485b143cc5eccee569ae3e238be10a'/>
<id>urn:sha1:ee6df38da8485b143cc5eccee569ae3e238be10a</id>
<content type='text'>
  - Exit pcitest with error code when test fails (Jean-Jacques Hiblot)

  - Fix leaked of_node references in dra7xx, uniphier, layerscape,
    rockchip, aardvark, iproc, mediatek, rpadlpar (Wen Yang)

  - Fix pcitest "help" option parsing (Kishon Vijay Abraham I)

  - Fix Makefile bug that inadvertently removes pcitest.sh (Kishon Vijay
    Abraham I)

  - Check for alloc_workqueue() failure in endpoint test driver (Kangjie
    Lu)

* remotes/lorenzo/pci/misc:
  PCI: endpoint: Fix a potential NULL pointer dereference
  tools: PCI: Handle pcitest.sh independently from pcitest
  tools: PCI: Add 'h' in optstring of getopt()
  PCI: mediatek: Fix a leaked reference by adding missing of_node_put()
  PCI: iproc: Fix a leaked reference by adding missing of_node_put()
  PCI: aardvark: Fix a leaked reference by adding missing of_node_put()
  PCI: rockchip: Fix a leaked reference by adding missing of_node_put()
  PCI: dwc: layerscape: Fix a leaked reference by adding missing of_node_put()
  PCI: uniphier: Fix a leaked reference by adding missing of_node_put()
  PCI: dwc: pci-dra7xx: Fix a leaked reference by adding missing of_node_put()
  tools: PCI: Exit with error code when test fails
</content>
</entry>
<entry>
<title>PCI: mediatek: Get optional clocks with devm_clk_get_optional()</title>
<updated>2019-04-11T08:56:01Z</updated>
<author>
<name>Chunfeng Yun</name>
</author>
<published>2019-04-10T06:54:16Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=6be22343cc546b46402869668da453d56921c14e'/>
<id>urn:sha1:6be22343cc546b46402869668da453d56921c14e</id>
<content type='text'>
Update the driver to use devm_clk_get_optional() to claim
optional clocks instead of devm_clk_get().

Signed-off-by: Chunfeng Yun &lt;chunfeng.yun@mediatek.com&gt;
Signed-off-by: Lorenzo Pieralisi &lt;lorenzo.pieralisi@arm.com&gt;
Acked-by: Ryder Lee &lt;ryder.lee@mediatek.com&gt;
Acked-by: Honghui Zhang &lt;honghui.zhang@mediatek.com&gt;
Cc: Ryder Lee &lt;ryder.lee@mediatek.com&gt;
Cc: Honghui Zhang &lt;honghui.zhang@mediatek.com&gt;
</content>
</entry>
<entry>
<title>PCI: mediatek: Fix a leaked reference by adding missing of_node_put()</title>
<updated>2019-04-01T09:42:58Z</updated>
<author>
<name>Wen Yang</name>
</author>
<published>2019-02-27T04:40:42Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=ff7a5a0a8562434f114035a5a4cbbeec5cb6320c'/>
<id>urn:sha1:ff7a5a0a8562434f114035a5a4cbbeec5cb6320c</id>
<content type='text'>
The call to of_get_next_child() returns a node pointer with refcount
incremented thus it must be explicitly decremented after the last
usage.

irq_domain_add_linear() also calls of_node_get() to increase refcount,
so irq_domain will not be affected when it is released.

Detected by coccinelle with the following warnings:
  ./drivers/pci/controller/pcie-mediatek.c:577:2-8: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 567, but without a corresponding object release within this function.
  ./drivers/pci/controller/pcie-mediatek.c:583:3-9: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 567, but without a corresponding object release within this function.
  ./drivers/pci/controller/pcie-mediatek.c:586:1-7: ERROR: missing of_node_put; acquired a node pointer with refcount incremented on line 567, but without a corresponding object release within this function.

Signed-off-by: Wen Yang &lt;wen.yang99@zte.com.cn&gt;
Signed-off-by: Lorenzo Pieralisi &lt;lorenzo.pieralisi@arm.com&gt;
Acked-by: Honghui Zhang &lt;honghui.zhang@mediatek.com&gt;
Cc: Ryder Lee &lt;ryder.lee@mediatek.com&gt;
Cc: Lorenzo Pieralisi &lt;lorenzo.pieralisi@arm.com&gt;
Cc: Bjorn Helgaas &lt;bhelgaas@google.com&gt;
Cc: Matthias Brugger &lt;matthias.bgg@gmail.com&gt;
Cc: linux-pci@vger.kernel.org
Cc: linux-mediatek@lists.infradead.org
Cc: linux-kernel@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
</content>
</entry>
<entry>
<title>PCI: mediatek: Enlarge PCIe2AHB window size to support 4GB DRAM</title>
<updated>2019-03-01T11:22:21Z</updated>
<author>
<name>Honghui Zhang</name>
</author>
<published>2019-02-01T05:36:07Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=cbe3a7728c7ad4721677208e155db06f67eb57d2'/>
<id>urn:sha1:cbe3a7728c7ad4721677208e155db06f67eb57d2</id>
<content type='text'>
The PCIE_AXI_WINDOW0 register defines the inbound window size for
requests coming from PCI endpoints. Requests outside of this window will
be treated as unsupported requests.

Enlarge this window size from 2^31 to 2^33 to support a 8GB address
space (which gives endpoints DMA access to full 4GB DRAM address range
- physical DRAM starts at 0x40000000).

Reported-by: Bjorn Helgaas &lt;bhelgaas@google.com&gt;
Signed-off-by: Honghui Zhang &lt;honghui.zhang@mediatek.com&gt;
[lorenzo.pieralisi@arm.com: updated commit log]
Signed-off-by: Lorenzo Pieralisi &lt;lorenzo.pieralisi@arm.com&gt;
</content>
</entry>
<entry>
<title>PCI: mediatek: Fix memory mapped IO range size computation</title>
<updated>2019-03-01T11:16:46Z</updated>
<author>
<name>Honghui Zhang</name>
</author>
<published>2019-02-01T05:36:06Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=c61df57343bf05743f8abbb31eec9a6f05820dd1'/>
<id>urn:sha1:c61df57343bf05743f8abbb31eec9a6f05820dd1</id>
<content type='text'>
Mediatek's HW assigns a MMIO address range (typically starts from
0x20000000 to 0x2fffffff for both mt2712 and mt7622) for PCI usage.

This MMIO address space represents the address space that can
be allocated to PCI devices through Base Address Registers.

Even though the full MMIO address range is available to be allocated, it
should be enabled by the PCIE_AHB_TRANS_BASE register in the host
controller and the size that is enabled is determined by AHB2PCIE_SIZE
bits in this register.

Owing to a bug in the MMIO window size computation, current code does
not enable the full size of the available MMIO address range in the
PCI host controller; if the PCI devices BARs requested size exceeds the
size enabled through the PCIE_AHB_TRANS_BASE register the requests
targeting the disabled address address space will be blocked by the root
complex causing a system error.

Existing code has never run into a system error in production because
even half of the enabled MMIO range (128MB) is big enough for typical
devices BAR requests (4MB) but the full MMIO address range should
be enabled regardless.

Fix the MMIO window size computation by using resource_size(mem) instead
of mem-&gt;end - mem-&gt;start.

Since the MMIO window size for both MT2712 and MT7622 is 0x10000000,
this change will update the parameter passed to fls() from 0xfffffff to
0x10000000 and calculate the whole memory mapped IO range size
correctly.

Detected through coccinelle semantic patch (and related warning):

scripts/coccinelle/api/resource_size.cocci:

pcie-mediatek.c:720:13-16: WARNING: Suspicious code. resource_size is maybe missing with mem

Signed-off-by: Honghui Zhang &lt;honghui.zhang@mediatek.com&gt;
[lorenzo.pieralisi@arm.com: rewrote the commit log]
Signed-off-by: Lorenzo Pieralisi &lt;lorenzo.pieralisi@arm.com&gt;
</content>
</entry>
</feed>
