* [PATCH -next] iommu/arm-smmu-v3: Fix build error without CONFIG_PCI_ATS
@ 2019-09-03 2:42 YueHaibing
2019-09-03 6:30 ` Will Deacon
2019-09-03 6:50 ` [PATCH v2 " YueHaibing
0 siblings, 2 replies; 5+ messages in thread
From: YueHaibing @ 2019-09-03 2:42 UTC (permalink / raw)
To: will, robin.murphy, joro
Cc: iommu, YueHaibing, linux-kernel, linux-arm-kernel
If CONFIG_PCI_ATS is not set, building fails:
drivers/iommu/arm-smmu-v3.c: In function arm_smmu_ats_supported:
drivers/iommu/arm-smmu-v3.c:2325:35: error: struct pci_dev has no member named ats_cap; did you mean msi_cap?
return !pdev->untrusted && pdev->ats_cap;
^~~~~~~
ats_cap should only used when CONFIG_PCI_ATS is defined,
so use #ifdef block to guard this.
Fixes: bfff88ec1afe ("iommu/arm-smmu-v3: Rework enabling/disabling of ATS for PCI masters")
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
drivers/iommu/arm-smmu-v3.c | 4 +++-
1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c
index 66bf641..44ac9ac 100644
--- a/drivers/iommu/arm-smmu-v3.c
+++ b/drivers/iommu/arm-smmu-v3.c
@@ -2313,7 +2313,7 @@ static void arm_smmu_install_ste_for_dev(struct arm_smmu_master *master)
static bool arm_smmu_ats_supported(struct arm_smmu_master *master)
{
- struct pci_dev *pdev;
+ struct pci_dev *pdev __maybe_unused;
struct arm_smmu_device *smmu = master->smmu;
struct iommu_fwspec *fwspec = dev_iommu_fwspec_get(master->dev);
@@ -2321,8 +2321,10 @@ static bool arm_smmu_ats_supported(struct arm_smmu_master *master)
!(fwspec->flags & IOMMU_FWSPEC_PCI_RC_ATS) || pci_ats_disabled())
return false;
+#ifdef CONFIG_PCI_ATS
pdev = to_pci_dev(master->dev);
return !pdev->untrusted && pdev->ats_cap;
+#endif
}
static void arm_smmu_enable_ats(struct arm_smmu_master *master)
--
2.7.4
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH -next] iommu/arm-smmu-v3: Fix build error without CONFIG_PCI_ATS
2019-09-03 2:42 [PATCH -next] iommu/arm-smmu-v3: Fix build error without CONFIG_PCI_ATS YueHaibing
@ 2019-09-03 6:30 ` Will Deacon
2019-09-03 6:34 ` Yuehaibing
2019-09-03 6:50 ` [PATCH v2 " YueHaibing
1 sibling, 1 reply; 5+ messages in thread
From: Will Deacon @ 2019-09-03 6:30 UTC (permalink / raw)
To: YueHaibing; +Cc: robin.murphy, iommu, linux-arm-kernel, linux-kernel
On Tue, Sep 03, 2019 at 10:42:12AM +0800, YueHaibing wrote:
> If CONFIG_PCI_ATS is not set, building fails:
>
> drivers/iommu/arm-smmu-v3.c: In function arm_smmu_ats_supported:
> drivers/iommu/arm-smmu-v3.c:2325:35: error: struct pci_dev has no member named ats_cap; did you mean msi_cap?
> return !pdev->untrusted && pdev->ats_cap;
> ^~~~~~~
>
> ats_cap should only used when CONFIG_PCI_ATS is defined,
> so use #ifdef block to guard this.
>
> Fixes: bfff88ec1afe ("iommu/arm-smmu-v3: Rework enabling/disabling of ATS for PCI masters")
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
> ---
> drivers/iommu/arm-smmu-v3.c | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c
> index 66bf641..44ac9ac 100644
> --- a/drivers/iommu/arm-smmu-v3.c
> +++ b/drivers/iommu/arm-smmu-v3.c
> @@ -2313,7 +2313,7 @@ static void arm_smmu_install_ste_for_dev(struct arm_smmu_master *master)
>
> static bool arm_smmu_ats_supported(struct arm_smmu_master *master)
> {
> - struct pci_dev *pdev;
> + struct pci_dev *pdev __maybe_unused;
> struct arm_smmu_device *smmu = master->smmu;
> struct iommu_fwspec *fwspec = dev_iommu_fwspec_get(master->dev);
>
> @@ -2321,8 +2321,10 @@ static bool arm_smmu_ats_supported(struct arm_smmu_master *master)
> !(fwspec->flags & IOMMU_FWSPEC_PCI_RC_ATS) || pci_ats_disabled())
> return false;
>
> +#ifdef CONFIG_PCI_ATS
> pdev = to_pci_dev(master->dev);
> return !pdev->untrusted && pdev->ats_cap;
> +#endif
> }
Hmm, I really don't like the missing return statement here, even though we
never get this far thanks to the feature not getting set during ->probe().
I'd actually prefer just to duplicate the function:
#ifndef CONFIG_PCI_ATS
static bool
arm_smmu_ats_supported(struct arm_smmu_master *master) { return false; }
#else
<current code here>
#endif
Can you send a v2 like that, please?
Will
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH -next] iommu/arm-smmu-v3: Fix build error without CONFIG_PCI_ATS
2019-09-03 6:30 ` Will Deacon
@ 2019-09-03 6:34 ` Yuehaibing
0 siblings, 0 replies; 5+ messages in thread
From: Yuehaibing @ 2019-09-03 6:34 UTC (permalink / raw)
To: Will Deacon; +Cc: robin.murphy, iommu, linux-arm-kernel, linux-kernel
On 2019/9/3 14:30, Will Deacon wrote:
> On Tue, Sep 03, 2019 at 10:42:12AM +0800, YueHaibing wrote:
>> If CONFIG_PCI_ATS is not set, building fails:
>>
>> drivers/iommu/arm-smmu-v3.c: In function arm_smmu_ats_supported:
>> drivers/iommu/arm-smmu-v3.c:2325:35: error: struct pci_dev has no member named ats_cap; did you mean msi_cap?
>> return !pdev->untrusted && pdev->ats_cap;
>> ^~~~~~~
>>
>> ats_cap should only used when CONFIG_PCI_ATS is defined,
>> so use #ifdef block to guard this.
>>
>> Fixes: bfff88ec1afe ("iommu/arm-smmu-v3: Rework enabling/disabling of ATS for PCI masters")
>> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
>> ---
>> drivers/iommu/arm-smmu-v3.c | 4 +++-
>> 1 file changed, 3 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c
>> index 66bf641..44ac9ac 100644
>> --- a/drivers/iommu/arm-smmu-v3.c
>> +++ b/drivers/iommu/arm-smmu-v3.c
>> @@ -2313,7 +2313,7 @@ static void arm_smmu_install_ste_for_dev(struct arm_smmu_master *master)
>>
>> static bool arm_smmu_ats_supported(struct arm_smmu_master *master)
>> {
>> - struct pci_dev *pdev;
>> + struct pci_dev *pdev __maybe_unused;
>> struct arm_smmu_device *smmu = master->smmu;
>> struct iommu_fwspec *fwspec = dev_iommu_fwspec_get(master->dev);
>>
>> @@ -2321,8 +2321,10 @@ static bool arm_smmu_ats_supported(struct arm_smmu_master *master)
>> !(fwspec->flags & IOMMU_FWSPEC_PCI_RC_ATS) || pci_ats_disabled())
>> return false;
>>
>> +#ifdef CONFIG_PCI_ATS
>> pdev = to_pci_dev(master->dev);
>> return !pdev->untrusted && pdev->ats_cap;
>> +#endif
>> }
>
> Hmm, I really don't like the missing return statement here, even though we
> never get this far thanks to the feature not getting set during ->probe().
> I'd actually prefer just to duplicate the function:
>
> #ifndef CONFIG_PCI_ATS
> static bool
> arm_smmu_ats_supported(struct arm_smmu_master *master) { return false; }
> #else
> <current code here>
> #endif
>
> Can you send a v2 like that, please?
Ok, will send v2 as your suggestion.
>
> Will
>
> .
>
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu
^ permalink raw reply [flat|nested] 5+ messages in thread
* [PATCH v2 -next] iommu/arm-smmu-v3: Fix build error without CONFIG_PCI_ATS
2019-09-03 2:42 [PATCH -next] iommu/arm-smmu-v3: Fix build error without CONFIG_PCI_ATS YueHaibing
2019-09-03 6:30 ` Will Deacon
@ 2019-09-03 6:50 ` YueHaibing
2019-09-03 12:58 ` Joerg Roedel
1 sibling, 1 reply; 5+ messages in thread
From: YueHaibing @ 2019-09-03 6:50 UTC (permalink / raw)
To: will, robin.murphy, joro
Cc: iommu, YueHaibing, linux-kernel, linux-arm-kernel
If CONFIG_PCI_ATS is not set, building fails:
drivers/iommu/arm-smmu-v3.c: In function arm_smmu_ats_supported:
drivers/iommu/arm-smmu-v3.c:2325:35: error: struct pci_dev has no member named ats_cap; did you mean msi_cap?
return !pdev->untrusted && pdev->ats_cap;
^~~~~~~
ats_cap should only used when CONFIG_PCI_ATS is defined,
so use #ifdef block to guard this.
Fixes: bfff88ec1afe ("iommu/arm-smmu-v3: Rework enabling/disabling of ATS for PCI masters")
Signed-off-by: YueHaibing <yuehaibing@huawei.com>
---
v2: Add arm_smmu_ats_supported() of no CONFIG_PCI_ATS
---
drivers/iommu/arm-smmu-v3.c | 7 +++++++
1 file changed, 7 insertions(+)
diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c
index 66bf641..8da93e7 100644
--- a/drivers/iommu/arm-smmu-v3.c
+++ b/drivers/iommu/arm-smmu-v3.c
@@ -2311,6 +2311,7 @@ static void arm_smmu_install_ste_for_dev(struct arm_smmu_master *master)
}
}
+#ifdef CONFIG_PCI_ATS
static bool arm_smmu_ats_supported(struct arm_smmu_master *master)
{
struct pci_dev *pdev;
@@ -2324,6 +2325,12 @@ static bool arm_smmu_ats_supported(struct arm_smmu_master *master)
pdev = to_pci_dev(master->dev);
return !pdev->untrusted && pdev->ats_cap;
}
+#else
+static bool arm_smmu_ats_supported(struct arm_smmu_master *master)
+{
+ return false;
+}
+#endif
static void arm_smmu_enable_ats(struct arm_smmu_master *master)
{
--
2.7.4
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu
^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH v2 -next] iommu/arm-smmu-v3: Fix build error without CONFIG_PCI_ATS
2019-09-03 6:50 ` [PATCH v2 " YueHaibing
@ 2019-09-03 12:58 ` Joerg Roedel
0 siblings, 0 replies; 5+ messages in thread
From: Joerg Roedel @ 2019-09-03 12:58 UTC (permalink / raw)
To: YueHaibing; +Cc: robin.murphy, iommu, will, linux-kernel, linux-arm-kernel
On Tue, Sep 03, 2019 at 02:50:56PM +0800, YueHaibing wrote:
> If CONFIG_PCI_ATS is not set, building fails:
>
> drivers/iommu/arm-smmu-v3.c: In function arm_smmu_ats_supported:
> drivers/iommu/arm-smmu-v3.c:2325:35: error: struct pci_dev has no member named ats_cap; did you mean msi_cap?
> return !pdev->untrusted && pdev->ats_cap;
> ^~~~~~~
>
> ats_cap should only used when CONFIG_PCI_ATS is defined,
> so use #ifdef block to guard this.
>
> Fixes: bfff88ec1afe ("iommu/arm-smmu-v3: Rework enabling/disabling of ATS for PCI masters")
> Signed-off-by: YueHaibing <yuehaibing@huawei.com>
> ---
> v2: Add arm_smmu_ats_supported() of no CONFIG_PCI_ATS
> ---
> drivers/iommu/arm-smmu-v3.c | 7 +++++++
> 1 file changed, 7 insertions(+)
Applied, thanks.
_______________________________________________
iommu mailing list
iommu@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/iommu
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2019-09-03 12:58 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-03 2:42 [PATCH -next] iommu/arm-smmu-v3: Fix build error without CONFIG_PCI_ATS YueHaibing
2019-09-03 6:30 ` Will Deacon
2019-09-03 6:34 ` Yuehaibing
2019-09-03 6:50 ` [PATCH v2 " YueHaibing
2019-09-03 12:58 ` 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).