~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/mips/sgi-ip27/ip27-klnuma.c

Version: ~ [ linux-6.12-rc7 ] ~ [ linux-6.11.7 ] ~ [ linux-6.10.14 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.60 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.116 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.171 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.229 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.285 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.323 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.12 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

Diff markup

Differences between /arch/mips/sgi-ip27/ip27-klnuma.c (Version linux-6.12-rc7) and /arch/mips/sgi-ip27/ip27-klnuma.c (Version linux-5.17.15)


  1 // SPDX-License-Identifier: GPL-2.0                 1 // SPDX-License-Identifier: GPL-2.0
  2 /*                                                  2 /*
  3  * Ported from IRIX to Linux by Kanoj Sarcar,       3  * Ported from IRIX to Linux by Kanoj Sarcar, 06/08/00.
  4  * Copyright 2000 - 2001 Silicon Graphics, Inc      4  * Copyright 2000 - 2001 Silicon Graphics, Inc.
  5  * Copyright 2000 - 2001 Kanoj Sarcar (kanoj@s      5  * Copyright 2000 - 2001 Kanoj Sarcar (kanoj@sgi.com)
  6  */                                                 6  */
  7 #include <linux/init.h>                             7 #include <linux/init.h>
  8 #include <linux/mm.h>                               8 #include <linux/mm.h>
  9 #include <linux/mmzone.h>                           9 #include <linux/mmzone.h>
 10 #include <linux/kernel.h>                          10 #include <linux/kernel.h>
 11 #include <linux/nodemask.h>                        11 #include <linux/nodemask.h>
 12 #include <linux/string.h>                          12 #include <linux/string.h>
 13                                                    13 
 14 #include <asm/page.h>                              14 #include <asm/page.h>
 15 #include <asm/sections.h>                          15 #include <asm/sections.h>
 16 #include <asm/sn/types.h>                          16 #include <asm/sn/types.h>
 17 #include <asm/sn/arch.h>                           17 #include <asm/sn/arch.h>
 18 #include <asm/sn/gda.h>                            18 #include <asm/sn/gda.h>
 19 #include <asm/sn/mapped_kernel.h>                  19 #include <asm/sn/mapped_kernel.h>
 20                                                    20 
 21 #include "ip27-common.h"                           21 #include "ip27-common.h"
 22                                                    22 
 23 static nodemask_t ktext_repmask;                   23 static nodemask_t ktext_repmask;
 24                                                    24 
 25 /*                                                 25 /*
 26  * XXX - This needs to be much smarter about w     26  * XXX - This needs to be much smarter about where it puts copies of the
 27  * kernel.  For example, we should never put a     27  * kernel.  For example, we should never put a copy on a headless node,
 28  * and we should respect the topology of the m     28  * and we should respect the topology of the machine.
 29  */                                                29  */
 30 void __init setup_replication_mask(void)           30 void __init setup_replication_mask(void)
 31 {                                                  31 {
 32         /* Set only the master cnode's bit.  T     32         /* Set only the master cnode's bit.  The master cnode is always 0. */
 33         nodes_clear(ktext_repmask);                33         nodes_clear(ktext_repmask);
 34         node_set(0, ktext_repmask);                34         node_set(0, ktext_repmask);
 35                                                    35 
 36 #ifdef CONFIG_REPLICATE_KTEXT                      36 #ifdef CONFIG_REPLICATE_KTEXT
 37 #ifndef CONFIG_MAPPED_KERNEL                       37 #ifndef CONFIG_MAPPED_KERNEL
 38 #error Kernel replication works with mapped ke     38 #error Kernel replication works with mapped kernel support. No calias support.
 39 #endif                                             39 #endif
 40         {                                          40         {
 41                 nasid_t nasid;                     41                 nasid_t nasid;
 42                                                    42 
 43                 for_each_online_node(nasid) {      43                 for_each_online_node(nasid) {
 44                         if (nasid == 0)            44                         if (nasid == 0)
 45                                 continue;          45                                 continue;
 46                         /* Advertise that we h     46                         /* Advertise that we have a copy of the kernel */
 47                         node_set(nasid, ktext_     47                         node_set(nasid, ktext_repmask);
 48                 }                                  48                 }
 49         }                                          49         }
 50 #endif                                             50 #endif
 51         /* Set up a GDA pointer to the replica     51         /* Set up a GDA pointer to the replication mask. */
 52         GDA->g_ktext_repmask = &ktext_repmask;     52         GDA->g_ktext_repmask = &ktext_repmask;
 53 }                                                  53 }
 54                                                    54 
 55                                                    55 
 56 static __init void set_ktext_source(nasid_t cl     56 static __init void set_ktext_source(nasid_t client_nasid, nasid_t server_nasid)
 57 {                                                  57 {
 58         kern_vars_t *kvp;                          58         kern_vars_t *kvp;
 59                                                    59 
 60         kvp = &hub_data(client_nasid)->kern_va     60         kvp = &hub_data(client_nasid)->kern_vars;
 61                                                    61 
 62         KERN_VARS_ADDR(client_nasid) = (unsign     62         KERN_VARS_ADDR(client_nasid) = (unsigned long)kvp;
 63                                                    63 
 64         kvp->kv_magic = KV_MAGIC;                  64         kvp->kv_magic = KV_MAGIC;
 65         kvp->kv_ro_nasid = server_nasid;           65         kvp->kv_ro_nasid = server_nasid;
 66         kvp->kv_rw_nasid = master_nasid;           66         kvp->kv_rw_nasid = master_nasid;
 67         kvp->kv_ro_baseaddr = NODE_CAC_BASE(se     67         kvp->kv_ro_baseaddr = NODE_CAC_BASE(server_nasid);
 68         kvp->kv_rw_baseaddr = NODE_CAC_BASE(ma     68         kvp->kv_rw_baseaddr = NODE_CAC_BASE(master_nasid);
 69         printk("REPLICATION: ON nasid %d, ktex     69         printk("REPLICATION: ON nasid %d, ktext from nasid %d, kdata from nasid %d\n", client_nasid, server_nasid, master_nasid);
 70 }                                                  70 }
 71                                                    71 
 72 /* XXX - When the BTE works, we should use it      72 /* XXX - When the BTE works, we should use it instead of this. */
 73 static __init void copy_kernel(nasid_t dest_na     73 static __init void copy_kernel(nasid_t dest_nasid)
 74 {                                                  74 {
 75         unsigned long dest_kern_start, source_     75         unsigned long dest_kern_start, source_start, source_end, kern_size;
 76                                                    76 
 77         source_start = (unsigned long) _stext;     77         source_start = (unsigned long) _stext;
 78         source_end = (unsigned long) _etext;       78         source_end = (unsigned long) _etext;
 79         kern_size = source_end - source_start;     79         kern_size = source_end - source_start;
 80                                                    80 
 81         dest_kern_start = CHANGE_ADDR_NASID(MA     81         dest_kern_start = CHANGE_ADDR_NASID(MAPPED_KERN_RO_TO_K0(source_start),
 82                                             de     82                                             dest_nasid);
 83         memcpy((void *)dest_kern_start, (void      83         memcpy((void *)dest_kern_start, (void *)source_start, kern_size);
 84 }                                                  84 }
 85                                                    85 
 86 void __init replicate_kernel_text(void)            86 void __init replicate_kernel_text(void)
 87 {                                                  87 {
 88         nasid_t client_nasid;                      88         nasid_t client_nasid;
 89         nasid_t server_nasid;                      89         nasid_t server_nasid;
 90                                                    90 
 91         server_nasid = master_nasid;               91         server_nasid = master_nasid;
 92                                                    92 
 93         /* Record where the master node should     93         /* Record where the master node should get its kernel text */
 94         set_ktext_source(master_nasid, master_     94         set_ktext_source(master_nasid, master_nasid);
 95                                                    95 
 96         for_each_online_node(client_nasid) {       96         for_each_online_node(client_nasid) {
 97                 if (client_nasid == 0)             97                 if (client_nasid == 0)
 98                         continue;                  98                         continue;
 99                                                    99 
100                 /* Check if this node should g    100                 /* Check if this node should get a copy of the kernel */
101                 if (node_isset(client_nasid, k    101                 if (node_isset(client_nasid, ktext_repmask)) {
102                         server_nasid = client_    102                         server_nasid = client_nasid;
103                         copy_kernel(server_nas    103                         copy_kernel(server_nasid);
104                 }                                 104                 }
105                                                   105 
106                 /* Record where this node shou    106                 /* Record where this node should get its kernel text */
107                 set_ktext_source(client_nasid,    107                 set_ktext_source(client_nasid, server_nasid);
108         }                                         108         }
109 }                                                 109 }
110                                                   110 
111 /*                                                111 /*
112  * Return pfn of first free page of memory on     112  * Return pfn of first free page of memory on a node. PROM may allocate
113  * data structures on the first couple of page    113  * data structures on the first couple of pages of the first slot of each
114  * node. If this is the case, getfirstfree(nod    114  * node. If this is the case, getfirstfree(node) > getslotstart(node, 0).
115  */                                               115  */
116 unsigned long node_getfirstfree(nasid_t nasid)    116 unsigned long node_getfirstfree(nasid_t nasid)
117 {                                                 117 {
118         unsigned long loadbase = REP_BASE;        118         unsigned long loadbase = REP_BASE;
119         unsigned long offset;                     119         unsigned long offset;
120                                                   120 
121 #ifdef CONFIG_MAPPED_KERNEL                       121 #ifdef CONFIG_MAPPED_KERNEL
122         loadbase += 16777216;                     122         loadbase += 16777216;
123 #endif                                            123 #endif
124         offset = PAGE_ALIGN((unsigned long)(&_    124         offset = PAGE_ALIGN((unsigned long)(&_end)) - loadbase;
125         if ((nasid == 0) || (node_isset(nasid,    125         if ((nasid == 0) || (node_isset(nasid, ktext_repmask)))
126                 return TO_NODE(nasid, offset)     126                 return TO_NODE(nasid, offset) >> PAGE_SHIFT;
127         else                                      127         else
128                 return KDM_TO_PHYS(PAGE_ALIGN(    128                 return KDM_TO_PHYS(PAGE_ALIGN(SYMMON_STK_ADDR(nasid, 0))) >> PAGE_SHIFT;
129 }                                                 129 }
130                                                   130 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php