From: Shunsuke Mie <mie@igel.co.jp>
To: Jingoo Han <jingoohan1@gmail.com>
Cc: "Gustavo Pimentel" <gustavo.pimentel@synopsys.com>,
"Lorenzo Pieralisi" <lpieralisi@kernel.org>,
"Rob Herring" <robh@kernel.org>,
"Krzysztof Wilczyński" <kw@linux.com>,
"Bjorn Helgaas" <bhelgaas@google.com>,
"Manivannan Sadhasivam" <mani@kernel.org>,
"Kishon Vijay Abraham I" <kishon@kernel.org>,
"Shunsuke Mie" <mie@igel.co.jp>,
"Kunihiko Hayashi" <hayashi.kunihiko@socionext.com>,
"Hou Zhiqiang" <Zhiqiang.Hou@nxp.com>,
"Frank Li" <Frank.Li@nxp.com>, "Li Chen" <lchen@ambarella.com>,
linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: [RFC PATCH 2/3] PCI: dwc: support align_mem() callback for pci_epc_epc
Date: Fri, 13 Jan 2023 18:03:49 +0900 [thread overview]
Message-ID: <20230113090350.1103494-3-mie@igel.co.jp> (raw)
In-Reply-To: <20230113090350.1103494-1-mie@igel.co.jp>
DWC PCIe EPC driver has alignment restriction for mapping as
pci->region_align. Use it to align memory.
Signed-off-by: Shunsuke Mie <mie@igel.co.jp>
---
drivers/pci/controller/dwc/pcie-designware-ep.c | 13 +++++++++++++
1 file changed, 13 insertions(+)
diff --git a/drivers/pci/controller/dwc/pcie-designware-ep.c b/drivers/pci/controller/dwc/pcie-designware-ep.c
index d06654895eba..7a7d7513b612 100644
--- a/drivers/pci/controller/dwc/pcie-designware-ep.c
+++ b/drivers/pci/controller/dwc/pcie-designware-ep.c
@@ -444,6 +444,18 @@ static void dw_pcie_ep_stop(struct pci_epc *epc)
dw_pcie_stop_link(pci);
}
+static u64 dw_pcie_ep_align_mem(struct pci_epc *epc, u64 addr, size_t *size)
+{
+ struct dw_pcie_ep *ep = epc_get_drvdata(epc);
+ struct dw_pcie *pci = to_dw_pcie_from_ep(ep);
+ u64 aaddr;
+
+ aaddr = ALIGN_DOWN(addr, pci->region_align);
+ *size += addr - aaddr;
+
+ return aaddr;
+}
+
static int dw_pcie_ep_start(struct pci_epc *epc)
{
struct dw_pcie_ep *ep = epc_get_drvdata(epc);
@@ -474,6 +486,7 @@ static const struct pci_epc_ops epc_ops = {
.set_msix = dw_pcie_ep_set_msix,
.get_msix = dw_pcie_ep_get_msix,
.raise_irq = dw_pcie_ep_raise_irq,
+ .align_mem = dw_pcie_ep_align_mem,
.start = dw_pcie_ep_start,
.stop = dw_pcie_ep_stop,
.get_features = dw_pcie_ep_get_features,
--
2.25.1
next prev parent reply other threads:[~2023-01-13 9:05 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-13 9:03 [RFC PATCH 0/3] Deal with alignment restriction on EP side Shunsuke Mie
2023-01-13 9:03 ` [RFC PATCH 1/3] PCI: endpoint: support an alignment aware map/unmaping Shunsuke Mie
2023-01-17 20:41 ` Bjorn Helgaas
2023-01-18 10:33 ` Shunsuke Mie
2023-06-01 15:06 ` Kishon Vijay Abraham I
2023-06-01 23:43 ` Damien Le Moal
2023-06-02 9:42 ` Shunsuke Mie
2023-06-02 12:21 ` Damien Le Moal
2023-06-05 10:34 ` Shunsuke Mie
2023-06-02 11:39 ` Kishon Vijay Abraham I
2023-06-02 12:10 ` Damien Le Moal
2023-06-05 7:54 ` Manivannan Sadhasivam
2023-01-13 9:03 ` Shunsuke Mie [this message]
2023-01-13 9:03 ` [RFC PATCH 3/3] PCI: endpoint: support pci_epc_mem_map/unmap API changes Shunsuke Mie
2023-01-17 20:32 ` [RFC PATCH 0/3] Deal with alignment restriction on EP side Bjorn Helgaas
2023-01-18 10:17 ` Shunsuke Mie
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=20230113090350.1103494-3-mie@igel.co.jp \
--to=mie@igel.co.jp \
--cc=Frank.Li@nxp.com \
--cc=Zhiqiang.Hou@nxp.com \
--cc=bhelgaas@google.com \
--cc=gustavo.pimentel@synopsys.com \
--cc=hayashi.kunihiko@socionext.com \
--cc=jingoohan1@gmail.com \
--cc=kishon@kernel.org \
--cc=kw@linux.com \
--cc=lchen@ambarella.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=lpieralisi@kernel.org \
--cc=mani@kernel.org \
--cc=robh@kernel.org \
/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