linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH -next] ACPI/IORT: Fix build error implicit-function-declaration
@ 2022-07-24 11:54 Ren Zhijie
  2022-07-25 13:50 ` Shameerali Kolothum Thodi
  0 siblings, 1 reply; 4+ messages in thread
From: Ren Zhijie @ 2022-07-24 11:54 UTC (permalink / raw)
  To: lpieralisi, guohanjun, sudeep.holla, rafael, lenb,
	shameerali.kolothum.thodi, jroedel, robin.murphy
  Cc: linux-acpi, linux-arm-kernel, linux-kernel, Ren Zhijie

If CONFIG_ACPI_IORT=y and CONFIG_IOMMU_API is not set,
make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu-, will be failed, like this:

drivers/acpi/arm64/iort.c: In function ‘iort_get_rmr_sids’:
drivers/acpi/arm64/iort.c:1406:2: error: implicit declaration of function ‘iort_iommu_rmr_get_resv_regions’; did you mean ‘iort_iommu_get_resv_regions’? [-Werror=implicit-function-declaration]
  iort_iommu_rmr_get_resv_regions(iommu_fwnode, NULL, head);
  ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
  iort_iommu_get_resv_regions
cc1: some warnings being treated as errors
make[3]: *** [drivers/acpi/arm64/iort.o] Error 1

The function iort_iommu_rmr_get_resv_regions() is declared at #ifdef CONFIG_IOMMU_API area, and the callers of  iort_get_rmr_sids() and iort_put_rmr_sids() would select IOMMU_API.
To fix this error, move the definitions to #ifdef CONFIG_IOMMU_API area.

Fixes: e302eea8f497 ("ACPI/IORT: Add a helper to retrieve RMR info directly")
Signed-off-by: Ren Zhijie <renzhijie2@huawei.com>
---
 drivers/acpi/arm64/iort.c | 56 +++++++++++++++++++--------------------
 1 file changed, 28 insertions(+), 28 deletions(-)

diff --git a/drivers/acpi/arm64/iort.c b/drivers/acpi/arm64/iort.c
index cd1349d3544e..ca2aed86b540 100644
--- a/drivers/acpi/arm64/iort.c
+++ b/drivers/acpi/arm64/iort.c
@@ -1162,6 +1162,34 @@ void iort_iommu_get_resv_regions(struct device *dev, struct list_head *head)
 	iort_iommu_rmr_get_resv_regions(fwspec->iommu_fwnode, dev, head);
 }
 
+/**
+ * iort_get_rmr_sids - Retrieve IORT RMR node reserved regions with
+ *                     associated StreamIDs information.
+ * @iommu_fwnode: fwnode associated with IOMMU
+ * @head: Resereved region list
+ */
+void iort_get_rmr_sids(struct fwnode_handle *iommu_fwnode,
+		       struct list_head *head)
+{
+	iort_iommu_rmr_get_resv_regions(iommu_fwnode, NULL, head);
+}
+EXPORT_SYMBOL_GPL(iort_get_rmr_sids);
+
+/**
+ * iort_put_rmr_sids - Free memory allocated for RMR reserved regions.
+ * @iommu_fwnode: fwnode associated with IOMMU
+ * @head: Resereved region list
+ */
+void iort_put_rmr_sids(struct fwnode_handle *iommu_fwnode,
+		       struct list_head *head)
+{
+	struct iommu_resv_region *entry, *next;
+
+	list_for_each_entry_safe(entry, next, head, list)
+		entry->free(NULL, entry);
+}
+EXPORT_SYMBOL_GPL(iort_put_rmr_sids);
+
 static inline bool iort_iommu_driver_enabled(u8 type)
 {
 	switch (type) {
@@ -1394,34 +1422,6 @@ int iort_dma_get_ranges(struct device *dev, u64 *size)
 		return nc_dma_get_range(dev, size);
 }
 
-/**
- * iort_get_rmr_sids - Retrieve IORT RMR node reserved regions with
- *                     associated StreamIDs information.
- * @iommu_fwnode: fwnode associated with IOMMU
- * @head: Resereved region list
- */
-void iort_get_rmr_sids(struct fwnode_handle *iommu_fwnode,
-		       struct list_head *head)
-{
-	iort_iommu_rmr_get_resv_regions(iommu_fwnode, NULL, head);
-}
-EXPORT_SYMBOL_GPL(iort_get_rmr_sids);
-
-/**
- * iort_put_rmr_sids - Free memory allocated for RMR reserved regions.
- * @iommu_fwnode: fwnode associated with IOMMU
- * @head: Resereved region list
- */
-void iort_put_rmr_sids(struct fwnode_handle *iommu_fwnode,
-		       struct list_head *head)
-{
-	struct iommu_resv_region *entry, *next;
-
-	list_for_each_entry_safe(entry, next, head, list)
-		entry->free(NULL, entry);
-}
-EXPORT_SYMBOL_GPL(iort_put_rmr_sids);
-
 static void __init acpi_iort_register_irq(int hwirq, const char *name,
 					  int trigger,
 					  struct resource *res)
-- 
2.17.1


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* RE: [PATCH -next] ACPI/IORT: Fix build error implicit-function-declaration
  2022-07-24 11:54 [PATCH -next] ACPI/IORT: Fix build error implicit-function-declaration Ren Zhijie
@ 2022-07-25 13:50 ` Shameerali Kolothum Thodi
  2022-07-26  2:53   ` Hanjun Guo
  0 siblings, 1 reply; 4+ messages in thread
From: Shameerali Kolothum Thodi @ 2022-07-25 13:50 UTC (permalink / raw)
  To: renzhijie, lpieralisi@kernel.org, Guohanjun (Hanjun Guo),
	sudeep.holla@arm.com, rafael@kernel.org, lenb@kernel.org,
	jroedel@suse.de, robin.murphy@arm.com
  Cc: linux-acpi@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, lorenzo.pieralisi@linaro.org



> -----Original Message-----
> From: renzhijie
> Sent: 24 July 2022 12:54
> To: lpieralisi@kernel.org; Guohanjun (Hanjun Guo)
> <guohanjun@huawei.com>; sudeep.holla@arm.com; rafael@kernel.org;
> lenb@kernel.org; Shameerali Kolothum Thodi
> <shameerali.kolothum.thodi@huawei.com>; jroedel@suse.de;
> robin.murphy@arm.com
> Cc: linux-acpi@vger.kernel.org; linux-arm-kernel@lists.infradead.org;
> linux-kernel@vger.kernel.org; renzhijie <renzhijie2@huawei.com>
> Subject: [PATCH -next] ACPI/IORT: Fix build error
> implicit-function-declaration
> 
> If CONFIG_ACPI_IORT=y and CONFIG_IOMMU_API is not set,
> make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu-, will be failed, like
> this:
> 
> drivers/acpi/arm64/iort.c: In function ‘iort_get_rmr_sids’:
> drivers/acpi/arm64/iort.c:1406:2: error: implicit declaration of function
> ‘iort_iommu_rmr_get_resv_regions’; did you mean
> ‘iort_iommu_get_resv_regions’? [-Werror=implicit-function-declaration]
>   iort_iommu_rmr_get_resv_regions(iommu_fwnode, NULL, head);
>   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>   iort_iommu_get_resv_regions
> cc1: some warnings being treated as errors
> make[3]: *** [drivers/acpi/arm64/iort.o] Error 1

Thanks for spotting this.

> The function iort_iommu_rmr_get_resv_regions() is declared at #ifdef
> CONFIG_IOMMU_API area, and the callers of  iort_get_rmr_sids() and
> iort_put_rmr_sids() would select IOMMU_API.
> To fix this error, move the definitions to #ifdef CONFIG_IOMMU_API area.

That makes sense. And the only callers of these are SMMU drivers I think we
don't need stub functions under !CONFIG_IOMMU_API(Lorenzo, could you
please double check this). 

Nit: Please wrap the commit description to a max of 75 chars per line.

Thanks.
Shameer

> 
> Fixes: e302eea8f497 ("ACPI/IORT: Add a helper to retrieve RMR info
> directly")
> Signed-off-by: Ren Zhijie <renzhijie2@huawei.com>
> ---
>  drivers/acpi/arm64/iort.c | 56 +++++++++++++++++++--------------------
>  1 file changed, 28 insertions(+), 28 deletions(-)
> 
> diff --git a/drivers/acpi/arm64/iort.c b/drivers/acpi/arm64/iort.c
> index cd1349d3544e..ca2aed86b540 100644
> --- a/drivers/acpi/arm64/iort.c
> +++ b/drivers/acpi/arm64/iort.c
> @@ -1162,6 +1162,34 @@ void iort_iommu_get_resv_regions(struct device
> *dev, struct list_head *head)
>  	iort_iommu_rmr_get_resv_regions(fwspec->iommu_fwnode, dev,
> head);
>  }
> 
> +/**
> + * iort_get_rmr_sids - Retrieve IORT RMR node reserved regions with
> + *                     associated StreamIDs information.
> + * @iommu_fwnode: fwnode associated with IOMMU
> + * @head: Resereved region list
> + */
> +void iort_get_rmr_sids(struct fwnode_handle *iommu_fwnode,
> +		       struct list_head *head)
> +{
> +	iort_iommu_rmr_get_resv_regions(iommu_fwnode, NULL, head);
> +}
> +EXPORT_SYMBOL_GPL(iort_get_rmr_sids);
> +
> +/**
> + * iort_put_rmr_sids - Free memory allocated for RMR reserved regions.
> + * @iommu_fwnode: fwnode associated with IOMMU
> + * @head: Resereved region list
> + */
> +void iort_put_rmr_sids(struct fwnode_handle *iommu_fwnode,
> +		       struct list_head *head)
> +{
> +	struct iommu_resv_region *entry, *next;
> +
> +	list_for_each_entry_safe(entry, next, head, list)
> +		entry->free(NULL, entry);
> +}
> +EXPORT_SYMBOL_GPL(iort_put_rmr_sids);
> +
>  static inline bool iort_iommu_driver_enabled(u8 type)
>  {
>  	switch (type) {
> @@ -1394,34 +1422,6 @@ int iort_dma_get_ranges(struct device *dev, u64
> *size)
>  		return nc_dma_get_range(dev, size);
>  }
> 
> -/**
> - * iort_get_rmr_sids - Retrieve IORT RMR node reserved regions with
> - *                     associated StreamIDs information.
> - * @iommu_fwnode: fwnode associated with IOMMU
> - * @head: Resereved region list
> - */
> -void iort_get_rmr_sids(struct fwnode_handle *iommu_fwnode,
> -		       struct list_head *head)
> -{
> -	iort_iommu_rmr_get_resv_regions(iommu_fwnode, NULL, head);
> -}
> -EXPORT_SYMBOL_GPL(iort_get_rmr_sids);
> -
> -/**
> - * iort_put_rmr_sids - Free memory allocated for RMR reserved regions.
> - * @iommu_fwnode: fwnode associated with IOMMU
> - * @head: Resereved region list
> - */
> -void iort_put_rmr_sids(struct fwnode_handle *iommu_fwnode,
> -		       struct list_head *head)
> -{
> -	struct iommu_resv_region *entry, *next;
> -
> -	list_for_each_entry_safe(entry, next, head, list)
> -		entry->free(NULL, entry);
> -}
> -EXPORT_SYMBOL_GPL(iort_put_rmr_sids);
> -
>  static void __init acpi_iort_register_irq(int hwirq, const char *name,
>  					  int trigger,
>  					  struct resource *res)
> --
> 2.17.1

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH -next] ACPI/IORT: Fix build error implicit-function-declaration
  2022-07-25 13:50 ` Shameerali Kolothum Thodi
@ 2022-07-26  2:53   ` Hanjun Guo
  2022-07-26  3:22     ` Ren Zhijie
  0 siblings, 1 reply; 4+ messages in thread
From: Hanjun Guo @ 2022-07-26  2:53 UTC (permalink / raw)
  To: Shameerali Kolothum Thodi, renzhijie, lpieralisi@kernel.org,
	sudeep.holla@arm.com, rafael@kernel.org, lenb@kernel.org,
	jroedel@suse.de, robin.murphy@arm.com
  Cc: linux-acpi@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, lorenzo.pieralisi@linaro.org

On 2022/7/25 21:50, Shameerali Kolothum Thodi wrote:
[...]
>>
>> If CONFIG_ACPI_IORT=y and CONFIG_IOMMU_API is not set,
>> make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu-, will be failed, like
>> this:
>>
>> drivers/acpi/arm64/iort.c: In function ‘iort_get_rmr_sids’:
>> drivers/acpi/arm64/iort.c:1406:2: error: implicit declaration of function
>> ‘iort_iommu_rmr_get_resv_regions’; did you mean
>> ‘iort_iommu_get_resv_regions’? [-Werror=implicit-function-declaration]
>>    iort_iommu_rmr_get_resv_regions(iommu_fwnode, NULL, head);
>>    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>    iort_iommu_get_resv_regions
>> cc1: some warnings being treated as errors
>> make[3]: *** [drivers/acpi/arm64/iort.o] Error 1
> 
> Thanks for spotting this.
> 
>> The function iort_iommu_rmr_get_resv_regions() is declared at #ifdef
>> CONFIG_IOMMU_API area, and the callers of  iort_get_rmr_sids() and
>> iort_put_rmr_sids() would select IOMMU_API.
>> To fix this error, move the definitions to #ifdef CONFIG_IOMMU_API area.
> 
> That makes sense. And the only callers of these are SMMU drivers I think we
> don't need stub functions under !CONFIG_IOMMU_API(Lorenzo, could you
> please double check this).

I think so, because SMMU drivers will select IOMMU_API,
in drivers/iommu/Kconfig, it says:

# IOMMU_API always gets selected by whoever wants it. 

config IOMMU_API 

bool

> 
> Nit: Please wrap the commit description to a max of 75 chars per line.

Zhijie, would you mind send a updated version?

Thanks
Hanjun

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH -next] ACPI/IORT: Fix build error implicit-function-declaration
  2022-07-26  2:53   ` Hanjun Guo
@ 2022-07-26  3:22     ` Ren Zhijie
  0 siblings, 0 replies; 4+ messages in thread
From: Ren Zhijie @ 2022-07-26  3:22 UTC (permalink / raw)
  To: Hanjun Guo, Shameerali Kolothum Thodi, lpieralisi@kernel.org,
	sudeep.holla@arm.com, rafael@kernel.org, lenb@kernel.org,
	jroedel@suse.de, robin.murphy@arm.com
  Cc: linux-acpi@vger.kernel.org, linux-arm-kernel@lists.infradead.org,
	linux-kernel@vger.kernel.org, lorenzo.pieralisi@linaro.org


在 2022/7/26 10:53, Hanjun Guo 写道:
> On 2022/7/25 21:50, Shameerali Kolothum Thodi wrote:
> [...]
>>>
>>> If CONFIG_ACPI_IORT=y and CONFIG_IOMMU_API is not set,
>>> make ARCH=arm64 CROSS_COMPILE=aarch64-linux-gnu-, will be failed, like
>>> this:
>>>
>>> drivers/acpi/arm64/iort.c: In function ‘iort_get_rmr_sids’:
>>> drivers/acpi/arm64/iort.c:1406:2: error: implicit declaration of 
>>> function
>>> ‘iort_iommu_rmr_get_resv_regions’; did you mean
>>> ‘iort_iommu_get_resv_regions’? [-Werror=implicit-function-declaration]
>>>    iort_iommu_rmr_get_resv_regions(iommu_fwnode, NULL, head);
>>>    ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
>>>    iort_iommu_get_resv_regions
>>> cc1: some warnings being treated as errors
>>> make[3]: *** [drivers/acpi/arm64/iort.o] Error 1
>>
>> Thanks for spotting this.
>>
>>> The function iort_iommu_rmr_get_resv_regions() is declared at #ifdef
>>> CONFIG_IOMMU_API area, and the callers of  iort_get_rmr_sids() and
>>> iort_put_rmr_sids() would select IOMMU_API.
>>> To fix this error, move the definitions to #ifdef CONFIG_IOMMU_API 
>>> area.
>>
>> That makes sense. And the only callers of these are SMMU drivers I 
>> think we
>> don't need stub functions under !CONFIG_IOMMU_API(Lorenzo, could you
>> please double check this).
>
> I think so, because SMMU drivers will select IOMMU_API,
> in drivers/iommu/Kconfig, it says:
>
> # IOMMU_API always gets selected by whoever wants it.
> config IOMMU_API
> bool
>
>>
>> Nit: Please wrap the commit description to a max of 75 chars per line.
>
> Zhijie, would you mind send a updated version?
>
sure, will send patch v2.

Thanks,

Ren Zhijie

> Thanks
> Hanjun
> .


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2022-07-26  3:25 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-07-24 11:54 [PATCH -next] ACPI/IORT: Fix build error implicit-function-declaration Ren Zhijie
2022-07-25 13:50 ` Shameerali Kolothum Thodi
2022-07-26  2:53   ` Hanjun Guo
2022-07-26  3:22     ` Ren Zhijie

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).