<feed xmlns='http://www.w3.org/2005/Atom'>
<title>kernel.git/drivers/pci/endpoint, branch linux-6.17.y</title>
<subtitle>Hosts the 0x221E linux distro kernel.
</subtitle>
<id>https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-6.17.y</id>
<link rel='self' href='https://git.0xinfinity.dev/distro/kernel.git/atom?h=linux-6.17.y'/>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/'/>
<updated>2025-12-18T12:59:23Z</updated>
<entry>
<title>PCI: endpoint: pci-epf-test: Fix sleeping function being called from atomic context</title>
<updated>2025-12-18T12:59:23Z</updated>
<author>
<name>Bhanu Seshu Kumar Valluri</name>
</author>
<published>2025-10-14T02:41:09Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=01cbf3e5fd8de858397d78fd2176361769ad2f42'/>
<id>urn:sha1:01cbf3e5fd8de858397d78fd2176361769ad2f42</id>
<content type='text'>
[ Upstream commit 25423cda145f9ed6ee4a72d9f2603ac2a4685e74 ]

When Root Complex (RC) triggers a Doorbell interrupt to Endpoint (EP), it
triggers the below warning in the EP:

 BUG: sleeping function called from invalid context at kernel/locking/mutex.c:271
 Call trace:
  __might_resched+0x130/0x158
  __might_sleep+0x70/0x88
  mutex_lock+0x2c/0x80
  pci_epc_get_msi+0x78/0xd8
  pci_epf_test_raise_irq.isra.0+0x74/0x138
  pci_epf_test_doorbell_handler+0x34/0x50

The BUG arises because the EP's pci_epf_test_doorbell_handler() which is
running in the hard IRQ context is making an indirect call to
pci_epc_get_msi(), which uses mutex inside.

To fix the issue, convert the hard IRQ handler to a threaded IRQ handler to
allow it to call functions that can sleep during bottom half execution.
Also, register the threaded IRQ handler with IRQF_ONESHOT to keep the
interrupt line disabled until the threaded IRQ handler completes execution.

Fixes: eff0c286aa91 ("PCI: endpoint: pci-epf-test: Add doorbell test support")
Signed-off-by: Bhanu Seshu Kumar Valluri &lt;bhanuseshukumar@gmail.com&gt;
[mani: reworded description a bit]
Signed-off-by: Manivannan Sadhasivam &lt;mani@kernel.org&gt;
Reviewed-by: Niklas Cassel &lt;cassel@kernel.org&gt;
Reviewed-by: Frank Li &lt;Frank.Li@nxp.com&gt;
Link: https://patch.msgid.link/20251014024109.42287-1-bhanuseshukumar@gmail.com
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>PCI: endpoint: pci-epf-test: Limit PCIe BAR size for fixed BARs</title>
<updated>2025-11-13T20:37:16Z</updated>
<author>
<name>Marek Vasut</name>
</author>
<published>2025-09-05T18:42:10Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=63f62b69abd4132f9d486f9b5fa57c1d5f3796de'/>
<id>urn:sha1:63f62b69abd4132f9d486f9b5fa57c1d5f3796de</id>
<content type='text'>
[ Upstream commit d5f6bd3ee3f5048f272182dc91675c082773999e ]

Currently, the test allocates BAR sizes according to fixed table bar_size.
This does not work with controllers which have fixed size BARs that are
smaller than the requested BAR size. One such controller is Renesas R-Car
V4H PCIe controller, which has BAR4 size limited to 256 bytes, which is
much less than one of the BAR size, 131072 currently requested by this
test. A lot of controllers drivers in-tree have fixed size BARs, and they
do work perfectly fine, but it is only because their fixed size is larger
than the size requested by pci-epf-test.c

Adjust the test such that in case a fixed size BAR is detected, the fixed
BAR size is used, as that is the only possible option.

This helps with test failures reported as follows:

  pci_epf_test pci_epf_test.0: requested BAR size is larger than fixed size
  pci_epf_test pci_epf_test.0: Failed to allocate space for BAR4

Signed-off-by: Marek Vasut &lt;marek.vasut+renesas@mailbox.org&gt;
[mani: reworded description]
Signed-off-by: Manivannan Sadhasivam &lt;mani@kernel.org&gt;
Signed-off-by: Bjorn Helgaas &lt;bhelgaas@google.com&gt;
Reviewed-by: Niklas Cassel &lt;cassel@kernel.org&gt;
Link: https://patch.msgid.link/20250905184240.144431-1-marek.vasut+renesas@mailbox.org
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>PCI: endpoint: pci-epf-test: Add NULL check for DMA channels before release</title>
<updated>2025-10-15T10:04:22Z</updated>
<author>
<name>Shin'ichiro Kawasaki</name>
</author>
<published>2025-09-16T02:57:56Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=57f7fb0d1ac28540c0f6405c829bb9c3b89d8dba'/>
<id>urn:sha1:57f7fb0d1ac28540c0f6405c829bb9c3b89d8dba</id>
<content type='text'>
commit 85afa9ea122dd9d4a2ead104a951d318975dcd25 upstream.

The fields dma_chan_tx and dma_chan_rx of the struct pci_epf_test can be
NULL even after EPF initialization. Then it is prudent to check that
they have non-NULL values before releasing the channels. Add the checks
in pci_epf_test_clean_dma_chan().

Without the checks, NULL pointer dereferences happen and they can lead
to a kernel panic in some cases:

  Unable to handle kernel NULL pointer dereference at virtual address 0000000000000050
  Call trace:
   dma_release_channel+0x2c/0x120 (P)
   pci_epf_test_epc_deinit+0x94/0xc0 [pci_epf_test]
   pci_epc_deinit_notify+0x74/0xc0
   tegra_pcie_ep_pex_rst_irq+0x250/0x5d8
   irq_thread_fn+0x34/0xb8
   irq_thread+0x18c/0x2e8
   kthread+0x14c/0x210
   ret_from_fork+0x10/0x20

Fixes: 8353813c88ef ("PCI: endpoint: Enable DMA tests for endpoints with DMA capabilities")
Fixes: 5ebf3fc59bd2 ("PCI: endpoint: functions/pci-epf-test: Add DMA support to transfer data")
Signed-off-by: Shin'ichiro Kawasaki &lt;shinichiro.kawasaki@wdc.com&gt;
[mani: trimmed the stack trace]
Signed-off-by: Manivannan Sadhasivam &lt;mani@kernel.org&gt;
Reviewed-by: Damien Le Moal &lt;dlemoal@kernel.org&gt;
Reviewed-by: Krzysztof Wilczyński &lt;kwilczynski@kernel.org&gt;
Cc: stable@vger.kernel.org
Link: https://patch.msgid.link/20250916025756.34807-1-shinichiro.kawasaki@wdc.com
Signed-off-by: Greg Kroah-Hartman &lt;gregkh@linuxfoundation.org&gt;
</content>
</entry>
<entry>
<title>PCI: endpoint: pci-epf-test: Fix doorbell test support</title>
<updated>2025-10-15T10:03:57Z</updated>
<author>
<name>Niklas Cassel</name>
</author>
<published>2025-09-08T16:19:42Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=b3172ec3ab2d2755b188bbf8ef2050f5d5efa27b'/>
<id>urn:sha1:b3172ec3ab2d2755b188bbf8ef2050f5d5efa27b</id>
<content type='text'>
[ Upstream commit f272210b28d050df56ec7dfaecb9fa3bebca6419 ]

The doorbell feature temporarily overrides the inbound translation to point
to the address stored in epf_test-&gt;db_bar.phys_addr, i.e., it calls
set_bar() twice without ever calling clear_bar(), as calling clear_bar()
would clear the BAR's PCI address assigned by the host.

Thus, when disabling the doorbell, restore the inbound translation to point
to the memory allocated for the BAR.

Without this, running the PCI endpoint kselftest doorbell test case more
than once would fail.

Fixes: eff0c286aa91 ("PCI: endpoint: pci-epf-test: Add doorbell test support")
Signed-off-by: Niklas Cassel &lt;cassel@kernel.org&gt;
Signed-off-by: Manivannan Sadhasivam &lt;mani@kernel.org&gt;
Signed-off-by: Bjorn Helgaas &lt;bhelgaas@google.com&gt;
Reviewed-by: Frank Li &lt;Frank.Li@nxp.com&gt;
Link: https://patch.msgid.link/20250908161942.534799-2-cassel@kernel.org
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>PCI: endpoint: pci-ep-msi: Fix NULL vs IS_ERR() check in pci_epf_write_msi_msg()</title>
<updated>2025-10-15T10:03:40Z</updated>
<author>
<name>Dan Carpenter</name>
</author>
<published>2025-08-01T13:34:45Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=325ad20f85191b8198c6a8efcad7a4687698779e'/>
<id>urn:sha1:325ad20f85191b8198c6a8efcad7a4687698779e</id>
<content type='text'>
[ Upstream commit 57a75fa9d56e310e883e4377205690e88c05781b ]

The pci_epc_get() function returns error pointers. It never returns NULL.
Update the check to match.

Fixes: 1c3b002c6bf6 ("PCI: endpoint: Add RC-to-EP doorbell support using platform MSI controller")
Signed-off-by: Dan Carpenter &lt;dan.carpenter@linaro.org&gt;
Signed-off-by: Manivannan Sadhasivam &lt;mani@kernel.org&gt;
Reviewed-by: Frank Li &lt;Frank.Li@nxp.com&gt;
Link: https://patch.msgid.link/aIzCdV8jyBeql-Oa@stanley.mountain
Signed-off-by: Sasha Levin &lt;sashal@kernel.org&gt;
</content>
</entry>
<entry>
<title>Merge branch 'pci/endpoint/epf-vntb'</title>
<updated>2025-07-31T21:11:46Z</updated>
<author>
<name>Bjorn Helgaas</name>
</author>
<published>2025-07-31T21:11:46Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=7f837a2648a614337a879cc2f7131c3015e8557b'/>
<id>urn:sha1:7f837a2648a614337a879cc2f7131c3015e8557b</id>
<content type='text'>
- Return -ENOENT (not -1) if pci_epc_get_next_free_bar() fails (Jerome
  Brunet)

- Align MW (memory window) naming with config names (Jerome Brunet)

- Allow BAR assignment via configfs so platforms have flexibility in
  determining BAR usage (Jerome Brunet)

- Drop incorrect '__iomem' annotation on the return value of
  pci_epf_alloc_space(); this also fixes an sparse warning (Manivannan
  Sadhasivam)

* pci/endpoint/epf-vntb:
  PCI: endpoint: pci-epf-vntb: Fix the incorrect usage of __iomem attribute
  PCI: endpoint: pci-epf-vntb: Allow BAR assignment via configfs
  PCI: endpoint: pci-epf-vntb: Align MW naming with config names
  PCI: endpoint: pci-epf-vntb: Return -ENOENT if pci_epc_get_next_free_bar() fails
</content>
</entry>
<entry>
<title>Merge branch 'pci/endpoint/doorbell'</title>
<updated>2025-07-31T21:11:45Z</updated>
<author>
<name>Bjorn Helgaas</name>
</author>
<published>2025-07-31T21:11:45Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=63e6f0df6a07945709c02822e89ec61ce7fe7c9a'/>
<id>urn:sha1:63e6f0df6a07945709c02822e89ec61ce7fe7c9a</id>
<content type='text'>
- Add RC-to-EP doorbell support using platform MSI controller (Frank Li)

- Check for MSI parent and mutability since we currently don't support
  mutable MSI controllers (Frank Li)

- Add pci_epf_align_inbound_addr() helper (Frank Li)

- Add a doorbell test (Frank Li)

* pci/endpoint/doorbell:
  selftests: pci_endpoint: Add doorbell test case
  misc: pci_endpoint_test: Add doorbell test case
  PCI: endpoint: pci-epf-test: Add doorbell test support
  PCI: endpoint: Add pci_epf_align_inbound_addr() helper for inbound address alignment
  PCI: endpoint: pci-ep-msi: Add checks for MSI parent and mutability
  PCI: endpoint: Add RC-to-EP doorbell support using platform MSI controller
</content>
</entry>
<entry>
<title>PCI: endpoint: pci-epf-test: Add doorbell test support</title>
<updated>2025-07-24T21:51:43Z</updated>
<author>
<name>Frank Li</name>
</author>
<published>2025-07-10T19:13:52Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=eff0c286aa916221a69126a43eee7c218d6f4011'/>
<id>urn:sha1:eff0c286aa916221a69126a43eee7c218d6f4011</id>
<content type='text'>
Add doorbell support by allocating a dedicated BAR using the
pci_epf_alloc_doorbell() API and mapping the Endpoint MSI controller
message data address to it. The data to be written in the message address
is stored in the 'pci_epf_test_reg::doorbell_data' register. Finally, the
RC can trigger doorbell in the Endpoint by writing the content of
'doorbell_data' register to the offset specified in 'doorbell_offset' of
the 'doorbell_bar' BAR.

Triggering of the doorbell is detected by pci_epf_test_doorbell_handler(),
which is bound to the doorbell IRQ. On successful completion,
STATUS_DOORBELL_SUCCESS status is set in the above mentioned handler.

To avoid breaking compatibility between host and endpoint, add two new
commands: COMMAND_ENABLE_DOORBELL and COMMAND_DISABLE_DOORBELL.

The doorbell is allocated when COMMAND_ENABLE_DOORBELL command is called
and destroyed when COMMAND_DISABLE_DOORBELL is called.

This doorbell feature only works when both RC and EP drivers support it.
If one of them doesn't support the feature, the testcase will fail.

Signed-off-by: Frank Li &lt;Frank.Li@nxp.com&gt;
[mani: code cleanups and reworded commit message]
Signed-off-by: Manivannan Sadhasivam &lt;mani@kernel.org&gt;
Signed-off-by: Bjorn Helgaas &lt;bhelgaas@google.com&gt;
Tested-by: Niklas Cassel &lt;cassel@kernel.org&gt;
Link: https://patch.msgid.link/20250710-ep-msi-v21-6-57683fc7fb25@nxp.com
</content>
</entry>
<entry>
<title>PCI: endpoint: Add pci_epf_align_inbound_addr() helper for inbound address alignment</title>
<updated>2025-07-24T21:51:41Z</updated>
<author>
<name>Frank Li</name>
</author>
<published>2025-07-10T19:13:51Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=4ff4252a2355f585c5cad8dc959ff1097300aa47'/>
<id>urn:sha1:4ff4252a2355f585c5cad8dc959ff1097300aa47</id>
<content type='text'>
Add pci_epf_align_inbound_addr() to align the inbound addresses according
to PCI BAR alignment requirements. The aligned base address and offset are
returned via 'base' and 'off' parameters.

Signed-off-by: Frank Li &lt;Frank.Li@nxp.com&gt;
[mani: reworded kernel-doc and commit message]
Signed-off-by: Manivannan Sadhasivam &lt;mani@kernel.org&gt;
Signed-off-by: Bjorn Helgaas &lt;bhelgaas@google.com&gt;
Tested-by: Niklas Cassel &lt;cassel@kernel.org&gt;
Link: https://patch.msgid.link/20250710-ep-msi-v21-5-57683fc7fb25@nxp.com
</content>
</entry>
<entry>
<title>PCI: endpoint: pci-ep-msi: Add checks for MSI parent and mutability</title>
<updated>2025-07-24T21:51:37Z</updated>
<author>
<name>Frank Li</name>
</author>
<published>2025-07-10T19:13:50Z</published>
<link rel='alternate' type='text/html' href='https://git.0xinfinity.dev/distro/kernel.git/commit/?id=c822392280aa9bc57ad3b5079020388950cce9c8'/>
<id>urn:sha1:c822392280aa9bc57ad3b5079020388950cce9c8</id>
<content type='text'>
Some MSI controllers can change address/data pair during the execution of
irq_chip::irq_set_affinity() callback. Since the current PCI Endpoint
framework cannot support mutable MSI controllers, call
irq_domain_is_msi_immutable() API to check if the controller is immutable
or not.

Also ensure that the MSI domain is a parent MSI domain so that it can
allocate address/data pairs.

Signed-off-by: Frank Li &lt;Frank.Li@nxp.com&gt;
[mani: reworded error message and commit message]
Signed-off-by: Manivannan Sadhasivam &lt;mani@kernel.org&gt;
Signed-off-by: Bjorn Helgaas &lt;bhelgaas@google.com&gt;
Tested-by: Niklas Cassel &lt;cassel@kernel.org&gt;
Link: https://patch.msgid.link/20250710-ep-msi-v21-4-57683fc7fb25@nxp.com
</content>
</entry>
</feed>
