linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] x86/vmd: Select device dma ops to override
@ 2016-05-17 17:13 Keith Busch
  2016-05-17 17:13 ` [PATCH 2/2] x86/vmd: Initialize list item in irq disable Keith Busch
                   ` (2 more replies)
  0 siblings, 3 replies; 5+ messages in thread
From: Keith Busch @ 2016-05-17 17:13 UTC (permalink / raw)
  To: linux-pci, Bjorn Helgaas; +Cc: Jon Derrick, 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 <keith.busch@intel.com>
---
 arch/x86/pci/vmd.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/arch/x86/pci/vmd.c b/arch/x86/pci/vmd.c
index 7792aba..b1662bf 100644
--- a/arch/x86/pci/vmd.c
+++ b/arch/x86/pci/vmd.c
@@ -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;
 
-- 
2.7.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH 2/2] x86/vmd: Initialize list item in irq disable
  2016-05-17 17:13 [PATCH 1/2] x86/vmd: Select device dma ops to override Keith Busch
@ 2016-05-17 17:13 ` Keith Busch
  2016-05-17 17:25   ` Keith Busch
  2016-05-17 19:00 ` [PATCH 1/2] x86/vmd: Select device dma ops to override Jon Derrick
  2016-06-13 21:04 ` Bjorn Helgaas
  2 siblings, 1 reply; 5+ messages in thread
From: Keith Busch @ 2016-05-17 17:13 UTC (permalink / raw)
  To: linux-pci, Bjorn Helgaas; +Cc: Jon Derrick, Keith Busch

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.

Signed-off-by: Keith Busch <keith.busch@intel.com>
---
 arch/x86/pci/vmd.c | 1 +
 1 file changed, 1 insertion(+)

diff --git a/arch/x86/pci/vmd.c b/arch/x86/pci/vmd.c
index b1662bf..e9e461b 100644
--- a/arch/x86/pci/vmd.c
+++ b/arch/x86/pci/vmd.c
@@ -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);
 }
 
-- 
2.7.2


^ permalink raw reply related	[flat|nested] 5+ messages in thread

* Re: [PATCH 2/2] x86/vmd: Initialize list item in irq disable
  2016-05-17 17:13 ` [PATCH 2/2] x86/vmd: Initialize list item in irq disable Keith Busch
@ 2016-05-17 17:25   ` Keith Busch
  0 siblings, 0 replies; 5+ messages in thread
From: Keith Busch @ 2016-05-17 17:25 UTC (permalink / raw)
  To: linux-pci, Bjorn Helgaas; +Cc: Jon Derrick

On Tue, May 17, 2016 at 11:13:25AM -0600, Keith Busch wrote:
>  	raw_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.

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] x86/vmd: Select device dma ops to override
  2016-05-17 17:13 [PATCH 1/2] x86/vmd: Select device dma ops to override Keith Busch
  2016-05-17 17:13 ` [PATCH 2/2] x86/vmd: Initialize list item in irq disable Keith Busch
@ 2016-05-17 19:00 ` Jon Derrick
  2016-06-13 21:04 ` Bjorn Helgaas
  2 siblings, 0 replies; 5+ messages in thread
From: Jon Derrick @ 2016-05-17 19:00 UTC (permalink / raw)
  To: Keith Busch; +Cc: linux-pci@vger.kernel.org, Bjorn Helgaas

Looks fine

Acked-by Jon Derrick: <jonathan.derrick@intel.com>

On Tue, May 17, 2016 at 11:13:24AM -0600, Keith Busch wrote:
> 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 <keith.busch@intel.com>
> ---
>  arch/x86/pci/vmd.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/x86/pci/vmd.c b/arch/x86/pci/vmd.c
> index 7792aba..b1662bf 100644
> --- a/arch/x86/pci/vmd.c
> +++ b/arch/x86/pci/vmd.c
> @@ -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;
>  
> -- 
> 2.7.2
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-pci" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [PATCH 1/2] x86/vmd: Select device dma ops to override
  2016-05-17 17:13 [PATCH 1/2] x86/vmd: Select device dma ops to override Keith Busch
  2016-05-17 17:13 ` [PATCH 2/2] x86/vmd: Initialize list item in irq disable Keith Busch
  2016-05-17 19:00 ` [PATCH 1/2] x86/vmd: Select device dma ops to override Jon Derrick
@ 2016-06-13 21:04 ` Bjorn Helgaas
  2 siblings, 0 replies; 5+ messages in thread
From: Bjorn Helgaas @ 2016-06-13 21:04 UTC (permalink / raw)
  To: Keith Busch; +Cc: linux-pci, Bjorn Helgaas, Jon Derrick

On Tue, May 17, 2016 at 11:13:24AM -0600, Keith Busch wrote:
> 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 <keith.busch@intel.com>

I applied this and the v2 2/2 patch with Jon's acks to pci/host-vmd for
v4.8, thanks!

> ---
>  arch/x86/pci/vmd.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/x86/pci/vmd.c b/arch/x86/pci/vmd.c
> index 7792aba..b1662bf 100644
> --- a/arch/x86/pci/vmd.c
> +++ b/arch/x86/pci/vmd.c
> @@ -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;
>  
> -- 
> 2.7.2
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-pci" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-06-13 21:04 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-05-17 17:13 [PATCH 1/2] x86/vmd: Select device dma ops to override Keith Busch
2016-05-17 17:13 ` [PATCH 2/2] x86/vmd: Initialize list item in irq disable Keith Busch
2016-05-17 17:25   ` Keith Busch
2016-05-17 19:00 ` [PATCH 1/2] x86/vmd: Select device dma ops to override Jon Derrick
2016-06-13 21:04 ` Bjorn Helgaas

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).