mp_machdep.c (236830) | mp_machdep.c (236938) |
---|---|
1/*- 2 * Copyright (c) 1996, by Steve Passe 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 10 unchanged lines hidden (view full) --- 19 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 20 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 21 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 22 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 23 * SUCH DAMAGE. 24 */ 25 26#include <sys/cdefs.h> | 1/*- 2 * Copyright (c) 1996, by Steve Passe 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 10 unchanged lines hidden (view full) --- 19 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 20 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 21 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 22 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 23 * SUCH DAMAGE. 24 */ 25 26#include <sys/cdefs.h> |
27__FBSDID("$FreeBSD: head/sys/i386/i386/mp_machdep.c 236830 2012-06-10 02:38:51Z iwasaki $"); | 27__FBSDID("$FreeBSD: head/sys/i386/i386/mp_machdep.c 236938 2012-06-12 00:14:54Z iwasaki $"); |
28 29#include "opt_apic.h" 30#include "opt_cpu.h" 31#include "opt_kstack_pages.h" 32#include "opt_pmap.h" 33#include "opt_sched.h" 34#include "opt_smp.h" 35 --- 1040 unchanged lines hidden (view full) --- 1076 int cpus; 1077 1078 /* calculate the vector */ 1079 vector = (boot_address >> 12) & 0xff; 1080 1081 /* used as a watchpoint to signal AP startup */ 1082 cpus = mp_naps; 1083 | 28 29#include "opt_apic.h" 30#include "opt_cpu.h" 31#include "opt_kstack_pages.h" 32#include "opt_pmap.h" 33#include "opt_sched.h" 34#include "opt_smp.h" 35 --- 1040 unchanged lines hidden (view full) --- 1076 int cpus; 1077 1078 /* calculate the vector */ 1079 vector = (boot_address >> 12) & 0xff; 1080 1081 /* used as a watchpoint to signal AP startup */ 1082 cpus = mp_naps; 1083 |
1084 ipi_startup(apic_id, vector); 1085 1086 /* Wait up to 5 seconds for it to start. */ 1087 for (ms = 0; ms < 5000; ms++) { 1088 if (mp_naps > cpus) 1089 return 1; /* return SUCCESS */ 1090 DELAY(1000); 1091 } 1092 return 0; /* return FAILURE */ 1093} 1094 1095#ifdef COUNT_XINVLTLB_HITS 1096u_int xhits_gbl[MAXCPU]; 1097u_int xhits_pg[MAXCPU]; 1098u_int xhits_rng[MAXCPU]; 1099static SYSCTL_NODE(_debug, OID_AUTO, xhits, CTLFLAG_RW, 0, ""); 1100SYSCTL_OPAQUE(_debug_xhits, OID_AUTO, global, CTLFLAG_RW, &xhits_gbl, 1101 sizeof(xhits_gbl), "IU", ""); 1102SYSCTL_OPAQUE(_debug_xhits, OID_AUTO, page, CTLFLAG_RW, &xhits_pg, 1103 sizeof(xhits_pg), "IU", ""); 1104SYSCTL_OPAQUE(_debug_xhits, OID_AUTO, range, CTLFLAG_RW, &xhits_rng, 1105 sizeof(xhits_rng), "IU", ""); 1106 1107u_int ipi_global; 1108u_int ipi_page; 1109u_int ipi_range; 1110u_int ipi_range_size; 1111SYSCTL_INT(_debug_xhits, OID_AUTO, ipi_global, CTLFLAG_RW, &ipi_global, 0, ""); 1112SYSCTL_INT(_debug_xhits, OID_AUTO, ipi_page, CTLFLAG_RW, &ipi_page, 0, ""); 1113SYSCTL_INT(_debug_xhits, OID_AUTO, ipi_range, CTLFLAG_RW, &ipi_range, 0, ""); 1114SYSCTL_INT(_debug_xhits, OID_AUTO, ipi_range_size, CTLFLAG_RW, &ipi_range_size, 1115 0, ""); 1116 1117u_int ipi_masked_global; 1118u_int ipi_masked_page; 1119u_int ipi_masked_range; 1120u_int ipi_masked_range_size; 1121SYSCTL_INT(_debug_xhits, OID_AUTO, ipi_masked_global, CTLFLAG_RW, 1122 &ipi_masked_global, 0, ""); 1123SYSCTL_INT(_debug_xhits, OID_AUTO, ipi_masked_page, CTLFLAG_RW, 1124 &ipi_masked_page, 0, ""); 1125SYSCTL_INT(_debug_xhits, OID_AUTO, ipi_masked_range, CTLFLAG_RW, 1126 &ipi_masked_range, 0, ""); 1127SYSCTL_INT(_debug_xhits, OID_AUTO, ipi_masked_range_size, CTLFLAG_RW, 1128 &ipi_masked_range_size, 0, ""); 1129#endif /* COUNT_XINVLTLB_HITS */ 1130 1131/* 1132 * Init and startup IPI. 1133 */ 1134void 1135ipi_startup(int apic_id, int vector) 1136{ 1137 |
|
1084 /* 1085 * first we do an INIT/RESET IPI this INIT IPI might be run, reseting 1086 * and running the target CPU. OR this INIT IPI might be latched (P5 1087 * bug), CPU waiting for STARTUP IPI. OR this INIT IPI might be 1088 * ignored. 1089 */ 1090 1091 /* do an INIT IPI: assert RESET */ --- 34 unchanged lines hidden (view full) --- 1126 * recognized after hardware RESET or INIT IPI. 1127 */ 1128 1129 lapic_ipi_raw(APIC_DEST_DESTFLD | APIC_TRIGMOD_EDGE | 1130 APIC_LEVEL_DEASSERT | APIC_DESTMODE_PHY | APIC_DELMODE_STARTUP | 1131 vector, apic_id); 1132 lapic_ipi_wait(-1); 1133 DELAY(200); /* wait ~200uS */ | 1138 /* 1139 * first we do an INIT/RESET IPI this INIT IPI might be run, reseting 1140 * and running the target CPU. OR this INIT IPI might be latched (P5 1141 * bug), CPU waiting for STARTUP IPI. OR this INIT IPI might be 1142 * ignored. 1143 */ 1144 1145 /* do an INIT IPI: assert RESET */ --- 34 unchanged lines hidden (view full) --- 1180 * recognized after hardware RESET or INIT IPI. 1181 */ 1182 1183 lapic_ipi_raw(APIC_DEST_DESTFLD | APIC_TRIGMOD_EDGE | 1184 APIC_LEVEL_DEASSERT | APIC_DESTMODE_PHY | APIC_DELMODE_STARTUP | 1185 vector, apic_id); 1186 lapic_ipi_wait(-1); 1187 DELAY(200); /* wait ~200uS */ |
1134 1135 /* Wait up to 5 seconds for it to start. */ 1136 for (ms = 0; ms < 5000; ms++) { 1137 if (mp_naps > cpus) 1138 return 1; /* return SUCCESS */ 1139 DELAY(1000); 1140 } 1141 return 0; /* return FAILURE */ | |
1142} 1143 | 1188} 1189 |
1144#ifdef COUNT_XINVLTLB_HITS 1145u_int xhits_gbl[MAXCPU]; 1146u_int xhits_pg[MAXCPU]; 1147u_int xhits_rng[MAXCPU]; 1148static SYSCTL_NODE(_debug, OID_AUTO, xhits, CTLFLAG_RW, 0, ""); 1149SYSCTL_OPAQUE(_debug_xhits, OID_AUTO, global, CTLFLAG_RW, &xhits_gbl, 1150 sizeof(xhits_gbl), "IU", ""); 1151SYSCTL_OPAQUE(_debug_xhits, OID_AUTO, page, CTLFLAG_RW, &xhits_pg, 1152 sizeof(xhits_pg), "IU", ""); 1153SYSCTL_OPAQUE(_debug_xhits, OID_AUTO, range, CTLFLAG_RW, &xhits_rng, 1154 sizeof(xhits_rng), "IU", ""); 1155 1156u_int ipi_global; 1157u_int ipi_page; 1158u_int ipi_range; 1159u_int ipi_range_size; 1160SYSCTL_INT(_debug_xhits, OID_AUTO, ipi_global, CTLFLAG_RW, &ipi_global, 0, ""); 1161SYSCTL_INT(_debug_xhits, OID_AUTO, ipi_page, CTLFLAG_RW, &ipi_page, 0, ""); 1162SYSCTL_INT(_debug_xhits, OID_AUTO, ipi_range, CTLFLAG_RW, &ipi_range, 0, ""); 1163SYSCTL_INT(_debug_xhits, OID_AUTO, ipi_range_size, CTLFLAG_RW, &ipi_range_size, 1164 0, ""); 1165 1166u_int ipi_masked_global; 1167u_int ipi_masked_page; 1168u_int ipi_masked_range; 1169u_int ipi_masked_range_size; 1170SYSCTL_INT(_debug_xhits, OID_AUTO, ipi_masked_global, CTLFLAG_RW, 1171 &ipi_masked_global, 0, ""); 1172SYSCTL_INT(_debug_xhits, OID_AUTO, ipi_masked_page, CTLFLAG_RW, 1173 &ipi_masked_page, 0, ""); 1174SYSCTL_INT(_debug_xhits, OID_AUTO, ipi_masked_range, CTLFLAG_RW, 1175 &ipi_masked_range, 0, ""); 1176SYSCTL_INT(_debug_xhits, OID_AUTO, ipi_masked_range_size, CTLFLAG_RW, 1177 &ipi_masked_range_size, 0, ""); 1178#endif /* COUNT_XINVLTLB_HITS */ 1179 | |
1180/* 1181 * Send an IPI to specified CPU handling the bitmap logic. 1182 */ 1183static void 1184ipi_send_cpu(int cpu, u_int ipi) 1185{ 1186 u_int bitmap, old_pending, new_pending; 1187 --- 398 unchanged lines hidden --- | 1190/* 1191 * Send an IPI to specified CPU handling the bitmap logic. 1192 */ 1193static void 1194ipi_send_cpu(int cpu, u_int ipi) 1195{ 1196 u_int bitmap, old_pending, new_pending; 1197 --- 398 unchanged lines hidden --- |