Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at v5.11-rc2 100 lines 2.6 kB view raw
1/* SPDX-License-Identifier: GPL-2.0 */ 2/* 3 * Written by Kanoj Sarcar (kanoj@sgi.com) Aug 99 4 * Adapted for the alpha wildfire architecture Jan 2001. 5 */ 6#ifndef _ASM_MMZONE_H_ 7#define _ASM_MMZONE_H_ 8 9#ifdef CONFIG_DISCONTIGMEM 10 11#include <asm/smp.h> 12 13/* 14 * Following are macros that are specific to this numa platform. 15 */ 16 17extern pg_data_t node_data[]; 18 19#define alpha_pa_to_nid(pa) \ 20 (alpha_mv.pa_to_nid \ 21 ? alpha_mv.pa_to_nid(pa) \ 22 : (0)) 23#define node_mem_start(nid) \ 24 (alpha_mv.node_mem_start \ 25 ? alpha_mv.node_mem_start(nid) \ 26 : (0UL)) 27#define node_mem_size(nid) \ 28 (alpha_mv.node_mem_size \ 29 ? alpha_mv.node_mem_size(nid) \ 30 : ((nid) ? (0UL) : (~0UL))) 31 32#define pa_to_nid(pa) alpha_pa_to_nid(pa) 33#define NODE_DATA(nid) (&node_data[(nid)]) 34 35#define node_localnr(pfn, nid) ((pfn) - NODE_DATA(nid)->node_start_pfn) 36 37#if 1 38#define PLAT_NODE_DATA_LOCALNR(p, n) \ 39 (((p) >> PAGE_SHIFT) - PLAT_NODE_DATA(n)->gendata.node_start_pfn) 40#else 41static inline unsigned long 42PLAT_NODE_DATA_LOCALNR(unsigned long p, int n) 43{ 44 unsigned long temp; 45 temp = p >> PAGE_SHIFT; 46 return temp - PLAT_NODE_DATA(n)->gendata.node_start_pfn; 47} 48#endif 49 50/* 51 * Following are macros that each numa implementation must define. 52 */ 53 54/* 55 * Given a kernel address, find the home node of the underlying memory. 56 */ 57#define kvaddr_to_nid(kaddr) pa_to_nid(__pa(kaddr)) 58 59/* 60 * Given a kaddr, LOCAL_BASE_ADDR finds the owning node of the memory 61 * and returns the kaddr corresponding to first physical page in the 62 * node's mem_map. 63 */ 64#define LOCAL_BASE_ADDR(kaddr) \ 65 ((unsigned long)__va(NODE_DATA(kvaddr_to_nid(kaddr))->node_start_pfn \ 66 << PAGE_SHIFT)) 67 68/* XXX: FIXME -- nyc */ 69#define kern_addr_valid(kaddr) (0) 70 71#define mk_pte(page, pgprot) \ 72({ \ 73 pte_t pte; \ 74 unsigned long pfn; \ 75 \ 76 pfn = page_to_pfn(page) << 32; \ 77 pte_val(pte) = pfn | pgprot_val(pgprot); \ 78 \ 79 pte; \ 80}) 81 82#define pte_page(x) \ 83({ \ 84 unsigned long kvirt; \ 85 struct page * __xx; \ 86 \ 87 kvirt = (unsigned long)__va(pte_val(x) >> (32-PAGE_SHIFT)); \ 88 __xx = virt_to_page(kvirt); \ 89 \ 90 __xx; \ 91}) 92 93#define pfn_to_nid(pfn) pa_to_nid(((u64)(pfn) << PAGE_SHIFT)) 94#define pfn_valid(pfn) \ 95 (((pfn) - node_start_pfn(pfn_to_nid(pfn))) < \ 96 node_spanned_pages(pfn_to_nid(pfn))) \ 97 98#endif /* CONFIG_DISCONTIGMEM */ 99 100#endif /* _ASM_MMZONE_H_ */