x86/vmd: Select device dma ops to override
PATCH 1/2 x86/vmd: Select device dma ops to override
VMD device doesn't usually have device archdata specific dma_ops, so we need to override the default ops for VMD devices.
--- arch/x86/pci/vmd.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
arch/x86/pci/vmd.c +3 -3
@@ -261,7 +261,7 @@ static struct device *to_vmd_dev(struct device *dev)static struct dma_map_ops *vmd_dma_ops (struct device *dev) { -return to_vmd_dev (dev)->archdata.dma_ops; +return get_dma_ops (to_vmd_dev (dev)); } static void *vmd_alloc(struct device *dev, size_t size, dma_addr_t *addr,
@@ -367,7 +367,7 @@ static void vmd_teardown_dma_ops(struct vmd_dev *vmd) {struct dma_domain *domain = &vmd->dma_domain; -if (vmd->dev->dev.archdata.dma_ops) +if (get_dma_ops (&vmd->dev->dev))del_dma_domain (domain); }
@@ -379,7 +379,7 @@ static void vmd_teardown_dma_ops(struct vmd_dev *vmd)static void vmd_setup_dma_ops (struct vmd_dev *vmd) { -const struct dma_map_ops *source = vmd->dev->dev.archdata.dma_ops; +const struct dma_map_ops *source =get_dma_ops (&vmd->dev->dev);struct dma_map_ops *dest = &vmd->dma_ops;struct dma_domain *domain = &vmd->dma_domain;
Signature · 1 line
2.7.2
PATCH 2/2 x86/vmd: Initialize list item in irq disable
Multiple calls to disable an IRQ would have caused the driver to dereference a poisoned list item. This re-initializes the list to allow multiple requests to disable the irq.
--- arch/x86/pci/vmd.c | 1 + 1 file changed, 1 insertion(+)
arch/x86/pci/vmd.c +1 -0
@@ -135,6 +135,7 @@ static void vmd_irq_disable(struct irq_data *data)raw_spin_lock (&list_lock);list_del_rcu (&vmdirq->node); +LIST_HEAD_INIT_RCU (&vmdirq->node);raw_spin_unlock (&list_lock); }
Signature · 1 line
2.7.2
Re: [PATCH 2/2] x86/vmd: Initialize list item in irq disable
arch/x86/pci/vmd.c static void vmd_irq_disable(struct irq_data *data) · line 139
Quoted 4 lines · Keith Busch
arch/x86/pci/vmd.c +1
-0raw_spin_lock (&list_lock);list_del_rcu (&vmdirq->node); +LIST_HEAD_INIT_RCU (&vmdirq->node);raw_spin_unlock (&list_lock);
Sorry, please disregard PATCH 2/2. I'll have to resend with the correct patch using a real macro instead of the mistyped one above.
Looks fine
Acked-by Jon Derrick: <[email protected]>
Quoted 46 lines · Keith Busch
VMD device doesn't usually have device archdata specific
dma_ops, so we need to override the default ops for VMD devices.Signed-off-by Keith Busch <[email protected]>--- arch/x86/pci/vmd.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)arch/x86/pci/vmd.c +3
-3@@ -261,7 +261,7 @@ static struct device *to_vmd_dev(struct device *dev)static struct dma_map_ops *vmd_dma_ops (struct device *dev) { -return to_vmd_dev (dev)->archdata.dma_ops; +return get_dma_ops (to_vmd_dev (dev)); } static void *vmd_alloc(struct device *dev, size_t size, dma_addr_t *addr,@@ -367,7 +367,7 @@ static void vmd_teardown_dma_ops(struct vmd_dev *vmd) {struct dma_domain *domain = &vmd->dma_domain; -if (vmd->dev->dev.archdata.dma_ops) +if (get_dma_ops (&vmd->dev->dev))del_dma_domain (domain); }@@ -379,7 +379,7 @@ static void vmd_teardown_dma_ops(struct vmd_dev *vmd)static void vmd_setup_dma_ops (struct vmd_dev *vmd) { -const struct dma_map_ops *source = vmd->dev->dev.archdata.dma_ops; +const struct dma_map_ops *source =get_dma_ops (&vmd->dev->dev);struct dma_map_ops *dest = &vmd->dma_ops;struct dma_domain *domain = &vmd->dma_domain;Signature · 6 lines
2.7.2 -- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
Bjorn Helgaas
AppliedQuoted 4 lines · Keith Busch
VMD device doesn't usually have device archdata specific
dma_ops, so we need to override the default ops for VMD devices.Signed-off-by Keith Busch <[email protected]>
I applied this and the v2 2/2 patch with Jon's acks to pci/host-vmd for v4.8, thanks!
Quoted 42 lines
--- arch/x86/pci/vmd.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)arch/x86/pci/vmd.c +3
-3@@ -261,7 +261,7 @@ static struct device *to_vmd_dev(struct device *dev)static struct dma_map_ops *vmd_dma_ops (struct device *dev) { -return to_vmd_dev (dev)->archdata.dma_ops; +return get_dma_ops (to_vmd_dev (dev)); } static void *vmd_alloc(struct device *dev, size_t size, dma_addr_t *addr,@@ -367,7 +367,7 @@ static void vmd_teardown_dma_ops(struct vmd_dev *vmd) {struct dma_domain *domain = &vmd->dma_domain; -if (vmd->dev->dev.archdata.dma_ops) +if (get_dma_ops (&vmd->dev->dev))del_dma_domain (domain); }@@ -379,7 +379,7 @@ static void vmd_teardown_dma_ops(struct vmd_dev *vmd)static void vmd_setup_dma_ops (struct vmd_dev *vmd) { -const struct dma_map_ops *source = vmd->dev->dev.archdata.dma_ops; +const struct dma_map_ops *source =get_dma_ops (&vmd->dev->dev);struct dma_map_ops *dest = &vmd->dma_ops;struct dma_domain *domain = &vmd->dma_domain;Signature · 6 lines
2.7.2 -- To unsubscribe from this list: send the line "unsubscribe linux-pci" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html