diff mbox

[1/2] irqdomain: add empty irq_domain_check_msi_remap

Message ID 20170302100132.20502-1-yousaf.kaukab@suse.com (mailing list archive)
State New, archived
Headers show

Commit Message

Mian Yousaf Kaukab March 2, 2017, 10:01 a.m. UTC
Fix following build error for s390:
drivers/vfio/vfio_iommu_type1.c: In function 'vfio_iommu_type1_attach_group':
drivers/vfio/vfio_iommu_type1.c:1290:25: error: implicit declaration of function 'irq_domain_check_msi_remap'

Signed-off-by: Mian Yousaf Kaukab <yousaf.kaukab@suse.com>
---
 include/linux/irqdomain.h | 4 ++++
 1 file changed, 4 insertions(+)

Comments

Eric Auger March 2, 2017, 10:29 a.m. UTC | #1
Hi Marc,

On 02/03/2017 11:16, Marc Zyngier wrote:
> On 02/03/17 10:01, Mian Yousaf Kaukab wrote:
>> Fix following build error for s390:
>> drivers/vfio/vfio_iommu_type1.c: In function 'vfio_iommu_type1_attach_group':
>> drivers/vfio/vfio_iommu_type1.c:1290:25: error: implicit declaration of function 'irq_domain_check_msi_remap'
>>
>> Signed-off-by: Mian Yousaf Kaukab <yousaf.kaukab@suse.com>
>> ---
>>  include/linux/irqdomain.h | 4 ++++
>>  1 file changed, 4 insertions(+)
>>
>> diff --git a/include/linux/irqdomain.h b/include/linux/irqdomain.h
>> index 188eced6813e..137817b08cdc 100644
>> --- a/include/linux/irqdomain.h
>> +++ b/include/linux/irqdomain.h
>> @@ -524,6 +524,10 @@ static inline struct irq_domain *irq_find_matching_fwnode(
>>  {
>>  	return NULL;
>>  }
>> +static inline bool irq_domain_check_msi_remap(void)
>> +{
>> +	return true;
> 
> I'm not sure about that one. If we don't support reserved regions for
> MSI, why should we return "true" here? My gut feeling is that it should
> be false (because we lack the infrastructure to deal with it).
> 
> It is a bit of a moot point since the only calling site will *not* call
> this in that case, but I believe that we should be consistent.
> 
> Eric, what do you think?

I agree with you. I Would return false here as just commented and I
don't think subsequent patch is needed.

Thanks

Eric
> 
> Thanks,
> 
> 	M.
>
Mian Yousaf Kaukab March 2, 2017, 12:23 p.m. UTC | #2
On 03/02/2017 11:24 AM, Auger Eric wrote:
> Hi Mian Yousaf,
> 
> On 02/03/2017 11:01, Mian Yousaf Kaukab wrote:
>> Fix following build error for s390:
>> drivers/vfio/vfio_iommu_type1.c: In function 'vfio_iommu_type1_attach_group':
>> drivers/vfio/vfio_iommu_type1.c:1290:25: error: implicit declaration of function 'irq_domain_check_msi_remap'
>>
>> Signed-off-by: Mian Yousaf Kaukab <yousaf.kaukab@suse.com>
>> ---
>>   include/linux/irqdomain.h | 4 ++++
>>   1 file changed, 4 insertions(+)
>>
>> diff --git a/include/linux/irqdomain.h b/include/linux/irqdomain.h
>> index 188eced6813e..137817b08cdc 100644
>> --- a/include/linux/irqdomain.h
>> +++ b/include/linux/irqdomain.h
>> @@ -524,6 +524,10 @@ static inline struct irq_domain *irq_find_matching_fwnode(
>>   {
>>   	return NULL;
>>   }
>> +static inline bool irq_domain_check_msi_remap(void)
>> +{
>> +	return true;
> By default you should rather return false, reporting there is no MSI
> remapping capability on irq domain side. Besides thank you for the fix.
I choose to return true based on the function header comments of 
irq_domain_check_msi_remap. It says

"Return: false if any MSI irq domain does not support IRQ remapping, 
true otherwise (including if there is no MSI irq domain)"

So function should return true in case of no MSI irq domain. Have I miss 
understood this?

BR,
Yousaf
Eric Auger March 2, 2017, 1:12 p.m. UTC | #3
Hi Yousaf,

On 02/03/2017 13:23, Mian Yousaf Kaukab wrote:
> On 03/02/2017 11:24 AM, Auger Eric wrote:
>> Hi Mian Yousaf,
>>
>> On 02/03/2017 11:01, Mian Yousaf Kaukab wrote:
>>> Fix following build error for s390:
>>> drivers/vfio/vfio_iommu_type1.c: In function
>>> 'vfio_iommu_type1_attach_group':
>>> drivers/vfio/vfio_iommu_type1.c:1290:25: error: implicit declaration
>>> of function 'irq_domain_check_msi_remap'
>>>
>>> Signed-off-by: Mian Yousaf Kaukab <yousaf.kaukab@suse.com>
>>> ---
>>>   include/linux/irqdomain.h | 4 ++++
>>>   1 file changed, 4 insertions(+)
>>>
>>> diff --git a/include/linux/irqdomain.h b/include/linux/irqdomain.h
>>> index 188eced6813e..137817b08cdc 100644
>>> --- a/include/linux/irqdomain.h
>>> +++ b/include/linux/irqdomain.h
>>> @@ -524,6 +524,10 @@ static inline struct irq_domain
>>> *irq_find_matching_fwnode(
>>>   {
>>>       return NULL;
>>>   }
>>> +static inline bool irq_domain_check_msi_remap(void)
>>> +{
>>> +    return true;
>> By default you should rather return false, reporting there is no MSI
>> remapping capability on irq domain side. Besides thank you for the fix.
> I choose to return true based on the function header comments of
> irq_domain_check_msi_remap. It says
> 
> "Return: false if any MSI irq domain does not support IRQ remapping,
> true otherwise (including if there is no MSI irq domain)"
> 
> So function should return true in case of no MSI irq domain. Have I miss
> understood this?
This behavior is indeed mandated on ARM - where MSI are translated by
the smmu - to allow safe device assignment if there is no MSI domain,
ie. in this situation there is no risk an assigned device writes into an
MSI doorbell.

As the function is not implemented at all in your case, personally I
would rather be defensive though and return false. You were not able to
check the capability.

Thanks

Eric
> 
> BR,
> Yousaf
Mian Yousaf Kaukab March 2, 2017, 1:31 p.m. UTC | #4
On 03/02/2017 02:12 PM, Auger Eric wrote:
> Hi Yousaf,
> 
> On 02/03/2017 13:23, Mian Yousaf Kaukab wrote:
>> On 03/02/2017 11:24 AM, Auger Eric wrote:
>>> Hi Mian Yousaf,
>>>
>>> On 02/03/2017 11:01, Mian Yousaf Kaukab wrote:
>>>> Fix following build error for s390:
>>>> drivers/vfio/vfio_iommu_type1.c: In function
>>>> 'vfio_iommu_type1_attach_group':
>>>> drivers/vfio/vfio_iommu_type1.c:1290:25: error: implicit declaration
>>>> of function 'irq_domain_check_msi_remap'
>>>>
>>>> Signed-off-by: Mian Yousaf Kaukab <yousaf.kaukab@suse.com>
>>>> ---
>>>>    include/linux/irqdomain.h | 4 ++++
>>>>    1 file changed, 4 insertions(+)
>>>>
>>>> diff --git a/include/linux/irqdomain.h b/include/linux/irqdomain.h
>>>> index 188eced6813e..137817b08cdc 100644
>>>> --- a/include/linux/irqdomain.h
>>>> +++ b/include/linux/irqdomain.h
>>>> @@ -524,6 +524,10 @@ static inline struct irq_domain
>>>> *irq_find_matching_fwnode(
>>>>    {
>>>>        return NULL;
>>>>    }
>>>> +static inline bool irq_domain_check_msi_remap(void)
>>>> +{
>>>> +    return true;
>>> By default you should rather return false, reporting there is no MSI
>>> remapping capability on irq domain side. Besides thank you for the fix.
>> I choose to return true based on the function header comments of
>> irq_domain_check_msi_remap. It says
>>
>> "Return: false if any MSI irq domain does not support IRQ remapping,
>> true otherwise (including if there is no MSI irq domain)"
>>
>> So function should return true in case of no MSI irq domain. Have I miss
>> understood this?
> This behavior is indeed mandated on ARM - where MSI are translated by
> the smmu - to allow safe device assignment if there is no MSI domain,
> ie. in this situation there is no risk an assigned device writes into an
> MSI doorbell.
> 
> As the function is not implemented at all in your case, personally I
> would rather be defensive though and return false. You were not able to
> check the capability.
OK Agree. I will send an update as soon as a decision is made on 2/2.

BR,
Yousaf
diff mbox

Patch

diff --git a/include/linux/irqdomain.h b/include/linux/irqdomain.h
index 188eced6813e..137817b08cdc 100644
--- a/include/linux/irqdomain.h
+++ b/include/linux/irqdomain.h
@@ -524,6 +524,10 @@  static inline struct irq_domain *irq_find_matching_fwnode(
 {
 	return NULL;
 }
+static inline bool irq_domain_check_msi_remap(void)
+{
+	return true;
+}
 #endif /* !CONFIG_IRQ_DOMAIN */
 
 #endif /* _LINUX_IRQDOMAIN_H */