==== //depot/vendor/freebsd/src/sys/amd64/amd64/intr_machdep.c#31 (text+ko) - //depot/projects/ethng/src/sys/amd64/amd64/intr_machdep.c#2 (text+ko) ==== content @@ -51,6 +51,7 @@ #include #include #include +#include #include #include #include @@ -87,7 +88,7 @@ static void intr_assign_next_cpu(struct intsrc *isrc); #endif - +static int intr_assign_cpu(void *arg, u_char cpu); static void intr_init(void *__dummy); static int intr_pic_registered(struct pic *pic); static void intrcnt_setname(const char *name, int index); @@ -145,10 +146,10 @@ #ifdef INTR_FILTER error = intr_event_create(&isrc->is_event, isrc, 0, (mask_fn)isrc->is_pic->pic_enable_source, - intr_eoi_src, intr_disab_eoi_src, "irq%d:", vector); + intr_eoi_src, intr_disab_eoi_src, intr_assign_cpu, "irq%d:", vector); #else error = intr_event_create(&isrc->is_event, isrc, 0, - (mask_fn)isrc->is_pic->pic_enable_source, "irq%d:", vector); + (mask_fn)isrc->is_pic->pic_enable_source, intr_assign_cpu, "irq%d:", vector); #endif if (error) return (error); @@ -430,6 +431,33 @@ sx_xunlock(&intr_table_lock); } +static int +intr_assign_cpu(void *arg, u_char cpu) +{ +#ifdef SMP + struct intsrc *isrc; + + /* + * Don't do anything during early boot. We will pick up the + * assignment once the APs are started. + */ + if (assign_cpu) { + isrc = arg; + + if (bootverbose) + printf("assigning vector=%d to cpu=%d\n", isrc->is_pic->pic_vector(isrc), cpu); + + sx_xlock(&intr_table_lock); + isrc->is_pic->pic_assign_cpu(isrc, cpu_apic_ids[cpu]); + sx_xunlock(&intr_table_lock); + } + return (0); +#else + return (EOPNOTSUPP); +#endif +} + + static void intrcnt_setname(const char *name, int index) { @@ -477,12 +505,16 @@ static void intr_init(void *dummy __unused) { - + int flags = 0; + intrcnt_setname("???", 0); intrcnt_index = 1; STAILQ_INIT(&pics); - sx_init(&intr_table_lock, "intr sources"); - mtx_init(&intrcnt_lock, "intrcnt", NULL, MTX_SPIN); +#ifdef BIND_ALL + flags = SX_RECURSE; +#endif + sx_init_flags(&intr_table_lock, "intr sources", flags); + mtx_init(&intrcnt_lock, "intrcnt", NULL, MTX_SPIN); } SYSINIT(intr_init, SI_SUB_INTR, SI_ORDER_FIRST, intr_init, NULL) @@ -541,15 +573,14 @@ static void intr_assign_next_cpu(struct intsrc *isrc) { - struct pic *pic; - u_int apic_id; - /* * Assign this source to a local APIC in a round-robin fashion. */ - pic = isrc->is_pic; - apic_id = cpu_apic_ids[current_cpu]; - pic->pic_assign_cpu(isrc, apic_id); +#ifdef BIND_ALL + intr_event_bind(isrc->is_event, current_cpu); +#else + isrc->is_pic->pic_assign_cpu(isrc, cpu_apic_ids[current_cpu]); +#endif do { current_cpu++; if (current_cpu >= num_cpus) @@ -557,6 +588,20 @@ } while (!(intr_cpus & (1 << current_cpu))); } +/* Attempt to bind the specified IRQ to the specified CPU. */ +int +intr_bind(u_int vector, u_char cpu) +{ + struct intsrc *isrc; + + isrc = intr_lookup_source(vector); + if (isrc == NULL) + return (EINVAL); + isrc->is_event->ie_source = isrc; + + return (intr_event_bind(isrc->is_event, cpu)); +} + /* * Add a CPU to our mask of valid CPUs that can be destinations of * interrupts. @@ -585,6 +630,10 @@ struct intsrc *isrc; int i; + /* + * XXX should be mp_ncpus but this causes a crash + */ + /* Don't bother on UP. */ if (num_cpus <= 1) return; @@ -594,8 +643,19 @@ assign_cpu = 1; for (i = 0; i < NUM_IO_INTS; i++) { isrc = interrupt_sources[i]; - if (isrc != NULL && isrc->is_handlers > 0) - intr_assign_next_cpu(isrc); + if (isrc != NULL && isrc->is_handlers > 0) { + /* + * If this event is already bound to a CPU, + * then assign the source to that CPU instead + * of picking one via round-robin. + */ + if (isrc->is_event->ie_cpu != NOCPU) + isrc->is_pic->pic_assign_cpu(isrc, + cpu_apic_ids[isrc->is_event->ie_cpu]); + else + intr_assign_next_cpu(isrc); + + } } sx_xunlock(&intr_table_lock); } ==== //depot/vendor/freebsd/src/sys/amd64/amd64/local_apic.c#41 (text+ko) - //depot/projects/ethng/src/sys/amd64/amd64/local_apic.c#4 (text+ko) ==== content @@ -46,6 +46,7 @@ #include #include #include +#include #include #include ==== //depot/vendor/freebsd/src/sys/amd64/amd64/sys_machdep.c#10 (text+ko) - //depot/projects/ethng/src/sys/amd64/amd64/sys_machdep.c#2 (text+ko) ==== content @@ -35,9 +35,11 @@ #include #include -#include +#include +#include #include #include +#include #include #include #include @@ -62,7 +64,10 @@ struct pcb *pcb = curthread->td_pcb; uint32_t i386base; uint64_t a64base; - +#ifdef SMP + struct amd64_intr_bind_args bargs; +#endif + switch(uap->op) { case I386_GET_FSBASE: i386base = pcb->pcb_fsbase; @@ -126,6 +131,15 @@ } break; +#ifdef SMP +/* ABI and API compatible with I386_INTR_BIND. */ + case AMD64_INTR_BIND: + error = copyin(uap->parms, &bargs, + sizeof(struct amd64_intr_bind_args)); + if (error == 0) + error = intr_bind(bargs.vector, bargs.cpu); + break; +#endif default: error = EINVAL; break; ==== //depot/vendor/freebsd/src/sys/amd64/amd64/vm_machdep.c#51 (text+ko) - //depot/projects/ethng/src/sys/amd64/amd64/vm_machdep.c#3 (text+ko) ==== content @@ -571,3 +571,23 @@ return 1; } + +void * +contigmalloc2(vm_page_t m, vm_pindex_t npages, int flags) +{ + return (void *)PHYS_TO_DMAP(VM_PAGE_TO_PHYS(m)); +} + +void +contigfree(void *addr, unsigned long size, struct malloc_type *type) +{ + vm_pindex_t npgs; + vm_page_t m; + int i; + + npgs = round_page(size) >> PAGE_SHIFT; + m = PHYS_TO_VM_PAGE(DMAP_TO_PHYS((vm_offset_t)addr)); + for (i = 0; i < npgs; i++, m++) + vm_page_free(m); + malloc_type_freed(type, npgs << PAGE_SHIFT); +} ==== //depot/vendor/freebsd/src/sys/amd64/conf/GENERIC#106 (text+ko) - //depot/projects/ethng/src/sys/amd64/conf/GENERIC#7 (text+ko) ==== content @@ -19,14 +19,16 @@ # $FreeBSD: src/sys/amd64/conf/GENERIC,v 1.487 2007/10/26 02:35:42 imp Exp $ cpu HAMMER -ident GENERIC +ident CXGB # To statically compile in device wiring instead of /boot/device.hints #hints "GENERIC.hints" # Default places to look for devices. +makeoptions MODULES_OVERRIDE="cxgb em if_vlan linux linprocfs hwpmc netgraph" makeoptions DEBUG=-g # Build kernel with gdb(1) debug symbols -options SCHED_ULE # ULE scheduler +options SCHED_ULE +options IPI_PREEMPTION options PREEMPTION # Enable kernel thread preemption options INET # InterNETworking options INET6 # IPv6 communications protocols @@ -69,8 +71,8 @@ options GDB # Support remote GDB. options INVARIANTS # Enable calls of extra sanity checking options INVARIANT_SUPPORT # Extra sanity checks of internal structures, required by INVARIANTS -options WITNESS # Enable checks to detect deadlocks and cycles -options WITNESS_SKIPSPIN # Don't run witness on spinlocks for speed +#options WITNESS # Enable checks to detect deadlocks and cycles +#options WITNESS_SKIPSPIN # Don't run witness on spinlocks for speed # Make an SMP-capable kernel by default options SMP # Symmetric MultiProcessor Kernel @@ -78,6 +80,9 @@ # CPU frequency control device cpufreq +# Add hooks for PMC +options HWPMC_HOOKS + # Bus support. device acpi device pci @@ -125,28 +130,6 @@ device pass # Passthrough device (direct SCSI access) device ses # SCSI Environmental Services (and SAF-TE) -# RAID controllers interfaced to the SCSI subsystem -device amr # AMI MegaRAID -device arcmsr # Areca SATA II RAID -device ciss # Compaq Smart RAID 5* -device dpt # DPT Smartcache III, IV - See NOTES for options -device hptmv # Highpoint RocketRAID 182x -device rr232x # Highpoint RocketRAID 232x -device iir # Intel Integrated RAID -device ips # IBM (Adaptec) ServeRAID -device mly # Mylex AcceleRAID/eXtremeRAID -device twa # 3ware 9000 series PATA/SATA RAID - -# RAID controllers -device aac # Adaptec FSA RAID -device aacp # SCSI passthrough for aac (requires CAM) -device ida # Compaq Smart RAID -device mfi # LSI MegaRAID SAS -device mlx # Mylex DAC960 family -#XXX pointer/int warnings -#device pst # Promise Supertrak SX6000 -device twe # 3ware ATA RAID - # atkbdc0 controls both the keyboard and the PS/2 mouse device atkbdc # AT keyboard controller device atkbd # AT keyboard @@ -186,68 +169,7 @@ # line to enable it (connects to sio, uart and/or ppc drivers): #device puc -# PCI Ethernet NICs. -device de # DEC/Intel DC21x4x (``Tulip'') -device em # Intel PRO/1000 adapter Gigabit Ethernet Card -device ixgb # Intel PRO/10GbE Ethernet Card -device le # AMD Am7900 LANCE and Am79C9xx PCnet -device txp # 3Com 3cR990 (``Typhoon'') -device vx # 3Com 3c590, 3c595 (``Vortex'') -# PCI Ethernet NICs that use the common MII bus controller code. -# NOTE: Be sure to keep the 'device miibus' line in order to use these NICs! -device miibus # MII bus support -device bce # Broadcom BCM5706/BCM5708 Gigabit Ethernet -device bfe # Broadcom BCM440x 10/100 Ethernet -device bge # Broadcom BCM570xx Gigabit Ethernet -device dc # DEC/Intel 21143 and various workalikes -device fxp # Intel EtherExpress PRO/100B (82557, 82558) -device lge # Level 1 LXT1001 gigabit Ethernet -device msk # Marvell/SysKonnect Yukon II Gigabit Ethernet -device nfe # nVidia nForce MCP on-board Ethernet -device nge # NatSemi DP83820 gigabit Ethernet -#device nve # nVidia nForce MCP on-board Ethernet Networking -device pcn # AMD Am79C97x PCI 10/100 (precedence over 'le') -device re # RealTek 8139C+/8169/8169S/8110S -device rl # RealTek 8129/8139 -device sf # Adaptec AIC-6915 (``Starfire'') -device sis # Silicon Integrated Systems SiS 900/SiS 7016 -device sk # SysKonnect SK-984x & SK-982x gigabit Ethernet -device ste # Sundance ST201 (D-Link DFE-550TX) -device ti # Alteon Networks Tigon I/II gigabit Ethernet -device tl # Texas Instruments ThunderLAN -device tx # SMC EtherPower II (83c170 ``EPIC'') -device vge # VIA VT612x gigabit Ethernet -device vr # VIA Rhine, Rhine II -device wb # Winbond W89C840F -device xl # 3Com 3c90x (``Boomerang'', ``Cyclone'') - -# ISA Ethernet NICs. pccard NICs included. -device cs # Crystal Semiconductor CS89x0 NIC -# 'device ed' requires 'device miibus' -device ed # NE[12]000, SMC Ultra, 3c503, DS8390 cards -device ex # Intel EtherExpress Pro/10 and Pro/10+ -device ep # Etherlink III based cards -device fe # Fujitsu MB8696x based cards -device sn # SMC's 9000 series of Ethernet chips -device xe # Xircom pccard Ethernet - -# Wireless NIC cards -device wlan # 802.11 support -device wlan_wep # 802.11 WEP support -device wlan_ccmp # 802.11 CCMP support -device wlan_tkip # 802.11 TKIP support -device wlan_amrr # AMRR transmit rate control algorithm -device wlan_scan_ap # 802.11 AP mode scanning -device wlan_scan_sta # 802.11 STA mode scanning -device an # Aironet 4500/4800 802.11 wireless NICs. -device ath # Atheros pci/cardbus NIC's -device ath_hal # Atheros HAL (Hardware Access Layer) -device ath_rate_sample # SampleRate tx rate control for ath -device awi # BayStack 660 and others -device ral # Ralink Technology RT2500 wireless NICs. -device wi # WaveLAN/Intersil/Symbol 802.11 wireless NICs. - # Pseudo devices. device loop # Network loopback device random # Entropy device @@ -278,28 +200,9 @@ device ulpt # Printer device umass # Disks/Mass storage - Requires scbus and da device ums # Mouse -device ural # Ralink Technology RT2500USB wireless NICs device rum # Ralink Technology RT2501USB wireless NICs device urio # Diamond Rio 500 MP3 player device uscanner # Scanners -# USB Serial devices -device ucom # Generic com ttys -device uark # Technologies ARK3116 based serial adapters -device ubsa # Belkin F5U103 and compatible serial adapters -device ubser # BWCT console serial adapters -device uftdi # For FTDI usb serial adapters -device uipaq # Some WinCE based devices -device uplcom # Prolific PL-2303 serial adapters -device uvisor # Visor and Palm devices -device uvscom # USB serial support for DDI pocket's PHS -# USB Ethernet, requires miibus -device aue # ADMtek USB Ethernet -device axe # ASIX Electronics USB Ethernet -device cdce # Generic USB over Ethernet -device cue # CATC USB Ethernet -device kue # Kawasaki LSI USB Ethernet -device rue # RealTek RTL8150 USB Ethernet -device udav # Davicom DM9601E USB # FireWire support device firewire # FireWire bus code @@ -308,3 +211,7 @@ device fwip # IP over FireWire (RFC 2734,3146) device dcons # Dumb console driver device dcons_crom # Configuration ROM for dcons + +options ALT_BREAK_TO_DEBUGGER +options IFNET_MULTIQUEUE +#options BIND_ALL ==== - //depot/projects/ethng/src/sys/amd64/conf/MULTIQ#5 ==== ==== //depot/vendor/freebsd/src/sys/amd64/include/intr_machdep.h#17 (text+ko) - //depot/projects/ethng/src/sys/amd64/include/intr_machdep.h#2 (text+ko) ==== content @@ -133,6 +133,7 @@ void elcr_write_trigger(u_int irq, enum intr_trigger trigger); #ifdef SMP void intr_add_cpu(u_int cpu); +int intr_bind(u_int vector, u_char cpu); #endif int intr_add_handler(const char *name, int vector, driver_filter_t filter, driver_intr_t handler, void *arg, enum intr_type flags, ==== //depot/vendor/freebsd/src/sys/amd64/include/pmc_mdep.h#3 (text+ko) - //depot/projects/ethng/src/sys/amd64/include/pmc_mdep.h#2 (text+ko) ==== content @@ -33,10 +33,13 @@ #include #include +#include + union pmc_md_op_pmcallocate { struct pmc_md_amd_op_pmcallocate pm_amd; struct pmc_md_p4_op_pmcallocate pm_p4; + struct pmc_md_ppro_op_pmcallocate pm_ppro; uint64_t __pad[4]; }; @@ -49,6 +52,8 @@ union pmc_md_pmc { struct pmc_md_amd_pmc pm_amd; struct pmc_md_p4_pmc pm_p4; + struct pmc_md_ppro_pmc pm_ppro; + }; struct pmc; ==== //depot/vendor/freebsd/src/sys/amd64/include/sysarch.h#8 (text+ko) - //depot/projects/ethng/src/sys/amd64/include/sysarch.h#2 (text+ko) ==== content @@ -39,6 +39,7 @@ #define I386_SET_FSBASE 8 #define I386_GET_GSBASE 9 #define I386_SET_GSBASE 10 +#define AMD64_INTR_BIND 11 /* Leave space for 0-127 for to avoid translating syscalls */ #define AMD64_GET_FSBASE 128 @@ -46,6 +47,11 @@ #define AMD64_GET_GSBASE 130 #define AMD64_SET_GSBASE 131 +struct amd64_intr_bind_args { + unsigned int vector; + unsigned int cpu; +}; + #ifndef _KERNEL #include @@ -54,6 +60,7 @@ int amd64_get_gsbase(void **); int amd64_set_fsbase(void *); int amd64_set_gsbase(void *); +int amd64_intr_bind(unsigned int, unsigned int); int sysarch(int, void *); __END_DECLS #endif ==== //depot/vendor/freebsd/src/sys/amd64/include/vmparam.h#15 (text+ko) - //depot/projects/ethng/src/sys/amd64/include/vmparam.h#3 (text+ko) ==== content @@ -186,4 +186,10 @@ #define VM_INITIAL_PAGEIN 16 #endif +/* + * We provide a machine specific contiguous mapping function + * which uses the direct map + */ +#define VM_MD_CONTIG + #endif /* _MACHINE_VMPARAM_H_ */