* [PATCH] iommu: Check for iommu_ops == NULL in iommu_probe_device()
@ 2018-12-20 9:08 Joerg Roedel
[not found] ` <20181220090833.6643-1-joro-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
0 siblings, 1 reply; 5+ messages in thread
From: Joerg Roedel @ 2018-12-20 9:08 UTC (permalink / raw)
To: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA; +Cc: Joerg Roedel
From: Joerg Roedel <jroedel-l3A5Bk7waGM@public.gmane.org>
This check needs to be there and got lost at some point
during development. Add it again.
Fixes: 641fb0efbff0 ('iommu/of: Don't call iommu_ops->add_device directly')
Reported-by: Marek Szyprowski <m.szyprowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
Reported-by: kernelci.org bot <bot-ssFOTAMYnuFg9hUCZPvPmw@public.gmane.org>
Signed-off-by: Joerg Roedel <jroedel-l3A5Bk7waGM@public.gmane.org>
---
drivers/iommu/iommu.c | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
index a2131751dcff..3ed4db334341 100644
--- a/drivers/iommu/iommu.c
+++ b/drivers/iommu/iommu.c
@@ -114,10 +114,14 @@ void iommu_device_unregister(struct iommu_device *iommu)
int iommu_probe_device(struct device *dev)
{
const struct iommu_ops *ops = dev->bus->iommu_ops;
+ int ret = -EINVAL;
WARN_ON(dev->iommu_group);
- return ops->add_device(dev);
+ if (ops)
+ ret = ops->add_device(dev);
+
+ return ret;
}
void iommu_release_device(struct device *dev)
--
2.13.7
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH] iommu: Check for iommu_ops == NULL in iommu_probe_device()
[not found] ` <20181220090833.6643-1-joro-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
@ 2019-01-16 15:27 ` Auger Eric
[not found] ` <e1a87036-d2df-c59b-a23d-9093ba02bacd-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
0 siblings, 1 reply; 5+ messages in thread
From: Auger Eric @ 2019-01-16 15:27 UTC (permalink / raw)
To: Joerg Roedel, iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA
Cc: Joerg Roedel
Hi Joerg,
On 12/20/18 10:08 AM, Joerg Roedel wrote:
> From: Joerg Roedel <jroedel-l3A5Bk7waGM@public.gmane.org>
>
> This check needs to be there and got lost at some point
> during development. Add it again.
>
> Fixes: 641fb0efbff0 ('iommu/of: Don't call iommu_ops->add_device directly')
I experience a regression with those 2 patches. I have virtio-pci device
protected by virtual smmuv3 and in that case I get err = -EPROBE_DEFER
after pci_for_each_dma_alias() in of_iommu_configure(). When
iommu_probe_device is called, ops = NULL so it returns -EINVAL and err
is overwritten. So there is no deferred probing while it happened before.
Thanks
Eric
> Reported-by: Marek Szyprowski <m.szyprowski-Sze3O3UU22JBDgjK7y7TUQ@public.gmane.org>
> Reported-by: kernelci.org bot <bot-ssFOTAMYnuFg9hUCZPvPmw@public.gmane.org>
> Signed-off-by: Joerg Roedel <jroedel-l3A5Bk7waGM@public.gmane.org>
> ---
> drivers/iommu/iommu.c | 6 +++++-
> 1 file changed, 5 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
> index a2131751dcff..3ed4db334341 100644
> --- a/drivers/iommu/iommu.c
> +++ b/drivers/iommu/iommu.c
> @@ -114,10 +114,14 @@ void iommu_device_unregister(struct iommu_device *iommu)
> int iommu_probe_device(struct device *dev)
> {
> const struct iommu_ops *ops = dev->bus->iommu_ops;
> + int ret = -EINVAL;
>
> WARN_ON(dev->iommu_group);
>
> - return ops->add_device(dev);
> + if (ops)
> + ret = ops->add_device(dev);
> +
> + return ret;
> }
>
> void iommu_release_device(struct device *dev)
>
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] iommu: Check for iommu_ops == NULL in iommu_probe_device()
[not found] ` <e1a87036-d2df-c59b-a23d-9093ba02bacd-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
@ 2019-01-16 16:33 ` Jean-Philippe Brucker
[not found] ` <270d1c47-0752-68c7-e5ca-d19dcd170bbc-5wv7dgnIgG8@public.gmane.org>
0 siblings, 1 reply; 5+ messages in thread
From: Jean-Philippe Brucker @ 2019-01-16 16:33 UTC (permalink / raw)
To: Auger Eric, Joerg Roedel,
iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA
Cc: Joerg Roedel
On 16/01/2019 15:27, Auger Eric wrote:
> Hi Joerg,
>
> On 12/20/18 10:08 AM, Joerg Roedel wrote:
>> From: Joerg Roedel <jroedel-l3A5Bk7waGM@public.gmane.org>
>>
>> This check needs to be there and got lost at some point
>> during development. Add it again.
>>
>> Fixes: 641fb0efbff0 ('iommu/of: Don't call iommu_ops->add_device directly')
> I experience a regression with those 2 patches. I have virtio-pci device
> protected by virtual smmuv3 and in that case I get err = -EPROBE_DEFER
> after pci_for_each_dma_alias() in of_iommu_configure(). When
> iommu_probe_device is called, ops = NULL so it returns -EINVAL and err
> is overwritten. So there is no deferred probing while it happened before.
There is a fix on the list:
https://www.spinics.net/lists/arm-kernel/msg698371.html
Thanks,
Jean
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] iommu: Check for iommu_ops == NULL in iommu_probe_device()
[not found] ` <270d1c47-0752-68c7-e5ca-d19dcd170bbc-5wv7dgnIgG8@public.gmane.org>
@ 2019-01-16 16:43 ` Joerg Roedel
[not found] ` <20190116164316.GC4681-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
0 siblings, 1 reply; 5+ messages in thread
From: Joerg Roedel @ 2019-01-16 16:43 UTC (permalink / raw)
To: Jean-Philippe Brucker
Cc: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA, Joerg Roedel
On Wed, Jan 16, 2019 at 04:33:51PM +0000, Jean-Philippe Brucker wrote:
> There is a fix on the list:
> https://www.spinics.net/lists/arm-kernel/msg698371.html
It is also in my tree already, I will send it upstream this week.
Regards,
Joerg
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] iommu: Check for iommu_ops == NULL in iommu_probe_device()
[not found] ` <20190116164316.GC4681-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
@ 2019-01-16 17:40 ` Auger Eric
0 siblings, 0 replies; 5+ messages in thread
From: Auger Eric @ 2019-01-16 17:40 UTC (permalink / raw)
To: Joerg Roedel, Jean-Philippe Brucker
Cc: iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA, Joerg Roedel
Hi Jean, Joerg,
On 1/16/19 5:43 PM, Joerg Roedel wrote:
> On Wed, Jan 16, 2019 at 04:33:51PM +0000, Jean-Philippe Brucker wrote:
>> There is a fix on the list:
>> https://www.spinics.net/lists/arm-kernel/msg698371.html
>
> It is also in my tree already, I will send it upstream this week.
OK thanks!
Eric
>
> Regards,
>
> Joerg
>
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2019-01-16 17:40 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-12-20 9:08 [PATCH] iommu: Check for iommu_ops == NULL in iommu_probe_device() Joerg Roedel
[not found] ` <20181220090833.6643-1-joro-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
2019-01-16 15:27 ` Auger Eric
[not found] ` <e1a87036-d2df-c59b-a23d-9093ba02bacd-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org>
2019-01-16 16:33 ` Jean-Philippe Brucker
[not found] ` <270d1c47-0752-68c7-e5ca-d19dcd170bbc-5wv7dgnIgG8@public.gmane.org>
2019-01-16 16:43 ` Joerg Roedel
[not found] ` <20190116164316.GC4681-zLv9SwRftAIdnm+yROfE0A@public.gmane.org>
2019-01-16 17:40 ` Auger Eric
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.