* [PATCH v2 0/2] hw/arm/smmu-common: Avoid using inlined functions with external linkage
@ 2022-12-16 21:49 Philippe Mathieu-Daudé
2022-12-16 21:49 ` [PATCH v2 1/2] hw/arm/smmu-common: Reduce smmu_inv_notifiers_mr() scope Philippe Mathieu-Daudé
` (2 more replies)
0 siblings, 3 replies; 8+ messages in thread
From: Philippe Mathieu-Daudé @ 2022-12-16 21:49 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-arm, Stefan Weil, Peter Maydell, Eric Auger,
Philippe Mathieu-Daudé
Avoid inlined functions with external linkage,
convert 'inline' header to 'static inline' in source.
Supersedes: <20221208161152.28976-1-philmd@linaro.org>
Philippe Mathieu-Daudé (2):
hw/arm/smmu-common: Reduce smmu_inv_notifiers_mr() scope
hw/arm/smmu-common: Avoid using inlined functions with external
linkage
hw/arm/smmu-common.c | 15 +++++++--------
include/hw/arm/smmu-common.h | 3 ---
2 files changed, 7 insertions(+), 11 deletions(-)
--
2.38.1
^ permalink raw reply [flat|nested] 8+ messages in thread
* [PATCH v2 1/2] hw/arm/smmu-common: Reduce smmu_inv_notifiers_mr() scope
2022-12-16 21:49 [PATCH v2 0/2] hw/arm/smmu-common: Avoid using inlined functions with external linkage Philippe Mathieu-Daudé
@ 2022-12-16 21:49 ` Philippe Mathieu-Daudé
2022-12-16 23:55 ` Richard Henderson
2022-12-19 8:39 ` Eric Auger
2022-12-16 21:49 ` [PATCH v2 2/2] hw/arm/smmu-common: Avoid using inlined functions with external linkage Philippe Mathieu-Daudé
2023-01-05 14:51 ` [PATCH v2 0/2] " Peter Maydell
2 siblings, 2 replies; 8+ messages in thread
From: Philippe Mathieu-Daudé @ 2022-12-16 21:49 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-arm, Stefan Weil, Peter Maydell, Eric Auger,
Philippe Mathieu-Daudé
This function is not used anywhere outside this file,
so we can make the function "static void".
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/arm/smmu-common.c | 2 +-
include/hw/arm/smmu-common.h | 3 ---
2 files changed, 1 insertion(+), 4 deletions(-)
diff --git a/hw/arm/smmu-common.c b/hw/arm/smmu-common.c
index 220838525d..9f196625a2 100644
--- a/hw/arm/smmu-common.c
+++ b/hw/arm/smmu-common.c
@@ -483,7 +483,7 @@ static void smmu_unmap_notifier_range(IOMMUNotifier *n)
}
/* Unmap all notifiers attached to @mr */
-inline void smmu_inv_notifiers_mr(IOMMUMemoryRegion *mr)
+static void smmu_inv_notifiers_mr(IOMMUMemoryRegion *mr)
{
IOMMUNotifier *n;
diff --git a/include/hw/arm/smmu-common.h b/include/hw/arm/smmu-common.h
index 21e62342e9..c5683af07d 100644
--- a/include/hw/arm/smmu-common.h
+++ b/include/hw/arm/smmu-common.h
@@ -173,7 +173,4 @@ void smmu_iotlb_inv_iova(SMMUState *s, int asid, dma_addr_t iova,
/* Unmap the range of all the notifiers registered to any IOMMU mr */
void smmu_inv_notifiers_all(SMMUState *s);
-/* Unmap the range of all the notifiers registered to @mr */
-void smmu_inv_notifiers_mr(IOMMUMemoryRegion *mr);
-
#endif /* HW_ARM_SMMU_COMMON_H */
--
2.38.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* [PATCH v2 2/2] hw/arm/smmu-common: Avoid using inlined functions with external linkage
2022-12-16 21:49 [PATCH v2 0/2] hw/arm/smmu-common: Avoid using inlined functions with external linkage Philippe Mathieu-Daudé
2022-12-16 21:49 ` [PATCH v2 1/2] hw/arm/smmu-common: Reduce smmu_inv_notifiers_mr() scope Philippe Mathieu-Daudé
@ 2022-12-16 21:49 ` Philippe Mathieu-Daudé
2022-12-16 23:55 ` Richard Henderson
2022-12-19 8:39 ` Eric Auger
2023-01-05 14:51 ` [PATCH v2 0/2] " Peter Maydell
2 siblings, 2 replies; 8+ messages in thread
From: Philippe Mathieu-Daudé @ 2022-12-16 21:49 UTC (permalink / raw)
To: qemu-devel
Cc: qemu-arm, Stefan Weil, Peter Maydell, Eric Auger,
Philippe Mathieu-Daudé
When using Clang ("Apple clang version 14.0.0 (clang-1400.0.29.202)")
and building with -Wall we get:
hw/arm/smmu-common.c:173:33: warning: static function 'smmu_hash_remove_by_asid_iova' is used in an inline function with external linkage [-Wstatic-in-inline]
hw/arm/smmu-common.h:170:1: note: use 'static' to give inline function 'smmu_iotlb_inv_iova' internal linkage
void smmu_iotlb_inv_iova(SMMUState *s, int asid, dma_addr_t iova,
^
static
None of our code base require / use inlined functions with external
linkage. Some places use internal inlining in the hot path. These
two functions are certainly not in any hot path and don't justify
any inlining, so these are likely oversights rather than intentional.
Reported-by: Stefan Weil <sw@weilnetz.de>
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
---
hw/arm/smmu-common.c | 13 ++++++-------
1 file changed, 6 insertions(+), 7 deletions(-)
diff --git a/hw/arm/smmu-common.c b/hw/arm/smmu-common.c
index 9f196625a2..54186f31cb 100644
--- a/hw/arm/smmu-common.c
+++ b/hw/arm/smmu-common.c
@@ -116,7 +116,7 @@ void smmu_iotlb_insert(SMMUState *bs, SMMUTransCfg *cfg, SMMUTLBEntry *new)
g_hash_table_insert(bs->iotlb, key, new);
}
-inline void smmu_iotlb_inv_all(SMMUState *s)
+void smmu_iotlb_inv_all(SMMUState *s)
{
trace_smmu_iotlb_inv_all();
g_hash_table_remove_all(s->iotlb);
@@ -146,9 +146,8 @@ static gboolean smmu_hash_remove_by_asid_iova(gpointer key, gpointer value,
((entry->iova & ~info->mask) == info->iova);
}
-inline void
-smmu_iotlb_inv_iova(SMMUState *s, int asid, dma_addr_t iova,
- uint8_t tg, uint64_t num_pages, uint8_t ttl)
+void smmu_iotlb_inv_iova(SMMUState *s, int asid, dma_addr_t iova,
+ uint8_t tg, uint64_t num_pages, uint8_t ttl)
{
/* if tg is not set we use 4KB range invalidation */
uint8_t granule = tg ? tg * 2 + 10 : 12;
@@ -174,7 +173,7 @@ smmu_iotlb_inv_iova(SMMUState *s, int asid, dma_addr_t iova,
&info);
}
-inline void smmu_iotlb_inv_asid(SMMUState *s, uint16_t asid)
+void smmu_iotlb_inv_asid(SMMUState *s, uint16_t asid)
{
trace_smmu_iotlb_inv_asid(asid);
g_hash_table_foreach_remove(s->iotlb, smmu_hash_remove_by_asid, &asid);
@@ -374,8 +373,8 @@ error:
*
* return 0 on success
*/
-inline int smmu_ptw(SMMUTransCfg *cfg, dma_addr_t iova, IOMMUAccessFlags perm,
- SMMUTLBEntry *tlbe, SMMUPTWEventInfo *info)
+int smmu_ptw(SMMUTransCfg *cfg, dma_addr_t iova, IOMMUAccessFlags perm,
+ SMMUTLBEntry *tlbe, SMMUPTWEventInfo *info)
{
if (!cfg->aa64) {
/*
--
2.38.1
^ permalink raw reply related [flat|nested] 8+ messages in thread
* Re: [PATCH v2 1/2] hw/arm/smmu-common: Reduce smmu_inv_notifiers_mr() scope
2022-12-16 21:49 ` [PATCH v2 1/2] hw/arm/smmu-common: Reduce smmu_inv_notifiers_mr() scope Philippe Mathieu-Daudé
@ 2022-12-16 23:55 ` Richard Henderson
2022-12-19 8:39 ` Eric Auger
1 sibling, 0 replies; 8+ messages in thread
From: Richard Henderson @ 2022-12-16 23:55 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: qemu-arm, Stefan Weil, Peter Maydell, Eric Auger
On 12/16/22 13:49, Philippe Mathieu-Daudé wrote:
> This function is not used anywhere outside this file,
> so we can make the function "static void".
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2 2/2] hw/arm/smmu-common: Avoid using inlined functions with external linkage
2022-12-16 21:49 ` [PATCH v2 2/2] hw/arm/smmu-common: Avoid using inlined functions with external linkage Philippe Mathieu-Daudé
@ 2022-12-16 23:55 ` Richard Henderson
2022-12-19 8:39 ` Eric Auger
1 sibling, 0 replies; 8+ messages in thread
From: Richard Henderson @ 2022-12-16 23:55 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: qemu-arm, Stefan Weil, Peter Maydell, Eric Auger
On 12/16/22 13:49, Philippe Mathieu-Daudé wrote:
> When using Clang ("Apple clang version 14.0.0 (clang-1400.0.29.202)")
> and building with -Wall we get:
>
> hw/arm/smmu-common.c:173:33: warning: static function 'smmu_hash_remove_by_asid_iova' is used in an inline function with external linkage [-Wstatic-in-inline]
> hw/arm/smmu-common.h:170:1: note: use 'static' to give inline function 'smmu_iotlb_inv_iova' internal linkage
> void smmu_iotlb_inv_iova(SMMUState *s, int asid, dma_addr_t iova,
> ^
> static
>
> None of our code base require / use inlined functions with external
> linkage. Some places use internal inlining in the hot path. These
> two functions are certainly not in any hot path and don't justify
> any inlining, so these are likely oversights rather than intentional.
>
> Reported-by: Stefan Weil<sw@weilnetz.de>
> Reviewed-by: Peter Maydell<peter.maydell@linaro.org>
> Signed-off-by: Philippe Mathieu-Daudé<philmd@linaro.org>
> ---
> hw/arm/smmu-common.c | 13 ++++++-------
> 1 file changed, 6 insertions(+), 7 deletions(-)
Reviewed-by: Richard Henderson <richard.henderson@linaro.org>
r~
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2 2/2] hw/arm/smmu-common: Avoid using inlined functions with external linkage
2022-12-16 21:49 ` [PATCH v2 2/2] hw/arm/smmu-common: Avoid using inlined functions with external linkage Philippe Mathieu-Daudé
2022-12-16 23:55 ` Richard Henderson
@ 2022-12-19 8:39 ` Eric Auger
1 sibling, 0 replies; 8+ messages in thread
From: Eric Auger @ 2022-12-19 8:39 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: qemu-arm, Stefan Weil, Peter Maydell
On 12/16/22 22:49, Philippe Mathieu-Daudé wrote:
> When using Clang ("Apple clang version 14.0.0 (clang-1400.0.29.202)")
> and building with -Wall we get:
>
> hw/arm/smmu-common.c:173:33: warning: static function 'smmu_hash_remove_by_asid_iova' is used in an inline function with external linkage [-Wstatic-in-inline]
> hw/arm/smmu-common.h:170:1: note: use 'static' to give inline function 'smmu_iotlb_inv_iova' internal linkage
> void smmu_iotlb_inv_iova(SMMUState *s, int asid, dma_addr_t iova,
> ^
> static
>
> None of our code base require / use inlined functions with external
> linkage. Some places use internal inlining in the hot path. These
> two functions are certainly not in any hot path and don't justify
> any inlining, so these are likely oversights rather than intentional.
>
> Reported-by: Stefan Weil <sw@weilnetz.de>
> Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Thanks!
Eric
> ---
> hw/arm/smmu-common.c | 13 ++++++-------
> 1 file changed, 6 insertions(+), 7 deletions(-)
>
> diff --git a/hw/arm/smmu-common.c b/hw/arm/smmu-common.c
> index 9f196625a2..54186f31cb 100644
> --- a/hw/arm/smmu-common.c
> +++ b/hw/arm/smmu-common.c
> @@ -116,7 +116,7 @@ void smmu_iotlb_insert(SMMUState *bs, SMMUTransCfg *cfg, SMMUTLBEntry *new)
> g_hash_table_insert(bs->iotlb, key, new);
> }
>
> -inline void smmu_iotlb_inv_all(SMMUState *s)
> +void smmu_iotlb_inv_all(SMMUState *s)
> {
> trace_smmu_iotlb_inv_all();
> g_hash_table_remove_all(s->iotlb);
> @@ -146,9 +146,8 @@ static gboolean smmu_hash_remove_by_asid_iova(gpointer key, gpointer value,
> ((entry->iova & ~info->mask) == info->iova);
> }
>
> -inline void
> -smmu_iotlb_inv_iova(SMMUState *s, int asid, dma_addr_t iova,
> - uint8_t tg, uint64_t num_pages, uint8_t ttl)
> +void smmu_iotlb_inv_iova(SMMUState *s, int asid, dma_addr_t iova,
> + uint8_t tg, uint64_t num_pages, uint8_t ttl)
> {
> /* if tg is not set we use 4KB range invalidation */
> uint8_t granule = tg ? tg * 2 + 10 : 12;
> @@ -174,7 +173,7 @@ smmu_iotlb_inv_iova(SMMUState *s, int asid, dma_addr_t iova,
> &info);
> }
>
> -inline void smmu_iotlb_inv_asid(SMMUState *s, uint16_t asid)
> +void smmu_iotlb_inv_asid(SMMUState *s, uint16_t asid)
> {
> trace_smmu_iotlb_inv_asid(asid);
> g_hash_table_foreach_remove(s->iotlb, smmu_hash_remove_by_asid, &asid);
> @@ -374,8 +373,8 @@ error:
> *
> * return 0 on success
> */
> -inline int smmu_ptw(SMMUTransCfg *cfg, dma_addr_t iova, IOMMUAccessFlags perm,
> - SMMUTLBEntry *tlbe, SMMUPTWEventInfo *info)
> +int smmu_ptw(SMMUTransCfg *cfg, dma_addr_t iova, IOMMUAccessFlags perm,
> + SMMUTLBEntry *tlbe, SMMUPTWEventInfo *info)
> {
> if (!cfg->aa64) {
> /*
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2 1/2] hw/arm/smmu-common: Reduce smmu_inv_notifiers_mr() scope
2022-12-16 21:49 ` [PATCH v2 1/2] hw/arm/smmu-common: Reduce smmu_inv_notifiers_mr() scope Philippe Mathieu-Daudé
2022-12-16 23:55 ` Richard Henderson
@ 2022-12-19 8:39 ` Eric Auger
1 sibling, 0 replies; 8+ messages in thread
From: Eric Auger @ 2022-12-19 8:39 UTC (permalink / raw)
To: Philippe Mathieu-Daudé, qemu-devel
Cc: qemu-arm, Stefan Weil, Peter Maydell
Hi
On 12/16/22 22:49, Philippe Mathieu-Daudé wrote:
> This function is not used anywhere outside this file,
> so we can make the function "static void".
>
> Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Reviewed-by: Eric Auger <eric.auger@redhat.com>
Thanks
Eric
> ---
> hw/arm/smmu-common.c | 2 +-
> include/hw/arm/smmu-common.h | 3 ---
> 2 files changed, 1 insertion(+), 4 deletions(-)
>
> diff --git a/hw/arm/smmu-common.c b/hw/arm/smmu-common.c
> index 220838525d..9f196625a2 100644
> --- a/hw/arm/smmu-common.c
> +++ b/hw/arm/smmu-common.c
> @@ -483,7 +483,7 @@ static void smmu_unmap_notifier_range(IOMMUNotifier *n)
> }
>
> /* Unmap all notifiers attached to @mr */
> -inline void smmu_inv_notifiers_mr(IOMMUMemoryRegion *mr)
> +static void smmu_inv_notifiers_mr(IOMMUMemoryRegion *mr)
> {
> IOMMUNotifier *n;
>
> diff --git a/include/hw/arm/smmu-common.h b/include/hw/arm/smmu-common.h
> index 21e62342e9..c5683af07d 100644
> --- a/include/hw/arm/smmu-common.h
> +++ b/include/hw/arm/smmu-common.h
> @@ -173,7 +173,4 @@ void smmu_iotlb_inv_iova(SMMUState *s, int asid, dma_addr_t iova,
> /* Unmap the range of all the notifiers registered to any IOMMU mr */
> void smmu_inv_notifiers_all(SMMUState *s);
>
> -/* Unmap the range of all the notifiers registered to @mr */
> -void smmu_inv_notifiers_mr(IOMMUMemoryRegion *mr);
> -
> #endif /* HW_ARM_SMMU_COMMON_H */
^ permalink raw reply [flat|nested] 8+ messages in thread
* Re: [PATCH v2 0/2] hw/arm/smmu-common: Avoid using inlined functions with external linkage
2022-12-16 21:49 [PATCH v2 0/2] hw/arm/smmu-common: Avoid using inlined functions with external linkage Philippe Mathieu-Daudé
2022-12-16 21:49 ` [PATCH v2 1/2] hw/arm/smmu-common: Reduce smmu_inv_notifiers_mr() scope Philippe Mathieu-Daudé
2022-12-16 21:49 ` [PATCH v2 2/2] hw/arm/smmu-common: Avoid using inlined functions with external linkage Philippe Mathieu-Daudé
@ 2023-01-05 14:51 ` Peter Maydell
2 siblings, 0 replies; 8+ messages in thread
From: Peter Maydell @ 2023-01-05 14:51 UTC (permalink / raw)
To: Philippe Mathieu-Daudé; +Cc: qemu-devel, qemu-arm, Stefan Weil, Eric Auger
On Fri, 16 Dec 2022 at 21:49, Philippe Mathieu-Daudé <philmd@linaro.org> wrote:
>
> Avoid inlined functions with external linkage,
> convert 'inline' header to 'static inline' in source.
>
> Supersedes: <20221208161152.28976-1-philmd@linaro.org>
>
> Philippe Mathieu-Daudé (2):
> hw/arm/smmu-common: Reduce smmu_inv_notifiers_mr() scope
> hw/arm/smmu-common: Avoid using inlined functions with external
> linkage
Applied to target-arm.next, thanks.
-- PMM
^ permalink raw reply [flat|nested] 8+ messages in thread
end of thread, other threads:[~2023-01-05 14:52 UTC | newest]
Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-12-16 21:49 [PATCH v2 0/2] hw/arm/smmu-common: Avoid using inlined functions with external linkage Philippe Mathieu-Daudé
2022-12-16 21:49 ` [PATCH v2 1/2] hw/arm/smmu-common: Reduce smmu_inv_notifiers_mr() scope Philippe Mathieu-Daudé
2022-12-16 23:55 ` Richard Henderson
2022-12-19 8:39 ` Eric Auger
2022-12-16 21:49 ` [PATCH v2 2/2] hw/arm/smmu-common: Avoid using inlined functions with external linkage Philippe Mathieu-Daudé
2022-12-16 23:55 ` Richard Henderson
2022-12-19 8:39 ` Eric Auger
2023-01-05 14:51 ` [PATCH v2 0/2] " Peter Maydell
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.