Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 7 Jul 2016 20:36:07 +0000 (UTC)
From:      Nathan Whitehorn <nwhitehorn@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-projects@freebsd.org
Subject:   svn commit: r302397 - in projects/powernv: amd64/include arm/ti/cpsw arm64/arm64 arm64/include boot/efi/boot1 boot/fdt boot/powerpc/ofw cam cam/scsi cddl/compat/opensolaris/sys cddl/contrib/opensol...
Message-ID:  <201607072036.u67Ka75i018269@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: nwhitehorn
Date: Thu Jul  7 20:36:07 2016
New Revision: 302397
URL: https://svnweb.freebsd.org/changeset/base/302397

Log:
  IFC @ r302396

Added:
  projects/powernv/contrib/ncsw/inc/integrations/dpaa_integration_ext.h
     - copied unchanged from r302396, head/sys/contrib/ncsw/inc/integrations/dpaa_integration_ext.h
  projects/powernv/contrib/ncsw/integrations/fman_ctrl_code/
     - copied from r302396, head/sys/contrib/ncsw/integrations/fman_ctrl_code/
Deleted:
  projects/powernv/arm64/arm64/gic.c
  projects/powernv/arm64/arm64/gic_acpi.c
  projects/powernv/arm64/arm64/gic_fdt.c
  projects/powernv/arm64/arm64/gic_v3_its.c
  projects/powernv/arm64/arm64/intr_machdep.c
  projects/powernv/arm64/arm64/pic_if.m
  projects/powernv/contrib/ncsw/inc/integrations/P2041/
  projects/powernv/contrib/ncsw/inc/integrations/P3041/
  projects/powernv/contrib/ncsw/inc/integrations/P5020/
  projects/powernv/contrib/ncsw/integrations/P2041/
  projects/powernv/contrib/ncsw/integrations/P3041/
  projects/powernv/contrib/ncsw/integrations/P5020/
  projects/powernv/powerpc/conf/dpaa/config.p2041
  projects/powernv/powerpc/conf/dpaa/config.p3041
  projects/powernv/powerpc/conf/dpaa/config.p5020
  projects/powernv/powerpc/conf/dpaa/files.p2041
  projects/powernv/powerpc/conf/dpaa/files.p3041
  projects/powernv/powerpc/conf/dpaa/files.p5020
Modified:
  projects/powernv/amd64/include/counter.h
  projects/powernv/arm/ti/cpsw/if_cpsw.c
  projects/powernv/arm/ti/cpsw/if_cpswvar.h
  projects/powernv/arm64/include/vmparam.h
  projects/powernv/boot/efi/boot1/boot1.c
  projects/powernv/boot/fdt/fdt_loader_cmd.c
  projects/powernv/boot/powerpc/ofw/ofwfdt.c
  projects/powernv/cam/cam_iosched.c
  projects/powernv/cam/scsi/scsi_all.c
  projects/powernv/cddl/compat/opensolaris/sys/proc.h
  projects/powernv/cddl/contrib/opensolaris/common/acl/acl_common.c
  projects/powernv/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
  projects/powernv/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c
  projects/powernv/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c
  projects/powernv/cddl/contrib/opensolaris/uts/common/sys/acl.h
  projects/powernv/conf/files.arm64
  projects/powernv/conf/newvers.sh
  projects/powernv/contrib/ipfilter/netinet/ip_fil.h
  projects/powernv/contrib/ipfilter/netinet/ip_fil_freebsd.c
  projects/powernv/contrib/ipfilter/netinet/ip_nat.c
  projects/powernv/contrib/ipfilter/netinet/ip_proxy.c
  projects/powernv/contrib/ipfilter/netinet/ip_rpcb_pxy.c
  projects/powernv/contrib/ipfilter/netinet/ip_rules.c
  projects/powernv/contrib/ipfilter/netinet/mlfk_ipl.c
  projects/powernv/contrib/ncsw/inc/error_ext.h
  projects/powernv/contrib/ncsw/inc/integrations/part_ext.h
  projects/powernv/contrib/ncsw/integrations/fman_ucode.h
  projects/powernv/dev/ath/if_ath_tx_ht.c
  projects/powernv/dev/cpuctl/cpuctl.c
  projects/powernv/dev/cxgbe/adapter.h
  projects/powernv/dev/cxgbe/cxgbei/cxgbei.c
  projects/powernv/dev/cxgbe/cxgbei/icl_cxgbei.c
  projects/powernv/dev/cxgbe/iw_cxgbe/cm.c
  projects/powernv/dev/cxgbe/iw_cxgbe/device.c
  projects/powernv/dev/cxgbe/iw_cxgbe/iw_cxgbe.h
  projects/powernv/dev/cxgbe/t4_l2t.c
  projects/powernv/dev/cxgbe/t4_l2t.h
  projects/powernv/dev/cxgbe/t4_main.c
  projects/powernv/dev/cxgbe/t4_sge.c
  projects/powernv/dev/cxgbe/tom/t4_connect.c
  projects/powernv/dev/cxgbe/tom/t4_cpl_io.c
  projects/powernv/dev/cxgbe/tom/t4_ddp.c
  projects/powernv/dev/cxgbe/tom/t4_listen.c
  projects/powernv/dev/cxgbe/tom/t4_tom.c
  projects/powernv/dev/cxgbe/tom/t4_tom.h
  projects/powernv/dev/cxgbe/tom/t4_tom_l2t.c
  projects/powernv/dev/cxgbe/tom/t4_tom_l2t.h
  projects/powernv/dev/e1000/if_em.c
  projects/powernv/dev/e1000/if_igb.c
  projects/powernv/dev/e1000/if_lem.c
  projects/powernv/dev/ioat/ioat.c
  projects/powernv/dev/ioat/ioat_internal.h
  projects/powernv/dev/isci/scil/sati_passthrough.c
  projects/powernv/dev/isci/scil/sati_util.c
  projects/powernv/dev/ixgb/if_ixgb.c
  projects/powernv/dev/ixgbe/if_ix.c
  projects/powernv/dev/ixgbe/if_ixv.c
  projects/powernv/dev/ixl/if_ixl.c
  projects/powernv/dev/ixl/if_ixlv.c
  projects/powernv/dev/usb/controller/dwc_otg.c
  projects/powernv/dev/usb/controller/xhci.h
  projects/powernv/dev/usb/quirk/usb_quirk.c
  projects/powernv/dev/usb/usbdevs
  projects/powernv/fs/cuse/cuse.c
  projects/powernv/fs/fifofs/fifo_vnops.c
  projects/powernv/geom/uzip/g_uzip.c
  projects/powernv/geom/uzip/g_uzip_dapi.h
  projects/powernv/geom/uzip/g_uzip_lzma.c
  projects/powernv/geom/uzip/g_uzip_zlib.c
  projects/powernv/i386/include/counter.h
  projects/powernv/kern/imgact_elf.c
  projects/powernv/kern/init_main.c
  projects/powernv/kern/kern_event.c
  projects/powernv/kern/kern_exec.c
  projects/powernv/kern/kern_exit.c
  projects/powernv/kern/kern_fork.c
  projects/powernv/kern/kern_lockf.c
  projects/powernv/kern/kern_mutex.c
  projects/powernv/kern/kern_ntptime.c
  projects/powernv/kern/kern_shutdown.c
  projects/powernv/kern/kern_sig.c
  projects/powernv/kern/kern_thread.c
  projects/powernv/kern/kern_timeout.c
  projects/powernv/kern/subr_clock.c
  projects/powernv/kern/subr_pcpu.c
  projects/powernv/kern/subr_rtc.c
  projects/powernv/kern/subr_sleepqueue.c
  projects/powernv/kern/subr_taskqueue.c
  projects/powernv/kern/subr_trap.c
  projects/powernv/kern/vfs_mount.c
  projects/powernv/kern/vfs_subr.c
  projects/powernv/kern/vfs_vnops.c
  projects/powernv/mips/malta/gt_pci.c
  projects/powernv/modules/aic7xxx/ahd/Makefile
  projects/powernv/net/flowtable.c
  projects/powernv/net/if.c
  projects/powernv/net/iflib.c
  projects/powernv/net80211/ieee80211_amrr.c
  projects/powernv/net80211/ieee80211_ddb.c
  projects/powernv/net80211/ieee80211_freebsd.h
  projects/powernv/net80211/ieee80211_superg.c
  projects/powernv/net80211/ieee80211_superg.h
  projects/powernv/net80211/ieee80211_var.h
  projects/powernv/netinet/ip_id.c
  projects/powernv/netinet/sctp_output.c
  projects/powernv/netinet/tcp_pcap.c
  projects/powernv/netinet/tcp_pcap.h
  projects/powernv/netinet/tcp_subr.c
  projects/powernv/netpfil/ipfw/dn_aqm_pie.c
  projects/powernv/netpfil/ipfw/ip_fw2.c
  projects/powernv/netpfil/ipfw/ip_fw_log.c
  projects/powernv/netpfil/ipfw/ip_fw_nat.c
  projects/powernv/nlm/nlm_advlock.c
  projects/powernv/nlm/nlm_prot_impl.c
  projects/powernv/powerpc/aim/mmu_oea.c
  projects/powernv/powerpc/conf/dpaa/config.dpaa
  projects/powernv/powerpc/include/counter.h
  projects/powernv/powerpc/mpc85xx/lbc.c
  projects/powernv/powerpc/powerpc/machdep.c
  projects/powernv/powerpc/powerpc/mp_machdep.c
  projects/powernv/sys/buf_ring.h
  projects/powernv/sys/callout.h
  projects/powernv/sys/event.h
  projects/powernv/sys/mount.h
  projects/powernv/sys/proc.h
  projects/powernv/sys/signalvar.h
  projects/powernv/sys/systm.h
  projects/powernv/vm/uma.h
  projects/powernv/vm/uma_core.c
  projects/powernv/vm/uma_int.h
  projects/powernv/vm/vm_fault.c
  projects/powernv/vm/vm_page.c
  projects/powernv/vm/vnode_pager.c
Directory Properties:
  projects/powernv/   (props changed)
  projects/powernv/cddl/contrib/opensolaris/   (props changed)
  projects/powernv/contrib/ipfilter/   (props changed)

Modified: projects/powernv/amd64/include/counter.h
==============================================================================
--- projects/powernv/amd64/include/counter.h	Thu Jul  7 20:31:35 2016	(r302396)
+++ projects/powernv/amd64/include/counter.h	Thu Jul  7 20:36:07 2016	(r302397)
@@ -51,7 +51,7 @@ counter_u64_fetch_inline(uint64_t *p)
 	int i;
 
 	r = 0;
-	for (i = 0; i < mp_ncpus; i++)
+	CPU_FOREACH(i)
 		r += counter_u64_read_one((uint64_t *)p, i);
 
 	return (r);

Modified: projects/powernv/arm/ti/cpsw/if_cpsw.c
==============================================================================
--- projects/powernv/arm/ti/cpsw/if_cpsw.c	Thu Jul  7 20:31:35 2016	(r302396)
+++ projects/powernv/arm/ti/cpsw/if_cpsw.c	Thu Jul  7 20:36:07 2016	(r302397)
@@ -1874,6 +1874,7 @@ cpswp_tx_enqueue(struct cpswp_softc *sc)
 		return;
 	} else if (last_old_slot == NULL) {
 		/* Start a fresh queue. */
+		sc->swsc->last_hdp = cpsw_cpdma_bd_paddr(sc->swsc, first_new_slot);
 		cpsw_write_hdp_slot(sc->swsc, &sc->swsc->tx, first_new_slot);
 	} else {
 		/* Add buffers to end of current queue. */
@@ -1882,6 +1883,7 @@ cpswp_tx_enqueue(struct cpswp_softc *sc)
 		/* If underrun, restart queue. */
 		if (cpsw_cpdma_read_bd_flags(sc->swsc, last_old_slot) &
 		    CPDMA_BD_EOQ) {
+			sc->swsc->last_hdp = cpsw_cpdma_bd_paddr(sc->swsc, first_new_slot);
 			cpsw_write_hdp_slot(sc->swsc, &sc->swsc->tx,
 			    first_new_slot);
 		}
@@ -1897,6 +1899,7 @@ static int
 cpsw_tx_dequeue(struct cpsw_softc *sc)
 {
 	struct cpsw_slot *slot, *last_removed_slot = NULL;
+	struct cpsw_cpdma_bd bd;
 	uint32_t flags, removed = 0;
 
 	slot = STAILQ_FIRST(&sc->tx.active);
@@ -1931,13 +1934,26 @@ cpsw_tx_dequeue(struct cpsw_softc *sc)
 		}
 
 		/* TearDown complete is only marked on the SOP for the packet. */
-		if (flags & CPDMA_BD_TDOWNCMPLT) {
+		if ((flags & (CPDMA_BD_SOP | CPDMA_BD_TDOWNCMPLT)) ==
+		    (CPDMA_BD_EOP | CPDMA_BD_TDOWNCMPLT)) {
 			CPSW_DEBUGF(sc, ("TX teardown in progress"));
 			cpsw_write_cp(sc, &sc->tx, 0xfffffffc);
 			// TODO: Increment a count of dropped TX packets
 			sc->tx.running = 0;
 			break;
 		}
+
+		if ((flags & CPDMA_BD_EOP) == 0)
+			flags = cpsw_cpdma_read_bd_flags(sc, last_removed_slot);
+		if ((flags & (CPDMA_BD_EOP | CPDMA_BD_EOQ)) ==
+		    (CPDMA_BD_EOP | CPDMA_BD_EOQ)) {
+			cpsw_cpdma_read_bd(sc, last_removed_slot, &bd);
+			if (bd.next != 0 && bd.next != sc->last_hdp) {
+				/* Restart the queue. */
+				sc->last_hdp = bd.next;
+				cpsw_write_4(sc, sc->tx.hdp_offset, bd.next);
+			}
+		}
 	}
 
 	if (removed != 0) {

Modified: projects/powernv/arm/ti/cpsw/if_cpswvar.h
==============================================================================
--- projects/powernv/arm/ti/cpsw/if_cpswvar.h	Thu Jul  7 20:31:35 2016	(r302396)
+++ projects/powernv/arm/ti/cpsw/if_cpswvar.h	Thu Jul  7 20:36:07 2016	(r302397)
@@ -83,6 +83,7 @@ struct cpsw_softc {
 
 	/* RX and TX buffer tracking */
 	struct cpsw_queue rx, tx;
+	uint32_t	last_hdp;
 
 	/* We expect 1 memory resource and 4 interrupts from the device tree. */
 	int		mem_rid;

Modified: projects/powernv/arm64/include/vmparam.h
==============================================================================
--- projects/powernv/arm64/include/vmparam.h	Thu Jul  7 20:31:35 2016	(r302396)
+++ projects/powernv/arm64/include/vmparam.h	Thu Jul  7 20:36:07 2016	(r302397)
@@ -181,7 +181,7 @@
 	KASSERT(PHYS_IN_DMAP(pa),					\
 	    ("%s: PA out of range, PA: 0x%lx", __func__,		\
 	    (vm_paddr_t)(pa)));						\
-	((pa) - dmap_phys_base) | DMAP_MIN_ADDRESS;			\
+	((pa) - dmap_phys_base) + DMAP_MIN_ADDRESS;			\
 })
 
 #define	DMAP_TO_PHYS(va)						\
@@ -189,7 +189,7 @@
 	KASSERT(VIRT_IN_DMAP(va),					\
 	    ("%s: VA out of range, VA: 0x%lx", __func__,		\
 	    (vm_offset_t)(va)));					\
-	((va) & ~DMAP_MIN_ADDRESS) + dmap_phys_base;			\
+	((va) - DMAP_MIN_ADDRESS) + dmap_phys_base;			\
 })
 
 #define	VM_MIN_USER_ADDRESS	(0x0000000000000000UL)

Modified: projects/powernv/boot/efi/boot1/boot1.c
==============================================================================
--- projects/powernv/boot/efi/boot1/boot1.c	Thu Jul  7 20:31:35 2016	(r302396)
+++ projects/powernv/boot/efi/boot1/boot1.c	Thu Jul  7 20:36:07 2016	(r302397)
@@ -629,7 +629,7 @@ efi_main(EFI_HANDLE Ximage, EFI_SYSTEM_T
 	case EFI_BUFFER_TOO_SMALL:
 		(void)bs->FreePool(handles);
 		if ((status = bs->AllocatePool(EfiLoaderData, hsize,
-		    (void **)&handles) != EFI_SUCCESS)) {
+		    (void **)&handles)) != EFI_SUCCESS) {
 			panic("Failed to allocate %zu handles (%lu)", hsize /
 			    sizeof(*handles), EFI_ERROR_CODE(status));
 		}

Modified: projects/powernv/boot/fdt/fdt_loader_cmd.c
==============================================================================
--- projects/powernv/boot/fdt/fdt_loader_cmd.c	Thu Jul  7 20:31:35 2016	(r302396)
+++ projects/powernv/boot/fdt/fdt_loader_cmd.c	Thu Jul  7 20:36:07 2016	(r302397)
@@ -49,7 +49,7 @@ __FBSDID("$FreeBSD$");
 #endif
 
 #define FDT_CWD_LEN	256
-#define FDT_MAX_DEPTH	6
+#define FDT_MAX_DEPTH	12
 
 #define FDT_PROP_SEP	" = "
 
@@ -1029,7 +1029,7 @@ fdt_cmd_ls(int argc, char *argv[])
 	const char *prevname[FDT_MAX_DEPTH] = { NULL };
 	const char *name;
 	char *path;
-	int i, o, depth, len;
+	int i, o, depth;
 
 	path = (argc > 2) ? argv[2] : NULL;
 	if (path == NULL)
@@ -1045,7 +1045,7 @@ fdt_cmd_ls(int argc, char *argv[])
 	    (o >= 0) && (depth >= 0);
 	    o = fdt_next_node(fdtp, o, &depth)) {
 
-		name = fdt_get_name(fdtp, o, &len);
+		name = fdt_get_name(fdtp, o, NULL);
 
 		if (depth > FDT_MAX_DEPTH) {
 			printf("max depth exceeded: %d\n", depth);

Modified: projects/powernv/boot/powerpc/ofw/ofwfdt.c
==============================================================================
--- projects/powernv/boot/powerpc/ofw/ofwfdt.c	Thu Jul  7 20:31:35 2016	(r302396)
+++ projects/powernv/boot/powerpc/ofw/ofwfdt.c	Thu Jul  7 20:36:07 2016	(r302397)
@@ -33,24 +33,37 @@ __FBSDID("$FreeBSD$");
 #include <libfdt.h>
 #include "bootstrap.h"
 
+extern int command_fdt_internal(int argc, char *argv[]);
+
 static int
 OF_hasprop(phandle_t node, const char *prop)
 {
-	return (OF_getproplen(node, prop) > 0);
+	return (OF_getproplen(node, (char *)prop) > 0);
 }
 
 static void
 add_node_to_fdt(void *buffer, phandle_t node, int fdt_offset)
 {
-        int i, child_offset, error;
-        char name[2048], *lastprop, *subname;
+	int i, child_offset, error;
+	char name[255], *lastprop, *subname;
 	void *propbuf;
-	size_t proplen;
+	ssize_t proplen;
 
 	lastprop = NULL;
 	while (OF_nextprop(node, lastprop, name) > 0) {
 		proplen = OF_getproplen(node, name);
+
+		/* Detect and correct for errors and strangeness */
+		if (proplen < 0)
+			proplen = 0;
+		if (proplen > 1024)
+			proplen = 1024;
+
 		propbuf = malloc(proplen);
+		if (propbuf == NULL) {
+			printf("Cannot allocate memory for prop %s\n", name);
+			return;
+		}
 		OF_getprop(node, name, propbuf, proplen);
 		error = fdt_setprop(buffer, fdt_offset, name, propbuf, proplen);
 		free(propbuf);
@@ -64,7 +77,7 @@ add_node_to_fdt(void *buffer, phandle_t 
 	    && !OF_hasprop(node, "ibm,phandle"))
 		fdt_setprop(buffer, fdt_offset, "phandle", &node, sizeof(node));
 
-        for (node = OF_child(node); node > 0; node = OF_peer(node)) {
+	for (node = OF_child(node); node > 0; node = OF_peer(node)) {
 		OF_package_to_path(node, name, sizeof(name));
 		subname = strrchr(name, '/');
 		subname++;
@@ -76,7 +89,7 @@ add_node_to_fdt(void *buffer, phandle_t 
 		}
 	
                 add_node_to_fdt(buffer, node, child_offset);
-        }
+	}
 }
 
 static void
@@ -123,18 +136,16 @@ ofwfdt_fixups(void *fdtp)
 		fdt_add_mem_rsv(fdtp, base, len);
 	} else {
 		/*
-		 * Remove /memory/available properties, which reflect long-gone OF
-		 * state. Note that this doesn't work if we need RTAS still, since
-		 * that's part of the firmware.
+		 * Remove /memory/available properties, which reflect long-gone
+		 * OF state. Note that this doesn't work if we need RTAS still,
+		 * since that's part of the firmware.
 		 */
-
 		offset = fdt_path_offset(fdtp, "/memory@0");
 		if (offset > 0)
 			fdt_delprop(fdtp, offset, "available");
 	}
-		
-	/*
 
+	
 	/*
 	 * Convert stored ihandles under /chosen to xref phandles
 	 */
@@ -158,7 +169,8 @@ ofwfdt_fixups(void *fdtp)
 					OF_getprop(node, "ibm,phandle", &node,
 					    sizeof(node));
 				node = cpu_to_fdt32(node);
-				fdt_setprop(fdtp, offset, chosenprops[i], &node,				    sizeof(node));
+				fdt_setprop(fdtp, offset, chosenprops[i], &node,
+				    sizeof(node));
 			}
 
 			/* Refind node in case it moved */

Modified: projects/powernv/cam/cam_iosched.c
==============================================================================
--- projects/powernv/cam/cam_iosched.c	Thu Jul  7 20:31:35 2016	(r302396)
+++ projects/powernv/cam/cam_iosched.c	Thu Jul  7 20:36:07 2016	(r302397)
@@ -59,15 +59,19 @@ static MALLOC_DEFINE(M_CAMSCHED, "CAM I/
  * Default I/O scheduler for FreeBSD. This implementation is just a thin-vineer
  * over the bioq_* interface, with notions of separate calls for normal I/O and
  * for trims.
+ *
+ * When CAM_IOSCHED_DYNAMIC is defined, the scheduler is enhanced to dynamically
+ * steer the rate of one type of traffic to help other types of traffic (eg
+ * limit writes when read latency deteriorates on SSDs).
  */
 
 #ifdef CAM_IOSCHED_DYNAMIC
 
-static int do_netflix_iosched = 1;
-TUNABLE_INT("kern.cam.do_netflix_iosched", &do_netflix_iosched);
-SYSCTL_INT(_kern_cam, OID_AUTO, do_netflix_iosched, CTLFLAG_RD,
-    &do_netflix_iosched, 1,
-    "Enable Netflix I/O scheduler optimizations.");
+static int do_dynamic_iosched = 1;
+TUNABLE_INT("kern.cam.do_dynamic_iosched", &do_dynamic_iosched);
+SYSCTL_INT(_kern_cam, OID_AUTO, do_dynamic_iosched, CTLFLAG_RD,
+    &do_dynamic_iosched, 1,
+    "Enable Dynamic I/O scheduler optimizations.");
 
 static int alpha_bits = 9;
 TUNABLE_INT("kern.cam.iosched_alpha_bits", &alpha_bits);
@@ -640,7 +644,7 @@ static inline int
 cam_iosched_has_io(struct cam_iosched_softc *isc)
 {
 #ifdef CAM_IOSCHED_DYNAMIC
-	if (do_netflix_iosched) {
+	if (do_dynamic_iosched) {
 		struct bio *rbp = bioq_first(&isc->bio_queue);
 		struct bio *wbp = bioq_first(&isc->write_queue);
 		int can_write = wbp != NULL &&
@@ -954,7 +958,7 @@ cam_iosched_init(struct cam_iosched_soft
 	bioq_init(&(*iscp)->bio_queue);
 	bioq_init(&(*iscp)->trim_queue);
 #ifdef CAM_IOSCHED_DYNAMIC
-	if (do_netflix_iosched) {
+	if (do_dynamic_iosched) {
 		bioq_init(&(*iscp)->write_queue);
 		(*iscp)->read_bias = 100;
 		(*iscp)->current_read_bias = 100;
@@ -1019,7 +1023,7 @@ void cam_iosched_sysctl_init(struct cam_
 		"Sort IO queue to try and optimise disk access patterns");
 
 #ifdef CAM_IOSCHED_DYNAMIC
-	if (!do_netflix_iosched)
+	if (!do_dynamic_iosched)
 		return;
 
 	isc->sysctl_tree = SYSCTL_ADD_NODE(&isc->sysctl_ctx,
@@ -1061,7 +1065,7 @@ cam_iosched_flush(struct cam_iosched_sof
 	bioq_flush(&isc->bio_queue, stp, err);
 	bioq_flush(&isc->trim_queue, stp, err);
 #ifdef CAM_IOSCHED_DYNAMIC
-	if (do_netflix_iosched)
+	if (do_dynamic_iosched)
 		bioq_flush(&isc->write_queue, stp, err);
 #endif
 }
@@ -1206,7 +1210,7 @@ cam_iosched_next_bio(struct cam_iosched_
 	 * See if we have any pending writes, and room in the queue for them,
 	 * and if so, those are next.
 	 */
-	if (do_netflix_iosched) {
+	if (do_dynamic_iosched) {
 		if ((bp = cam_iosched_get_write(isc)) != NULL)
 			return bp;
 	}
@@ -1223,7 +1227,7 @@ cam_iosched_next_bio(struct cam_iosched_
 	 * For the netflix scheduler, bio_queue is only for reads, so enforce
 	 * the limits here. Enforce only for reads.
 	 */
-	if (do_netflix_iosched) {
+	if (do_dynamic_iosched) {
 		if (bp->bio_cmd == BIO_READ &&
 		    cam_iosched_limiter_iop(&isc->read_stats, bp) != 0)
 			return NULL;
@@ -1231,7 +1235,7 @@ cam_iosched_next_bio(struct cam_iosched_
 #endif
 	bioq_remove(&isc->bio_queue, bp);
 #ifdef CAM_IOSCHED_DYNAMIC
-	if (do_netflix_iosched) {
+	if (do_dynamic_iosched) {
 		if (bp->bio_cmd == BIO_READ) {
 			isc->read_stats.queued--;
 			isc->read_stats.total++;
@@ -1268,7 +1272,7 @@ cam_iosched_queue_work(struct cam_iosche
 #endif
 	}
 #ifdef CAM_IOSCHED_DYNAMIC
-	else if (do_netflix_iosched &&
+	else if (do_dynamic_iosched &&
 	    (bp->bio_cmd == BIO_WRITE || bp->bio_cmd == BIO_FLUSH)) {
 		if (cam_iosched_sort_queue(isc))
 			bioq_disksort(&isc->write_queue, bp);
@@ -1332,7 +1336,7 @@ cam_iosched_bio_complete(struct cam_iosc
 {
 	int retval = 0;
 #ifdef CAM_IOSCHED_DYNAMIC
-	if (!do_netflix_iosched)
+	if (!do_dynamic_iosched)
 		return retval;
 
 	if (iosched_debug > 10)

Modified: projects/powernv/cam/scsi/scsi_all.c
==============================================================================
--- projects/powernv/cam/scsi/scsi_all.c	Thu Jul  7 20:31:35 2016	(r302396)
+++ projects/powernv/cam/scsi/scsi_all.c	Thu Jul  7 20:36:07 2016	(r302397)
@@ -8788,6 +8788,7 @@ scsi_persistent_reserve_out(struct ccb_s
 	scsi_cmd->opcode = PERSISTENT_RES_OUT;
 	scsi_cmd->action = service_action;
 	scsi_cmd->scope_type = scope | res_type;
+	scsi_ulto4b(dxfer_len, scsi_cmd->length);
 
 	cam_fill_csio(csio,
 		      retries,

Modified: projects/powernv/cddl/compat/opensolaris/sys/proc.h
==============================================================================
--- projects/powernv/cddl/compat/opensolaris/sys/proc.h	Thu Jul  7 20:31:35 2016	(r302396)
+++ projects/powernv/cddl/compat/opensolaris/sys/proc.h	Thu Jul  7 20:36:07 2016	(r302397)
@@ -45,8 +45,8 @@
 #define	CPU		curcpu
 #define	minclsyspri	PRIBIO
 #define	maxclsyspri	PVM
-#define	max_ncpus	mp_ncpus
-#define	boot_max_ncpus	mp_ncpus
+#define	max_ncpus	(mp_maxid + 1)
+#define	boot_max_ncpus	(mp_maxid + 1)
 
 #define	TS_RUN	0
 

Modified: projects/powernv/cddl/contrib/opensolaris/common/acl/acl_common.c
==============================================================================
--- projects/powernv/cddl/contrib/opensolaris/common/acl/acl_common.c	Thu Jul  7 20:31:35 2016	(r302396)
+++ projects/powernv/cddl/contrib/opensolaris/common/acl/acl_common.c	Thu Jul  7 20:36:07 2016	(r302397)
@@ -20,7 +20,7 @@
  */
 /*
  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
- * Copyright 2014 Nexenta Systems, Inc.  All rights reserved.
+ * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
  */
 
 #include <sys/types.h>
@@ -1580,8 +1580,7 @@ acl_trivial_access_masks(mode_t mode, bo
 	uint32_t write_mask = ACE_WRITE_DATA|ACE_APPEND_DATA;
 	uint32_t execute_mask = ACE_EXECUTE;
 
-	if (isdir)
-		write_mask |= ACE_DELETE_CHILD;
+	(void) isdir;	/* will need this later */
 
 	masks->deny1 = 0;
 	if (!(mode & S_IRUSR) && (mode & (S_IRGRP|S_IROTH)))
@@ -1725,17 +1724,10 @@ ace_trivial_common(void *acep, int aclcn
 			return (1);
 
 		/*
-		 * Delete permission is never set by default
-		 */
-		if (mask & ACE_DELETE)
-			return (1);
-
-		/*
-		 * Child delete permission should be accompanied by write
+		 * Delete permissions are never set by default
 		 */
-		if ((mask & ACE_DELETE_CHILD) && !(mask & ACE_WRITE_DATA))
+		if (mask & (ACE_DELETE|ACE_DELETE_CHILD))
 			return (1);
-
 		/*
 		 * only allow owner@ to have
 		 * write_acl/write_owner/write_attributes/write_xattr/

Modified: projects/powernv/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c
==============================================================================
--- projects/powernv/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c	Thu Jul  7 20:31:35 2016	(r302396)
+++ projects/powernv/cddl/contrib/opensolaris/uts/common/fs/zfs/arc.c	Thu Jul  7 20:36:07 2016	(r302397)
@@ -238,10 +238,15 @@ int zfs_disable_dup_eviction = 0;
 uint64_t zfs_arc_average_blocksize = 8 * 1024; /* 8KB */
 u_int zfs_arc_free_target = 0;
 
+/* Absolute min for arc min / max is 16MB. */
+static uint64_t arc_abs_min = 16 << 20;
+
 static int sysctl_vfs_zfs_arc_free_target(SYSCTL_HANDLER_ARGS);
 static int sysctl_vfs_zfs_arc_meta_limit(SYSCTL_HANDLER_ARGS);
+static int sysctl_vfs_zfs_arc_max(SYSCTL_HANDLER_ARGS);
+static int sysctl_vfs_zfs_arc_min(SYSCTL_HANDLER_ARGS);
 
-#ifdef _KERNEL
+#if defined(__FreeBSD__) && defined(_KERNEL)
 static void
 arc_free_target_init(void *unused __unused)
 {
@@ -255,10 +260,10 @@ TUNABLE_QUAD("vfs.zfs.arc_meta_limit", &
 TUNABLE_QUAD("vfs.zfs.arc_meta_min", &zfs_arc_meta_min);
 TUNABLE_INT("vfs.zfs.arc_shrink_shift", &zfs_arc_shrink_shift);
 SYSCTL_DECL(_vfs_zfs);
-SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, arc_max, CTLFLAG_RDTUN, &zfs_arc_max, 0,
-    "Maximum ARC size");
-SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, arc_min, CTLFLAG_RDTUN, &zfs_arc_min, 0,
-    "Minimum ARC size");
+SYSCTL_PROC(_vfs_zfs, OID_AUTO, arc_max, CTLTYPE_U64 | CTLFLAG_RWTUN,
+    0, sizeof(uint64_t), sysctl_vfs_zfs_arc_max, "QU", "Maximum ARC size");
+SYSCTL_PROC(_vfs_zfs, OID_AUTO, arc_min, CTLTYPE_U64 | CTLFLAG_RWTUN,
+    0, sizeof(uint64_t), sysctl_vfs_zfs_arc_min, "QU", "Minimum ARC size");
 SYSCTL_UQUAD(_vfs_zfs, OID_AUTO, arc_average_blocksize, CTLFLAG_RDTUN,
     &zfs_arc_average_blocksize, 0,
     "ARC average blocksize");
@@ -884,7 +889,7 @@ struct arc_buf_hdr {
 	l1arc_buf_hdr_t		b_l1hdr;
 };
 
-#ifdef _KERNEL
+#if defined(__FreeBSD__) && defined(_KERNEL)
 static int
 sysctl_vfs_zfs_arc_meta_limit(SYSCTL_HANDLER_ARGS)
 {
@@ -902,6 +907,82 @@ sysctl_vfs_zfs_arc_meta_limit(SYSCTL_HAN
 	arc_meta_limit = val;
 	return (0);
 }
+
+static int
+sysctl_vfs_zfs_arc_max(SYSCTL_HANDLER_ARGS)
+{
+	uint64_t val;
+	int err;
+
+	val = zfs_arc_max;
+	err = sysctl_handle_64(oidp, &val, 0, req);
+	if (err != 0 || req->newptr == NULL)
+		return (err);
+
+	if (zfs_arc_max == 0) {
+		/* Loader tunable so blindly set */
+		zfs_arc_max = val;
+		return (0);
+	}
+
+	if (val < arc_abs_min || val > kmem_size())
+		return (EINVAL);
+	if (val < arc_c_min)
+		return (EINVAL);
+	if (zfs_arc_meta_limit > 0 && val < zfs_arc_meta_limit)
+		return (EINVAL);
+
+	arc_c_max = val;
+
+	arc_c = arc_c_max;
+        arc_p = (arc_c >> 1);
+
+	if (zfs_arc_meta_limit == 0) {
+		/* limit meta-data to 1/4 of the arc capacity */
+		arc_meta_limit = arc_c_max / 4;
+	}
+
+	/* if kmem_flags are set, lets try to use less memory */
+	if (kmem_debugging())
+		arc_c = arc_c / 2;
+
+	zfs_arc_max = arc_c;
+
+	return (0);
+}
+
+static int
+sysctl_vfs_zfs_arc_min(SYSCTL_HANDLER_ARGS)
+{
+	uint64_t val;
+	int err;
+
+	val = zfs_arc_min;
+	err = sysctl_handle_64(oidp, &val, 0, req);
+	if (err != 0 || req->newptr == NULL)
+		return (err);
+
+	if (zfs_arc_min == 0) {
+		/* Loader tunable so blindly set */
+		zfs_arc_min = val;
+		return (0);
+	}
+
+	if (val < arc_abs_min || val > arc_c_max)
+		return (EINVAL);
+
+	arc_c_min = val;
+
+	if (zfs_arc_meta_min == 0)
+                arc_meta_min = arc_c_min / 2;
+
+	if (arc_c < arc_c_min)
+                arc_c = arc_c_min;
+
+	zfs_arc_min = arc_c_min;
+
+	return (0);
+}
 #endif
 
 static arc_buf_t *arc_eviction_list;
@@ -5385,8 +5466,8 @@ arc_init(void)
 	arc_c = MIN(arc_c, vmem_size(heap_arena, VMEM_ALLOC | VMEM_FREE) / 8);
 #endif
 #endif	/* illumos */
-	/* set min cache to 1/32 of all memory, or 16MB, whichever is more */
-	arc_c_min = MAX(arc_c / 4, 16 << 20);
+	/* set min cache to 1/32 of all memory, or arc_abs_min, whichever is more */
+	arc_c_min = MAX(arc_c / 4, arc_abs_min);
 	/* set max to 1/2 of all memory, or all but 1GB, whichever is more */
 	if (arc_c * 8 >= 1 << 30)
 		arc_c_max = (arc_c * 8) - (1 << 30);
@@ -5407,11 +5488,11 @@ arc_init(void)
 #ifdef _KERNEL
 	/*
 	 * Allow the tunables to override our calculations if they are
-	 * reasonable (ie. over 16MB)
+	 * reasonable.
 	 */
-	if (zfs_arc_max > 16 << 20 && zfs_arc_max < kmem_size())
+	if (zfs_arc_max > arc_abs_min && zfs_arc_max < kmem_size())
 		arc_c_max = zfs_arc_max;
-	if (zfs_arc_min > 16 << 20 && zfs_arc_min <= arc_c_max)
+	if (zfs_arc_min > arc_abs_min && zfs_arc_min <= arc_c_max)
 		arc_c_min = zfs_arc_min;
 #endif
 

Modified: projects/powernv/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c
==============================================================================
--- projects/powernv/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c	Thu Jul  7 20:31:35 2016	(r302396)
+++ projects/powernv/cddl/contrib/opensolaris/uts/common/fs/zfs/dsl_pool.c	Thu Jul  7 20:36:07 2016	(r302397)
@@ -49,8 +49,8 @@
 #include <sys/dsl_userhold.h>
 
 #if defined(__FreeBSD__) && defined(_KERNEL)
-#include <sys/sysctl.h>
 #include <sys/types.h>
+#include <sys/sysctl.h>
 #endif
 
 /*

Modified: projects/powernv/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c
==============================================================================
--- projects/powernv/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c	Thu Jul  7 20:31:35 2016	(r302396)
+++ projects/powernv/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_acl.c	Thu Jul  7 20:36:07 2016	(r302397)
@@ -20,8 +20,8 @@
  */
 /*
  * Copyright (c) 2005, 2010, Oracle and/or its affiliates. All rights reserved.
+ * Copyright 2011 Nexenta Systems, Inc.  All rights reserved.
  * Copyright (c) 2013 by Delphix. All rights reserved.
- * Copyright 2014 Nexenta Systems, Inc.  All rights reserved.
  */
 
 #include <sys/types.h>
@@ -2085,7 +2085,7 @@ zfs_zaccess_dataset_check(znode_t *zp, u
  * placed into the working_mode, giving the caller a mask of denied
  * accesses.  Returns:
  *	0		if all AoI granted
- *	EACCES		if the denied mask is non-zero
+ *	EACCESS 	if the denied mask is non-zero
  *	other error	if abnormal failure (e.g., IO error)
  *
  * A secondary usage of the function is to determine if any of the
@@ -2532,32 +2532,46 @@ zfs_zaccess_unix(znode_t *zp, mode_t mod
 	return (zfs_zaccess(zp, v4_mode, 0, B_FALSE, cr));
 }
 
-/* See zfs_zaccess_delete() */
-int zfs_write_implies_delete_child = 1;
+static int
+zfs_delete_final_check(znode_t *zp, znode_t *dzp,
+    mode_t available_perms, cred_t *cr)
+{
+	int error;
+	uid_t downer;
+
+	downer = zfs_fuid_map_id(dzp->z_zfsvfs, dzp->z_uid, cr, ZFS_OWNER);
+
+	error = secpolicy_vnode_access2(cr, ZTOV(dzp),
+	    downer, available_perms, VWRITE|VEXEC);
+
+	if (error == 0)
+		error = zfs_sticky_remove_access(dzp, zp, cr);
+
+	return (error);
+}
 
 /*
- * Determine whether delete access should be granted.
+ * Determine whether Access should be granted/deny, without
+ * consulting least priv subsystem.
  *
- * The following chart outlines how we handle delete permissions which is
- * how recent versions of windows (Windows 2008) handles it.  The efficiency
- * comes from not having to check the parent ACL where the object itself grants
- * delete:
+ * The following chart is the recommended NFSv4 enforcement for
+ * ability to delete an object.
  *
  *      -------------------------------------------------------
- *      |   Parent Dir  |      Target Object Permissions      |
+ *      |   Parent Dir  |           Target Object Permissions |
  *      |  permissions  |                                     |
  *      -------------------------------------------------------
  *      |               | ACL Allows | ACL Denies| Delete     |
  *      |               |  Delete    |  Delete   | unspecified|
  *      -------------------------------------------------------
- *      | ACL Allows    | Permit     | Deny *    | Permit     |
- *      | DELETE_CHILD  |            |           |            |
+ *      |  ACL Allows   | Permit     | Permit    | Permit     |
+ *      |  DELETE_CHILD |                                     |
  *      -------------------------------------------------------
- *      | ACL Denies    | Permit     | Deny      | Deny       |
- *      | DELETE_CHILD  |            |           |            |
+ *      |  ACL Denies   | Permit     | Deny      | Deny       |
+ *      |  DELETE_CHILD |            |           |            |
  *      -------------------------------------------------------
  *      | ACL specifies |            |           |            |
- *      | only allow    | Permit     | Deny *    | Permit     |
+ *      | only allow    | Permit     | Permit    | Permit     |
  *      | write and     |            |           |            |
  *      | execute       |            |           |            |
  *      -------------------------------------------------------
@@ -2567,171 +2581,91 @@ int zfs_write_implies_delete_child = 1;
  *      -------------------------------------------------------
  *         ^
  *         |
- *         Re. execute permission on the directory:  if that's missing,
- *	   the vnode lookup of the target will fail before we get here.
- *
- * Re [*] in the table above:  NFSv4 would normally Permit delete for
- * these two cells of the matrix.
- * See acl.h for notes on which ACE_... flags should be checked for which
- * operations.  Specifically, the NFSv4 committee recommendation is in
- * conflict with the Windows interpretation of DENY ACEs, where DENY ACEs
- * should take precedence ahead of ALLOW ACEs.
- *
- * This implementation always consults the target object's ACL first.
- * If a DENY ACE is present on the target object that specifies ACE_DELETE,
- * delete access is denied.  If an ALLOW ACE with ACE_DELETE is present on
- * the target object, access is allowed.  If and only if no entries with
- * ACE_DELETE are present in the object's ACL, check the container's ACL
- * for entries with ACE_DELETE_CHILD.
- *
- * A summary of the logic implemented from the table above is as follows:
+ *         No search privilege, can't even look up file?
  *
- * First check for DENY ACEs that apply.
- * If either target or container has a deny, EACCES.
- *
- * Delete access can then be summarized as follows:
- * 1: The object to be deleted grants ACE_DELETE, or
- * 2: The containing directory grants ACE_DELETE_CHILD.
- * In a Windows system, that would be the end of the story.
- * In this system, (2) has some complications...
- * 2a: "sticky" bit on a directory adds restrictions, and
- * 2b: existing ACEs from previous versions of ZFS may
- * not carry ACE_DELETE_CHILD where they should, so we
- * also allow delete when ACE_WRITE_DATA is granted.
- *
- * Note: 2b is technically a work-around for a prior bug,
- * which hopefully can go away some day.  For those who
- * no longer need the work around, and for testing, this
- * work-around is made conditional via the tunable:
- * zfs_write_implies_delete_child
  */
 int
 zfs_zaccess_delete(znode_t *dzp, znode_t *zp, cred_t *cr)
 {
-	uint32_t wanted_dirperms;
 	uint32_t dzp_working_mode = 0;
 	uint32_t zp_working_mode = 0;
 	int dzp_error, zp_error;
-	boolean_t dzpcheck_privs;
-	boolean_t zpcheck_privs;
+	mode_t available_perms;
+	boolean_t dzpcheck_privs = B_TRUE;
+	boolean_t zpcheck_privs = B_TRUE;
+
+	/*
+	 * We want specific DELETE permissions to
+	 * take precedence over WRITE/EXECUTE.  We don't
+	 * want an ACL such as this to mess us up.
+	 * user:joe:write_data:deny,user:joe:delete:allow
+	 *
+	 * However, deny permissions may ultimately be overridden
+	 * by secpolicy_vnode_access().
+	 *
+	 * We will ask for all of the necessary permissions and then
+	 * look at the working modes from the directory and target object
+	 * to determine what was found.
+	 */
 
 	if (zp->z_pflags & (ZFS_IMMUTABLE | ZFS_NOUNLINK))
 		return (SET_ERROR(EPERM));
 
 	/*
-	 * Case 1:
-	 * If target object grants ACE_DELETE then we are done.  This is
-	 * indicated by a return value of 0.  For this case we don't worry
-	 * about the sticky bit because sticky only applies to the parent
-	 * directory and this is the child access result.
-	 *
-	 * If we encounter a DENY ACE here, we're also done (EACCES).
-	 * Note that if we hit a DENY ACE here (on the target) it should
-	 * take precedence over a DENY ACE on the container, so that when
-	 * we have more complete auditing support we will be able to
-	 * report an access failure against the specific target.
-	 * (This is part of why we're checking the target first.)
-	 */
-	zp_error = zfs_zaccess_common(zp, ACE_DELETE, &zp_working_mode,
-	    &zpcheck_privs, B_FALSE, cr);
-	if (zp_error == EACCES) {
-		/* We hit a DENY ACE. */
-		if (!zpcheck_privs)
-			return (SET_ERROR(zp_error));
-		return (secpolicy_vnode_remove(ZTOV(dzp), cr)); /* XXXPJD: s/dzp/zp/ ? */
-
-	}
-	if (zp_error == 0)
+	 * First row
+	 * If the directory permissions allow the delete, we are done.
+	 */
+	if ((dzp_error = zfs_zaccess_common(dzp, ACE_DELETE_CHILD,
+	    &dzp_working_mode, &dzpcheck_privs, B_FALSE, cr)) == 0)
 		return (0);
 
 	/*
-	 * Case 2:
-	 * If the containing directory grants ACE_DELETE_CHILD,
-	 * or we're in backward compatibility mode and the
-	 * containing directory has ACE_WRITE_DATA, allow.
-	 * Case 2b is handled with wanted_dirperms.
-	 */
-	wanted_dirperms = ACE_DELETE_CHILD;
-	if (zfs_write_implies_delete_child)
-		wanted_dirperms |= ACE_WRITE_DATA;
-	dzp_error = zfs_zaccess_common(dzp, wanted_dirperms,
-	    &dzp_working_mode, &dzpcheck_privs, B_FALSE, cr);
-	if (dzp_error == EACCES) {
-		/* We hit a DENY ACE. */
-		if (!dzpcheck_privs)
-			return (SET_ERROR(dzp_error));
-		return (secpolicy_vnode_remove(ZTOV(dzp), cr));  /* XXXPJD: s/dzp/zp/ ? */
-	}
+	 * If target object has delete permission then we are done
+	 */
+	if ((zp_error = zfs_zaccess_common(zp, ACE_DELETE, &zp_working_mode,
+	    &zpcheck_privs, B_FALSE, cr)) == 0)
+		return (0);
 
-	/*
-	 * Cases 2a, 2b (continued)
-	 *
-	 * Note: dzp_working_mode now contains any permissions
-	 * that were NOT granted.  Therefore, if any of the
-	 * wanted_dirperms WERE granted, we will have:
-	 *   dzp_working_mode != wanted_dirperms
-	 * We're really asking if ANY of those permissions
-	 * were granted, and if so, grant delete access.
-	 */
-	if (dzp_working_mode != wanted_dirperms)
-		dzp_error = 0;
+	ASSERT(dzp_error && zp_error);
+
+	if (!dzpcheck_privs)
+		return (dzp_error);
+	if (!zpcheck_privs)
+		return (zp_error);
 
 	/*
-	 * dzp_error is 0 if the container granted us permissions to "modify".
-	 * If we do not have permission via one or more ACEs, our current
-	 * privileges may still permit us to modify the container.
+	 * Second row
 	 *
-	 * dzpcheck_privs is false when i.e. the FS is read-only.
-	 * Otherwise, do privilege checks for the container.
+	 * If directory returns EACCES then delete_child was denied
+	 * due to deny delete_child.  In this case send the request through
+	 * secpolicy_vnode_remove().  We don't use zfs_delete_final_check()
+	 * since that *could* allow the delete based on write/execute permission
+	 * and we want delete permissions to override write/execute.
 	 */
-	if (dzp_error != 0 && dzpcheck_privs) {
-		uid_t owner;
 
-		/*
-		 * The secpolicy call needs the requested access and
-		 * the current access mode of the container, but it
-		 * only knows about Unix-style modes (VEXEC, VWRITE),
-		 * so this must condense the fine-grained ACE bits into
-		 * Unix modes.
-		 *
-		 * The VEXEC flag is easy, because we know that has
-		 * always been checked before we get here (during the
-		 * lookup of the target vnode).  The container has not
-		 * granted us permissions to "modify", so we do not set
-		 * the VWRITE flag in the current access mode.
-		 */
-		owner = zfs_fuid_map_id(dzp->z_zfsvfs, dzp->z_uid, cr,
-		    ZFS_OWNER);
-		dzp_error = secpolicy_vnode_access2(cr, ZTOV(dzp),
-		    owner, VEXEC, VWRITE|VEXEC);
-	}
-	if (dzp_error != 0) {
-		/*
-		 * Note: We may have dzp_error = -1 here (from
-		 * zfs_zacess_common).  Don't return that.
-		 */
-		return (SET_ERROR(EACCES));
-	}
+	if (dzp_error == EACCES)
+		return (secpolicy_vnode_remove(ZTOV(dzp), cr));	/* XXXPJD: s/dzp/zp/ ? */
 
 	/*
-	 * At this point, we know that the directory permissions allow
-	 * us to modify, but we still need to check for the additional
-	 * restrictions that apply when the "sticky bit" is set.
-	 *
-	 * Yes, zfs_sticky_remove_access() also checks this bit, but
-	 * checking it here and skipping the call below is nice when
-	 * you're watching all of this with dtrace.
+	 * Third Row
+	 * only need to see if we have write/execute on directory.
 	 */
-	if ((dzp->z_mode & S_ISVTX) == 0)
-		return (0);
+
+	dzp_error = zfs_zaccess_common(dzp, ACE_EXECUTE|ACE_WRITE_DATA,
+	    &dzp_working_mode, &dzpcheck_privs, B_FALSE, cr);
+
+	if (dzp_error != 0 && !dzpcheck_privs)
+		return (dzp_error);
 
 	/*
-	 * zfs_sticky_remove_access will succeed if:
-	 * 1. The sticky bit is absent.
-	 * 2. We pass the sticky bit restrictions.
-	 * 3. We have privileges that always allow file removal.
+	 * Fourth row
 	 */
-	return (zfs_sticky_remove_access(dzp, zp, cr));
+
+	available_perms = (dzp_working_mode & ACE_WRITE_DATA) ? 0 : VWRITE;
+	available_perms |= (dzp_working_mode & ACE_EXECUTE) ? 0 : VEXEC;
+
+	return (zfs_delete_final_check(zp, dzp, available_perms, cr));
+
 }
 
 int

Modified: projects/powernv/cddl/contrib/opensolaris/uts/common/sys/acl.h
==============================================================================
--- projects/powernv/cddl/contrib/opensolaris/uts/common/sys/acl.h	Thu Jul  7 20:31:35 2016	(r302396)
+++ projects/powernv/cddl/contrib/opensolaris/uts/common/sys/acl.h	Thu Jul  7 20:36:07 2016	(r302397)
@@ -23,8 +23,6 @@
  *
  * Copyright 2009 Sun Microsystems, Inc.  All rights reserved.
  * Use is subject to license terms.
- *
- * Copyright 2014 Nexenta Systems, Inc.  All rights reserved.
  */
 
 #ifndef _SYS_ACL_H
@@ -90,55 +88,37 @@ typedef struct acl_info acl_t;
 
 /*
  * The following are defined for ace_t.
- *
- * Note, these are intentionally the same as the Windows
- * "File Access Rights Constants" you can find on MSDN.
- * (See also: "Standard Access Rights" on MSDN).
- *
- * The equivalent Windows names for these are just like
- * those show below, with FILE_ in place of ACE_, except
- * as noted below.  Also note that Windows uses a special
- * privilege: BYPASS_TRAVERSE_CHECKING, normally granted
- * to everyone, that causes the absence of ACE_TRAVERSE
- * to be ignored.
- */
-#define	ACE_READ_DATA		0x00000001	/* file: read data */
-#define	ACE_LIST_DIRECTORY	0x00000001	/* dir: list files */
-#define	ACE_WRITE_DATA		0x00000002	/* file: write data */
-#define	ACE_ADD_FILE		0x00000002	/* dir: create file */
-#define	ACE_APPEND_DATA		0x00000004	/* file: append data */
-#define	ACE_ADD_SUBDIRECTORY	0x00000004	/* dir: create subdir */
-#define	ACE_READ_NAMED_ATTRS	0x00000008	/* FILE_READ_EA */
-#define	ACE_WRITE_NAMED_ATTRS	0x00000010	/* FILE_WRITE_EA */
-#define	ACE_EXECUTE		0x00000020	/* file: execute */
-#define	ACE_TRAVERSE		0x00000020	/* dir: lookup name */
-#define	ACE_DELETE_CHILD	0x00000040	/* dir: unlink child */
-#define	ACE_READ_ATTRIBUTES	0x00000080	/* (all) stat, etc. */
-#define	ACE_WRITE_ATTRIBUTES	0x00000100	/* (all) utimes, etc. */
-#define	ACE_DELETE		0x00010000	/* (all) unlink self */
-#define	ACE_READ_ACL		0x00020000	/* (all) getsecattr */
-#define	ACE_WRITE_ACL		0x00040000	/* (all) setsecattr */
-#define	ACE_WRITE_OWNER		0x00080000	/* (all) chown */
-#define	ACE_SYNCHRONIZE		0x00100000	/* (all) see MSDN */
-
-/*
- * Some of the following are the same as Windows uses. (but NOT ALL!)
- * See the "ACE_HEADER" structure description on MSDN for details.
- * Comments show relations to the MSDN names.
  */
-#define	ACE_FILE_INHERIT_ACE		0x0001	/* = OBJECT_INHERIT_ACE */
-#define	ACE_DIRECTORY_INHERIT_ACE	0x0002	/* = CONTAINER_INHERIT_ACE */
-#define	ACE_NO_PROPAGATE_INHERIT_ACE	0x0004	/* = NO_PROPAGATE_INHERIT_ACE */
-#define	ACE_INHERIT_ONLY_ACE		0x0008	/* = INHERIT_ONLY_ACE */
+#define	ACE_READ_DATA		0x00000001
+#define	ACE_LIST_DIRECTORY	0x00000001
+#define	ACE_WRITE_DATA		0x00000002
+#define	ACE_ADD_FILE		0x00000002
+#define	ACE_APPEND_DATA		0x00000004
+#define	ACE_ADD_SUBDIRECTORY	0x00000004
+#define	ACE_READ_NAMED_ATTRS	0x00000008
+#define	ACE_WRITE_NAMED_ATTRS	0x00000010
+#define	ACE_EXECUTE		0x00000020
+#define	ACE_DELETE_CHILD	0x00000040
+#define	ACE_READ_ATTRIBUTES	0x00000080
+#define	ACE_WRITE_ATTRIBUTES	0x00000100
+#define	ACE_DELETE		0x00010000
+#define	ACE_READ_ACL		0x00020000
+#define	ACE_WRITE_ACL		0x00040000
+#define	ACE_WRITE_OWNER		0x00080000
+#define	ACE_SYNCHRONIZE		0x00100000
+
+#define	ACE_FILE_INHERIT_ACE		0x0001
+#define	ACE_DIRECTORY_INHERIT_ACE	0x0002
+#define	ACE_NO_PROPAGATE_INHERIT_ACE	0x0004
+#define	ACE_INHERIT_ONLY_ACE		0x0008
 #define	ACE_SUCCESSFUL_ACCESS_ACE_FLAG	0x0010
 #define	ACE_FAILED_ACCESS_ACE_FLAG	0x0020
 #define	ACE_IDENTIFIER_GROUP		0x0040
-#define	ACE_INHERITED_ACE		0x0080	/* INHERITED_ACE, 0x10 on NT */
+#define	ACE_INHERITED_ACE		0x0080
 #define	ACE_OWNER			0x1000
 #define	ACE_GROUP			0x2000
 #define	ACE_EVERYONE			0x4000
 
-/* These four are the same as Windows, but with an ACE_ prefix added. */
 #define	ACE_ACCESS_ALLOWED_ACE_TYPE	0x0000
 #define	ACE_ACCESS_DENIED_ACE_TYPE	0x0001
 #define	ACE_SYSTEM_AUDIT_ACE_TYPE	0x0002
@@ -154,7 +134,6 @@ typedef struct acl_info acl_t;
 
 /*
  * These are only applicable in a CIFS context.
- * Here again, same as Windows, but with an ACE_ prefix added.
  */
 #define	ACE_ACCESS_ALLOWED_COMPOUND_ACE_TYPE		0x04
 #define	ACE_ACCESS_ALLOWED_OBJECT_ACE_TYPE		0x05

Modified: projects/powernv/conf/files.arm64
==============================================================================
--- projects/powernv/conf/files.arm64	Thu Jul  7 20:31:35 2016	(r302396)
+++ projects/powernv/conf/files.arm64	Thu Jul  7 20:36:07 2016	(r302397)
@@ -25,15 +25,10 @@ arm64/arm64/disassem.c		optional	ddb
 arm64/arm64/dump_machdep.c	standard
 arm64/arm64/elf_machdep.c	standard
 arm64/arm64/exception.S		standard
-arm64/arm64/gic.c		optional	!intrng
 arm64/arm64/gicv3_its.c		optional	intrng
-arm64/arm64/gic_acpi.c		optional	!intrng acpi
-arm64/arm64/gic_fdt.c		optional	!intrng fdt
 arm64/arm64/gic_v3.c		standard
 arm64/arm64/gic_v3_fdt.c	optional	fdt
-arm64/arm64/gic_v3_its.c	optional	!intrng
 arm64/arm64/identcpu.c		standard
-arm64/arm64/intr_machdep.c	optional	!intrng
 arm64/arm64/in_cksum.c		optional	inet | inet6
 arm64/arm64/locore.S		standard	no-obj
 arm64/arm64/machdep.c		standard
@@ -42,7 +37,6 @@ arm64/arm64/minidump_machdep.c	standard
 arm64/arm64/mp_machdep.c	optional	smp
 arm64/arm64/nexus.c		standard
 arm64/arm64/ofw_machdep.c	optional	fdt
-arm64/arm64/pic_if.m		optional	!intrng
 arm64/arm64/pmap.c		standard
 arm64/arm64/stack_machdep.c	optional	ddb | stack
 arm64/arm64/support.S		standard

*** DIFF OUTPUT TRUNCATED AT 1000 LINES ***



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