[PATCH 2/2] powerpc/iommu: check dev->iommu_group before remove a device from iommu_group
Alexey Kardashevskiy
aik at ozlabs.ru
Mon Aug 19 11:39:49 EST 2013
On 08/19/2013 11:29 AM, Wei Yang wrote:
> On Fri, Aug 16, 2013 at 08:15:36PM +1000, Alexey Kardashevskiy wrote:
>> On 08/16/2013 08:08 PM, Wei Yang wrote:
>>> ---
>>> arch/powerpc/kernel/iommu.c | 3 ++-
>>> 1 files changed, 2 insertions(+), 1 deletions(-)
>>>
>>> diff --git a/arch/powerpc/kernel/iommu.c b/arch/powerpc/kernel/iommu.c
>>> index b20ff17..5abf7c3 100644
>>> --- a/arch/powerpc/kernel/iommu.c
>>> +++ b/arch/powerpc/kernel/iommu.c
>>> @@ -1149,7 +1149,8 @@ static int iommu_bus_notifier(struct notifier_block *nb,
>>> case BUS_NOTIFY_ADD_DEVICE:
>>> return iommu_add_device(dev);
>>> case BUS_NOTIFY_DEL_DEVICE:
>>> - iommu_del_device(dev);
>>> + if (dev->iommu_group)
>>> + iommu_del_device(dev);
>>> return 0;
>>> default:
>>> return 0;
>>>
>>
>> This one seems redundant, no?
>
> Sorry for the late.
>
> Yes, these two patches have the same purpose to guard the system, while in two
> different places. One is in powernv platform, the other is in the generic iommu
> driver.
>
> The one in powernv platform is used to correct the original logic.
>
> The one in generic iommu driver is to keep system safe in case other platform to
> call iommu_group_remove_device() without the check.
But I am moving bus notifier to powernv code (posted a patch last week,
otherwise Freescale's IOMMU conflicted) so this won't be the case.
--
Alexey
More information about the Linuxppc-dev
mailing list