PCI: epf-mhi: Simulate async read/write using iATU
authorManivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Mon, 27 Nov 2023 10:18:54 +0000 (15:48 +0530)
committerManivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Thu, 14 Dec 2023 06:28:53 +0000 (11:58 +0530)
Even though iATU only supports synchronous read/write, the MHI stack may
call async read/write callbacks without knowing the limitations of the
controller driver. So in order to maintain compatibility, let's simulate
async read/write operation with iATU by invoking the completion callback
after memcpy.

Acked-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Krzysztof WilczyƄski <kw@linux.com>
Signed-off-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
drivers/pci/endpoint/functions/pci-epf-mhi.c

index 2c5b627eb5ee64e26505f451fd6f348b8c86edff..d9f45822e6705d3b8c01591fdab2782c2b1b1371 100644 (file)
@@ -234,6 +234,9 @@ static int pci_epf_mhi_iatu_read(struct mhi_ep_cntrl *mhi_cntrl,
 
        mutex_unlock(&epf_mhi->lock);
 
+       if (buf_info->cb)
+               buf_info->cb(buf_info);
+
        return 0;
 }
 
@@ -262,6 +265,9 @@ static int pci_epf_mhi_iatu_write(struct mhi_ep_cntrl *mhi_cntrl,
 
        mutex_unlock(&epf_mhi->lock);
 
+       if (buf_info->cb)
+               buf_info->cb(buf_info);
+
        return 0;
 }