@@ -12,7 +12,7 @@
#include <asm/errata_list.h>
#ifdef CONFIG_MMU
-extern unsigned long asid_mask;
+extern xlen_t asid_mask;
static inline void local_flush_tlb_all(void)
{
@@ -20,9 +20,9 @@
DEFINE_STATIC_KEY_FALSE(use_asid_allocator);
-static unsigned long asid_bits;
+static xlen_t asid_bits;
static unsigned long num_asids;
-unsigned long asid_mask;
+xlen_t asid_mask;
static atomic_long_t current_version;
@@ -227,14 +227,18 @@ static inline void set_mm(struct mm_struct *prev,
static int __init asids_init(void)
{
- unsigned long old;
+ xlen_t old;
/* Figure-out number of ASID bits in HW */
old = csr_read(CSR_SATP);
asid_bits = old | (SATP_ASID_MASK << SATP_ASID_SHIFT);
csr_write(CSR_SATP, asid_bits);
asid_bits = (csr_read(CSR_SATP) >> SATP_ASID_SHIFT) & SATP_ASID_MASK;
- asid_bits = fls_long(asid_bits);
+#if __riscv_xlen == 64
+ asid_bits = fls64(asid_bits);
+#else
+ asid_bits = fls(asid_bits);
+#endif
csr_write(CSR_SATP, old);
/*
@@ -267,9 +271,9 @@ static int __init asids_init(void)
static_branch_enable(&use_asid_allocator);
pr_info("ASID allocator using %lu bits (%lu entries)\n",
- asid_bits, num_asids);
+ (ulong)asid_bits, num_asids);
} else {
- pr_info("ASID allocator disabled (%lu bits)\n", asid_bits);
+ pr_info("ASID allocator disabled (%lu bits)\n", (ulong)asid_bits);
}
return 0;