* [RFC] ARM: dma-mapping: Return 0 if no ->set_dma_mask() @ 2013-01-28 8:33 Hiroshi Doyu 2013-01-29 11:31 ` Marek Szyprowski 0 siblings, 1 reply; 8+ messages in thread From: Hiroshi Doyu @ 2013-01-28 8:33 UTC (permalink / raw) To: linux-arm-kernel struct dma_map_ops iommu_ops doesn't have ->set_dma_mask, which causes crash when dma_set_mask() is called from some driver. Signed-off-by: Hiroshi Doyu <hdoyu@nvidia.com> --- arch/arm/include/asm/dma-mapping.h | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/arch/arm/include/asm/dma-mapping.h b/arch/arm/include/asm/dma-mapping.h index a58e0f5..95328bf 100644 --- a/arch/arm/include/asm/dma-mapping.h +++ b/arch/arm/include/asm/dma-mapping.h @@ -32,7 +32,11 @@ static inline void set_dma_ops(struct device *dev, struct dma_map_ops *ops) static inline int dma_set_mask(struct device *dev, u64 mask) { - return get_dma_ops(dev)->set_dma_mask(dev, mask); + struct dma_map_ops *ops = get_dma_ops(dev); + + if (ops->set_dma_mask) + return ops->set_dma_mask(dev, mask); + return 0; } #ifdef __arch_page_to_dma -- 1.7.9.5 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* [RFC] ARM: dma-mapping: Return 0 if no ->set_dma_mask() 2013-01-28 8:33 [RFC] ARM: dma-mapping: Return 0 if no ->set_dma_mask() Hiroshi Doyu @ 2013-01-29 11:31 ` Marek Szyprowski [not found] ` <5107B301.2060802-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org> 0 siblings, 1 reply; 8+ messages in thread From: Marek Szyprowski @ 2013-01-29 11:31 UTC (permalink / raw) To: linux-arm-kernel Hello, On 1/28/2013 9:33 AM, Hiroshi Doyu wrote: > struct dma_map_ops iommu_ops doesn't have ->set_dma_mask, which causes > crash when dma_set_mask() is called from some driver. I think that the issue is a bit different. It looks that iommu_ops lacks the mandatory set_dma_mask callback. arm_dma_set_mask() can be used for it, so please update your patch to add this missing callback. > Signed-off-by: Hiroshi Doyu <hdoyu@nvidia.com> > --- > arch/arm/include/asm/dma-mapping.h | 6 +++++- > 1 file changed, 5 insertions(+), 1 deletion(-) > > diff --git a/arch/arm/include/asm/dma-mapping.h b/arch/arm/include/asm/dma-mapping.h > index a58e0f5..95328bf 100644 > --- a/arch/arm/include/asm/dma-mapping.h > +++ b/arch/arm/include/asm/dma-mapping.h > @@ -32,7 +32,11 @@ static inline void set_dma_ops(struct device *dev, struct dma_map_ops *ops) > > static inline int dma_set_mask(struct device *dev, u64 mask) > { > - return get_dma_ops(dev)->set_dma_mask(dev, mask); > + struct dma_map_ops *ops = get_dma_ops(dev); > + > + if (ops->set_dma_mask) > + return ops->set_dma_mask(dev, mask); > + return 0; > } > > #ifdef __arch_page_to_dma Best regards -- Marek Szyprowski Samsung Poland R&D Center ^ permalink raw reply [flat|nested] 8+ messages in thread
[parent not found: <5107B301.2060802-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>]
* [v2 1/1] ARM: dma-mapping: Call arm_dma_set_mask() if no ->set_dma_mask() 2013-01-29 11:31 ` Marek Szyprowski @ 2013-01-29 12:27 ` Hiroshi Doyu 0 siblings, 0 replies; 8+ messages in thread From: Hiroshi Doyu @ 2013-01-29 12:27 UTC (permalink / raw) To: m.szyprowski-Sze3O3UU22JBDgjK7y7TUQ Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, linaro-mm-sig-cunTk1MwBs8s++Sfvej+rw, linux-tegra-u79uwXL29TY76Z2rM5mHXA, Hiroshi Doyu struct dma_map_ops iommu_ops doesn't have ->set_dma_mask, which causes crash when dma_set_mask() is called from some driver. Signed-off-by: Hiroshi Doyu <hdoyu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> --- arch/arm/include/asm/dma-mapping.h | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/arch/arm/include/asm/dma-mapping.h b/arch/arm/include/asm/dma-mapping.h index 5b579b9..63cc49c 100644 --- a/arch/arm/include/asm/dma-mapping.h +++ b/arch/arm/include/asm/dma-mapping.h @@ -14,6 +14,7 @@ #define DMA_ERROR_CODE (~0) extern struct dma_map_ops arm_dma_ops; extern struct dma_map_ops arm_coherent_dma_ops; +extern int arm_dma_set_mask(struct device *dev, u64 dma_mask); static inline struct dma_map_ops *get_dma_ops(struct device *dev) { @@ -32,7 +33,13 @@ static inline void set_dma_ops(struct device *dev, struct dma_map_ops *ops) static inline int dma_set_mask(struct device *dev, u64 mask) { - return get_dma_ops(dev)->set_dma_mask(dev, mask); + struct dma_map_ops *ops = get_dma_ops(dev); + BUG_ON(!ops); + + if (ops->set_dma_mask) + return ops->set_dma_mask(dev, mask); + + return arm_dma_set_mask(dev, mask); } #ifdef __arch_page_to_dma @@ -112,8 +119,6 @@ static inline void dma_free_noncoherent(struct device *dev, size_t size, extern int dma_supported(struct device *dev, u64 mask); -extern int arm_dma_set_mask(struct device *dev, u64 dma_mask); - /** * arm_dma_alloc - allocate consistent memory for DMA * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices -- 1.7.9.5 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* [v2 1/1] ARM: dma-mapping: Call arm_dma_set_mask() if no ->set_dma_mask() @ 2013-01-29 12:27 ` Hiroshi Doyu 0 siblings, 0 replies; 8+ messages in thread From: Hiroshi Doyu @ 2013-01-29 12:27 UTC (permalink / raw) To: linux-arm-kernel struct dma_map_ops iommu_ops doesn't have ->set_dma_mask, which causes crash when dma_set_mask() is called from some driver. Signed-off-by: Hiroshi Doyu <hdoyu@nvidia.com> --- arch/arm/include/asm/dma-mapping.h | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/arch/arm/include/asm/dma-mapping.h b/arch/arm/include/asm/dma-mapping.h index 5b579b9..63cc49c 100644 --- a/arch/arm/include/asm/dma-mapping.h +++ b/arch/arm/include/asm/dma-mapping.h @@ -14,6 +14,7 @@ #define DMA_ERROR_CODE (~0) extern struct dma_map_ops arm_dma_ops; extern struct dma_map_ops arm_coherent_dma_ops; +extern int arm_dma_set_mask(struct device *dev, u64 dma_mask); static inline struct dma_map_ops *get_dma_ops(struct device *dev) { @@ -32,7 +33,13 @@ static inline void set_dma_ops(struct device *dev, struct dma_map_ops *ops) static inline int dma_set_mask(struct device *dev, u64 mask) { - return get_dma_ops(dev)->set_dma_mask(dev, mask); + struct dma_map_ops *ops = get_dma_ops(dev); + BUG_ON(!ops); + + if (ops->set_dma_mask) + return ops->set_dma_mask(dev, mask); + + return arm_dma_set_mask(dev, mask); } #ifdef __arch_page_to_dma @@ -112,8 +119,6 @@ static inline void dma_free_noncoherent(struct device *dev, size_t size, extern int dma_supported(struct device *dev, u64 mask); -extern int arm_dma_set_mask(struct device *dev, u64 dma_mask); - /** * arm_dma_alloc - allocate consistent memory for DMA * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices -- 1.7.9.5 ^ permalink raw reply related [flat|nested] 8+ messages in thread
[parent not found: <1359462438-21006-1-git-send-email-hdoyu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>]
* Re: [v2 1/1] ARM: dma-mapping: Call arm_dma_set_mask() if no ->set_dma_mask() 2013-01-29 12:27 ` Hiroshi Doyu @ 2013-01-29 12:47 ` Marek Szyprowski -1 siblings, 0 replies; 8+ messages in thread From: Marek Szyprowski @ 2013-01-29 12:47 UTC (permalink / raw) To: Hiroshi Doyu Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, linaro-mm-sig-cunTk1MwBs8s++Sfvej+rw, linux-tegra-u79uwXL29TY76Z2rM5mHXA Hello, On 1/29/2013 1:27 PM, Hiroshi Doyu wrote: > struct dma_map_ops iommu_ops doesn't have ->set_dma_mask, which causes > crash when dma_set_mask() is called from some driver. > > Signed-off-by: Hiroshi Doyu <hdoyu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> > --- > arch/arm/include/asm/dma-mapping.h | 11 ++++++++--- > 1 file changed, 8 insertions(+), 3 deletions(-) > > diff --git a/arch/arm/include/asm/dma-mapping.h b/arch/arm/include/asm/dma-mapping.h > index 5b579b9..63cc49c 100644 > --- a/arch/arm/include/asm/dma-mapping.h > +++ b/arch/arm/include/asm/dma-mapping.h > @@ -14,6 +14,7 @@ > #define DMA_ERROR_CODE (~0) > extern struct dma_map_ops arm_dma_ops; > extern struct dma_map_ops arm_coherent_dma_ops; > +extern int arm_dma_set_mask(struct device *dev, u64 dma_mask); > > static inline struct dma_map_ops *get_dma_ops(struct device *dev) > { > @@ -32,7 +33,13 @@ static inline void set_dma_ops(struct device *dev, struct dma_map_ops *ops) > > static inline int dma_set_mask(struct device *dev, u64 mask) > { > - return get_dma_ops(dev)->set_dma_mask(dev, mask); > + struct dma_map_ops *ops = get_dma_ops(dev); > + BUG_ON(!ops); > + > + if (ops->set_dma_mask) > + return ops->set_dma_mask(dev, mask); > + > + return arm_dma_set_mask(dev, mask); > } > > #ifdef __arch_page_to_dma > @@ -112,8 +119,6 @@ static inline void dma_free_noncoherent(struct device *dev, size_t size, > > extern int dma_supported(struct device *dev, u64 mask); > > -extern int arm_dma_set_mask(struct device *dev, u64 dma_mask); > - > /** > * arm_dma_alloc - allocate consistent memory for DMA > * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices It can be done much simpler, please just add '.set_dma_mask = arm_dma_set_mask,' to iommu_ops declaration. There is no point complicating the header files. Best regards -- Marek Szyprowski Samsung Poland R&D Center ^ permalink raw reply [flat|nested] 8+ messages in thread
* [v2 1/1] ARM: dma-mapping: Call arm_dma_set_mask() if no ->set_dma_mask() @ 2013-01-29 12:47 ` Marek Szyprowski 0 siblings, 0 replies; 8+ messages in thread From: Marek Szyprowski @ 2013-01-29 12:47 UTC (permalink / raw) To: linux-arm-kernel Hello, On 1/29/2013 1:27 PM, Hiroshi Doyu wrote: > struct dma_map_ops iommu_ops doesn't have ->set_dma_mask, which causes > crash when dma_set_mask() is called from some driver. > > Signed-off-by: Hiroshi Doyu <hdoyu@nvidia.com> > --- > arch/arm/include/asm/dma-mapping.h | 11 ++++++++--- > 1 file changed, 8 insertions(+), 3 deletions(-) > > diff --git a/arch/arm/include/asm/dma-mapping.h b/arch/arm/include/asm/dma-mapping.h > index 5b579b9..63cc49c 100644 > --- a/arch/arm/include/asm/dma-mapping.h > +++ b/arch/arm/include/asm/dma-mapping.h > @@ -14,6 +14,7 @@ > #define DMA_ERROR_CODE (~0) > extern struct dma_map_ops arm_dma_ops; > extern struct dma_map_ops arm_coherent_dma_ops; > +extern int arm_dma_set_mask(struct device *dev, u64 dma_mask); > > static inline struct dma_map_ops *get_dma_ops(struct device *dev) > { > @@ -32,7 +33,13 @@ static inline void set_dma_ops(struct device *dev, struct dma_map_ops *ops) > > static inline int dma_set_mask(struct device *dev, u64 mask) > { > - return get_dma_ops(dev)->set_dma_mask(dev, mask); > + struct dma_map_ops *ops = get_dma_ops(dev); > + BUG_ON(!ops); > + > + if (ops->set_dma_mask) > + return ops->set_dma_mask(dev, mask); > + > + return arm_dma_set_mask(dev, mask); > } > > #ifdef __arch_page_to_dma > @@ -112,8 +119,6 @@ static inline void dma_free_noncoherent(struct device *dev, size_t size, > > extern int dma_supported(struct device *dev, u64 mask); > > -extern int arm_dma_set_mask(struct device *dev, u64 dma_mask); > - > /** > * arm_dma_alloc - allocate consistent memory for DMA > * @dev: valid struct device pointer, or NULL for ISA and EISA-like devices It can be done much simpler, please just add '.set_dma_mask = arm_dma_set_mask,' to iommu_ops declaration. There is no point complicating the header files. Best regards -- Marek Szyprowski Samsung Poland R&D Center ^ permalink raw reply [flat|nested] 8+ messages in thread
[parent not found: <5107C4DE.7060607-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>]
* [v3 1/1] ARM: dma-mapping: Set arm_dma_set_mask() for iommu->set_dma_mask() 2013-01-29 12:47 ` Marek Szyprowski @ 2013-01-29 12:57 ` Hiroshi Doyu -1 siblings, 0 replies; 8+ messages in thread From: Hiroshi Doyu @ 2013-01-29 12:57 UTC (permalink / raw) To: m.szyprowski-Sze3O3UU22JBDgjK7y7TUQ Cc: linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r, linaro-mm-sig-cunTk1MwBs8s++Sfvej+rw, linux-tegra-u79uwXL29TY76Z2rM5mHXA, Hiroshi Doyu struct dma_map_ops iommu_ops doesn't have ->set_dma_mask, which causes crash when dma_set_mask() is called from some driver. Signed-off-by: Hiroshi Doyu <hdoyu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org> --- arch/arm/mm/dma-mapping.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c index 6b2fb87..5dfc71f 100644 --- a/arch/arm/mm/dma-mapping.c +++ b/arch/arm/mm/dma-mapping.c @@ -1730,6 +1730,8 @@ struct dma_map_ops iommu_ops = { .unmap_sg = arm_iommu_unmap_sg, .sync_sg_for_cpu = arm_iommu_sync_sg_for_cpu, .sync_sg_for_device = arm_iommu_sync_sg_for_device, + + .set_dma_mask = arm_dma_set_mask, }; struct dma_map_ops iommu_coherent_ops = { @@ -1743,6 +1745,8 @@ struct dma_map_ops iommu_coherent_ops = { .map_sg = arm_coherent_iommu_map_sg, .unmap_sg = arm_coherent_iommu_unmap_sg, + + .set_dma_mask = arm_dma_set_mask, }; /** -- 1.7.9.5 ^ permalink raw reply related [flat|nested] 8+ messages in thread
* [v3 1/1] ARM: dma-mapping: Set arm_dma_set_mask() for iommu->set_dma_mask() @ 2013-01-29 12:57 ` Hiroshi Doyu 0 siblings, 0 replies; 8+ messages in thread From: Hiroshi Doyu @ 2013-01-29 12:57 UTC (permalink / raw) To: linux-arm-kernel struct dma_map_ops iommu_ops doesn't have ->set_dma_mask, which causes crash when dma_set_mask() is called from some driver. Signed-off-by: Hiroshi Doyu <hdoyu@nvidia.com> --- arch/arm/mm/dma-mapping.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/arch/arm/mm/dma-mapping.c b/arch/arm/mm/dma-mapping.c index 6b2fb87..5dfc71f 100644 --- a/arch/arm/mm/dma-mapping.c +++ b/arch/arm/mm/dma-mapping.c @@ -1730,6 +1730,8 @@ struct dma_map_ops iommu_ops = { .unmap_sg = arm_iommu_unmap_sg, .sync_sg_for_cpu = arm_iommu_sync_sg_for_cpu, .sync_sg_for_device = arm_iommu_sync_sg_for_device, + + .set_dma_mask = arm_dma_set_mask, }; struct dma_map_ops iommu_coherent_ops = { @@ -1743,6 +1745,8 @@ struct dma_map_ops iommu_coherent_ops = { .map_sg = arm_coherent_iommu_map_sg, .unmap_sg = arm_coherent_iommu_unmap_sg, + + .set_dma_mask = arm_dma_set_mask, }; /** -- 1.7.9.5 ^ permalink raw reply related [flat|nested] 8+ messages in thread
end of thread, other threads:[~2013-01-29 12:57 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2013-01-28 8:33 [RFC] ARM: dma-mapping: Return 0 if no ->set_dma_mask() Hiroshi Doyu
2013-01-29 11:31 ` Marek Szyprowski
[not found] ` <5107B301.2060802-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2013-01-29 12:27 ` [v2 1/1] ARM: dma-mapping: Call arm_dma_set_mask() " Hiroshi Doyu
2013-01-29 12:27 ` Hiroshi Doyu
[not found] ` <1359462438-21006-1-git-send-email-hdoyu-DDmLM1+adcrQT0dZR+AlfA@public.gmane.org>
2013-01-29 12:47 ` Marek Szyprowski
2013-01-29 12:47 ` Marek Szyprowski
[not found] ` <5107C4DE.7060607-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
2013-01-29 12:57 ` [v3 1/1] ARM: dma-mapping: Set arm_dma_set_mask() for iommu->set_dma_mask() Hiroshi Doyu
2013-01-29 12:57 ` Hiroshi Doyu
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.