Thread (18 messages) flat view 18 messages, 6 authors, 2020-11-30

Re: [PATCH v12 04/10] set_memory: allow querying whether set_direct_map_*() is actually enabled

From: David Hildenbrand <hidden>
Date: 2020-11-25 12:42:57
Also in: linux-arch, linux-arm-kernel, linux-fsdevel, linux-kselftest, linux-mm, linux-riscv, lkml, nvdimm

On 25.11.20 13:11, Mike Rapoport wrote:
On Wed, Nov 25, 2020 at 12:22:52PM +0100, David Hildenbrand wrote:
quoted
quoted
 #include <asm-generic/cacheflush.h>
 
 #endif /* __ASM_CACHEFLUSH_H */
diff --git a/arch/arm64/include/asm/set_memory.h b/arch/arm64/include/asm/set_memory.h
new file mode 100644
index 000000000000..ecb6b0f449ab
--- /dev/null
+++ b/arch/arm64/include/asm/set_memory.h
@@ -0,0 +1,17 @@
+/* SPDX-License-Identifier: GPL-2.0-only */
+
+#ifndef _ASM_ARM64_SET_MEMORY_H
+#define _ASM_ARM64_SET_MEMORY_H
+
+#include <asm-generic/set_memory.h>
+
+bool can_set_direct_map(void);
+#define can_set_direct_map can_set_direct_map
Well, that looks weird.
[...]
We have a lot of those e.g. in linux/pgtable.h
quoted
quoted
 }
+#else /* CONFIG_ARCH_HAS_SET_DIRECT_MAP */
+/*
+ * Some architectures, e.g. ARM64 can disable direct map modifications at
+ * boot time. Let them overrive this query.
+ */
+#ifndef can_set_direct_map
+static inline bool can_set_direct_map(void)
+{
+	return true;
+}
I think we prefer __weak functions for something like that, avoids the
ifdefery.
I'd prefer this for two reasons: first, static inline can be optimized
away and second, there is no really good place to put generic
implementation.
Fair enough

Reviewed-by: David Hildenbrand <redacted>

-- 
Thanks,

David / dhildenb
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help