From: Damien Le Moal <dlemoal@kernel.org>
To: "Manivannan Sadhasivam" <manivannan.sadhasivam@linaro.org>,
"Krzysztof Wilczyński" <kw@linux.com>,
"Kishon Vijay Abraham I" <kishon@kernel.org>,
"Bjorn Helgaas" <bhelgaas@google.com>,
"Lorenzo Pieralisi" <lpieralisi@kernel.org>,
"Rob Herring" <robh@kernel.org>,
"Jonathan Corbet" <corbet@lwn.net>,
"Jingoo Han" <jingoohan1@gmail.com>,
linux-pci@vger.kernel.org
Cc: Rick Wertenbroek <rick.wertenbroek@gmail.com>,
Niklas Cassel <cassel@kernel.org>
Subject: [PATCH] PCI: endpoint: Improve pci_epc_ops::align_addr() interface
Date: Tue, 15 Oct 2024 15:47:18 +0900 [thread overview]
Message-ID: <20241015064718.111952-1-dlemoal@kernel.org> (raw)
The PCI endpoint controller operation interface for the align_addr()
operation uses the phys_addr_t type for the PCI address argument and
return a value using this type. This is not ideal as PCI addresses are
bus addresses, not memory physical addresses. Replace the use of
phys_addr_t for this operation with the generic u64 type. To be
consistent with this change the Designware driver implementation of this
operation (function dw_pcie_ep_align_addr()) is also changed.
Fixes: e98c99e2ccad ("PCI: endpoint: Introduce pci_epc_mem_map()/unmap()")
Fixes: cb6b7158fdf5 ("PCI: dwc: endpoint: Implement the pci_epc_ops::align_addr() operation")
Signed-off-by: Damien Le Moal <dlemoal@kernel.org>
---
drivers/pci/controller/dwc/pcie-designware-ep.c | 6 +++---
include/linux/pci-epc.h | 4 ++--
2 files changed, 5 insertions(+), 5 deletions(-)
diff --git a/drivers/pci/controller/dwc/pcie-designware-ep.c b/drivers/pci/controller/dwc/pcie-designware-ep.c
index 0ada60487c25..df1460ed63d9 100644
--- a/drivers/pci/controller/dwc/pcie-designware-ep.c
+++ b/drivers/pci/controller/dwc/pcie-designware-ep.c
@@ -268,12 +268,12 @@ static int dw_pcie_find_index(struct dw_pcie_ep *ep, phys_addr_t addr,
return -EINVAL;
}
-static phys_addr_t dw_pcie_ep_align_addr(struct pci_epc *epc,
- phys_addr_t pci_addr, size_t *pci_size, size_t *offset)
+static u64 dw_pcie_ep_align_addr(struct pci_epc *epc, u64 pci_addr,
+ size_t *pci_size, size_t *offset)
{
struct dw_pcie_ep *ep = epc_get_drvdata(epc);
struct dw_pcie *pci = to_dw_pcie_from_ep(ep);
- phys_addr_t mask = pci->region_align - 1;
+ u64 mask = pci->region_align - 1;
size_t ofst = pci_addr & mask;
*pci_size = ALIGN(ofst + *pci_size, ep->page_size);
diff --git a/include/linux/pci-epc.h b/include/linux/pci-epc.h
index f4b8dc37e447..ff208fd4526b 100644
--- a/include/linux/pci-epc.h
+++ b/include/linux/pci-epc.h
@@ -93,8 +93,8 @@ struct pci_epc_ops {
struct pci_epf_bar *epf_bar);
void (*clear_bar)(struct pci_epc *epc, u8 func_no, u8 vfunc_no,
struct pci_epf_bar *epf_bar);
- phys_addr_t (*align_addr)(struct pci_epc *epc, phys_addr_t pci_addr,
- size_t *size, size_t *offset);
+ u64 (*align_addr)(struct pci_epc *epc, u64 pci_addr, size_t *size,
+ size_t *offset);
int (*map_addr)(struct pci_epc *epc, u8 func_no, u8 vfunc_no,
phys_addr_t addr, u64 pci_addr, size_t size);
void (*unmap_addr)(struct pci_epc *epc, u8 func_no, u8 vfunc_no,
--
2.47.0
next reply other threads:[~2024-10-15 6:47 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-10-15 6:47 Damien Le Moal [this message]
2024-10-15 7:24 ` [PATCH] PCI: endpoint: Improve pci_epc_ops::align_addr() interface Niklas Cassel
2024-10-15 9:02 ` Niklas Cassel
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=20241015064718.111952-1-dlemoal@kernel.org \
--to=dlemoal@kernel.org \
--cc=bhelgaas@google.com \
--cc=cassel@kernel.org \
--cc=corbet@lwn.net \
--cc=jingoohan1@gmail.com \
--cc=kishon@kernel.org \
--cc=kw@linux.com \
--cc=linux-pci@vger.kernel.org \
--cc=lpieralisi@kernel.org \
--cc=manivannan.sadhasivam@linaro.org \
--cc=rick.wertenbroek@gmail.com \
--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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.