diff mbox

[1/2] x86/vmd: Select device dma ops to override

Message ID 1463505205-30431-1-git-send-email-keith.busch@intel.com (mailing list archive)
State New, archived
Delegated to: Bjorn Helgaas
Headers show

Commit Message

Keith Busch May 17, 2016, 5:13 p.m. UTC
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(-)

Comments

Jon Derrick May 17, 2016, 7 p.m. UTC | #1
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
--
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
Bjorn Helgaas June 13, 2016, 9:04 p.m. UTC | #2
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
--
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
diff mbox

Patch

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;