]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - include/linux/percpu.h
percpu: allow non-linear / sparse cpu -> unit mapping
[karo-tx-linux.git] / include / linux / percpu.h
index e5000343dd6199bcac26d1a4d8865ea63466cd21..1e0e8878dc2a3b3395013c1cdb03cf936e12c736 100644 (file)
 #endif
 
 extern void *pcpu_base_addr;
+extern const int *pcpu_unit_map;
 
-typedef struct page * (*pcpu_get_page_fn_t)(unsigned int cpu, int pageno);
-typedef void (*pcpu_populate_pte_fn_t)(unsigned long addr);
+typedef void * (*pcpu_fc_alloc_fn_t)(unsigned int cpu, size_t size);
+typedef void (*pcpu_fc_free_fn_t)(void *ptr, size_t size);
+typedef void (*pcpu_fc_populate_pte_fn_t)(unsigned long addr);
+typedef void (*pcpu_fc_map_fn_t)(void *ptr, size_t size, void *addr);
 
-extern size_t __init pcpu_setup_first_chunk(pcpu_get_page_fn_t get_page_fn,
+extern size_t __init pcpu_setup_first_chunk(
                                size_t static_size, size_t reserved_size,
-                               ssize_t dyn_size, ssize_t unit_size,
-                               void *base_addr,
-                               pcpu_populate_pte_fn_t populate_pte_fn);
+                               ssize_t dyn_size, size_t unit_size,
+                               void *base_addr, const int *unit_map);
 
 extern ssize_t __init pcpu_embed_first_chunk(
                                size_t static_size, size_t reserved_size,
-                               ssize_t dyn_size, ssize_t unit_size);
+                               ssize_t dyn_size);
+
+extern ssize_t __init pcpu_4k_first_chunk(
+                               size_t static_size, size_t reserved_size,
+                               pcpu_fc_alloc_fn_t alloc_fn,
+                               pcpu_fc_free_fn_t free_fn,
+                               pcpu_fc_populate_pte_fn_t populate_pte_fn);
+
+#ifdef CONFIG_NEED_MULTIPLE_NODES
+extern ssize_t __init pcpu_lpage_first_chunk(
+                               size_t static_size, size_t reserved_size,
+                               ssize_t dyn_size, size_t lpage_size,
+                               pcpu_fc_alloc_fn_t alloc_fn,
+                               pcpu_fc_free_fn_t free_fn,
+                               pcpu_fc_map_fn_t map_fn);
+
+extern void *pcpu_lpage_remapped(void *kaddr);
+#else
+static inline ssize_t __init pcpu_lpage_first_chunk(
+                               size_t static_size, size_t reserved_size,
+                               ssize_t dyn_size, size_t lpage_size,
+                               pcpu_fc_alloc_fn_t alloc_fn,
+                               pcpu_fc_free_fn_t free_fn,
+                               pcpu_fc_map_fn_t map_fn)
+{
+       return -EINVAL;
+}
+
+static inline void *pcpu_lpage_remapped(void *kaddr)
+{
+       return NULL;
+}
+#endif
 
 /*
  * Use this to get to a cpu's version of the per-cpu object