Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 19 May 2014 21:06:21 GMT
From:      John Baldwin <jhb@FreeBSD.org>
To:        Perforce Change Reviews <perforce@FreeBSD.org>
Subject:   PERFORCE change 1193982 for review
Message-ID:  <201405192106.s4JL6LGb065011@skunkworks.freebsd.org>

next in thread | raw e-mail | index | archive | help
http://p4web.freebsd.org/@@1193982?ac=10

Change 1193982 by jhb@jhb_jhbbsd on 2014/05/19 21:05:43

	IFC @1193981

Affected files ...

.. //depot/projects/smpng/sys/amd64/amd64/db_disasm.c#17 integrate
.. //depot/projects/smpng/sys/amd64/include/vmm.h#11 integrate
.. //depot/projects/smpng/sys/amd64/include/vmm_instruction_emul.h#5 integrate
.. //depot/projects/smpng/sys/amd64/vmm/intel/vmx.c#14 integrate
.. //depot/projects/smpng/sys/amd64/vmm/intel/vmx.h#9 integrate
.. //depot/projects/smpng/sys/amd64/vmm/intel/vmx_support.S#7 integrate
.. //depot/projects/smpng/sys/amd64/vmm/vmm.c#11 integrate
.. //depot/projects/smpng/sys/amd64/vmm/vmm_instruction_emul.c#9 integrate
.. //depot/projects/smpng/sys/boot/usb/bsd_kernel.c#2 integrate
.. //depot/projects/smpng/sys/boot/usb/bsd_kernel.h#2 integrate
.. //depot/projects/smpng/sys/conf/files#298 integrate
.. //depot/projects/smpng/sys/conf/kern.opts.mk#3 integrate
.. //depot/projects/smpng/sys/dev/i40e/i40e.h#1 branch
.. //depot/projects/smpng/sys/dev/i40e/i40e_adminq.c#1 branch
.. //depot/projects/smpng/sys/dev/i40e/i40e_adminq.h#1 branch
.. //depot/projects/smpng/sys/dev/i40e/i40e_adminq_cmd.h#1 branch
.. //depot/projects/smpng/sys/dev/i40e/i40e_alloc.h#1 branch
.. //depot/projects/smpng/sys/dev/i40e/i40e_common.c#1 branch
.. //depot/projects/smpng/sys/dev/i40e/i40e_hmc.c#1 branch
.. //depot/projects/smpng/sys/dev/i40e/i40e_hmc.h#1 branch
.. //depot/projects/smpng/sys/dev/i40e/i40e_lan_hmc.c#1 branch
.. //depot/projects/smpng/sys/dev/i40e/i40e_lan_hmc.h#1 branch
.. //depot/projects/smpng/sys/dev/i40e/i40e_nvm.c#1 branch
.. //depot/projects/smpng/sys/dev/i40e/i40e_osdep.c#1 branch
.. //depot/projects/smpng/sys/dev/i40e/i40e_osdep.h#1 branch
.. //depot/projects/smpng/sys/dev/i40e/i40e_pf.h#1 branch
.. //depot/projects/smpng/sys/dev/i40e/i40e_prototype.h#1 branch
.. //depot/projects/smpng/sys/dev/i40e/i40e_register.h#1 branch
.. //depot/projects/smpng/sys/dev/i40e/i40e_register_x710_int.h#1 branch
.. //depot/projects/smpng/sys/dev/i40e/i40e_status.h#1 branch
.. //depot/projects/smpng/sys/dev/i40e/i40e_txrx.c#1 branch
.. //depot/projects/smpng/sys/dev/i40e/i40e_type.h#1 branch
.. //depot/projects/smpng/sys/dev/i40e/i40e_virtchnl.h#1 branch
.. //depot/projects/smpng/sys/dev/i40e/if_i40e.c#1 branch
.. //depot/projects/smpng/sys/dev/usb/controller/dwc_otg.c#10 integrate
.. //depot/projects/smpng/sys/dev/usb/controller/dwc_otg.h#5 integrate
.. //depot/projects/smpng/sys/dev/usb/controller/dwc_otg_atmelarm.c#3 delete
.. //depot/projects/smpng/sys/dev/usb/controller/dwc_otg_fdt.c#4 integrate
.. //depot/projects/smpng/sys/dev/usb/controller/usb_controller.c#29 integrate
.. //depot/projects/smpng/sys/dev/usb/usb_bus.h#16 integrate
.. //depot/projects/smpng/sys/dev/usb/usb_core.h#19 integrate
.. //depot/projects/smpng/sys/geom/geom_event.c#43 integrate
.. //depot/projects/smpng/sys/geom/geom_subr.c#74 integrate
.. //depot/projects/smpng/sys/kern/subr_rman.c#47 integrate
.. //depot/projects/smpng/sys/mips/conf/AP93.hints#5 integrate
.. //depot/projects/smpng/sys/modules/i40e/Makefile#1 branch
.. //depot/projects/smpng/sys/modules/usb/dwc_otg/Makefile#4 integrate
.. //depot/projects/smpng/sys/netinet/in_pcb.h#82 integrate
.. //depot/projects/smpng/sys/netinet/in_rss.c#2 integrate
.. //depot/projects/smpng/sys/netinet/in_rss.h#2 integrate
.. //depot/projects/smpng/sys/netinet/ip_output.c#139 integrate
.. //depot/projects/smpng/sys/netinet/tcp_input.c#161 integrate
.. //depot/projects/smpng/sys/netinet/tcp_syncache.c#96 integrate
.. //depot/projects/smpng/sys/netinet/tcp_timer.c#64 integrate
.. //depot/projects/smpng/sys/netpfil/ipfw/ip_fw_nat.c#7 integrate

Differences ...

==== //depot/projects/smpng/sys/amd64/amd64/db_disasm.c#17 (text+ko) ====

@@ -25,7 +25,7 @@
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/sys/amd64/amd64/db_disasm.c 266354 2014-05-17 21:10:03Z jhb $");
+__FBSDID("$FreeBSD: head/sys/amd64/amd64/db_disasm.c 266449 2014-05-19 18:07:37Z jhb $");
 
 /*
  * Instruction disassembler.
@@ -1391,6 +1391,46 @@
 			i_size = NONE;
 			i_mode = 0;
 			break;
+		case 0xd8:
+			i_name = "vmrun";
+			i_size = NONE;
+			i_mode = 0;
+			break;
+		case 0xd9:
+			i_name = "vmmcall";
+			i_size = NONE;
+			i_mode = 0;
+			break;
+		case 0xda:
+			i_name = "vmload";
+			i_size = NONE;
+			i_mode = 0;
+			break;
+		case 0xdb:
+			i_name = "vmsave";
+			i_size = NONE;
+			i_mode = 0;
+			break;
+		case 0xdc:
+			i_name = "stgi";
+			i_size = NONE;
+			i_mode = 0;
+			break;
+		case 0xdd:
+			i_name = "clgi";
+			i_size = NONE;
+			i_mode = 0;
+			break;
+		case 0xde:
+			i_name = "skinit";
+			i_size = NONE;
+			i_mode = 0;
+			break;
+		case 0xdf:
+			i_name = "invlpga";
+			i_size = NONE;
+			i_mode = 0;
+			break;
 		case 0xf8:
 			i_name = "swapgs";
 			i_size = NONE;

==== //depot/projects/smpng/sys/amd64/include/vmm.h#11 (text+ko) ====

@@ -23,7 +23,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: head/sys/amd64/include/vmm.h 266125 2014-05-15 14:16:55Z jhb $
+ * $FreeBSD: head/sys/amd64/include/vmm.h 266424 2014-05-19 03:50:07Z neel $
  */
 
 #ifndef _VMM_H_
@@ -361,6 +361,7 @@
 			uint64_t	cr3;
 			enum vie_cpu_mode cpu_mode;
 			enum vie_paging_mode paging_mode;
+			int		cpl;
 			struct vie	vie;
 		} inst_emul;
 		/*

==== //depot/projects/smpng/sys/amd64/include/vmm_instruction_emul.h#5 (text+ko) ====

@@ -23,7 +23,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: head/sys/amd64/include/vmm_instruction_emul.h 261504 2014-02-05 04:39:03Z jhb $
+ * $FreeBSD: head/sys/amd64/include/vmm_instruction_emul.h 266424 2014-05-19 03:50:07Z neel $
  */
 
 #ifndef	_VMM_INSTRUCTION_EMUL_H_
@@ -119,7 +119,8 @@
  */
 int vmm_fetch_instruction(struct vm *vm, int cpuid,
 			  uint64_t rip, int inst_length, uint64_t cr3,
-			  enum vie_paging_mode paging_mode, struct vie *vie);
+			  enum vie_paging_mode paging_mode, int cpl,
+			  struct vie *vie);
 
 void vie_init(struct vie *vie);
 

==== //depot/projects/smpng/sys/amd64/vmm/intel/vmx.c#14 (text+ko) ====

@@ -23,11 +23,11 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: head/sys/amd64/vmm/intel/vmx.c 265114 2014-04-30 02:08:27Z neel $
+ * $FreeBSD: head/sys/amd64/vmm/intel/vmx.c 266424 2014-05-19 03:50:07Z neel $
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/sys/amd64/vmm/intel/vmx.c 265114 2014-04-30 02:08:27Z neel $");
+__FBSDID("$FreeBSD: head/sys/amd64/vmm/intel/vmx.c 266424 2014-05-19 03:50:07Z neel $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -1498,6 +1498,18 @@
 	return (HANDLED);
 }
 
+/*
+ * From section "Guest Register State" in the Intel SDM: CPL = SS.DPL
+ */
+static int
+vmx_cpl(void)
+{
+	uint32_t ssar;
+
+	ssar = vmcs_read(VMCS_GUEST_SS_ACCESS_RIGHTS);
+	return ((ssar >> 5) & 0x3);
+}
+
 static enum vie_cpu_mode
 vmx_cpu_mode(void)
 {
@@ -1522,6 +1534,18 @@
 		return (PAGING_MODE_PAE);
 }
 
+static void
+vmexit_inst_emul(struct vm_exit *vmexit, uint64_t gpa, uint64_t gla)
+{
+	vmexit->exitcode = VM_EXITCODE_INST_EMUL;
+	vmexit->u.inst_emul.gpa = gpa;
+	vmexit->u.inst_emul.gla = gla;
+	vmexit->u.inst_emul.cr3 = vmcs_guest_cr3();
+	vmexit->u.inst_emul.cpu_mode = vmx_cpu_mode();
+	vmexit->u.inst_emul.paging_mode = vmx_paging_mode();
+	vmexit->u.inst_emul.cpl = vmx_cpl();
+}
+
 static int
 ept_fault_type(uint64_t ept_qual)
 {
@@ -1713,12 +1737,8 @@
 	}
 
 	if (allowed) {
-		vmexit->exitcode = VM_EXITCODE_INST_EMUL;
-		vmexit->u.inst_emul.gpa = DEFAULT_APIC_BASE + offset;
-		vmexit->u.inst_emul.gla = VIE_INVALID_GLA;
-		vmexit->u.inst_emul.cr3 = vmcs_guest_cr3();
-		vmexit->u.inst_emul.cpu_mode = vmx_cpu_mode();
-		vmexit->u.inst_emul.paging_mode = vmx_paging_mode();
+		vmexit_inst_emul(vmexit, DEFAULT_APIC_BASE + offset,
+		    VIE_INVALID_GLA);
 	}
 
 	/*
@@ -1949,12 +1969,7 @@
 			vmexit->u.paging.fault_type = ept_fault_type(qual);
 			vmm_stat_incr(vmx->vm, vcpu, VMEXIT_NESTED_FAULT, 1);
 		} else if (ept_emulation_fault(qual)) {
-			vmexit->exitcode = VM_EXITCODE_INST_EMUL;
-			vmexit->u.inst_emul.gpa = gpa;
-			vmexit->u.inst_emul.gla = vmcs_gla();
-			vmexit->u.inst_emul.cr3 = vmcs_guest_cr3();
-			vmexit->u.inst_emul.cpu_mode = vmx_cpu_mode();
-			vmexit->u.inst_emul.paging_mode = vmx_paging_mode();
+			vmexit_inst_emul(vmexit, gpa, vmcs_gla());
 			vmm_stat_incr(vmx->vm, vcpu, VMEXIT_INST_EMUL, 1);
 		}
 		/*

==== //depot/projects/smpng/sys/amd64/vmm/intel/vmx.h#9 (text+ko) ====

@@ -23,7 +23,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: head/sys/amd64/vmm/intel/vmx.h 264353 2014-04-11 20:15:53Z neel $
+ * $FreeBSD: head/sys/amd64/vmm/intel/vmx.h 266390 2014-05-18 03:50:17Z grehan $
  */
 
 #ifndef _VMX_H_
@@ -67,7 +67,7 @@
 	int		inst_fail_status;
 
 	/*
-	 * The pmap needs to be deactivated in vmx_exit_guest()
+	 * The pmap needs to be deactivated in vmx_enter_guest()
 	 * so keep a copy of the 'pmap' in each vmxctx.
 	 */
 	struct pmap	*pmap;
@@ -121,10 +121,11 @@
 #define	VMX_VMLAUNCH_ERROR	2
 #define	VMX_INVEPT_ERROR	3
 int	vmx_enter_guest(struct vmxctx *ctx, struct vmx *vmx, int launched);
-void	vmx_exit_guest(void);
 void	vmx_call_isr(uintptr_t entry);
 
 u_long	vmx_fix_cr0(u_long cr0);
 u_long	vmx_fix_cr4(u_long cr4);
 
+extern char	vmx_exit_guest[];
+
 #endif

==== //depot/projects/smpng/sys/amd64/vmm/intel/vmx_support.S#7 (text+ko) ====

@@ -24,7 +24,7 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: head/sys/amd64/vmm/intel/vmx_support.S 264353 2014-04-11 20:15:53Z neel $
+ * $FreeBSD: head/sys/amd64/vmm/intel/vmx_support.S 266390 2014-05-18 03:50:17Z grehan $
  */
 
 #include <machine/asmacros.h>
@@ -37,6 +37,10 @@
 #define	LK
 #endif
 
+/* Be friendly to DTrace FBT's prologue/epilogue pattern matching */
+#define VENTER  push %rbp ; mov %rsp,%rbp
+#define VLEAVE  pop %rbp
+
 /*
  * Assumes that %rdi holds a pointer to the 'vmxctx'.
  *
@@ -98,6 +102,7 @@
  * Interrupts must be disabled on entry.
  */
 ENTRY(vmx_enter_guest)
+	VENTER
 	/*
 	 * Save host state before doing anything else.
 	 */
@@ -183,14 +188,17 @@
 	LK btrl	%r10d, PM_ACTIVE(%r11)
 
 	VMX_HOST_RESTORE
+	VLEAVE
 	ret
-END(vmx_enter_guest)
 
 /*
- * void vmx_exit_guest(void)
- * %rsp points to the struct vmxctx
+ * Non-error VM-exit from the guest. Make this a label so it can
+ * be used by C code when setting up the VMCS.
+ * The VMCS-restored %rsp points to the struct vmxctx
  */
-ENTRY(vmx_exit_guest)
+	ALIGN_TEXT
+	.globl	vmx_exit_guest
+vmx_exit_guest:
 	/*
 	 * Save guest state that is not automatically saved in the vmcs.
 	 */
@@ -229,8 +237,9 @@
 	 * value of VMX_GUEST_VMEXIT.
 	 */
 	movl	$VMX_GUEST_VMEXIT, %eax
+	VLEAVE
 	ret
-END(vmx_exit_guest)
+END(vmx_enter_guest)
 
 /*
  * %rdi = interrupt handler entry point
@@ -239,6 +248,7 @@
  * instruction in Intel SDM, Vol 2.
  */
 ENTRY(vmx_call_isr)
+	VENTER
 	mov	%rsp, %r11			/* save %rsp */
 	and	$~0xf, %rsp			/* align on 16-byte boundary */
 	pushq	$KERNEL_SS			/* %ss */
@@ -247,5 +257,6 @@
 	pushq	$KERNEL_CS			/* %cs */
 	cli					/* disable interrupts */
 	callq	*%rdi				/* push %rip and call isr */
+	VLEAVE
 	ret
 END(vmx_call_isr)

==== //depot/projects/smpng/sys/amd64/vmm/vmm.c#11 (text+ko) ====

@@ -23,11 +23,11 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: head/sys/amd64/vmm/vmm.c 265364 2014-05-05 16:19:24Z neel $
+ * $FreeBSD: head/sys/amd64/vmm/vmm.c 266424 2014-05-19 03:50:07Z neel $
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/sys/amd64/vmm/vmm.c 265364 2014-05-05 16:19:24Z neel $");
+__FBSDID("$FreeBSD: head/sys/amd64/vmm/vmm.c 266424 2014-05-19 03:50:07Z neel $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -1131,7 +1131,7 @@
 	struct vie *vie;
 	struct vcpu *vcpu;
 	struct vm_exit *vme;
-	int error, inst_length;
+	int cpl, error, inst_length;
 	uint64_t rip, gla, gpa, cr3;
 	enum vie_cpu_mode cpu_mode;
 	enum vie_paging_mode paging_mode;
@@ -1147,6 +1147,7 @@
 	gla = vme->u.inst_emul.gla;
 	gpa = vme->u.inst_emul.gpa;
 	cr3 = vme->u.inst_emul.cr3;
+	cpl = vme->u.inst_emul.cpl;
 	cpu_mode = vme->u.inst_emul.cpu_mode;
 	paging_mode = vme->u.inst_emul.paging_mode;
 	vie = &vme->u.inst_emul.vie;
@@ -1155,7 +1156,7 @@
 
 	/* Fetch, decode and emulate the faulting instruction */
 	if (vmm_fetch_instruction(vm, vcpuid, rip, inst_length, cr3,
-	    paging_mode, vie) != 0)
+	    paging_mode, cpl, vie) != 0)
 		return (EFAULT);
 
 	if (vmm_decode_instruction(vm, vcpuid, gla, cpu_mode, vie) != 0)

==== //depot/projects/smpng/sys/amd64/vmm/vmm_instruction_emul.c#9 (text+ko) ====

@@ -24,11 +24,11 @@
  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  * SUCH DAMAGE.
  *
- * $FreeBSD: head/sys/amd64/vmm/vmm_instruction_emul.c 264501 2014-04-15 15:11:10Z tychon $
+ * $FreeBSD: head/sys/amd64/vmm/vmm_instruction_emul.c 266424 2014-05-19 03:50:07Z neel $
  */
 
 #include <sys/cdefs.h>
-__FBSDID("$FreeBSD: head/sys/amd64/vmm/vmm_instruction_emul.c 264501 2014-04-15 15:11:10Z tychon $");
+__FBSDID("$FreeBSD: head/sys/amd64/vmm/vmm_instruction_emul.c 266424 2014-05-19 03:50:07Z neel $");
 
 #ifdef _KERNEL
 #include <sys/param.h>
@@ -572,14 +572,16 @@
 }
 
 static int
-gla2gpa(struct vm *vm, uint64_t gla, uint64_t ptpphys,
-	uint64_t *gpa, enum vie_paging_mode paging_mode)
+gla2gpa(struct vm *vm, uint64_t gla, uint64_t ptpphys, uint64_t *gpa,
+    enum vie_paging_mode paging_mode, int cpl)
 {
-	int nlevels, ptpshift, ptpindex;
+	int nlevels, ptpshift, ptpindex, usermode;
 	uint64_t *ptpbase, pte, pgsize;
 	uint32_t *ptpbase32, pte32;
 	void *cookie;
 
+	usermode = (cpl == 3 ? 1 : 0);
+
 	if (paging_mode == PAGING_MODE_FLAT) {
 		*gpa = gla;
 		return (0);
@@ -593,7 +595,7 @@
 
 			ptpbase32 = vm_gpa_hold(vm, ptpphys, PAGE_SIZE,
 						VM_PROT_READ, &cookie);
-			
+
 			if (ptpbase32 == NULL)
 				goto error;
 
@@ -608,7 +610,11 @@
 			if ((pte32 & PG_V) == 0)
 				goto error;
 
-			if (pte32 & PG_PS)
+			if (usermode && (pte32 & PG_U) == 0)
+				goto error;
+
+			/* XXX must be ignored if CR4.PSE=0 */
+			if (nlevels > 0 && (pte32 & PG_PS) != 0)
 				break;
 
 			ptpphys = pte32;
@@ -621,8 +627,8 @@
 	}
 
 	if (paging_mode == PAGING_MODE_PAE) {
-		/* Zero out the lower 5 bits and the upper 12 bits */
-		ptpphys >>= 5; ptpphys <<= 17; ptpphys >>= 12;
+		/* Zero out the lower 5 bits and the upper 32 bits */
+		ptpphys &= 0xffffffe0UL;
 
 		ptpbase = vm_gpa_hold(vm, ptpphys, sizeof(*ptpbase) * 4,
 				      VM_PROT_READ, &cookie);
@@ -663,7 +669,10 @@
 		if ((pte & PG_V) == 0)
 			goto error;
 
-		if (pte & PG_PS) {
+		if (usermode && (pte & PG_U) == 0)
+			goto error;
+
+		if (nlevels > 0 && (pte & PG_PS) != 0) {
 			if (pgsize > 1 * GB)
 				goto error;
 			else
@@ -684,7 +693,7 @@
 
 int
 vmm_fetch_instruction(struct vm *vm, int cpuid, uint64_t rip, int inst_length,
-		      uint64_t cr3, enum vie_paging_mode paging_mode,
+		      uint64_t cr3, enum vie_paging_mode paging_mode, int cpl,
 		      struct vie *vie)
 {
 	int n, err, prot;
@@ -701,7 +710,7 @@
 
 	/* Copy the instruction into 'vie' */
 	while (vie->num_valid < inst_length) {
-		err = gla2gpa(vm, rip, cr3, &gpa, paging_mode);
+		err = gla2gpa(vm, rip, cr3, &gpa, paging_mode, cpl);
 		if (err)
 			break;
 

==== //depot/projects/smpng/sys/boot/usb/bsd_kernel.c#2 (text+ko) ====

@@ -1,4 +1,4 @@
-/* $FreeBSD: head/sys/boot/usb/bsd_kernel.c 246363 2013-02-05 14:44:25Z hselasky $ */
+/* $FreeBSD: head/sys/boot/usb/bsd_kernel.c 266396 2014-05-18 09:29:00Z hselasky $ */
 /*-
  * Copyright (c) 2013 Hans Petter Selasky. All rights reserved.
  *
@@ -380,8 +380,10 @@
 }
 
 void
-device_set_interrupt(device_t dev, intr_fn_t *fn, void *arg)
+device_set_interrupt(device_t dev, driver_filter_t *filter,
+    driver_intr_t *fn, void *arg)
 {
+	dev->dev_irq_filter = filter;
 	dev->dev_irq_fn = fn;
 	dev->dev_irq_arg = arg;
 }
@@ -395,8 +397,16 @@
 		return;
 
 	TAILQ_FOREACH(child, &parent->dev_children, dev_link) {
-		if (child->dev_irq_fn != NULL)
-			(child->dev_irq_fn) (child->dev_irq_arg);
+		int status;
+		if (child->dev_irq_filter != NULL)
+			status = child->dev_irq_filter(child->dev_irq_arg);
+		else
+			status = FILTER_SCHEDULE_THREAD;
+
+		if (status == FILTER_SCHEDULE_THREAD) {
+			if (child->dev_irq_fn != NULL)
+				(child->dev_irq_fn) (child->dev_irq_arg);
+		}
 	}
 }
 

==== //depot/projects/smpng/sys/boot/usb/bsd_kernel.h#2 (text+ko) ====

@@ -1,4 +1,4 @@
-/* $FreeBSD: head/sys/boot/usb/bsd_kernel.h 246363 2013-02-05 14:44:25Z hselasky $ */
+/* $FreeBSD: head/sys/boot/usb/bsd_kernel.h 266396 2014-05-18 09:29:00Z hselasky $ */
 /*-
  * Copyright (c) 2011 Hans Petter Selasky. All rights reserved.
  *
@@ -96,6 +96,7 @@
 #define	MIN(a,b) (((a) < (b)) ? (a) : (b))
 #define	MAX(a,b) (((a) > (b)) ? (a) : (b))
 #define	MTX_DEF 0
+#define	MTX_SPIN 0
 #define	MTX_RECURSE 0
 #define	SX_DUPOK 0
 #define	SX_NOWITNESS 0
@@ -201,6 +202,8 @@
 void	mtx_init(struct mtx *, const char *, const char *, int);
 void	mtx_lock(struct mtx *);
 void	mtx_unlock(struct mtx *);
+#define	mtx_lock_spin(x) mtx_lock(x)
+#define	mtx_unlock_spin(x) mtx_unlock(x)
 int	mtx_owned(struct mtx *);
 void	mtx_destroy(struct mtx *);
 
@@ -266,7 +269,11 @@
 typedef struct driver driver_t;
 typedef struct devclass *devclass_t;
 typedef struct device *device_t;
-typedef void (intr_fn_t)(void *arg);
+typedef void (driver_intr_t)(void *arg);
+typedef int (driver_filter_t)(void *arg);
+#define	FILTER_STRAY		0x01
+#define	FILTER_HANDLED		0x02
+#define	FILTER_SCHEDULE_THREAD	0x04
 
 typedef int device_attach_t (device_t dev);
 typedef int device_detach_t (device_t dev);
@@ -294,7 +301,8 @@
 	const struct module_data *dev_module;
 	void   *dev_sc;
 	void   *dev_aux;
-	intr_fn_t *dev_irq_fn;
+	driver_filter_t *dev_irq_filter;
+	driver_intr_t *dev_irq_fn;
 	void   *dev_irq_arg;
 
 	uint16_t dev_unit;
@@ -341,7 +349,7 @@
 	printf("%s: " fmt, device_get_nameunit(dev),## __VA_ARGS__)
 device_t device_add_child(device_t dev, const char *name, int unit);
 void	device_quiet(device_t dev);
-void	device_set_interrupt(device_t dev, intr_fn_t *fn, void *arg);
+void	device_set_interrupt(device_t dev, driver_filter_t *, driver_intr_t *, void *);
 void	device_run_interrupts(device_t parent);
 void	device_set_ivars(device_t dev, void *ivars);
 void   *device_get_ivars(device_t dev);

==== //depot/projects/smpng/sys/conf/files#298 (text+ko) ====

@@ -1,4 +1,4 @@
-# $FreeBSD: head/sys/conf/files 265813 2014-05-10 12:19:02Z loos $
+# $FreeBSD: head/sys/conf/files 266423 2014-05-19 01:21:02Z jfv $
 #
 # The long compile-with and dependency lines are required because of
 # limitations in config: backslash-newline doesn't work in strings, and
@@ -1417,6 +1417,22 @@
 dev/hwpmc/hwpmc_logging.c	optional hwpmc
 dev/hwpmc/hwpmc_mod.c		optional hwpmc
 dev/hwpmc/hwpmc_soft.c		optional hwpmc
+dev/i40e/if_i40e.c		optional i40e inet \
+	compile-with "${NORMAL_C} -I$S/dev/i40e -DSMP"
+dev/i40e/i40e_txrx.c		optional i40e inet \
+	compile-with "${NORMAL_C} -I$S/dev/i40e -DSMP"
+dev/i40e/i40e_osdep.c		optional i40e inet \
+	compile-with "${NORMAL_C} -I$S/dev/i40e -DSMP"
+dev/i40e/i40e_nvm.c		optional i40e inet \
+	compile-with "${NORMAL_C} -I$S/dev/i40e -DSMP"
+dev/i40e/i40e_lan_hmc.c		optional i40e inet \
+	compile-with "${NORMAL_C} -I$S/dev/i40e -DSMP"
+dev/i40e/i40e_hmc.c		optional i40e inet \
+	compile-with "${NORMAL_C} -I$S/dev/i40e -DSMP"
+dev/i40e/i40e_common.c		optional i40e inet \
+	compile-with "${NORMAL_C} -I$S/dev/i40e -DSMP"
+dev/i40e/i40e_adminq.c		optional i40e inet \
+	compile-with "${NORMAL_C} -I$S/dev/i40e -DSMP"
 dev/ichsmb/ichsmb.c		optional ichsmb
 dev/ichsmb/ichsmb_pci.c		optional ichsmb pci
 dev/ida/ida.c			optional ida

==== //depot/projects/smpng/sys/conf/kern.opts.mk#3 (text+ko) ====

@@ -1,4 +1,4 @@
-# $FreeBSD: head/sys/conf/kern.opts.mk 266349 2014-05-17 20:31:34Z imp $
+# $FreeBSD: head/sys/conf/kern.opts.mk 266446 2014-05-19 16:13:40Z imp $
 
 # Options set in the build system that affect the kernel somehow.
 
@@ -16,6 +16,7 @@
 # src tree.
 
 __DEFAULT_YES_OPTIONS = \
+    ARM_EABI \
     FORMAT_EXTENSIONS \
     KERNEL_SYMBOLS
 

==== //depot/projects/smpng/sys/dev/usb/controller/dwc_otg.c#10 (text+ko) ====

@@ -1,4 +1,4 @@
-/* $FreeBSD: head/sys/dev/usb/controller/dwc_otg.c 266012 2014-05-14 11:32:15Z hselasky $ */
+/* $FreeBSD: head/sys/dev/usb/controller/dwc_otg.c 266394 2014-05-18 09:13:29Z hselasky $ */
 /*-
  * Copyright (c) 2012 Hans Petter Selasky. All rights reserved.
  * Copyright (c) 2010-2011 Aleksandr Rybalko. All rights reserved.
@@ -89,9 +89,6 @@
    ((struct dwc_otg_softc *)(((uint8_t *)(bus)) - \
     ((uint8_t *)&(((struct dwc_otg_softc *)0)->sc_bus))))
 
-#define	DWC_OTG_PC2SC(pc) \
-   DWC_OTG_BUS2SC(USB_DMATAG_TO_XROOT((pc)->tag_parent)->bus)
-
 #define	DWC_OTG_PC2UDEV(pc) \
    (USB_DMATAG_TO_XROOT((pc)->tag_parent)->udev)
 
@@ -104,6 +101,11 @@
    GINTMSK_OTGINTMSK |			\
    GINTMSK_PRTINTMSK)
 
+#define	DWC_OTG_MSK_GINT_THREAD_IRQ				\
+   (GINTSTS_USBRST | GINTSTS_ENUMDONE | GINTSTS_PRTINT |	\
+   GINTSTS_WKUPINT | GINTSTS_USBSUSP | GINTMSK_OTGINTMSK |	\
+   GINTSTS_SESSREQINT)
+
 static int dwc_otg_use_hsic;
 
 static SYSCTL_NODE(_hw_usb, OID_AUTO, dwc_otg, CTLFLAG_RW, 0, "USB DWC OTG");
@@ -590,9 +592,8 @@
 }
 
 static uint8_t
-dwc_otg_host_channel_alloc(struct dwc_otg_td *td, uint8_t which, uint8_t is_out)
+dwc_otg_host_channel_alloc(struct dwc_otg_softc *sc, struct dwc_otg_td *td, uint8_t which, uint8_t is_out)
 {
-	struct dwc_otg_softc *sc;
 	uint32_t tx_p_size;
 	uint32_t tx_np_size;
 	uint8_t x;
@@ -604,9 +605,6 @@
 	if (DWC_OTG_PC2UDEV(td->pc)->flags.self_suspended != 0)
 		return (1);		/* busy - cannot transfer data */
 
-	/* get pointer to softc */
-	sc = DWC_OTG_PC2SC(td->pc);
-
 	/* compute needed TX FIFO size */
 	if (is_out != 0) {
 		if (td->ep_type == UE_INTERRUPT ||
@@ -670,9 +668,8 @@
 }
 
 static void
-dwc_otg_host_channel_free(struct dwc_otg_td *td, uint8_t which)
+dwc_otg_host_channel_free(struct dwc_otg_softc *sc, struct dwc_otg_td *td, uint8_t which)
 {
-	struct dwc_otg_softc *sc;
 	uint8_t x;
 
 	if (td->channel[which] >= DWC_OTG_MAX_CHANNELS)
@@ -684,9 +681,6 @@
 
 	DPRINTF("CH=%d\n", x);
 
-	/* get pointer to softc */
-	sc = DWC_OTG_PC2SC(td->pc);
-
 	/*
 	 * We need to let programmed host channels run till complete
 	 * else the host channel will stop functioning. Assume that
@@ -714,17 +708,13 @@
 }
 
 static uint8_t
-dwc_otg_host_setup_tx(struct dwc_otg_td *td)
+dwc_otg_host_setup_tx(struct dwc_otg_softc *sc, struct dwc_otg_td *td)
 {
 	struct usb_device_request req __aligned(4);
-	struct dwc_otg_softc *sc;
 	uint32_t hcint;
 	uint32_t hcchar;
 	uint8_t delta;
 
-	/* get pointer to softc */
-	sc = DWC_OTG_PC2SC(td->pc);
-
 	if (td->channel[0] < DWC_OTG_MAX_CHANNELS) {
 		hcint = sc->sc_chan_state[td->channel[0]].hcint;
 
@@ -814,7 +804,7 @@
 
 send_pkt:
 	/* free existing channel, if any */
-	dwc_otg_host_channel_free(td, 0);
+	dwc_otg_host_channel_free(sc, td, 0);
 
 	if (sizeof(req) != td->remainder) {
 		td->error_any = 1;
@@ -837,7 +827,7 @@
 	}
 
 	/* allocate a new channel */
-	if (dwc_otg_host_channel_alloc(td, 0, 1)) {
+	if (dwc_otg_host_channel_alloc(sc, td, 0, 1)) {
 		td->state = DWC_CHAN_ST_START;
 		goto busy;
 	}
@@ -875,7 +865,7 @@
 
 send_cpkt:
 	/* free existing channel, if any */
-	dwc_otg_host_channel_free(td, 0);
+	dwc_otg_host_channel_free(sc, td, 0);
 
 	delta = td->tt_complete_slot - sc->sc_last_frame_num - 1;
 	if (td->tt_scheduled == 0 || delta < DWC_OTG_TT_SLOT_MAX) {
@@ -890,7 +880,7 @@
 		goto complete;
 	}
 	/* allocate a new channel */
-	if (dwc_otg_host_channel_alloc(td, 0, 0)) {
+	if (dwc_otg_host_channel_alloc(sc, td, 0, 0)) {
 		td->state = DWC_CHAN_ST_WAIT_C_PKT;
 		goto busy;
 	}
@@ -917,21 +907,17 @@
 	return (1);	/* busy */
 
 complete:
-	dwc_otg_host_channel_free(td, 0);
+	dwc_otg_host_channel_free(sc, td, 0);
 	return (0);	/* complete */
 }
 
 static uint8_t
-dwc_otg_setup_rx(struct dwc_otg_td *td)
+dwc_otg_setup_rx(struct dwc_otg_softc *sc, struct dwc_otg_td *td)
 {
-	struct dwc_otg_softc *sc;
 	struct usb_device_request req __aligned(4);
 	uint32_t temp;
 	uint16_t count;
 
-	/* get pointer to softc */
-	sc = DWC_OTG_PC2SC(td->pc);
-
 	/* check endpoint status */
 
 	if (sc->sc_last_rx_status == 0)
@@ -1072,13 +1058,8 @@
 }
 
 static uint8_t
-dwc_otg_host_rate_check(struct dwc_otg_td *td)
+dwc_otg_host_rate_check(struct dwc_otg_softc *sc, struct dwc_otg_td *td)
 {
-	struct dwc_otg_softc *sc;
-
-	/* get pointer to softc */
-	sc = DWC_OTG_PC2SC(td->pc);
-
 	if (td->ep_type == UE_ISOCHRONOUS) {
 		/* non TT isochronous traffic */
 		if ((td->tmr_val != 0) ||
@@ -1104,17 +1085,14 @@
 }
 
 static uint8_t
-dwc_otg_host_data_rx(struct dwc_otg_td *td)
+dwc_otg_host_data_rx(struct dwc_otg_softc *sc, struct dwc_otg_td *td)
 {
-	struct dwc_otg_softc *sc;
 	uint32_t hcint;
 	uint32_t hcchar;
 	uint32_t count;
 	uint8_t delta;
 	uint8_t channel;
 
-	/* get pointer to softc */
-	sc = DWC_OTG_PC2SC(td->pc);
 	channel = td->channel[td->tt_channel_tog];
 
 	if (channel < DWC_OTG_MAX_CHANNELS) {
@@ -1328,7 +1306,7 @@
 
 receive_pkt:
 	/* free existing channel, if any */
-	dwc_otg_host_channel_free(td, td->tt_channel_tog);
+	dwc_otg_host_channel_free(sc, td, td->tt_channel_tog);
 
   	if (td->hcsplt != 0) {
 		delta = td->tt_complete_slot - sc->sc_last_frame_num - 1;
@@ -1346,13 +1324,13 @@
 		/* complete split */
 		td->hcsplt |= HCSPLT_COMPSPLT;
 	} else if (td->tt_xactpos == HCSPLT_XACTPOS_BEGIN &&
-	    dwc_otg_host_rate_check(td)) {
+	    dwc_otg_host_rate_check(sc, td)) {
 		td->state = DWC_CHAN_ST_WAIT_C_PKT;
 		goto busy;
 	}
 
 	/* allocate a new channel */
-	if (dwc_otg_host_channel_alloc(td, td->tt_channel_tog, 0)) {
+	if (dwc_otg_host_channel_alloc(sc, td, td->tt_channel_tog, 0)) {
 		td->state = DWC_CHAN_ST_WAIT_C_PKT;
 		goto busy;
 	}
@@ -1417,8 +1395,8 @@
 
 receive_spkt:
 	/* free existing channel(s), if any */
-	dwc_otg_host_channel_free(td, 0);
-	dwc_otg_host_channel_free(td, 1);
+	dwc_otg_host_channel_free(sc, td, 0);
+	dwc_otg_host_channel_free(sc, td, 1);
 
 	delta = td->tt_start_slot - sc->sc_last_frame_num - 1;
 	if (td->tt_scheduled == 0 || delta < DWC_OTG_TT_SLOT_MAX) {
@@ -1434,7 +1412,7 @@
 	}
 
 	/* allocate a new channel */
-	if (dwc_otg_host_channel_alloc(td, 0, 0)) {
+	if (dwc_otg_host_channel_alloc(sc, td, 0, 0)) {
 		td->state = DWC_CHAN_ST_START;
 		goto busy;
 	}
@@ -1468,24 +1446,20 @@
 	return (1);	/* busy */
 
 complete:
-	dwc_otg_host_channel_free(td, 0);
-	dwc_otg_host_channel_free(td, 1);
+	dwc_otg_host_channel_free(sc, td, 0);
+	dwc_otg_host_channel_free(sc, td, 1);
 	return (0);	/* complete */
 }
 
 static uint8_t
-dwc_otg_data_rx(struct dwc_otg_td *td)
+dwc_otg_data_rx(struct dwc_otg_softc *sc, struct dwc_otg_td *td)
 {
-	struct dwc_otg_softc *sc;
 	uint32_t temp;
 	uint16_t count;
 	uint8_t got_short;
 
 	got_short = 0;
 
-	/* get pointer to softc */
-	sc = DWC_OTG_PC2SC(td->pc);
-
 	/* check endpoint status */
 	if (sc->sc_last_rx_status == 0)
 		goto not_complete;
@@ -1587,17 +1561,14 @@
 }
 
 static uint8_t
-dwc_otg_host_data_tx(struct dwc_otg_td *td)
+dwc_otg_host_data_tx(struct dwc_otg_softc *sc, struct dwc_otg_td *td)
 {
-	struct dwc_otg_softc *sc;
 	uint32_t count;
 	uint32_t hcint;
 	uint32_t hcchar;
 	uint8_t delta;
 	uint8_t channel;
 
-	/* get pointer to softc */
-	sc = DWC_OTG_PC2SC(td->pc);
 	channel = td->channel[td->tt_channel_tog];
 
 	if (channel < DWC_OTG_MAX_CHANNELS) {
@@ -1723,14 +1694,14 @@
 			td->tt_xactpos++;
 
 		/* free existing channel, if any */
-		dwc_otg_host_channel_free(td, td->tt_channel_tog);
+		dwc_otg_host_channel_free(sc, td, td->tt_channel_tog);
 
 		td->state = DWC_CHAN_ST_TX_PKT_ISOC;
 
 		/* FALLTHROUGH */
 
 	case DWC_CHAN_ST_TX_PKT_ISOC:
-		if (dwc_otg_host_channel_alloc(td, 0, 1))
+		if (dwc_otg_host_channel_alloc(sc, td, 0, 1))
 			break;
 		channel = td->channel[0];
 		goto send_isoc_pkt;
@@ -1741,8 +1712,8 @@
 
 send_pkt:
 	/* free existing channel(s), if any */
-	dwc_otg_host_channel_free(td, 0);
-	dwc_otg_host_channel_free(td, 1);
+	dwc_otg_host_channel_free(sc, td, 0);
+	dwc_otg_host_channel_free(sc, td, 1);
 
 	if (td->hcsplt != 0) {
 		delta = td->tt_start_slot - sc->sc_last_frame_num - 1;
@@ -1757,13 +1728,13 @@
 			td->state = DWC_CHAN_ST_START;
 			goto busy;
 		}
-	} else if (dwc_otg_host_rate_check(td)) {
+	} else if (dwc_otg_host_rate_check(sc, td)) {
 		td->state = DWC_CHAN_ST_START;
 		goto busy;
 	}
 
 	/* allocate a new channel */
-	if (dwc_otg_host_channel_alloc(td, 0, 1)) {
+	if (dwc_otg_host_channel_alloc(sc, td, 0, 1)) {
 		td->state = DWC_CHAN_ST_START;
 		goto busy;
 	}
@@ -1912,7 +1883,7 @@
 
 send_cpkt:
 	/* free existing channel, if any */
-	dwc_otg_host_channel_free(td, td->tt_channel_tog);
+	dwc_otg_host_channel_free(sc, td, td->tt_channel_tog);
 
 	delta = td->tt_complete_slot - sc->sc_last_frame_num - 1;
 	if (td->tt_scheduled == 0 || delta < DWC_OTG_TT_SLOT_MAX) {
@@ -1928,7 +1899,7 @@
 	}
 
 	/* allocate a new channel */
-	if (dwc_otg_host_channel_alloc(td, td->tt_channel_tog, 0)) {
+	if (dwc_otg_host_channel_alloc(sc, td, td->tt_channel_tog, 0)) {
 		td->state = DWC_CHAN_ST_WAIT_C_PKT;
 		goto busy;
 	}
@@ -1986,15 +1957,14 @@
 	return (1);	/* busy */
 
 complete:
-	dwc_otg_host_channel_free(td, 0);
-	dwc_otg_host_channel_free(td, 1);
+	dwc_otg_host_channel_free(sc, td, 0);
+	dwc_otg_host_channel_free(sc, td, 1);
 	return (0);	/* complete */

>>> TRUNCATED FOR MAIL (1000 lines) <<<



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201405192106.s4JL6LGb065011>