svn commit: r354532 - stable/12/sys/dev/gpio

2019-11-07 Thread Andriy Gapon
Author: avg
Date: Fri Nov  8 07:56:14 2019
New Revision: 354532
URL: https://svnweb.freebsd.org/changeset/base/354532

Log:
  MFC r354065: gpioiic: set output after switching to output mode...
  
  if presetting it failed.

Modified:
  stable/12/sys/dev/gpio/gpioiic.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/gpio/gpioiic.c
==
--- stable/12/sys/dev/gpio/gpioiic.cFri Nov  8 07:38:34 2019
(r354531)
+++ stable/12/sys/dev/gpio/gpioiic.cFri Nov  8 07:56:14 2019
(r354532)
@@ -168,59 +168,67 @@ gpioiic_reset_bus(device_t dev)
 }
 
 static void
-gpioiic_setsda(device_t dev, int val)
+gpioiic_setpin(struct gpioiic_softc *sc, int pin, int val)
 {
-   struct gpioiic_softc*sc = device_get_softc(dev);
+   int err;
 
if (val == 0) {
-   GPIOBUS_PIN_SET(sc->sc_busdev, sc->sc_dev, sc->sda_pin, 0);
-   GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, sc->sda_pin,
+   err = GPIOBUS_PIN_SET(sc->sc_busdev, sc->sc_dev, pin, 0);
+   GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, pin,
GPIO_PIN_OUTPUT);
+
+   /*
+* Some controllers cannot set output value while a pin is in
+* input mode.
+*/
+   if (err != 0)
+   GPIOBUS_PIN_SET(sc->sc_busdev, sc->sc_dev, pin, 0);
} else {
-   GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, sc->sda_pin,
+   GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, pin,
GPIO_PIN_INPUT);
}
 }
 
 static void
+gpioiic_setsda(device_t dev, int val)
+{
+   struct gpioiic_softc*sc = device_get_softc(dev);
+
+   gpioiic_setpin(sc, sc->sda_pin, val);
+}
+
+static void
 gpioiic_setscl(device_t dev, int val)
 {
struct gpioiic_softc*sc = device_get_softc(dev);
 
-   if (val == 0) {
-   GPIOBUS_PIN_SET(sc->sc_busdev, sc->sc_dev, sc->scl_pin, 0);
-   GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, sc->scl_pin,
-   GPIO_PIN_OUTPUT);
-   } else {
-   GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, sc->scl_pin,
-   GPIO_PIN_INPUT);
-   }
+   gpioiic_setpin(sc, sc->scl_pin, val);
 }
 
 static int
-gpioiic_getscl(device_t dev)
+gpioiic_getpin(struct gpioiic_softc *sc, int pin)
 {
-   struct gpioiic_softc*sc = device_get_softc(dev);
unsigned intval;
 
-   GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, sc->scl_pin,
-   GPIO_PIN_INPUT);
-   GPIOBUS_PIN_GET(sc->sc_busdev, sc->sc_dev, sc->scl_pin, );
-
+   GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, pin, GPIO_PIN_INPUT);
+   GPIOBUS_PIN_GET(sc->sc_busdev, sc->sc_dev, pin, );
return ((int)val);
 }
 
 static int
-gpioiic_getsda(device_t dev)
+gpioiic_getscl(device_t dev)
 {
struct gpioiic_softc*sc = device_get_softc(dev);
-   unsigned intval;
 
-   GPIOBUS_PIN_SETFLAGS(sc->sc_busdev, sc->sc_dev, sc->sda_pin,
-   GPIO_PIN_INPUT);
-   GPIOBUS_PIN_GET(sc->sc_busdev, sc->sc_dev, sc->sda_pin, );
+   return (gpioiic_getpin(sc, sc->scl_pin));
+}
 
-   return ((int)val);
+static int
+gpioiic_getsda(device_t dev)
+{
+   struct gpioiic_softc*sc = device_get_softc(dev);
+
+   return (gpioiic_getpin(sc, sc->sda_pin));
 }
 
 static int
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354531 - stable/12/sys/dev/ow

2019-11-07 Thread Andriy Gapon
Author: avg
Date: Fri Nov  8 07:38:34 2019
New Revision: 354531
URL: https://svnweb.freebsd.org/changeset/base/354531

Log:
  MFC r354077,r354078: owc_gpiobus_read_data: add recovery time to the read slot

Modified:
  stable/12/sys/dev/ow/owc_gpiobus.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/ow/owc_gpiobus.c
==
--- stable/12/sys/dev/ow/owc_gpiobus.c  Fri Nov  8 07:36:51 2019
(r354530)
+++ stable/12/sys/dev/ow/owc_gpiobus.c  Fri Nov  8 07:38:34 2019
(r354531)
@@ -307,7 +307,7 @@ owc_gpiobus_read_data(device_t dev, struct ow_timing *
/* Wait out the rest of t_slot */
do {
now = sbinuptime();
-   } while (now - then < t->t_slot * SBT_1US);
+   } while (now - then < (t->t_slot + t->t_rec) * SBT_1US);
 
RELBUS(sc);
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354530 - stable/12/sys/dev/ow

2019-11-07 Thread Andriy Gapon
Author: avg
Date: Fri Nov  8 07:36:51 2019
New Revision: 354530
URL: https://svnweb.freebsd.org/changeset/base/354530

Log:
  MFC r354076: owc_gpiobus_read_data: compare times in sbintime_t units

Modified:
  stable/12/sys/dev/ow/owc_gpiobus.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/ow/owc_gpiobus.c
==
--- stable/12/sys/dev/ow/owc_gpiobus.c  Fri Nov  8 07:35:32 2019
(r354529)
+++ stable/12/sys/dev/ow/owc_gpiobus.c  Fri Nov  8 07:36:51 2019
(r354530)
@@ -296,10 +296,10 @@ owc_gpiobus_read_data(device_t dev, struct ow_timing *
do {
now = sbinuptime();
GETPIN(sc, );
-   } while (sbttous(now - then) < t->t_rdv + 2 && sample == 0);
+   } while (now - then < (t->t_rdv + 2) * SBT_1US && sample == 0);
critical_exit();
 
-   if (sbttons(now - then) < t->t_rdv * 1000)
+   if (now - then < t->t_rdv * SBT_1US)
*bit = 1;
else
*bit = 0;
@@ -307,7 +307,7 @@ owc_gpiobus_read_data(device_t dev, struct ow_timing *
/* Wait out the rest of t_slot */
do {
now = sbinuptime();
-   } while ((now - then) / SBT_1US < t->t_slot);
+   } while (now - then < t->t_slot * SBT_1US);
 
RELBUS(sc);
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354529 - stable/12/sys/dev/ow

2019-11-07 Thread Andriy Gapon
Author: avg
Date: Fri Nov  8 07:35:32 2019
New Revision: 354529
URL: https://svnweb.freebsd.org/changeset/base/354529

Log:
  MFC r354069: owc_gpiobus_read_data: disable preemption earlier

Modified:
  stable/12/sys/dev/ow/owc_gpiobus.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/ow/owc_gpiobus.c
==
--- stable/12/sys/dev/ow/owc_gpiobus.c  Fri Nov  8 06:40:17 2019
(r354528)
+++ stable/12/sys/dev/ow/owc_gpiobus.c  Fri Nov  8 07:35:32 2019
(r354529)
@@ -279,6 +279,8 @@ owc_gpiobus_read_data(device_t dev, struct ow_timing *
if (error != 0)
return (error);
 
+   critical_enter();
+
/* Force low for t_lowr microseconds */
then = sbinuptime();
OUTPIN(sc);
@@ -291,7 +293,6 @@ owc_gpiobus_read_data(device_t dev, struct ow_timing *
 * master's pushing the line low.
 */
INPIN(sc);
-   critical_enter();
do {
now = sbinuptime();
GETPIN(sc, );
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354528 - head/share/man/man9

2019-11-07 Thread Rick Macklem
Author: rmacklem
Date: Fri Nov  8 06:40:17 2019
New Revision: 354528
URL: https://svnweb.freebsd.org/changeset/base/354528

Log:
  Fix the man page to correctly describe the use of the "len" argument.
  
  The man page incorrectly described the use of the"len" argument, which
  is updated to the number of bytes copied and not reduced by the number
  of bytes copied.
  
  This is a content change.

Modified:
  head/share/man/man9/VOP_COPY_FILE_RANGE.9

Modified: head/share/man/man9/VOP_COPY_FILE_RANGE.9
==
--- head/share/man/man9/VOP_COPY_FILE_RANGE.9   Fri Nov  8 04:26:19 2019
(r354527)
+++ head/share/man/man9/VOP_COPY_FILE_RANGE.9   Fri Nov  8 06:40:17 2019
(r354528)
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd July 24, 2019
+.Dd November 7, 2019
 .Dt VOP_COPY_FILE_RANGE 9
 .Os
 .Sh NAME
@@ -60,7 +60,7 @@ The vnode of the output file.
 .It Fa outoff
 A pointer to the file offset for the output file.
 .It Fa len
-A pointer to the number of bytes to be copied.
+A pointer to the byte count for the copy.
 .It Fa flags
 Flags, should be set to 0 for now.
 .It Fa incred
@@ -89,11 +89,11 @@ The
 .Fa len
 argument points to the location that stores the number of bytes
 to be copied.
-It should be reduced by the number of bytes copied, which implies that
-the value pointed to by
+Upon a successful return
 .Fa len
-will normally be zero for a non-error return.
-However, a copy of fewer bytes than requested is permitted.
+will be updated to the number of bytes actually copied.
+Normally, this will be the number of bytes requested to be copied,
+however a copy of fewer bytes than requested is permitted.
 .Sh LOCKS
 The vnode are unlocked on entry and must be unlocked on return.
 The byte ranges for both
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354527 - head/sys/powerpc/booke

2019-11-07 Thread Justin Hibbits
Author: jhibbits
Date: Fri Nov  8 04:26:19 2019
New Revision: 354527
URL: https://svnweb.freebsd.org/changeset/base/354527

Log:
  powerpc/booke:  Only handle kernel page faults in KVA range
  
  The memory range between VM_MAXUSER_ADDRESS and VM_MIN_KERNEL_ADDRESS is
  reserved for devices currently, which are always mapped in TLB1, and
  therefore do not exist in the kernel page table.  Any page fault in this
  range is therefore automatically a fatal fault.

Modified:
  head/sys/powerpc/booke/trap_subr.S

Modified: head/sys/powerpc/booke/trap_subr.S
==
--- head/sys/powerpc/booke/trap_subr.S  Fri Nov  8 03:45:13 2019
(r354526)
+++ head/sys/powerpc/booke/trap_subr.S  Fri Nov  8 04:26:19 2019
(r354527)
@@ -713,6 +713,15 @@ INTERRUPT(int_data_tlb_error)
mtcr%r21
bt  17, search_failed   /* check MSR[PR] */
 
+#ifdef __powerpc64__
+   srdi%r21, %r31, 48
+   cmpldi  cr0, %r21, VM_MIN_KERNEL_ADDRESS@highest
+#else
+   lis %r21, VM_MIN_KERNEL_ADDRESS@h
+   cmplw   cr0, %r31, %r21
+#endif
+   blt search_failed
+
 search_kernel_pmap:
/* Load r26 with kernel_pmap address */
bl  1f
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354526 - in head/sys/powerpc: booke include

2019-11-07 Thread Justin Hibbits
Author: jhibbits
Date: Fri Nov  8 03:45:13 2019
New Revision: 354526
URL: https://svnweb.freebsd.org/changeset/base/354526

Log:
  powerpc/booke: Make the TLB save area and mask match
  
  Since TLB_MAXNEST is 3, the insert mask should only be 2 bits.  Given that 2
  bits counts to 4, and that we already have plenty of space wasted in
  padding, make the nest level 4 to match the mask.

Modified:
  head/sys/powerpc/booke/trap_subr.S
  head/sys/powerpc/include/pcpu.h

Modified: head/sys/powerpc/booke/trap_subr.S
==
--- head/sys/powerpc/booke/trap_subr.S  Fri Nov  8 03:36:19 2019
(r354525)
+++ head/sys/powerpc/booke/trap_subr.S  Fri Nov  8 03:45:13 2019
(r354526)
@@ -365,14 +365,14 @@
ld  %r30, (TLBSAVE_BOOKE_R30)(br);  \
ld  %r31, (TLBSAVE_BOOKE_R31)(br);  
 #define TLB_NEST(outr,inr) \
-   rlwinm  outr, inr, 7, 22, 24;   /* 8 x TLBSAVE_LEN */
+   rlwinm  outr, inr, 7, 23, 24;   /* 8 x TLBSAVE_LEN */
 #else
 #define TLB_SAVE_REGS(br)  \
stmw%r20, TLBSAVE_BOOKE_R20(br)
 #define TLB_RESTORE_REGS(br)   \
lmw %r20, TLBSAVE_BOOKE_R20(br)
 #define TLB_NEST(outr,inr) \
-   rlwinm  outr, inr, 6, 23, 25;   /* 4 x TLBSAVE_LEN */
+   rlwinm  outr, inr, 6, 24, 25;   /* 4 x TLBSAVE_LEN */
 #endif
 #define TLB_PROLOG \
mtspr   SPR_SPRG4, %r1; /* Save SP */   \

Modified: head/sys/powerpc/include/pcpu.h
==
--- head/sys/powerpc/include/pcpu.h Fri Nov  8 03:36:19 2019
(r354525)
+++ head/sys/powerpc/include/pcpu.h Fri Nov  8 03:45:13 2019
(r354526)
@@ -77,14 +77,14 @@ struct pvo_entry;
 #endif
 
 #defineBOOKE_CRITSAVE_LEN  (CPUSAVE_LEN + 2)
-#defineBOOKE_TLB_MAXNEST   3
+#defineBOOKE_TLB_MAXNEST   4
 #defineBOOKE_TLB_SAVELEN   16
 #defineBOOKE_TLBSAVE_LEN   (BOOKE_TLB_SAVELEN * BOOKE_TLB_MAXNEST)
 
 #ifdef __powerpc64__
 #defineBOOKE_PCPU_PAD  901
 #else
-#defineBOOKE_PCPU_PAD  429
+#defineBOOKE_PCPU_PAD  365
 #endif
 #define PCPU_MD_BOOKE_FIELDS   \
register_t  critsave[BOOKE_CRITSAVE_LEN];   \
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354525 - in head/sys/powerpc: include mpc85xx ofw powerpc

2019-11-07 Thread Justin Hibbits
Author: jhibbits
Date: Fri Nov  8 03:36:19 2019
New Revision: 354525
URL: https://svnweb.freebsd.org/changeset/base/354525

Log:
  powerpc/mpc85xx: Add MSI support for Freescale PowerPC SoCs
  
  Freescale SoCs use a set of IRQs at the high end of the OpenPIC IRQ
  list, not counted in the NIRQs of the Feature reporting register.  Some
  SoCs include a MSI inbound window in the PCIe controller configuration
  registers as well, but some don't.  Currently, this only handles the
  SoCs *with* the MSI window.
  
  There are 256 MSIs per MSI bank (32 per MSI IRQ, 8 IRQs per MSI bank).
  The P5020 has 3 banks, yielding up to 768 MSIs; older SoCs have only one
  bank.

Modified:
  head/sys/powerpc/include/openpicvar.h
  head/sys/powerpc/mpc85xx/pci_mpc85xx.c
  head/sys/powerpc/ofw/openpic_ofw.c
  head/sys/powerpc/powerpc/openpic.c

Modified: head/sys/powerpc/include/openpicvar.h
==
--- head/sys/powerpc/include/openpicvar.h   Fri Nov  8 03:27:56 2019
(r354524)
+++ head/sys/powerpc/include/openpicvar.h   Fri Nov  8 03:36:19 2019
(r354525)
@@ -35,6 +35,7 @@
 #define OPENPIC_IRQMAX 256 /* h/w allows more */
 
 #defineOPENPIC_QUIRK_SINGLE_BIND   1   /* Bind interrupts to 
only 1 CPU */
+#defineOPENPIC_QUIRK_HIDDEN_IRQS   2   /* May have IRQs beyond 
FRR[NIRQ] */
 
 /* Names match the macros in openpicreg.h. */
 struct openpic_timer {

Modified: head/sys/powerpc/mpc85xx/pci_mpc85xx.c
==
--- head/sys/powerpc/mpc85xx/pci_mpc85xx.c  Fri Nov  8 03:27:56 2019
(r354524)
+++ head/sys/powerpc/mpc85xx/pci_mpc85xx.c  Fri Nov  8 03:36:19 2019
(r354525)
@@ -51,8 +51,10 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
+#include 
 
 #include 
 #include 
@@ -67,6 +69,7 @@ __FBSDID("$FreeBSD$");
 
 #include "ofw_bus_if.h"
 #include "pcib_if.h"
+#include "pic_if.h"
 
 #include 
 #include 
@@ -80,6 +83,12 @@ __FBSDID("$FreeBSD$");
 #defineREG_CFG_DATA0x0004
 #defineREG_INT_ACK 0x0008
 
+#defineREG_PEX_IP_BLK_REV1 0x0bf8
+#define  IP_MJ_M 0xff00
+#define  IP_MJ_S 8
+#define  IP_MN_M 0x00ff
+#define  IP_MN_S 0
+
 #defineREG_POTAR(n)(0x0c00 + 0x20 * (n))
 #defineREG_POTEAR(n)   (0x0c04 + 0x20 * (n))
 #defineREG_POWBAR(n)   (0x0c08 + 0x20 * (n))
@@ -89,6 +98,12 @@ __FBSDID("$FreeBSD$");
 #defineREG_PIWBAR(n)   (0x0e08 - 0x20 * (n))
 #defineREG_PIWBEAR(n)  (0x0e0c - 0x20 * (n))
 #defineREG_PIWAR(n)(0x0e10 - 0x20 * (n))
+#define  PIWAR_EN0x8000
+#define  PIWAR_PF0x4000
+#define  PIWAR_TRGT_M0x00f0
+#define  PIWAR_TRGT_S20
+#define  PIWAR_TRGT_CCSR 0xe
+#define  PIWAR_TRGT_LOCAL0xf
 
 #defineREG_PEX_MES_DR  0x0020
 #defineREG_PEX_MES_IER 0x0028
@@ -123,10 +138,14 @@ __FBSDID("$FreeBSD$");
 
 #defineDEVFN(b, s, f)  ((b << 16) | (s << 8) | f)
 
+#defineFSL_NUM_MSIS256 /* 8 registers of 32 bits (8 
hardware IRQs) */
+
 struct fsl_pcib_softc {
struct ofw_pci_softc pci_sc;
device_tsc_dev;
struct mtx  sc_cfg_mtx;
+   int sc_ip_maj;
+   int sc_ip_min;
 
int sc_iomem_target;
bus_addr_t  sc_iomem_start, sc_iomem_end;
@@ -151,6 +170,14 @@ struct fsl_pcib_err_dr {
uint32_terr_dr_mask;
 };
 
+struct fsl_msi_map {
+   SLIST_ENTRY(fsl_msi_map) slist;
+   uint32_tirq_base;
+   bus_addr_t  target;
+};
+
+SLIST_HEAD(msi_head, fsl_msi_map) fsl_msis = SLIST_HEAD_INITIALIZER(msi_head);
+
 static const struct fsl_pcib_err_dr pci_err[] = {
{"ME",  REG_PEX_ERR_DR_ME},
{"PCT", REG_PEX_ERR_DR_PCT},
@@ -195,7 +222,17 @@ static int fsl_pcib_maxslots(device_t);
 static uint32_t fsl_pcib_read_config(device_t, u_int, u_int, u_int, u_int, 
int);
 static void fsl_pcib_write_config(device_t, u_int, u_int, u_int, u_int,
 uint32_t, int);
+static int fsl_pcib_alloc_msi(device_t dev, device_t child,
+int count, int maxcount, int *irqs);
+static int fsl_pcib_release_msi(device_t dev, device_t child,
+int count, int *irqs);
+static int fsl_pcib_alloc_msix(device_t dev, device_t child, int *irq);
+static int fsl_pcib_release_msix(device_t dev, device_t child, int irq);
+static int fsl_pcib_map_msi(device_t dev, device_t child,
+int irq, uint64_t *addr, uint32_t *data);
 
+static vmem_t *msi_vmem;   /* Global MSI vmem, holds all MSI ranges. */
+
 /*
  * Bus interface definitions.
  */
@@ -209,6 +246,11 @@ static device_method_t fsl_pcib_methods[] = {
DEVMETHOD(pcib_maxslots, 

svn commit: r354524 - head/sys/arm/broadcom/bcm2835

2019-11-07 Thread Kyle Evans
Author: kevans
Date: Fri Nov  8 03:27:56 2019
New Revision: 354524
URL: https://svnweb.freebsd.org/changeset/base/354524

Log:
  bcm2835_dma: Mark IRQs shareable
  
  On the RPi4, some of these IRQs are shared. Start moving toward a mode where
  we accept that shared IRQs happen and simply ignore interrupts that are
  seemingly for no reason.
  
  I would like to be more verbose here, but my 30-minute assessment of the
  current world order is that mapping a resource/rid to an actual IRQ number
  (as found in FDT) data is not a simple matter. Determining if more than one
  handler is attached to an IRQ is closer to feasible, but it's unclear which
  way is the cleaner path. Beyond that, we're only really using it to be
  slightly more verbose when something's going wrong, so for now just suppress
  and drop a complaint-comment.
  
  This was originally submitted (via freebsd-arm@) by Robert Crowston; the
  additional verbosity was dropped by kevans@.
  
  Submitted by: Robert Crowston 

Modified:
  head/sys/arm/broadcom/bcm2835/bcm2835_dma.c

Modified: head/sys/arm/broadcom/bcm2835/bcm2835_dma.c
==
--- head/sys/arm/broadcom/bcm2835/bcm2835_dma.c Fri Nov  8 03:14:06 2019
(r354523)
+++ head/sys/arm/broadcom/bcm2835/bcm2835_dma.c Fri Nov  8 03:27:56 2019
(r354524)
@@ -619,18 +619,18 @@ bcm_dma_intr(void *arg)
/* my interrupt? */
cs = bus_read_4(sc->sc_mem, BCM_DMA_CS(ch->ch));
 
-   if (!(cs & (CS_INT | CS_ERR))) {
-   device_printf(sc->sc_dev,
-   "unexpected DMA intr CH=%d, CS=%x\n", ch->ch, cs);
+   /*
+* Is it an active channel?  Our diagnostics could be better here, but
+* it's not necessarily an easy task to resolve a rid/resource to an
+* actual irq number.  We'd want to do this to set a flag indicating
+* whether the irq is shared or not, so we know to complain.
+*/
+   if (!(ch->flags & BCM_DMA_CH_USED))
return;
-   }
 
-   /* running? */
-   if (!(ch->flags & BCM_DMA_CH_USED)) {
-   device_printf(sc->sc_dev,
-   "unused DMA intr CH=%d, CS=%x\n", ch->ch, cs);
+   /* Again, we can't complain here.  The same logic applies. */
+   if (!(cs & (CS_INT | CS_ERR)))
return;
-   }
 
if (cs & CS_ERR) {
debug = bus_read_4(sc->sc_mem, BCM_DMA_DEBUG(ch->ch));
@@ -715,7 +715,7 @@ bcm_dma_attach(device_t dev)
continue;
 
sc->sc_irq[rid] = bus_alloc_resource_any(dev, SYS_RES_IRQ, ,
-  RF_ACTIVE);
+   RF_ACTIVE | RF_SHAREABLE);
if (sc->sc_irq[rid] == NULL) {
device_printf(dev, "cannot allocate interrupt\n");
err = ENXIO;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354523 - head/share/mk

2019-11-07 Thread Brooks Davis
Author: brooks
Date: Fri Nov  8 03:14:06 2019
New Revision: 354523
URL: https://svnweb.freebsd.org/changeset/base/354523

Log:
  Turn the error about a lack of LIBCOMPAT into a warning.
  
  Add some diagnostic output.
  
  This works around the fact that buildworld calls cleandir in libexec
  with the wrong MACHINE_ARCH (i386 on amd64) when the OBJ directory is empty.
  
  Reported by:  bdragon, jkim

Modified:
  head/share/mk/bsd.compat.mk

Modified: head/share/mk/bsd.compat.mk
==
--- head/share/mk/bsd.compat.mk Fri Nov  8 01:13:12 2019(r354522)
+++ head/share/mk/bsd.compat.mk Fri Nov  8 03:14:06 2019(r354523)
@@ -103,7 +103,7 @@ LIBSOFTWMAKEFLAGS=-DCOMPAT_SOFTFP
 # In the program linking case, select LIBCOMPAT
 .if defined(NEED_COMPAT)
 .ifndef HAS_COMPAT
-.error NEED_COMPAT defined, but no LIBCOMPAT is available
+.warning NEED_COMPAT defined, but no LIBCOMPAT is available (COMPAT_ARCH == 
${COMPAT_ARCH}
 .elif !${HAS_COMPAT:M${NEED_COMPAT}} && ${NEED_COMPAT} != "any"
 .error NEED_COMPAT (${NEED_COMPAT}) defined, but not in HAS_COMPAT 
($HAS_COMPAT)
 .elif ${NEED_COMPAT} == "any"
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354522 - head/sys/dev/cxgbe

2019-11-07 Thread Navdeep Parhar
Author: np
Date: Fri Nov  8 01:13:12 2019
New Revision: 354522
URL: https://svnweb.freebsd.org/changeset/base/354522

Log:
  cxgbe(4): Query Vdd from the firmware if its last known value is 0.
  
  TVSENSE may not be ready by the time t4_fw_initialize returns and the
  firmware returns 0 if the driver asks for the Vdd before the sensor is
  ready.
  
  MFC after:1 week
  Sponsored by: Chelsio Communications

Modified:
  head/sys/dev/cxgbe/t4_main.c

Modified: head/sys/dev/cxgbe/t4_main.c
==
--- head/sys/dev/cxgbe/t4_main.cFri Nov  8 00:01:37 2019
(r354521)
+++ head/sys/dev/cxgbe/t4_main.cFri Nov  8 01:13:12 2019
(r354522)
@@ -656,6 +656,7 @@ static int sysctl_fec(SYSCTL_HANDLER_ARGS);
 static int sysctl_autoneg(SYSCTL_HANDLER_ARGS);
 static int sysctl_handle_t4_reg64(SYSCTL_HANDLER_ARGS);
 static int sysctl_temperature(SYSCTL_HANDLER_ARGS);
+static int sysctl_vdd(SYSCTL_HANDLER_ARGS);
 static int sysctl_loadavg(SYSCTL_HANDLER_ARGS);
 static int sysctl_cctrl(SYSCTL_HANDLER_ARGS);
 static int sysctl_cim_ibq_obq(SYSCTL_HANDLER_ARGS);
@@ -6153,8 +6154,8 @@ t4_sysctls(struct adapter *sc)
CTLFLAG_RD, sc, 0, sysctl_loadavg, "A",
"microprocessor load averages (debug firmwares only)");
 
-   SYSCTL_ADD_INT(ctx, children, OID_AUTO, "core_vdd", CTLFLAG_RD,
-   >params.core_vdd, 0, "core Vdd (in mV)");
+   SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "core_vdd", CTLTYPE_INT |
+   CTLFLAG_RD, sc, 0, sysctl_vdd, "I", "core Vdd (in mV)");
 
SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "local_cpus",
CTLTYPE_STRING | CTLFLAG_RD, sc, LOCAL_CPUS,
@@ -7292,6 +7293,31 @@ sysctl_temperature(SYSCTL_HANDLER_ARGS)
 
rc = sysctl_handle_int(oidp, , 0, req);
return (rc);
+}
+
+static int
+sysctl_vdd(SYSCTL_HANDLER_ARGS)
+{
+   struct adapter *sc = arg1;
+   int rc;
+   uint32_t param, val;
+
+   if (sc->params.core_vdd == 0) {
+   rc = begin_synchronized_op(sc, NULL, SLEEP_OK | INTR_OK,
+   "t4vdd");
+   if (rc)
+   return (rc);
+   param = V_FW_PARAMS_MNEM(FW_PARAMS_MNEM_DEV) |
+   V_FW_PARAMS_PARAM_X(FW_PARAMS_PARAM_DEV_DIAG) |
+   V_FW_PARAMS_PARAM_Y(FW_PARAM_DEV_DIAG_VDD);
+   rc = -t4_query_params(sc, sc->mbox, sc->pf, 0, 1, , );
+   end_synchronized_op(sc, 0);
+   if (rc)
+   return (rc);
+   sc->params.core_vdd = val;
+   }
+
+   return (sysctl_handle_int(oidp, >params.core_vdd, 0, req));
 }
 
 static int
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354521 - head

2019-11-07 Thread Mark Johnston
Author: markj
Date: Fri Nov  8 00:01:37 2019
New Revision: 354521
URL: https://svnweb.freebsd.org/changeset/base/354521

Log:
  Document iwm(4) support for 9000-series devices.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  head/RELNOTES

Modified: head/RELNOTES
==
--- head/RELNOTES   Thu Nov  7 23:57:48 2019(r354520)
+++ head/RELNOTES   Fri Nov  8 00:01:37 2019(r354521)
@@ -10,6 +10,9 @@ newline.  Entries should be separated by a newline.
 
 Changes to this file should not be MFCed.
 
+r354517:
+   iwm(4) now supports most Intel 9260, 9460 and 9560 Wi-Fi devices.
+
 r354269:
sqlite3 is updated to sqlite3-3.30.1.
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354520 - head/lib/msun/src

2019-11-07 Thread Li-Wen Hsu
Author: lwhsu
Date: Thu Nov  7 23:57:48 2019
New Revision: 354520
URL: https://svnweb.freebsd.org/changeset/base/354520

Log:
  Get the fix in back by reverting the part accidentally included in r354491.
  
  This brings back r354467.
  
  MFC after:1 week
  Sponsored by: The FreeBSD Foundation

Modified:
  head/lib/msun/src/k_sincosl.h

Modified: head/lib/msun/src/k_sincosl.h
==
--- head/lib/msun/src/k_sincosl.h   Thu Nov  7 23:54:40 2019
(r354519)
+++ head/lib/msun/src/k_sincosl.h   Thu Nov  7 23:57:48 2019
(r354520)
@@ -28,8 +28,8 @@ S1lo = -9.2563760475949941e-18;   /* 
-0x155800.
 #defineC1  ((long double)C1hi + C1lo)
 #else
 static const long double
-C1 =  0.041136L;   /*  0xaa9b.0p-68 */
-S1 = -0.16671L,/* -0xaaab.0p-66 */
+C1 =  0.041136L,   /*  0xaa9b.0p-68 */
+S1 = -0.16671L;/* -0xaaab.0p-66 */
 #endif
 
 static const double
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354519 - in head: . share/mk

2019-11-07 Thread Brooks Davis
Author: brooks
Date: Thu Nov  7 23:54:40 2019
New Revision: 354519
URL: https://svnweb.freebsd.org/changeset/base/354519

Log:
  Revert r354518 and commit the intented fix rather than the diagnostic
  check.
  
  This fixes the definition of MK_LIB32 in Makefile.inc1.

Modified:
  head/Makefile.inc1
  head/share/mk/src.opts.mk

Modified: head/Makefile.inc1
==
--- head/Makefile.inc1  Thu Nov  7 23:50:33 2019(r354518)
+++ head/Makefile.inc1  Thu Nov  7 23:54:40 2019(r354519)
@@ -803,7 +803,6 @@ XCFLAGS+=   ${BFLAGS}
 .endif
 
 .if ${MK_LIB32} == "yes"
-.error WTF
 _LIBCOMPAT= 32
 .include "Makefile.libcompat"
 .elif ${MK_LIBSOFT} == "yes"

Modified: head/share/mk/src.opts.mk
==
--- head/share/mk/src.opts.mk   Thu Nov  7 23:50:33 2019(r354518)
+++ head/share/mk/src.opts.mk   Thu Nov  7 23:54:40 2019(r354519)
@@ -358,8 +358,7 @@ __DEFAULT_NO_OPTIONS+=GDB_LIBEXEC
 __DEFAULT_YES_OPTIONS+=GDB_LIBEXEC
 .endif
 # LIB32 is supported on amd64, mips64, and powerpc64
-.if (${MACHINE_ARCH} == "amd64" || ${MACHINE_ARCH:Mmips64*} || \
-${MACHINE_ARCH} == "powerpc64")
+.if (${__T} == "amd64" || ${__T:Mmips64*} || ${__T} == "powerpc64")
 __DEFAULT_YES_OPTIONS+=LIB32
 .else
 BROKEN_OPTIONS+=LIB32
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354518 - head

2019-11-07 Thread Brooks Davis
Author: brooks
Date: Thu Nov  7 23:50:33 2019
New Revision: 354518
URL: https://svnweb.freebsd.org/changeset/base/354518

Log:
  Fix the ARCH check for LIB32 from Makefile.inc1.

Modified:
  head/Makefile.inc1

Modified: head/Makefile.inc1
==
--- head/Makefile.inc1  Thu Nov  7 23:39:33 2019(r354517)
+++ head/Makefile.inc1  Thu Nov  7 23:50:33 2019(r354518)
@@ -803,6 +803,7 @@ XCFLAGS+=   ${BFLAGS}
 .endif
 
 .if ${MK_LIB32} == "yes"
+.error WTF
 _LIBCOMPAT= 32
 .include "Makefile.libcompat"
 .elif ${MK_LIBSOFT} == "yes"
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354517 - head/share/man/man4

2019-11-07 Thread Mark Johnston
Author: markj
Date: Thu Nov  7 23:39:33 2019
New Revision: 354517
URL: https://svnweb.freebsd.org/changeset/base/354517

Log:
  Update iwm and iwmfw man pages with info about 9000-series chips.
  
  Thanks to bapt, bz, cem, woodsb02, Neel Chauhan and Salvador Martínez
  Mármol for helping test the initial 9000-series support.
  
  MFC after:2 weeks
  Sponsored by: The FreeBSD Foundation

Modified:
  head/share/man/man4/iwm.4
  head/share/man/man4/iwmfw.4

Modified: head/share/man/man4/iwm.4
==
--- head/share/man/man4/iwm.4   Thu Nov  7 23:39:17 2019(r354516)
+++ head/share/man/man4/iwm.4   Thu Nov  7 23:39:33 2019(r354517)
@@ -25,7 +25,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd October 29, 2017
+.Dd November 7, 2019
 .Dt IWM 4
 .Os
 .Sh NAME
@@ -51,6 +51,8 @@ Choose one from:
 .Cd "device iwm7265fw"
 .Cd "device iwm8000Cfw"
 .Cd "device iwm8265fw"
+.Cd "device iwm9000fw"
+.Cd "device iwm9260fw"
 .Ed
 .Pp
 Or you can use
@@ -71,6 +73,8 @@ iwm7260fw_load="YES"
 iwm7265fw_load="YES"
 iwm8000Cfw_load="YES"
 iwm8265fw_load="YES"
+iwm9000fw_load="YES"
+iwm9260fw_load="YES"
 .Ed
 .Sh DESCRIPTION
 The
@@ -84,6 +88,10 @@ driver provides support for:
 .It Intel Dual Band Wireless AC 7260
 .It Intel Dual Band Wireless AC 7265
 .It Intel Dual Band Wireless AC 8260
+.It Intel Dual Band Wireless AC 9260
+.It Intel Dual Band Wireless AC 9270
+.It Intel Dual Band Wireless AC 946X
+.It Intel Dual Band Wireless AC 9560
 .El
 .Pp
 .Nm

Modified: head/share/man/man4/iwmfw.4
==
--- head/share/man/man4/iwmfw.4 Thu Nov  7 23:39:17 2019(r354516)
+++ head/share/man/man4/iwmfw.4 Thu Nov  7 23:39:33 2019(r354517)
@@ -22,7 +22,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd October 29, 2017
+.Dd November 7, 2019
 .Dt IWMFW 4
 .Os
 .Sh NAME
@@ -48,10 +48,12 @@ of the following:
 .Cd "device iwm7265fw"
 .Cd "device iwm8000Cfw"
 .Cd "device iwm8265fw"
+.Cd "device iwm9000fw"
+.Cd "device iwm9260fw"
 .Ed
 .Pp
 Alternatively, to load the driver as a
-module at boot time, place the following line in
+module at boot time, place one of the following lines in
 .Xr loader.conf 5 :
 .Bd -literal -offset indent
 iwm3160fw_load="YES"
@@ -61,13 +63,14 @@ iwm7265fw_load="YES"
 iwm7265Dfw_load="YES"
 iwm8000Cfw_load="YES"
 iwm8265fw_load="YES"
+iwm9000fw_load="YES"
+iwm9260fw_load="YES"
 .Ed
 .Sh DESCRIPTION
 This module provides access to firmware sets for the
-Intel Dual Band Wireless WiFi 3160, 3165, 3168, 7260, 7265, 8000, and 8260 
series of
-IEEE 802.11n/11ac adapters.
-It may be
-statically linked into the kernel, or loaded as a module.
+Intel Dual Band Wireless WiFi 3160, 3165, 3168, 7260, 7265, 8000, 8260,
+9000 and 9260 series of IEEE 802.11n/11ac adapters.
+It may be statically linked into the kernel, or loaded as a module.
 .Sh SEE ALSO
 .Xr iwm 4 ,
 .Xr firmware 9
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354516 - head/sys/dev/iwm

2019-11-07 Thread Mark Johnston
Author: markj
Date: Thu Nov  7 23:39:17 2019
New Revision: 354516
URL: https://svnweb.freebsd.org/changeset/base/354516

Log:
  iwm: Sync device initialization and reset code with iwlwifi.
  
  MFC after:2 weeks
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/dev/iwm/if_iwm.c
  head/sys/dev/iwm/if_iwm_pcie_trans.c
  head/sys/dev/iwm/if_iwmreg.h

Modified: head/sys/dev/iwm/if_iwm.c
==
--- head/sys/dev/iwm/if_iwm.c   Thu Nov  7 23:39:04 2019(r354515)
+++ head/sys/dev/iwm/if_iwm.c   Thu Nov  7 23:39:17 2019(r354516)
@@ -1353,6 +1353,8 @@ iwm_stop_device(struct iwm_softc *sc)
 */
iwm_enable_rfkill_int(sc);
iwm_check_rfkill(sc);
+
+   iwm_prepare_card_hw(sc);
 }
 
 /* iwlwifi: mvm/ops.c */
@@ -1381,7 +1383,15 @@ iwm_mvm_nic_config(struct iwm_softc *sc)
reg_val |= radio_cfg_step << IWM_CSR_HW_IF_CONFIG_REG_POS_PHY_STEP;
reg_val |= radio_cfg_dash << IWM_CSR_HW_IF_CONFIG_REG_POS_PHY_DASH;
 
-   IWM_WRITE(sc, IWM_CSR_HW_IF_CONFIG_REG, reg_val);
+   IWM_WRITE(sc, IWM_CSR_HW_IF_CONFIG_REG,
+   IWM_CSR_HW_IF_CONFIG_REG_MSK_MAC_DASH |
+   IWM_CSR_HW_IF_CONFIG_REG_MSK_MAC_STEP |
+   IWM_CSR_HW_IF_CONFIG_REG_MSK_PHY_STEP |
+   IWM_CSR_HW_IF_CONFIG_REG_MSK_PHY_DASH |
+   IWM_CSR_HW_IF_CONFIG_REG_MSK_PHY_TYPE |
+   IWM_CSR_HW_IF_CONFIG_REG_BIT_RADIO_SI |
+   IWM_CSR_HW_IF_CONFIG_REG_BIT_MAC_SI |
+   reg_val);
 
IWM_DPRINTF(sc, IWM_DEBUG_RESET,
"Radio type=0x%x-0x%x-0x%x\n", radio_cfg_type,

Modified: head/sys/dev/iwm/if_iwm_pcie_trans.c
==
--- head/sys/dev/iwm/if_iwm_pcie_trans.cThu Nov  7 23:39:04 2019
(r354515)
+++ head/sys/dev/iwm/if_iwm_pcie_trans.cThu Nov  7 23:39:17 2019
(r354516)
@@ -346,6 +346,8 @@ iwm_enable_rfkill_int(struct iwm_softc *sc)
 {
sc->sc_intmask = IWM_CSR_INT_BIT_RF_KILL;
IWM_WRITE(sc, IWM_CSR_INT_MASK, sc->sc_intmask);
+   IWM_SETBITS(sc, IWM_CSR_GP_CNTRL,
+   IWM_CSR_GP_CNTRL_REG_FLAG_RFKILL_WAKE_L1A_EN);
 }
 
 int
@@ -404,7 +406,9 @@ iwm_prepare_card_hw(struct iwm_softc *sc)
if (iwm_set_hw_ready(sc))
goto out;
 
-   DELAY(100);
+   IWM_SETBITS(sc, IWM_CSR_DBG_LINK_PWR_MGMT_REG,
+   IWM_CSR_RESET_LINK_PWR_MGMT_DISABLED);
+   DELAY(1000);
 
/* If HW is not ready, prepare the conditions to check again */
IWM_SETBITS(sc, IWM_CSR_HW_IF_CONFIG_REG,
@@ -590,6 +594,16 @@ iwm_apm_init(struct iwm_softc *sc)
 void
 iwm_apm_stop(struct iwm_softc *sc)
 {
+   IWM_SETBITS(sc, IWM_CSR_DBG_LINK_PWR_MGMT_REG,
+   IWM_CSR_RESET_LINK_PWR_MGMT_DISABLED);
+   IWM_SETBITS(sc, IWM_CSR_HW_IF_CONFIG_REG,
+   IWM_CSR_HW_IF_CONFIG_REG_PREPARE |
+   IWM_CSR_HW_IF_CONFIG_REG_ENABLE_PME);
+   DELAY(1000);
+   IWM_CLRBITS(sc, IWM_CSR_DBG_LINK_PWR_MGMT_REG,
+   IWM_CSR_RESET_LINK_PWR_MGMT_DISABLED);
+   DELAY(5000);
+
/* stop device's busmaster DMA activity */
IWM_SETBITS(sc, IWM_CSR_RESET, IWM_CSR_RESET_REG_FLAG_STOP_MASTER);
 
@@ -597,6 +611,14 @@ iwm_apm_stop(struct iwm_softc *sc)
IWM_CSR_RESET_REG_FLAG_MASTER_DISABLED,
IWM_CSR_RESET_REG_FLAG_MASTER_DISABLED, 100))
device_printf(sc->sc_dev, "timeout waiting for master\n");
+
+   /*
+* Clear "initialization complete" bit to move adapter from
+* D0A* (powered-up Active) --> D0U* (Uninitialized) state.
+*/
+   IWM_CLRBITS(sc, IWM_CSR_GP_CNTRL,
+   IWM_CSR_GP_CNTRL_REG_FLAG_INIT_DONE);
+
IWM_DPRINTF(sc, IWM_DEBUG_TRANS, "%s: iwm apm stop\n", __func__);
 }
 

Modified: head/sys/dev/iwm/if_iwmreg.h
==
--- head/sys/dev/iwm/if_iwmreg.hThu Nov  7 23:39:04 2019
(r354515)
+++ head/sys/dev/iwm/if_iwmreg.hThu Nov  7 23:39:17 2019
(r354516)
@@ -289,7 +289,7 @@
 #define IWM_CSR_GP_CNTRL_REG_VAL_MAC_ACCESS_EN   (0x0001)
 
 #define IWM_CSR_GP_CNTRL_REG_MSK_POWER_SAVE_TYPE (0x0700)
-#define IWM_CSR_GP_CNTRL_REG_FLAG_MAC_POWER_SAVE (0x0400)
+#define IWM_CSR_GP_CNTRL_REG_FLAG_RFKILL_WAKE_L1A_EN (0x0400)
 #define IWM_CSR_GP_CNTRL_REG_FLAG_HW_RF_KILL_SW  (0x0800)
 
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354513 - head/sys/dev/iwm

2019-11-07 Thread Mark Johnston
Author: markj
Date: Thu Nov  7 23:38:36 2019
New Revision: 354513
URL: https://svnweb.freebsd.org/changeset/base/354513

Log:
  iwm: Set flag for pad bytes in offload_assist.
  
  Though we don't otherwise use firmware's offload capabilities, we need
  to set this flag when the MAC header's size isn't a multiple of four.
  
  MFC after:2 weeks
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/dev/iwm/if_iwm.c
  head/sys/dev/iwm/if_iwmreg.h

Modified: head/sys/dev/iwm/if_iwm.c
==
--- head/sys/dev/iwm/if_iwm.c   Thu Nov  7 23:38:17 2019(r354512)
+++ head/sys/dev/iwm/if_iwm.c   Thu Nov  7 23:38:36 2019(r354513)
@@ -3882,11 +3882,12 @@ iwm_tx(struct iwm_softc *sc, struct mbuf *m, struct ie
if (hdrlen & 3) {
/* First segment length must be a multiple of 4. */
flags |= IWM_TX_CMD_FLG_MH_PAD;
+   tx->offload_assist |= htole16(1 << IWM_TX_CMD_OFFLD_PAD);
pad = 4 - (hdrlen & 3);
-   } else
+   } else {
+   tx->offload_assist = 0;
pad = 0;
-
-   tx->next_frame_len = 0;
+   }
 
tx->len = htole16(totlen);
tx->tid_tspec = tid;

Modified: head/sys/dev/iwm/if_iwmreg.h
==
--- head/sys/dev/iwm/if_iwmreg.hThu Nov  7 23:38:17 2019
(r354512)
+++ head/sys/dev/iwm/if_iwmreg.hThu Nov  7 23:38:36 2019
(r354513)
@@ -4477,13 +4477,41 @@ enum iwm_tx_pm_timeouts {
 #define IWM_BAR_DFAULT_RETRY_LIMIT 60
 #define IWM_LOW_RETRY_LIMIT7
 
+/**
+ * enum iwm_tx_offload_assist_flags_pos -  set %iwm_tx_cmd offload_assist 
values
+ * @IWM_TX_CMD_OFFLD_IP_HDR: offset to start of IP header (in words)
+ * from mac header end. For normal case it is 4 words for SNAP.
+ * note: tx_cmd, mac header and pad are not counted in the offset.
+ * This is used to help the offload in case there is tunneling such as
+ * IPv6 in IPv4, in such case the ip header offset should point to the
+ * inner ip header and IPv4 checksum of the external header should be
+ * calculated by driver.
+ * @IWM_TX_CMD_OFFLD_L4_EN: enable TCP/UDP checksum
+ * @IWM_TX_CMD_OFFLD_L3_EN: enable IP header checksum
+ * @IWM_TX_CMD_OFFLD_MH_SIZE: size of the mac header in words. Includes the IV
+ * field. Doesn't include the pad.
+ * @IWM_TX_CMD_OFFLD_PAD: mark 2-byte pad was inserted after the mac header for
+ * alignment
+ * @IWM_TX_CMD_OFFLD_AMSDU: mark TX command is A-MSDU
+ */
+enum iwm_tx_offload_assist_flags_pos {
+   IWM_TX_CMD_OFFLD_IP_HDR =   0,
+   IWM_TX_CMD_OFFLD_L4_EN =6,
+   IWM_TX_CMD_OFFLD_L3_EN =7,
+   IWM_TX_CMD_OFFLD_MH_SIZE =  8,
+   IWM_TX_CMD_OFFLD_PAD =  13,
+   IWM_TX_CMD_OFFLD_AMSDU =14,
+};
+
+#define IWM_TX_CMD_OFFLD_MH_MASK   0x1f
+#define IWM_TX_CMD_OFFLD_IP_HDR_MASK   0x3f
+
 /* TODO: complete documentation for try_cnt and btkill_cnt */
 /**
  * struct iwm_tx_cmd - TX command struct to FW
  * ( IWM_TX_CMD = 0x1c )
  * @len: in bytes of the payload, see below for details
- * @next_frame_len: same as len, but for next frame (0 if not applicable)
- * Used for fragmentation and bursting, but not in 11n aggregation.
+ * @offload_assist: TX offload configuration
  * @tx_flags: combination of IWM_TX_CMD_FLG_*
  * @rate_n_flags: rate for *all* Tx attempts, if IWM_TX_CMD_FLG_STA_RATE_MSK is
  * cleared. Combination of IWM_RATE_MCS_*
@@ -4519,7 +4547,7 @@ enum iwm_tx_pm_timeouts {
  */
 struct iwm_tx_cmd {
uint16_t len;
-   uint16_t next_frame_len;
+   uint16_t offload_assist;
uint32_t tx_flags;
struct {
uint8_t try_cnt;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354514 - head/sys/dev/iwm

2019-11-07 Thread Mark Johnston
Author: markj
Date: Thu Nov  7 23:38:49 2019
New Revision: 354514
URL: https://svnweb.freebsd.org/changeset/base/354514

Log:
  iwm: Use the default station for all transmits.
  
  This is what iwlwifi seems to do, and the previous behaviour triggered
  firmware panics during transmit on a 9560.
  
  MFC after:2 weeks
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/dev/iwm/if_iwm.c

Modified: head/sys/dev/iwm/if_iwm.c
==
--- head/sys/dev/iwm/if_iwm.c   Thu Nov  7 23:38:36 2019(r354513)
+++ head/sys/dev/iwm/if_iwm.c   Thu Nov  7 23:38:49 2019(r354514)
@@ -3858,11 +3858,7 @@ iwm_tx(struct iwm_softc *sc, struct mbuf *m, struct ie
flags |= IWM_TX_CMD_FLG_PROT_REQUIRE;
}
 
-   if (IEEE80211_IS_MULTICAST(wh->i_addr1) ||
-   type != IEEE80211_FC0_TYPE_DATA)
-   tx->sta_id = sc->sc_aux_sta.sta_id;
-   else
-   tx->sta_id = IWM_STATION_ID;
+   tx->sta_id = IWM_STATION_ID;
 
if (type == IEEE80211_FC0_TYPE_MGT) {
uint8_t subtype = wh->i_fc[0] & IEEE80211_FC0_SUBTYPE_MASK;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354515 - head/sys/dev/iwm

2019-11-07 Thread Mark Johnston
Author: markj
Date: Thu Nov  7 23:39:04 2019
New Revision: 354515
URL: https://svnweb.freebsd.org/changeset/base/354515

Log:
  iwm: Implement support for scans with "adaptive" dwell time.
  
  This is required by 9000-series firmware.
  
  MFC after:2 weeks
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/dev/iwm/if_iwm_scan.c
  head/sys/dev/iwm/if_iwmreg.h

Modified: head/sys/dev/iwm/if_iwm_scan.c
==
--- head/sys/dev/iwm/if_iwm_scan.c  Thu Nov  7 23:38:49 2019
(r354514)
+++ head/sys/dev/iwm/if_iwm_scan.c  Thu Nov  7 23:39:04 2019
(r354515)
@@ -580,6 +580,29 @@ iwm_mvm_scan_use_ebs(struct iwm_softc *sc)
sc->last_ebs_successful);
 }
 
+static int
+iwm_mvm_scan_size(struct iwm_softc *sc)
+{
+   int base_size;
+
+   if (iwm_fw_has_capa(sc, IWM_UCODE_TLV_CAPA_UMAC_SCAN)) {
+   if (iwm_fw_has_api(sc, IWM_UCODE_TLV_API_ADAPTIVE_DWELL))
+   base_size = IWM_SCAN_REQ_UMAC_SIZE_V7;
+   else
+   base_size = IWM_SCAN_REQ_UMAC_SIZE_V1;
+
+   return base_size +
+   sizeof(struct iwm_scan_channel_cfg_umac) *
+   sc->sc_fw.ucode_capa.n_scan_channels +
+   sizeof(struct iwm_scan_req_umac_tail);
+   } else {
+   return sizeof(struct iwm_scan_req_lmac) +
+   sizeof(struct iwm_scan_channel_cfg_lmac) *
+   sc->sc_fw.ucode_capa.n_scan_channels +
+   sizeof(struct iwm_scan_probe_req);
+   }
+}
+
 int
 iwm_mvm_umac_scan(struct iwm_softc *sc)
 {
@@ -593,13 +616,11 @@ iwm_mvm_umac_scan(struct iwm_softc *sc)
struct iwm_scan_req_umac *req;
struct iwm_scan_req_umac_tail *tail;
size_t req_len;
-   uint8_t i, nssid;
+   uint16_t general_flags;
+   uint8_t channel_flags, i, nssid;
int ret;
 
-   req_len = sizeof(struct iwm_scan_req_umac) +
-   (sizeof(struct iwm_scan_channel_cfg_umac) *
-   sc->sc_fw.ucode_capa.n_scan_channels) +
-   sizeof(struct iwm_scan_req_umac_tail);
+   req_len = iwm_mvm_scan_size(sc);
if (req_len > IWM_MAX_CMD_PAYLOAD_SIZE)
return ENOMEM;
req = malloc(req_len, M_DEVBUF, M_NOWAIT | M_ZERO);
@@ -611,28 +632,58 @@ iwm_mvm_umac_scan(struct iwm_softc *sc)
 
IWM_DPRINTF(sc, IWM_DEBUG_SCAN, "Handling ieee80211 scan request\n");
 
-   /* These timings correspond to iwlwifi's UNASSOC scan. */
-   req->active_dwell = 10;
-   req->passive_dwell = 110;
-   req->fragmented_dwell = 44;
-   req->extended_dwell = 90;
-   req->max_out_time = 0;
-   req->suspend_time = 0;
+   nssid = MIN(ss->ss_nssid, IWM_PROBE_OPTION_MAX);
 
-   req->scan_priority = htole32(IWM_SCAN_PRIORITY_HIGH);
+   general_flags = IWM_UMAC_SCAN_GEN_FLAGS_PASS_ALL |
+   IWM_UMAC_SCAN_GEN_FLAGS_ITER_COMPLETE;
+   if (!iwm_fw_has_api(sc, IWM_UCODE_TLV_API_ADAPTIVE_DWELL))
+   general_flags |= IWM_UMAC_SCAN_GEN_FLAGS_EXTENDED_DWELL;
+   if (iwm_mvm_rrm_scan_needed(sc))
+   general_flags |= IWM_UMAC_SCAN_GEN_FLAGS_RRM_ENABLED;
+   if (nssid != 0)
+   general_flags |= IWM_UMAC_SCAN_GEN_FLAGS_PRE_CONNECT;
+   else
+   general_flags |= IWM_UMAC_SCAN_GEN_FLAGS_PASSIVE;
+
+   channel_flags = 0;
+   if (iwm_mvm_scan_use_ebs(sc))
+   channel_flags = IWM_SCAN_CHANNEL_FLAG_EBS |
+   IWM_SCAN_CHANNEL_FLAG_EBS_ACCURATE |
+   IWM_SCAN_CHANNEL_FLAG_CACHE_ADD;
+
+   req->general_flags = htole16(general_flags);
req->ooc_priority = htole32(IWM_SCAN_PRIORITY_HIGH);
 
-   nssid = MIN(ss->ss_nssid, IWM_PROBE_OPTION_MAX);
-   req->n_channels = iwm_mvm_umac_scan_fill_channels(sc,
-   (struct iwm_scan_channel_cfg_umac *)req->data, nssid);
+   /* These timings correspond to iwlwifi's UNASSOC scan. */
+   if (iwm_fw_has_api(sc, IWM_UCODE_TLV_API_ADAPTIVE_DWELL)) {
+   req->v7.active_dwell = 10;
+   req->v7.passive_dwell = 110;
+   req->v7.fragmented_dwell = 44;
+   req->v7.adwell_default_n_aps_social = 10;
+   req->v7.adwell_default_n_aps = 2;
+   req->v7.adwell_max_budget = htole16(300);
+   req->v7.scan_priority = htole32(IWM_SCAN_PRIORITY_HIGH);
+   req->v7.channel.flags = channel_flags;
+   req->v7.channel.count = iwm_mvm_umac_scan_fill_channels(sc,
+   (struct iwm_scan_channel_cfg_umac *)req->v7.data, nssid);
 
-   req->general_flags = htole32(IWM_UMAC_SCAN_GEN_FLAGS_PASS_ALL |
-   IWM_UMAC_SCAN_GEN_FLAGS_ITER_COMPLETE |
-   IWM_UMAC_SCAN_GEN_FLAGS_EXTENDED_DWELL);
+   tail = (void *)((char *)>v7.data +
+   sizeof(struct iwm_scan_channel_cfg_umac) *
+   

svn commit: r354508 - head/sys/dev/iwm

2019-11-07 Thread Mark Johnston
Author: markj
Date: Thu Nov  7 23:37:02 2019
New Revision: 354508
URL: https://svnweb.freebsd.org/changeset/base/354508

Log:
  iwm: Implement the new receive path.
  
  This is the multiqueue receive code required for 9000-series chips.
  Note that we still only configure a single RX queue for now.  Multiqueue
  support will require MSI-X configuration and a scheme for managing a
  global pool of RX buffers.
  
  MFC after:2 weeks
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/dev/iwm/if_iwm.c
  head/sys/dev/iwm/if_iwm_pcie_trans.c
  head/sys/dev/iwm/if_iwmreg.h
  head/sys/dev/iwm/if_iwmvar.h

Modified: head/sys/dev/iwm/if_iwm.c
==
--- head/sys/dev/iwm/if_iwm.c   Thu Nov  7 23:36:46 2019(r354507)
+++ head/sys/dev/iwm/if_iwm.c   Thu Nov  7 23:37:02 2019(r354508)
@@ -322,16 +322,14 @@ static intiwm_mvm_load_ucode_wait_alive(struct 
iwm_so
 static int iwm_run_init_mvm_ucode(struct iwm_softc *, int);
 static int iwm_mvm_config_ltr(struct iwm_softc *sc);
 static int iwm_rx_addbuf(struct iwm_softc *, int, int);
-static int iwm_mvm_get_signal_strength(struct iwm_softc *,
-   struct iwm_rx_phy_info *);
 static voidiwm_mvm_rx_rx_phy_cmd(struct iwm_softc *,
   struct iwm_rx_packet *);
 static int iwm_get_noise(struct iwm_softc *,
const struct iwm_mvm_statistics_rx_non_phy *);
 static voidiwm_mvm_handle_rx_statistics(struct iwm_softc *,
struct iwm_rx_packet *);
-static boolean_t iwm_mvm_rx_rx_mpdu(struct iwm_softc *, struct mbuf *,
-   uint32_t, boolean_t);
+static booliwm_mvm_rx_mpdu(struct iwm_softc *, struct mbuf *,
+   uint32_t, bool);
 static int iwm_mvm_rx_tx_cmd_single(struct iwm_softc *,
  struct iwm_rx_packet *,
 struct iwm_node *);
@@ -929,19 +927,28 @@ static int
 iwm_alloc_rx_ring(struct iwm_softc *sc, struct iwm_rx_ring *ring)
 {
bus_size_t size;
-   int i, error;
+   size_t descsz;
+   int count, i, error;
 
ring->cur = 0;
+   if (sc->cfg->mqrx_supported) {
+   count = IWM_RX_MQ_RING_COUNT;
+   descsz = sizeof(uint64_t);
+   } else {
+   count = IWM_RX_LEGACY_RING_COUNT;
+   descsz = sizeof(uint32_t);
+   }
 
/* Allocate RX descriptors (256-byte aligned). */
-   size = IWM_RX_RING_COUNT * sizeof(uint32_t);
-   error = iwm_dma_contig_alloc(sc->sc_dmat, >desc_dma, size, 256);
+   size = count * descsz;
+   error = iwm_dma_contig_alloc(sc->sc_dmat, >free_desc_dma, size,
+   256);
if (error != 0) {
device_printf(sc->sc_dev,
"could not allocate RX ring DMA memory\n");
goto fail;
}
-   ring->desc = ring->desc_dma.vaddr;
+   ring->desc = ring->free_desc_dma.vaddr;
 
/* Allocate RX status area (16-byte aligned). */
error = iwm_dma_contig_alloc(sc->sc_dmat, >stat_dma,
@@ -953,6 +960,17 @@ iwm_alloc_rx_ring(struct iwm_softc *sc, struct iwm_rx_
}
ring->stat = ring->stat_dma.vaddr;
 
+   if (sc->cfg->mqrx_supported) {
+   size = count * sizeof(uint32_t);
+   error = iwm_dma_contig_alloc(sc->sc_dmat, >used_desc_dma,
+   size, 256);
+   if (error != 0) {
+   device_printf(sc->sc_dev,
+   "could not allocate RX ring DMA memory\n");
+   goto fail;
+   }
+   }
+
 /* Create RX buffer DMA tag. */
 error = bus_dma_tag_create(sc->sc_dmat, 1, 0,
 BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR, NULL, NULL,
@@ -972,10 +990,11 @@ iwm_alloc_rx_ring(struct iwm_softc *sc, struct iwm_rx_
__func__, error);
goto fail;
}
+
/*
 * Allocate and map RX buffers.
 */
-   for (i = 0; i < IWM_RX_RING_COUNT; i++) {
+   for (i = 0; i < count; i++) {
struct iwm_rx_data *data = >data[i];
error = bus_dmamap_create(ring->data_dmat, 0, >map);
if (error != 0) {
@@ -1013,12 +1032,16 @@ iwm_reset_rx_ring(struct iwm_softc *sc, struct iwm_rx_
 static void
 iwm_free_rx_ring(struct iwm_softc *sc, struct iwm_rx_ring *ring)
 {
-   int i;
+   int count, i;
 
-   iwm_dma_contig_free(>desc_dma);
+   iwm_dma_contig_free(>free_desc_dma);
iwm_dma_contig_free(>stat_dma);
+   iwm_dma_contig_free(>used_desc_dma);
 
-   for (i = 0; i < IWM_RX_RING_COUNT; i++) {
+   count = sc->cfg->mqrx_supported ? IWM_RX_MQ_RING_COUNT :
+   IWM_RX_LEGACY_RING_COUNT;
+
+   for (i = 0; i < count; i++) {
struct iwm_rx_data *data 

svn commit: r354510 - head/sys/dev/iwm

2019-11-07 Thread Mark Johnston
Author: markj
Date: Thu Nov  7 23:37:30 2019
New Revision: 354510
URL: https://svnweb.freebsd.org/changeset/base/354510

Log:
  iwm: Sync with iwm_run_init_mvm_ucode() with iwlwifi.
  
  Do not configure bluetooth on newer chips, it causes firmware panics.
  
  MFC after:2 weeks
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/dev/iwm/if_iwm.c

Modified: head/sys/dev/iwm/if_iwm.c
==
--- head/sys/dev/iwm/if_iwm.c   Thu Nov  7 23:37:17 2019(r354509)
+++ head/sys/dev/iwm/if_iwm.c   Thu Nov  7 23:37:30 2019(r354510)
@@ -3002,6 +3002,15 @@ iwm_run_init_mvm_ucode(struct iwm_softc *sc, int justn
goto error;
}
 
+   if (sc->cfg->device_family < IWM_DEVICE_FAMILY_8000) {
+   ret = iwm_send_bt_init_conf(sc);
+   if (ret) {
+   device_printf(sc->sc_dev,
+   "failed to send bt coex configuration: %d\n", ret);
+   goto error;
+   }
+   }
+
if (justnvm) {
/* Read nvm */
ret = iwm_nvm_init(sc);
@@ -3010,13 +3019,6 @@ iwm_run_init_mvm_ucode(struct iwm_softc *sc, int justn
goto error;
}
IEEE80211_ADDR_COPY(sc->sc_ic.ic_macaddr, 
sc->nvm_data->hw_addr);
-   goto error;
-   }
-
-   ret = iwm_send_bt_init_conf(sc);
-   if (ret) {
-   device_printf(sc->sc_dev,
-   "failed to send bt coex configuration: %d\n", ret);
goto error;
}
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354512 - head/sys/dev/iwm

2019-11-07 Thread Mark Johnston
Author: markj
Date: Thu Nov  7 23:38:17 2019
New Revision: 354512
URL: https://svnweb.freebsd.org/changeset/base/354512

Log:
  iwm: Use antenna B for TX on 9000-series chips.
  
  MFC after:2 weeks
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/dev/iwm/if_iwm.c

Modified: head/sys/dev/iwm/if_iwm.c
==
--- head/sys/dev/iwm/if_iwm.c   Thu Nov  7 23:37:55 2019(r354511)
+++ head/sys/dev/iwm/if_iwm.c   Thu Nov  7 23:38:17 2019(r354512)
@@ -3768,7 +3768,10 @@ iwm_tx_fill_cmd(struct iwm_softc *sc, struct iwm_node 
);
 
/* XXX TODO: hard-coded TX antenna? */
-   rate_flags = 1 << IWM_RATE_MCS_ANT_POS;
+   if (sc->cfg->device_family == IWM_DEVICE_FAMILY_9000)
+   rate_flags = IWM_RATE_MCS_ANT_B_MSK;
+   else
+   rate_flags = IWM_RATE_MCS_ANT_A_MSK;
if (IWM_RIDX_IS_CCK(ridx))
rate_flags |= IWM_RATE_MCS_CCK_MSK;
tx->rate_n_flags = htole32(rate_flags | rinfo->plcp);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354509 - head/sys/dev/iwm

2019-11-07 Thread Mark Johnston
Author: markj
Date: Thu Nov  7 23:37:17 2019
New Revision: 354509
URL: https://svnweb.freebsd.org/changeset/base/354509

Log:
  iwm: Fix scheduler configuration for aux and cmd queue configuration.
  
  - Configure the scheduler only for the management queue.
  - Fix a bug when enabling the schduler: the queues are specified using a
bitmask.
  - Fix style in the area.
  
  MFC after:2 weeks
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/dev/iwm/if_iwm.c

Modified: head/sys/dev/iwm/if_iwm.c
==
--- head/sys/dev/iwm/if_iwm.c   Thu Nov  7 23:37:02 2019(r354508)
+++ head/sys/dev/iwm/if_iwm.c   Thu Nov  7 23:37:17 2019(r354509)
@@ -1583,25 +1583,31 @@ iwm_nic_init(struct iwm_softc *sc)
 int
 iwm_enable_txq(struct iwm_softc *sc, int sta_id, int qid, int fifo)
 {
+   int qmsk;
+
+   qmsk = 1 << qid;
+
if (!iwm_nic_lock(sc)) {
-   device_printf(sc->sc_dev,
-   "%s: cannot enable txq %d\n",
-   __func__,
-   qid);
+   device_printf(sc->sc_dev, "%s: cannot enable txq %d\n",
+   __func__, qid);
return EBUSY;
}
 
IWM_WRITE(sc, IWM_HBUS_TARG_WRPTR, qid << 8 | 0);
 
if (qid == IWM_MVM_CMD_QUEUE) {
-   /* unactivate before configuration */
+   /* Disable the scheduler. */
+   iwm_write_prph(sc, IWM_SCD_EN_CTRL, 0);
+
+   /* Stop the TX queue prior to configuration. */
iwm_write_prph(sc, IWM_SCD_QUEUE_STATUS_BITS(qid),
-   (0 << IWM_SCD_QUEUE_STTS_REG_POS_ACTIVE)
-   | (1 << IWM_SCD_QUEUE_STTS_REG_POS_SCD_ACT_EN));
+   (0 << IWM_SCD_QUEUE_STTS_REG_POS_ACTIVE) |
+   (1 << IWM_SCD_QUEUE_STTS_REG_POS_SCD_ACT_EN));
 
iwm_nic_unlock(sc);
 
-   iwm_clear_bits_prph(sc, IWM_SCD_AGGR_SEL, (1 << qid));
+   /* Disable aggregations for this queue. */
+   iwm_clear_bits_prph(sc, IWM_SCD_AGGR_SEL, qmsk);
 
if (!iwm_nic_lock(sc)) {
device_printf(sc->sc_dev,
@@ -1611,7 +1617,8 @@ iwm_enable_txq(struct iwm_softc *sc, int sta_id, int q
iwm_write_prph(sc, IWM_SCD_QUEUE_RDPTR(qid), 0);
iwm_nic_unlock(sc);
 
-   iwm_write_mem32(sc, sc->scd_base_addr + 
IWM_SCD_CONTEXT_QUEUE_OFFSET(qid), 0);
+   iwm_write_mem32(sc,
+   sc->scd_base_addr + IWM_SCD_CONTEXT_QUEUE_OFFSET(qid), 0);
/* Set scheduler window size and frame limit. */
iwm_write_mem32(sc,
sc->scd_base_addr + IWM_SCD_CONTEXT_QUEUE_OFFSET(qid) +
@@ -1631,6 +1638,9 @@ iwm_enable_txq(struct iwm_softc *sc, int sta_id, int q
(fifo << IWM_SCD_QUEUE_STTS_REG_POS_TXF) |
(1 << IWM_SCD_QUEUE_STTS_REG_POS_WSL) |
IWM_SCD_QUEUE_STTS_REG_MSK);
+
+   /* Enable the scheduler for this queue. */
+   iwm_write_prph(sc, IWM_SCD_EN_CTRL, qmsk);
} else {
struct iwm_scd_txq_cfg_cmd cmd;
int error;
@@ -1656,9 +1666,6 @@ iwm_enable_txq(struct iwm_softc *sc, int sta_id, int q
if (!iwm_nic_lock(sc))
return EBUSY;
}
-
-   iwm_write_prph(sc, IWM_SCD_EN_CTRL,
-   iwm_read_prph(sc, IWM_SCD_EN_CTRL) | qid);
 
iwm_nic_unlock(sc);
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354511 - head/sys/dev/iwm

2019-11-07 Thread Mark Johnston
Author: markj
Date: Thu Nov  7 23:37:55 2019
New Revision: 354511
URL: https://svnweb.freebsd.org/changeset/base/354511

Log:
  iwm: Update the station add command for the new RX API.
  
  The firmware expects a new version of the add-station command in
  9000-series chips.
  
  MFC after:2 weeks
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/dev/iwm/if_iwm_sta.c
  head/sys/dev/iwm/if_iwmreg.h

Modified: head/sys/dev/iwm/if_iwm_sta.c
==
--- head/sys/dev/iwm/if_iwm_sta.c   Thu Nov  7 23:37:30 2019
(r354510)
+++ head/sys/dev/iwm/if_iwm_sta.c   Thu Nov  7 23:37:55 2019
(r354511)
@@ -138,13 +138,8 @@ __FBSDID("$FreeBSD$");
 static inline int
 iwm_mvm_add_sta_cmd_size(struct iwm_softc *sc)
 {
-#ifdef notyet
-   return iwm_mvm_has_new_rx_api(mvm) ?
-   sizeof(struct iwm_mvm_add_sta_cmd) :
-   sizeof(struct iwm_mvm_add_sta_cmd_v7);
-#else
-   return sizeof(struct iwm_mvm_add_sta_cmd);
-#endif
+   return sc->cfg->mqrx_supported ? sizeof(struct iwm_mvm_add_sta_cmd) :
+   sizeof(struct iwm_mvm_add_sta_cmd_v7);
 }
 
 /* send station add/update command to firmware */
@@ -318,7 +313,7 @@ iwm_mvm_rm_sta_id(struct iwm_softc *sc, struct ieee802
 
 static int
 iwm_mvm_add_int_sta_common(struct iwm_softc *sc, struct iwm_int_sta *sta,
-   const uint8_t *addr, uint16_t mac_id, uint16_t color)
+const uint8_t *addr, uint16_t mac_id, uint16_t color)
 {
struct iwm_mvm_add_sta_cmd cmd;
int ret;
@@ -327,6 +322,8 @@ iwm_mvm_add_int_sta_common(struct iwm_softc *sc, struc
memset(, 0, sizeof(cmd));
cmd.sta_id = sta->sta_id;
cmd.mac_id_n_color = htole32(IWM_FW_CMD_ID_AND_COLOR(mac_id, color));
+   if (sta->sta_id == IWM_AUX_STA_ID && sc->cfg->mqrx_supported)
+   cmd.station_type = IWM_STA_AUX_ACTIVITY;
 
cmd.tfd_queue_msk = htole32(sta->tfd_queue_msk);
cmd.tid_disable_tx = htole16(0x);
@@ -362,7 +359,8 @@ iwm_mvm_add_aux_sta(struct iwm_softc *sc)
sc->sc_aux_sta.tfd_queue_msk = (1 << IWM_MVM_AUX_QUEUE);
 
/* Map Aux queue to fifo - needs to happen before adding Aux station */
-   ret = iwm_enable_txq(sc, 0, IWM_MVM_AUX_QUEUE, IWM_MVM_TX_FIFO_MCAST);
+   ret = iwm_enable_txq(sc, IWM_AUX_STA_ID, IWM_MVM_AUX_QUEUE,
+   IWM_MVM_TX_FIFO_MCAST);
if (ret)
return ret;
 

Modified: head/sys/dev/iwm/if_iwmreg.h
==
--- head/sys/dev/iwm/if_iwmreg.hThu Nov  7 23:37:30 2019
(r354510)
+++ head/sys/dev/iwm/if_iwmreg.hThu Nov  7 23:37:55 2019
(r354511)
@@ -5806,30 +5806,34 @@ struct iwm_mvm_keyinfo {
 #define IWM_ADD_STA_BAID_SHIFT 8
 
 /**
- * struct iwm_mvm_add_sta_cmd - Add/modify a station in the fw's sta table.
+ * struct iwl_mvm_add_sta_cmd_v7 - Add/modify a station in the fw's sta table.
  * ( REPLY_ADD_STA = 0x18 )
- * @add_modify: 1: modify existing, 0: add new station
- * @awake_acs:
+ * @add_modify: see  iwl_sta_mode
+ * @awake_acs: ACs to transmit data on while station is sleeping (for U-APSD)
  * @tid_disable_tx: is tid BIT(tid) enabled for Tx. Clear BIT(x) to enable
- * AMPDU for tid x. Set %IWM_STA_MODIFY_TID_DISABLE_TX to change this 
field.
- * @mac_id_n_color: the Mac context this station belongs to
- * @addr[IEEE80211_ADDR_LEN]: station's MAC address
+ * AMPDU for tid x. Set %STA_MODIFY_TID_DISABLE_TX to change this field.
+ * @mac_id_n_color: the Mac context this station belongs to,
+ * see  iwl_ctxt_id_and_color
+ * @addr: station's MAC address
+ * @reserved2: reserved
  * @sta_id: index of station in uCode's station table
- * @modify_mask: IWM_STA_MODIFY_*, selects which parameters to modify vs. leave
+ * @modify_mask: STA_MODIFY_*, selects which parameters to modify vs. leave
  * alone. 1 - modify, 0 - don't change.
- * @station_flags: look at %iwm_sta_flags
- * @station_flags_msk: what of %station_flags have changed
+ * @reserved3: reserved
+ * @station_flags: look at  iwl_sta_flags
+ * @station_flags_msk: what of %station_flags have changed,
+ * also  iwl_sta_flags
  * @add_immediate_ba_tid: tid for which to add block-ack support (Rx)
- * Set %IWM_STA_MODIFY_ADD_BA_TID to use this field, and also set
+ * Set %STA_MODIFY_ADD_BA_TID to use this field, and also set
  * add_immediate_ba_ssn.
  * @remove_immediate_ba_tid: tid for which to remove block-ack support (Rx)
- * Set %IWM_STA_MODIFY_REMOVE_BA_TID to use this field
+ * Set %STA_MODIFY_REMOVE_BA_TID to use this field
  * @add_immediate_ba_ssn: ssn for the Rx block-ack session. Used together with
  * add_immediate_ba_tid.
  * @sleep_tx_count: number of packets to transmit to station even though it is
  * asleep. Used to synchronise PS-poll and u-APSD responses while ucode
  * keeps track of STA sleep state.
- * 

svn commit: r354507 - head/sys/dev/iwm

2019-11-07 Thread Mark Johnston
Author: markj
Date: Thu Nov  7 23:36:46 2019
New Revision: 354507
URL: https://svnweb.freebsd.org/changeset/base/354507

Log:
  iwm: Enable all 31 tx queues.
  
  For now iwm only ever uses queue 0 and the management queue, but my 9560
  raises a software error interrupt during initialization if this flag is
  not set.  iwlwifi sets it for all 7000- and 8000-series hardware, so we
  might as well do it unconditionally.
  
  MFC after:2 weeks
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/dev/iwm/if_iwm.c

Modified: head/sys/dev/iwm/if_iwm.c
==
--- head/sys/dev/iwm/if_iwm.c   Thu Nov  7 23:36:25 2019(r354506)
+++ head/sys/dev/iwm/if_iwm.c   Thu Nov  7 23:36:46 2019(r354507)
@@ -1468,7 +1468,9 @@ iwm_nic_tx_init(struct iwm_softc *sc)
(unsigned long) (txq->desc_dma.paddr >> 8));
}
 
-   iwm_write_prph(sc, IWM_SCD_GP_CTRL, IWM_SCD_GP_CTRL_AUTO_ACTIVE_MODE);
+   iwm_set_bits_prph(sc, IWM_SCD_GP_CTRL,
+   IWM_SCD_GP_CTRL_AUTO_ACTIVE_MODE |
+   IWM_SCD_GP_CTRL_ENABLE_31_QUEUES);
 
iwm_nic_unlock(sc);
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354505 - head/sys/dev/iwm

2019-11-07 Thread Mark Johnston
Author: markj
Date: Thu Nov  7 23:36:10 2019
New Revision: 354505
URL: https://svnweb.freebsd.org/changeset/base/354505

Log:
  iwm: Define the mqrx_supported capability.
  
  The firmware for 9000-series and newer devices has a different receive
  API which supports multiple queues.
  
  MFC after:2 weeks
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/dev/iwm/if_iwm_9000.c
  head/sys/dev/iwm/if_iwm_9260.c
  head/sys/dev/iwm/if_iwm_config.h

Modified: head/sys/dev/iwm/if_iwm_9000.c
==
--- head/sys/dev/iwm/if_iwm_9000.c  Thu Nov  7 23:35:54 2019
(r354504)
+++ head/sys/dev/iwm/if_iwm_9000.c  Thu Nov  7 23:36:10 2019
(r354505)
@@ -92,4 +92,6 @@ const struct iwm_cfg iwm9560_cfg = {
.fw_name = IWM9000_FW,
IWM_DEVICE_9000_COMMON,
.host_interrupt_operation_mode = 0,
+   .mqrx_supported = 1,
+   .integrated = 1,
 };

Modified: head/sys/dev/iwm/if_iwm_9260.c
==
--- head/sys/dev/iwm/if_iwm_9260.c  Thu Nov  7 23:35:54 2019
(r354504)
+++ head/sys/dev/iwm/if_iwm_9260.c  Thu Nov  7 23:36:10 2019
(r354505)
@@ -92,4 +92,5 @@ const struct iwm_cfg iwm9260_cfg = {
.fw_name = IWM9260_FW,
IWM_DEVICE_9260_COMMON,
.host_interrupt_operation_mode = 0,
+   .mqrx_supported = 1,
 };

Modified: head/sys/dev/iwm/if_iwm_config.h
==
--- head/sys/dev/iwm/if_iwm_config.hThu Nov  7 23:35:54 2019
(r354504)
+++ head/sys/dev/iwm/if_iwm_config.hThu Nov  7 23:36:10 2019
(r354505)
@@ -131,13 +131,15 @@ enum iwm_nvm_type {
  */
 struct iwm_cfg {
const char *name;
-const char *fw_name;
-uint16_t eeprom_size;
-enum iwm_device_family device_family;
-int host_interrupt_operation_mode;
-uint8_t nvm_hw_section_num;
-int apmg_wake_up_wa;
-enum iwm_nvm_type nvm_type;
+   const char *fw_name;
+   uint16_t eeprom_size;
+   enum iwm_device_family device_family;
+   int host_interrupt_operation_mode;
+   int mqrx_supported;
+   int integrated;
+   uint8_t nvm_hw_section_num;
+   int apmg_wake_up_wa;
+   enum iwm_nvm_type nvm_type;
 };
 
 /*
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354506 - head/sys/dev/iwm

2019-11-07 Thread Mark Johnston
Author: markj
Date: Thu Nov  7 23:36:25 2019
New Revision: 354506
URL: https://svnweb.freebsd.org/changeset/base/354506

Log:
  iwm: Explicitly enable MSI on newer chipsets.
  
  9000-series chips implement support for MSI-X interrupts and disable MSI
  by default.
  
  MFC after:2 weeks
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/dev/iwm/if_iwm_pcie_trans.c
  head/sys/dev/iwm/if_iwmreg.h

Modified: head/sys/dev/iwm/if_iwm_pcie_trans.c
==
--- head/sys/dev/iwm/if_iwm_pcie_trans.cThu Nov  7 23:36:10 2019
(r354505)
+++ head/sys/dev/iwm/if_iwm_pcie_trans.cThu Nov  7 23:36:25 2019
(r354506)
@@ -616,6 +616,10 @@ iwm_start_hw(struct iwm_softc *sc)
if ((error = iwm_apm_init(sc)) != 0)
return error;
 
+   /* On newer chipsets MSI is disabled by default. */
+   if (sc->cfg->mqrx_supported)
+   iwm_write_prph(sc, IWM_UREG_CHICK, IWM_UREG_CHICK_MSI_ENABLE);
+
iwm_enable_rfkill_int(sc);
iwm_check_rfkill(sc);
 

Modified: head/sys/dev/iwm/if_iwmreg.h
==
--- head/sys/dev/iwm/if_iwmreg.hThu Nov  7 23:36:10 2019
(r354505)
+++ head/sys/dev/iwm/if_iwmreg.hThu Nov  7 23:36:25 2019
(r354506)
@@ -457,6 +457,10 @@ enum iwm_secure_boot_status_reg {
 #define IWM_LMPM_CHICK 0xa01ff8
 #define IWM_LMPM_CHICK_EXTENDED_ADDR_SPACE 0x01
 
+#defineIWM_UREG_CHICK  0xa05c00
+#defineIWM_UREG_CHICK_MSI_ENABLE   0x0100
+#defineIWM_UREG_CHICK_MSIX_ENABLE  0x0200
+
 #define IWM_FH_TCSR_0_REG0 (0x1D00)
 
 /*
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354502 - head/sys/dev/iwm

2019-11-07 Thread Mark Johnston
Author: markj
Date: Thu Nov  7 23:35:15 2019
New Revision: 354502
URL: https://svnweb.freebsd.org/changeset/base/354502

Log:
  iwm: Use the same delays as iwlwifi when resetting the device.
  
  This is required for initialization to succeed for newer device
  families.
  
  MFC after:2 weeks
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/dev/iwm/if_iwm.c
  head/sys/dev/iwm/if_iwm_pcie_trans.c

Modified: head/sys/dev/iwm/if_iwm.c
==
--- head/sys/dev/iwm/if_iwm.c   Thu Nov  7 23:35:01 2019(r354501)
+++ head/sys/dev/iwm/if_iwm.c   Thu Nov  7 23:35:15 2019(r354502)
@@ -1315,12 +1315,14 @@ iwm_stop_device(struct iwm_softc *sc)
/* Stop the device, and put it in low power state */
iwm_apm_stop(sc);
 
-   /* Upon stop, the APM issues an interrupt if HW RF kill is set.
-* Clean again the interrupt here
+   /* stop and reset the on-board processor */
+   IWM_SETBITS(sc, IWM_CSR_RESET, IWM_CSR_RESET_REG_FLAG_SW_RESET);
+   DELAY(5000);
+
+   /*
+* Upon stop, the APM issues an interrupt if HW RF kill is set.
 */
iwm_disable_interrupts(sc);
-   /* stop and reset the on-board processor */
-   IWM_WRITE(sc, IWM_CSR_RESET, IWM_CSR_RESET_REG_FLAG_SW_RESET);
 
/*
 * Even if we stop the HW, we still want the RF kill

Modified: head/sys/dev/iwm/if_iwm_pcie_trans.c
==
--- head/sys/dev/iwm/if_iwm_pcie_trans.cThu Nov  7 23:35:01 2019
(r354501)
+++ head/sys/dev/iwm/if_iwm_pcie_trans.cThu Nov  7 23:35:15 2019
(r354502)
@@ -611,7 +611,7 @@ iwm_start_hw(struct iwm_softc *sc)
 
/* Reset the entire device */
IWM_WRITE(sc, IWM_CSR_RESET, IWM_CSR_RESET_REG_FLAG_SW_RESET);
-   DELAY(10);
+   DELAY(5000);
 
if ((error = iwm_apm_init(sc)) != 0)
return error;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354504 - in head/sys: dev/iwm modules/iwm

2019-11-07 Thread Mark Johnston
Author: markj
Date: Thu Nov  7 23:35:54 2019
New Revision: 354504
URL: https://svnweb.freebsd.org/changeset/base/354504

Log:
  iwm: Add device configuration definitions for 9000-series chips.
  
  Match such chips using the device ID.  We should really be checking the
  subdevice as well, since a smaller number of 9460 and 9560 devices
  actually belong to a new series of devices and require different
  firmware, but that will require some extra logic in iwm_attach().
  
  Submitted by: lwhsu, Guo Wen Jun 
  MFC after:2 weeks

Added:
  head/sys/dev/iwm/if_iwm_9000.c   (contents, props changed)
  head/sys/dev/iwm/if_iwm_9260.c   (contents, props changed)
Modified:
  head/sys/dev/iwm/if_iwm.c
  head/sys/dev/iwm/if_iwm_config.h
  head/sys/modules/iwm/Makefile

Modified: head/sys/dev/iwm/if_iwm.c
==
--- head/sys/dev/iwm/if_iwm.c   Thu Nov  7 23:35:29 2019(r354503)
+++ head/sys/dev/iwm/if_iwm.c   Thu Nov  7 23:35:54 2019(r354504)
@@ -5624,6 +5624,9 @@ iwm_intr(void *arg)
 #definePCI_PRODUCT_INTEL_WL_8260_1 0x24f3
 #definePCI_PRODUCT_INTEL_WL_8260_2 0x24f4
 #definePCI_PRODUCT_INTEL_WL_8265_1 0x24fd
+#definePCI_PRODUCT_INTEL_WL_9560_1 0x9df0
+#definePCI_PRODUCT_INTEL_WL_9560_2 0xa370
+#definePCI_PRODUCT_INTEL_WL_9260_1 0x2526
 
 static const struct iwm_devices {
uint16_tdevice;
@@ -5641,6 +5644,9 @@ static const struct iwm_devices {
{ PCI_PRODUCT_INTEL_WL_8260_1, _cfg },
{ PCI_PRODUCT_INTEL_WL_8260_2, _cfg },
{ PCI_PRODUCT_INTEL_WL_8265_1, _cfg },
+   { PCI_PRODUCT_INTEL_WL_9560_1, _cfg },
+   { PCI_PRODUCT_INTEL_WL_9560_2, _cfg },
+   { PCI_PRODUCT_INTEL_WL_9260_1, _cfg },
 };
 
 static int

Added: head/sys/dev/iwm/if_iwm_9000.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/dev/iwm/if_iwm_9000.c  Thu Nov  7 23:35:54 2019
(r354504)
@@ -0,0 +1,95 @@
+/*-
+ * Based on BSD-licensed source modules in the Linux iwlwifi driver,
+ * which were used as the reference documentation for this implementation.
+ *
+ **
+ *
+ * This file is provided under a dual BSD/GPLv2 license.  When using or
+ * redistributing this file, you may do so under either license.
+ *
+ * GPL LICENSE SUMMARY
+ *
+ * Copyright(c) 2014 Intel Corporation. All rights reserved.
+ * Copyright(c) 2014 - 2015 Intel Mobile Communications GmbH
+ * Copyright(c) 2016 Intel Deutschland GmbH
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of version 2 of the GNU General Public License as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110,
+ * USA
+ *
+ * The full GNU General Public License is included in this distribution
+ * in the file called COPYING.
+ *
+ * Contact Information:
+ *  Intel Linux Wireless 
+ * Intel Corporation, 5200 N.E. Elam Young Parkway, Hillsboro, OR 97124-6497
+ *
+ * BSD LICENSE
+ *
+ * Copyright(c) 2014 Intel Corporation. All rights reserved.
+ * Copyright(c) 2014 - 2015 Intel Mobile Communications GmbH
+ * All rights reserved.
+ *
+ * Redistribution and use in source and binary forms, with or without
+ * modification, are permitted provided that the following conditions
+ * are met:
+ *
+ *  * Redistributions of source code must retain the above copyright
+ *notice, this list of conditions and the following disclaimer.
+ *  * Redistributions in binary form must reproduce the above copyright
+ *notice, this list of conditions and the following disclaimer in
+ *the documentation and/or other materials provided with the
+ *distribution.
+ *  * Neither the name Intel Corporation nor the names of its
+ *contributors may be used to endorse or promote products derived
+ *from this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+ * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+ * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+ * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+ * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+ * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+ * LIMITED TO, PROCUREMENT OF 

svn commit: r354503 - head/sys/dev/iwm

2019-11-07 Thread Mark Johnston
Author: markj
Date: Thu Nov  7 23:35:29 2019
New Revision: 354503
URL: https://svnweb.freebsd.org/changeset/base/354503

Log:
  iwm: Sync the firmware tx_cmd descriptor fields with iwlwifi.
  
  MFC after:2 weeks
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/dev/iwm/if_iwm.c
  head/sys/dev/iwm/if_iwmreg.h

Modified: head/sys/dev/iwm/if_iwm.c
==
--- head/sys/dev/iwm/if_iwm.c   Thu Nov  7 23:35:15 2019(r354502)
+++ head/sys/dev/iwm/if_iwm.c   Thu Nov  7 23:35:29 2019(r354503)
@@ -3656,7 +3656,6 @@ iwm_tx(struct iwm_softc *sc, struct mbuf *m, struct ie
} else
pad = 0;
 
-   tx->driver_txop = 0;
tx->next_frame_len = 0;
 
tx->len = htole16(totlen);

Modified: head/sys/dev/iwm/if_iwmreg.h
==
--- head/sys/dev/iwm/if_iwmreg.hThu Nov  7 23:35:15 2019
(r354502)
+++ head/sys/dev/iwm/if_iwmreg.hThu Nov  7 23:35:29 2019
(r354503)
@@ -4465,8 +4465,7 @@ struct iwm_tx_cmd {
uint8_t initial_rate_index;
uint8_t reserved2;
uint8_t key[16];
-   uint16_t next_frame_flags;
-   uint16_t reserved3;
+   uint32_t reserved3;
uint32_t life_time;
uint32_t dram_lsb_ptr;
uint8_t dram_msb_ptr;
@@ -4474,7 +4473,7 @@ struct iwm_tx_cmd {
uint8_t data_retry_limit;
uint8_t tid_tspec;
uint16_t pm_frame_timeout;
-   uint16_t driver_txop;
+   uint16_t reserved4;
uint8_t payload[0];
struct ieee80211_frame hdr[0];
 } __packed; /* IWM_TX_CMD_API_S_VER_3 */
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354501 - head/sys/dev/iwm

2019-11-07 Thread Mark Johnston
Author: markj
Date: Thu Nov  7 23:35:01 2019
New Revision: 354501
URL: https://svnweb.freebsd.org/changeset/base/354501

Log:
  iwm: Add a device family definition for 9000 chips.
  
  Convert existing device family checks to avoid assuming that the device
  family is always one of IWM_DEVICE_FAMILY_7000 or _8000.
  
  Submitted by: lwhsu, Guo Wen Jun 
  MFC after:2 weeks

Modified:
  head/sys/dev/iwm/if_iwm.c
  head/sys/dev/iwm/if_iwm_config.h
  head/sys/dev/iwm/if_iwm_pcie_trans.c

Modified: head/sys/dev/iwm/if_iwm.c
==
--- head/sys/dev/iwm/if_iwm.c   Thu Nov  7 23:34:41 2019(r354500)
+++ head/sys/dev/iwm/if_iwm.c   Thu Nov  7 23:35:01 2019(r354501)
@@ -1651,7 +1651,7 @@ iwm_trans_pcie_fw_alive(struct iwm_softc *sc, uint32_t
iwm_nic_unlock(sc);
 
/* Enable L1-Active */
-   if (sc->cfg->device_family != IWM_DEVICE_FAMILY_8000) {
+   if (sc->cfg->device_family < IWM_DEVICE_FAMILY_8000) {
iwm_clear_bits_prph(sc, IWM_APMG_PCIDEV_STT_REG,
IWM_APMG_PCIDEV_STT_VAL_L1_ACT_DIS);
}
@@ -2069,7 +2069,7 @@ static int
 iwm_get_sku(const struct iwm_softc *sc, const uint16_t *nvm_sw,
const uint16_t *phy_sku)
 {
-   if (sc->cfg->device_family != IWM_DEVICE_FAMILY_8000)
+   if (sc->cfg->device_family < IWM_DEVICE_FAMILY_8000)
return le16_to_cpup(nvm_sw + IWM_SKU);
 
return le32_to_cpup((const uint32_t *)(phy_sku + IWM_SKU_8000));
@@ -2078,7 +2078,7 @@ iwm_get_sku(const struct iwm_softc *sc, const uint16_t
 static int
 iwm_get_nvm_version(const struct iwm_softc *sc, const uint16_t *nvm_sw)
 {
-   if (sc->cfg->device_family != IWM_DEVICE_FAMILY_8000)
+   if (sc->cfg->device_family < IWM_DEVICE_FAMILY_8000)
return le16_to_cpup(nvm_sw + IWM_NVM_VERSION);
else
return le32_to_cpup((const uint32_t *)(nvm_sw +
@@ -2089,7 +2089,7 @@ static int
 iwm_get_radio_cfg(const struct iwm_softc *sc, const uint16_t *nvm_sw,
  const uint16_t *phy_sku)
 {
-if (sc->cfg->device_family != IWM_DEVICE_FAMILY_8000)
+if (sc->cfg->device_family < IWM_DEVICE_FAMILY_8000)
 return le16_to_cpup(nvm_sw + IWM_RADIO_CFG);
 
 return le32_to_cpup((const uint32_t *)(phy_sku + IWM_RADIO_CFG_8000));
@@ -2100,7 +2100,7 @@ iwm_get_n_hw_addrs(const struct iwm_softc *sc, const u
 {
int n_hw_addr;
 
-   if (sc->cfg->device_family != IWM_DEVICE_FAMILY_8000)
+   if (sc->cfg->device_family < IWM_DEVICE_FAMILY_8000)
return le16_to_cpup(nvm_sw + IWM_N_HW_ADDRS);
 
n_hw_addr = le32_to_cpup((const uint32_t *)(nvm_sw + 
IWM_N_HW_ADDRS_8000));
@@ -2112,7 +2112,7 @@ static void
 iwm_set_radio_cfg(const struct iwm_softc *sc, struct iwm_nvm_data *data,
  uint32_t radio_cfg)
 {
-   if (sc->cfg->device_family != IWM_DEVICE_FAMILY_8000) {
+   if (sc->cfg->device_family < IWM_DEVICE_FAMILY_8000) {
data->radio_cfg_type = IWM_NVM_RF_CFG_TYPE_MSK(radio_cfg);
data->radio_cfg_step = IWM_NVM_RF_CFG_STEP_MSK(radio_cfg);
data->radio_cfg_dash = IWM_NVM_RF_CFG_DASH_MSK(radio_cfg);
@@ -2138,7 +2138,7 @@ iwm_set_hw_address(struct iwm_softc *sc, struct iwm_nv
iwm_set_hw_address_from_csr(sc, data);
 } else
 #endif
-   if (sc->cfg->device_family != IWM_DEVICE_FAMILY_8000) {
+   if (sc->cfg->device_family < IWM_DEVICE_FAMILY_8000) {
const uint8_t *hw_addr = (const uint8_t *)(nvm_hw + 
IWM_HW_ADDR);
 
/* The byte order is little endian 16 bit, meaning 214365 */
@@ -2170,7 +2170,7 @@ iwm_parse_nvm_data(struct iwm_softc *sc,
uint32_t sku, radio_cfg;
uint16_t lar_config;
 
-   if (sc->cfg->device_family != IWM_DEVICE_FAMILY_8000) {
+   if (sc->cfg->device_family < IWM_DEVICE_FAMILY_8000) {
data = malloc(sizeof(*data) +
IWM_NUM_CHANNELS * sizeof(uint16_t),
M_DEVBUF, M_NOWAIT | M_ZERO);
@@ -2194,7 +2194,8 @@ iwm_parse_nvm_data(struct iwm_softc *sc,
 
data->n_hw_addrs = iwm_get_n_hw_addrs(sc, nvm_sw);
 
-   if (sc->cfg->device_family == IWM_DEVICE_FAMILY_8000) {
+   if (sc->cfg->device_family >= IWM_DEVICE_FAMILY_8000) {
+   /* TODO: use IWL_NVM_EXT */
uint16_t lar_offset = data->nvm_version < 0xE39 ?
   IWM_NVM_LAR_OFFSET_8000_OLD :
   IWM_NVM_LAR_OFFSET_8000;
@@ -2242,7 +2243,7 @@ iwm_parse_nvm_sections(struct iwm_softc *sc, struct iw
"Can't parse empty OTP/NVM sections\n");
return NULL;
}
-   } else if (sc->cfg->device_family == IWM_DEVICE_FAMILY_8000) {
+   } else if (sc->cfg->device_family >= IWM_DEVICE_FAMILY_8000) {
/* SW and REGULATORY 

svn commit: r354499 - head/sys/dev/iwm

2019-11-07 Thread Mark Johnston
Author: markj
Date: Thu Nov  7 23:34:28 2019
New Revision: 354499
URL: https://svnweb.freebsd.org/changeset/base/354499

Log:
  iwm: Add a few _prph functions needed for 9000-series chips.
  
  MFC after:2 weeks
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/dev/iwm/if_iwm_pcie_trans.c
  head/sys/dev/iwm/if_iwm_pcie_trans.h

Modified: head/sys/dev/iwm/if_iwm_pcie_trans.c
==
--- head/sys/dev/iwm/if_iwm_pcie_trans.cThu Nov  7 23:34:12 2019
(r354498)
+++ head/sys/dev/iwm/if_iwm_pcie_trans.cThu Nov  7 23:34:28 2019
(r354499)
@@ -185,6 +185,27 @@ iwm_write_prph(struct iwm_softc *sc, uint32_t addr, ui
IWM_WRITE(sc, IWM_HBUS_TARG_PRPH_WDAT, val);
 }
 
+void
+iwm_write_prph64(struct iwm_softc *sc, uint64_t addr, uint64_t val)
+{
+   iwm_write_prph(sc, (uint32_t)addr, val & 0x);
+   iwm_write_prph(sc, (uint32_t)addr + 4, val >> 32);
+}
+
+int
+iwm_poll_prph(struct iwm_softc *sc, uint32_t addr, uint32_t bits, uint32_t 
mask,
+int timeout)
+{
+   do {
+   if ((iwm_read_prph(sc, addr) & mask) == (bits & mask))
+   return (0);
+   DELAY(10);
+   timeout -= 10;
+   } while (timeout > 0);
+
+   return (ETIMEDOUT);
+}
+
 #ifdef IWM_DEBUG
 /* iwlwifi: pcie/trans.c */
 int

Modified: head/sys/dev/iwm/if_iwm_pcie_trans.h
==
--- head/sys/dev/iwm/if_iwm_pcie_trans.hThu Nov  7 23:34:12 2019
(r354498)
+++ head/sys/dev/iwm/if_iwm_pcie_trans.hThu Nov  7 23:34:28 2019
(r354499)
@@ -106,6 +106,10 @@
 
 extern uint32_t iwm_read_prph(struct iwm_softc *sc, uint32_t addr);
 extern void iwm_write_prph(struct iwm_softc *sc, uint32_t addr, uint32_t val);
+extern void iwm_write_prph64(struct iwm_softc *sc, uint64_t addr,
+uint64_t val);
+extern int iwm_poll_prph(struct iwm_softc *sc, uint32_t addr, uint32_t bits,
+uint32_t mask, int timeout);
 extern int iwm_read_mem(struct iwm_softc *sc, uint32_t addr, void *buf, int 
dwords);
 extern int iwm_write_mem(struct iwm_softc *sc, uint32_t addr, const void *buf,
int dwords);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354500 - head/sys/dev/iwm

2019-11-07 Thread Mark Johnston
Author: markj
Date: Thu Nov  7 23:34:41 2019
New Revision: 354500
URL: https://svnweb.freebsd.org/changeset/base/354500

Log:
  iwm: Add 9000-series RX register definitions.
  
  MFC after:2 weeks
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/dev/iwm/if_iwmreg.h

Modified: head/sys/dev/iwm/if_iwmreg.h
==
--- head/sys/dev/iwm/if_iwmreg.hThu Nov  7 23:34:28 2019
(r354499)
+++ head/sys/dev/iwm/if_iwmreg.hThu Nov  7 23:34:41 2019
(r354500)
@@ -1527,6 +1527,52 @@ static inline unsigned int IWM_FH_MEM_CBBC_QUEUE(unsig
 
 #define IWM_FH_MEM_TFDIB_REG1_ADDR_BITSHIFT28
 
+/* 9000 rx series registers */
+
+#define IWM_RFH_Q0_FRBDCB_BA_LSB   0xa08000
+#define IWM_RFH_Q_FRBDCB_BA_LSB(IWM_RFH_Q0_FRBDCB_BA_LSB + (q) 
* 8)
+/* Write index table */
+#define IWM_RFH_Q0_FRBDCB_WIDX 0xa08080
+#define IWM_RFH_Q_FRBDCB_WIDX  (IWM_RFH_Q0_FRBDCB_WIDX + (q) * 4)
+/* Write index table - shadow registers */
+#define IWM_RFH_Q0_FRBDCB_WIDX_TRG 0x1c80
+#define IWM_RFH_Q_FRBDCB_WIDX_TRG  (IWM_RFH_Q0_FRBDCB_WIDX_TRG + (q) * 4)
+/* Read index table */
+#define IWM_RFH_Q0_FRBDCB_RIDX 0xa080c0
+#define IWM_RFH_Q_FRBDCB_RIDX  (IWM_RFH_Q0_FRBDCB_RIDX + (q) * 4)
+/* Used list table */
+#define IWM_RFH_Q0_URBDCB_BA_LSB   0xa08100
+#define IWM_RFH_Q_URBDCB_BA_LSB(IWM_RFH_Q0_URBDCB_BA_LSB + (q) 
* 8)
+/* Write index table */
+#define IWM_RFH_Q0_URBDCB_WIDX 0xa08180
+#define IWM_RFH_Q_URBDCB_WIDX  (IWM_RFH_Q0_URBDCB_WIDX + (q) * 4)
+/* stts */
+#define IWM_RFH_Q0_URBD_STTS_WPTR_LSB  0xa08200
+#define IWM_RFH_Q_URBD_STTS_WPTR_LSB (IWM_RFH_Q0_URBD_STTS_WPTR_LSB + (q) * 8)
+
+#define IWM_RFH_GEN_STATUS 0xa09808
+#define IWM_RXF_DMA_IDLE   0x8000
+
+/* DMA configuration */
+#define IWM_RFH_RXF_DMA_CFG0xa09820
+#define IWM_RFH_RXF_DMA_RB_SIZE_1K 0x0001
+#define IWM_RFH_RXF_DMA_RB_SIZE_2K 0x0002
+#define IWM_RFH_RXF_DMA_RB_SIZE_4K 0x0004
+#define IWM_RFH_RXF_DMA_RBDCB_SIZE_512 0x0090
+#define IWM_RFH_RXF_DMA_MIN_RB_4_8 0x0300
+#define IWM_RFH_RXF_DMA_DROP_TOO_LARGE_MASK 0x0400
+#define IWM_RFH_DMA_EN_ENABLE_VAL  0x8000
+
+#define IWM_RFH_GEN_CFG0xa09800
+#define IWM_RFH_GEN_CFG_SERVICE_DMA_SNOOP 0x0001
+#define IWM_RFH_GEN_CFG_RFH_DMA_SNOOP  0x0002
+#define IWM_RFH_GEN_CFG_RB_CHUNK_SIZE_128 0x0010
+#define IWM_RFH_GEN_CFG_RB_CHUNK_SIZE_64 0x
+
+#define IWM_RFH_RXF_RXQ_ACTIVE 0xa0980c
+
+/* end of 9000 rx series registers */
+
 /* TFDB  Area - TFDs buffer table */
 #define IWM_FH_MEM_TFDIB_DRAM_ADDR_LSB_MSK  (0x)
 #define IWM_FH_TFDIB_LOWER_BOUND   (IWM_FH_MEM_LOWER_BOUND + 0x900)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354498 - head/sys/dev/iwm

2019-11-07 Thread Mark Johnston
Author: markj
Date: Thu Nov  7 23:34:12 2019
New Revision: 354498
URL: https://svnweb.freebsd.org/changeset/base/354498

Log:
  iwm: Sync the TLV API enum with iwlwifi.
  
  MFC after:2 weeks
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/dev/iwm/if_iwmreg.h

Modified: head/sys/dev/iwm/if_iwmreg.h
==
--- head/sys/dev/iwm/if_iwmreg.hThu Nov  7 23:33:58 2019
(r354497)
+++ head/sys/dev/iwm/if_iwmreg.hThu Nov  7 23:34:12 2019
(r354498)
@@ -635,6 +635,40 @@ P2P_PS_SCM\31UAPSD_SUPPORT\32EBS\33P2P_PS_UAPSD\36BCAS
  * longer than the passive one, which is essential for fragmented scan.
  * @IWM_UCODE_TLV_API_WIFI_MCC_UPDATE: ucode supports MCC updates with source.
  * @IWM_UCODE_TLV_API_LQ_SS_PARAMS: Configure STBC/BFER via LQ CMD ss_params
+ * @IWM_UCODE_TLV_API_NEW_VERSION: new versioning format
+ * @IWM_UCODE_TLV_API_SCAN_TSF_REPORT: Scan start time reported in scan
+ * iteration complete notification, and the timestamp reported for RX
+ * received during scan, are reported in TSF of the mac specified in the
+ * scan request.
+ * @IWM_UCODE_TLV_API_TKIP_MIC_KEYS: This ucode supports version 2 of
+ * ADD_MODIFY_STA_KEY_API_S_VER_2.
+ * @IWM_UCODE_TLV_API_STA_TYPE: This ucode supports station type assignement.
+ * @IWM_UCODE_TLV_API_NAN2_VER2: This ucode supports NAN API version 2
+ * @IWM_UCODE_TLV_API_NEW_RX_STATS: should new RX STATISTICS API be used
+ * @IWM_UCODE_TLV_API_QUOTA_LOW_LATENCY: Quota command includes a field
+ * indicating low latency direction.
+ * @IWM_UCODE_TLV_API_DEPRECATE_TTAK: RX status flag TTAK ok (bit 7) is
+ * deprecated.
+ * @IWM_UCODE_TLV_API_ADAPTIVE_DWELL_V2: This ucode supports version 8
+ * of scan request: SCAN_REQUEST_CMD_UMAC_API_S_VER_8
+ * @IWM_UCODE_TLV_API_FRAG_EBS: This ucode supports fragmented EBS
+ * @IWM_UCODE_TLV_API_REDUCE_TX_POWER: This ucode supports v5 of
+ * the REDUCE_TX_POWER_CMD.
+ * @IWM_UCODE_TLV_API_SHORT_BEACON_NOTIF: This ucode supports the short
+ * version of the beacon notification.
+ * @IWM_UCODE_TLV_API_BEACON_FILTER_V4: This ucode supports v4 of
+ * BEACON_FILTER_CONFIG_API_S_VER_4.
+ * @IWM_UCODE_TLV_API_REGULATORY_NVM_INFO: This ucode supports v4 of
+ * REGULATORY_NVM_GET_INFO_RSP_API_S.
+ * @IWM_UCODE_TLV_API_FTM_NEW_RANGE_REQ: This ucode supports v7 of
+ * LOCATION_RANGE_REQ_CMD_API_S and v6 of LOCATION_RANGE_RESP_NTFY_API_S.
+ * @IWM_UCODE_TLV_API_SCAN_OFFLOAD_CHANS: This ucode supports v2 of
+ * SCAN_OFFLOAD_PROFILE_MATCH_RESULTS_S and v3 of
+ * SCAN_OFFLOAD_PROFILES_QUERY_RSP_S.
+ * @IWM_UCODE_TLV_API_MBSSID_HE: This ucode supports v2 of
+ * STA_CONTEXT_DOT11AX_API_S
+ * @IWM_UCODE_TLV_CAPA_SAR_TABLE_VER: This ucode supports different sar
+ * version tables.
  *
  * @IWM_NUM_UCODE_TLV_API: number of bits used
  */
@@ -642,12 +676,35 @@ enum iwm_ucode_tlv_api {
IWM_UCODE_TLV_API_FRAGMENTED_SCAN   = 8,
IWM_UCODE_TLV_API_WIFI_MCC_UPDATE   = 9,
IWM_UCODE_TLV_API_LQ_SS_PARAMS  = 18,
+   IWM_UCODE_TLV_API_NEW_VERSION   = 20,
+   IWM_UCODE_TLV_API_SCAN_TSF_REPORT   = 28,
+   IWM_UCODE_TLV_API_TKIP_MIC_KEYS = 29,
+   IWM_UCODE_TLV_API_STA_TYPE  = 30,
+   IWM_UCODE_TLV_API_NAN2_VER2 = 31,
+   IWM_UCODE_TLV_API_ADAPTIVE_DWELL= 32,
+   IWM_UCODE_TLV_API_OCE   = 33,
+   IWM_UCODE_TLV_API_NEW_BEACON_TEMPLATE   = 34,
+   IWM_UCODE_TLV_API_NEW_RX_STATS  = 35,
+   IWM_UCODE_TLV_API_WOWLAN_KEY_MATERIAL   = 36,
+   IWM_UCODE_TLV_API_QUOTA_LOW_LATENCY = 38,
+   IWM_UCODE_TLV_API_DEPRECATE_TTAK= 41,
+   IWM_UCODE_TLV_API_ADAPTIVE_DWELL_V2 = 42,
+   IWM_UCODE_TLV_API_FRAG_EBS  = 44,
+   IWM_UCODE_TLV_API_REDUCE_TX_POWER   = 45,
+   IWM_UCODE_TLV_API_SHORT_BEACON_NOTIF= 46,
+   IWM_UCODE_TLV_API_BEACON_FILTER_V4  = 47,
+   IWM_UCODE_TLV_API_REGULATORY_NVM_INFO   = 48,
+   IWM_UCODE_TLV_API_FTM_NEW_RANGE_REQ = 49,
+   IWM_UCODE_TLV_API_SCAN_OFFLOAD_CHANS= 50,
+   IWM_UCODE_TLV_API_MBSSID_HE = 52,
+   IWM_UCODE_TLV_API_WOWLAN_TCP_SYN_WAKE   = 53,
+   IWM_UCODE_TLV_API_FTM_RTT_ACCURACY  = 54,
+   IWM_UCODE_TLV_API_SAR_TABLE_VER = 55,
+   IWM_UCODE_TLV_API_ADWELL_HB_DEF_N_AP= 57,
+   IWM_UCODE_TLV_API_SCAN_EXT_CHAN_VER = 58,
 
-   IWM_NUM_UCODE_TLV_API = 32
+   IWM_NUM_UCODE_TLV_API   = 128,
 };
-
-#define IWM_UCODE_TLV_API_BITS \
-   
"\020\10FRAGMENTED_SCAN\11WIFI_MCC_UPDATE\16WIDE_CMD_HDR\22LQ_SS_PARAMS\30EXT_SCAN_PRIO\33TX_POWER_CHAIN"
 
 /**
  * enum iwm_ucode_tlv_capa - ucode capabilities
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send 

svn commit: r354497 - head/sys/dev/iwm

2019-11-07 Thread Mark Johnston
Author: markj
Date: Thu Nov  7 23:33:58 2019
New Revision: 354497
URL: https://svnweb.freebsd.org/changeset/base/354497

Log:
  iwm: Define a name for TLV 48.
  
  MFC after:2 weeks
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/dev/iwm/if_iwm.c
  head/sys/dev/iwm/if_iwmreg.h

Modified: head/sys/dev/iwm/if_iwm.c
==
--- head/sys/dev/iwm/if_iwm.c   Thu Nov  7 23:29:57 2019(r354496)
+++ head/sys/dev/iwm/if_iwm.c   Thu Nov  7 23:33:58 2019(r354497)
@@ -793,7 +793,7 @@ iwm_read_firmware(struct iwm_softc *sc)
break;
}
 
-   case 48: /* undocumented TLV */
+   case IWM_UCODE_TLV_CMD_VERSIONS:
case IWM_UCODE_TLV_SDIO_ADMA_ADDR:
case IWM_UCODE_TLV_FW_GSCAN_CAPA:
/* ignore, not used by current driver */

Modified: head/sys/dev/iwm/if_iwmreg.h
==
--- head/sys/dev/iwm/if_iwmreg.hThu Nov  7 23:29:57 2019
(r354496)
+++ head/sys/dev/iwm/if_iwmreg.hThu Nov  7 23:33:58 2019
(r354497)
@@ -933,6 +933,7 @@ enum iwm_ucode_tlv_type {
IWM_UCODE_TLV_FW_DBG_DEST   = 38,
IWM_UCODE_TLV_FW_DBG_CONF   = 39,
IWM_UCODE_TLV_FW_DBG_TRIGGER= 40,
+   IWM_UCODE_TLV_CMD_VERSIONS  = 48,
IWM_UCODE_TLV_FW_GSCAN_CAPA = 50,
IWM_UCODE_TLV_FW_MEM_SEG= 51,
 };
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354496 - head/sys/dev/iwm

2019-11-07 Thread Mark Johnston
Author: markj
Date: Thu Nov  7 23:29:57 2019
New Revision: 354496
URL: https://svnweb.freebsd.org/changeset/base/354496

Log:
  iwm: Avoid calling iwm_start() each time a descriptor is reclaimed.
  
  Only perform the call when a qfull bit transitions.  While here, avoid
  assignments in declarations in iwm_mvm_rx_tx_cmd().
  
  MFC after:2 weeks
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/dev/iwm/if_iwm.c

Modified: head/sys/dev/iwm/if_iwm.c
==
--- head/sys/dev/iwm/if_iwm.c   Thu Nov  7 23:29:43 2019(r354495)
+++ head/sys/dev/iwm/if_iwm.c   Thu Nov  7 23:29:57 2019(r354496)
@@ -3337,15 +3337,22 @@ iwm_mvm_rx_tx_cmd_single(struct iwm_softc *sc, struct 
 static void
 iwm_mvm_rx_tx_cmd(struct iwm_softc *sc, struct iwm_rx_packet *pkt)
 {
-   struct iwm_cmd_header *cmd_hdr = >hdr;
-   int idx = cmd_hdr->idx;
-   int qid = cmd_hdr->qid;
-   struct iwm_tx_ring *ring = >txq[qid];
-   struct iwm_tx_data *txd = >data[idx];
-   struct iwm_node *in = txd->in;
-   struct mbuf *m = txd->m;
-   int status;
+   struct iwm_cmd_header *cmd_hdr;
+   struct iwm_tx_ring *ring;
+   struct iwm_tx_data *txd;
+   struct iwm_node *in;
+   struct mbuf *m;
+   int idx, qid, qmsk, status;
 
+   cmd_hdr = >hdr;
+   idx = cmd_hdr->idx;
+   qid = cmd_hdr->qid;
+
+   ring = >txq[qid];
+   txd = >data[idx];
+   in = txd->in;
+   m = txd->m;
+
KASSERT(txd->done == 0, ("txd not done"));
KASSERT(txd->in != NULL, ("txd without node"));
KASSERT(txd->m != NULL, ("txd without mbuf"));
@@ -3366,11 +3373,11 @@ iwm_mvm_rx_tx_cmd(struct iwm_softc *sc, struct iwm_rx_
 
ieee80211_tx_complete(>in_ni, m, status);
 
-   if (--ring->queued < IWM_TX_RING_LOMARK) {
-   sc->qfullmsk &= ~(1 << ring->qid);
-   if (sc->qfullmsk == 0) {
+   qmsk = 1 << qid;
+   if (--ring->queued < IWM_TX_RING_LOMARK && (sc->qfullmsk & qmsk) != 0) {
+   sc->qfullmsk &= ~qmsk;
+   if (sc->qfullmsk == 0)
iwm_start(sc);
-   }
}
 }
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354495 - head/sys/dev/iwm

2019-11-07 Thread Mark Johnston
Author: markj
Date: Thu Nov  7 23:29:43 2019
New Revision: 354495
URL: https://svnweb.freebsd.org/changeset/base/354495

Log:
  iwm: Call iwm_dev_check() earlier in iwm_attach().
  
  This ensures that the driver softc reflects device capabilities as early
  as possible, for use by device initialization code that is conditional
  on certain capabilities.
  
  MFC after:2 weeks
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/dev/iwm/if_iwm.c

Modified: head/sys/dev/iwm/if_iwm.c
==
--- head/sys/dev/iwm/if_iwm.c   Thu Nov  7 23:29:25 2019(r354494)
+++ head/sys/dev/iwm/if_iwm.c   Thu Nov  7 23:29:43 2019(r354495)
@@ -5743,8 +5743,6 @@ iwm_pci_detach(device_t dev)
rman_get_rid(sc->sc_mem), sc->sc_mem);
 }
 
-
-
 static int
 iwm_attach(device_t dev)
 {
@@ -5761,6 +5759,10 @@ iwm_attach(device_t dev)
callout_init_mtx(>sc_led_blink_to, >sc_mtx, 0);
TASK_INIT(>sc_es_task, 0, iwm_endscan_cb, sc);
 
+   error = iwm_dev_check(dev);
+   if (error != 0)
+   goto fail;
+
sc->sc_notif_wait = iwm_notification_wait_init(sc);
if (sc->sc_notif_wait == NULL) {
device_printf(dev, "failed to init notification wait struct\n");
@@ -5785,11 +5787,6 @@ iwm_attach(device_t dev)
goto fail;
 
sc->sc_wantresp = -1;
-
-   /* Match device id */
-   error = iwm_dev_check(dev);
-   if (error != 0)
-   goto fail;
 
sc->sc_hw_rev = IWM_READ(sc, IWM_CSR_HW_REV);
/*
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354493 - head/sys/dev/iwm

2019-11-07 Thread Mark Johnston
Author: markj
Date: Thu Nov  7 23:29:00 2019
New Revision: 354493
URL: https://svnweb.freebsd.org/changeset/base/354493

Log:
  iwm: Remove a couple of unused fields from the softc.
  
  MFC after:2 weeks
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/dev/iwm/if_iwmvar.h

Modified: head/sys/dev/iwm/if_iwmvar.h
==
--- head/sys/dev/iwm/if_iwmvar.hThu Nov  7 23:27:54 2019
(r354492)
+++ head/sys/dev/iwm/if_iwmvar.hThu Nov  7 23:29:00 2019
(r354493)
@@ -459,8 +459,6 @@ struct iwm_softc {
struct iwm_rx_ring  rxq;
int qfullmsk;
 
-   int sc_sf_state;
-
/* ICT table. */
struct iwm_dma_info ict_dma;
int ict_cur;
@@ -525,8 +523,6 @@ struct iwm_softc {
 
struct iwm_notif_statistics_v10 sc_stats;
int sc_noise;
-
-   caddr_t sc_drvbpf;
 
struct iwm_rx_radiotap_header sc_rxtap;
struct iwm_tx_radiotap_header sc_txtap;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354494 - head/sys/dev/iwm

2019-11-07 Thread Mark Johnston
Author: markj
Date: Thu Nov  7 23:29:25 2019
New Revision: 354494
URL: https://svnweb.freebsd.org/changeset/base/354494

Log:
  iwm: Simplify fw_has_{api,capa}().
  
  No functional change intended.
  
  MFC after:2 weeks
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/dev/iwm/if_iwm.c
  head/sys/dev/iwm/if_iwm_scan.c
  head/sys/dev/iwm/if_iwmvar.h

Modified: head/sys/dev/iwm/if_iwm.c
==
--- head/sys/dev/iwm/if_iwm.c   Thu Nov  7 23:29:00 2019(r354493)
+++ head/sys/dev/iwm/if_iwm.c   Thu Nov  7 23:29:25 2019(r354494)
@@ -4442,8 +4442,7 @@ static boolean_t
 iwm_mvm_is_lar_supported(struct iwm_softc *sc)
 {
boolean_t nvm_lar = sc->nvm_data->lar_enabled;
-   boolean_t tlv_lar = fw_has_capa(>sc_fw.ucode_capa,
-   IWM_UCODE_TLV_CAPA_LAR_SUPPORT);
+   boolean_t tlv_lar = iwm_fw_has_capa(sc, IWM_UCODE_TLV_CAPA_LAR_SUPPORT);
 
if (iwm_lar_disable)
return FALSE;
@@ -4461,10 +4460,8 @@ iwm_mvm_is_lar_supported(struct iwm_softc *sc)
 static boolean_t
 iwm_mvm_is_wifi_mcc_supported(struct iwm_softc *sc)
 {
-   return fw_has_api(>sc_fw.ucode_capa,
- IWM_UCODE_TLV_API_WIFI_MCC_UPDATE) ||
-  fw_has_capa(>sc_fw.ucode_capa,
-  IWM_UCODE_TLV_CAPA_LAR_MULTI_MCC);
+   return iwm_fw_has_api(sc, IWM_UCODE_TLV_API_WIFI_MCC_UPDATE) ||
+   iwm_fw_has_capa(sc, IWM_UCODE_TLV_CAPA_LAR_MULTI_MCC);
 }
 
 static int
@@ -4484,8 +4481,7 @@ iwm_send_update_mcc_cmd(struct iwm_softc *sc, const ch
int n_channels;
uint16_t mcc;
 #endif
-   int resp_v2 = fw_has_capa(>sc_fw.ucode_capa,
-   IWM_UCODE_TLV_CAPA_LAR_SUPPORT_V2);
+   int resp_v2 = iwm_fw_has_capa(sc, IWM_UCODE_TLV_CAPA_LAR_SUPPORT_V2);
 
if (!iwm_mvm_is_lar_supported(sc)) {
IWM_DPRINTF(sc, IWM_DEBUG_LAR, "%s: no LAR support\n",
@@ -4646,7 +4642,7 @@ iwm_init_hw(struct iwm_softc *sc)
if ((error = iwm_send_update_mcc_cmd(sc, "ZZ")) != 0)
goto error;
 
-   if (fw_has_capa(>sc_fw.ucode_capa, IWM_UCODE_TLV_CAPA_UMAC_SCAN)) {
+   if (iwm_fw_has_capa(sc, IWM_UCODE_TLV_CAPA_UMAC_SCAN)) {
if ((error = iwm_mvm_config_umac_scan(sc)) != 0)
goto error;
}
@@ -6183,7 +6179,7 @@ iwm_scan_start(struct ieee80211com *ic)
device_printf(sc->sc_dev,
"%s: Previous scan not completed yet\n", __func__);
}
-   if (fw_has_capa(>sc_fw.ucode_capa, IWM_UCODE_TLV_CAPA_UMAC_SCAN))
+   if (iwm_fw_has_capa(sc, IWM_UCODE_TLV_CAPA_UMAC_SCAN))
error = iwm_mvm_umac_scan(sc);
else
error = iwm_mvm_lmac_scan(sc);

Modified: head/sys/dev/iwm/if_iwm_scan.c
==
--- head/sys/dev/iwm/if_iwm_scan.c  Thu Nov  7 23:29:00 2019
(r354493)
+++ head/sys/dev/iwm/if_iwm_scan.c  Thu Nov  7 23:29:25 2019
(r354494)
@@ -215,8 +215,7 @@ static inline boolean_t
 iwm_mvm_rrm_scan_needed(struct iwm_softc *sc)
 {
/* require rrm scan whenever the fw supports it */
-   return fw_has_capa(>sc_fw.ucode_capa,
-  IWM_UCODE_TLV_CAPA_DS_PARAM_SET_IE_SUPPORT);
+   return iwm_fw_has_capa(sc, IWM_UCODE_TLV_CAPA_DS_PARAM_SET_IE_SUPPORT);
 }
 
 #ifdef IWM_DEBUG
@@ -251,7 +250,7 @@ iwm_mvm_rx_lmac_scan_complete_notif(struct iwm_softc *
/* If this happens, the firmware has mistakenly sent an LMAC
 * notification during UMAC scans -- warn and ignore it.
 */
-   if (fw_has_capa(>sc_fw.ucode_capa, IWM_UCODE_TLV_CAPA_UMAC_SCAN)) {
+   if (iwm_fw_has_capa(sc, IWM_UCODE_TLV_CAPA_UMAC_SCAN)) {
device_printf(sc->sc_dev,
"%s: Mistakenly got LMAC notification during UMAC scan\n",
__func__);
@@ -866,7 +865,7 @@ iwm_mvm_scan_stop_wait(struct iwm_softc *sc)
 
IWM_DPRINTF(sc, IWM_DEBUG_SCAN, "Preparing to stop scan\n");
 
-   if (fw_has_capa(>sc_fw.ucode_capa, IWM_UCODE_TLV_CAPA_UMAC_SCAN))
+   if (iwm_fw_has_capa(sc, IWM_UCODE_TLV_CAPA_UMAC_SCAN))
ret = iwm_mvm_umac_scan_abort(sc);
else
ret = iwm_mvm_lmac_scan_abort(sc);

Modified: head/sys/dev/iwm/if_iwmvar.h
==
--- head/sys/dev/iwm/if_iwmvar.hThu Nov  7 23:29:00 2019
(r354493)
+++ head/sys/dev/iwm/if_iwmvar.hThu Nov  7 23:29:25 2019
(r354494)
@@ -165,20 +165,6 @@ struct iwm_ucode_capabilities {
uint8_t enabled_capa[howmany(IWM_NUM_UCODE_TLV_CAPA, NBBY)];
 };
 
-static inline int
-fw_has_api(const struct iwm_ucode_capabilities *capabilities,
-  unsigned int api)
-{
-   return isset(capabilities->enabled_api, api);
-}
-
-static inline int

svn commit: r354492 - head/sys/dev/iwm

2019-11-07 Thread Mark Johnston
Author: markj
Date: Thu Nov  7 23:27:54 2019
New Revision: 354492
URL: https://svnweb.freebsd.org/changeset/base/354492

Log:
  iwm: Fix style in the TX path.
  
  Also ensure that the htole* macros are applied correctly when specifying
  the segment length and upper address bits.  No functional change
  intended (unless you use iwm(4) on a big-endian machine).
  
  MFC after:2 weeks
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/dev/iwm/if_iwm.c

Modified: head/sys/dev/iwm/if_iwm.c
==
--- head/sys/dev/iwm/if_iwm.c   Thu Nov  7 22:58:10 2019(r354491)
+++ head/sys/dev/iwm/if_iwm.c   Thu Nov  7 23:27:54 2019(r354492)
@@ -3568,7 +3568,6 @@ iwm_tx(struct iwm_softc *sc, struct mbuf *m, struct ie
tid = 0;
ring = >txq[ac];
desc = >desc[ring->cur];
-   memset(desc, 0, sizeof(*desc));
data = >data[ring->cur];
 
/* Fill out iwm_tx_cmd to send to the firmware */
@@ -3607,17 +3606,15 @@ iwm_tx(struct iwm_softc *sc, struct mbuf *m, struct ie
ieee80211_radiotap_tx(vap, m);
}
 
-
-   totlen = m->m_pkthdr.len;
-
flags = 0;
+   totlen = m->m_pkthdr.len;
if (!IEEE80211_IS_MULTICAST(wh->i_addr1)) {
flags |= IWM_TX_CMD_FLG_ACK;
}
 
-   if (type == IEEE80211_FC0_TYPE_DATA
-   && (totlen + IEEE80211_CRC_LEN > vap->iv_rtsthreshold)
-   && !IEEE80211_IS_MULTICAST(wh->i_addr1)) {
+   if (type == IEEE80211_FC0_TYPE_DATA &&
+   totlen + IEEE80211_CRC_LEN > vap->iv_rtsthreshold &&
+   !IEEE80211_IS_MULTICAST(wh->i_addr1)) {
flags |= IWM_TX_CMD_FLG_PROT_REQUIRE;
}
 
@@ -3661,7 +3658,7 @@ iwm_tx(struct iwm_softc *sc, struct mbuf *m, struct ie
tx->dram_msb_ptr = iwm_get_dma_hi_addr(data->scratch_paddr);
 
/* Copy 802.11 header in TX command. */
-   memcpy(((uint8_t *)tx) + sizeof(*tx), wh, hdrlen);
+   memcpy((uint8_t *)tx + sizeof(*tx), wh, hdrlen);
 
flags |= IWM_TX_CMD_FLG_BT_DIS | IWM_TX_CMD_FLG_SEQ_CTL;
 
@@ -3715,23 +3712,24 @@ iwm_tx(struct iwm_softc *sc, struct mbuf *m, struct ie
);
 
/* Fill TX descriptor. */
+   memset(desc, 0, sizeof(*desc));
desc->num_tbs = 2 + nsegs;
 
desc->tbs[0].lo = htole32(data->cmd_paddr);
-   desc->tbs[0].hi_n_len = htole16(iwm_get_dma_hi_addr(data->cmd_paddr)) |
-   (TB0_SIZE << 4);
+   desc->tbs[0].hi_n_len = htole16(iwm_get_dma_hi_addr(data->cmd_paddr) |
+   (TB0_SIZE << 4));
desc->tbs[1].lo = htole32(data->cmd_paddr + TB0_SIZE);
-   desc->tbs[1].hi_n_len = htole16(iwm_get_dma_hi_addr(data->cmd_paddr)) |
-   ((sizeof(struct iwm_cmd_header) + sizeof(*tx)
- + hdrlen + pad - TB0_SIZE) << 4);
+   desc->tbs[1].hi_n_len = htole16(iwm_get_dma_hi_addr(data->cmd_paddr) |
+   ((sizeof(struct iwm_cmd_header) + sizeof(*tx) +
+   hdrlen + pad - TB0_SIZE) << 4));
 
/* Other DMA segments are for data payload. */
for (i = 0; i < nsegs; i++) {
seg = [i];
-   desc->tbs[i+2].lo = htole32(seg->ds_addr);
-   desc->tbs[i+2].hi_n_len = \
-   htole16(iwm_get_dma_hi_addr(seg->ds_addr))
-   | ((seg->ds_len) << 4);
+   desc->tbs[i + 2].lo = htole32(seg->ds_addr);
+   desc->tbs[i + 2].hi_n_len =
+   htole16(iwm_get_dma_hi_addr(seg->ds_addr)) |
+   (seg->ds_len << 4);
}
 
bus_dmamap_sync(ring->data_dmat, data->map,
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354491 - in head: . lib/msun/src libexec libexec/rtld-elf libexec/rtld-elf32 share/mk usr.bin usr.bin/ldd32

2019-11-07 Thread Brooks Davis
Author: brooks
Date: Thu Nov  7 22:58:10 2019
New Revision: 354491
URL: https://svnweb.freebsd.org/changeset/base/354491

Log:
  libcompat: build 32-bit rtld and ldd as part of "everything"
  
  Alter bsd.compat.mk to set MACHINE and MACHINE_ARCH when included
  directly so MD paths in Makefiles work. In the process centralize
  setting them in LIBCOMPATWMAKEENV.
  
  Alter .PATH and CFLAGS settings in work when the Makefile is included.
  
  While here only support LIB32 on supported platforms rather than always
  enabling it and requiring users of MK_LIB32 to filter based
  TARGET/MACHINE_ARCH.
  
  The net effect of this change is to make Makefile.libcompat only build
  compatability libraries.
  
  Changes relative to r354449:
  
  Correct detection of the compiler type when bsd.compat.mk is used
  outside Makefile.libcompat.  Previously it always matched the clang
  case.
  
  Set LDFLAGS including the linker emulation for mips where -m32 seems to
  be insufficent.
  
  Reviewed by:  imp, kib (origional version in r354449)
  Obtained from:CheriBSD (conceptually)
  Sponsored by: DARPA, AFRL
  Differential Revision:https://reviews.freebsd.org/D22251

Added:
  head/libexec/rtld-elf32/
 - copied from r354464, head/libexec/rtld-elf32/
  head/usr.bin/ldd32/
 - copied from r354464, head/usr.bin/ldd32/
Modified:
  head/Makefile.inc1
  head/Makefile.libcompat
  head/lib/msun/src/k_sincosl.h
  head/libexec/Makefile
  head/libexec/rtld-elf/Makefile
  head/share/mk/bsd.compat.mk
  head/share/mk/src.opts.mk
  head/usr.bin/Makefile

Modified: head/Makefile.inc1
==
--- head/Makefile.inc1  Thu Nov  7 22:26:54 2019(r354490)
+++ head/Makefile.inc1  Thu Nov  7 22:58:10 2019(r354491)
@@ -802,11 +802,10 @@ XCFLAGS+= --sysroot=${WORLDTMP}
 XCFLAGS+=  ${BFLAGS}
 .endif
 
-.if ${MK_LIB32} != "no" && (${TARGET_ARCH} == "amd64" || \
-${TARGET_ARCH} == "powerpc64" || ${TARGET_ARCH:Mmips64*} != "")
+.if ${MK_LIB32} == "yes"
 _LIBCOMPAT= 32
 .include "Makefile.libcompat"
-.elif ${MK_LIBSOFT} != "no" && ${TARGET_ARCH:Marmv[67]*} != ""
+.elif ${MK_LIBSOFT} == "yes"
 _LIBCOMPAT= SOFT
 .include "Makefile.libcompat"
 .endif

Modified: head/Makefile.libcompat
==
--- head/Makefile.libcompat Thu Nov  7 22:26:54 2019(r354490)
+++ head/Makefile.libcompat Thu Nov  7 22:58:10 2019(r354491)
@@ -111,28 +111,10 @@ build${libcompat}: .PHONY
 .endfor
${_+_}cd ${.CURDIR}; \
${LIBCOMPATWMAKE} -f Makefile.inc1 -DNO_FSCHG libraries
-.if ${libcompat} == "32"
-.for _t in ${_obj} all
-.if !defined(NO_RTLD)
-   ${_+_}cd ${.CURDIR}/libexec/rtld-elf; PROG=ld-elf32.so.1 
${LIBCOMPATWMAKE} \
-   -DNO_FSCHG DIRPRFX=libexec/rtld-elf/ ${_t}
-.endif
-   ${_+_}cd ${.CURDIR}/usr.bin/ldd; PROG=ldd32 ${LIBCOMPATWMAKE} \
-   DIRPRFX=usr.bin/ldd ${_t}
-.endfor
-.endif
 
 distribute${libcompat} install${libcompat}: .PHONY
 .for _dir in ${_LC_LIBDIRS.yes}
${_+_}cd ${.CURDIR}/${_dir}; ${LIBCOMPATIMAKE} 
${.TARGET:S/${libcompat}$//}
 .endfor
-.if ${libcompat} == "32"
-.if !defined(NO_RTLD)
-   ${_+_}cd ${.CURDIR}/libexec/rtld-elf; \
-   PROG=ld-elf32.so.1 ${LIBCOMPATIMAKE} ${.TARGET:S/32$//}
-.endif
-   ${_+_}cd ${.CURDIR}/usr.bin/ldd; PROG=ldd32 ${LIBCOMPATIMAKE} \
-   ${.TARGET:S/32$//}
-.endif
 
-.endif
+.endif # !targets(__<${_this:T}>__)

Modified: head/lib/msun/src/k_sincosl.h
==
--- head/lib/msun/src/k_sincosl.h   Thu Nov  7 22:26:54 2019
(r354490)
+++ head/lib/msun/src/k_sincosl.h   Thu Nov  7 22:58:10 2019
(r354491)
@@ -28,8 +28,8 @@ S1lo = -9.2563760475949941e-18;   /* 
-0x155800.
 #defineC1  ((long double)C1hi + C1lo)
 #else
 static const long double
-C1 =  0.041136L,   /*  0xaa9b.0p-68 */
-S1 = -0.16671L;/* -0xaaab.0p-66 */
+C1 =  0.041136L;   /*  0xaa9b.0p-68 */
+S1 = -0.16671L,/* -0xaaab.0p-66 */
 #endif
 
 static const double

Modified: head/libexec/Makefile
==
--- head/libexec/Makefile   Thu Nov  7 22:26:54 2019(r354490)
+++ head/libexec/Makefile   Thu Nov  7 22:58:10 2019(r354491)
@@ -74,6 +74,7 @@ _tftp-proxy=  tftp-proxy
 
 .if !defined(NO_PIC) && !defined(NO_RTLD)
 _rtld-elf= rtld-elf
+SUBDIR.${MK_LIB32}+=   rtld-elf32
 .endif
 
 .if ${MK_RBOOTD} != "no"

Modified: head/libexec/rtld-elf/Makefile
==
--- head/libexec/rtld-elf/Makefile  Thu Nov  7 22:26:54 2019
(r354490)
+++ 

svn commit: r354490 - head/sys/netinet

2019-11-07 Thread Gleb Smirnoff
Author: glebius
Date: Thu Nov  7 22:26:54 2019
New Revision: 354490
URL: https://svnweb.freebsd.org/changeset/base/354490

Log:
  Remove now unused INP_INFO_RLOCK macros.

Modified:
  head/sys/netinet/in_pcb.h

Modified: head/sys/netinet/in_pcb.h
==
--- head/sys/netinet/in_pcb.h   Thu Nov  7 21:43:31 2019(r354489)
+++ head/sys/netinet/in_pcb.h   Thu Nov  7 22:26:54 2019(r354490)
@@ -629,19 +629,14 @@ int   inp_so_options(const struct inpcb *inp);
 #define INP_INFO_LOCK_INIT(ipi, d) \
mtx_init(&(ipi)->ipi_lock, (d), NULL, MTX_DEF| MTX_RECURSE)
 #define INP_INFO_LOCK_DESTROY(ipi)  mtx_destroy(&(ipi)->ipi_lock)
-#define INP_INFO_RLOCK_ET(ipi, et) NET_EPOCH_ENTER((et))
 #define INP_INFO_WLOCK(ipi) mtx_lock(&(ipi)->ipi_lock)
 #define INP_INFO_TRY_WLOCK(ipi)mtx_trylock(&(ipi)->ipi_lock)
 #define INP_INFO_WLOCKED(ipi)  mtx_owned(&(ipi)->ipi_lock)
-#define INP_INFO_RUNLOCK_ET(ipi, et)   NET_EPOCH_EXIT((et))
-#define INP_INFO_RUNLOCK_TP(ipi, tp)   NET_EPOCH_EXIT(*(tp)->t_inpcb->inp_et)
 #define INP_INFO_WUNLOCK(ipi)  mtx_unlock(&(ipi)->ipi_lock)
 #defineINP_INFO_LOCK_ASSERT(ipi)   
MPASS(in_epoch(net_epoch_preempt) || mtx_owned(&(ipi)->ipi_lock))
-#define INP_INFO_RLOCK_ASSERT(ipi) MPASS(in_epoch(net_epoch_preempt))
 #define INP_INFO_WLOCK_ASSERT(ipi) mtx_assert(&(ipi)->ipi_lock, MA_OWNED)
 #define INP_INFO_WUNLOCK_ASSERT(ipi)   \
mtx_assert(&(ipi)->ipi_lock, MA_NOTOWNED)
-#define INP_INFO_UNLOCK_ASSERT(ipi)MPASS(!in_epoch(net_epoch_preempt) && 
!mtx_owned(&(ipi)->ipi_lock))
 
 #define INP_LIST_LOCK_INIT(ipi, d) \
 rw_init_flags(&(ipi)->ipi_list_lock, (d), 0)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r354482 - head/sys/x86/x86

2019-11-07 Thread Colin Percival
On 2019-11-07 13:34, Andriy Gapon wrote:
> On 07/11/2019 23:19, Colin Percival wrote:
>> On 2019-11-07 13:14, Andriy Gapon wrote:
>>>   x86 stack_save_td_running() can work safely only if IPI_TRACE is a
>>>   non-maskable interrupt.  But at the moment FreeBSD/Xen does not provide
>>>   support for the NMI delivery mode.  So, mark the functionality as
>>>   unsupported similarly to other platforms without NMI.
>>> [...]
>>> +#ifdef XENHVM
>>
>> I'm not sure this does what you intended.  XENHVM simply adds *support* for
>> running under Xen/HVM, and it's part of the GENERIC kernel.
> 
> Oh... I should not have rushed.
> So, I should really check for a run-time Xen marker?

I'm guessing that you want

#include 

...

if (vm_guest == VM_GUEST_XEN)
return (EOPNOTSUPP);

-- 
Colin Percival
Security Officer Emeritus, FreeBSD | The power to serve
Founder, Tarsnap | www.tarsnap.com | Online backups for the truly paranoid
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354489 - head/sys/x86/x86

2019-11-07 Thread Andriy Gapon
Author: avg
Date: Thu Nov  7 21:43:31 2019
New Revision: 354489
URL: https://svnweb.freebsd.org/changeset/base/354489

Log:
  revert r354482, checking for XENHVM was a wrong way of checking for Xen

Modified:
  head/sys/x86/x86/stack_machdep.c

Modified: head/sys/x86/x86/stack_machdep.c
==
--- head/sys/x86/x86/stack_machdep.cThu Nov  7 21:31:15 2019
(r354488)
+++ head/sys/x86/x86/stack_machdep.cThu Nov  7 21:43:31 2019
(r354489)
@@ -135,13 +135,6 @@ int
 stack_save_td_running(struct stack *st, struct thread *td)
 {
 
-#ifdef XENHVM
-   /*
-* There is no NMI support on Xen, so this code can lead to
-* an inter-processor deadlock.
-*/
-   return (EOPNOTSUPP);
-#endif /* XENHVM */
 #ifdef STACK
THREAD_LOCK_ASSERT(td, MA_OWNED);
MPASS(TD_IS_RUNNING(td));
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r354482 - head/sys/x86/x86

2019-11-07 Thread Andriy Gapon
On 07/11/2019 23:19, Colin Percival wrote:
> On 2019-11-07 13:14, Andriy Gapon wrote:
>>   x86 stack_save_td_running() can work safely only if IPI_TRACE is a
>>   non-maskable interrupt.  But at the moment FreeBSD/Xen does not provide
>>   support for the NMI delivery mode.  So, mark the functionality as
>>   unsupported similarly to other platforms without NMI.
>> [...]
>> +#ifdef XENHVM
> 
> I'm not sure this does what you intended.  XENHVM simply adds *support* for
> running under Xen/HVM, and it's part of the GENERIC kernel.

Oh... I should not have rushed.
So, I should really check for a run-time Xen marker?

-- 
Andriy Gapon
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354488 - head/sys/arm/broadcom/bcm2835

2019-11-07 Thread Kyle Evans
Author: kevans
Date: Thu Nov  7 21:31:15 2019
New Revision: 354488
URL: https://svnweb.freebsd.org/changeset/base/354488

Log:
  bcm_lintc: don't attach if "interrupt-controller" is missing
  
  This is a standard required property for interrupt controllers, and present
  on the bcm_lintc nodes for currently supported RPi models. For the RPi4, we
  have both bcm_lintc as well as GIC-400, but only one may be active at a
  time.
  
  Don't probe bcm_lintc if it's missing the "interrupt-controller" property --
  in RPi 4 DTS, the bcm_lintc node is actually missing this along with other
  required interrupt properties. Presumably, if the earlier boot stages will
  support switching to the legacy interrupt controller (as is suggested
  possible by the documentation), the DTS will need to be updated to indicate
  the proper interrupt-parent and hopefully also mark this node as an
  interrupt-controller instead.

Modified:
  head/sys/arm/broadcom/bcm2835/bcm2836.c

Modified: head/sys/arm/broadcom/bcm2835/bcm2836.c
==
--- head/sys/arm/broadcom/bcm2835/bcm2836.c Thu Nov  7 21:30:27 2019
(r354487)
+++ head/sys/arm/broadcom/bcm2835/bcm2836.c Thu Nov  7 21:31:15 2019
(r354488)
@@ -660,6 +660,8 @@ bcm_lintc_probe(device_t dev)
 
if (!ofw_bus_is_compatible(dev, "brcm,bcm2836-l1-intc"))
return (ENXIO);
+   if (!ofw_bus_has_prop(dev, "interrupt-controller"))
+   return (ENXIO);
device_set_desc(dev, "BCM2836 Interrupt Controller");
return (BUS_PROBE_DEFAULT);
 }
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354487 - head/sys/netinet

2019-11-07 Thread Gleb Smirnoff
Author: glebius
Date: Thu Nov  7 21:30:27 2019
New Revision: 354487
URL: https://svnweb.freebsd.org/changeset/base/354487

Log:
  In TCP HPTS enter the epoch in tcp_hpts_thread() and assert it in
  the leaf functions.

Modified:
  head/sys/netinet/tcp_hpts.c

Modified: head/sys/netinet/tcp_hpts.c
==
--- head/sys/netinet/tcp_hpts.c Thu Nov  7 21:29:38 2019(r354486)
+++ head/sys/netinet/tcp_hpts.c Thu Nov  7 21:30:27 2019(r354487)
@@ -1245,12 +1245,10 @@ tcp_input_data(struct tcp_hpts_entry *hpts, struct tim
int16_t set_cpu;
uint32_t did_prefetch = 0;
int dropped;
-   struct epoch_tracker et;
 
HPTS_MTX_ASSERT(hpts);
-#ifndef VIMAGE
-   INP_INFO_RLOCK_ET(_tcbinfo, et);
-#endif
+   NET_EPOCH_ASSERT();
+
while ((inp = TAILQ_FIRST(>p_input)) != NULL) {
HPTS_MTX_ASSERT(hpts);
hpts_sane_input_remove(hpts, inp, 0);
@@ -1266,7 +1264,6 @@ tcp_input_data(struct tcp_hpts_entry *hpts, struct tim
INP_WLOCK(inp);
 #ifdef VIMAGE
CURVNET_SET(inp->inp_vnet);
-   INP_INFO_RLOCK_ET(_tcbinfo, et);
 #endif
if ((inp->inp_flags & (INP_TIMEWAIT | INP_DROPPED)) ||
(inp->inp_flags2 & INP_FREED)) {
@@ -1276,7 +1273,6 @@ out:
INP_WUNLOCK(inp);
}
 #ifdef VIMAGE
-   INP_INFO_RUNLOCK_ET(_tcbinfo, et);
CURVNET_RESTORE();
 #endif
mtx_lock(>p_mtx);
@@ -1296,7 +1292,6 @@ out:
if (in_pcbrele_wlocked(inp) == 0)
INP_WUNLOCK(inp);
 #ifdef VIMAGE
-   INP_INFO_RUNLOCK_ET(_tcbinfo, et);
CURVNET_RESTORE();
 #endif
mtx_lock(>p_mtx);
@@ -1349,22 +1344,16 @@ out:
INP_WUNLOCK(inp);
INP_UNLOCK_ASSERT(inp);
 #ifdef VIMAGE
-   INP_INFO_RUNLOCK_ET(_tcbinfo, et);
CURVNET_RESTORE();
 #endif
mtx_lock(>p_mtx);
hpts->p_inp = NULL;
}
-#ifndef VIMAGE
-   INP_INFO_RUNLOCK_ET(_tcbinfo, et);
-   INP_INFO_UNLOCK_ASSERT(_tcbinfo);
-#endif
 }
 
 static void
 tcp_hptsi(struct tcp_hpts_entry *hpts)
 {
-   struct epoch_tracker et;
struct tcpcb *tp;
struct inpcb *inp = NULL, *ninp;
struct timeval tv;
@@ -1378,6 +1367,8 @@ tcp_hptsi(struct tcp_hpts_entry *hpts)
int16_t set_cpu;
 
HPTS_MTX_ASSERT(hpts);
+   NET_EPOCH_ASSERT();
+
/* record previous info for any logging */
hpts->saved_lasttick = hpts->p_lasttick;
hpts->saved_curtick = hpts->p_curtick;
@@ -1469,9 +1460,6 @@ again:
goto no_one;
}
HPTS_MTX_ASSERT(hpts);
-#ifndef VIMAGE
-   INP_INFO_RLOCK_ET(_tcbinfo, et);
-#endif
for (i = 0; i < ticks_to_run; i++) {
/*
 * Calculate our delay, if there are no extra ticks there
@@ -1586,7 +1574,6 @@ again:
}
 #ifdef VIMAGE
CURVNET_SET(inp->inp_vnet);
-   INP_INFO_RLOCK_ET(_tcbinfo, et);
 #endif
/* Lets do any logging that we might want to */
if (hpts_does_tp_logging && (tp->t_logstate != 
TCP_LOG_STATE_OFF)) {
@@ -1658,7 +1645,6 @@ again:
INP_WUNLOCK(inp);
skip_pacing:
 #ifdef VIMAGE
-   INP_INFO_RUNLOCK_ET(_tcbinfo, et);
CURVNET_RESTORE();
 #endif
INP_UNLOCK_ASSERT(inp);
@@ -1678,9 +1664,6 @@ again:
hpts->p_runningtick = 0;
}
}
-#ifndef VIMAGE
-   INP_INFO_RUNLOCK_ET(_tcbinfo, et);
-#endif
 no_one:
HPTS_MTX_ASSERT(hpts);
hpts->p_delayed_by = 0;
@@ -1820,6 +1803,7 @@ static void
 tcp_hpts_thread(void *ctx)
 {
struct tcp_hpts_entry *hpts;
+   struct epoch_tracker et;
struct timeval tv;
sbintime_t sb;
 
@@ -1839,7 +1823,9 @@ tcp_hpts_thread(void *ctx)
}
hpts->p_hpts_wake_scheduled = 0;
hpts->p_hpts_active = 1;
+   NET_EPOCH_ENTER(et);
tcp_hptsi(hpts);
+   NET_EPOCH_EXIT(et);
HPTS_MTX_ASSERT(hpts);
tv.tv_sec = 0;
tv.tv_usec = hpts->p_hpts_sleep_time * HPTS_TICKS_PER_USEC;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354486 - head/sys/netinet

2019-11-07 Thread Gleb Smirnoff
Author: glebius
Date: Thu Nov  7 21:29:38 2019
New Revision: 354486
URL: https://svnweb.freebsd.org/changeset/base/354486

Log:
  Mechanically convert INP_INFO_RLOCK() to NET_EPOCH_ENTER() in TCP
  timewait manipulation leaf functions.

Modified:
  head/sys/netinet/tcp_timewait.c

Modified: head/sys/netinet/tcp_timewait.c
==
--- head/sys/netinet/tcp_timewait.c Thu Nov  7 21:28:46 2019
(r354485)
+++ head/sys/netinet/tcp_timewait.c Thu Nov  7 21:29:38 2019
(r354486)
@@ -209,10 +209,10 @@ tcp_tw_destroy(void)
struct tcptw *tw;
struct epoch_tracker et;
 
-   INP_INFO_RLOCK_ET(_tcbinfo, et);
+   NET_EPOCH_ENTER(et);
while ((tw = TAILQ_FIRST(_twq_2msl)) != NULL)
tcp_twclose(tw, 0);
-   INP_INFO_RUNLOCK_ET(_tcbinfo, et);
+   NET_EPOCH_EXIT(et);
 
TW_LOCK_DESTROY(V_tw_lock);
uma_zdestroy(V_tcptw_zone);
@@ -236,7 +236,7 @@ tcp_twstart(struct tcpcb *tp)
bool isipv6 = inp->inp_inc.inc_flags & INC_ISIPV6;
 #endif
 
-   INP_INFO_RLOCK_ASSERT(_tcbinfo);
+   NET_EPOCH_ASSERT();
INP_WLOCK_ASSERT(inp);
 
/* A dropped inp should never transition to TIME_WAIT state. */
@@ -382,7 +382,7 @@ tcp_twcheck(struct inpcb *inp, struct tcpopt *to __unu
int thflags;
tcp_seq seq;
 
-   INP_INFO_RLOCK_ASSERT(_tcbinfo);
+   NET_EPOCH_ASSERT();
INP_WLOCK_ASSERT(inp);
 
/*
@@ -488,7 +488,7 @@ tcp_twclose(struct tcptw *tw, int reuse)
inp = tw->tw_inpcb;
KASSERT((inp->inp_flags & INP_TIMEWAIT), ("tcp_twclose: !timewait"));
KASSERT(intotw(inp) == tw, ("tcp_twclose: inp_ppcb != tw"));
-   INP_INFO_RLOCK_ASSERT(_tcbinfo);  /* in_pcbfree() */
+   NET_EPOCH_ASSERT();
INP_WLOCK_ASSERT(inp);
 
tcp_tw_2msl_stop(tw, reuse);
@@ -644,7 +644,7 @@ static void
 tcp_tw_2msl_reset(struct tcptw *tw, int rearm)
 {
 
-   INP_INFO_RLOCK_ASSERT(_tcbinfo);
+   NET_EPOCH_ASSERT();
INP_WLOCK_ASSERT(tw->tw_inpcb);
 
TW_WLOCK(V_tw_lock);
@@ -662,7 +662,7 @@ tcp_tw_2msl_stop(struct tcptw *tw, int reuse)
struct inpcb *inp;
int released __unused;
 
-   INP_INFO_RLOCK_ASSERT(_tcbinfo);
+   NET_EPOCH_ASSERT();
 
TW_WLOCK(V_tw_lock);
inp = tw->tw_inpcb;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354485 - head/sys/netinet

2019-11-07 Thread Gleb Smirnoff
Author: glebius
Date: Thu Nov  7 21:28:46 2019
New Revision: 354485
URL: https://svnweb.freebsd.org/changeset/base/354485

Log:
  Since pfslowtimo() runs in the network epoch, tcp_slowtimo()
  also does.  This allows to simplify tcp_tw_2msl_scan() and
  always require the network epoch in it.

Modified:
  head/sys/netinet/tcp_timewait.c

Modified: head/sys/netinet/tcp_timewait.c
==
--- head/sys/netinet/tcp_timewait.c Thu Nov  7 21:27:32 2019
(r354484)
+++ head/sys/netinet/tcp_timewait.c Thu Nov  7 21:28:46 2019
(r354485)
@@ -689,25 +689,8 @@ tcp_tw_2msl_scan(int reuse)
 {
struct tcptw *tw;
struct inpcb *inp;
-   struct epoch_tracker et;
 
-#ifdef INVARIANTS
-   if (reuse) {
-   /*
-* Exclusive pcbinfo lock is not required in reuse case even if
-* two inpcb locks can be acquired simultaneously:
-*  - the inpcb transitioning to TIME_WAIT state in
-*tcp_tw_start(),
-*  - the inpcb closed by tcp_twclose().
-*
-* It is because only inpcbs in FIN_WAIT2 or CLOSING states can
-* transition in TIME_WAIT state.  Then a pcbcb cannot be in
-* TIME_WAIT list and transitioning to TIME_WAIT state at same
-* time.
-*/
-   INP_INFO_RLOCK_ASSERT(_tcbinfo);
-   }
-#endif
+   NET_EPOCH_ASSERT();
 
for (;;) {
TW_RLOCK(V_tw_lock);
@@ -723,12 +706,10 @@ tcp_tw_2msl_scan(int reuse)
in_pcbref(inp);
TW_RUNLOCK(V_tw_lock);
 
-   INP_INFO_RLOCK_ET(_tcbinfo, et);
INP_WLOCK(inp);
tw = intotw(inp);
if (in_pcbrele_wlocked(inp)) {
if (__predict_true(tw == NULL)) {
-   INP_INFO_RUNLOCK_ET(_tcbinfo, et);
continue;
} else {
/* This should not happen as in TIMEWAIT
@@ -747,7 +728,6 @@ tcp_tw_2msl_scan(int reuse)
"|| inp last reference) && tw != "
"NULL", __func__);
 #endif
-   INP_INFO_RUNLOCK_ET(_tcbinfo, et);
break;
}
}
@@ -755,12 +735,10 @@ tcp_tw_2msl_scan(int reuse)
if (tw == NULL) {
/* tcp_twclose() has already been called */
INP_WUNLOCK(inp);
-   INP_INFO_RUNLOCK_ET(_tcbinfo, et);
continue;
}
 
tcp_twclose(tw, reuse);
-   INP_INFO_RUNLOCK_ET(_tcbinfo, et);
if (reuse)
return tw;
}
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354484 - head/sys/netinet

2019-11-07 Thread Gleb Smirnoff
Author: glebius
Date: Thu Nov  7 21:27:32 2019
New Revision: 354484
URL: https://svnweb.freebsd.org/changeset/base/354484

Log:
  Now that there is no R/W lock on PCB list the pcblist sysctls
  handlers can be greatly simplified.  All the previous double
  cycling and complex locking was added to avoid these functions
  holding global PCB locks for extended period of time, preventing
  addition of new entries.

Modified:
  head/sys/netinet/ip_divert.c
  head/sys/netinet/raw_ip.c
  head/sys/netinet/tcp_subr.c
  head/sys/netinet/tcp_syncache.c
  head/sys/netinet/tcp_syncache.h
  head/sys/netinet/udp_usrreq.c

Modified: head/sys/netinet/ip_divert.c
==
--- head/sys/netinet/ip_divert.cThu Nov  7 21:23:07 2019
(r354483)
+++ head/sys/netinet/ip_divert.cThu Nov  7 21:27:32 2019
(r354484)
@@ -629,71 +629,41 @@ div_ctlinput(int cmd, struct sockaddr *sa, void *vip)
 static int
 div_pcblist(SYSCTL_HANDLER_ARGS)
 {
-   int error, i, n;
-   struct inpcb *inp, **inp_list;
-   inp_gen_t gencnt;
struct xinpgen xig;
struct epoch_tracker et;
+   struct inpcb *inp;
+   int error;
 
-   /*
-* The process of preparing the TCB list is too time-consuming and
-* resource-intensive to repeat twice on every request.
-*/
+   if (req->newptr != 0)
+   return EPERM;
+
if (req->oldptr == 0) {
+   int n;
+
n = V_divcbinfo.ipi_count;
n += imax(n / 8, 10);
req->oldidx = 2 * (sizeof xig) + n * sizeof(struct xinpcb);
return 0;
}
 
-   if (req->newptr != 0)
-   return EPERM;
-
-   /*
-* OK, now we're committed to doing something.
-*/
-   INP_INFO_WLOCK(_divcbinfo);
-   gencnt = V_divcbinfo.ipi_gencnt;
-   n = V_divcbinfo.ipi_count;
-   INP_INFO_WUNLOCK(_divcbinfo);
-
-   error = sysctl_wire_old_buffer(req,
-   2 * sizeof(xig) + n*sizeof(struct xinpcb));
-   if (error != 0)
+   if ((error = sysctl_wire_old_buffer(req, 0)) != 0)
return (error);
 
bzero(, sizeof(xig));
xig.xig_len = sizeof xig;
-   xig.xig_count = n;
-   xig.xig_gen = gencnt;
+   xig.xig_count = V_divcbinfo.ipi_count;
+   xig.xig_gen = V_divcbinfo.ipi_gencnt;
xig.xig_sogen = so_gencnt;
error = SYSCTL_OUT(req, , sizeof xig);
if (error)
return error;
 
-   inp_list = malloc(n * sizeof *inp_list, M_TEMP, M_WAITOK);
-   if (inp_list == NULL)
-   return ENOMEM;
-   
-   INP_INFO_RLOCK_ET(_divcbinfo, et);
-   for (inp = CK_LIST_FIRST(V_divcbinfo.ipi_listhead), i = 0; inp && i < n;
-inp = CK_LIST_NEXT(inp, inp_list)) {
-   INP_WLOCK(inp);
-   if (inp->inp_gencnt <= gencnt &&
-   cr_canseeinpcb(req->td->td_ucred, inp) == 0) {
-   in_pcbref(inp);
-   inp_list[i++] = inp;
-   }
-   INP_WUNLOCK(inp);
-   }
-   INP_INFO_RUNLOCK_ET(_divcbinfo, et);
-   n = i;
-
-   error = 0;
-   for (i = 0; i < n; i++) {
-   inp = inp_list[i];
+   NET_EPOCH_ENTER(et);
+   for (inp = CK_LIST_FIRST(V_divcbinfo.ipi_listhead);
+   inp != NULL;
+   inp = CK_LIST_NEXT(inp, inp_list)) {
INP_RLOCK(inp);
-   if (inp->inp_gencnt <= gencnt) {
+   if (inp->inp_gencnt <= xig.xig_gen) {
struct xinpcb xi;
 
in_pcbtoxinpcb(inp, );
@@ -702,17 +672,9 @@ div_pcblist(SYSCTL_HANDLER_ARGS)
} else
INP_RUNLOCK(inp);
}
-   INP_INFO_WLOCK(_divcbinfo);
-   for (i = 0; i < n; i++) {
-   inp = inp_list[i];
-   INP_RLOCK(inp);
-   if (!in_pcbrele_rlocked(inp))
-   INP_RUNLOCK(inp);
-   }
-   INP_INFO_WUNLOCK(_divcbinfo);
+   NET_EPOCH_EXIT(et);
 
if (!error) {
-   struct epoch_tracker et;
/*
 * Give the user an updated idea of our state.
 * If the generation differs from what we told
@@ -720,15 +682,13 @@ div_pcblist(SYSCTL_HANDLER_ARGS)
 * while we were processing this request, and it
 * might be necessary to retry.
 */
-   INP_INFO_RLOCK_ET(_divcbinfo, et);
xig.xig_gen = V_divcbinfo.ipi_gencnt;
xig.xig_sogen = so_gencnt;
xig.xig_count = V_divcbinfo.ipi_count;
-   INP_INFO_RUNLOCK_ET(_divcbinfo, et);
error = SYSCTL_OUT(req, , sizeof xig);
}
-   free(inp_list, M_TEMP);
-   return error;
+
+   return (error);
 }
 
 #ifdef SYSCTL_NODE

Modified: head/sys/netinet/raw_ip.c

svn commit: r354483 - in head/sys/netinet: . tcp_stacks

2019-11-07 Thread Gleb Smirnoff
Author: glebius
Date: Thu Nov  7 21:23:07 2019
New Revision: 354483
URL: https://svnweb.freebsd.org/changeset/base/354483

Log:
  Now that all of the tcp_input() and all its branches are executed
  in the network epoch, we can greatly simplify synchronization.
  Remove all unneccesary epoch enters hidden under INP_INFO_RLOCK macro.
  Remove some unneccesary assertions and convert necessary ones into the
  NET_EPOCH_ASSERT macro.

Modified:
  head/sys/netinet/tcp_input.c
  head/sys/netinet/tcp_stacks/bbr.c
  head/sys/netinet/tcp_stacks/rack.c
  head/sys/netinet/tcp_stacks/rack_bbr_common.c

Modified: head/sys/netinet/tcp_input.c
==
--- head/sys/netinet/tcp_input.cThu Nov  7 21:14:59 2019
(r354482)
+++ head/sys/netinet/tcp_input.cThu Nov  7 21:23:07 2019
(r354483)
@@ -561,7 +561,6 @@ tcp_input(struct mbuf **mp, int *offp, int proto)
int rstreason = 0;  /* For badport_bandlim accounting purposes */
uint8_t iptos;
struct m_tag *fwd_tag = NULL;
-   struct epoch_tracker et;
 #ifdef INET6
struct ip6_hdr *ip6 = NULL;
int isipv6;
@@ -570,7 +569,6 @@ tcp_input(struct mbuf **mp, int *offp, int proto)
 #endif /* INET6 */
struct tcpopt to;   /* options in this segment */
char *s = NULL; /* address and port logging */
-   int ti_locked;
 #ifdef TCPDEBUG
/*
 * The size of tcp_saveipgen must be the size of the max ip header,
@@ -581,6 +579,8 @@ tcp_input(struct mbuf **mp, int *offp, int proto)
short ostate = 0;
 #endif
 
+   NET_EPOCH_ASSERT();
+
 #ifdef INET6
isipv6 = (mtod(m, struct ip *)->ip_v == 6) ? 1 : 0;
 #endif
@@ -747,19 +747,6 @@ tcp_input(struct mbuf **mp, int *offp, int proto)
drop_hdrlen = off0 + off;
 
/*
-* Locate pcb for segment; if we're likely to add or remove a
-* connection then first acquire pcbinfo lock.  There are three cases
-* where we might discover later we need a write lock despite the
-* flags: ACKs moving a connection out of the syncache, ACKs for a
-* connection in TIMEWAIT and SYNs not targeting a listening socket.
-*/
-   if ((thflags & (TH_FIN | TH_RST)) != 0) {
-   INP_INFO_RLOCK_ET(_tcbinfo, et);
-   ti_locked = TI_RLOCKED;
-   } else
-   ti_locked = TI_UNLOCKED;
-
-   /*
 * Grab info from PACKET_TAG_IPFORWARD tag prepended to the chain.
 */
 if (
@@ -776,13 +763,6 @@ tcp_input(struct mbuf **mp, int *offp, int proto)
fwd_tag = m_tag_find(m, PACKET_TAG_IPFORWARD, NULL);
 
 findpcb:
-#ifdef INVARIANTS
-   if (ti_locked == TI_RLOCKED) {
-   INP_INFO_RLOCK_ASSERT(_tcbinfo);
-   } else {
-   INP_INFO_WUNLOCK_ASSERT(_tcbinfo);
-   }
-#endif
 #ifdef INET6
if (isipv6 && fwd_tag != NULL) {
struct sockaddr_in6 *next_hop6;
@@ -942,12 +922,6 @@ findpcb:
 * XXXRW: It may be time to rethink timewait locking.
 */
if (inp->inp_flags & INP_TIMEWAIT) {
-   if (ti_locked == TI_UNLOCKED) {
-   INP_INFO_RLOCK_ET(_tcbinfo, et);
-   ti_locked = TI_RLOCKED;
-   }
-   INP_INFO_RLOCK_ASSERT(_tcbinfo);
-
if (thflags & TH_SYN)
tcp_dooptions(, optp, optlen, TO_SYN);
/*
@@ -955,7 +929,6 @@ findpcb:
 */
if (tcp_twcheck(inp, , th, m, tlen))
goto findpcb;
-   INP_INFO_RUNLOCK_ET(_tcbinfo, et);
return (IPPROTO_DONE);
}
/*
@@ -977,27 +950,6 @@ findpcb:
}
 #endif
 
-   /*
-* We've identified a valid inpcb, but it could be that we need an
-* inpcbinfo write lock but don't hold it.  In this case, attempt to
-* acquire using the same strategy as the TIMEWAIT case above.  If we
-* relock, we have to jump back to 'relocked' as the connection might
-* now be in TIMEWAIT.
-*/
-#ifdef INVARIANTS
-   if ((thflags & (TH_FIN | TH_RST)) != 0)
-   INP_INFO_RLOCK_ASSERT(_tcbinfo);
-#endif
-   if (!((tp->t_state == TCPS_ESTABLISHED && (thflags & TH_SYN) == 0) ||
- (tp->t_state == TCPS_LISTEN && (thflags & TH_SYN) &&
-  !IS_FASTOPEN(tp->t_flags {
-   if (ti_locked == TI_UNLOCKED) {
-   INP_INFO_RLOCK_ET(_tcbinfo, et);
-   ti_locked = TI_RLOCKED;
-   }
-   INP_INFO_RLOCK_ASSERT(_tcbinfo);
-   }
-
 #ifdef MAC
INP_WLOCK_ASSERT(inp);
if (mac_inpcb_check_deliver(inp, m))
@@ -1052,7 +1004,6 @@ findpcb:
 */
if ((thflags & (TH_RST|TH_ACK|TH_SYN)) == TH_ACK) {
 
-   INP_INFO_RLOCK_ASSERT(_tcbinfo);
  

Re: svn commit: r354482 - head/sys/x86/x86

2019-11-07 Thread Colin Percival
On 2019-11-07 13:14, Andriy Gapon wrote:
>   x86 stack_save_td_running() can work safely only if IPI_TRACE is a
>   non-maskable interrupt.  But at the moment FreeBSD/Xen does not provide
>   support for the NMI delivery mode.  So, mark the functionality as
>   unsupported similarly to other platforms without NMI.
> [...]
> +#ifdef XENHVM

I'm not sure this does what you intended.  XENHVM simply adds *support* for
running under Xen/HVM, and it's part of the GENERIC kernel.

-- 
Colin Percival
Security Officer Emeritus, FreeBSD | The power to serve
Founder, Tarsnap | www.tarsnap.com | Online backups for the truly paranoid
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354482 - head/sys/x86/x86

2019-11-07 Thread Andriy Gapon
Author: avg
Date: Thu Nov  7 21:14:59 2019
New Revision: 354482
URL: https://svnweb.freebsd.org/changeset/base/354482

Log:
  IPI_TRACE is not really supported on xen
  
  x86 stack_save_td_running() can work safely only if IPI_TRACE is a
  non-maskable interrupt.  But at the moment FreeBSD/Xen does not provide
  support for the NMI delivery mode.  So, mark the functionality as
  unsupported similarly to other platforms without NMI.
  Maybe there is a way to provide a Xen-specific working
  stack_save_td_running(), but I couldn't figure it out.
  
  MFC after:3 weeks
  Sponsored by: Panzura

Modified:
  head/sys/x86/x86/stack_machdep.c

Modified: head/sys/x86/x86/stack_machdep.c
==
--- head/sys/x86/x86/stack_machdep.cThu Nov  7 21:08:49 2019
(r354481)
+++ head/sys/x86/x86/stack_machdep.cThu Nov  7 21:14:59 2019
(r354482)
@@ -135,6 +135,13 @@ int
 stack_save_td_running(struct stack *st, struct thread *td)
 {
 
+#ifdef XENHVM
+   /*
+* There is no NMI support on Xen, so this code can lead to
+* an inter-processor deadlock.
+*/
+   return (EOPNOTSUPP);
+#endif /* XENHVM */
 #ifdef STACK
THREAD_LOCK_ASSERT(td, MA_OWNED);
MPASS(TD_IS_RUNNING(td));
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354481 - head/sys/netinet

2019-11-07 Thread Gleb Smirnoff
Author: glebius
Date: Thu Nov  7 21:08:49 2019
New Revision: 354481
URL: https://svnweb.freebsd.org/changeset/base/354481

Log:
  Remove unnecessary recursive epoch enter via INP_INFO_RLOCK
  macro in udp_input().  It shall always run in the network epoch.

Modified:
  head/sys/netinet/udp_usrreq.c

Modified: head/sys/netinet/udp_usrreq.c
==
--- head/sys/netinet/udp_usrreq.c   Thu Nov  7 21:03:15 2019
(r354480)
+++ head/sys/netinet/udp_usrreq.c   Thu Nov  7 21:08:49 2019
(r354481)
@@ -399,7 +399,6 @@ udp_input(struct mbuf **mp, int *offp, int proto)
struct sockaddr_in udp_in[2];
struct mbuf *m;
struct m_tag *fwd_tag;
-   struct epoch_tracker et;
int cscov_partial, iphlen;
 
m = *mp;
@@ -528,7 +527,8 @@ udp_input(struct mbuf **mp, int *offp, int proto)
struct inpcb *last;
struct inpcbhead *pcblist;
 
-   INP_INFO_RLOCK_ET(pcbinfo, et);
+   NET_EPOCH_ASSERT();
+
pcblist = udp_get_pcblist(proto);
last = NULL;
CK_LIST_FOREACH(inp, pcblist, inp_list) {
@@ -635,7 +635,6 @@ udp_input(struct mbuf **mp, int *offp, int proto)
UDPSTAT_INC(udps_noportbcast);
if (inp)
INP_RUNLOCK(inp);
-   INP_INFO_RUNLOCK_ET(pcbinfo, et);
goto badunlocked;
}
if (proto == IPPROTO_UDPLITE)
@@ -645,7 +644,6 @@ udp_input(struct mbuf **mp, int *offp, int proto)
if (udp_append(last, ip, m, iphlen, udp_in) == 0) 
INP_RUNLOCK(last);
inp_lost:
-   INP_INFO_RUNLOCK_ET(pcbinfo, et);
return (IPPROTO_DONE);
}
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354480 - head/sys/netinet

2019-11-07 Thread Gleb Smirnoff
Author: glebius
Date: Thu Nov  7 21:03:15 2019
New Revision: 354480
URL: https://svnweb.freebsd.org/changeset/base/354480

Log:
  Remove now unused INP_HASH_RLOCK() macros.

Modified:
  head/sys/netinet/in_pcb.h

Modified: head/sys/netinet/in_pcb.h
==
--- head/sys/netinet/in_pcb.h   Thu Nov  7 21:01:36 2019(r354479)
+++ head/sys/netinet/in_pcb.h   Thu Nov  7 21:03:15 2019(r354480)
@@ -664,11 +664,7 @@ intinp_so_options(const struct inpcb *inp);
 
 #defineINP_HASH_LOCK_INIT(ipi, d) mtx_init(&(ipi)->ipi_hash_lock, (d), 
NULL, MTX_DEF)
 #defineINP_HASH_LOCK_DESTROY(ipi)  
mtx_destroy(&(ipi)->ipi_hash_lock)
-#defineINP_HASH_RLOCK(ipi) struct epoch_tracker 
inp_hash_et; epoch_enter_preempt(net_epoch_preempt, _hash_et)
-#defineINP_HASH_RLOCK_ET(ipi, et)  
epoch_enter_preempt(net_epoch_preempt, &(et))
 #defineINP_HASH_WLOCK(ipi) mtx_lock(&(ipi)->ipi_hash_lock)
-#defineINP_HASH_RUNLOCK(ipi)   NET_EPOCH_EXIT(inp_hash_et)
-#defineINP_HASH_RUNLOCK_ET(ipi, et)NET_EPOCH_EXIT((et))
 #defineINP_HASH_WUNLOCK(ipi)   
mtx_unlock(&(ipi)->ipi_hash_lock)
 #defineINP_HASH_LOCK_ASSERT(ipi)   
MPASS(in_epoch(net_epoch_preempt) || mtx_owned(&(ipi)->ipi_hash_lock))
 #defineINP_HASH_WLOCK_ASSERT(ipi)  
mtx_assert(&(ipi)->ipi_hash_lock, MA_OWNED);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354479 - in head/sys: netinet netinet6

2019-11-07 Thread Gleb Smirnoff
Author: glebius
Date: Thu Nov  7 21:01:36 2019
New Revision: 354479
URL: https://svnweb.freebsd.org/changeset/base/354479

Log:
  Now with epoch synchronized PCB lookup tables we can greatly simplify
  locking in udp_output() and udp6_output().
  
  First, we select if we need read or write lock in PCB itself, we take
  the lock and enter network epoch.  Then, we proceed for the rest of
  the function.  In case if we need to modify PCB hash, we would take
  write lock on it for a short piece of code.
  
  We could exit the epoch before allocating an mbuf, but with this
  patch we are keeping it all the way into ip_output()/ip6_output().
  Today this creates an epoch recursion, since ip_output() enters epoch
  itself.  However, once all protocols are reviewed, ip_output() and
  ip6_output() would require epoch instead of entering it.
  
  Note: I'm not 100% sure that in udp6_output() the epoch is required.
  We don't do PCB hash lookup for a bound socket.  And all branches of
  in6_select_src() don't require epoch, at least they lack assertions.
  Today inet6 address list is protected by rmlock, although it is CKLIST.
  AFAIU, the future plan is to protect it by network epoch.  That would
  require epoch in in6_select_src().  Anyway, in future ip6_output()
  would require epoch, udp6_output() would need to enter it.

Modified:
  head/sys/netinet/udp_usrreq.c
  head/sys/netinet6/udp6_usrreq.c

Modified: head/sys/netinet/udp_usrreq.c
==
--- head/sys/netinet/udp_usrreq.c   Thu Nov  7 20:57:51 2019
(r354478)
+++ head/sys/netinet/udp_usrreq.c   Thu Nov  7 21:01:36 2019
(r354479)
@@ -1118,9 +1118,6 @@ udp_ctloutput(struct socket *so, struct sockopt *sopt)
 }
 
 #ifdef INET
-#defineUH_WLOCKED  2
-#defineUH_RLOCKED  1
-#defineUH_UNLOCKED 0
 static int
 udp_output(struct inpcb *inp, struct mbuf *m, struct sockaddr *addr,
 struct mbuf *control, struct thread *td)
@@ -1136,19 +1133,12 @@ udp_output(struct inpcb *inp, struct mbuf *m, struct s
int error = 0;
int ipflags;
u_short fport, lport;
-   int unlock_udbinfo, unlock_inp;
u_char tos;
uint8_t pr;
uint16_t cscov = 0;
uint32_t flowid = 0;
uint8_t flowtype = M_HASHTYPE_NONE;
 
-   /*
-* udp_output() may need to temporarily bind or connect the current
-* inpcb.  As such, we don't know up front whether we will need the
-* pcbinfo lock or not.  Do any work to decide what is needed up
-* front before acquiring any locks.
-*/
if (len + sizeof(struct udpiphdr) > IP_MAXPACKET) {
if (control)
m_freem(control);
@@ -1158,28 +1148,22 @@ udp_output(struct inpcb *inp, struct mbuf *m, struct s
 
src.sin_family = 0;
sin = (struct sockaddr_in *)addr;
-retry:
+
+   /*
+* udp_output() may need to temporarily bind or connect the current
+* inpcb.  As such, we don't know up front whether we will need the
+* pcbinfo lock or not.  Do any work to decide what is needed up
+* front before acquiring any locks.
+*
+* We will need network epoch in either case, to safely lookup into
+* pcb hash.
+*/
if (sin == NULL ||
-   (inp->inp_laddr.s_addr == INADDR_ANY && inp->inp_lport == 0)) {
+   (inp->inp_laddr.s_addr == INADDR_ANY && inp->inp_lport == 0))
INP_WLOCK(inp);
-   /*
-* In case we lost a race and another thread bound addr/port
-* on the inp we cannot keep the wlock (which still would be
-* fine) as further down, based on these values we make
-* decisions for the pcbinfo lock.  If the locks are not in
-* synch the assertions on unlock will fire, hence we go for
-* one retry loop.
-*/
-   if (sin != NULL && (inp->inp_laddr.s_addr != INADDR_ANY ||
-   inp->inp_lport != 0)) {
-   INP_WUNLOCK(inp);
-   goto retry;
-   }
-   unlock_inp = UH_WLOCKED;
-   } else {
+   else
INP_RLOCK(inp);
-   unlock_inp = UH_RLOCKED;
-   }
+   NET_EPOCH_ENTER(et);
tos = inp->inp_ip_tos;
if (control != NULL) {
/*
@@ -1187,13 +1171,9 @@ retry:
 * stored in a single mbuf.
 */
if (control->m_next) {
-   if (unlock_inp == UH_WLOCKED)
-   INP_WUNLOCK(inp);
-   else
-   INP_RUNLOCK(inp);
m_freem(control);
-   m_freem(m);
-   return (EINVAL);
+   error = EINVAL;
+   goto 

svn commit: r354478 - head/sys/netinet

2019-11-07 Thread Gleb Smirnoff
Author: glebius
Date: Thu Nov  7 20:57:51 2019
New Revision: 354478
URL: https://svnweb.freebsd.org/changeset/base/354478

Log:
  Add INP_UNLOCK() which will do whatever R/W unlock is required.

Modified:
  head/sys/netinet/in_pcb.h

Modified: head/sys/netinet/in_pcb.h
==
--- head/sys/netinet/in_pcb.h   Thu Nov  7 20:49:56 2019(r354477)
+++ head/sys/netinet/in_pcb.h   Thu Nov  7 20:57:51 2019(r354478)
@@ -586,6 +586,7 @@ struct inpcblbgroup {
 #define INP_TRY_WLOCK(inp) rw_try_wlock(&(inp)->inp_lock)
 #define INP_RUNLOCK(inp)   rw_runlock(&(inp)->inp_lock)
 #define INP_WUNLOCK(inp)   rw_wunlock(&(inp)->inp_lock)
+#define INP_UNLOCK(inp)rw_unlock(&(inp)->inp_lock)
 #defineINP_TRY_UPGRADE(inp)rw_try_upgrade(&(inp)->inp_lock)
 #defineINP_DOWNGRADE(inp)  rw_downgrade(&(inp)->inp_lock)
 #defineINP_WLOCKED(inp)rw_wowned(&(inp)->inp_lock)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r354477 - in head/sys: netinet netinet6

2019-11-07 Thread Gleb Smirnoff
On Thu, Nov 07, 2019 at 08:49:56PM +, Gleb Smirnoff wrote:
T> Author: glebius
T> Date: Thu Nov  7 20:49:56 2019
T> New Revision: 354477
T> URL: https://svnweb.freebsd.org/changeset/base/354477
T> 
T> Log:
T>   Since r353292 on input path we are always in network epoch, when
T>   we lookup PCBs.  Thus, do not enter epoch recursively in
T>   in_pcblookup_hash() and in6_pcblookup_hash().  Same applies to
T>   tcp_ctlinput() and tcp6_ctlinput().
T>   
T>   This leaves several sysctl(9) handlers that return PCB credentials
T>   unprotected.  Add epoch enter/exit to all of them.
T>   
T>   Differential Revision: https://reviews.freebsd.org/D22197

Note: only this commit references the differential revision,
as it is the core change.  But preceeding commits and following
commits related to PCB locking were all part of this review.

-- 
Gleb Smirnoff
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354477 - in head/sys: netinet netinet6

2019-11-07 Thread Gleb Smirnoff
Author: glebius
Date: Thu Nov  7 20:49:56 2019
New Revision: 354477
URL: https://svnweb.freebsd.org/changeset/base/354477

Log:
  Since r353292 on input path we are always in network epoch, when
  we lookup PCBs.  Thus, do not enter epoch recursively in
  in_pcblookup_hash() and in6_pcblookup_hash().  Same applies to
  tcp_ctlinput() and tcp6_ctlinput().
  
  This leaves several sysctl(9) handlers that return PCB credentials
  unprotected.  Add epoch enter/exit to all of them.
  
  Differential Revision:https://reviews.freebsd.org/D22197

Modified:
  head/sys/netinet/in_pcb.c
  head/sys/netinet/tcp_subr.c
  head/sys/netinet/udp_usrreq.c
  head/sys/netinet6/in6_pcb.c
  head/sys/netinet6/udp6_usrreq.c

Modified: head/sys/netinet/in_pcb.c
==
--- head/sys/netinet/in_pcb.c   Thu Nov  7 20:44:34 2019(r354476)
+++ head/sys/netinet/in_pcb.c   Thu Nov  7 20:49:56 2019(r354477)
@@ -2252,12 +2252,10 @@ in_pcblookup_hash_locked(struct inpcbinfo *pcbinfo, st
struct inpcb *inp, *tmpinp;
u_short fport = fport_arg, lport = lport_arg;
 
-#ifdef INVARIANTS
KASSERT((lookupflags & ~(INPLOOKUP_WILDCARD)) == 0,
("%s: invalid lookup flags %d", __func__, lookupflags));
-   if (!mtx_owned(>ipi_hash_lock))
-   MPASS(in_epoch_verbose(net_epoch_preempt, 1));
-#endif
+   INP_HASH_LOCK_ASSERT(pcbinfo);
+
/*
 * First look for an exact match.
 */
@@ -2384,7 +2382,6 @@ in_pcblookup_hash(struct inpcbinfo *pcbinfo, struct in
 {
struct inpcb *inp;
 
-   INP_HASH_RLOCK(pcbinfo);
inp = in_pcblookup_hash_locked(pcbinfo, faddr, fport, laddr, lport,
(lookupflags & ~(INPLOOKUP_RLOCKPCB | INPLOOKUP_WLOCKPCB)), ifp);
if (inp != NULL) {
@@ -2411,7 +2408,7 @@ in_pcblookup_hash(struct inpcbinfo *pcbinfo, struct in
}
 #endif
}
-   INP_HASH_RUNLOCK(pcbinfo);
+
return (inp);
 }
 

Modified: head/sys/netinet/tcp_subr.c
==
--- head/sys/netinet/tcp_subr.c Thu Nov  7 20:44:34 2019(r354476)
+++ head/sys/netinet/tcp_subr.c Thu Nov  7 20:49:56 2019(r354477)
@@ -2257,6 +2257,7 @@ tcp_getcred(SYSCTL_HANDLER_ARGS)
 {
struct xucred xuc;
struct sockaddr_in addrs[2];
+   struct epoch_tracker et;
struct inpcb *inp;
int error;
 
@@ -2266,8 +2267,10 @@ tcp_getcred(SYSCTL_HANDLER_ARGS)
error = SYSCTL_IN(req, addrs, sizeof(addrs));
if (error)
return (error);
+   NET_EPOCH_ENTER(et);
inp = in_pcblookup(_tcbinfo, addrs[1].sin_addr, addrs[1].sin_port,
addrs[0].sin_addr, addrs[0].sin_port, INPLOOKUP_RLOCKPCB, NULL);
+   NET_EPOCH_EXIT(et);
if (inp != NULL) {
if (inp->inp_socket == NULL)
error = ENOENT;
@@ -2292,6 +2295,7 @@ SYSCTL_PROC(_net_inet_tcp, OID_AUTO, getcred,
 static int
 tcp6_getcred(SYSCTL_HANDLER_ARGS)
 {
+   struct epoch_tracker et;
struct xucred xuc;
struct sockaddr_in6 addrs[2];
struct inpcb *inp;
@@ -2319,6 +2323,7 @@ tcp6_getcred(SYSCTL_HANDLER_ARGS)
return (EINVAL);
}
 
+   NET_EPOCH_ENTER(et);
 #ifdef INET
if (mapped == 1)
inp = in_pcblookup(_tcbinfo,
@@ -2332,6 +2337,7 @@ tcp6_getcred(SYSCTL_HANDLER_ARGS)
[1].sin6_addr, addrs[1].sin6_port,
[0].sin6_addr, addrs[0].sin6_port,
INPLOOKUP_RLOCKPCB, NULL);
+   NET_EPOCH_EXIT(et);
if (inp != NULL) {
if (inp->inp_socket == NULL)
error = ENOENT;
@@ -2365,7 +2371,6 @@ tcp_ctlinput(int cmd, struct sockaddr *sa, void *vip)
struct inpcb *(*notify)(struct inpcb *, int) = tcp_notify;
struct icmp *icp;
struct in_conninfo inc;
-   struct epoch_tracker et;
tcp_seq icmp_tcp_seq;
int mtu;
 
@@ -2397,7 +2402,6 @@ tcp_ctlinput(int cmd, struct sockaddr *sa, void *vip)
 
icp = (struct icmp *)((caddr_t)ip - offsetof(struct icmp, icmp_ip));
th = (struct tcphdr *)((caddr_t)ip + (ip->ip_hl << 2));
-   INP_INFO_RLOCK_ET(_tcbinfo, et);
inp = in_pcblookup(_tcbinfo, faddr, th->th_dport, ip->ip_src,
th->th_sport, INPLOOKUP_WLOCKPCB, NULL);
if (inp != NULL && PRC_IS_REDIRECT(cmd)) {
@@ -2462,7 +2466,6 @@ tcp_ctlinput(int cmd, struct sockaddr *sa, void *vip)
 out:
if (inp != NULL)
INP_WUNLOCK(inp);
-   INP_INFO_RUNLOCK_ET(_tcbinfo, et);
 }
 #endif /* INET */
 
@@ -2480,7 +2483,6 @@ tcp6_ctlinput(int cmd, struct sockaddr *sa, void *d)
struct ip6ctlparam *ip6cp = NULL;
const struct sockaddr_in6 *sa6_src = NULL;
struct in_conninfo inc;
-   struct epoch_tracker et;
struct tcp_ports {

svn commit: r354476 - head/sys/netinet

2019-11-07 Thread Gleb Smirnoff
Author: glebius
Date: Thu Nov  7 20:44:34 2019
New Revision: 354476
URL: https://svnweb.freebsd.org/changeset/base/354476

Log:
  Remove unnecessary recursive epoch enter via INP_INFO_RLOCK
  macro in divert_packet().  This function is called only from
  pfil(9) filters, which in their place always run in the
  network epoch.

Modified:
  head/sys/netinet/ip_divert.c

Modified: head/sys/netinet/ip_divert.c
==
--- head/sys/netinet/ip_divert.cThu Nov  7 20:43:12 2019
(r354475)
+++ head/sys/netinet/ip_divert.cThu Nov  7 20:44:34 2019
(r354476)
@@ -192,8 +192,9 @@ divert_packet(struct mbuf *m, bool incoming)
u_int16_t nport;
struct sockaddr_in divsrc;
struct m_tag *mtag;
-   struct epoch_tracker et;
 
+   NET_EPOCH_ASSERT();
+
mtag = m_tag_locate(m, MTAG_IPFW_RULE, 0, NULL);
if (mtag == NULL) {
m_freem(m);
@@ -231,7 +232,6 @@ divert_packet(struct mbuf *m, bool incoming)
 
/* Sanity check */
M_ASSERTPKTHDR(m);
-   NET_EPOCH_ASSERT();
 
/* Find IP address for receive interface */
ifp = m->m_pkthdr.rcvif;
@@ -272,7 +272,6 @@ divert_packet(struct mbuf *m, bool incoming)
/* Put packet on socket queue, if any */
sa = NULL;
nport = htons((u_int16_t)(((struct ipfw_rule_ref *)(mtag+1))->info));
-   INP_INFO_RLOCK_ET(_divcbinfo, et);
CK_LIST_FOREACH(inp, _divcb, inp_list) {
/* XXX why does only one socket match? */
if (inp->inp_lport == nport) {
@@ -290,7 +289,6 @@ divert_packet(struct mbuf *m, bool incoming)
break;
}
}
-   INP_INFO_RUNLOCK_ET(_divcbinfo, et);
if (sa == NULL) {
m_freem(m);
KMOD_IPSTAT_INC(ips_noproto);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354475 - head/sys/netinet6

2019-11-07 Thread Gleb Smirnoff
Author: glebius
Date: Thu Nov  7 20:43:12 2019
New Revision: 354475
URL: https://svnweb.freebsd.org/changeset/base/354475

Log:
  Remove unnecessary recursive epoch enter via INP_INFO_RLOCK
  macro in icmp6_rip6_input().  It shall always run in the
  network epoch.

Modified:
  head/sys/netinet6/icmp6.c

Modified: head/sys/netinet6/icmp6.c
==
--- head/sys/netinet6/icmp6.c   Thu Nov  7 20:40:44 2019(r354474)
+++ head/sys/netinet6/icmp6.c   Thu Nov  7 20:43:12 2019(r354475)
@@ -1893,9 +1893,10 @@ icmp6_rip6_input(struct mbuf **mp, int off)
struct inpcb *last = NULL;
struct sockaddr_in6 fromsa;
struct icmp6_hdr *icmp6;
-   struct epoch_tracker et;
struct mbuf *opts = NULL;
 
+   NET_EPOCH_ASSERT();
+
 #ifndef PULLDOWN_TEST
/* this is assumed to be safe. */
icmp6 = (struct icmp6_hdr *)((caddr_t)ip6 + off);
@@ -1920,7 +1921,6 @@ icmp6_rip6_input(struct mbuf **mp, int off)
return (IPPROTO_DONE);
}
 
-   INP_INFO_RLOCK_ET(_ripcbinfo, et);
CK_LIST_FOREACH(inp, _ripcb, inp_list) {
if ((inp->inp_vflag & INP_IPV6) == 0)
continue;
@@ -2002,7 +2002,6 @@ icmp6_rip6_input(struct mbuf **mp, int off)
}
last = inp;
}
-   INP_INFO_RUNLOCK_ET(_ripcbinfo, et);
if (last != NULL) {
if (last->inp_flags & INP_CONTROLOPTS)
ip6_savecontrol(last, m, );
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354474 - in head/sys: netinet netinet6

2019-11-07 Thread Gleb Smirnoff
Author: glebius
Date: Thu Nov  7 20:40:44 2019
New Revision: 354474
URL: https://svnweb.freebsd.org/changeset/base/354474

Log:
  Remove unnecessary recursive epoch enter via INP_INFO_RLOCK
  macro in raw input functions for IPv4 and IPv6.  They shall
  always run in the network epoch.

Modified:
  head/sys/netinet/raw_ip.c
  head/sys/netinet6/raw_ip6.c

Modified: head/sys/netinet/raw_ip.c
==
--- head/sys/netinet/raw_ip.c   Thu Nov  7 20:38:53 2019(r354473)
+++ head/sys/netinet/raw_ip.c   Thu Nov  7 20:40:44 2019(r354474)
@@ -284,9 +284,10 @@ rip_input(struct mbuf **mp, int *offp, int proto)
struct ip *ip = mtod(m, struct ip *);
struct inpcb *inp, *last;
struct sockaddr_in ripsrc;
-   struct epoch_tracker et;
int hash;
 
+   NET_EPOCH_ASSERT();
+
*mp = NULL;
 
bzero(, sizeof(ripsrc));
@@ -299,7 +300,6 @@ rip_input(struct mbuf **mp, int *offp, int proto)
 
hash = INP_PCBHASH_RAW(proto, ip->ip_src.s_addr,
ip->ip_dst.s_addr, V_ripcbinfo.ipi_hashmask);
-   INP_INFO_RLOCK_ET(_ripcbinfo, et);
CK_LIST_FOREACH(inp, _ripcbinfo.ipi_hashbase[hash], inp_hash) {
if (inp->inp_ip_p != proto)
continue;
@@ -422,7 +422,6 @@ rip_input(struct mbuf **mp, int *offp, int proto)
skip_2:
INP_RUNLOCK(inp);
}
-   INP_INFO_RUNLOCK_ET(_ripcbinfo, et);
if (last != NULL) {
if (rip_append(last, ip, m, ) != 0)
IPSTAT_INC(ips_delivered);

Modified: head/sys/netinet6/raw_ip6.c
==
--- head/sys/netinet6/raw_ip6.c Thu Nov  7 20:38:53 2019(r354473)
+++ head/sys/netinet6/raw_ip6.c Thu Nov  7 20:40:44 2019(r354474)
@@ -165,15 +165,15 @@ rip6_input(struct mbuf **mp, int *offp, int proto)
struct inpcb *last = NULL;
struct mbuf *opts = NULL;
struct sockaddr_in6 fromsa;
-   struct epoch_tracker et;
 
+   NET_EPOCH_ASSERT();
+
RIP6STAT_INC(rip6s_ipackets);
 
init_sin6(, m, 0); /* general init */
 
ifp = m->m_pkthdr.rcvif;
 
-   INP_INFO_RLOCK_ET(_ripcbinfo, et);
CK_LIST_FOREACH(inp, _ripcb, inp_list) {
/* XXX inp locking */
if ((inp->inp_vflag & INP_IPV6) == 0)
@@ -303,7 +303,6 @@ rip6_input(struct mbuf **mp, int *offp, int proto)
 skip_2:
INP_RUNLOCK(inp);
}
-   INP_INFO_RUNLOCK_ET(_ripcbinfo, et);
 #if defined(IPSEC) || defined(IPSEC_SUPPORT)
/*
 * Check AH/ESP integrity.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354473 - head/sys/netinet6

2019-11-07 Thread Gleb Smirnoff
Author: glebius
Date: Thu Nov  7 20:38:53 2019
New Revision: 354473
URL: https://svnweb.freebsd.org/changeset/base/354473

Log:
  Remove unnecessary recursive epoch enter via INP_INFO_RLOCK
  macro in udp6_input().  It shall always run in the network epoch.

Modified:
  head/sys/netinet6/udp6_usrreq.c

Modified: head/sys/netinet6/udp6_usrreq.c
==
--- head/sys/netinet6/udp6_usrreq.c Thu Nov  7 20:11:53 2019
(r354472)
+++ head/sys/netinet6/udp6_usrreq.c Thu Nov  7 20:38:53 2019
(r354473)
@@ -214,12 +214,13 @@ udp6_input(struct mbuf **mp, int *offp, int proto)
int off = *offp;
int cscov_partial;
int plen, ulen;
-   struct epoch_tracker et;
struct sockaddr_in6 fromsa[2];
struct m_tag *fwd_tag;
uint16_t uh_sum;
uint8_t nxt;
 
+   NET_EPOCH_ASSERT();
+
ifp = m->m_pkthdr.rcvif;
 
 #ifndef PULLDOWN_TEST
@@ -301,7 +302,6 @@ udp6_input(struct mbuf **mp, int *offp, int proto)
struct inpcbhead *pcblist;
struct ip6_moptions *imo;
 
-   INP_INFO_RLOCK_ET(pcbinfo, et);
/*
 * In the event that laddr should be set to the link-local
 * address (this happens in RIPng), the multicast address
@@ -395,7 +395,7 @@ udp6_input(struct mbuf **mp, int *offp, int proto)
UDP_PROBE(receive, 
NULL, last,
ip6, last, uh);
if (udp6_append(last, n, off, 
fromsa))
-   goto inp_lost;
+   return (IPPROTO_DONE);
}
INP_RUNLOCK(last);
}
@@ -422,7 +422,7 @@ udp6_input(struct mbuf **mp, int *offp, int proto)
 */
UDPSTAT_INC(udps_noport);
UDPSTAT_INC(udps_noportmcast);
-   goto badheadlocked;
+   goto badunlocked;
}
INP_RLOCK(last);
if (__predict_true(last->inp_flags2 & INP_FREED) == 0) {
@@ -434,8 +434,6 @@ udp6_input(struct mbuf **mp, int *offp, int proto)
INP_RUNLOCK(last);
} else
INP_RUNLOCK(last);
-   inp_lost:
-   INP_INFO_RUNLOCK_ET(pcbinfo, et);
return (IPPROTO_DONE);
}
/*
@@ -522,8 +520,6 @@ udp6_input(struct mbuf **mp, int *offp, int proto)
INP_RUNLOCK(inp);
return (IPPROTO_DONE);
 
-badheadlocked:
-   INP_INFO_RUNLOCK_ET(pcbinfo, et);
 badunlocked:
if (m)
m_freem(m);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354472 - stable/12/sys/net

2019-11-07 Thread Vincenzo Maffione
Author: vmaffione
Date: Thu Nov  7 20:11:53 2019
New Revision: 354472
URL: https://svnweb.freebsd.org/changeset/base/354472

Log:
  MFC r354231
  
  netmap: fix build issue in netmap_user.h
  
  The issue was a comparison of integers of different signs
  on 32 bit architectures.
  
  Reported by:jenkins
  MFC after:  1 week

Modified:
  stable/12/sys/net/netmap_user.h
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/net/netmap_user.h
==
--- stable/12/sys/net/netmap_user.h Thu Nov  7 20:09:41 2019
(r354471)
+++ stable/12/sys/net/netmap_user.h Thu Nov  7 20:11:53 2019
(r354472)
@@ -1116,7 +1116,7 @@ nm_dispatch(struct nm_desc *d, int cnt, nm_cb_t cb, u_
slot = >slot[i];
d->hdr.len += slot->len;
nbuf = (u_char *)NETMAP_BUF(ring, 
slot->buf_idx);
-   if (oldbuf != NULL && nbuf - oldbuf == 
ring->nr_buf_size &&
+   if (oldbuf != NULL && nbuf - oldbuf == 
(int)ring->nr_buf_size &&
oldlen == ring->nr_buf_size) {
d->hdr.caplen += slot->len;
oldbuf = nbuf;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354471 - in stable/12: share/man/man4 sys/dev/netmap sys/net tools/tools/netmap usr.sbin usr.sbin/valectl

2019-11-07 Thread Vincenzo Maffione
Author: vmaffione
Date: Thu Nov  7 20:09:41 2019
New Revision: 354471
URL: https://svnweb.freebsd.org/changeset/base/354471

Log:
  MFC r354229
  
  add valectl to the system commands
  
  The valectl(4) program is used to manage vale(4) switches.
  Add it to the system commands so that it can be used right away.
  This program was previously called vale-ctl, and stored in
  tools/tools/netmap
  
  Reviewed by:hrs, bcr, lwhsu, kevans
  Differential Revision:  https://reviews.freebsd.org/D22146

Added:
  stable/12/usr.sbin/valectl/
 - copied from r354229, head/usr.sbin/valectl/
Deleted:
  stable/12/tools/tools/netmap/vale-ctl.4
  stable/12/tools/tools/netmap/vale-ctl.c
Modified:
  stable/12/share/man/man4/netmap.4
  stable/12/sys/dev/netmap/netmap_bdg.c
  stable/12/sys/net/netmap_legacy.h
  stable/12/tools/tools/netmap/Makefile
  stable/12/tools/tools/netmap/README
  stable/12/tools/tools/netmap/lb.8
  stable/12/usr.sbin/Makefile
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/share/man/man4/netmap.4
==
--- stable/12/share/man/man4/netmap.4   Thu Nov  7 19:54:24 2019
(r354470)
+++ stable/12/share/man/man4/netmap.4   Thu Nov  7 20:09:41 2019
(r354471)
@@ -27,7 +27,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd November 20, 2018
+.Dd October 26, 2019
 .Dt NETMAP 4
 .Os
 .Sh NAME
@@ -1087,14 +1087,14 @@ changing port names, e.g.,
 .Pp
 The following command attaches an interface and the host stack
 to a switch:
-.Dl vale-ctl -h vale2:em0
+.Dl valectl -h vale2:em0
 Other
 .Nm
 clients attached to the same switch can now communicate
 with the network card or the host.
 .Sh SEE ALSO
 .Xr vale 4 ,
-.Xr vale-ctl 4 ,
+.Xr valectl 8 ,
 .Xr bridge 8 ,
 .Xr lb 8 ,
 .Xr nmreplay 8 ,

Modified: stable/12/sys/dev/netmap/netmap_bdg.c
==
--- stable/12/sys/dev/netmap/netmap_bdg.c   Thu Nov  7 19:54:24 2019
(r354470)
+++ stable/12/sys/dev/netmap/netmap_bdg.c   Thu Nov  7 20:09:41 2019
(r354471)
@@ -1442,7 +1442,7 @@ put_out:
 
 
 /* nm_bdg_ctl callback for the bwrap.
- * Called on bridge-attach and detach, as an effect of vale-ctl -[ahd].
+ * Called on bridge-attach and detach, as an effect of valectl -[ahd].
  * On attach, it needs to provide a fake netmap_priv_d structure and
  * perform a netmap_do_regif() on the bwrap. This will put both the
  * bwrap and the hwna in netmap mode, with the netmap rings shared

Modified: stable/12/sys/net/netmap_legacy.h
==
--- stable/12/sys/net/netmap_legacy.h   Thu Nov  7 19:54:24 2019
(r354470)
+++ stable/12/sys/net/netmap_legacy.h   Thu Nov  7 20:09:41 2019
(r354471)
@@ -116,13 +116,13 @@
  * nr_cmd (in) if non-zero indicates a special command:
  * NETMAP_BDG_ATTACHand nr_name = vale*:ifname
  * attaches the NIC to the switch; nr_ringid specifies
- * which rings to use. Used by vale-ctl -a ...
+ * which rings to use. Used by valectl -a ...
  * nr_arg1 = NETMAP_BDG_HOST also attaches the host port
- * as in vale-ctl -h ...
+ * as in valectl -h ...
  *
  * NETMAP_BDG_DETACH   and nr_name = vale*:ifname
  * disconnects a previously attached NIC.
- * Used by vale-ctl -d ...
+ * Used by valectl -d ...
  *
  * NETMAP_BDG_LIST
  * list the configuration of VALE switches.
@@ -133,10 +133,10 @@
  *
  * NETMAP_BDG_NEWIF
  * create a persistent VALE port with name nr_name.
- * Used by vale-ctl -n ...
+ * Used by valectl -n ...
  *
  * NETMAP_BDG_DELIF
- * delete a persistent VALE port. Used by vale-ctl -d ...
+ * delete a persistent VALE port. Used by valectl -d ...
  *
  * nr_arg1, nr_arg2, nr_arg3  (in/out) command specific
  *

Modified: stable/12/tools/tools/netmap/Makefile
==
--- stable/12/tools/tools/netmap/Makefile   Thu Nov  7 19:54:24 2019
(r354470)
+++ stable/12/tools/tools/netmap/Makefile   Thu Nov  7 20:09:41 2019
(r354471)
@@ -3,7 +3,7 @@
 #
 # For multiple programs using a single source file each,
 # we can just define 'progs' and create custom targets.
-PROGS  =   pkt-gen nmreplay bridge vale-ctl lb
+PROGS  =   pkt-gen nmreplay bridge lb
 
 CLEANFILES = $(PROGS) *.o
 MAN=
@@ -31,9 +31,6 @@ bridge: bridge.o
 
 nmreplay: nmreplay.o
$(CC) $(CFLAGS) -o nmreplay nmreplay.o $(LDFLAGS)
-
-vale-ctl: vale-ctl.o
-   $(CC) $(CFLAGS) -o vale-ctl vale-ctl.o
 
 lb: lb.o pkt_hash.o
$(CC) $(CFLAGS) -o lb lb.o pkt_hash.o $(LDFLAGS)

Modified: stable/12/tools/tools/netmap/README
==
--- 

svn commit: r354469 - in head/contrib/llvm: include/llvm/DebugInfo/DWARF include/llvm/MC lib/DebugInfo/DWARF lib/MC lib/Object lib/Target/RISCV lib/Target/RISCV/AsmParser lib/Target/RISCV/MCTargetD...

2019-11-07 Thread Dimitry Andric
Author: dim
Date: Thu Nov  7 19:54:08 2019
New Revision: 354469
URL: https://svnweb.freebsd.org/changeset/base/354469

Log:
  Merge commit f596f4507 from llvm git (by Sam Elliott):
  
[RISCV] Add Custom Parser for Atomic Memory Operands
  
Summary:
GCC Accepts both (reg) and 0(reg) for atomic instruction memory
operands. These instructions do not allow for an offset in their
encoding, so in the latter case, the 0 is silently dropped.
  
Due to how we have structured the RISCVAsmParser, the easiest way to
add support for parsing this offset is to add a custom AsmOperand and
parser. This parser drops all the parens, and just keeps the
register.
  
This commit also adds a custom printer for these operands, which
matches the GCC canonical printer, printing both `(a0)` and `0(a0)`
as `(a0)`.
  
Reviewers: asb, lewis-revill
  
Reviewed By: asb
  
Subscribers: s.egerton, hiraditya, rbar, johnrusso, simoncook,
apazos, sabuasal, niosHD, kito-cheng, shiva0217, jrtc27, MaskRay,
zzheng, edward-jones, rogfer01, MartinMosbeck, brucehoult, the_o,
rkruppe, jfb, PkmX, jocewei, psnobl, benna, Jim, llvm-commits
  
Tags: #llvm
  
Differential Revision: https://reviews.llvm.org/D65205
  
llvm-svn: 367553
  
  Merge commit f596f4507 from llvm git (by Sam Elliott):
  
[RISCV] Add FreeBSD targets
  
Reviewers: asb
  
Reviewed By: asb
  
Subscribers: simoncook, s.egerton, lenary, psnobl, benna, mhorne,
emaste, kito-cheng, shiva0217, rogfer01, rkruppe, cfe-commits
  
Tags: #clang
  
Differential Revision: https://reviews.llvm.org/D57795
  
Patch by James Clarke (jrtc27)
  
llvm-svn: 367557
  
  Merge commit f596f4507 from llvm git (by Hsiangkai Wang):
  
[DebugInfo] Generate fixups as emitting DWARF .debug_frame/.eh_frame.
  
It is necessary to generate fixups in .debug_frame or .eh_frame as
relaxation is enabled due to the address delta may be changed after
relaxation.
  
There is an opcode with 6-bits data in debug frame encoding. So, we
also need 6-bits fixup types.
  
Differential Revision: https://reviews.llvm.org/D58335
  
llvm-svn: 366524
  
  Merge commit f596f4507 from llvm git (by Hsiangkai Wang):
  
[DebugInfo] Some fields do not need relocations even relax is enabled.
  
In debug frame information, some fields, e.g., Length in CIE/FDE and
Offset in FDE are attributes to describe the structure of CIE/FDE.
They are not related to the relaxed code. However, these attributes
are symbol differences. So, in current design, these attributes will
be filled as zero and LLVM generates relocations for them.
  
We only need to generate relocations for symbols in executable
sections.  So, if the symbols are not located in executable sections,
we still evaluate their values under relaxation.
  
Differential Revision: https://reviews.llvm.org/D61584
  
llvm-svn: 366531
  
  Merge commit f596f4507 from llvm git (by Alex Bradbury):
  
[RISCV] Don't force absolute FK_Data_X fixups to relocs
  
The current behavior of shouldForceRelocation forces relocations for
the majority of fixups when relaxation is enabled. This makes sense
for fixups which incorporate symbols but is unnecessary for simple
data fixups where the fixup target is already resolved to an absolute
value.
  
Differential Revision: https://reviews.llvm.org/D63404
Patch by Edward Jones.
  
llvm-svn: 369257
  
  Merge commit f596f4507 from llvm git (by Alex Bradbury):
  
[RISCV] Implement getExprForFDESymbol to ensure RISCV_32_PCREL is
used for the FDE location
  
Follow binutils in using RISCV_32_PCREL for the FDE initial location.
As explained in the relevant binutils commit

,
the ADD/SUB pair of relocations is problematic in the presence of
linker relaxation.
  
This patch has the same end goal as D64715 but includes test changes
and avoids adding a new global VariantKind to MCExpr.h (preferring
RISCVMCExpr VKs like the rest of the RISC-V backend).
  
Differential Revision: https://reviews.llvm.org/D66419
  
llvm-svn: 369375
  
  This series of merges will permit riscv64 kernels and riscv64sf worlds
  to build with clang instead of gcc (but still using the bfd linker).
  
  Requested by: jhb
  Obtained from:
https://github.com/freebsd/freebsd/compare/master...bsdjhb:riscv_clang
  MFC after:1 month
  X-MFC-With:   r353358

Modified:
  head/contrib/llvm/include/llvm/DebugInfo/DWARF/DWARFDebugFrame.h
  head/contrib/llvm/include/llvm/DebugInfo/DWARF/DWARFObject.h
  head/contrib/llvm/include/llvm/MC/MCDwarf.h
  head/contrib/llvm/include/llvm/MC/MCFixup.h
  head/contrib/llvm/include/llvm/MC/MCFragment.h
  head/contrib/llvm/lib/DebugInfo/DWARF/DWARFContext.cpp
  

svn commit: r354470 - head/sys/dev/hwpmc

2019-11-07 Thread Andrew Gallatin
Author: gallatin
Date: Thu Nov  7 19:54:24 2019
New Revision: 354470
URL: https://svnweb.freebsd.org/changeset/base/354470

Log:
  hwpmc : fix AMD perf counter MSR access
  
  - amd_intr() does not account for the offset (0x200) in the counter
  MSR address and ends up accessing invalid regions while reading
  counter value after the 4th counter (0xC001000[8,9,..]) and
  erroneously updates the counter values for counters [1-4].
  
  - amd_intr() should only check core pmcs for interrupts since
   other types of pmcs (L3,DF) cannot generate interrupts.
  
  - fix pmc NMI's being ignored due to NMI latency on newer AMD processors
  
  Note that this fixes a kernel panic due to GPFs accessing MSRs on
  higher core count AMD cpus (seen on both Rome 7502P, and
  Threadripper 2990WX 32-core CPUs)
  
  Discussed with: markj
  
  Submitted by: Shreyank Amartya
  Differential Revision:https://reviews.freebsd.org/D21553

Modified:
  head/sys/dev/hwpmc/hwpmc_amd.c
  head/sys/dev/hwpmc/hwpmc_amd.h

Modified: head/sys/dev/hwpmc/hwpmc_amd.c
==
--- head/sys/dev/hwpmc/hwpmc_amd.c  Thu Nov  7 19:54:08 2019
(r354469)
+++ head/sys/dev/hwpmc/hwpmc_amd.c  Thu Nov  7 19:54:24 2019
(r354470)
@@ -39,6 +39,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 #include 
@@ -53,6 +54,10 @@ __FBSDID("$FreeBSD$");
 enum pmc_class amd_pmc_class;
 #endif
 
+#defineOVERFLOW_WAIT_COUNT 50
+
+DPCPU_DEFINE_STATIC(uint32_t, nmi_counter);
+
 /* AMD K7 & K8 PMCs */
 struct amd_descr {
struct pmc_descr pm_descr;  /* "base class" */
@@ -739,6 +744,7 @@ amd_stop_pmc(int cpu, int ri)
struct pmc_hw *phw;
const struct amd_descr *pd;
uint64_t config;
+   int i;
 
KASSERT(cpu >= 0 && cpu < pmc_cpu_max(),
("[amd,%d] illegal CPU value %d", __LINE__, cpu));
@@ -761,6 +767,21 @@ amd_stop_pmc(int cpu, int ri)
/* turn off the PMC ENABLE bit */
config = pm->pm_md.pm_amd.pm_amd_evsel & ~AMD_PMC_ENABLE;
wrmsr(pd->pm_evsel, config);
+
+   /*
+* Due to NMI latency on newer AMD processors
+* NMI interrupts are ignored, which leads to
+* panic or messages based on kernel configuraiton
+*/
+
+   /* Wait for the count to be reset */
+   for (i = 0; i < OVERFLOW_WAIT_COUNT; i++) {
+   if (rdmsr(pd->pm_perfctr) & (1 << (pd->pm_descr.pd_width - 1)))
+   break;
+
+   DELAY(1);
+   }
+
return 0;
 }
 
@@ -779,6 +800,7 @@ amd_intr(struct trapframe *tf)
struct pmc *pm;
struct amd_cpu *pac;
pmc_value_t v;
+   uint32_t active = 0, count = 0;
 
cpu = curcpu;
KASSERT(cpu >= 0 && cpu < pmc_cpu_max(),
@@ -798,19 +820,21 @@ amd_intr(struct trapframe *tf)
 *
 * If found, we call a helper to process the interrupt.
 *
-* If multiple PMCs interrupt at the same time, the AMD64
-* processor appears to deliver as many NMIs as there are
-* outstanding PMC interrupts.  So we process only one NMI
-* interrupt at a time.
+* PMCs interrupting at the same time are collapsed into
+* a single interrupt. Check all the valid pmcs for
+* overflow.
 */
 
-   for (i = 0; retval == 0 && i < AMD_NPMCS; i++) {
+   for (i = 0; i < AMD_CORE_NPMCS; i++) {
 
if ((pm = pac->pc_amdpmcs[i].phw_pmc) == NULL ||
!PMC_IS_SAMPLING_MODE(PMC_TO_MODE(pm))) {
continue;
}
 
+   /* Consider pmc with valid handle as active */
+   active++;
+
if (!AMD_PMC_HAS_OVERFLOWED(i))
continue;
 
@@ -820,8 +844,8 @@ amd_intr(struct trapframe *tf)
continue;
 
/* Stop the PMC, reload count. */
-   evsel   = AMD_PMC_EVSEL_0 + i;
-   perfctr = AMD_PMC_PERFCTR_0 + i;
+   evsel   = amd_pmcdesc[i].pm_evsel;
+   perfctr = amd_pmcdesc[i].pm_perfctr;
v   = pm->pm_sc.pm_reloadcount;
config  = rdmsr(evsel);
 
@@ -837,6 +861,26 @@ amd_intr(struct trapframe *tf)
error = pmc_process_interrupt(PMC_HR, pm, tf);
if (error == 0)
wrmsr(evsel, config);
+   }
+
+   /*
+* Due to NMI latency, there can be a scenario in which
+* multiple pmcs gets serviced in an earlier NMI and we
+* do not find an overflow in the subsequent NMI.
+*
+* For such cases we keep a per-cpu count of active NMIs
+* and compare it with min(active pmcs, 2) to determine
+* if this NMI was for a pmc overflow which was serviced
+* in an earlier request or should be ignored.
+*/
+
+   if (retval) {
+   

svn commit: r354468 - head/share/man/man7

2019-11-07 Thread Ed Maste
Author: emaste
Date: Thu Nov  7 19:37:26 2019
New Revision: 354468
URL: https://svnweb.freebsd.org/changeset/base/354468

Log:
  arch.7: claim 12.x as the last architecture with sparc64 support
  
  GCC 4.2.1 is being removed before FreeBSD 13, as are some other
  components required by FreeBSD/sparc64.  Contemporary GCC does not build
  and there is currently no indication that anyone is going to address
  these issues.
  
  PR:   228919, 233405, 236839, 239851

Modified:
  head/share/man/man7/arch.7

Modified: head/share/man/man7/arch.7
==
--- head/share/man/man7/arch.7  Thu Nov  7 19:31:56 2019(r354467)
+++ head/share/man/man7/arch.7  Thu Nov  7 19:37:26 2019(r354468)
@@ -114,7 +114,7 @@ architectures, the final release.
 .It powerpc64   Ta 6.0
 .It riscv64 Ta 12.0
 .It riscv64sf   Ta 12.0
-.It sparc64 Ta 5.0
+.It sparc64 Ta 5.0   Ta 12.x
 .El
 .Ss Type sizes
 All
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354467 - head/lib/msun/src

2019-11-07 Thread Brooks Davis
Author: brooks
Date: Thu Nov  7 19:31:56 2019
New Revision: 354467
URL: https://svnweb.freebsd.org/changeset/base/354467

Log:
  Fix declaration of S1 by swapping misplaced ',' and ';'.
  
  Reported by:  kargl
  Obtained from:OpenBSD (t...@openbsd.org)
  MFC after:1 week

Modified:
  head/lib/msun/src/k_sincosl.h

Modified: head/lib/msun/src/k_sincosl.h
==
--- head/lib/msun/src/k_sincosl.h   Thu Nov  7 19:28:03 2019
(r354466)
+++ head/lib/msun/src/k_sincosl.h   Thu Nov  7 19:31:56 2019
(r354467)
@@ -28,8 +28,8 @@ S1lo = -9.2563760475949941e-18;   /* 
-0x155800.
 #defineC1  ((long double)C1hi + C1lo)
 #else
 static const long double
-C1 =  0.041136L;   /*  0xaa9b.0p-68 */
-S1 = -0.16671L,/* -0xaaab.0p-66 */
+C1 =  0.041136L,   /*  0xaa9b.0p-68 */
+S1 = -0.16671L;/* -0xaaab.0p-66 */
 #endif
 
 static const double
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354466 - head/lib/msun/src

2019-11-07 Thread Brooks Davis
Author: brooks
Date: Thu Nov  7 19:28:03 2019
New Revision: 354466
URL: https://svnweb.freebsd.org/changeset/base/354466

Log:
  Revert change accidentally included in r354465.
  
  Will recommit with a proper commit message shortly.

Modified:
  head/lib/msun/src/k_sincosl.h

Modified: head/lib/msun/src/k_sincosl.h
==
--- head/lib/msun/src/k_sincosl.h   Thu Nov  7 19:22:51 2019
(r354465)
+++ head/lib/msun/src/k_sincosl.h   Thu Nov  7 19:28:03 2019
(r354466)
@@ -28,8 +28,8 @@ S1lo = -9.2563760475949941e-18;   /* 
-0x155800.
 #defineC1  ((long double)C1hi + C1lo)
 #else
 static const long double
-C1 =  0.041136L,   /*  0xaa9b.0p-68 */
-S1 = -0.16671L;/* -0xaaab.0p-66 */
+C1 =  0.041136L;   /*  0xaa9b.0p-68 */
+S1 = -0.16671L,/* -0xaaab.0p-66 */
 #endif
 
 static const double
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354465 - in head: . lib/msun/src libexec libexec/rtld-elf libexec/rtld-elf32 share/mk usr.bin usr.bin/ldd32

2019-11-07 Thread Brooks Davis
Author: brooks
Date: Thu Nov  7 19:22:51 2019
New Revision: 354465
URL: https://svnweb.freebsd.org/changeset/base/354465

Log:
  Revert r354449: libcompat: build 32-bit rtld and ldd as part of "everything"
  
  Additional testing is required..

Deleted:
  head/libexec/rtld-elf32/
  head/usr.bin/ldd32/
Modified:
  head/Makefile.inc1
  head/Makefile.libcompat
  head/lib/msun/src/k_sincosl.h
  head/libexec/Makefile
  head/libexec/rtld-elf/Makefile
  head/share/mk/bsd.compat.mk
  head/share/mk/src.opts.mk
  head/usr.bin/Makefile

Modified: head/Makefile.inc1
==
--- head/Makefile.inc1  Thu Nov  7 19:13:53 2019(r354464)
+++ head/Makefile.inc1  Thu Nov  7 19:22:51 2019(r354465)
@@ -802,10 +802,11 @@ XCFLAGS+= --sysroot=${WORLDTMP}
 XCFLAGS+=  ${BFLAGS}
 .endif
 
-.if ${MK_LIB32} == "yes"
+.if ${MK_LIB32} != "no" && (${TARGET_ARCH} == "amd64" || \
+${TARGET_ARCH} == "powerpc64" || ${TARGET_ARCH:Mmips64*} != "")
 _LIBCOMPAT= 32
 .include "Makefile.libcompat"
-.elif ${MK_LIBSOFT} == "yes"
+.elif ${MK_LIBSOFT} != "no" && ${TARGET_ARCH:Marmv[67]*} != ""
 _LIBCOMPAT= SOFT
 .include "Makefile.libcompat"
 .endif

Modified: head/Makefile.libcompat
==
--- head/Makefile.libcompat Thu Nov  7 19:13:53 2019(r354464)
+++ head/Makefile.libcompat Thu Nov  7 19:22:51 2019(r354465)
@@ -111,10 +111,28 @@ build${libcompat}: .PHONY
 .endfor
${_+_}cd ${.CURDIR}; \
${LIBCOMPATWMAKE} -f Makefile.inc1 -DNO_FSCHG libraries
+.if ${libcompat} == "32"
+.for _t in ${_obj} all
+.if !defined(NO_RTLD)
+   ${_+_}cd ${.CURDIR}/libexec/rtld-elf; PROG=ld-elf32.so.1 
${LIBCOMPATWMAKE} \
+   -DNO_FSCHG DIRPRFX=libexec/rtld-elf/ ${_t}
+.endif
+   ${_+_}cd ${.CURDIR}/usr.bin/ldd; PROG=ldd32 ${LIBCOMPATWMAKE} \
+   DIRPRFX=usr.bin/ldd ${_t}
+.endfor
+.endif
 
 distribute${libcompat} install${libcompat}: .PHONY
 .for _dir in ${_LC_LIBDIRS.yes}
${_+_}cd ${.CURDIR}/${_dir}; ${LIBCOMPATIMAKE} 
${.TARGET:S/${libcompat}$//}
 .endfor
+.if ${libcompat} == "32"
+.if !defined(NO_RTLD)
+   ${_+_}cd ${.CURDIR}/libexec/rtld-elf; \
+   PROG=ld-elf32.so.1 ${LIBCOMPATIMAKE} ${.TARGET:S/32$//}
+.endif
+   ${_+_}cd ${.CURDIR}/usr.bin/ldd; PROG=ldd32 ${LIBCOMPATIMAKE} \
+   ${.TARGET:S/32$//}
+.endif
 
-.endif # !targets(__<${_this:T}>__)
+.endif

Modified: head/lib/msun/src/k_sincosl.h
==
--- head/lib/msun/src/k_sincosl.h   Thu Nov  7 19:13:53 2019
(r354464)
+++ head/lib/msun/src/k_sincosl.h   Thu Nov  7 19:22:51 2019
(r354465)
@@ -28,8 +28,8 @@ S1lo = -9.2563760475949941e-18;   /* 
-0x155800.
 #defineC1  ((long double)C1hi + C1lo)
 #else
 static const long double
-C1 =  0.041136L;   /*  0xaa9b.0p-68 */
-S1 = -0.16671L,/* -0xaaab.0p-66 */
+C1 =  0.041136L,   /*  0xaa9b.0p-68 */
+S1 = -0.16671L;/* -0xaaab.0p-66 */
 #endif
 
 static const double

Modified: head/libexec/Makefile
==
--- head/libexec/Makefile   Thu Nov  7 19:13:53 2019(r354464)
+++ head/libexec/Makefile   Thu Nov  7 19:22:51 2019(r354465)
@@ -74,7 +74,6 @@ _tftp-proxy=  tftp-proxy
 
 .if !defined(NO_PIC) && !defined(NO_RTLD)
 _rtld-elf= rtld-elf
-SUBDIR.${MK_LIB32}+=   rtld-elf32
 .endif
 
 .if ${MK_RBOOTD} != "no"

Modified: head/libexec/rtld-elf/Makefile
==
--- head/libexec/rtld-elf/Makefile  Thu Nov  7 19:13:53 2019
(r354464)
+++ head/libexec/rtld-elf/Makefile  Thu Nov  7 19:22:51 2019
(r354465)
@@ -4,8 +4,6 @@
 # linker:
 # make DEBUG_FLAGS=-g WITHOUT_TESTS=yes all
 
-RTLD_ELF_DIR:= ${.PARSEDIR}
-
 .include 
 PACKAGE=   clibs
 MK_PIE=no # Always position independent using local rules
@@ -27,16 +25,16 @@ SRCS= \
xmalloc.c \
debug.c \
libmap.c
-MAN?=  rtld.1
+MAN=   rtld.1
 CSTD?= gnu99
 CFLAGS+=   -Wall -DFREEBSD_ELF -DIN_RTLD -ffreestanding
 CFLAGS+=   -I${SRCTOP}/lib/csu/common
-.if exists(${RTLD_ELF_DIR}/${MACHINE_ARCH})
+.if exists(${.CURDIR}/${MACHINE_ARCH})
 RTLD_ARCH= ${MACHINE_ARCH}
 .else
 RTLD_ARCH= ${MACHINE_CPUARCH}
 .endif
-CFLAGS+=   -I${RTLD_ELF_DIR}/${RTLD_ARCH} -I${RTLD_ELF_DIR}
+CFLAGS+=   -I${.CURDIR}/${RTLD_ARCH} -I${.CURDIR}
 .if ${MACHINE_ARCH} == "powerpc64"
 LDFLAGS+=  -nostdlib -e _rtld_start
 .else
@@ -83,16 +81,16 @@ LIBADD+=compiler_rt
 
 .if ${MK_SYMVER} == "yes"
 VERSION_DEF=   ${LIBCSRCDIR}/Versions.def
-SYMBOL_MAPS=   

svn commit: r354464 - head/sys/conf

2019-11-07 Thread Kyle Evans
Author: kevans
Date: Thu Nov  7 19:13:53 2019
New Revision: 354464
URL: https://svnweb.freebsd.org/changeset/base/354464

Log:
  sys/conf/files.arm64: remove some unnecessary soc_* dependencies
  
  These files already have 'device' lines that they require; adding a
  dependency on SOC_* options is an extra restriction that adds extra
  verbosity when future supported Broadcom-based SOC will also feature the
  same compatible device.
  
  Users wishing to not compile these devices in should remove the 'device'
  lines from their config.

Modified:
  head/sys/conf/files.arm64

Modified: head/sys/conf/files.arm64
==
--- head/sys/conf/files.arm64   Thu Nov  7 19:06:18 2019(r354463)
+++ head/sys/conf/files.arm64   Thu Nov  7 19:13:53 2019(r354464)
@@ -88,18 +88,18 @@ arm/arm/pmu.c   standard
 arm/arm/physmem.c  standard
 arm/broadcom/bcm2835/bcm2835_audio.c   optional sound vchiq fdt \
compile-with "${NORMAL_C} -DUSE_VCHIQ_ARM -D__VCCOREVER__=0x0400 
-I$S/contrib/vchiq"
-arm/broadcom/bcm2835/bcm2835_bsc.c optional bcm2835_bsc 
soc_brcm_bcm2837 fdt
+arm/broadcom/bcm2835/bcm2835_bsc.c optional bcm2835_bsc fdt
 arm/broadcom/bcm2835/bcm2835_cpufreq.c optional soc_brcm_bcm2837 fdt
 arm/broadcom/bcm2835/bcm2835_dma.c optional soc_brcm_bcm2837 fdt
 arm/broadcom/bcm2835/bcm2835_fbd.c optional vt soc_brcm_bcm2837 fdt
-arm/broadcom/bcm2835/bcm2835_ft5406.c  optional evdev bcm2835_ft5406 
soc_brcm_bcm2837 fdt
+arm/broadcom/bcm2835/bcm2835_ft5406.c  optional evdev bcm2835_ft5406 
fdt
 arm/broadcom/bcm2835/bcm2835_gpio.coptional gpio soc_brcm_bcm2837 
fdt
 arm/broadcom/bcm2835/bcm2835_intr.coptional soc_brcm_bcm2837 fdt
 arm/broadcom/bcm2835/bcm2835_mbox.coptional soc_brcm_bcm2837 fdt
 arm/broadcom/bcm2835/bcm2835_rng.c optional !random_loadable 
soc_brcm_bcm2837 fdt
 arm/broadcom/bcm2835/bcm2835_sdhci.c   optional sdhci soc_brcm_bcm2837 
fdt
 arm/broadcom/bcm2835/bcm2835_sdhost.c  optional sdhci soc_brcm_bcm2837 
fdt
-arm/broadcom/bcm2835/bcm2835_spi.c optional bcm2835_spi 
soc_brcm_bcm2837 fdt
+arm/broadcom/bcm2835/bcm2835_spi.c optional bcm2835_spi fdt
 arm/broadcom/bcm2835/bcm2835_vcio.coptional soc_brcm_bcm2837 fdt
 arm/broadcom/bcm2835/bcm2835_wdog.coptional soc_brcm_bcm2837 fdt
 arm/broadcom/bcm2835/bcm2836.c optional soc_brcm_bcm2837 fdt
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354463 - head/sys/net

2019-11-07 Thread Gleb Smirnoff
Author: glebius
Date: Thu Nov  7 19:06:18 2019
New Revision: 354463
URL: https://svnweb.freebsd.org/changeset/base/354463

Log:
  sysctl_rtsock() has all necessary locking and doesn't need Giant to run.
  While here add description.

Modified:
  head/sys/net/rtsock.c

Modified: head/sys/net/rtsock.c
==
--- head/sys/net/rtsock.c   Thu Nov  7 18:29:51 2019(r354462)
+++ head/sys/net/rtsock.c   Thu Nov  7 19:06:18 2019(r354463)
@@ -1970,7 +1970,8 @@ sysctl_rtsock(SYSCTL_HANDLER_ARGS)
return (error);
 }
 
-static SYSCTL_NODE(_net, PF_ROUTE, routetable, CTLFLAG_RD, sysctl_rtsock, "");
+static SYSCTL_NODE(_net, PF_ROUTE, routetable, CTLFLAG_RD | CTLFLAG_MPSAFE,
+sysctl_rtsock, "Return route tables and interface/address lists");
 
 /*
  * Definitions of protocols supported in the ROUTE domain.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354462 - in head/sys: netinet netinet6

2019-11-07 Thread Bjoern A. Zeeb
Author: bz
Date: Thu Nov  7 18:29:51 2019
New Revision: 354462
URL: https://svnweb.freebsd.org/changeset/base/354462

Log:
  netinet*: variable cleanup
  
  In preparation for another change factor out various variable cleanups.
  These mainly include:
  (1) do not assign values to variables during declaration:  this makes
  the code more readable and does allow for better grouping of
  variable declarations,
  (2) do not assign values to variables before need; e.g., if a variable
  is only used in the 2nd half of a function and we have multiple
  return paths before that, then do not set it before it is needed, and
  (3) try to avoid assigning the same value multiple times.
  
  MFC after:3 weeks
  Sponsored by: Netflix

Modified:
  head/sys/netinet/tcp_input.c
  head/sys/netinet/udp_usrreq.c
  head/sys/netinet6/dest6.c
  head/sys/netinet6/icmp6.c
  head/sys/netinet6/ip6_input.c
  head/sys/netinet6/ip6_mroute.c
  head/sys/netinet6/mld6.c
  head/sys/netinet6/nd6_nbr.c
  head/sys/netinet6/nd6_rtr.c
  head/sys/netinet6/route6.c

Modified: head/sys/netinet/tcp_input.c
==
--- head/sys/netinet/tcp_input.cThu Nov  7 18:26:29 2019
(r354461)
+++ head/sys/netinet/tcp_input.cThu Nov  7 18:29:51 2019
(r354462)
@@ -512,10 +512,11 @@ cc_ecnpkt_handler(struct tcpcb *tp, struct tcphdr *th,
 int
 tcp6_input(struct mbuf **mp, int *offp, int proto)
 {
-   struct mbuf *m = *mp;
+   struct mbuf *m;
struct in6_ifaddr *ia6;
struct ip6_hdr *ip6;
 
+   m = *mp;
IP6_EXTHDR_CHECK(m, *offp, sizeof(struct tcphdr), IPPROTO_DONE);
 
/*
@@ -525,10 +526,8 @@ tcp6_input(struct mbuf **mp, int *offp, int proto)
ip6 = mtod(m, struct ip6_hdr *);
ia6 = in6ifa_ifwithaddr(>ip6_dst, 0 /* XXX */);
if (ia6 && (ia6->ia6_flags & IN6_IFF_ANYCAST)) {
-   struct ip6_hdr *ip6;
 
ifa_free(>ia_ifa);
-   ip6 = mtod(m, struct ip6_hdr *);
icmp6_error(m, ICMP6_DST_UNREACH, ICMP6_DST_UNREACH_ADDR,
(caddr_t)>ip6_dst - (caddr_t)ip6);
return (IPPROTO_DONE);

Modified: head/sys/netinet/udp_usrreq.c
==
--- head/sys/netinet/udp_usrreq.c   Thu Nov  7 18:26:29 2019
(r354461)
+++ head/sys/netinet/udp_usrreq.c   Thu Nov  7 18:29:51 2019
(r354462)
@@ -421,14 +421,13 @@ udp_input(struct mbuf **mp, int *offp, int proto)
/*
 * Get IP and UDP header together in first mbuf.
 */
-   ip = mtod(m, struct ip *);
if (m->m_len < iphlen + sizeof(struct udphdr)) {
if ((m = m_pullup(m, iphlen + sizeof(struct udphdr))) == NULL) {
UDPSTAT_INC(udps_hdrops);
return (IPPROTO_DONE);
}
-   ip = mtod(m, struct ip *);
}
+   ip = mtod(m, struct ip *);
uh = (struct udphdr *)((caddr_t)ip + iphlen);
cscov_partial = (proto == IPPROTO_UDPLITE) ? 1 : 0;
 

Modified: head/sys/netinet6/dest6.c
==
--- head/sys/netinet6/dest6.c   Thu Nov  7 18:26:29 2019(r354461)
+++ head/sys/netinet6/dest6.c   Thu Nov  7 18:29:51 2019(r354462)
@@ -64,10 +64,13 @@ __FBSDID("$FreeBSD$");
 int
 dest6_input(struct mbuf **mp, int *offp, int proto)
 {
-   struct mbuf *m = *mp;
-   int off = *offp, dstoptlen, optlen;
+   struct mbuf *m;
+   int off, dstoptlen, optlen;
struct ip6_dest *dstopts;
u_int8_t *opt;
+
+   m = *mp;
+   off = *offp;
 
/* validation of the length of the header */
 #ifndef PULLDOWN_TEST

Modified: head/sys/netinet6/icmp6.c
==
--- head/sys/netinet6/icmp6.c   Thu Nov  7 18:26:29 2019(r354461)
+++ head/sys/netinet6/icmp6.c   Thu Nov  7 18:29:51 2019(r354462)
@@ -401,17 +401,15 @@ icmp6_error(struct mbuf *m, int type, int code, int pa
 int
 icmp6_input(struct mbuf **mp, int *offp, int proto)
 {
-   struct mbuf *m = *mp, *n;
+   struct mbuf *m, *n;
struct ifnet *ifp;
struct ip6_hdr *ip6, *nip6;
struct icmp6_hdr *icmp6, *nicmp6;
-   int off = *offp;
-   int icmp6len = m->m_pkthdr.len - *offp;
-   int code, sum, noff;
char ip6bufs[INET6_ADDRSTRLEN], ip6bufd[INET6_ADDRSTRLEN];
-   int ip6len, error;
+   int code, error, icmp6len, ip6len, noff, off, sum;
 
-   ifp = m->m_pkthdr.rcvif;
+   m = *mp;
+   off = *offp;
 
 #ifndef PULLDOWN_TEST
IP6_EXTHDR_CHECK(m, off, sizeof(struct icmp6_hdr), IPPROTO_DONE);
@@ -423,13 +421,14 @@ icmp6_input(struct mbuf **mp, int *offp, int proto)
 * that not corrupted and of at least minimum length
 */
 
-   ip6 = 

svn commit: r354461 - head/sys/vm

2019-11-07 Thread Mark Johnston
Author: markj
Date: Thu Nov  7 18:26:29 2019
New Revision: 354461
URL: https://svnweb.freebsd.org/changeset/base/354461

Log:
  Drop Giant before sleeping on a busy page.
  
  Before the page busy code was converted to make direct use of
  sleepqueues, this was handled by _sleep().
  
  Reported by:  glebius
  Reviewed by:  kib
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/vm/vm_page.c

Modified: head/sys/vm/vm_page.c
==
--- head/sys/vm/vm_page.c   Thu Nov  7 18:26:01 2019(r354460)
+++ head/sys/vm/vm_page.c   Thu Nov  7 18:26:29 2019(r354461)
@@ -1053,8 +1053,10 @@ _vm_page_busy_sleep(vm_object_t obj, vm_page_t m, cons
}
if (locked)
VM_OBJECT_DROP(obj);
+   DROP_GIANT();
sleepq_add(m, NULL, wmesg, 0, 0);
sleepq_wait(m, PVM);
+   PICKUP_GIANT();
 }
 
 /*
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354460 - in head: contrib/libc++/include sys/sys

2019-11-07 Thread Dimitry Andric
Author: dim
Date: Thu Nov  7 18:26:01 2019
New Revision: 354460
URL: https://svnweb.freebsd.org/changeset/base/354460

Log:
  Merge commit e8316372b from llvm git (by Louis Dionne):
  
[libc++] Add `__truncating_cast` for safely casting float types to
integers
  
This is needed anytime we need to clamp an arbitrary floating point
value to an integer type.
  
Thanks to Eric Fiselier for the patch.
  
Differential Revision: https://reviews.llvm.org/D66836
  
llvm-svn: 370891
  
  Merge commit b92deded8 from llvm git (by Louis Dionne):
  
[libc++] Move __clamp_to_integral to , and harden against
min()/max() macros
  
llvm-svn: 370900
  
  Merge commit 0ec6a4882 from llvm git (by Louis Dionne):
  
[libc++] Fix potential OOB in poisson_distribution
  
See details in the original Chromium bug report:
https://bugs.chromium.org/p/chromium/issues/detail?id=994957
  
  Together, these fix a security issue in libc++'s implementation of
  std::poisson_distribution, which can be exploited to read data which is
  out of bounds.
  
  Note there are no programs in the FreeBSD base system that use
  std::poisson_distribution, so this is only a possible issue for ports
  and external programs which have been built against libc++.  Therefore,
  I am bumping __FreeBSD_version for the benefit of our port maintainers.
  
  Requested by: emaste
  Security: potential OOB read
  MFC after:3 days

Modified:
  head/contrib/libc++/include/cmath
  head/contrib/libc++/include/random
  head/sys/sys/param.h

Modified: head/contrib/libc++/include/cmath
==
--- head/contrib/libc++/include/cmath   Thu Nov  7 18:16:46 2019
(r354459)
+++ head/contrib/libc++/include/cmath   Thu Nov  7 18:26:01 2019
(r354460)
@@ -303,11 +303,15 @@ long doubletruncl(long double x);
 #include <__config>
 #include 
 #include 
+#include 
 
 #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER)
 #pragma GCC system_header
 #endif
 
+_LIBCPP_PUSH_MACROS
+#include <__undef_macros>
+
 _LIBCPP_BEGIN_NAMESPACE_STD
 
 using ::signbit;
@@ -632,6 +636,38 @@ lerp(long double __a, long double __b, long double __t
 
 #endif // _LIBCPP_STD_VER > 17
 
+template ::digits > 
numeric_limits<_IntT>::digits),
+int _Bits = (numeric_limits<_IntT>::digits - 
numeric_limits<_FloatT>::digits)>
+_LIBCPP_INLINE_VISIBILITY
+_LIBCPP_CONSTEXPR _IntT __max_representable_int_for_float() _NOEXCEPT {
+  static_assert(is_floating_point<_FloatT>::value, "must be a floating point 
type");
+  static_assert(is_integral<_IntT>::value, "must be an integral type");
+  static_assert(numeric_limits<_FloatT>::radix == 2, "FloatT has incorrect 
radix");
+  static_assert(_IsSame<_FloatT, float>::value || _IsSame<_FloatT, 
double>::value
+   || _IsSame<_FloatT,long double>::value, "unsupported floating 
point type");
+  return _FloatBigger ? numeric_limits<_IntT>::max() :  
(numeric_limits<_IntT>::max() >> _Bits << _Bits);
+}
+
+// Convert a floating point number to the specified integral type after
+// clamping to the integral types representable range.
+//
+// The behavior is undefined if `__r` is NaN.
+template 
+_LIBCPP_INLINE_VISIBILITY
+_IntT __clamp_to_integral(_RealT __r) _NOEXCEPT {
+  using _Lim = std::numeric_limits<_IntT>;
+  const _IntT _MaxVal = std::__max_representable_int_for_float<_IntT, 
_RealT>();
+  if (__r >= ::nextafter(static_cast<_RealT>(_MaxVal), INFINITY)) {
+return _Lim::max();
+  } else if (__r <= _Lim::lowest()) {
+return _Lim::min();
+  }
+  return static_cast<_IntT>(__r);
+}
+
 _LIBCPP_END_NAMESPACE_STD
+
+_LIBCPP_POP_MACROS
 
 #endif  // _LIBCPP_CMATH

Modified: head/contrib/libc++/include/random
==
--- head/contrib/libc++/include/random  Thu Nov  7 18:16:46 2019
(r354459)
+++ head/contrib/libc++/include/random  Thu Nov  7 18:26:01 2019
(r354460)
@@ -4592,7 +4592,10 @@ class _LIBCPP_TEMPLATE_VIS poisson_distribution (publi
 
 template
 poisson_distribution<_IntType>::param_type::param_type(double __mean)
-: __mean_(__mean)
+// According to the standard `inf` is a valid input, but it causes the
+// distribution to hang, so we replace it with the maximum representable
+// mean.
+: __mean_(isinf(__mean) ? numeric_limits::max() : __mean)
 {
 if (__mean_ < 10)
 {
@@ -4610,7 +4613,7 @@ poisson_distribution<_IntType>::param_type::param_type
 {
 __s_ = _VSTD::sqrt(__mean_);
 __d_ = 6 * __mean_ * __mean_;
-__l_ = static_cast(__mean_ - 1.1484);
+__l_ = std::trunc(__mean_ - 1.1484);
 __omega_ = .3989423 / __s_;
 double __b1_ = .417E-1 / __mean_;
 double __b2_ = .3 * __b1_ * __b1_;
@@ -4627,12 +4630,12 @@ template
 _IntType
 poisson_distribution<_IntType>::operator()(_URNG& __urng, const param_type& 
__pr)
 {
-result_type __x;
+

svn commit: r354459 - head/share/man/man4

2019-11-07 Thread Edward Tomasz Napierala
Author: trasz
Date: Thu Nov  7 18:16:46 2019
New Revision: 354459
URL: https://svnweb.freebsd.org/changeset/base/354459

Log:
  The cdceem(4) driver debuted in 12.1.
  
  MFC after:2 weeks

Modified:
  head/share/man/man4/cdceem.4

Modified: head/share/man/man4/cdceem.4
==
--- head/share/man/man4/cdceem.4Thu Nov  7 18:15:24 2019
(r354458)
+++ head/share/man/man4/cdceem.4Thu Nov  7 18:16:46 2019
(r354459)
@@ -22,7 +22,7 @@
 .\" SUCH DAMAGE.
 .\"
 .\" $FreeBSD$
-.Dd August 7, 2019
+.Dd November 7, 2019
 .Dt CDCEEM 4
 .Os
 .Sh NAME
@@ -110,7 +110,7 @@ Defaults to 0.
 The
 .Nm
 device driver first appeared in
-.Fx 13.0 .
+.Fx 12.1 .
 .Sh AUTHORS
 The
 .Nm
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354458 - head/libexec/rc/rc.d

2019-11-07 Thread Edward Tomasz Napierala
Author: trasz
Date: Thu Nov  7 18:15:24 2019
New Revision: 354458
URL: https://svnweb.freebsd.org/changeset/base/354458

Log:
  Extend the linux rc script to mount the neccessary file systems,
  set ELF fallback brand, and load pty(4).
  
  Reviewed by:  emaste (earlier version)
  MFC after:2 weeks
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D21874

Modified:
  head/libexec/rc/rc.d/linux

Modified: head/libexec/rc/rc.d/linux
==
--- head/libexec/rc/rc.d/linux  Thu Nov  7 18:14:58 2019(r354457)
+++ head/libexec/rc/rc.d/linux  Thu Nov  7 18:15:24 2019(r354458)
@@ -17,7 +17,7 @@ stop_cmd=":"
 
 linux_start()
 {
-   local _tmpdir
+   local _emul_path _tmpdir
 
load_kld -e 'linux(aout|elf)' linux
case `sysctl -n hw.machine_arch` in
@@ -33,6 +33,25 @@ linux_start()
fi
rm -rf ${_tmpdir}
fi
+
+   # Linux uses the pre-pts(4) tty naming scheme.
+   load_kld pty
+
+   # Handle unbranded ELF executables by defaulting to ELFOSABI_LINUX.
+   if [ `sysctl -ni kern.elf64.fallback_brand` -eq "-1" ]; then
+   sysctl kern.elf64.fallback_brand=3 > /dev/null
+   fi
+
+   if [ `sysctl -ni kern.elf32.fallback_brand` -eq "-1" ]; then
+   sysctl kern.elf32.fallback_brand=3 > /dev/null
+   fi
+
+   _emul_path="/compat/linux"
+   mount -o nocover -t linprocfs linprocfs "${_emul_path}/proc"
+   mount -o nocover -t linsysfs linsysfs "${_emul_path}/sys"
+   mount -o nocover -t devfs devfs "${_emul_path}/dev"
+   mount -o nocover -t fdescfs fdescfs "${_emul_path}/dev/fd"
+   mount -o nocover,mode=1777 -t tmpfs tmpfs "${_emul_path}/dev/shm"
 }
 
 load_rc_config $name
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354457 - stable/12/lib/libpmc/pmu-events

2019-11-07 Thread Ed Maste
Author: emaste
Date: Thu Nov  7 18:14:58 2019
New Revision: 354457
URL: https://svnweb.freebsd.org/changeset/base/354457

Log:
  MFC r354342: libpmc: jevents: handle empty description
  
  PR:   241258
  Reported by:  sigsys @ gmail.com
  Obtained from:github.com/andikleen/pmu-tools commit bb3c77ed61

Modified:
  stable/12/lib/libpmc/pmu-events/jevents.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/lib/libpmc/pmu-events/jevents.c
==
--- stable/12/lib/libpmc/pmu-events/jevents.c   Thu Nov  7 18:07:34 2019
(r354456)
+++ stable/12/lib/libpmc/pmu-events/jevents.c   Thu Nov  7 18:14:58 2019
(r354457)
@@ -122,7 +122,7 @@ static void fixdesc(char *s)
--e;
while (e >= s && isspace(*e))
--e;
-   if (*e == '.')
+   if (e >= s && *e == '.')
*e = 0;
 }
 
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354456 - vendor/Juniper/libxo

2019-11-07 Thread Phil Shafer
Author: phil
Date: Thu Nov  7 18:07:34 2019
New Revision: 354456
URL: https://svnweb.freebsd.org/changeset/base/354456

Log:
  Remove oxtradoc version of documentation; move to RST/Sphinx

Modified:
  vendor/Juniper/libxo/import.sh

Modified: vendor/Juniper/libxo/import.sh
==
--- vendor/Juniper/libxo/import.sh  Thu Nov  7 18:06:44 2019
(r354455)
+++ vendor/Juniper/libxo/import.sh  Thu Nov  7 18:07:34 2019
(r354456)
@@ -26,14 +26,19 @@ GMAKE=${GMAKE:-gmake}
 
 # For consistency...
 Error() {
-   echo ERROR: ${1+"$@"} >&2
-   exit 1
+echo ERROR: ${1+"$@"} >&2
+exit 1
 }
 
 Cd() {
-   [ $# -eq 1 ] || Error "Cd() takes a single parameter."
-   cd $1 || Error "cannot \"cd $1\" from $PWD"
-info "Directory =" `pwd`
+[ $# -eq 1 ] || Error "Cd() takes a single parameter."
+cd $1 || Error "cannot \"cd $1\" from $PWD"
+info "Directory =" `pwd`
+ 
+if [ "$DOC" = doc ]; then
+   echo "cd $1"
+   echo "  "
+fi
 }
 
 siginfo() {
@@ -51,8 +56,8 @@ run() {
 CMD="$2"
 
 if [ "$DOC" = doc ]; then
-echo " == $desc"
-echo " - $cmd"
+echo "## $desc"
+echo " $cmd"
 echo " "
 else
 echo ""
@@ -66,7 +71,7 @@ run() {
 }
 
 info() {
-echo " -- " "$@"
+echo "## -- " "$@"
 }
 
 okay() {
@@ -182,13 +187,7 @@ fi
 
 # We need the release tar ball for the HTML docs, nothing more
 
DOCURL=https://github.com/Juniper/libxo/releases/download/$VERS/libxo-$VERS.tar.gz
-DOCBALL=~/tars/doc-$BASEURL
 
-if [ "$FETCH" = "yes" -o ! -f $DOCBALL ]; then
-run "fetching doc tarball" "fetch -o $DOCBALL $DOCURL"
-test -s ${DOCBALL} || Error need DOCBALL
-fi
-
 # BASE should match what the TARBALL contains
 BASE=`basename $TARBALL .tar.gz`
 VERSION=`echo $BASE | sed 's/libxo-//'`
@@ -196,8 +195,6 @@ VERSION=`echo $BASE | sed 's/libxo-//'`
 TF=$BASE/info
 
 run "untarring source files TARBALL" "tar zxf $TARBALL"
-run "untarring html manual" \
-"tar zxf $DOCBALL libxo-$VERS/doc/libxo-manual.html"
 
 # List of top-level files we want to ignore
 TOPJUNKFILES="\
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354455 - in head: contrib/libxo contrib/libxo/libxo contrib/libxo/tests/core lib/libxo lib/libxo/encoder/csv usr.bin/xohtml

2019-11-07 Thread Phil Shafer
Author: phil
Date: Thu Nov  7 18:06:44 2019
New Revision: 354455
URL: https://svnweb.freebsd.org/changeset/base/354455

Log:
  Import libxo-1.3.1:
  - handle argv[0] without '/'
  - add test case for argv[0] without '/'

Modified:
  head/contrib/libxo/configure.ac
  head/contrib/libxo/libxo/libxo.c
  head/contrib/libxo/tests/core/test_01.c
  head/lib/libxo/add.man
  head/lib/libxo/encoder/csv/Makefile
  head/lib/libxo/xo_config.h
  head/usr.bin/xohtml/xohtml.sh
Directory Properties:
  head/contrib/libxo/   (props changed)

Modified: head/contrib/libxo/configure.ac
==
--- head/contrib/libxo/configure.ac Thu Nov  7 18:05:38 2019
(r354454)
+++ head/contrib/libxo/configure.ac Thu Nov  7 18:06:44 2019
(r354455)
@@ -12,7 +12,7 @@
 #
 
 AC_PREREQ(2.2)
-AC_INIT([libxo], [1.3.0], [p...@juniper.net])
+AC_INIT([libxo], [1.3.1], [p...@juniper.net])
 AM_INIT_AUTOMAKE([-Wall -Werror foreign -Wno-portability])
 
 # Support silent build rules.  Requires at least automake-1.11.

Modified: head/contrib/libxo/libxo/libxo.c
==
--- head/contrib/libxo/libxo/libxo.cThu Nov  7 18:05:38 2019
(r354454)
+++ head/contrib/libxo/libxo/libxo.cThu Nov  7 18:06:44 2019
(r354455)
@@ -8104,12 +8104,14 @@ xo_parse_args (int argc, char **argv)
 cp = strrchr(xo_program, '/');
 if (cp)
xo_program = ++cp;
+else
+   cp = argv[0];   /* Reset to front of string */
 
 /* GNU tools add an annoying ".test" as the program extension; remove it */
 size_t len = strlen(xo_program);
 static const char gnu_ext[] = ".test";
 if (len >= sizeof(gnu_ext)) {
-   cp = [len + 1 - sizeof(gnu_ext)];
+   cp += len + 1 - sizeof(gnu_ext);
if (xo_streq(cp, gnu_ext))
*cp = '\0';
 }

Modified: head/contrib/libxo/tests/core/test_01.c
==
--- head/contrib/libxo/tests/core/test_01.c Thu Nov  7 18:05:38 2019
(r354454)
+++ head/contrib/libxo/tests/core/test_01.c Thu Nov  7 18:06:44 2019
(r354455)
@@ -50,6 +50,9 @@ main (int argc, char **argv)
{ "sold", "number", "Number of items sold" },
{ XO_INFO_NULL },
 };
+
+char name[] = "test_01.test";  /* test trimming of xo_program */
+argv[0] = name;
 
 argc = xo_parse_args(argc, argv);
 if (argc < 0)

Modified: head/lib/libxo/add.man
==
--- head/lib/libxo/add.man  Thu Nov  7 18:05:38 2019(r354454)
+++ head/lib/libxo/add.man  Thu Nov  7 18:06:44 2019(r354455)
@@ -3,10 +3,10 @@
 .Fx
 uses
 .Nm libxo
-version 1.3.0.
+version 1.3.1.
 Complete documentation can be found on github:
 .Bd -literal -offset indent
-https://juniper.github.io/libxo/1.3.0/html/index.html
+https://juniper.github.io/libxo/1.3.1/html/index.html
 .Ed
 .Pp
 .Nm libxo

Modified: head/lib/libxo/encoder/csv/Makefile
==
--- head/lib/libxo/encoder/csv/Makefile Thu Nov  7 18:05:38 2019
(r354454)
+++ head/lib/libxo/encoder/csv/Makefile Thu Nov  7 18:06:44 2019
(r354455)
@@ -2,7 +2,7 @@
 
 LIBXODIR=   ${STAGEDIR}${PREFIX}/usr/lib/libxo/encoder
 SHLIBDIR?=  ${LIBXODIR}
-LIBDIR?=  ${LIBXODIR}
+LIBDIR?=${LIBXODIR}
 
 .include 
 
@@ -21,6 +21,7 @@ CFLAGS+=-I${LIBXOSRC}/libxo -I${.CURDIR}
 CFLAGS+=-DXO_ENCODERDIR=\"/usr/lib/libxo/encoder\"
 
 LIBADD=util xo
+LDFLAGS += -L${.OBJDIR}/../../wildebeast
 
 WARNS?= 5
 

Modified: head/lib/libxo/xo_config.h
==
--- head/lib/libxo/xo_config.h  Thu Nov  7 18:05:38 2019(r354454)
+++ head/lib/libxo/xo_config.h  Thu Nov  7 18:06:44 2019(r354455)
@@ -183,16 +183,16 @@
 /* #undef LIBXO_TEXT_ONLY */
 
 /* Version number as dotted value */
-#define LIBXO_VERSION "1.3.0"
+#define LIBXO_VERSION "1.3.1"
 
 /* Version number extra information */
 #define LIBXO_VERSION_EXTRA ""
 
 /* Version number as a number */
-#define LIBXO_VERSION_NUMBER 1003000
+#define LIBXO_VERSION_NUMBER 1003001
 
 /* Version number as string */
-#define LIBXO_VERSION_STRING "1003000"
+#define LIBXO_VERSION_STRING "1003001"
 
 /* Enable local wcwidth implementation */
 #define LIBXO_WCWIDTH 1
@@ -210,7 +210,7 @@
 #define PACKAGE_NAME "libxo"
 
 /* Define to the full name and version of this package. */
-#define PACKAGE_STRING "libxo 1.3.0"
+#define PACKAGE_STRING "libxo 1.3.1"
 
 /* Define to the one symbol short name of this package. */
 #define PACKAGE_TARNAME "libxo"
@@ -219,7 +219,7 @@
 #define PACKAGE_URL ""
 
 /* Define to the version of this package. */
-#define PACKAGE_VERSION "1.3.0"
+#define PACKAGE_VERSION "1.3.1"
 
 /* If using the C 

svn commit: r354454 - vendor/Juniper/libxo/1.3.1

2019-11-07 Thread Phil Shafer
Author: phil
Date: Thu Nov  7 18:05:38 2019
New Revision: 354454
URL: https://svnweb.freebsd.org/changeset/base/354454

Log:
  Tag libxo 1.3.1

Added:
 - copied from r354453, vendor/Juniper/libxo/dist/
Directory Properties:
  vendor/Juniper/libxo/1.3.1/   (props changed)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354453 - in vendor/Juniper/libxo/dist: . libxo tests/core

2019-11-07 Thread Phil Shafer
Author: phil
Date: Thu Nov  7 18:05:26 2019
New Revision: 354453
URL: https://svnweb.freebsd.org/changeset/base/354453

Log:
  Import libxo 1.3.1

Modified:
  vendor/Juniper/libxo/dist/configure.ac
  vendor/Juniper/libxo/dist/libxo/libxo.c
  vendor/Juniper/libxo/dist/tests/core/test_01.c

Modified: vendor/Juniper/libxo/dist/configure.ac
==
--- vendor/Juniper/libxo/dist/configure.ac  Thu Nov  7 17:34:44 2019
(r354452)
+++ vendor/Juniper/libxo/dist/configure.ac  Thu Nov  7 18:05:26 2019
(r354453)
@@ -12,7 +12,7 @@
 #
 
 AC_PREREQ(2.2)
-AC_INIT([libxo], [1.3.0], [p...@juniper.net])
+AC_INIT([libxo], [1.3.1], [p...@juniper.net])
 AM_INIT_AUTOMAKE([-Wall -Werror foreign -Wno-portability])
 
 # Support silent build rules.  Requires at least automake-1.11.

Modified: vendor/Juniper/libxo/dist/libxo/libxo.c
==
--- vendor/Juniper/libxo/dist/libxo/libxo.c Thu Nov  7 17:34:44 2019
(r354452)
+++ vendor/Juniper/libxo/dist/libxo/libxo.c Thu Nov  7 18:05:26 2019
(r354453)
@@ -8104,12 +8104,14 @@ xo_parse_args (int argc, char **argv)
 cp = strrchr(xo_program, '/');
 if (cp)
xo_program = ++cp;
+else
+   cp = argv[0];   /* Reset to front of string */
 
 /* GNU tools add an annoying ".test" as the program extension; remove it */
 size_t len = strlen(xo_program);
 static const char gnu_ext[] = ".test";
 if (len >= sizeof(gnu_ext)) {
-   cp = [len + 1 - sizeof(gnu_ext)];
+   cp += len + 1 - sizeof(gnu_ext);
if (xo_streq(cp, gnu_ext))
*cp = '\0';
 }

Modified: vendor/Juniper/libxo/dist/tests/core/test_01.c
==
--- vendor/Juniper/libxo/dist/tests/core/test_01.c  Thu Nov  7 17:34:44 
2019(r354452)
+++ vendor/Juniper/libxo/dist/tests/core/test_01.c  Thu Nov  7 18:05:26 
2019(r354453)
@@ -50,6 +50,9 @@ main (int argc, char **argv)
{ "sold", "number", "Number of items sold" },
{ XO_INFO_NULL },
 };
+
+char name[] = "test_01.test";  /* test trimming of xo_program */
+argv[0] = name;
 
 argc = xo_parse_args(argc, argv);
 if (argc < 0)
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354452 - head/sys/arm64/include

2019-11-07 Thread Andrew Turner
Author: andrew
Date: Thu Nov  7 17:34:44 2019
New Revision: 354452
URL: https://svnweb.freebsd.org/changeset/base/354452

Log:
  Add more 8 and 16 bit variants of the the atomic(9) functions on arm64.
  
  These are direct copies of the 32 bit functions, adjusted ad needed.
  While here fix atomic_fcmpset_16 to use the valid load and store exclusive
  instructions.
  
  Sponsored by: DARPA, AFRL

Modified:
  head/sys/arm64/include/atomic.h

Modified: head/sys/arm64/include/atomic.h
==
--- head/sys/arm64/include/atomic.h Thu Nov  7 17:21:17 2019
(r354451)
+++ head/sys/arm64/include/atomic.h Thu Nov  7 17:34:44 2019
(r354452)
@@ -57,6 +57,40 @@
 
 #defineATOMIC_OP(op, asm_op, bar, a, l)
\
 static __inline void   \
+atomic_##op##_##bar##8(volatile uint8_t *p, uint8_t val)   \
+{  \
+   uint8_t tmp;\
+   int res;\
+   \
+   __asm __volatile(   \
+   "1: ld"#a"xrb  %w0, [%2]  \n"   \
+   "   "#asm_op"  %w0, %w0, %w3  \n"   \
+   "   st"#l"xrb  %w1, %w0, [%2] \n"   \
+"   cbnz   %w1, 1b\n"  \
+   : "="(tmp), "="(res)\
+   : "r" (p), "r" (val)\
+   : "memory"  \
+   );  \
+}  \
+   \
+static __inline void   \
+atomic_##op##_##bar##16(volatile uint16_t *p, uint16_t val)\
+{  \
+   uint16_t tmp;   \
+   int res;\
+   \
+   __asm __volatile(   \
+   "1: ld"#a"xrh  %w0, [%2]  \n"   \
+   "   "#asm_op"  %w0, %w0, %w3  \n"   \
+   "   st"#l"xrh  %w1, %w0, [%2] \n"   \
+"   cbnz   %w1, 1b\n"  \
+   : "="(tmp), "="(res)\
+   : "r" (p), "r" (val)\
+   : "memory"  \
+   );  \
+}  \
+   \
+static __inline void   \
 atomic_##op##_##bar##32(volatile uint32_t *p, uint32_t val)\
 {  \
uint32_t tmp;   \
@@ -135,10 +169,10 @@ atomic_fcmpset_##bar##16(volatile uint16_t *p, uint16_
\
__asm __volatile(   \
"1: mov  %w1, #1\n" \
-   "   ld"#a"xh %w0, [%2]  \n" \
+   "   ld"#a"xrh %w0, [%2]  \n"\
"   cmp  %w0, %w3   \n" \
"   b.ne 2f \n" \
-   "   st"#l"xh %w1, %w4, [%2] \n" \
+   "   st"#l"xrh %w1, %w4, [%2] \n"\
"2:"\
: "="(tmp), "="(res)\
: "r" (p), "r" (_cmpval), "r" (newval)  \
@@ -204,6 +238,52 @@ ATOMIC_FCMPSET(rel_,  ,l)
 #undef ATOMIC_FCMPSET
 
 #defineATOMIC_CMPSET(bar, a, l)
\
+static __inline int\
+atomic_cmpset_##bar##8(volatile uint8_t *p, uint8_t cmpval,\
+uint8_t newval)\
+{   

svn commit: r354451 - head/sys/sys

2019-11-07 Thread Andrew Turner
Author: andrew
Date: Thu Nov  7 17:21:17 2019
New Revision: 354451
URL: https://svnweb.freebsd.org/changeset/base/354451

Log:
  Add the missing volatile qualifier in atomic_store_ptr
  
  MFC after:1 week
  Sponsored by: DARPA, AFRL

Modified:
  head/sys/sys/atomic_common.h

Modified: head/sys/sys/atomic_common.h
==
--- head/sys/sys/atomic_common.hThu Nov  7 17:14:59 2019
(r354450)
+++ head/sys/sys/atomic_common.hThu Nov  7 17:21:17 2019
(r354451)
@@ -58,7 +58,7 @@
 #defineatomic_store_long(p, v) \
 (*(volatile u_long *)(p) = (u_long)(v))
 #defineatomic_store_ptr(p, v)  \
-(*(uintptr_t *)(p) = (uintptr_t)(v))
+(*(volatile uintptr_t *)(p) = (uintptr_t)(v))
 #defineatomic_store_8(p, v)\
 (*(volatile uint8_t *)(p) = (uint8_t)(v))
 #defineatomic_store_16(p, v)   \
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354450 - head/usr.bin/env

2019-11-07 Thread Joseph Mingrone
Author: jrm (ports committer)
Date: Thu Nov  7 17:14:59 2019
New Revision: 354450
URL: https://svnweb.freebsd.org/changeset/base/354450

Log:
  Add -0 option to ENV(1)
  
  With the -0 option added to ENV(1), some ports will no longer require genv
  from sysutils/coreutils.
  
  Reviewed by:  kevans (prior version), swills
  Approved by:  bcr (manpages), imp
  Differential Revision:https://reviews.freebsd.org/D22230

Modified:
  head/usr.bin/env/env.1
  head/usr.bin/env/env.c

Modified: head/usr.bin/env/env.1
==
--- head/usr.bin/env/env.1  Thu Nov  7 17:10:33 2019(r354449)
+++ head/usr.bin/env/env.1  Thu Nov  7 17:14:59 2019(r354450)
@@ -31,7 +31,7 @@
 .\" From FreeBSD: src/usr.bin/printenv/printenv.1,v 1.17 2002/11/26 17:33:35 
ru Exp
 .\" $FreeBSD$
 .\"
-.Dd April 17, 2008
+.Dd November 7, 2019
 .Dt ENV 1
 .Os
 .Sh NAME
@@ -39,7 +39,7 @@
 .Nd set environment and execute command, or print environment
 .Sh SYNOPSIS
 .Nm
-.Op Fl iv
+.Op Fl 0iv
 .Op Fl P Ar altpath
 .Op Fl S Ar string
 .Op Fl u Ar name
@@ -64,6 +64,8 @@ is executed.
 .Pp
 The options are as follows:
 .Bl -tag -width indent
+.It Fl 0
+End each output line with NUL, not newline.
 .It Fl i
 Execute the
 .Ar utility
@@ -130,8 +132,15 @@ If no
 .Ar utility
 is specified,
 .Nm
-prints out the names and values
-of the variables in the environment, with one name/value pair per line.
+prints out the names and values of the variables in the environment.
+Each name/value pair is separated by a new line unless
+.Fl 0
+is specified, in which case name/value pairs are separated by NUL.
+Both
+.Fl 0
+and
+.Ar utility
+may not be specified together.
 .\"
 .Ss Details of Fl S \ (split-string) processing
 The processing of the

Modified: head/usr.bin/env/env.c
==
--- head/usr.bin/env/env.c  Thu Nov  7 17:10:33 2019(r354449)
+++ head/usr.bin/env/env.c  Thu Nov  7 17:14:59 2019(r354450)
@@ -59,22 +59,33 @@ int  env_verbosity;
 
 static void usage(void);
 
+/*
+ * Exit codes.
+ */
+#define EXIT_CANCELED  125 /* Internal error prior to exec attempt. */
+#define EXIT_CANNOT_INVOKE 126 /* Program located, but not usable. */
+#define EXIT_ENOENT127 /* Could not find program to exec. */
+
 int
 main(int argc, char **argv)
 {
-   char *altpath, **ep, *p, **parg;
+   char *altpath, **ep, *p, **parg, term;
char *cleanenv[1];
int ch, want_clear;
int rtrn;
 
altpath = NULL;
want_clear = 0;
-   while ((ch = getopt(argc, argv, "-iP:S:u:v")) != -1)
+   term = '\n';
+   while ((ch = getopt(argc, argv, "-0iP:S:u:v")) != -1)
switch(ch) {
case '-':
case 'i':
want_clear = 1;
break;
+   case '0':
+   term = '\0';
+   break;
case 'P':
altpath = strdup(optarg);
break;
@@ -118,6 +129,8 @@ main(int argc, char **argv)
err(EXIT_FAILURE, "setenv %s", *argv);
}
if (*argv) {
+   if (term == '\0')
+   errx(EXIT_CANCELED, "cannot specify command with -0");
if (altpath)
search_paths(altpath, argv);
if (env_verbosity) {
@@ -129,10 +142,11 @@ main(int argc, char **argv)
sleep(1);
}
execvp(*argv, argv);
-   err(errno == ENOENT ? 127 : 126, "%s", *argv);
+   err(errno == ENOENT ? EXIT_ENOENT : EXIT_CANNOT_INVOKE,
+   "%s", *argv);
}
for (ep = environ; *ep; ep++)
-   (void)printf("%s\n", *ep);
+   (void)printf("%s%c", *ep, term);
exit(0);
 }
 
@@ -140,7 +154,7 @@ static void
 usage(void)
 {
(void)fprintf(stderr,
-   "usage: env [-iv] [-P utilpath] [-S string] [-u name]\n"
+   "usage: env [-0iv] [-P utilpath] [-S string] [-u name]\n"
"   [name=value ...] [utility [argument ...]]\n");
exit(1);
 }
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354449 - in head: . libexec libexec/rtld-elf libexec/rtld-elf32 share/mk usr.bin usr.bin/ldd32

2019-11-07 Thread Brooks Davis
Author: brooks
Date: Thu Nov  7 17:10:33 2019
New Revision: 354449
URL: https://svnweb.freebsd.org/changeset/base/354449

Log:
  libcompat: build 32-bit rtld and ldd as part of "everything"
  
  Alter bsd.compat.mk to set MACHINE and MACHINE_ARCH when included
  directly so MD paths in Makefiles work. In the process centralize
  setting them in LIBCOMPATWMAKEENV.
  
  Alter .PATH and CFLAGS settings in work when the Makefile is included.
  
  While here only support LIB32 on supported platforms rather than always
  enabling it and requiring users of MK_LIB32 to filter based
  TARGET/MACHINE_ARCH.
  
  The net effect of this change is to make Makefile.libcompat only build
  compatability libraries.
  
  Reviewed by:  imp, kib
  Obtained from:CheriBSD (conceptually)
  Sponsored by: DARPA, AFRL
  Differential Revision:https://reviews.freebsd.org/D22251

Added:
  head/libexec/rtld-elf32/
  head/libexec/rtld-elf32/Makefile   (contents, props changed)
  head/usr.bin/ldd32/
  head/usr.bin/ldd32/Makefile   (contents, props changed)
Modified:
  head/Makefile.inc1
  head/Makefile.libcompat
  head/libexec/Makefile
  head/libexec/rtld-elf/Makefile
  head/share/mk/bsd.compat.mk
  head/share/mk/src.opts.mk
  head/usr.bin/Makefile

Modified: head/Makefile.inc1
==
--- head/Makefile.inc1  Thu Nov  7 17:00:20 2019(r354448)
+++ head/Makefile.inc1  Thu Nov  7 17:10:33 2019(r354449)
@@ -802,11 +802,10 @@ XCFLAGS+= --sysroot=${WORLDTMP}
 XCFLAGS+=  ${BFLAGS}
 .endif
 
-.if ${MK_LIB32} != "no" && (${TARGET_ARCH} == "amd64" || \
-${TARGET_ARCH} == "powerpc64" || ${TARGET_ARCH:Mmips64*} != "")
+.if ${MK_LIB32} == "yes"
 _LIBCOMPAT= 32
 .include "Makefile.libcompat"
-.elif ${MK_LIBSOFT} != "no" && ${TARGET_ARCH:Marmv[67]*} != ""
+.elif ${MK_LIBSOFT} == "yes"
 _LIBCOMPAT= SOFT
 .include "Makefile.libcompat"
 .endif

Modified: head/Makefile.libcompat
==
--- head/Makefile.libcompat Thu Nov  7 17:00:20 2019(r354448)
+++ head/Makefile.libcompat Thu Nov  7 17:10:33 2019(r354449)
@@ -111,28 +111,10 @@ build${libcompat}: .PHONY
 .endfor
${_+_}cd ${.CURDIR}; \
${LIBCOMPATWMAKE} -f Makefile.inc1 -DNO_FSCHG libraries
-.if ${libcompat} == "32"
-.for _t in ${_obj} all
-.if !defined(NO_RTLD)
-   ${_+_}cd ${.CURDIR}/libexec/rtld-elf; PROG=ld-elf32.so.1 
${LIBCOMPATWMAKE} \
-   -DNO_FSCHG DIRPRFX=libexec/rtld-elf/ ${_t}
-.endif
-   ${_+_}cd ${.CURDIR}/usr.bin/ldd; PROG=ldd32 ${LIBCOMPATWMAKE} \
-   DIRPRFX=usr.bin/ldd ${_t}
-.endfor
-.endif
 
 distribute${libcompat} install${libcompat}: .PHONY
 .for _dir in ${_LC_LIBDIRS.yes}
${_+_}cd ${.CURDIR}/${_dir}; ${LIBCOMPATIMAKE} 
${.TARGET:S/${libcompat}$//}
 .endfor
-.if ${libcompat} == "32"
-.if !defined(NO_RTLD)
-   ${_+_}cd ${.CURDIR}/libexec/rtld-elf; \
-   PROG=ld-elf32.so.1 ${LIBCOMPATIMAKE} ${.TARGET:S/32$//}
-.endif
-   ${_+_}cd ${.CURDIR}/usr.bin/ldd; PROG=ldd32 ${LIBCOMPATIMAKE} \
-   ${.TARGET:S/32$//}
-.endif
 
-.endif
+.endif # !targets(__<${_this:T}>__)

Modified: head/libexec/Makefile
==
--- head/libexec/Makefile   Thu Nov  7 17:00:20 2019(r354448)
+++ head/libexec/Makefile   Thu Nov  7 17:10:33 2019(r354449)
@@ -74,6 +74,7 @@ _tftp-proxy=  tftp-proxy
 
 .if !defined(NO_PIC) && !defined(NO_RTLD)
 _rtld-elf= rtld-elf
+SUBDIR.${MK_LIB32}+=   rtld-elf32
 .endif
 
 .if ${MK_RBOOTD} != "no"

Modified: head/libexec/rtld-elf/Makefile
==
--- head/libexec/rtld-elf/Makefile  Thu Nov  7 17:00:20 2019
(r354448)
+++ head/libexec/rtld-elf/Makefile  Thu Nov  7 17:10:33 2019
(r354449)
@@ -4,6 +4,8 @@
 # linker:
 # make DEBUG_FLAGS=-g WITHOUT_TESTS=yes all
 
+RTLD_ELF_DIR:= ${.PARSEDIR}
+
 .include 
 PACKAGE=   clibs
 MK_PIE=no # Always position independent using local rules
@@ -25,16 +27,16 @@ SRCS= \
xmalloc.c \
debug.c \
libmap.c
-MAN=   rtld.1
+MAN?=  rtld.1
 CSTD?= gnu99
 CFLAGS+=   -Wall -DFREEBSD_ELF -DIN_RTLD -ffreestanding
 CFLAGS+=   -I${SRCTOP}/lib/csu/common
-.if exists(${.CURDIR}/${MACHINE_ARCH})
+.if exists(${RTLD_ELF_DIR}/${MACHINE_ARCH})
 RTLD_ARCH= ${MACHINE_ARCH}
 .else
 RTLD_ARCH= ${MACHINE_CPUARCH}
 .endif
-CFLAGS+=   -I${.CURDIR}/${RTLD_ARCH} -I${.CURDIR}
+CFLAGS+=   -I${RTLD_ELF_DIR}/${RTLD_ARCH} -I${RTLD_ELF_DIR}
 .if ${MACHINE_ARCH} == "powerpc64"
 LDFLAGS+=  -nostdlib -e _rtld_start
 .else
@@ -81,16 +83,16 @@ LIBADD+=compiler_rt
 
 .if ${MK_SYMVER} == "yes"
 VERSION_DEF=   ${LIBCSRCDIR}/Versions.def
-SYMBOL_MAPS=   ${.CURDIR}/Symbol.map
+SYMBOL_MAPS=   ${RTLD_ELF_DIR}/Symbol.map
 VERSION_MAP=   

svn commit: r354448 - head/sys/netinet6

2019-11-07 Thread Gleb Smirnoff
Author: glebius
Date: Thu Nov  7 17:00:20 2019
New Revision: 354448
URL: https://svnweb.freebsd.org/changeset/base/354448

Log:
  Widen network epoch coverage in nd6_prefix_onlink() as
  in6ifa_ifpforlinklocal() requires the epoch.
  
  Reported by:  bz
  Reviewed by:  bz

Modified:
  head/sys/netinet6/nd6_rtr.c

Modified: head/sys/netinet6/nd6_rtr.c
==
--- head/sys/netinet6/nd6_rtr.c Thu Nov  7 15:51:44 2019(r354447)
+++ head/sys/netinet6/nd6_rtr.c Thu Nov  7 17:00:20 2019(r354448)
@@ -1974,6 +1974,7 @@ nd6_prefix_onlink_rtrequest(struct nd_prefix *pr, stru
 int
 nd6_prefix_onlink(struct nd_prefix *pr)
 {
+   struct epoch_tracker et;
struct ifaddr *ifa;
struct ifnet *ifp = pr->ndpr_ifp;
struct nd_prefix *opr;
@@ -2018,22 +2019,20 @@ nd6_prefix_onlink(struct nd_prefix *pr)
 * We prefer link-local addresses as the associated interface address.
 */
/* search for a link-local addr */
+   NET_EPOCH_ENTER(et);
ifa = (struct ifaddr *)in6ifa_ifpforlinklocal(ifp,
IN6_IFF_NOTREADY | IN6_IFF_ANYCAST);
if (ifa == NULL) {
-   struct epoch_tracker et;
-
/* XXX: freebsd does not have ifa_ifwithaf */
-   NET_EPOCH_ENTER(et);
CK_STAILQ_FOREACH(ifa, >if_addrhead, ifa_link) {
if (ifa->ifa_addr->sa_family == AF_INET6) {
ifa_ref(ifa);
break;
}
}
-   NET_EPOCH_EXIT(et);
/* should we care about ia6_flags? */
}
+   NET_EPOCH_EXIT(et);
if (ifa == NULL) {
/*
 * This can still happen, when, for example, we receive an RA
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r354435 - head/stand/efi/libefi

2019-11-07 Thread Warner Losh
On Thu, Nov 7, 2019 at 8:39 AM Toomas Soome  wrote:

>
>
> On 7. Nov 2019, at 17:29, Warner Losh  wrote:
>
>
>
> On Thu, Nov 7, 2019 at 4:17 AM Toomas Soome  wrote:
>
>> Author: tsoome
>> Date: Thu Nov  7 11:17:03 2019
>> New Revision: 354435
>> URL: https://svnweb.freebsd.org/changeset/base/354435
>>
>> Log:
>>   loader: implement fallback efi_devpath_to_name()
>>
>>   UEFI 1.10 on macs does not seem to provide devpath to name translation,
>>   provide our own (limited) version, so we can get information about
>> commmon
>>   devices.
>>
>
> We specifically deleted our own version of this function (it was wrong in
> many ways too) because we thought we could require a minimum UEFI 2.0 for
> full functionality... This sort of function is a total pain to maintain.
>
> I'd prefer the fallback was "you don't get this" rather than bloating the
> code, especially for devices that we don't care about and will never care
> about for booting...
>
> Warner
>
>
>
> I can see why, but then again, try to debug such system…  btw, that
> particular one I debug is MacBookPro11,4 with quad core i7….  not even that
> old hw anyhow.
>
> I’d rather keep some bloat than spend 2-3 days to write code just to get
> any idea what is going on in the machine…
>

Yea, that's surprising... The initial reports we'd received were only from
super-old macbooks. We'd also been told that newer versions were newer UEFI
revisions, so not to worry...  Guess there's some disconnect here. If
there's modern gear that still use this old revision, that's quite useful
to know... we've made other decisions that would exclude 1.2-level
implementations as well...

Warner


> rgds,
> toomas
>
>
>
>
>>   MFC after:1 week
>>
>> Modified:
>>   head/stand/efi/libefi/devpath.c
>>
>> Modified: head/stand/efi/libefi/devpath.c
>>
>> ==
>> --- head/stand/efi/libefi/devpath.c Thu Nov  7 07:21:45 2019
>> (r354434)
>> +++ head/stand/efi/libefi/devpath.c Thu Nov  7 11:17:03 2019
>> (r354435)
>> @@ -29,13 +29,16 @@ __FBSDID("$FreeBSD$");
>>  #include 
>>  #include 
>>  #include 
>> +#include 
>> +#include 
>>
>>  static EFI_GUID ImageDevicePathGUID =
>>  EFI_LOADED_IMAGE_DEVICE_PATH_PROTOCOL_GUID;
>>  static EFI_GUID DevicePathGUID = DEVICE_PATH_PROTOCOL;
>>  static EFI_GUID DevicePathToTextGUID =
>> EFI_DEVICE_PATH_TO_TEXT_PROTOCOL_GUID;
>>  static EFI_DEVICE_PATH_TO_TEXT_PROTOCOL *toTextProtocol;
>> -static EFI_GUID DevicePathFromTextGUID =
>> EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL_GUID;
>> +static EFI_GUID DevicePathFromTextGUID =
>> +EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL_GUID;
>>  static EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL *fromTextProtocol;
>>
>>  EFI_DEVICE_PATH *
>> @@ -64,6 +67,427 @@ efi_lookup_devpath(EFI_HANDLE handle)
>> return (devpath);
>>  }
>>
>> +static char *
>> +efi_make_tail(char *suffix)
>> +{
>> +   char *tail;
>> +
>> +   tail = NULL;
>> +   if (suffix != NULL)
>> +   (void)asprintf(, "/%s", suffix);
>> +   else
>> +   tail = strdup("");
>> +   return (tail);
>> +}
>> +
>> +typedef struct {
>> +   EFI_DEVICE_PATH Header;
>> +   EFI_GUIDGuid;
>> +   UINT8   VendorDefinedData[1];
>> +} __packed VENDOR_DEVICE_PATH_WITH_DATA;
>> +
>> +static char *
>> +efi_vendor_path(const char *type, VENDOR_DEVICE_PATH *node, char *suffix)
>> +{
>> +   uint32_t size = DevicePathNodeLength(>Header) -
>> sizeof(*node);
>> +   VENDOR_DEVICE_PATH_WITH_DATA *dp = (VENDOR_DEVICE_PATH_WITH_DATA
>> *)node;
>> +   char *name, *tail, *head;
>> +   char *uuid;
>> +   int rv;
>> +
>> +   uuid_to_string((const uuid_t *)(void *)>Guid, , );
>> +   if (rv != uuid_s_ok)
>> +   return (NULL);
>> +
>> +   tail = efi_make_tail(suffix);
>> +   rv = asprintf(, "%sVendor(%s)[%x:", type, uuid, size);
>> +   free(uuid);
>> +   if (rv < 0)
>> +   return (NULL);
>> +
>> +   if (DevicePathNodeLength(>Header) > sizeof(*node)) {
>> +   for (uint32_t i = 0; i < size; i++) {
>> +   rv = asprintf(, "%s%02x", head,
>> +   dp->VendorDefinedData[i]);
>> +   if (rv < 0) {
>> +   free(tail);
>> +   free(head);
>> +   return (NULL);
>> +   }
>> +   free(head);
>> +   head = name;
>> +   }
>> +   }
>> +
>> +   if (asprintf(, "%s]%s", head, tail) < 0)
>> +   name = NULL;
>> +   free(head);
>> +   free(tail);
>> +   return (name);
>> +}
>> +
>> +static char *
>> +efi_hw_dev_path(EFI_DEVICE_PATH *node, char *suffix)
>> +{
>> +   uint8_t subtype = DevicePathSubType(node);
>> +   char *name, *tail;
>> +
>> +   tail = efi_make_tail(suffix);
>> +   switch (subtype) {
>> +   case HW_PCI_DP:
>> 

svn commit: r354447 - head/sys/compat/linux

2019-11-07 Thread Ed Maste
Author: emaste
Date: Thu Nov  7 15:51:44 2019
New Revision: 354447
URL: https://svnweb.freebsd.org/changeset/base/354447

Log:
  linux_renameat2: improve flag checks
  
  In the cases where Linux returns an error (e.g. passing in an undefined
  flag) there's no need for us to emit a message.  (The target of this
  message is a developer working on the linuxulatorm, not the author of
  presumably broken Linux software).
  
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D21606

Modified:
  head/sys/compat/linux/linux_file.c
  head/sys/compat/linux/linux_file.h

Modified: head/sys/compat/linux/linux_file.c
==
--- head/sys/compat/linux/linux_file.c  Thu Nov  7 15:48:46 2019
(r354446)
+++ head/sys/compat/linux/linux_file.c  Thu Nov  7 15:51:44 2019
(r354447)
@@ -704,6 +704,13 @@ linux_renameat2(struct thread *td, struct linux_rename
int error, olddfd, newdfd;
 
if (args->flags != 0) {
+   if (args->flags & ~(LINUX_RENAME_EXCHANGE |
+   LINUX_RENAME_NOREPLACE | LINUX_RENAME_WHITEOUT))
+   return (EINVAL);
+   if (args->flags & LINUX_RENAME_EXCHANGE &&
+   args->flags & (LINUX_RENAME_NOREPLACE |
+   LINUX_RENAME_WHITEOUT))
+   return (EINVAL);
linux_msg(td, "renameat2 unsupported flags 0x%x",
args->flags);
return (EINVAL);

Modified: head/sys/compat/linux/linux_file.h
==
--- head/sys/compat/linux/linux_file.h  Thu Nov  7 15:48:46 2019
(r354446)
+++ head/sys/compat/linux/linux_file.h  Thu Nov  7 15:51:44 2019
(r354447)
@@ -127,4 +127,11 @@
 #defineLINUX_F_UNLCK   2
 #endif
 
+/*
+ * renameat2 flags
+ */
+#defineLINUX_RENAME_NOREPLACE  0x0001
+#defineLINUX_RENAME_EXCHANGE   0x0002
+#defineLINUX_RENAME_WHITEOUT   0x0004
+
 #endif /* !_LINUX_FILE_H_ */
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354446 - head/libexec/rc

2019-11-07 Thread Ed Maste
Author: emaste
Date: Thu Nov  7 15:48:46 2019
New Revision: 354446
URL: https://svnweb.freebsd.org/changeset/base/354446

Log:
  rc.shutdown: print a newline before watchdog timeout message
  
  Previously the watchdog timeout message was appended to the last entry
  in the "Waiting for PIDS" list, resulting in a message like
  
  Waiting for PIDS: 31299 31296 90201 9020090 second watchdog timeout
  expired. Shutdown terminated.
  
  Print a newline to separate the watchdog timeout message.  Also perform
  the kill before logging or echoing the message.
  
  PR:   241072
  MFC after:1 month
  Sponsored by: The FreeBSD Foundation

Modified:
  head/libexec/rc/rc.shutdown

Modified: head/libexec/rc/rc.shutdown
==
--- head/libexec/rc/rc.shutdown Thu Nov  7 15:47:05 2019(r354445)
+++ head/libexec/rc/rc.shutdown Thu Nov  7 15:48:46 2019(r354446)
@@ -69,12 +69,13 @@ _rcshutdown_watchdog=
 if [ -n "$rcshutdown_timeout" ]; then
debug "Initiating watchdog timer."
sleep $rcshutdown_timeout && (
+   kill -KILL $$ >/dev/null 2>&1
_msg="$rcshutdown_timeout second watchdog"
_msg="$_msg timeout expired. Shutdown terminated."
logger -t rc.shutdown "$_msg"
+   echo
echo "$_msg"
date
-   kill -KILL $$ >/dev/null 2>&1
) &
_rcshutdown_watchdog=$!
 fi
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354445 - head/share/man/man4

2019-11-07 Thread Ed Maste
Author: emaste
Date: Thu Nov  7 15:47:05 2019
New Revision: 354445
URL: https://svnweb.freebsd.org/changeset/base/354445

Log:
  nvdimm.4: small grammar improvements

Modified:
  head/share/man/man4/nvdimm.4

Modified: head/share/man/man4/nvdimm.4
==
--- head/share/man/man4/nvdimm.4Thu Nov  7 15:32:59 2019
(r35)
+++ head/share/man/man4/nvdimm.4Thu Nov  7 15:47:05 2019
(r354445)
@@ -121,12 +121,12 @@ and then updated by
 .Sh BUGS
 The
 .Nm
-driver does not utilize the Block Window interface, so if the write to
-NVDIMM was interrupted due to a system crash or power outage,
-the corresponding page might be left in partially updated state.
+driver does not utilize the Block Window interface, so if a write to an
+NVDIMM is interrupted due to a system crash or power outage,
+the corresponding page might be left in a partially updated state.
 .Pp
 There is no support for Device-Specific Methods (DSM), used to report and
-control the device health and wearing.
+control device health and wearing.
 .Pp
 The driver depends on the
 .Xr pmap_largemap 9
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r354435 - head/stand/efi/libefi

2019-11-07 Thread Toomas Soome via svn-src-all


> On 7. Nov 2019, at 17:29, Warner Losh  wrote:
> 
> 
> 
> On Thu, Nov 7, 2019 at 4:17 AM Toomas Soome  > wrote:
> Author: tsoome
> Date: Thu Nov  7 11:17:03 2019
> New Revision: 354435
> URL: https://svnweb.freebsd.org/changeset/base/354435 
> 
> 
> Log:
>   loader: implement fallback efi_devpath_to_name()
> 
>   UEFI 1.10 on macs does not seem to provide devpath to name translation,
>   provide our own (limited) version, so we can get information about commmon
>   devices.
> 
> We specifically deleted our own version of this function (it was wrong in 
> many ways too) because we thought we could require a minimum UEFI 2.0 for 
> full functionality... This sort of function is a total pain to maintain.
> 
> I'd prefer the fallback was "you don't get this" rather than bloating the 
> code, especially for devices that we don't care about and will never care 
> about for booting...
> 
> Warner


I can see why, but then again, try to debug such system…  btw, that particular 
one I debug is MacBookPro11,4 with quad core i7….  not even that old hw anyhow.

I’d rather keep some bloat than spend 2-3 days to write code just to get any 
idea what is going on in the machine…

rgds,
toomas


>  
>   MFC after:1 week
> 
> Modified:
>   head/stand/efi/libefi/devpath.c
> 
> Modified: head/stand/efi/libefi/devpath.c
> ==
> --- head/stand/efi/libefi/devpath.c Thu Nov  7 07:21:45 2019
> (r354434)
> +++ head/stand/efi/libefi/devpath.c Thu Nov  7 11:17:03 2019
> (r354435)
> @@ -29,13 +29,16 @@ __FBSDID("$FreeBSD$");
>  #include 
>  #include 
>  #include 
> +#include 
> +#include 
> 
>  static EFI_GUID ImageDevicePathGUID =
>  EFI_LOADED_IMAGE_DEVICE_PATH_PROTOCOL_GUID;
>  static EFI_GUID DevicePathGUID = DEVICE_PATH_PROTOCOL;
>  static EFI_GUID DevicePathToTextGUID = EFI_DEVICE_PATH_TO_TEXT_PROTOCOL_GUID;
>  static EFI_DEVICE_PATH_TO_TEXT_PROTOCOL *toTextProtocol;
> -static EFI_GUID DevicePathFromTextGUID = 
> EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL_GUID;
> +static EFI_GUID DevicePathFromTextGUID =
> +EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL_GUID;
>  static EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL *fromTextProtocol;
> 
>  EFI_DEVICE_PATH *
> @@ -64,6 +67,427 @@ efi_lookup_devpath(EFI_HANDLE handle)
> return (devpath);
>  }
> 
> +static char *
> +efi_make_tail(char *suffix)
> +{
> +   char *tail;
> +
> +   tail = NULL;
> +   if (suffix != NULL)
> +   (void)asprintf(, "/%s", suffix);
> +   else
> +   tail = strdup("");
> +   return (tail);
> +}
> +
> +typedef struct {
> +   EFI_DEVICE_PATH Header;
> +   EFI_GUIDGuid;
> +   UINT8   VendorDefinedData[1];
> +} __packed VENDOR_DEVICE_PATH_WITH_DATA;
> +
> +static char *
> +efi_vendor_path(const char *type, VENDOR_DEVICE_PATH *node, char *suffix)
> +{
> +   uint32_t size = DevicePathNodeLength(>Header) - sizeof(*node);
> +   VENDOR_DEVICE_PATH_WITH_DATA *dp = (VENDOR_DEVICE_PATH_WITH_DATA 
> *)node;
> +   char *name, *tail, *head;
> +   char *uuid;
> +   int rv;
> +
> +   uuid_to_string((const uuid_t *)(void *)>Guid, , );
> +   if (rv != uuid_s_ok)
> +   return (NULL);
> +
> +   tail = efi_make_tail(suffix);
> +   rv = asprintf(, "%sVendor(%s)[%x:", type, uuid, size);
> +   free(uuid);
> +   if (rv < 0)
> +   return (NULL);
> +
> +   if (DevicePathNodeLength(>Header) > sizeof(*node)) {
> +   for (uint32_t i = 0; i < size; i++) {
> +   rv = asprintf(, "%s%02x", head,
> +   dp->VendorDefinedData[i]);
> +   if (rv < 0) {
> +   free(tail);
> +   free(head);
> +   return (NULL);
> +   }
> +   free(head);
> +   head = name;
> +   }
> +   }
> +
> +   if (asprintf(, "%s]%s", head, tail) < 0)
> +   name = NULL;
> +   free(head);
> +   free(tail);
> +   return (name);
> +}
> +
> +static char *
> +efi_hw_dev_path(EFI_DEVICE_PATH *node, char *suffix)
> +{
> +   uint8_t subtype = DevicePathSubType(node);
> +   char *name, *tail;
> +
> +   tail = efi_make_tail(suffix);
> +   switch (subtype) {
> +   case HW_PCI_DP:
> +   if (asprintf(, "Pci(%x,%x)%s",
> +   ((PCI_DEVICE_PATH *)node)->Function,
> +   ((PCI_DEVICE_PATH *)node)->Device, tail) < 0)
> +   name = NULL;
> +   break;
> +   case HW_PCCARD_DP:
> +   if (asprintf(, "PCCARD(%x)%s",
> +   ((PCCARD_DEVICE_PATH *)node)->FunctionNumber, tail) < 0)
> +   name = NULL;
> +   break;
> +   case HW_MEMMAP_DP:
> 

svn commit: r354444 - in stable/12/sys: cddl/contrib/opensolaris/uts/common/fs/zfs sys vm

2019-11-07 Thread Konstantin Belousov
Author: kib
Date: Thu Nov  7 15:32:59 2019
New Revision: 35
URL: https://svnweb.freebsd.org/changeset/base/35

Log:
  MFC r353892:
  Assert that vnode_pager_setsize() is called with the vnode exclusively locked.

Modified:
  stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c
  stable/12/sys/sys/mount.h
  stable/12/sys/vm/vnode_pager.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c
==
--- stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c   
Thu Nov  7 15:00:37 2019(r354443)
+++ stable/12/sys/cddl/contrib/opensolaris/uts/common/fs/zfs/zfs_vfsops.c   
Thu Nov  7 15:32:59 2019(r35)
@@ -1400,6 +1400,7 @@ zfs_domount(vfs_t *vfsp, char *osname)
vfsp->mnt_kern_flag |= MNTK_SHARED_WRITES;
vfsp->mnt_kern_flag |= MNTK_EXTENDED_SHARED;
vfsp->mnt_kern_flag |= MNTK_NO_IOPF;/* vn_io_fault can be used */
+   vfsp->mnt_kern_flag |= MNTK_VMSETSIZE_BUG;
 
/*
 * The fsid is 64 bits, composed of an 8-bit fs type, which

Modified: stable/12/sys/sys/mount.h
==
--- stable/12/sys/sys/mount.h   Thu Nov  7 15:00:37 2019(r354443)
+++ stable/12/sys/sys/mount.h   Thu Nov  7 15:32:59 2019(r35)
@@ -396,6 +396,7 @@ void  __mnt_vnode_markerfree_active(struct vno
 #defineMNTK_UNMAPPED_BUFS  0x2000
 #defineMNTK_USES_BCACHE0x4000 /* FS uses the buffer cache. 
*/
 #defineMNTK_TEXT_REFS  0x8000 /* Keep use ref for text */
+#defineMNTK_VMSETSIZE_BUG  0x0001
 #define MNTK_NOASYNC   0x0080  /* disable async */
 #define MNTK_UNMOUNT   0x0100  /* unmount in progress */
 #defineMNTK_MWAIT  0x0200  /* waiting for unmount to 
finish */

Modified: stable/12/sys/vm/vnode_pager.c
==
--- stable/12/sys/vm/vnode_pager.c  Thu Nov  7 15:00:37 2019
(r354443)
+++ stable/12/sys/vm/vnode_pager.c  Thu Nov  7 15:32:59 2019
(r35)
@@ -433,7 +433,16 @@ vnode_pager_setsize(struct vnode *vp, vm_ooffset_t nsi
 
if ((object = vp->v_object) == NULL)
return;
-/* ASSERT_VOP_ELOCKED(vp, "vnode_pager_setsize and not locked vnode"); */
+#ifdef DEBUG_VFS_LOCKS
+   {
+   struct mount *mp;
+
+   mp = vp->v_mount;
+   if (mp != NULL && (mp->mnt_kern_flag & MNTK_VMSETSIZE_BUG) == 0)
+   assert_vop_elocked(vp,
+   "vnode_pager_setsize and not locked vnode");
+   }
+#endif
VM_OBJECT_WLOCK(object);
if (object->type == OBJT_DEAD) {
VM_OBJECT_WUNLOCK(object);
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


Re: svn commit: r354435 - head/stand/efi/libefi

2019-11-07 Thread Warner Losh
On Thu, Nov 7, 2019 at 4:17 AM Toomas Soome  wrote:

> Author: tsoome
> Date: Thu Nov  7 11:17:03 2019
> New Revision: 354435
> URL: https://svnweb.freebsd.org/changeset/base/354435
>
> Log:
>   loader: implement fallback efi_devpath_to_name()
>
>   UEFI 1.10 on macs does not seem to provide devpath to name translation,
>   provide our own (limited) version, so we can get information about
> commmon
>   devices.
>

We specifically deleted our own version of this function (it was wrong in
many ways too) because we thought we could require a minimum UEFI 2.0 for
full functionality... This sort of function is a total pain to maintain.

I'd prefer the fallback was "you don't get this" rather than bloating the
code, especially for devices that we don't care about and will never care
about for booting...

Warner


>   MFC after:1 week
>
> Modified:
>   head/stand/efi/libefi/devpath.c
>
> Modified: head/stand/efi/libefi/devpath.c
>
> ==
> --- head/stand/efi/libefi/devpath.c Thu Nov  7 07:21:45 2019
> (r354434)
> +++ head/stand/efi/libefi/devpath.c Thu Nov  7 11:17:03 2019
> (r354435)
> @@ -29,13 +29,16 @@ __FBSDID("$FreeBSD$");
>  #include 
>  #include 
>  #include 
> +#include 
> +#include 
>
>  static EFI_GUID ImageDevicePathGUID =
>  EFI_LOADED_IMAGE_DEVICE_PATH_PROTOCOL_GUID;
>  static EFI_GUID DevicePathGUID = DEVICE_PATH_PROTOCOL;
>  static EFI_GUID DevicePathToTextGUID =
> EFI_DEVICE_PATH_TO_TEXT_PROTOCOL_GUID;
>  static EFI_DEVICE_PATH_TO_TEXT_PROTOCOL *toTextProtocol;
> -static EFI_GUID DevicePathFromTextGUID =
> EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL_GUID;
> +static EFI_GUID DevicePathFromTextGUID =
> +EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL_GUID;
>  static EFI_DEVICE_PATH_FROM_TEXT_PROTOCOL *fromTextProtocol;
>
>  EFI_DEVICE_PATH *
> @@ -64,6 +67,427 @@ efi_lookup_devpath(EFI_HANDLE handle)
> return (devpath);
>  }
>
> +static char *
> +efi_make_tail(char *suffix)
> +{
> +   char *tail;
> +
> +   tail = NULL;
> +   if (suffix != NULL)
> +   (void)asprintf(, "/%s", suffix);
> +   else
> +   tail = strdup("");
> +   return (tail);
> +}
> +
> +typedef struct {
> +   EFI_DEVICE_PATH Header;
> +   EFI_GUIDGuid;
> +   UINT8   VendorDefinedData[1];
> +} __packed VENDOR_DEVICE_PATH_WITH_DATA;
> +
> +static char *
> +efi_vendor_path(const char *type, VENDOR_DEVICE_PATH *node, char *suffix)
> +{
> +   uint32_t size = DevicePathNodeLength(>Header) -
> sizeof(*node);
> +   VENDOR_DEVICE_PATH_WITH_DATA *dp = (VENDOR_DEVICE_PATH_WITH_DATA
> *)node;
> +   char *name, *tail, *head;
> +   char *uuid;
> +   int rv;
> +
> +   uuid_to_string((const uuid_t *)(void *)>Guid, , );
> +   if (rv != uuid_s_ok)
> +   return (NULL);
> +
> +   tail = efi_make_tail(suffix);
> +   rv = asprintf(, "%sVendor(%s)[%x:", type, uuid, size);
> +   free(uuid);
> +   if (rv < 0)
> +   return (NULL);
> +
> +   if (DevicePathNodeLength(>Header) > sizeof(*node)) {
> +   for (uint32_t i = 0; i < size; i++) {
> +   rv = asprintf(, "%s%02x", head,
> +   dp->VendorDefinedData[i]);
> +   if (rv < 0) {
> +   free(tail);
> +   free(head);
> +   return (NULL);
> +   }
> +   free(head);
> +   head = name;
> +   }
> +   }
> +
> +   if (asprintf(, "%s]%s", head, tail) < 0)
> +   name = NULL;
> +   free(head);
> +   free(tail);
> +   return (name);
> +}
> +
> +static char *
> +efi_hw_dev_path(EFI_DEVICE_PATH *node, char *suffix)
> +{
> +   uint8_t subtype = DevicePathSubType(node);
> +   char *name, *tail;
> +
> +   tail = efi_make_tail(suffix);
> +   switch (subtype) {
> +   case HW_PCI_DP:
> +   if (asprintf(, "Pci(%x,%x)%s",
> +   ((PCI_DEVICE_PATH *)node)->Function,
> +   ((PCI_DEVICE_PATH *)node)->Device, tail) < 0)
> +   name = NULL;
> +   break;
> +   case HW_PCCARD_DP:
> +   if (asprintf(, "PCCARD(%x)%s",
> +   ((PCCARD_DEVICE_PATH *)node)->FunctionNumber, tail) <
> 0)
> +   name = NULL;
> +   break;
> +   case HW_MEMMAP_DP:
> +   if (asprintf(, "MMap(%x,%" PRIx64 ",%" PRIx64 ")%s",
> +   ((MEMMAP_DEVICE_PATH *)node)->MemoryType,
> +   ((MEMMAP_DEVICE_PATH *)node)->StartingAddress,
> +   ((MEMMAP_DEVICE_PATH *)node)->EndingAddress, tail) < 0)
> +   name = NULL;
> +   break;
> +   case HW_VENDOR_DP:
> +   name = efi_vendor_path("Hardware",
> +   (VENDOR_DEVICE_PATH *)node, 

Re: svn commit: r354286 - in head/sys/arm64: arm64 include

2019-11-07 Thread Ed Maste
On Sun, 3 Nov 2019 at 16:39, Alan Cox  wrote:
>
> Author: alc
> Date: Sun Nov  3 17:45:30 2019
> New Revision: 354286
> URL: https://svnweb.freebsd.org/changeset/base/354286
>
> Log:
>   Utilize ASIDs to reduce both the direct and indirect costs of context

I built a full pkg set on an Ampere eMAG on 2019-09-11, and again on
2019-11-04 after this change went in. The second build included
TRYBROKEN so tried to build more ports and took slightly more time
overall, but comparing the overall build duration (wall clock) of
various ports is illustrative.

llvm90 took the longest to build; it was 21:15:58 in the first run and
19:54:32 in the second. qt5-webkit went from 12:13:21 to 11:39:21.
rust went from 15:14:46 to 13:49:50. firefox from 7:24:21 to 7:08:35.
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354443 - head/sys/net

2019-11-07 Thread Andrey V. Elsukov
Author: ae
Date: Thu Nov  7 15:00:37 2019
New Revision: 354443
URL: https://svnweb.freebsd.org/changeset/base/354443

Log:
  Enqueue lladdr_task to update link level address of vlan, when its parent
  interface has changed.
  
  During vlan reconfiguration without destroying interface, it is possible,
  that parent interface will be changed. This usually means, that link
  layer address of vlan will be different. Therefore we need to update all
  associated with vlan's addresses permanent llentries - NDP for IPv6
  addresses, and ARP for IPv4 addresses. This is done via lladdr_task
  execution. To avoid extra work, before execution do the check, that L2
  address is different.
  
  No objection from:#network
  Obtained from:Yandex LLC
  MFC after:1 week
  Sponsored by: Yandex LLC
  Differential Revision:https://reviews.freebsd.org/D22243

Modified:
  head/sys/net/if_vlan.c

Modified: head/sys/net/if_vlan.c
==
--- head/sys/net/if_vlan.c  Thu Nov  7 14:16:55 2019(r354442)
+++ head/sys/net/if_vlan.c  Thu Nov  7 15:00:37 2019(r354443)
@@ -1459,11 +1459,19 @@ vlan_config(struct ifvlan *ifv, struct ifnet *p, uint1
 * Set up our interface address to reflect the underlying
 * physical interface's.
 */
-   bcopy(IF_LLADDR(p), IF_LLADDR(ifp), p->if_addrlen);
+   TASK_INIT(>lladdr_task, 0, vlan_lladdr_fn, ifv);
((struct sockaddr_dl *)ifp->if_addr->ifa_addr)->sdl_alen =
p->if_addrlen;
 
-   TASK_INIT(>lladdr_task, 0, vlan_lladdr_fn, ifv);
+   /*
+* Do not schedule link address update if it was the same
+* as previous parent's. This helps avoid updating for each
+* associated llentry.
+*/
+   if (memcmp(IF_LLADDR(p), IF_LLADDR(ifp), p->if_addrlen) != 0) {
+   bcopy(IF_LLADDR(p), IF_LLADDR(ifp), p->if_addrlen);
+   taskqueue_enqueue(taskqueue_thread, >lladdr_task);
+   }
 
/* We are ready for operation now. */
ifp->if_drv_flags |= IFF_DRV_RUNNING;
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354441 - head/share/man/man7

2019-11-07 Thread Ed Maste
Author: emaste
Date: Thu Nov  7 14:14:51 2019
New Revision: 354441
URL: https://svnweb.freebsd.org/changeset/base/354441

Log:
  arch.7: armv6 uses lld by default as of r354289

Modified:
  head/share/man/man7/arch.7

Modified: head/share/man/man7/arch.7
==
--- head/share/man/man7/arch.7  Thu Nov  7 13:12:38 2019(r354440)
+++ head/share/man/man7/arch.7  Thu Nov  7 14:14:51 2019(r354441)
@@ -26,7 +26,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd October 11, 2019
+.Dd November 7, 2019
 .Dt ARCH 7
 .Os
 .Sh NAME
@@ -316,7 +316,7 @@ This table shows the default tool chain for each archi
 .It aarch64 Ta Clang Ta lld
 .It amd64   Ta Clang Ta lld
 .It arm Ta Clang Ta GNU ld 2.17.50
-.It armv6   Ta Clang Ta GNU ld 2.17.50
+.It armv6   Ta Clang Ta lld
 .It armv7   Ta Clang Ta lld
 .It i386Ta Clang Ta lld
 .It mipsTa GCC 4.2.1 Ta GNU ld 2.17.50
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


svn commit: r354440 - stable/12/sys/dev/mlx5/mlx5_en

2019-11-07 Thread Hans Petter Selasky
Author: hselasky
Date: Thu Nov  7 13:12:38 2019
New Revision: 354440
URL: https://svnweb.freebsd.org/changeset/base/354440

Log:
  Check CSUM_SND_TAG flag before classifying packet has having a send
  tag in mlx5en(4). This fixes an issue with packets being dropped when
  doing packet forwarding, because the rcvif field is still set. The
  send tag pointer and rcvif field share the same memory location.
  
  This is a direct commit.
  
  Reported by:  olivier@
  Sponsored by: Mellanox Technologies

Modified:
  stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c

Modified: stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c
==
--- stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c Thu Nov  7 13:01:09 2019
(r354439)
+++ stable/12/sys/dev/mlx5/mlx5_en/mlx5_en_tx.c Thu Nov  7 13:12:38 2019
(r354440)
@@ -609,7 +609,8 @@ mlx5e_xmit(struct ifnet *ifp, struct mbuf *mb)
struct mlx5e_sq *sq;
int ret;
 
-   if (mb->m_pkthdr.snd_tag != NULL) {
+   if ((mb->m_pkthdr.csum_flags & CSUM_SND_TAG) != 0 &&
+   (mb->m_pkthdr.snd_tag != NULL)) {
sq = mlx5e_select_queue_by_send_tag(ifp, mb);
if (unlikely(sq == NULL)) {
/* Check for route change */
___
svn-src-all@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-all
To unsubscribe, send any mail to "svn-src-all-unsubscr...@freebsd.org"


  1   2   >