From: Daniel Axtens <dja@axtens.net>
To: linuxppc-dev@ozlabs.org
Cc: Daniel Axtens <dja@axtens.net>
Subject: [PATCH 2/3] powerpc/pci: add dma_set_mask to pci_controller_ops
Date: Tue, 28 Apr 2015 15:12:06 +1000 [thread overview]
Message-ID: <1430197927-24814-3-git-send-email-dja@axtens.net> (raw)
In-Reply-To: <1430197927-24814-1-git-send-email-dja@axtens.net>
Some systems only need to deal with DMA masks for PCI devices.
For these systems, we can avoid the need for a platform hook and
instead use a pci controller based hook.
Signed-off-by: Daniel Axtens <dja@axtens.net>
---
arch/powerpc/include/asm/pci-bridge.h | 2 ++
arch/powerpc/kernel/dma.c | 11 +++++++++++
2 files changed, 13 insertions(+)
diff --git a/arch/powerpc/include/asm/pci-bridge.h b/arch/powerpc/include/asm/pci-bridge.h
index a3b6252..6d17bb8 100644
--- a/arch/powerpc/include/asm/pci-bridge.h
+++ b/arch/powerpc/include/asm/pci-bridge.h
@@ -36,6 +36,8 @@ struct pci_controller_ops {
int nvec, int type);
void (*teardown_msi_irqs)(struct pci_dev *dev);
#endif
+
+ int (*dma_set_mask)(struct pci_dev *dev, u64 dma_mask);
};
/*
diff --git a/arch/powerpc/kernel/dma.c b/arch/powerpc/kernel/dma.c
index 484b2d4..1acf19c 100644
--- a/arch/powerpc/kernel/dma.c
+++ b/arch/powerpc/kernel/dma.c
@@ -246,8 +246,19 @@ int __dma_set_mask(struct device *dev, u64 dma_mask)
int dma_set_mask(struct device *dev, u64 dma_mask)
{
+ struct pci_dev *pdev;
+ struct pci_controller *phb;
+
if (ppc_md.dma_set_mask)
return ppc_md.dma_set_mask(dev, dma_mask);
+
+ if (dev_is_pci(dev)) {
+ pdev = to_pci_dev(dev);
+ phb = pci_bus_to_host(pdev->bus);
+ if (phb->controller_ops.dma_set_mask)
+ return phb->controller_ops.dma_set_mask(pdev, dma_mask);
+ }
+
return __dma_set_mask(dev, dma_mask);
}
EXPORT_SYMBOL(dma_set_mask);
--
2.1.4
next prev parent reply other threads:[~2015-04-28 5:12 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-28 5:12 [PATCH 0/3] Add dma_set_mask to pci_controller_ops Daniel Axtens
2015-04-28 5:12 ` [PATCH 1/3] powerpc/powernv: Specialise pci_controller_ops for each controller type Daniel Axtens
2015-04-28 5:12 ` Daniel Axtens [this message]
2015-04-28 5:12 ` [PATCH 3/3] powerpc/powernv: Move dma_set_mask from pnv_phb to pci_controller_ops Daniel Axtens
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=1430197927-24814-3-git-send-email-dja@axtens.net \
--to=dja@axtens.net \
--cc=linuxppc-dev@ozlabs.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;
as well as URLs for NNTP newsgroup(s).