dmaengine.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [1/6] driver core: Introduce device_iommu_mapped() function
@ 2018-12-12 11:04 Greg Kroah-Hartman
  0 siblings, 0 replies; 7+ messages in thread
From: Greg Kroah-Hartman @ 2018-12-12 11:04 UTC (permalink / raw)
  To: Joerg Roedel
  Cc: iommu, Russell Currey, Sam Bobroff, oohall,
	Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman,
	Lorenzo Pieralisi, Hanjun Guo, Sudeep Holla, Dan Williams,
	Vinod Koul, jroedel, Mathias Nyman, linux-kernel, linux-acpi,
	dmaengine, linux-usb

On Tue, Dec 11, 2018 at 02:43:38PM +0100, Joerg Roedel wrote:
> From: Joerg Roedel <jroedel@suse.de>
> 
> Some places in the kernel check the iommu_group pointer in
> 'struct device' in order to find ot whether a device is
> mapped by an IOMMU.
> 
> This is not good way to make this check, as the pointer will
> be moved to 'struct dev_iommu_data'. This way to make the
> check is also not very readable.
> 
> Introduce an explicit function to perform this check.
> 
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

No need to have a cc: line if I have already acked it :)

thanks,

greg k-h

^ permalink raw reply	[flat|nested] 7+ messages in thread
* [1/6] driver core: Introduce device_iommu_mapped() function
@ 2018-12-17  9:31 Joerg Roedel
  0 siblings, 0 replies; 7+ messages in thread
From: Joerg Roedel @ 2018-12-17  9:31 UTC (permalink / raw)
  To: Vinod Koul
  Cc: Joerg Roedel, iommu, Russell Currey, Sam Bobroff, oohall,
	Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman,
	Lorenzo Pieralisi, Hanjun Guo, Sudeep Holla, Dan Williams,
	Mathias Nyman, Greg Kroah-Hartman, linux-kernel, linux-acpi,
	dmaengine, linux-usb

On Mon, Dec 17, 2018 at 11:41:10AM +0530, Vinod Koul wrote:
> On 11-12-18, 14:43, Joerg Roedel wrote:
> > From: Joerg Roedel <jroedel@suse.de>
> > 
> > Some places in the kernel check the iommu_group pointer in
> > 'struct device' in order to find ot whether a device is
>                                    ^^
> Typo

Right, fixed now, thanks.

^ permalink raw reply	[flat|nested] 7+ messages in thread
* [1/6] driver core: Introduce device_iommu_mapped() function
@ 2018-12-17  6:11 Vinod Koul
  0 siblings, 0 replies; 7+ messages in thread
From: Vinod Koul @ 2018-12-17  6:11 UTC (permalink / raw)
  To: Joerg Roedel
  Cc: iommu, Russell Currey, Sam Bobroff, oohall,
	Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman,
	Lorenzo Pieralisi, Hanjun Guo, Sudeep Holla, Dan Williams,
	jroedel, Mathias Nyman, Greg Kroah-Hartman, linux-kernel,
	linux-acpi, dmaengine, linux-usb

On 11-12-18, 14:43, Joerg Roedel wrote:
> From: Joerg Roedel <jroedel@suse.de>
> 
> Some places in the kernel check the iommu_group pointer in
> 'struct device' in order to find ot whether a device is
                                   ^^
Typo

^ permalink raw reply	[flat|nested] 7+ messages in thread
* [1/6] driver core: Introduce device_iommu_mapped() function
@ 2018-12-12 11:07 Joerg Roedel
  0 siblings, 0 replies; 7+ messages in thread
From: Joerg Roedel @ 2018-12-12 11:07 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Joerg Roedel, iommu, Russell Currey, Sam Bobroff, oohall,
	Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman,
	Lorenzo Pieralisi, Hanjun Guo, Sudeep Holla, Dan Williams,
	Vinod Koul, Mathias Nyman, linux-kernel, linux-acpi, dmaengine,
	linux-usb

On Wed, Dec 12, 2018 at 12:04:35PM +0100, Greg Kroah-Hartman wrote:
> On Tue, Dec 11, 2018 at 02:43:38PM +0100, Joerg Roedel wrote:
> > Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> > Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> 
> No need to have a cc: line if I have already acked it :)

Right, I'll remove it, sorry for the noise.

Regards,

	Joerg

^ permalink raw reply	[flat|nested] 7+ messages in thread
* [1/6] driver core: Introduce device_iommu_mapped() function
@ 2018-12-11 15:18 Joerg Roedel
  0 siblings, 0 replies; 7+ messages in thread
From: Joerg Roedel @ 2018-12-11 15:18 UTC (permalink / raw)
  To: Sergei Shtylyov
  Cc: iommu, Russell Currey, Sam Bobroff, oohall,
	Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman,
	Lorenzo Pieralisi, Hanjun Guo, Sudeep Holla, Dan Williams,
	Vinod Koul, jroedel, Mathias Nyman, Greg Kroah-Hartman,
	linux-kernel, linux-acpi, dmaengine, linux-usb

On Tue, Dec 11, 2018 at 05:59:33PM +0300, Sergei Shtylyov wrote:
> > +static inline bool device_iommu_mapped(struct device *dev)
> > +{
> > +	return (dev->iommu_group != NULL);
> 
>    You know that parens are unnecessary here, right? :-)

Yes, I know, but it feels incomplete to me without them :-)

	Joerg

^ permalink raw reply	[flat|nested] 7+ messages in thread
* [1/6] driver core: Introduce device_iommu_mapped() function
@ 2018-12-11 14:59 Sergei Shtylyov
  0 siblings, 0 replies; 7+ messages in thread
From: Sergei Shtylyov @ 2018-12-11 14:59 UTC (permalink / raw)
  To: Joerg Roedel, iommu
  Cc: Russell Currey, Sam Bobroff, oohall, Benjamin Herrenschmidt,
	Paul Mackerras, Michael Ellerman, Lorenzo Pieralisi, Hanjun Guo,
	Sudeep Holla, Dan Williams, Vinod Koul, jroedel, Mathias Nyman,
	Greg Kroah-Hartman, linux-kernel, linux-acpi, dmaengine,
	linux-usb

Hello!

On 12/11/2018 04:43 PM, Joerg Roedel wrote:

> From: Joerg Roedel <jroedel@suse.de>
> 
> Some places in the kernel check the iommu_group pointer in
> 'struct device' in order to find ot whether a device is
> mapped by an IOMMU.
> 
> This is not good way to make this check, as the pointer will
> be moved to 'struct dev_iommu_data'. This way to make the
> check is also not very readable.
> 
> Introduce an explicit function to perform this check.
> 
> Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
> Acked-by: Robin Murphy <robin.murphy@arm.com>
> Signed-off-by: Joerg Roedel <jroedel@suse.de>
> ---
>  include/linux/device.h | 10 ++++++++++
>  1 file changed, 10 insertions(+)
> 
> diff --git a/include/linux/device.h b/include/linux/device.h
> index 1b25c7a43f4c..6cb4640b6160 100644
> --- a/include/linux/device.h
> +++ b/include/linux/device.h
> @@ -1058,6 +1058,16 @@ static inline struct device *kobj_to_dev(struct kobject *kobj)
>  	return container_of(kobj, struct device, kobj);
>  }
>  
> +/**
> + * device_iommu_mapped - Returns true when the device DMA is translated
> + *			 by an IOMMU
> + * @dev: Device to perform the check on
> + */
> +static inline bool device_iommu_mapped(struct device *dev)
> +{
> +	return (dev->iommu_group != NULL);

   You know that parens are unnecessary here, right? :-)

> +}
> +
>  /* Get the wakeup routines, which depend on struct device */
>  #include <linux/pm_wakeup.h>
>  

MBR, Sergei

^ permalink raw reply	[flat|nested] 7+ messages in thread
* [1/6] driver core: Introduce device_iommu_mapped() function
@ 2018-12-11 13:43 Joerg Roedel
  0 siblings, 0 replies; 7+ messages in thread
From: Joerg Roedel @ 2018-12-11 13:43 UTC (permalink / raw)
  To: iommu
  Cc: Russell Currey, Sam Bobroff, oohall, Benjamin Herrenschmidt,
	Paul Mackerras, Michael Ellerman, Lorenzo Pieralisi, Hanjun Guo,
	Sudeep Holla, Dan Williams, Vinod Koul, Joerg Roedel, jroedel,
	Mathias Nyman, Greg Kroah-Hartman, linux-kernel, linux-acpi,
	dmaengine, linux-usb

From: Joerg Roedel <jroedel@suse.de>

Some places in the kernel check the iommu_group pointer in
'struct device' in order to find ot whether a device is
mapped by an IOMMU.

This is not good way to make this check, as the pointer will
be moved to 'struct dev_iommu_data'. This way to make the
check is also not very readable.

Introduce an explicit function to perform this check.

Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Acked-by: Robin Murphy <robin.murphy@arm.com>
Signed-off-by: Joerg Roedel <jroedel@suse.de>
---
 include/linux/device.h | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/include/linux/device.h b/include/linux/device.h
index 1b25c7a43f4c..6cb4640b6160 100644
--- a/include/linux/device.h
+++ b/include/linux/device.h
@@ -1058,6 +1058,16 @@ static inline struct device *kobj_to_dev(struct kobject *kobj)
 	return container_of(kobj, struct device, kobj);
 }
 
+/**
+ * device_iommu_mapped - Returns true when the device DMA is translated
+ *			 by an IOMMU
+ * @dev: Device to perform the check on
+ */
+static inline bool device_iommu_mapped(struct device *dev)
+{
+	return (dev->iommu_group != NULL);
+}
+
 /* Get the wakeup routines, which depend on struct device */
 #include <linux/pm_wakeup.h>
 

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

end of thread, other threads:[~2018-12-17  9:31 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-12-12 11:04 [1/6] driver core: Introduce device_iommu_mapped() function Greg Kroah-Hartman
  -- strict thread matches above, loose matches on Subject: below --
2018-12-17  9:31 Joerg Roedel
2018-12-17  6:11 Vinod Koul
2018-12-12 11:07 Joerg Roedel
2018-12-11 15:18 Joerg Roedel
2018-12-11 14:59 Sergei Shtylyov
2018-12-11 13:43 Joerg Roedel

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