New patch
1
Avoid inlined functions with external linkage,
2
convert 'inline' header to 'static inline' in source.
1
3
4
Supersedes: <20221208161152.28976-1-philmd@linaro.org>
5
6
Philippe Mathieu-Daudé (2):
7
hw/arm/smmu-common: Reduce smmu_inv_notifiers_mr() scope
8
hw/arm/smmu-common: Avoid using inlined functions with external
9
linkage
10
11
hw/arm/smmu-common.c | 15 +++++++--------
12
include/hw/arm/smmu-common.h | 3 ---
13
2 files changed, 7 insertions(+), 11 deletions(-)
14
15
--
16
2.38.1
17
18
diff view generated by jsdifflib
New patch
1
This function is not used anywhere outside this file,
2
so we can make the function "static void".
1
3
4
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
5
---
6
hw/arm/smmu-common.c | 2 +-
7
include/hw/arm/smmu-common.h | 3 ---
8
2 files changed, 1 insertion(+), 4 deletions(-)
9
10
diff --git a/hw/arm/smmu-common.c b/hw/arm/smmu-common.c
11
index XXXXXXX..XXXXXXX 100644
12
--- a/hw/arm/smmu-common.c
13
+++ b/hw/arm/smmu-common.c
14
@@ -XXX,XX +XXX,XX @@ static void smmu_unmap_notifier_range(IOMMUNotifier *n)
15
}
16
17
/* Unmap all notifiers attached to @mr */
18
-inline void smmu_inv_notifiers_mr(IOMMUMemoryRegion *mr)
19
+static void smmu_inv_notifiers_mr(IOMMUMemoryRegion *mr)
20
{
21
IOMMUNotifier *n;
22
23
diff --git a/include/hw/arm/smmu-common.h b/include/hw/arm/smmu-common.h
24
index XXXXXXX..XXXXXXX 100644
25
--- a/include/hw/arm/smmu-common.h
26
+++ b/include/hw/arm/smmu-common.h
27
@@ -XXX,XX +XXX,XX @@ void smmu_iotlb_inv_iova(SMMUState *s, int asid, dma_addr_t iova,
28
/* Unmap the range of all the notifiers registered to any IOMMU mr */
29
void smmu_inv_notifiers_all(SMMUState *s);
30
31
-/* Unmap the range of all the notifiers registered to @mr */
32
-void smmu_inv_notifiers_mr(IOMMUMemoryRegion *mr);
33
-
34
#endif /* HW_ARM_SMMU_COMMON_H */
35
--
36
2.38.1
37
38
diff view generated by jsdifflib
1
Similarly to commit 9de9fa5c ("hw/arm/smmu-common: Avoid using
1
When using Clang ("Apple clang version 14.0.0 (clang-1400.0.29.202)")
2
inlined functions with external linkage"):
2
and building with -Wall we get:
3
3
4
None of our code base require / use inlined functions with external
4
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]
5
linkage. Some places use internal inlining in the hot path. These
5
hw/arm/smmu-common.h:170:1: note: use 'static' to give inline function 'smmu_iotlb_inv_iova' internal linkage
6
two functions are certainly not in any hot path and don't justify
6
void smmu_iotlb_inv_iova(SMMUState *s, int asid, dma_addr_t iova,
7
any inlining, so these are likely oversights rather than intentional.
7
^
8
static
8
9
9
Fixes: b8fa4c23 (hw/arm/smmu: Support nesting in the rest of commands)
10
None of our code base require / use inlined functions with external
10
Signed-off-by: JianChunfu <jansef.jian@hj-micro.com>
11
linkage. Some places use internal inlining in the hot path. These
12
two functions are certainly not in any hot path and don't justify
13
any inlining, so these are likely oversights rather than intentional.
14
15
Reported-by: Stefan Weil <sw@weilnetz.de>
16
Reviewed-by: Peter Maydell <peter.maydell@linaro.org>
17
Signed-off-by: Philippe Mathieu-Daudé <philmd@linaro.org>
11
---
18
---
12
hw/arm/smmu-common.c | 2 +-
19
hw/arm/smmu-common.c | 13 ++++++-------
13
1 file changed, 1 insertion(+), 1 deletion(-)
20
1 file changed, 6 insertions(+), 7 deletions(-)
14
21
15
diff --git a/hw/arm/smmu-common.c b/hw/arm/smmu-common.c
22
diff --git a/hw/arm/smmu-common.c b/hw/arm/smmu-common.c
16
index XXXXXXX..XXXXXXX 100644
23
index XXXXXXX..XXXXXXX 100644
17
--- a/hw/arm/smmu-common.c
24
--- a/hw/arm/smmu-common.c
18
+++ b/hw/arm/smmu-common.c
25
+++ b/hw/arm/smmu-common.c
19
@@ -XXX,XX +XXX,XX @@ void smmu_iotlb_inv_vmid(SMMUState *s, int vmid)
26
@@ -XXX,XX +XXX,XX @@ void smmu_iotlb_insert(SMMUState *bs, SMMUTransCfg *cfg, SMMUTLBEntry *new)
20
g_hash_table_foreach_remove(s->iotlb, smmu_hash_remove_by_vmid, &vmid);
27
g_hash_table_insert(bs->iotlb, key, new);
21
}
28
}
22
29
23
-inline void smmu_iotlb_inv_vmid_s1(SMMUState *s, int vmid)
30
-inline void smmu_iotlb_inv_all(SMMUState *s)
24
+void smmu_iotlb_inv_vmid_s1(SMMUState *s, int vmid)
31
+void smmu_iotlb_inv_all(SMMUState *s)
25
{
32
{
26
trace_smmu_iotlb_inv_vmid_s1(vmid);
33
trace_smmu_iotlb_inv_all();
27
g_hash_table_foreach_remove(s->iotlb, smmu_hash_remove_by_vmid_s1, &vmid);
34
g_hash_table_remove_all(s->iotlb);
35
@@ -XXX,XX +XXX,XX @@ static gboolean smmu_hash_remove_by_asid_iova(gpointer key, gpointer value,
36
((entry->iova & ~info->mask) == info->iova);
37
}
38
39
-inline void
40
-smmu_iotlb_inv_iova(SMMUState *s, int asid, dma_addr_t iova,
41
- uint8_t tg, uint64_t num_pages, uint8_t ttl)
42
+void smmu_iotlb_inv_iova(SMMUState *s, int asid, dma_addr_t iova,
43
+ uint8_t tg, uint64_t num_pages, uint8_t ttl)
44
{
45
/* if tg is not set we use 4KB range invalidation */
46
uint8_t granule = tg ? tg * 2 + 10 : 12;
47
@@ -XXX,XX +XXX,XX @@ smmu_iotlb_inv_iova(SMMUState *s, int asid, dma_addr_t iova,
48
&info);
49
}
50
51
-inline void smmu_iotlb_inv_asid(SMMUState *s, uint16_t asid)
52
+void smmu_iotlb_inv_asid(SMMUState *s, uint16_t asid)
53
{
54
trace_smmu_iotlb_inv_asid(asid);
55
g_hash_table_foreach_remove(s->iotlb, smmu_hash_remove_by_asid, &asid);
56
@@ -XXX,XX +XXX,XX @@ error:
57
*
58
* return 0 on success
59
*/
60
-inline int smmu_ptw(SMMUTransCfg *cfg, dma_addr_t iova, IOMMUAccessFlags perm,
61
- SMMUTLBEntry *tlbe, SMMUPTWEventInfo *info)
62
+int smmu_ptw(SMMUTransCfg *cfg, dma_addr_t iova, IOMMUAccessFlags perm,
63
+ SMMUTLBEntry *tlbe, SMMUPTWEventInfo *info)
64
{
65
if (!cfg->aa64) {
66
/*
28
--
67
--
29
2.43.0
68
2.38.1
69
70
diff view generated by jsdifflib