svn commit: r362982 - head

2020-07-06 Thread Gleb Smirnoff
Author: glebius
Date: Tue Jul  7 02:43:53 2020
New Revision: 362982
URL: https://svnweb.freebsd.org/changeset/base/362982

Log:
  Fixup r362981: remove gzipped manual pages.
  
  Pointy hat to:glebius

Modified:
  head/ObsoleteFiles.inc

Modified: head/ObsoleteFiles.inc
==
--- head/ObsoleteFiles.inc  Tue Jul  7 02:41:51 2020(r362981)
+++ head/ObsoleteFiles.inc  Tue Jul  7 02:43:53 2020(r362982)
@@ -37,10 +37,10 @@
 # done
 
 # 20200706: update of sglist(9), r360574
-OLD_FILES+=usr/share/man/man9/sglist_append_ext_pgs.9
-OLD_FILES+=usr/share/man/man9/sglist_append_mb_ext_pgs.9
-OLD_FILES+=usr/share/man/man9/sglist_count_ext_pgs.9
-OLD_FILES+=usr/share/man/man9/sglist_count_mb_ext_pgs.9
+OLD_FILES+=usr/share/man/man9/sglist_append_ext_pgs.9.gz
+OLD_FILES+=usr/share/man/man9/sglist_append_mb_ext_pgs.9.gz
+OLD_FILES+=usr/share/man/man9/sglist_count_ext_pgs.9.gz
+OLD_FILES+=usr/share/man/man9/sglist_count_mb_ext_pgs.9.gz
 
 # 20200617: update opencsd to 0.14.2
 OLD_FILES+=usr/include/opencsd/etmv4/trc_pkt_elem_etmv4d.h
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r362981 - in head: . share/man/man9

2020-07-06 Thread Gleb Smirnoff
Author: glebius
Date: Tue Jul  7 02:41:51 2020
New Revision: 362981
URL: https://svnweb.freebsd.org/changeset/base/362981

Log:
  Fixup for r360574: install new mlinks for sglist(9) and remove old ones.

Modified:
  head/ObsoleteFiles.inc
  head/share/man/man9/Makefile

Modified: head/ObsoleteFiles.inc
==
--- head/ObsoleteFiles.inc  Tue Jul  7 00:42:23 2020(r362980)
+++ head/ObsoleteFiles.inc  Tue Jul  7 02:41:51 2020(r362981)
@@ -36,6 +36,12 @@
 #   xargs -n1 | sort | uniq -d;
 # done
 
+# 20200706: update of sglist(9), r360574
+OLD_FILES+=usr/share/man/man9/sglist_append_ext_pgs.9
+OLD_FILES+=usr/share/man/man9/sglist_append_mb_ext_pgs.9
+OLD_FILES+=usr/share/man/man9/sglist_count_ext_pgs.9
+OLD_FILES+=usr/share/man/man9/sglist_count_mb_ext_pgs.9
+
 # 20200617: update opencsd to 0.14.2
 OLD_FILES+=usr/include/opencsd/etmv4/trc_pkt_elem_etmv4d.h
 

Modified: head/share/man/man9/Makefile
==
--- head/share/man/man9/MakefileTue Jul  7 00:42:23 2020
(r362980)
+++ head/share/man/man9/MakefileTue Jul  7 02:41:51 2020
(r362981)
@@ -1902,9 +1902,8 @@ MLINKS+=sf_buf.9 sf_buf_alloc.9 \
 MLINKS+=sglist.9 sglist_alloc.9 \
sglist.9 sglist_append.9 \
sglist.9 sglist_append_bio.9 \
-   sglist.9 sglist_append_ext_pgs.9 \
-   sglist.9 sglist_append_mb_ext_pgs.9 \
sglist.9 sglist_append_mbuf.9 \
+   sglist.9 sglist_append_mbuf_epg.9 \
sglist.9 sglist_append_phys.9 \
sglist.9 sglist_append_sglist.9 \
sglist.9 sglist_append_uio.9 \
@@ -1914,8 +1913,7 @@ MLINKS+=sglist.9 sglist_alloc.9 \
sglist.9 sglist_clone.9 \
sglist.9 sglist_consume_uio.9 \
sglist.9 sglist_count.9 \
-   sglist.9 sglist_count_ext_pgs.9 \
-   sglist.9 sglist_count_mb_ext_pgs.9 \
+   sglist.9 sglist_count_mbuf_epg.9 \
sglist.9 sglist_count_vmpages.9 \
sglist.9 sglist_free.9 \
sglist.9 sglist_hold.9 \
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r362980 - head/sys/fs/nfs

2020-07-06 Thread Rick Macklem
Author: rmacklem
Date: Tue Jul  7 00:42:23 2020
New Revision: 362980
URL: https://svnweb.freebsd.org/changeset/base/362980

Log:
  Add support for ext_pgs mbufs to nfsrvd_rephead().
  
  This is another in the series of commits that add support to the NFS client
  and server for building RPC messages in ext_pgs mbufs with anonymous pages.
  This is useful so that the entire mbuf list does not need to be
  copied before calling sosend() when NFS over TLS is enabled.
  
  Since ND_EXTPG is never set yet, there is no semantic change at this time.

Modified:
  head/sys/fs/nfs/nfs_commonsubs.c

Modified: head/sys/fs/nfs/nfs_commonsubs.c
==
--- head/sys/fs/nfs/nfs_commonsubs.cMon Jul  6 22:39:42 2020
(r362979)
+++ head/sys/fs/nfs/nfs_commonsubs.cTue Jul  7 00:42:23 2020
(r362980)
@@ -4443,21 +4443,30 @@ nfsrvd_rephead(struct nfsrv_descript *nd)
 {
struct mbuf *mreq;
 
-   /*
-* If this is a big reply, use a cluster.
-*/
-   if ((nd->nd_flag & ND_GSSINITREPLY) == 0 &&
-   nfs_bigreply[nd->nd_procnum]) {
-   NFSMCLGET(mreq, M_WAITOK);
-   nd->nd_mreq = mreq;
-   nd->nd_mb = mreq;
+   if ((nd->nd_flag & ND_EXTPG) != 0) {
+   mreq = mb_alloc_ext_plus_pages(PAGE_SIZE, M_WAITOK);
+   nd->nd_mreq = nd->nd_mb = mreq;
+   nd->nd_bpos = (char *)(void *)
+   PHYS_TO_DMAP(mreq->m_epg_pa[0]);
+   nd->nd_bextpg = 0;
+   nd->nd_bextpgsiz = PAGE_SIZE;
} else {
-   NFSMGET(mreq);
-   nd->nd_mreq = mreq;
-   nd->nd_mb = mreq;
+   /*
+* If this is a big reply, use a cluster.
+*/
+   if ((nd->nd_flag & ND_GSSINITREPLY) == 0 &&
+   nfs_bigreply[nd->nd_procnum]) {
+   NFSMCLGET(mreq, M_WAITOK);
+   nd->nd_mreq = mreq;
+   nd->nd_mb = mreq;
+   } else {
+   NFSMGET(mreq);
+   nd->nd_mreq = mreq;
+   nd->nd_mb = mreq;
+   }
+   nd->nd_bpos = mtod(mreq, char *);
+   mreq->m_len = 0;
}
-   nd->nd_bpos = mtod(mreq, caddr_t);
-   mreq->m_len = 0;
 
if ((nd->nd_flag & ND_GSSINITREPLY) == 0)
NFSM_BUILD(nd->nd_errp, int *, NFSX_UNSIGNED);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r362979 - head/cddl/contrib/opensolaris/tools/ctf/cvt

2020-07-06 Thread Brooks Davis
Author: brooks
Date: Mon Jul  6 22:39:42 2020
New Revision: 362979
URL: https://svnweb.freebsd.org/changeset/base/362979

Log:
  Fix a Wvoid-pointer-to-enum-cast warning missed in r359978.
  
  This pattern is used in callbacks with void * data arguments and seems
  both relatively uncommon and relatively harmless.  Silence the warning
  by casting through uintptr_t.
  
  This warning is on by default in Clang 11.
  
  MFC after:3 days
  Sponsored by: DARPA
  Differential Revision:https://reviews.freebsd.org/D24425

Modified:
  head/cddl/contrib/opensolaris/tools/ctf/cvt/iidesc.c

Modified: head/cddl/contrib/opensolaris/tools/ctf/cvt/iidesc.c
==
--- head/cddl/contrib/opensolaris/tools/ctf/cvt/iidesc.cMon Jul  6 
21:39:14 2020(r362978)
+++ head/cddl/contrib/opensolaris/tools/ctf/cvt/iidesc.cMon Jul  6 
22:39:42 2020(r362979)
@@ -179,7 +179,7 @@ int
 iidesc_count_type(void *data, void *private)
 {
iidesc_t *ii = data;
-   iitype_t match = (iitype_t)private;
+   iitype_t match = (iitype_t)(uintptr_t)private;
 
return (ii->ii_type == match);
 }
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r362978 - head/stand

2020-07-06 Thread Mitchell Horne
Author: mhorne
Date: Mon Jul  6 21:39:14 2020
New Revision: 362978
URL: https://svnweb.freebsd.org/changeset/base/362978

Log:
  Fix cleandir target post r362973
  
  Reported by:  mmacy

Modified:
  head/stand/defs.mk

Modified: head/stand/defs.mk
==
--- head/stand/defs.mk  Mon Jul  6 21:29:50 2020(r362977)
+++ head/stand/defs.mk  Mon Jul  6 21:39:14 2020(r362978)
@@ -151,7 +151,7 @@ CFLAGS+=-fPIC
 
 # Some RISC-V linkers have support for relaxations, while some (lld) do not
 # yet. If this is the case we inhibit the compiler from emitting relaxations.
-.if ${LINKER_FEATURES:Mriscv-relaxations} == ""
+.if ${MACHINE_CPUARCH} == "riscv" && ${LINKER_FEATURES:Mriscv-relaxations} == 
""
 CFLAGS+=   -mno-relax
 .endif
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r362977 - head/sys/riscv/riscv

2020-07-06 Thread Kristof Provost
Author: kp
Date: Mon Jul  6 21:29:50 2020
New Revision: 362977
URL: https://svnweb.freebsd.org/changeset/base/362977

Log:
  riscv plic: Do not complete interrupts until the interrupt handler has run
  
  We cannot complete the interrupt (i.e. write to the claims/complete register
  until the interrupt handler has actually run. We don't run the interrupt
  handler immediately from intr_isrc_dispatch(), we only schedule it for later
  execution.
  
  If we immediately complete it (i.e. before the interrupt handler proper has
  run) the interrupt may be triggered again if the interrupt source remains set.
  From RISC-V Instruction Set Manual: Volume II: Priviliged Architecture, 7.4
  Interrupt Gateways:
  
  "If a level-sensitive interrupt source deasserts the interrupt after the PLIC
  core accepts the request and before the interrupt is serviced, the interrupt
  request remains present in the IP bit of the PLIC core and will be serviced by
  a handler, which will then have to determine that the interrupt device no
  longer requires service."
  
  In other words, we may receive interrupts twice.
  
  Avoid that by postponing the completion until after the interrupt handler has
  run.
  
  If the interrupt is handled by a filter rather than by scheduling an interrupt
  thread we must also complete the interrupt, so set up a post_filter handler
  (which is the same as the post_ithread handler).
  
  Reviewed by:  mhorne
  Sponsored by: Axiado
  Differential Revision:https://reviews.freebsd.org/D25531

Modified:
  head/sys/riscv/riscv/plic.c

Modified: head/sys/riscv/riscv/plic.c
==
--- head/sys/riscv/riscv/plic.c Mon Jul  6 21:20:57 2020(r362976)
+++ head/sys/riscv/riscv/plic.c Mon Jul  6 21:29:50 2020(r362977)
@@ -169,11 +169,11 @@ plic_intr(void *arg)
sc = arg;
cpu = PCPU_GET(cpuid);
 
+   /* Claim any pending interrupt. */
pending = RD4(sc, PLIC_CLAIM(sc, cpu));
if (pending) {
tf = curthread->td_intr_frame;
plic_irq_dispatch(sc, pending, tf);
-   WR4(sc, PLIC_CLAIM(sc, cpu), pending);
}
 
return (FILTER_HANDLED);
@@ -384,7 +384,17 @@ plic_pre_ithread(device_t dev, struct intr_irqsrc *isr
 static void
 plic_post_ithread(device_t dev, struct intr_irqsrc *isrc)
 {
+   struct plic_softc *sc;
+   struct plic_irqsrc *src;
+   uint32_t cpu;
 
+   sc = device_get_softc(dev);
+   src = (struct plic_irqsrc *)isrc;
+
+   cpu = CPU_FFS(>isrc_cpu) - 1;
+
+   /* Complete the interrupt. */
+   WR4(sc, PLIC_CLAIM(sc, cpu), src->irq);
plic_enable_intr(dev, isrc);
 }
 
@@ -451,6 +461,7 @@ static device_method_t plic_methods[] = {
DEVMETHOD(pic_map_intr, plic_map_intr),
DEVMETHOD(pic_pre_ithread,  plic_pre_ithread),
DEVMETHOD(pic_post_ithread, plic_post_ithread),
+   DEVMETHOD(pic_post_filter,  plic_post_ithread),
DEVMETHOD(pic_setup_intr,   plic_setup_intr),
DEVMETHOD(pic_bind_intr,plic_bind_intr),
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r362976 - head/sys/net/route

2020-07-06 Thread Mark Johnston
Author: markj
Date: Mon Jul  6 21:20:57 2020
New Revision: 362976
URL: https://svnweb.freebsd.org/changeset/base/362976

Log:
  Split nhop_ref_object().
  
  Now nhop_ref_object() unconditionally acquires a reference, and the new
  nhop_try_ref_object() uses refcount_acquire_if_not_zero() to
  conditionally acquire a reference.  Since the former is cheaper, use it
  when we know that the initial counter value is non-zero.  No functional
  change intended.
  
  Reviewed by:  melifaro
  Differential Revision:https://reviews.freebsd.org/D25535

Modified:
  head/sys/net/route/nhop_ctl.c
  head/sys/net/route/shared.h

Modified: head/sys/net/route/nhop_ctl.c
==
--- head/sys/net/route/nhop_ctl.c   Mon Jul  6 20:23:14 2020
(r362975)
+++ head/sys/net/route/nhop_ctl.c   Mon Jul  6 21:20:57 2020
(r362976)
@@ -598,10 +598,19 @@ destroy_nhop_epoch(epoch_context_t ctx)
destroy_nhop(nh_priv);
 }
 
-int
+void
 nhop_ref_object(struct nhop_object *nh)
 {
+   u_int old;
 
+   old = refcount_acquire(>nh_priv->nh_refcnt);
+   KASSERT(old > 0, ("%s: nhop object %p has 0 refs", __func__, nh));
+}
+
+int
+nhop_try_ref_object(struct nhop_object *nh)
+{
+
return (refcount_acquire_if_not_zero(>nh_priv->nh_refcnt));
 }
 
@@ -654,7 +663,7 @@ int
 nhop_ref_any(struct nhop_object *nh)
 {
 
-   return (nhop_ref_object(nh));
+   return (nhop_try_ref_object(nh));
 }
 
 void

Modified: head/sys/net/route/shared.h
==
--- head/sys/net/route/shared.h Mon Jul  6 20:23:14 2020(r362975)
+++ head/sys/net/route/shared.h Mon Jul  6 21:20:57 2020(r362976)
@@ -51,7 +51,8 @@ struct rib_head;
 void nhops_init(void);
 int nhops_init_rib(struct rib_head *rh);
 void nhops_destroy_rib(struct rib_head *rh);
-int nhop_ref_object(struct nhop_object *nh);
+void nhop_ref_object(struct nhop_object *nh);
+int nhop_try_ref_object(struct nhop_object *nh);
 int nhop_ref_any(struct nhop_object *nh);
 void nhop_free_any(struct nhop_object *nh);
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r362736 - head/sys/arm64/rockchip

2020-07-06 Thread Oleksandr Tymoshenko
Peter Jeremy (pe...@rulingia.com) wrote:
> On 2020-Jul-02 17:26:23 -0700, Oleksandr Tymoshenko  wrote:
> >Could you try kernel with this patch? It's mostly debug output,
> >with one possible clock-related fix.
> >
> >https://people.freebsd.org/~gonzo/patches/rk3328-gmac-debug.patch
> 
> It's still not working for me.  I get the following:
> dwc0:  mem 0xff54-0xff54 irq 44 
> on ofwbus0
> setting RK3328 RX/TX delays:  24/36
> >>> RK3328_GRF_MAC_CON1 (0413):
> >>> gmac2io_gmii_clk_sel: 0x0
> >>> gmac2io_rmii_extclk_sel: 0x1
> >>> gmac2io_rmii_mode: 0x0
> >>> gmac2io_rmii_clk_sel: 0x0
> >>> gmac2io_phy_intf_sel: 0x1
> >>> gmac2io_flowctrl: 0x0
> >>> gmac2io_rxclk_dly_ena: 0x1
> >>> gmac2io_txclk_dly_ena: 0x1
> >>> RK3328_GRF_MAC_CON0 (0c24):
> miibus0:  on dwc0
> rgephy0:  PHY 0 on miibus0
> rgephy0: OUI 0x00e04c, model 0x0011, rev. 6
> rgephy0:  none, 10baseT, 10baseT-FDX, 100baseTX, 100baseTX-FDX, 
> 1000baseT-FDX, 1000baseT-FDX-master, auto

Thanks for running the test. Register values seem OK :(
 
> >I have Rock64 v2, which, as you mentioned, has a known issue with GigE, so
> >my tests are not reliable. I'll try to get another RK3328 board for tests,
> >but it may take some time.
> 
> I've asked on -arm if anyone else has tried this on a Rock64 v2 or v3.
> 
> >If the clock fix doesn't help, I'll make
> >delays configuration run-time configurable with off by default until
> >more hardware is tested.
> 
> That sounds like a good way forward - maybe boot and run-time configurable.
> It's a pity that there doesn't seem to be any documentation on what the
> numbers represent (or what the "default" value is) - which means that
> actually adjusting the delay numbers would be very time consuming.

There are no "default" values AFAIK. They depend on the board schematics.
I was told that Rockhip partners use some kind of proprietary tool
which they feed with values based on the scematics (like trace lengths)
and tool calculates delays.

With boot-time or run-time configuration I think it's possible to
automate the search for good value. Something like this:
https://github.com/ayufan-rock64/linux-build/blob/master/recipes/gmac-delays-test/range-test

but with loader.conf modifications instead of DTB

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


svn commit: r362974 - head/share/man/man5

2020-07-06 Thread Mitchell Horne
Author: mhorne
Date: Mon Jul  6 18:43:00 2020
New Revision: 362974
URL: https://svnweb.freebsd.org/changeset/base/362974

Log:
  src.conf.5: regen after r362972, r362973, RISC-V EFI support

Modified:
  head/share/man/man5/src.conf.5

Modified: head/share/man/man5/src.conf.5
==
--- head/share/man/man5/src.conf.5  Mon Jul  6 18:19:42 2020
(r362973)
+++ head/share/man/man5/src.conf.5  Mon Jul  6 18:43:00 2020
(r362974)
@@ -1,6 +1,6 @@
 .\" DO NOT EDIT-- this file is @generated by tools/build/options/makeman.
 .\" $FreeBSD$
-.Dd June 24, 2020
+.Dd July 6, 2020
 .Dt SRC.CONF 5
 .Os
 .Sh NAME
@@ -585,7 +585,7 @@ and
 .Xr efivar 8 .
 .Pp
 This is a default setting on
-mips/mips, mips/mips64, powerpc/powerpc, powerpc/powerpc64, riscv/riscv64 and 
riscv/riscv64sf.
+mips/mips, mips/mips64, powerpc/powerpc and powerpc/powerpc64.
 .It Va WITH_EFI
 Set to build
 .Xr efivar 3
@@ -593,7 +593,7 @@ and
 .Xr efivar 8 .
 .Pp
 This is a default setting on
-amd64/amd64, arm/armv6, arm/armv7, arm64/aarch64 and i386/i386.
+amd64/amd64, arm/armv6, arm/armv7, arm64/aarch64, i386/i386, riscv/riscv64 and 
riscv/riscv64sf.
 .It Va WITHOUT_ELFTOOLCHAIN_BOOTSTRAP
 Set to not build ELF Tool Chain tools
 (addr2line, nm, size, strings and strip)
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r362973 - in head: share/mk stand stand/common stand/efi/include/riscv stand/efi/libefi stand/efi/loader stand/efi/loader/arch/riscv sys/riscv/include

2020-07-06 Thread Mitchell Horne
On Mon, Jul 6, 2020 at 3:19 PM Mitchell Horne  wrote:
>
> Author: mhorne
> Date: Mon Jul  6 18:19:42 2020
> New Revision: 362973
> URL: https://svnweb.freebsd.org/changeset/base/362973
>
> Log:
>   RISC-V boot1.efi and loader.efi support
>
>   This implementation doesn't have any major deviations from the other EFI
>   ports. I've copied the boilerplate from arm and arm64.
>
>   I've tested this with the following boot flows:
>   OpenSBI (M-mode) -> u-boot (S-mode) -> loader.efi -> FreeBSD
>   OpenSBI (M-mode) -> u-boot (S-mode) -> boot1.efi -> loader.efi -> FreeBSD
>
>   Due to the way that u-boot handles secondary CPUs, OpenSBI >= v0.7 is 
> required,
>   as the HSM extension is needed to bring them up explicitly. Because of this,
>   using BBL as the SBI implementation will not be possible. Additionally, 
> there
>   are a few recent u-boot changes that are required as well, all of which 
> will be
>   present in the upcoming v2020.07 release.
>
>   Looks good:   emaste
>   Differential Revision:https://reviews.freebsd.org/D25135
>
> Added:
>   head/stand/efi/include/riscv/
>   head/stand/efi/include/riscv/efibind.h
>  - copied unchanged from r362787, head/stand/efi/include/arm64/efibind.h
>   head/stand/efi/loader/arch/riscv/
>   head/stand/efi/loader/arch/riscv/Makefile.inc   (contents, props changed)
>   head/stand/efi/loader/arch/riscv/exec.c
>  - copied, changed from r362787, head/stand/efi/loader/arch/arm/exec.c
>   head/stand/efi/loader/arch/riscv/ldscript.riscv   (contents, props changed)
>   head/stand/efi/loader/arch/riscv/start.S   (contents, props changed)
> Modified:
>   head/share/mk/src.opts.mk
>   head/stand/common/self_reloc.c
>   head/stand/defs.mk
>   head/stand/efi/libefi/Makefile
>   head/stand/efi/loader/copy.c
>   head/stand/efi/loader/main.c
>   head/stand/loader.mk
>   head/sys/riscv/include/metadata.h
>
> Modified: head/share/mk/src.opts.mk
> ==
> --- head/share/mk/src.opts.mk   Mon Jul  6 17:47:29 2020(r362972)
> +++ head/share/mk/src.opts.mk   Mon Jul  6 18:19:42 2020(r362973)
> @@ -318,8 +318,8 @@ BROKEN_OPTIONS+=LIBSOFT
>  # marked no longer broken with the switch to LLVM.
>  BROKEN_OPTIONS+=GOOGLETEST SSP
>  .endif
> -# EFI doesn't exist on mips, powerpc, or riscv.
> -.if ${__T:Mmips*} || ${__T:Mpowerpc*} || ${__T:Mriscv*}
> +# EFI doesn't exist on mips or powerpc.
> +.if ${__T:Mmips*} || ${__T:Mpowerpc*}
>  BROKEN_OPTIONS+=EFI
>  .endif
>  # OFW is only for powerpc, exclude others
>

I meant to commit this hunk separately, but included it by mistake.
The log would have been:

Enable MK_EFI by default on RISC-V

We can now build the EFI libraries, utilities, and bootloader. This is
enough for EFI boot-time services and for us to un-break this option.

Reviewed by: br
Differential Revision: https://reviews.freebsd.org/D25137

> Modified: head/stand/common/self_reloc.c
> ==
> --- head/stand/common/self_reloc.c  Mon Jul  6 17:47:29 2020
> (r362972)
> +++ head/stand/common/self_reloc.c  Mon Jul  6 18:19:42 2020
> (r362973)
> @@ -31,7 +31,7 @@ __FBSDID("$FreeBSD$");
>  #include 
>  #include 
>
> -#if defined(__aarch64__) || defined(__amd64__)
> +#if defined(__aarch64__) || defined(__amd64__) || defined(__riscv)
>  #defineElfW_RelElf64_Rela
>  #defineElfW_DynElf64_Dyn
>  #defineELFW_R_TYPE ELF64_R_TYPE
> @@ -55,6 +55,9 @@ __FBSDID("$FreeBSD$");
>  #elif defined(__i386__)
>  #defineRELOC_TYPE_NONE R_386_NONE
>  #defineRELOC_TYPE_RELATIVE R_386_RELATIVE
> +#elif defined(__riscv)
> +#defineRELOC_TYPE_NONE R_RISCV_NONE
> +#defineRELOC_TYPE_RELATIVE R_RISCV_RELATIVE
>  #endif
>
>  void self_reloc(Elf_Addr baseaddr, ElfW_Dyn *dynamic);
>
> Modified: head/stand/defs.mk
> ==
> --- head/stand/defs.mk  Mon Jul  6 17:47:29 2020(r362972)
> +++ head/stand/defs.mk  Mon Jul  6 18:19:42 2020(r362973)
> @@ -115,13 +115,14 @@ AFLAGS+=  --32
>  SSP_CFLAGS=
>
>  # Add in the no float / no SIMD stuff and announce we're freestanding
> -# aarch64 and riscv don't have -msoft-float, but all others do. riscv
> -# currently has no /boot/loader, but may soon.
> +# aarch64 and riscv don't have -msoft-float, but all others do.
>  CFLAGS+=   -ffreestanding ${CFLAGS_NO_SIMD}
>  .if ${MACHINE_CPUARCH} == "aarch64"
>  CFLAGS+=   -mgeneral-regs-only -ffixed-x18 -fPIC
>  .elif ${MACHINE_CPUARCH} == "riscv"
> -CFLAGS+=   -march=rv64imac -mabi=lp64
> +CFLAGS+=   -march=rv64imac -mabi=lp64 -fPIC
> +CFLAGS.clang+= -mcmodel=medium
> +CFLAGS.gcc+=   -mcmodel=medany
>  .else
>  CFLAGS+=   -msoft-float
>  .endif
> @@ -146,6 +147,12 @@ CFLAGS+=   -fPIC -mno-red-zone
>  CFLAGS.clang+= -mno-movt
>  

svn commit: r362973 - in head: share/mk stand stand/common stand/efi/include/riscv stand/efi/libefi stand/efi/loader stand/efi/loader/arch/riscv sys/riscv/include

2020-07-06 Thread Mitchell Horne
Author: mhorne
Date: Mon Jul  6 18:19:42 2020
New Revision: 362973
URL: https://svnweb.freebsd.org/changeset/base/362973

Log:
  RISC-V boot1.efi and loader.efi support
  
  This implementation doesn't have any major deviations from the other EFI
  ports. I've copied the boilerplate from arm and arm64.
  
  I've tested this with the following boot flows:
  OpenSBI (M-mode) -> u-boot (S-mode) -> loader.efi -> FreeBSD
  OpenSBI (M-mode) -> u-boot (S-mode) -> boot1.efi -> loader.efi -> FreeBSD
  
  Due to the way that u-boot handles secondary CPUs, OpenSBI >= v0.7 is 
required,
  as the HSM extension is needed to bring them up explicitly. Because of this,
  using BBL as the SBI implementation will not be possible. Additionally, there
  are a few recent u-boot changes that are required as well, all of which will 
be
  present in the upcoming v2020.07 release.
  
  Looks good:   emaste
  Differential Revision:https://reviews.freebsd.org/D25135

Added:
  head/stand/efi/include/riscv/
  head/stand/efi/include/riscv/efibind.h
 - copied unchanged from r362787, head/stand/efi/include/arm64/efibind.h
  head/stand/efi/loader/arch/riscv/
  head/stand/efi/loader/arch/riscv/Makefile.inc   (contents, props changed)
  head/stand/efi/loader/arch/riscv/exec.c
 - copied, changed from r362787, head/stand/efi/loader/arch/arm/exec.c
  head/stand/efi/loader/arch/riscv/ldscript.riscv   (contents, props changed)
  head/stand/efi/loader/arch/riscv/start.S   (contents, props changed)
Modified:
  head/share/mk/src.opts.mk
  head/stand/common/self_reloc.c
  head/stand/defs.mk
  head/stand/efi/libefi/Makefile
  head/stand/efi/loader/copy.c
  head/stand/efi/loader/main.c
  head/stand/loader.mk
  head/sys/riscv/include/metadata.h

Modified: head/share/mk/src.opts.mk
==
--- head/share/mk/src.opts.mk   Mon Jul  6 17:47:29 2020(r362972)
+++ head/share/mk/src.opts.mk   Mon Jul  6 18:19:42 2020(r362973)
@@ -318,8 +318,8 @@ BROKEN_OPTIONS+=LIBSOFT
 # marked no longer broken with the switch to LLVM.
 BROKEN_OPTIONS+=GOOGLETEST SSP
 .endif
-# EFI doesn't exist on mips, powerpc, or riscv.
-.if ${__T:Mmips*} || ${__T:Mpowerpc*} || ${__T:Mriscv*}
+# EFI doesn't exist on mips or powerpc.
+.if ${__T:Mmips*} || ${__T:Mpowerpc*}
 BROKEN_OPTIONS+=EFI
 .endif
 # OFW is only for powerpc, exclude others

Modified: head/stand/common/self_reloc.c
==
--- head/stand/common/self_reloc.c  Mon Jul  6 17:47:29 2020
(r362972)
+++ head/stand/common/self_reloc.c  Mon Jul  6 18:19:42 2020
(r362973)
@@ -31,7 +31,7 @@ __FBSDID("$FreeBSD$");
 #include 
 #include 
 
-#if defined(__aarch64__) || defined(__amd64__)
+#if defined(__aarch64__) || defined(__amd64__) || defined(__riscv)
 #defineElfW_RelElf64_Rela
 #defineElfW_DynElf64_Dyn
 #defineELFW_R_TYPE ELF64_R_TYPE
@@ -55,6 +55,9 @@ __FBSDID("$FreeBSD$");
 #elif defined(__i386__)
 #defineRELOC_TYPE_NONE R_386_NONE
 #defineRELOC_TYPE_RELATIVE R_386_RELATIVE
+#elif defined(__riscv)
+#defineRELOC_TYPE_NONE R_RISCV_NONE
+#defineRELOC_TYPE_RELATIVE R_RISCV_RELATIVE
 #endif
 
 void self_reloc(Elf_Addr baseaddr, ElfW_Dyn *dynamic);

Modified: head/stand/defs.mk
==
--- head/stand/defs.mk  Mon Jul  6 17:47:29 2020(r362972)
+++ head/stand/defs.mk  Mon Jul  6 18:19:42 2020(r362973)
@@ -115,13 +115,14 @@ AFLAGS+=  --32
 SSP_CFLAGS=
 
 # Add in the no float / no SIMD stuff and announce we're freestanding
-# aarch64 and riscv don't have -msoft-float, but all others do. riscv
-# currently has no /boot/loader, but may soon.
+# aarch64 and riscv don't have -msoft-float, but all others do.
 CFLAGS+=   -ffreestanding ${CFLAGS_NO_SIMD}
 .if ${MACHINE_CPUARCH} == "aarch64"
 CFLAGS+=   -mgeneral-regs-only -ffixed-x18 -fPIC
 .elif ${MACHINE_CPUARCH} == "riscv"
-CFLAGS+=   -march=rv64imac -mabi=lp64
+CFLAGS+=   -march=rv64imac -mabi=lp64 -fPIC
+CFLAGS.clang+= -mcmodel=medium
+CFLAGS.gcc+=   -mcmodel=medany
 .else
 CFLAGS+=   -msoft-float
 .endif
@@ -146,6 +147,12 @@ CFLAGS+=   -fPIC -mno-red-zone
 CFLAGS.clang+= -mno-movt
 CFLAGS.clang+=  -mfpu=none
 CFLAGS+=   -fPIC
+.endif
+
+# Some RISC-V linkers have support for relaxations, while some (lld) do not
+# yet. If this is the case we inhibit the compiler from emitting relaxations.
+.if ${LINKER_FEATURES:Mriscv-relaxations} == ""
+CFLAGS+=   -mno-relax
 .endif
 
 # The boot loader build uses dd status=none, where possible, for reproducible

Copied: head/stand/efi/include/riscv/efibind.h (from r362787, 
head/stand/efi/include/arm64/efibind.h)
==
--- /dev/null   00:00:00 1970   (empty, because file is 

svn commit: r362972 - head/lib/libefivar

2020-07-06 Thread Mitchell Horne
Author: mhorne
Date: Mon Jul  6 17:47:29 2020
New Revision: 362972
URL: https://svnweb.freebsd.org/changeset/base/362972

Log:
  libefivar: define MDE_CPU_RISCV64
  
  The necessary definitions from EDK2 are present, so this allows the
  library to be built on RISC-V.

Modified:
  head/lib/libefivar/efi-osdep.h

Modified: head/lib/libefivar/efi-osdep.h
==
--- head/lib/libefivar/efi-osdep.h  Mon Jul  6 16:34:49 2020
(r362971)
+++ head/lib/libefivar/efi-osdep.h  Mon Jul  6 17:47:29 2020
(r362972)
@@ -104,6 +104,8 @@ typedef void VOID;
 #define MDE_CPU_ARM
 #elif defined(__aarch64__)
 #define MDE_CPU_AARCH64
+#elif defined(__riscv)
+#define MDE_CPU_RISCV64
 #endif
 /* FreeBSD doesn't have/use MDE_CPU_EBC or MDE_CPU_IPF (ia64) */
 
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r362970 - head/sys/kern

2020-07-06 Thread Mark Johnston
Author: markj
Date: Mon Jul  6 16:34:29 2020
New Revision: 362970
URL: https://svnweb.freebsd.org/changeset/base/362970

Log:
  Permit cpuset_(get|set)domain() in capability mode.
  
  These system calls already perform validation of their parameters when
  called in capability mode, identical to cpuset_(get|set)affinity().
  
  MFC after:1 week
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/kern/capabilities.conf

Modified: head/sys/kern/capabilities.conf
==
--- head/sys/kern/capabilities.conf Mon Jul  6 16:34:15 2020
(r362969)
+++ head/sys/kern/capabilities.conf Mon Jul  6 16:34:29 2020
(r362970)
@@ -149,8 +149,10 @@ copy_file_range
 ##
 #cpuset
 cpuset_getaffinity
+cpuset_getdomain
 #cpuset_getid
 cpuset_setaffinity
+cpuset_setdomain
 #cpuset_setid
 
 ##
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r362969 - head/sys/kern

2020-07-06 Thread Pawel Biernacki
Author: kaktus
Date: Mon Jul  6 16:34:15 2020
New Revision: 362969
URL: https://svnweb.freebsd.org/changeset/base/362969

Log:
  kern.tty_info_kstacks: set compact format as default

Modified:
  head/sys/kern/tty_info.c

Modified: head/sys/kern/tty_info.c
==
--- head/sys/kern/tty_info.cMon Jul  6 16:34:09 2020(r362968)
+++ head/sys/kern/tty_info.cMon Jul  6 16:34:15 2020(r362969)
@@ -239,7 +239,7 @@ sbuf_tty_drain(void *a, const char *d, int len)
 }
 
 #ifdef STACK
-static int tty_info_kstacks = STACK_SBUF_FMT_LONG;
+static int tty_info_kstacks = STACK_SBUF_FMT_COMPACT;
 
 static int
 sysctl_tty_info_kstacks(SYSCTL_HANDLER_ARGS)
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r362968 - head/sys/kern

2020-07-06 Thread Mark Johnston
Author: markj
Date: Mon Jul  6 16:34:09 2020
New Revision: 362968
URL: https://svnweb.freebsd.org/changeset/base/362968

Log:
  Allow accesses of the caller's CPU and domain sets in capability mode.
  
  cpuset_(get|set)(affinity|domain)(2) permit a get or set of the calling
  thread or process' CPU and domain set in capability mode, but only when
  the thread or process ID is specified as -1.  Extend this to cover the
  case where the ID actually matches the caller's TID or PID, since some
  code, such as our pthread_attr_get_np() implementation, always provides
  an explicit ID.
  
  It was not and still is not permitted to access CPU and domain sets for
  other threads in the same process when the process is in capability
  mode.  This might change in the future.
  
  Submitted by: Greg V  (original version)
  MFC after:1 week
  Differential Revision:https://reviews.freebsd.org/D25552

Modified:
  head/sys/kern/kern_cpuset.c

Modified: head/sys/kern/kern_cpuset.c
==
--- head/sys/kern/kern_cpuset.c Mon Jul  6 16:33:28 2020(r362967)
+++ head/sys/kern/kern_cpuset.c Mon Jul  6 16:34:09 2020(r362968)
@@ -1595,7 +1595,9 @@ cpuset_check_capabilities(struct thread *td, cpulevel_
return (ECAPMODE);
if (which != CPU_WHICH_TID && which != CPU_WHICH_PID)
return (ECAPMODE);
-   if (id != -1)
+   if (id != -1 &&
+   !(which == CPU_WHICH_TID && id == td->td_tid) &&
+   !(which == CPU_WHICH_PID && id == td->td_proc->p_pid))
return (ECAPMODE);
}
return (0);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r362971 - in head/sys: compat/freebsd32 kern

2020-07-06 Thread Mark Johnston
Author: markj
Date: Mon Jul  6 16:34:49 2020
New Revision: 362971
URL: https://svnweb.freebsd.org/changeset/base/362971

Log:
  Regenerate.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/compat/freebsd32/freebsd32_sysent.c
  head/sys/kern/init_sysent.c

Modified: head/sys/compat/freebsd32/freebsd32_sysent.c
==
--- head/sys/compat/freebsd32/freebsd32_sysent.cMon Jul  6 16:34:29 
2020(r362970)
+++ head/sys/compat/freebsd32/freebsd32_sysent.cMon Jul  6 16:34:49 
2020(r362971)
@@ -650,8 +650,8 @@ struct sysent freebsd32_sysent[] = {
{ AS(freebsd32_mknodat_args), (sy_call_t *)freebsd32_mknodat, 
AUE_MKNODAT, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC }, /* 559 = 
freebsd32_mknodat */
 #endif
{ AS(freebsd32_kevent_args), (sy_call_t *)freebsd32_kevent, AUE_KEVENT, 
NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC },/* 560 = freebsd32_kevent */
-   { AS(freebsd32_cpuset_getdomain_args), (sy_call_t 
*)freebsd32_cpuset_getdomain, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },   
/* 561 = freebsd32_cpuset_getdomain */
-   { AS(freebsd32_cpuset_setdomain_args), (sy_call_t 
*)freebsd32_cpuset_setdomain, AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },   
/* 562 = freebsd32_cpuset_setdomain */
+   { AS(freebsd32_cpuset_getdomain_args), (sy_call_t 
*)freebsd32_cpuset_getdomain, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, 
SY_THR_STATIC },  /* 561 = freebsd32_cpuset_getdomain */
+   { AS(freebsd32_cpuset_setdomain_args), (sy_call_t 
*)freebsd32_cpuset_setdomain, AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, 
SY_THR_STATIC },  /* 562 = freebsd32_cpuset_setdomain */
{ AS(getrandom_args), (sy_call_t *)sys_getrandom, AUE_NULL, NULL, 0, 0, 
SYF_CAPENABLED, SY_THR_STATIC },/* 563 = getrandom */
{ AS(getfhat_args), (sy_call_t *)sys_getfhat, AUE_NULL, NULL, 0, 0, 0, 
SY_THR_STATIC }, /* 564 = getfhat */
{ AS(fhlink_args), (sy_call_t *)sys_fhlink, AUE_NULL, NULL, 0, 0, 0, 
SY_THR_STATIC },   /* 565 = fhlink */

Modified: head/sys/kern/init_sysent.c
==
--- head/sys/kern/init_sysent.c Mon Jul  6 16:34:29 2020(r362970)
+++ head/sys/kern/init_sysent.c Mon Jul  6 16:34:49 2020(r362971)
@@ -616,8 +616,8 @@ struct sysent sysent[] = {
{ AS(fhstatfs_args), (sy_call_t *)sys_fhstatfs, AUE_FHSTATFS, NULL, 0, 
0, 0, SY_THR_STATIC },   /* 558 = fhstatfs */
{ AS(mknodat_args), (sy_call_t *)sys_mknodat, AUE_MKNODAT, NULL, 0, 0, 
SYF_CAPENABLED, SY_THR_STATIC }, /* 559 = mknodat */
{ AS(kevent_args), (sy_call_t *)sys_kevent, AUE_KEVENT, NULL, 0, 0, 
SYF_CAPENABLED, SY_THR_STATIC },/* 560 = kevent */
-   { AS(cpuset_getdomain_args), (sy_call_t *)sys_cpuset_getdomain, 
AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },   /* 561 = cpuset_getdomain */
-   { AS(cpuset_setdomain_args), (sy_call_t *)sys_cpuset_setdomain, 
AUE_NULL, NULL, 0, 0, 0, SY_THR_STATIC },   /* 562 = cpuset_setdomain */
+   { AS(cpuset_getdomain_args), (sy_call_t *)sys_cpuset_getdomain, 
AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC },  /* 561 = 
cpuset_getdomain */
+   { AS(cpuset_setdomain_args), (sy_call_t *)sys_cpuset_setdomain, 
AUE_NULL, NULL, 0, 0, SYF_CAPENABLED, SY_THR_STATIC },  /* 562 = 
cpuset_setdomain */
{ AS(getrandom_args), (sy_call_t *)sys_getrandom, AUE_NULL, NULL, 0, 0, 
SYF_CAPENABLED, SY_THR_STATIC },/* 563 = getrandom */
{ AS(getfhat_args), (sy_call_t *)sys_getfhat, AUE_NULL, NULL, 0, 0, 0, 
SY_THR_STATIC }, /* 564 = getfhat */
{ AS(fhlink_args), (sy_call_t *)sys_fhlink, AUE_NULL, NULL, 0, 0, 0, 
SY_THR_STATIC },   /* 565 = fhlink */
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r362966 - head/sys/kern

2020-07-06 Thread Mark Johnston
Author: markj
Date: Mon Jul  6 16:33:21 2020
New Revision: 362966
URL: https://svnweb.freebsd.org/changeset/base/362966

Log:
  Lift cpuset Capsicum checks into a subroutine.
  
  Otherwise the same checks are duplicated across four different system
  call implementations, cpuset_(get|set)(affinity|domain)().  No
  functional change intended.
  
  MFC after:1 week
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/kern/kern_cpuset.c

Modified: head/sys/kern/kern_cpuset.c
==
--- head/sys/kern/kern_cpuset.c Mon Jul  6 15:15:37 2020(r362965)
+++ head/sys/kern/kern_cpuset.c Mon Jul  6 16:33:21 2020(r362966)
@@ -1582,6 +1582,25 @@ cpuset_setproc_update_set(struct proc *p, struct cpuse
return (0);
 }
 
+/*
+ * In Capability mode, the only accesses that are permitted are to the current
+ * thread and process' CPU and domain sets.
+ */
+static int
+cpuset_check_capabilities(struct thread *td, cpulevel_t level, cpuwhich_t 
which,
+id_t id)
+{
+   if (IN_CAPABILITY_MODE(td)) {
+   if (level != CPU_LEVEL_WHICH)
+   return (ECAPMODE);
+   if (which != CPU_WHICH_TID && which != CPU_WHICH_PID)
+   return (ECAPMODE);
+   if (id != -1)
+   return (ECAPMODE);
+   }
+   return (0);
+}
+
 #ifndef _SYS_SYSPROTO_H_
 struct cpuset_args {
cpusetid_t  *setid;
@@ -1739,15 +1758,9 @@ kern_cpuset_getaffinity(struct thread *td, cpulevel_t 
 
if (cpusetsize < sizeof(cpuset_t) || cpusetsize > CPU_MAXSIZE / NBBY)
return (ERANGE);
-   /* In Capability mode, you can only get your own CPU set. */
-   if (IN_CAPABILITY_MODE(td)) {
-   if (level != CPU_LEVEL_WHICH)
-   return (ECAPMODE);
-   if (which != CPU_WHICH_TID && which != CPU_WHICH_PID)
-   return (ECAPMODE);
-   if (id != -1)
-   return (ECAPMODE);
-   }
+   error = cpuset_check_capabilities(td, level, which, id);
+   if (error != 0)
+   return (error);
size = cpusetsize;
mask = malloc(size, M_TEMP, M_WAITOK | M_ZERO);
error = cpuset_which(which, id, , , );
@@ -1856,15 +1869,9 @@ kern_cpuset_setaffinity(struct thread *td, cpulevel_t 
 
if (cpusetsize < sizeof(cpuset_t) || cpusetsize > CPU_MAXSIZE / NBBY)
return (ERANGE);
-   /* In Capability mode, you can only set your own CPU set. */
-   if (IN_CAPABILITY_MODE(td)) {
-   if (level != CPU_LEVEL_WHICH)
-   return (ECAPMODE);
-   if (which != CPU_WHICH_TID && which != CPU_WHICH_PID)
-   return (ECAPMODE);
-   if (id != -1)
-   return (ECAPMODE);
-   }
+   error = cpuset_check_capabilities(td, level, which, id);
+   if (error != 0)
+   return (error);
mask = malloc(cpusetsize, M_TEMP, M_WAITOK | M_ZERO);
error = copyin(maskp, mask, cpusetsize);
if (error)
@@ -1987,15 +1994,9 @@ kern_cpuset_getdomain(struct thread *td, cpulevel_t le
if (domainsetsize < sizeof(domainset_t) ||
domainsetsize > DOMAINSET_MAXSIZE / NBBY)
return (ERANGE);
-   /* In Capability mode, you can only get your own domain set. */
-   if (IN_CAPABILITY_MODE(td)) {
-   if (level != CPU_LEVEL_WHICH)
-   return (ECAPMODE);
-   if (which != CPU_WHICH_TID && which != CPU_WHICH_PID)
-   return (ECAPMODE);
-   if (id != -1)
-   return (ECAPMODE);
-   }
+   error = cpuset_check_capabilities(td, level, which, id);
+   if (error != 0)
+   return (error);
mask = malloc(domainsetsize, M_TEMP, M_WAITOK | M_ZERO);
bzero(, sizeof(outset));
error = cpuset_which(which, id, , , );
@@ -2122,15 +2123,9 @@ kern_cpuset_setdomain(struct thread *td, cpulevel_t le
if (policy <= DOMAINSET_POLICY_INVALID ||
policy > DOMAINSET_POLICY_MAX)
return (EINVAL);
-   /* In Capability mode, you can only set your own CPU set. */
-   if (IN_CAPABILITY_MODE(td)) {
-   if (level != CPU_LEVEL_WHICH)
-   return (ECAPMODE);
-   if (which != CPU_WHICH_TID && which != CPU_WHICH_PID)
-   return (ECAPMODE);
-   if (id != -1)
-   return (ECAPMODE);
-   }
+   error = cpuset_check_capabilities(td, level, which, id);
+   if (error != 0)
+   return (error);
memset(, 0, sizeof(domain));
mask = malloc(domainsetsize, M_TEMP, M_WAITOK | M_ZERO);
error = copyin(maskp, mask, domainsetsize);
___
svn-src-head@freebsd.org mailing list

svn commit: r362967 - in head/sys: kern sys

2020-07-06 Thread Pawel Biernacki
Author: kaktus
Date: Mon Jul  6 16:33:28 2020
New Revision: 362967
URL: https://svnweb.freebsd.org/changeset/base/362967

Log:
  kern.tty_info_kstacks: add a compact format
  
  Add a more compact display format for kern.tty_info_kstacks inspired by
  procstat -kk. Set it as a default one.
  
  # sysctl kern.tty_info_kstacks=1
  kern.tty_info_kstacks: 0 -> 1
  # sleep 2
  ^T
  load: 0.17  cmd: sleep 623 [nanslp] 0.72r 0.00u 0.00s 0% 2124k
  #0 0x80c4443e at mi_switch+0xbe
  #1 0x80c98044 at sleepq_catch_signals+0x494
  #2 0x80c982c2 at sleepq_timedwait_sig+0x12
  #3 0x80c43af3 at _sleep+0x193
  #4 0x80c50e31 at kern_clock_nanosleep+0x1a1
  #5 0x80c5119b at sys_nanosleep+0x3b
  #6 0x810ffc69 at amd64_syscall+0x119
  #7 0x810d5520 at fast_syscall_common+0x101
  sleep: about 1 second(s) left out of the original 2
  ^C
  # sysctl kern.tty_info_kstacks=2
  kern.tty_info_kstacks: 1 -> 2
  # sleep 2
  ^T
  load: 0.24  cmd: sleep 625 [nanslp] 0.81r 0.00u 0.00s 0% 2124k
  mi_switch+0xbe sleepq_catch_signals+0x494 sleepq_timedwait_sig+0x12
  sleep+0x193 kern_clock_nanosleep+0x1a1 sys_nanosleep+0x3b
  amd64_syscall+0x119 fast_syscall_common+0x101
  sleep: about 1 second(s) left out of the original 2
  ^C
  
  Suggested by: avg
  Reviewed by:  mjg
  Relnotes: yes
  Sponsored by: Mysterious Code Ltd.
  Differential Revision:https://reviews.freebsd.org/D25487

Modified:
  head/sys/kern/subr_stack.c
  head/sys/kern/tty_info.c
  head/sys/sys/stack.h

Modified: head/sys/kern/subr_stack.c
==
--- head/sys/kern/subr_stack.c  Mon Jul  6 16:33:21 2020(r362966)
+++ head/sys/kern/subr_stack.c  Mon Jul  6 16:33:28 2020(r362967)
@@ -170,7 +170,8 @@ stack_print_short_ddb(const struct stack *st)
  * flags - M_WAITOK or M_NOWAIT (EWOULDBLOCK).
  */
 int
-stack_sbuf_print_flags(struct sbuf *sb, const struct stack *st, int flags)
+stack_sbuf_print_flags(struct sbuf *sb, const struct stack *st, int flags,
+enum stack_sbuf_fmt format)
 {
char namebuf[64];
long offset;
@@ -182,9 +183,19 @@ stack_sbuf_print_flags(struct sbuf *sb, const struct s
, flags);
if (error == EWOULDBLOCK)
return (error);
-   sbuf_printf(sb, "#%d %p at %s+%#lx\n", i, (void *)st->pcs[i],
-   namebuf, offset);
+   switch (format) {
+   case STACK_SBUF_FMT_LONG:
+   sbuf_printf(sb, "#%d %p at %s+%#lx\n", i,
+   (void *)st->pcs[i], namebuf, offset);
+   break;
+   case STACK_SBUF_FMT_COMPACT:
+   sbuf_printf(sb, "%s+%#lx ", namebuf, offset);
+   break;
+   default:
+   __assert_unreachable();
+   }
}
+   sbuf_nl_terminate(sb);
return (0);
 }
 
@@ -192,7 +203,7 @@ void
 stack_sbuf_print(struct sbuf *sb, const struct stack *st)
 {
 
-   (void)stack_sbuf_print_flags(sb, st, M_WAITOK);
+   (void)stack_sbuf_print_flags(sb, st, M_WAITOK, STACK_SBUF_FMT_LONG);
 }
 
 #if defined(DDB) || defined(WITNESS)

Modified: head/sys/kern/tty_info.c
==
--- head/sys/kern/tty_info.cMon Jul  6 16:33:21 2020(r362966)
+++ head/sys/kern/tty_info.cMon Jul  6 16:33:28 2020(r362967)
@@ -239,10 +239,36 @@ sbuf_tty_drain(void *a, const char *d, int len)
 }
 
 #ifdef STACK
-static bool tty_info_kstacks = true;
-SYSCTL_BOOL(_kern, OID_AUTO, tty_info_kstacks, CTLFLAG_RWTUN,
-_info_kstacks, 0,
-"Enable printing kernel stack(9) traces on ^T (tty info)");
+static int tty_info_kstacks = STACK_SBUF_FMT_LONG;
+
+static int
+sysctl_tty_info_kstacks(SYSCTL_HANDLER_ARGS)
+{
+   enum stack_sbuf_fmt val;
+   int error;
+
+   val = tty_info_kstacks;
+   error = sysctl_handle_int(oidp, , 0, req);
+   if (error != 0 || req->newptr == NULL)
+   return (error);
+
+   switch (val) {
+   case STACK_SBUF_FMT_NONE:
+   case STACK_SBUF_FMT_LONG:
+   case STACK_SBUF_FMT_COMPACT:
+   tty_info_kstacks = val;
+   break;
+   default:
+   error = EINVAL;
+   }
+
+   return (error);
+}
+SYSCTL_PROC(_kern, OID_AUTO, tty_info_kstacks,
+CTLFLAG_RWTUN | CTLFLAG_MPSAFE | CTLTYPE_INT, NULL, 0,
+sysctl_tty_info_kstacks, "I",
+"Adjust format of kernel stack(9) traces on ^T (tty info): "
+"0 - disabled; 1 - long; 2 - compact");
 #endif
 
 /*
@@ -254,7 +280,8 @@ tty_info(struct tty *tp)
struct timeval rtime, utime, stime;
 #ifdef STACK
struct stack stack;
-   int sterr;
+   int sterr, kstacks_val;
+   bool print_kstacks;
 #endif
struct proc *p, *ppick;
struct thread *td, *tdpick;
@@ -337,7 +364,10 @@ 

svn commit: r362965 - head/sys/powerpc/powernv

2020-07-06 Thread Brandon Bergren
Author: bdragon
Date: Mon Jul  6 15:15:37 2020
New Revision: 362965
URL: https://svnweb.freebsd.org/changeset/base/362965

Log:
  [PowerPC] XIVE dispatch tweaks
  
* Only read the DPCPU pointer once per xive_dispatch call.
* Optimize HE decoding for the common cases.
  
  Reported by:  jhibbits (in irc)
  Reviewed by:  jhibbits
  Sponsored by: Tag1 Consulting, Inc.
  Differential Revision:https://reviews.freebsd.org/D25545

Modified:
  head/sys/powerpc/powernv/xive.c

Modified: head/sys/powerpc/powernv/xive.c
==
--- head/sys/powerpc/powernv/xive.c Mon Jul  6 15:00:28 2020
(r362964)
+++ head/sys/powerpc/powernv/xive.c Mon Jul  6 15:15:37 2020
(r362965)
@@ -507,6 +507,7 @@ xive_dispatch(device_t dev, struct trapframe *tf)
 
sc = device_get_softc(dev);
 
+   xive_cpud = DPCPU_PTR(xive_cpu_data);
for (;;) {
ack = xive_read_2(sc, XIVE_TM_SPC_ACK);
cppr = (ack & 0xff);
@@ -515,19 +516,17 @@ xive_dispatch(device_t dev, struct trapframe *tf)
 
if (he == TM_QW3_NSR_HE_NONE)
break;
-   switch (he) {
-   case TM_QW3_NSR_HE_NONE:
-   goto end;
-   case TM_QW3_NSR_HE_POOL:
-   case TM_QW3_NSR_HE_LSI:
+
+   else if (__predict_false(he != TM_QW3_NSR_HE_PHYS)) {
+   /*
+* We don't support TM_QW3_NSR_HE_POOL or
+* TM_QW3_NSR_HE_LSI interrupts.
+*/
device_printf(dev,
"Unexpected interrupt he type: %d\n", he);
goto end;
-   case TM_QW3_NSR_HE_PHYS:
-   break;
}
 
-   xive_cpud = DPCPU_PTR(xive_cpu_data);
xive_write_1(sc, XIVE_TM_CPPR, cppr);
 
for (;;) {
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r362963 - head/sys/net

2020-07-06 Thread Mark Johnston
Author: markj
Date: Mon Jul  6 14:52:21 2020
New Revision: 362963
URL: https://svnweb.freebsd.org/changeset/base/362963

Log:
  iflib: Fix some nits in the rx refill code.
  
  - Get rid of the ifl_vm_addrs array.  It is not used by any existing
consumer, so we are just dirtying a couple of cache lines for no
reason.
  - Use uma_zalloc(fl->ifl_zone) instead of m_cljget().  Otherwise
m_cljget() is doing unnecessary work to look up the correct zone, when
iflib already knows what that zone is.
  - ifl_gen is only used when INVARIANTS is on, so make that more clear.
  - Fix some style nits and inconsistencies.
  
  Reviewed by:  gallatin
  Tested by:pho
  MFC after:2 weeks
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D25490

Modified:
  head/sys/net/iflib.c
  head/sys/net/iflib.h

Modified: head/sys/net/iflib.c
==
--- head/sys/net/iflib.cMon Jul  6 14:52:09 2020(r362962)
+++ head/sys/net/iflib.cMon Jul  6 14:52:21 2020(r362963)
@@ -206,8 +206,6 @@ struct iflib_ctx {
 #define isc_rxd_pkt_get ifc_txrx.ift_rxd_pkt_get
 #define isc_rxd_refill ifc_txrx.ift_rxd_refill
 #define isc_rxd_flush ifc_txrx.ift_rxd_flush
-#define isc_rxd_refill ifc_txrx.ift_rxd_refill
-#define isc_rxd_refill ifc_txrx.ift_rxd_refill
 #define isc_legacy_intr ifc_txrx.ift_legacy_intr
eventhandler_tag ifc_vlan_attach_event;
eventhandler_tag ifc_vlan_detach_event;
@@ -392,8 +390,7 @@ struct iflib_fl {
bus_dma_tag_t   ifl_buf_tag;
iflib_dma_info_tifl_ifdi;
uint64_tifl_bus_addrs[IFLIB_MAX_RX_REFRESH] 
__aligned(CACHE_LINE_SIZE);
-   caddr_t ifl_vm_addrs[IFLIB_MAX_RX_REFRESH];
-   qidx_t  ifl_rxd_idxs[IFLIB_MAX_RX_REFRESH];
+   qidx_t  ifl_rxd_idxs[IFLIB_MAX_RX_REFRESH];
 }  __aligned(CACHE_LINE_SIZE);
 
 static inline qidx_t
@@ -854,7 +851,6 @@ netmap_fl_refill(iflib_rxq_t rxq, struct netmap_kring 
if (addr == NETMAP_BUF_BASE(na)) /* bad buf */
return netmap_ring_reinit(kring);
 
-   fl->ifl_vm_addrs[tmp_pidx] = addr;
if (__predict_false(init)) {
netmap_load_map(na, fl->ifl_buf_tag,
map[nic_i], addr);
@@ -1295,7 +1291,6 @@ iru_init(if_rxd_update_t iru, iflib_rxq_t rxq, uint8_t
 
fl = >ifr_fl[flid];
iru->iru_paddrs = fl->ifl_bus_addrs;
-   iru->iru_vaddrs = >ifl_vm_addrs[0];
iru->iru_idxs = fl->ifl_rxd_idxs;
iru->iru_qsidx = rxq->ifr_id;
iru->iru_buf_size = fl->ifl_buf_size;
@@ -1916,7 +1911,7 @@ _rxq_refill_cb(void *arg, bus_dma_segment_t *segs, int
 }
 
 /**
- * _iflib_fl_refill - refill an rxq free-buffer list
+ * iflib_fl_refill - refill an rxq free-buffer list
  * @ctx: the iflib context
  * @fl: the free list to refill
  * @count: the number of new buffers to allocate
@@ -1925,7 +1920,7 @@ _rxq_refill_cb(void *arg, bus_dma_segment_t *segs, int
  * The caller must assure that @count does not exceed the queue's capacity.
  */
 static uint8_t
-_iflib_fl_refill(if_ctx_t ctx, iflib_fl_t fl, int count)
+iflib_fl_refill(if_ctx_t ctx, iflib_fl_t fl, int count)
 {
struct if_rxd_update iru;
struct rxq_refill_cb_arg cb_arg;
@@ -1962,12 +1957,13 @@ _iflib_fl_refill(if_ctx_t ctx, iflib_fl_t fl, int coun
if (n > 8)
DBG_COUNTER_INC(fl_refills_large);
iru_init(, fl->ifl_rxq, fl->ifl_id);
-   while (n--) {
+   while (n-- > 0) {
/*
 * We allocate an uninitialized mbuf + cluster, mbuf is
 * initialized after rx.
 *
-* If the cluster is still set then we know a minimum sized 
packet was received
+* If the cluster is still set then we know a minimum sized
+* packet was received
 */
bit_ffc_at(fl->ifl_rx_bitmap, frag_idx, fl->ifl_size,
_idx);
@@ -1975,7 +1971,7 @@ _iflib_fl_refill(if_ctx_t ctx, iflib_fl_t fl, int coun
bit_ffc(fl->ifl_rx_bitmap, fl->ifl_size, _idx);
MPASS(frag_idx >= 0);
if ((cl = sd_cl[frag_idx]) == NULL) {
-   cl = m_cljget(NULL, M_NOWAIT, fl->ifl_buf_size);
+   cl = uma_zalloc(fl->ifl_zone, M_NOWAIT);
if (__predict_false(cl == NULL))
break;
 
@@ -1989,7 +1985,7 @@ _iflib_fl_refill(if_ctx_t ctx, iflib_fl_t fl, int coun
break;
}
 
-   sd_ba[frag_idx] =  bus_addr = cb_arg.seg.ds_addr;
+   sd_ba[frag_idx] = bus_addr = cb_arg.seg.ds_addr;
sd_cl[frag_idx] = cl;
 #if MEMORY_LOGGING
   

svn commit: r362962 - head/sys/net

2020-07-06 Thread Mark Johnston
Author: markj
Date: Mon Jul  6 14:52:09 2020
New Revision: 362962
URL: https://svnweb.freebsd.org/changeset/base/362962

Log:
  iflib: Fix handling of mbuf cluster allocation failures.
  
  When refilling an rx freelist, make sure we only update the hardware
  producer index if at least one cluster was allocated.  Otherwise the
  NIC is programmed to write a previously used cluster, typically
  resulting in a use-after-free when packet data is written by the
  hardware.
  
  Also make sure that we don't update the fragment index cursor if the
  last allocation attempt didn't succeed.  For at least Intel drivers,
  iflib assumes that the consumer index and fragment index cursor stay in
  lockstep, but this assumption was violated in the face of cluster
  allocation failures.
  
  Reported and tested by:   pho
  Reviewed by:  gallatin, hselasky
  MFC after:2 weeks
  Sponsored by: The FreeBSD Foundation
  Differential Revision:https://reviews.freebsd.org/D25489

Modified:
  head/sys/net/iflib.c

Modified: head/sys/net/iflib.c
==
--- head/sys/net/iflib.cMon Jul  6 14:00:20 2020(r362961)
+++ head/sys/net/iflib.cMon Jul  6 14:52:09 2020(r362962)
@@ -1975,7 +1975,8 @@ _iflib_fl_refill(if_ctx_t ctx, iflib_fl_t fl, int coun
bit_ffc(fl->ifl_rx_bitmap, fl->ifl_size, _idx);
MPASS(frag_idx >= 0);
if ((cl = sd_cl[frag_idx]) == NULL) {
-   if ((cl = m_cljget(NULL, M_NOWAIT, fl->ifl_buf_size)) 
== NULL)
+   cl = m_cljget(NULL, M_NOWAIT, fl->ifl_buf_size);
+   if (__predict_false(cl == NULL))
break;
 
cb_arg.error = 0;
@@ -1983,12 +1984,8 @@ _iflib_fl_refill(if_ctx_t ctx, iflib_fl_t fl, int coun
err = bus_dmamap_load(fl->ifl_buf_tag, sd_map[frag_idx],
cl, fl->ifl_buf_size, _rxq_refill_cb, _arg,
BUS_DMA_NOWAIT);
-   if (err != 0 || cb_arg.error) {
-   /*
-* !zone_pack ?
-*/
-   if (fl->ifl_zone == zone_pack)
-   uma_zfree(fl->ifl_zone, cl);
+   if (__predict_false(err != 0 || cb_arg.error)) {
+   uma_zfree(fl->ifl_zone, cl);
break;
}
 
@@ -2004,9 +2001,9 @@ _iflib_fl_refill(if_ctx_t ctx, iflib_fl_t fl, int coun
BUS_DMASYNC_PREREAD);
 
if (sd_m[frag_idx] == NULL) {
-   if ((m = m_gethdr(M_NOWAIT, MT_NOINIT)) == NULL) {
+   m = m_gethdr(M_NOWAIT, MT_NOINIT);
+   if (__predict_false(m == NULL))
break;
-   }
sd_m[frag_idx] = m;
}
bit_set(fl->ifl_rx_bitmap, frag_idx);
@@ -2036,25 +2033,32 @@ _iflib_fl_refill(if_ctx_t ctx, iflib_fl_t fl, int coun
}
}
 
-   if (i) {
-   iru.iru_pidx = pidx;
-   iru.iru_count = i;
-   ctx->isc_rxd_refill(ctx->ifc_softc, );
-   fl->ifl_pidx = idx;
-   fl->ifl_credits = credits;
-   }
-   DBG_COUNTER_INC(rxd_flush);
-   if (fl->ifl_pidx == 0)
-   pidx = fl->ifl_size - 1;
-   else
-   pidx = fl->ifl_pidx - 1;
+   if (n < count - 1) {
+   if (i != 0) {
+   iru.iru_pidx = pidx;
+   iru.iru_count = i;
+   ctx->isc_rxd_refill(ctx->ifc_softc, );
+   fl->ifl_pidx = idx;
+   fl->ifl_credits = credits;
+   }
+   DBG_COUNTER_INC(rxd_flush);
+   if (fl->ifl_pidx == 0)
+   pidx = fl->ifl_size - 1;
+   else
+   pidx = fl->ifl_pidx - 1;
 
-   bus_dmamap_sync(fl->ifl_ifdi->idi_tag, fl->ifl_ifdi->idi_map,
-   BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
-   ctx->isc_rxd_flush(ctx->ifc_softc, fl->ifl_rxq->ifr_id, fl->ifl_id, 
pidx);
-   fl->ifl_fragidx = frag_idx + 1;
-   if (fl->ifl_fragidx == fl->ifl_size)
-   fl->ifl_fragidx = 0;
+   bus_dmamap_sync(fl->ifl_ifdi->idi_tag, fl->ifl_ifdi->idi_map,
+   BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE);
+   ctx->isc_rxd_flush(ctx->ifc_softc, fl->ifl_rxq->ifr_id,
+   fl->ifl_id, pidx);
+   if (__predict_true(bit_test(fl->ifl_rx_bitmap, frag_idx))) {
+   fl->ifl_fragidx = frag_idx + 1;
+   if (fl->ifl_fragidx == fl->ifl_size)
+   

svn commit: r362958 - head/libexec/rtld-elf

2020-07-06 Thread Leandro Lupori
Author: luporl
Date: Mon Jul  6 11:57:59 2020
New Revision: 362958
URL: https://svnweb.freebsd.org/changeset/base/362958

Log:
  Handle non-PLT GNU IFUNC relocations in rtld
  
  In the last IFUNC related changes to rtld, the code that handled non-PLT
  GNU IFUNC relocations ended up getting lost. This could leave some
  relocations unhandled, causing crashes or misbehavior. This change restores
  the handling of these relocations, but now together with the other IFUNC
  relocations, allowing resolvers to reference external symbols.
  
  Reviewed by:  kib
  MFC after:2 weeks
  Sponsored by: Eldorado Research Institute (eldorado.org.br)
  Differential Revision:https://reviews.freebsd.org/D25550

Modified:
  head/libexec/rtld-elf/rtld.c

Modified: head/libexec/rtld-elf/rtld.c
==
--- head/libexec/rtld-elf/rtld.cMon Jul  6 10:05:35 2020
(r362957)
+++ head/libexec/rtld-elf/rtld.cMon Jul  6 11:57:59 2020
(r362958)
@@ -3111,7 +3111,8 @@ resolve_object_ifunc(Obj_Entry *obj, bool bind_now, in
return (0);
obj->ifuncs_resolved = true;
if (!obj->irelative && !obj->irelative_nonplt &&
-   !((obj->bind_now || bind_now) && obj->gnu_ifunc))
+   !((obj->bind_now || bind_now) && obj->gnu_ifunc) &&
+   !obj->non_plt_gnu_ifunc)
return (0);
if (obj_disable_relro(obj) == -1 ||
(obj->irelative && reloc_iresolve(obj, lockstate) == -1) ||
@@ -3119,6 +3120,8 @@ resolve_object_ifunc(Obj_Entry *obj, bool bind_now, in
lockstate) == -1) ||
((obj->bind_now || bind_now) && obj->gnu_ifunc &&
reloc_gnu_ifunc(obj, flags, lockstate) == -1) ||
+   (obj->non_plt_gnu_ifunc && reloc_non_plt(obj, _rtld,
+   flags | SYMLOOK_IFUNC, lockstate) == -1) ||
obj_enforce_relro(obj) == -1)
return (-1);
return (0);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r362957 - head/bin/sh

2020-07-06 Thread Mateusz Piotrowski
Author: 0mp (doc,ports committer)
Date: Mon Jul  6 10:05:35 2020
New Revision: 362957
URL: https://svnweb.freebsd.org/changeset/base/362957

Log:
  Fix description of the "\$" sequence for PS1
  
  The manual page documents "\$" to expand to either "$" or "#" followed by
  a single space. In reality, the single space character is not appended.
  
  PR:   247791
  Submitted by: kd-...@pm.me
  MFC after:7 days

Modified:
  head/bin/sh/sh.1

Modified: head/bin/sh/sh.1
==
--- head/bin/sh/sh.1Mon Jul  6 09:53:00 2020(r362956)
+++ head/bin/sh/sh.1Mon Jul  6 10:05:35 2020(r362957)
@@ -32,7 +32,7 @@
 .\"from: @(#)sh.1  8.6 (Berkeley) 5/4/95
 .\" $FreeBSD$
 .\"
-.Dd February 24, 2019
+.Dd July 6, 2020
 .Dt SH 1
 .Os
 .Sh NAME
@@ -1425,9 +1425,9 @@ The final component of the current working directory.
 The entire path of the current working directory.
 .It Li \e$
 Superuser status.
-.Dq Li "$ "
+.Dq Li "$"
 for normal users and
-.Dq Li "# "
+.Dq Li "#"
 for superusers.
 .It Li \e\e
 A literal backslash.
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r362956 - head/lib/libcam

2020-07-06 Thread Mateusz Piotrowski
Author: 0mp (doc,ports committer)
Date: Mon Jul  6 09:53:00 2020
New Revision: 362956
URL: https://svnweb.freebsd.org/changeset/base/362956

Log:
  Clean up cam.3
  
  - Add a missing Pp [1]
  - Remove uses of Tn
  - Use "Xr open 2" when appropriate
  
  PR:   247783 [1]
  Submitted by: PauAmma  [1]
  MFC after:3 days

Modified:
  head/lib/libcam/cam.3

Modified: head/lib/libcam/cam.3
==
--- head/lib/libcam/cam.3   Mon Jul  6 09:04:06 2020(r362955)
+++ head/lib/libcam/cam.3   Mon Jul  6 09:53:00 2020(r362956)
@@ -27,7 +27,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd March 11, 2017
+.Dd July 6, 2020
 .Dt CAM 3
 .Os
 .Sh NAME
@@ -218,15 +218,12 @@ structure using
 .Fn cam_open_btl
 is similar to
 .Fn cam_open_spec_device ,
-except that it takes a
-.Tn SCSI
-bus, target and logical unit instead of a device name and unit number as
+except that it takes a SCSI bus,
+target and logical unit instead of a device name and unit number as
 arguments.
 The
 .Va path_id
-argument is the CAM equivalent of a
-.Tn SCSI
-bus number.
+argument is the CAM equivalent of a SCSI bus number.
 It represents the logical bus number in the system.
 The
 .Ar flags
@@ -263,10 +260,13 @@ should be
 if the user wants the CAM library to allocate space for the
 .Va cam_device
 structure.
+.Pp
 .Fn cam_close_device
 frees the
 .Va cam_device
-structure allocated by one of the above open() calls, and closes the file
+structure allocated by one of the above
+.Xr open 2
+calls, and closes the file
 descriptor to the passthrough device.
 This routine should not be called if
 the user allocated space for the
@@ -276,7 +276,9 @@ Instead, the user should call
 .Fn cam_close_spec_device .
 .Pp
 .Fn cam_close_spec_device
-merely closes the file descriptor opened in one of the open() routines
+merely closes the file descriptor opened in one of the
+.Xr open 2
+routines
 described above.
 This function should be called when the
 .Va cam_device
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


svn commit: r362954 - in head/sys: arm/broadcom/bcm2835 conf dev/pci

2020-07-06 Thread Andrew Turner
Author: andrew
Date: Mon Jul  6 08:51:55 2020
New Revision: 362954
URL: https://svnweb.freebsd.org/changeset/base/362954

Log:
  Add a driver for bcm2838 PCI express controller
  
  This adds support for the Broadcom bcm2711 PCI express controller, found
  on the Raspberry Pi 4 (aka the bcm2838 SoC). The driver has only been
  developed against the soldered-on VIA XHCI controller and not tested
  with other end points.
  
  Submitted by: Robert Crowston 
  Differential Revision:https://reviews.freebsd.org/D25068

Added:
  head/sys/arm/broadcom/bcm2835/bcm2838_pci.c   (contents, props changed)
Modified:
  head/sys/arm/broadcom/bcm2835/files.bcm283x
  head/sys/conf/files.arm64
  head/sys/dev/pci/pci_host_generic_fdt.c
  head/sys/dev/pci/pci_host_generic_fdt.h

Added: head/sys/arm/broadcom/bcm2835/bcm2838_pci.c
==
--- /dev/null   00:00:00 1970   (empty, because file is newly added)
+++ head/sys/arm/broadcom/bcm2835/bcm2838_pci.c Mon Jul  6 08:51:55 2020
(r362954)
@@ -0,0 +1,743 @@
+/*-
+ * SPDX-License-Identifier: ISC
+ *
+ * Copyright (c) 2020 Dr Robert Harvey Crowston 
+ *
+ * Permission to use, copy, modify, and distribute this software for any
+ * purpose with or without fee is hereby granted, provided that the above
+ * copyright notice and this permission notice appear in all copies.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
+ * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
+ * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
+ * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
+ * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
+ * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
+ * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
+ *
+ *
+ * $FreeBSD$
+ *
+ */
+
+/*
+ * BCM2838-compatible PCI-express controller.
+ *
+ * Broadcom likes to give the same chip lots of different names. The name of
+ * this driver is taken from the Raspberry Pi 4 Broadcom 2838 chip.
+ */
+
+#include 
+__FBSDID("$FreeBSD$");
+
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+
+#include 
+#include 
+#include 
+#include 
+#include 
+
+#include 
+#include 
+
+#include "pcib_if.h"
+#include "msi_if.h"
+
+extern struct bus_space memmap_bus;
+
+#define BUS_SPACE_3G_MAXADDR   0xc000
+#define PCI_ID_VAL30x43c
+#define CLASS_SHIFT0x10
+#define SUBCLASS_SHIFT 0x8
+
+#define REG_CONTROLLER_HW_REV  0x406c
+#define REG_BRIDGE_CTRL0x9210
+#define BRIDGE_DISABLE_FLAG0x1
+#define BRIDGE_RESET_FLAG  0x2
+#define REG_BRIDGE_SERDES_MODE 0x4204
+#define REG_BRIDGE_CONFIG  0x4008
+#define REG_BRIDGE_MEM_WINDOW_LOW  0x4034
+#define REG_BRIDGE_MEM_WINDOW_HIGH 0x4038
+#define REG_BRIDGE_MEM_WINDOW_10x403c
+#define REG_BRIDGE_GISB_WINDOW 0x402c
+#define REG_BRIDGE_STATE   0x4068
+#define REG_BRIDGE_LINK_STATE  0x00bc
+#define REG_BRIDGE_BUS_WINDOW_LOW  0x400c
+#define REG_BRIDGE_BUS_WINDOW_HIGH 0x4010
+#define REG_BRIDGE_CPU_WINDOW_LOW  0x4070
+#define REG_BRIDGE_CPU_WINDOW_START_HIGH   0x4080
+#define REG_BRIDGE_CPU_WINDOW_END_HIGH 0x4084
+
+#define REG_MSI_ADDR_LOW   0x4044
+#define REG_MSI_ADDR_HIGH  0x4048
+#define REG_MSI_CONFIG 0x404c
+#define REG_MSI_CLR0x4508
+#define REG_MSI_MASK_CLR   0x4514
+#define REG_MSI_RAISED 0x4500
+#define REG_MSI_EOI0x4060
+#define NUM_MSI32
+
+#define REG_EP_CONFIG_CHOICE   0x9000
+#define REG_EP_CONFIG_DATA 0x8000
+
+/*
+ * These values were obtained from runtime inspection of a Linux system using a
+ * JTAG. The very limited documentation I have obtained from Broadcom does not
+ * explain how to compute them.
+ */
+#define REG_VALUE_4GB_WINDOW   0x11
+#define REG_VALUE_4GB_CONFIG   0x88003000
+#define REG_VALUE_MSI_CONFIG   0xffe06540
+
+struct bcm_pcib_irqsrc {
+   struct intr_irqsrc  isrc;
+   u_int   irq;
+   boolallocated;
+};
+
+struct bcm_pcib_softc {
+   struct generic_pcie_fdt_softc   base;
+   device_tdev;
+   struct mtx  config_mtx;
+   struct mtx  msi_mtx;
+   struct resource *msi_irq_res;
+   void*msi_intr_cookie;
+   struct bcm_pcib_irqsrc  *msi_isrcs;
+   

svn commit: r362953 - in head/sys: dev/mlx4/mlx4_core dev/mlx4/mlx4_en dev/mlx4/mlx4_ib dev/mlx5/mlx5_core dev/mlx5/mlx5_en dev/mlx5/mlx5_fpga_tools dev/mlx5/mlx5_ib dev/mthca ofed/drivers/infiniba...

2020-07-06 Thread Hans Petter Selasky
Author: hselasky
Date: Mon Jul  6 08:50:11 2020
New Revision: 362953
URL: https://svnweb.freebsd.org/changeset/base/362953

Log:
  Infiniband clients must be attached and detached in a specific order in 
ibcore.
  
  Currently the linking order of the infiniband, IB, modules decide in which
  order the clients are attached and detached. For example one IB client may
  use resources from another IB client. This can lead to a potential deadlock
  at shutdown. For example if the ipoib is unregistered after the ib_multicast
  client is detached, then if ipoib is using multicast addresses a deadlock may
  happen, because ib_multicast will wait for all its resources to be freed 
before
  returning from the remove method.
  
  Fix this by using module_xxx_order() instead of module_xxx().
  
  Differential Revision:https://reviews.freebsd.org/D23973
  MFC after:1 week
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/dev/mlx4/mlx4_core/mlx4_main.c
  head/sys/dev/mlx4/mlx4_en/mlx4_en_main.c
  head/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c
  head/sys/dev/mlx5/mlx5_core/mlx5_main.c
  head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
  head/sys/dev/mlx5/mlx5_fpga_tools/mlx5fpga_tools_main.c
  head/sys/dev/mlx5/mlx5_ib/mlx5_ib_main.c
  head/sys/dev/mthca/mthca_main.c
  head/sys/ofed/drivers/infiniband/core/ib_cm.c
  head/sys/ofed/drivers/infiniband/core/ib_cma.c
  head/sys/ofed/drivers/infiniband/core/ib_device.c
  head/sys/ofed/drivers/infiniband/core/ib_iwcm.c
  head/sys/ofed/drivers/infiniband/core/ib_ucm.c
  head/sys/ofed/drivers/infiniband/core/ib_ucma.c
  head/sys/ofed/drivers/infiniband/core/ib_user_mad.c
  head/sys/ofed/drivers/infiniband/core/ib_uverbs_main.c
  head/sys/ofed/drivers/infiniband/ulp/ipoib/ipoib_main.c
  head/sys/ofed/drivers/infiniband/util/madeye.c

Modified: head/sys/dev/mlx4/mlx4_core/mlx4_main.c
==
--- head/sys/dev/mlx4/mlx4_core/mlx4_main.c Mon Jul  6 08:36:14 2020
(r362952)
+++ head/sys/dev/mlx4/mlx4_core/mlx4_main.c Mon Jul  6 08:50:11 2020
(r362953)
@@ -4218,8 +4218,8 @@ static void __exit mlx4_cleanup(void)
destroy_workqueue(mlx4_wq);
 }
 
-module_init(mlx4_init);
-module_exit(mlx4_cleanup);
+module_init_order(mlx4_init, SI_ORDER_FIRST);
+module_exit_order(mlx4_cleanup, SI_ORDER_FIRST);
 
 static int
 mlx4_evhand(module_t mod, int event, void *arg)

Modified: head/sys/dev/mlx4/mlx4_en/mlx4_en_main.c
==
--- head/sys/dev/mlx4/mlx4_en/mlx4_en_main.cMon Jul  6 08:36:14 2020
(r362952)
+++ head/sys/dev/mlx4/mlx4_en/mlx4_en_main.cMon Jul  6 08:50:11 2020
(r362953)
@@ -304,8 +304,8 @@ static void __exit mlx4_en_cleanup(void)
mlx4_unregister_interface(_en_interface);
 }
 
-module_init(mlx4_en_init);
-module_exit(mlx4_en_cleanup);
+module_init_order(mlx4_en_init, SI_ORDER_SIXTH);
+module_exit_order(mlx4_en_cleanup, SI_ORDER_SIXTH);
 
 static int
 mlx4en_evhand(module_t mod, int event, void *arg)

Modified: head/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.c
==
--- head/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.cMon Jul  6 08:36:14 2020
(r362952)
+++ head/sys/dev/mlx4/mlx4_ib/mlx4_ib_main.cMon Jul  6 08:50:11 2020
(r362953)
@@ -3319,8 +3319,8 @@ static void __exit mlx4_ib_cleanup(void)
destroy_workqueue(wq);
 }
 
-module_init_order(mlx4_ib_init, SI_ORDER_THIRD);
-module_exit(mlx4_ib_cleanup);
+module_init_order(mlx4_ib_init, SI_ORDER_SEVENTH);
+module_exit_order(mlx4_ib_cleanup, SI_ORDER_SEVENTH);
 
 static int
 mlx4ib_evhand(module_t mod, int event, void *arg)

Modified: head/sys/dev/mlx5/mlx5_core/mlx5_main.c
==
--- head/sys/dev/mlx5/mlx5_core/mlx5_main.c Mon Jul  6 08:36:14 2020
(r362952)
+++ head/sys/dev/mlx5/mlx5_core/mlx5_main.c Mon Jul  6 08:50:11 2020
(r362953)
@@ -2026,5 +2026,5 @@ static void __exit cleanup(void)
pci_unregister_driver(_core_driver);
 }
 
-module_init(init);
-module_exit(cleanup);
+module_init_order(init, SI_ORDER_FIRST);
+module_exit_order(cleanup, SI_ORDER_FIRST);

Modified: head/sys/dev/mlx5/mlx5_en/mlx5_en_main.c
==
--- head/sys/dev/mlx5/mlx5_en/mlx5_en_main.cMon Jul  6 08:36:14 2020
(r362952)
+++ head/sys/dev/mlx5/mlx5_en/mlx5_en_main.cMon Jul  6 08:50:11 2020
(r362953)
@@ -4723,8 +4723,8 @@ mlx5e_show_version(void __unused *arg)
 }
 SYSINIT(mlx5e_show_version, SI_SUB_DRIVERS, SI_ORDER_ANY, mlx5e_show_version, 
NULL);
 
-module_init_order(mlx5e_init, SI_ORDER_THIRD);
-module_exit_order(mlx5e_cleanup, SI_ORDER_THIRD);
+module_init_order(mlx5e_init, SI_ORDER_SIXTH);
+module_exit_order(mlx5e_cleanup, SI_ORDER_SIXTH);
 
 #if (__FreeBSD_version 

svn commit: r362952 - head/usr.sbin/bhyve

2020-07-06 Thread Peter Grehan
Author: grehan
Date: Mon Jul  6 08:36:14 2020
New Revision: 362952
URL: https://svnweb.freebsd.org/changeset/base/362952

Log:
  Silence ACPI RTC error/warning in Linux guests.
  
  Allow guests to   set the RTC bit in the ACPI PM control register.
  This eliminates an annoying   (and harmless) Linux kernel boot message.
  
  PR:   244721
  Submitted by: Jose Luis Duran
  MFC after:1 week

Modified:
  head/usr.sbin/bhyve/pm.c

Modified: head/usr.sbin/bhyve/pm.c
==
--- head/usr.sbin/bhyve/pm.cMon Jul  6 02:00:35 2020(r362951)
+++ head/usr.sbin/bhyve/pm.cMon Jul  6 08:36:14 2020(r362952)
@@ -198,7 +198,7 @@ pm1_enable_handler(struct vmctx *ctx, int vcpu, int in
 * the global lock, but ACPI-CA whines profusely if it
 * can't set GBL_EN.
 */
-   pm1_enable = *eax & (PM1_PWRBTN_EN | PM1_GBL_EN);
+   pm1_enable = *eax & (PM1_RTC_EN | PM1_PWRBTN_EN | PM1_GBL_EN);
sci_update(ctx);
}
pthread_mutex_unlock(_lock);
___
svn-src-head@freebsd.org mailing list
https://lists.freebsd.org/mailman/listinfo/svn-src-head
To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"


Re: svn commit: r362809 - head/contrib/mandoc

2020-07-06 Thread Gordon Bergling
On Sun, Jul 05, 2020 at 10:22:58AM -0700, Rodney W. Grimes wrote:
> > On Thu, Jul 02, 2020 at 12:06:13AM +, Alexey Dokuchaev wrote:
> > > On Wed, Jul 01, 2020 at 05:01:00PM -0700, Rodney W. Grimes wrote:
> > > > Thats good, but realize the page already contains history that
> > > > reads like:
> > > > 
> > > > HISTORY
> > > >  Part of the functionality of whatis was already provided by the 
> > > > former
> > > >  manwhere utility in 1BSD. The apropos and whatis utilities first 
> > > > ap-
> > > >  peared in 2BSD.  They were rewritten from scratch for OpenBSD 5.6.
> > > > 
> > > >  The -M option and the MANPATH variable first appeared in 4.3BSD; 
> > > > -m in
> > > >  4.3BSD-Reno; -C in 4.4BSD Lite1; and -S and -s in OpenBSD 4.5 for 
> > > > apropos
> > > >  and in OpenBSD 5.6 for whatis.  The options -acfhIKklOTWw appeared 
> > > > in
> > > >  OpenBSD 5.7.
> > > > 
> > > > And further contains:
> > > > 
> > > > AUTHORS
> > > >  Bill Joy wrote manwhere in 1977 and the original BSD apropos and 
> > > > whatis
> > > >  in February 1979. The current version was written by Kristaps 
> > > > Dzonsons
> > > >   and Ingo Schwarze .
> > > > 
> > > > So the history is rich and complete, do we really need to say when we
> > > > incorporated this into FreeBSD from OpenBSD's mandoc in the manual page?
> > > 
> > > Ah, in this case, the only thing lacking from the current version is 
> > > mention
> > > of FreeBSD 11.1.  Sorry for not checking with that before writing my 
> > > reply.
> > > My main point, however, was that reverse chronological order looks 
> > > strange.
> > 
> > I have created the following differential and integrated the given feedback.
> > 
> > https://reviews.freebsd.org/D25566
> > 
> > If necessary I could revert r362809, but somebody should explicit request 
> > it.
> 
> Consider it so requested.

Consider it done.

--Gordon

> -- 
> Rod Grimes rgri...@freebsd.org
> ___
> svn-src-head@freebsd.org mailing list
> https://lists.freebsd.org/mailman/listinfo/svn-src-head
> To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"

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