powerpc/dma: use the generic direct mapping bypass
Now that we've switched all the powerpc nommu and swiotlb methods to use the generic dma_direct_* calls we can remove these ops vectors entirely and rely on the common direct mapping bypass that avoids indirect function calls entirely. This also allows to remove a whole lot of boilerplate code related to setting up these operations. Signed-off-by: Christoph Hellwig <hch@lst.de> Tested-by: Christian Zigotzky <chzigotzky@xenosoft.de> Signed-off-by: Michael Ellerman <mpe@ellerman.id.au>
This commit is contained in:

committed by
Michael Ellerman

parent
461db2bdbf
commit
68005b67d1
@@ -47,7 +47,7 @@ static int __init warp_probe(void)
|
||||
if (!of_machine_is_compatible("pika,warp"))
|
||||
return 0;
|
||||
|
||||
/* For __dma_nommu_alloc_coherent */
|
||||
/* For arch_dma_alloc */
|
||||
ISA_DMA_THRESHOLD = ~0L;
|
||||
|
||||
return 1;
|
||||
|
@@ -223,7 +223,3 @@ define_machine(corenet_generic) {
|
||||
};
|
||||
|
||||
machine_arch_initcall(corenet_generic, corenet_gen_publish_devices);
|
||||
|
||||
#ifdef CONFIG_SWIOTLB
|
||||
machine_arch_initcall(corenet_generic, swiotlb_setup_bus_notifier);
|
||||
#endif
|
||||
|
@@ -202,8 +202,6 @@ static int __init ge_imp3a_probe(void)
|
||||
|
||||
machine_arch_initcall(ge_imp3a, mpc85xx_common_publish_devices);
|
||||
|
||||
machine_arch_initcall(ge_imp3a, swiotlb_setup_bus_notifier);
|
||||
|
||||
define_machine(ge_imp3a) {
|
||||
.name = "GE_IMP3A",
|
||||
.probe = ge_imp3a_probe,
|
||||
|
@@ -57,8 +57,6 @@ static void __init mpc8536_ds_setup_arch(void)
|
||||
|
||||
machine_arch_initcall(mpc8536_ds, mpc85xx_common_publish_devices);
|
||||
|
||||
machine_arch_initcall(mpc8536_ds, swiotlb_setup_bus_notifier);
|
||||
|
||||
/*
|
||||
* Called very early, device-tree isn't unflattened
|
||||
*/
|
||||
|
@@ -174,10 +174,6 @@ machine_arch_initcall(mpc8544_ds, mpc85xx_common_publish_devices);
|
||||
machine_arch_initcall(mpc8572_ds, mpc85xx_common_publish_devices);
|
||||
machine_arch_initcall(p2020_ds, mpc85xx_common_publish_devices);
|
||||
|
||||
machine_arch_initcall(mpc8544_ds, swiotlb_setup_bus_notifier);
|
||||
machine_arch_initcall(mpc8572_ds, swiotlb_setup_bus_notifier);
|
||||
machine_arch_initcall(p2020_ds, swiotlb_setup_bus_notifier);
|
||||
|
||||
/*
|
||||
* Called very early, device-tree isn't unflattened
|
||||
*/
|
||||
|
@@ -367,10 +367,6 @@ machine_arch_initcall(mpc8568_mds, mpc85xx_publish_devices);
|
||||
machine_arch_initcall(mpc8569_mds, mpc85xx_publish_devices);
|
||||
machine_arch_initcall(p1021_mds, mpc85xx_common_publish_devices);
|
||||
|
||||
machine_arch_initcall(mpc8568_mds, swiotlb_setup_bus_notifier);
|
||||
machine_arch_initcall(mpc8569_mds, swiotlb_setup_bus_notifier);
|
||||
machine_arch_initcall(p1021_mds, swiotlb_setup_bus_notifier);
|
||||
|
||||
static void __init mpc85xx_mds_pic_init(void)
|
||||
{
|
||||
struct mpic *mpic = mpic_alloc(NULL, 0, MPIC_BIG_ENDIAN |
|
||||
|
@@ -55,7 +55,6 @@ static void __init p1010_rdb_setup_arch(void)
|
||||
}
|
||||
|
||||
machine_arch_initcall(p1010_rdb, mpc85xx_common_publish_devices);
|
||||
machine_arch_initcall(p1010_rdb, swiotlb_setup_bus_notifier);
|
||||
|
||||
/*
|
||||
* Called very early, device-tree isn't unflattened
|
||||
|
@@ -548,8 +548,6 @@ static void __init p1022_ds_setup_arch(void)
|
||||
|
||||
machine_arch_initcall(p1022_ds, mpc85xx_common_publish_devices);
|
||||
|
||||
machine_arch_initcall(p1022_ds, swiotlb_setup_bus_notifier);
|
||||
|
||||
/*
|
||||
* Called very early, device-tree isn't unflattened
|
||||
*/
|
||||
|
@@ -128,8 +128,6 @@ static void __init p1022_rdk_setup_arch(void)
|
||||
|
||||
machine_arch_initcall(p1022_rdk, mpc85xx_common_publish_devices);
|
||||
|
||||
machine_arch_initcall(p1022_rdk, swiotlb_setup_bus_notifier);
|
||||
|
||||
/*
|
||||
* Called very early, device-tree isn't unflattened
|
||||
*/
|
||||
|
@@ -121,7 +121,6 @@ static int __init declare_of_platform_devices(void)
|
||||
return 0;
|
||||
}
|
||||
machine_arch_initcall(mpc86xx_hpcn, declare_of_platform_devices);
|
||||
machine_arch_initcall(mpc86xx_hpcn, swiotlb_setup_bus_notifier);
|
||||
|
||||
define_machine(mpc86xx_hpcn) {
|
||||
.name = "MPC86xx HPCN",
|
||||
|
@@ -600,8 +600,6 @@ static int cell_of_bus_notify(struct notifier_block *nb, unsigned long action,
|
||||
|
||||
if (cell_iommu_enabled)
|
||||
dev->dma_ops = &dma_iommu_ops;
|
||||
else
|
||||
dev->dma_ops = &dma_nommu_ops;
|
||||
cell_dma_dev_setup(dev);
|
||||
return 0;
|
||||
}
|
||||
@@ -727,7 +725,6 @@ static int __init cell_iommu_init_disabled(void)
|
||||
unsigned long base = 0, size;
|
||||
|
||||
/* When no iommu is present, we use direct DMA ops */
|
||||
set_pci_dma_ops(&dma_nommu_ops);
|
||||
|
||||
/* First make sure all IOC translation is turned off */
|
||||
cell_disable_iommus();
|
||||
|
@@ -186,7 +186,7 @@ static void pci_dma_dev_setup_pasemi(struct pci_dev *dev)
|
||||
*/
|
||||
if (dev->vendor == 0x1959 && dev->device == 0xa007 &&
|
||||
!firmware_has_feature(FW_FEATURE_LPAR)) {
|
||||
dev->dev.dma_ops = &dma_nommu_ops;
|
||||
dev->dev.dma_ops = NULL;
|
||||
/*
|
||||
* Set the coherent DMA mask to prevent the iommu
|
||||
* being used unnecessarily
|
||||
|
@@ -411,55 +411,6 @@ out:
|
||||
return !!(srr1 & 0x2);
|
||||
}
|
||||
|
||||
#ifdef CONFIG_PCMCIA
|
||||
static int pcmcia_notify(struct notifier_block *nb, unsigned long action,
|
||||
void *data)
|
||||
{
|
||||
struct device *dev = data;
|
||||
struct device *parent;
|
||||
struct pcmcia_device *pdev = to_pcmcia_dev(dev);
|
||||
|
||||
/* We are only intereted in device addition */
|
||||
if (action != BUS_NOTIFY_ADD_DEVICE)
|
||||
return 0;
|
||||
|
||||
parent = pdev->socket->dev.parent;
|
||||
|
||||
/* We know electra_cf devices will always have of_node set, since
|
||||
* electra_cf is an of_platform driver.
|
||||
*/
|
||||
if (!parent->of_node)
|
||||
return 0;
|
||||
|
||||
if (!of_device_is_compatible(parent->of_node, "electra-cf"))
|
||||
return 0;
|
||||
|
||||
/* We use the direct ops for localbus */
|
||||
dev->dma_ops = &dma_nommu_ops;
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
static struct notifier_block pcmcia_notifier = {
|
||||
.notifier_call = pcmcia_notify,
|
||||
};
|
||||
|
||||
static inline void pasemi_pcmcia_init(void)
|
||||
{
|
||||
extern struct bus_type pcmcia_bus_type;
|
||||
|
||||
bus_register_notifier(&pcmcia_bus_type, &pcmcia_notifier);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
static inline void pasemi_pcmcia_init(void)
|
||||
{
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
static const struct of_device_id pasemi_bus_ids[] = {
|
||||
/* Unfortunately needed for legacy firmwares */
|
||||
{ .type = "localbus", },
|
||||
@@ -472,8 +423,6 @@ static const struct of_device_id pasemi_bus_ids[] = {
|
||||
|
||||
static int __init pasemi_publish_devices(void)
|
||||
{
|
||||
pasemi_pcmcia_init();
|
||||
|
||||
/* Publish OF platform devices for SDC and other non-PCI devices */
|
||||
of_platform_bus_probe(NULL, pasemi_bus_ids, NULL);
|
||||
|
||||
|
@@ -220,7 +220,7 @@ static void pnv_npu_dma_set_32(struct pnv_ioda_pe *npe)
|
||||
* their parent device so drivers shouldn't be doing DMA
|
||||
* operations directly on these devices.
|
||||
*/
|
||||
set_dma_ops(&npe->pdev->dev, NULL);
|
||||
set_dma_ops(&npe->pdev->dev, &dma_dummy_ops);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@@ -1699,3 +1699,10 @@ int vio_disable_interrupts(struct vio_dev *dev)
|
||||
}
|
||||
EXPORT_SYMBOL(vio_disable_interrupts);
|
||||
#endif /* CONFIG_PPC_PSERIES */
|
||||
|
||||
static int __init vio_init(void)
|
||||
{
|
||||
dma_debug_add_bus(&vio_bus_type);
|
||||
return 0;
|
||||
}
|
||||
fs_initcall(vio_init);
|
||||
|
Reference in New Issue
Block a user