Skip to contentSkip to conversation

Add a dma_device to mcb_device

PATCH Applied Michael Moese 2 participants 4 messages Aug 29, 2016 – Aug 31, 2016 1 message not in the archive Men chameleon bus (mcb)

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH v2 1/2 Enable PCI bus mastering by default

In order to successfully perform DMA operations on PCI devices, it is necessary to enble PCI bus mastering, so enable it by default.

---
 drivers/mcb/mcb-pci.c | 1 +
 1 file changed, 1 insertion(+)
drivers/mcb/mcb-pci.c +1 -0
index b15a034..af4d2f2 100644
@@ -46,6 +46,7 @@ static int mcb_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 		dev_err(&pdev->dev, "Failed to enable PCI device\n");
 		return -ENODEV;
 	}
+	pci_set_master(pdev);
 
 	priv->mapbase = pci_resource_start(pdev, 0);
 	if (!priv->mapbase) {
Signature · 1 line
2.6.6
#2 lore raw

Re: [PATCH v2 1/2] Enable PCI bus mastering by default

Quoted 5 lines · Michael Moese

In order to successfully perform DMA operations on PCI devices, it is necessary to enble PCI bus mastering, so enable it by default.

---

Applied thanks.

I'm not pushing the commit's out, as I'll wait if Greg to applies the mcb-for-4.8 patches before or not. This would remove the burden of a rebase and force-push.

Signature · 6 lines
Johannes Thumshirn                                          Storage
[email protected]                                +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850
#3 lore raw

PATCH v2 2/2 Add a dma_device to mcb_device

In reply to a message not in the archive

When performing DMA operations on a MCB device, the device needed for using the DMA API is "mcb_device->bus_carrier".
This is rather lengthy, so a shortcut is introduced to struct mcb_device in order to ensure the MCB device driver uses the correct device for DMA operations.

---
 drivers/mcb/mcb-core.c | 1 +
 include/linux/mcb.h    | 1 +
 2 files changed, 2 insertions(+)
drivers/mcb/mcb-core.c +1 -0
index 5306966..921a5d2 100644
@@ -233,6 +233,7 @@ int mcb_device_register(struct mcb_bus *bus, struct mcb_device *dev)
 	dev->dev.bus = &mcb_bus_type;
 	dev->dev.parent = bus->dev.parent;
 	dev->dev.release = mcb_release_dev;
+	dev->dma_dev = bus->carrier;
 
 	device_id = dev->id;
 	dev_set_name(&dev->dev, "mcb%d-16z%03d-%d:%d:%d",
include/linux/mcb.h +1 -0
index ee5200d..4097ac9 100644
@@ -76,6 +76,7 @@ struct mcb_device {
 	int rev;
 	struct resource irq;
 	struct resource mem;
+	struct device *dma_dev;
 };
 
 static inline struct mcb_device *to_mcb_device(struct device *dev)
Signature · 1 line
2.6.6
#4 lore raw
Quoted 8 lines · Michael Moese

When performing DMA operations on a MCB device, the device needed for using the DMA API is "mcb_device->bus_carrier".
This is rather lengthy, so a shortcut is introduced to struct mcb_device in order to ensure the MCB device driver uses the correct device for DMA operations.

---

Applied, thanks.

Signature · 6 lines
Johannes Thumshirn                                          Storage
[email protected]                                +49 911 74053 689
SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg
GF: Felix Imendörffer, Jane Smithard, Graham Norton
HRB 21284 (AG Nürnberg)
Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850