mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Rick Wertenbroek <rick.wertenbroek@gmail.com>
To: rick.wertenbroek@heig-vd.ch
Cc: dlemoal@kernel.org, alberto.dassatti@heig-vd.ch,
	"Rick Wertenbroek" <rick.wertenbroek@gmail.com>,
	"Manivannan Sadhasivam" <manivannan.sadhasivam@linaro.org>,
	"Krzysztof Wilczyński" <kw@linux.com>,
	"Kishon Vijay Abraham I" <kishon@kernel.org>,
	"Bjorn Helgaas" <bhelgaas@google.com>,
	"Niklas Cassel" <cassel@kernel.org>,
	"Frank Li" <Frank.Li@nxp.com>,
	"Lars-Peter Clausen" <lars@metafoo.de>,
	linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [PATCH v3 1/1] PCI: endpoint: pci-epf-test: Call pci_epf_test_raise_irq() on failed DMA check
Date: Tue, 20 Aug 2024 09:10:58 +0200	[thread overview]
Message-ID: <20240820071100.211622-2-rick.wertenbroek@gmail.com> (raw)
In-Reply-To: <20240820071100.211622-1-rick.wertenbroek@gmail.com>

The pci-epf-test PCI endpoint function /drivers/pci/endpoint/function/pci-epf_test.c
is meant to be used in a PCI endpoint device connected to a host computer
with the host side driver: /drivers/misc/pci_endpoint_test.c.

The host side driver can request read/write/copy transactions from the
endpoint function and expects an IRQ from the endpoint function once
the read/write/copy transaction is finished. These can be issued with or
without DMA enabled. If the host side driver requests a read/write/copy
transaction with DMA enabled and the endpoint function does not support
DMA, the endpoint would only print an error message and wait for further
commands without sending an IRQ because pci_epf_test_raise_irq() is
skipped in pci_epf_test_cmd_handler(). This results in the host side
driver hanging indefinitely waiting for the IRQ.

Call pci_epf_test_raise_irq() when a transfer with DMA is requested but
DMA is unsupported. The host side driver will no longer hang but report
an error on transfer (printing "NOT OKAY") thanks to the checksum because
no data was moved.

Clarify the error message in the endpoint function as "Cannot ..." is
vague and does not state the reason why it cannot be done.

Signed-off-by: Rick Wertenbroek <rick.wertenbroek@gmail.com>
---
 drivers/pci/endpoint/functions/pci-epf-test.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/pci/endpoint/functions/pci-epf-test.c b/drivers/pci/endpoint/functions/pci-epf-test.c
index 7c2ed6eae53a..b02193cef06e 100644
--- a/drivers/pci/endpoint/functions/pci-epf-test.c
+++ b/drivers/pci/endpoint/functions/pci-epf-test.c
@@ -649,7 +649,8 @@ static void pci_epf_test_cmd_handler(struct work_struct *work)
 
 	if ((READ_ONCE(reg->flags) & FLAG_USE_DMA) &&
 	    !epf_test->dma_supported) {
-		dev_err(dev, "Cannot transfer data using DMA\n");
+		dev_err(dev, "DMA transfer not supported\n");
+		pci_epf_test_raise_irq(epf_test, reg);
 		goto reset_handler;
 	}
 
-- 
2.25.1


  reply	other threads:[~2024-08-20  7:11 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-08-20  7:10 [PATCH v3 0/1] PCI: endpoint: pci-epf-test: Call Rick Wertenbroek
2024-08-20  7:10 ` Rick Wertenbroek [this message]
2024-08-20  8:18   ` [PATCH v3 1/1] PCI: endpoint: pci-epf-test: Call pci_epf_test_raise_irq() on failed DMA check Damien Le Moal
2024-08-20  8:43     ` Rick Wertenbroek
2024-08-20  8:46       ` Damien Le Moal
2024-08-20  9:23       ` Manivannan Sadhasivam

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20240820071100.211622-2-rick.wertenbroek@gmail.com \
    --to=rick.wertenbroek@gmail.com \
    --cc=Frank.Li@nxp.com \
    --cc=alberto.dassatti@heig-vd.ch \
    --cc=bhelgaas@google.com \
    --cc=cassel@kernel.org \
    --cc=dlemoal@kernel.org \
    --cc=kishon@kernel.org \
    --cc=kw@linux.com \
    --cc=lars@metafoo.de \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=manivannan.sadhasivam@linaro.org \
    --cc=rick.wertenbroek@heig-vd.ch \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®