svn commit: r360560 - head/sys/netipsec

2020-05-01 Thread John Baldwin
Author: jhb
Date: Sat May  2 01:00:29 2020
New Revision: 360560
URL: https://svnweb.freebsd.org/changeset/base/360560

Log:
  Don't pass bogus keys down for NULL algorithms.
  
  The changes in r359374 added various sanity checks in sessions and
  requests created by crypto consumers in part to permit backend drivers
  to make assumptions instead of duplicating checks for various edge
  cases.  One of the new checks was to reject sessions which provide a
  pointer to a key while claiming the key is zero bits long.
  
  IPsec ESP tripped over this as it passes along whatever key is
  provided for NULL, including a pointer to a zero-length key when an
  empty string ("") is used with setkey(8).  One option would be to
  teach the IPsec key layer to not allocate keys of zero length, but I
  went with a simpler fix of just not passing any keys down and always
  using a key length of zero for NULL algorithms.
  
  PR:   245832
  Reported by:  CI

Modified:
  head/sys/netipsec/xform_ah.c
  head/sys/netipsec/xform_esp.c

Modified: head/sys/netipsec/xform_ah.c
==
--- head/sys/netipsec/xform_ah.cSat May  2 00:10:25 2020
(r360559)
+++ head/sys/netipsec/xform_ah.cSat May  2 01:00:29 2020
(r360560)
@@ -215,8 +215,10 @@ ah_init0(struct secasvar *sav, struct xformsw *xsp,
 
/* Initialize crypto session. */
csp->csp_auth_alg = sav->tdb_authalgxform->type;
-   csp->csp_auth_klen = _KEYBITS(sav->key_auth) / 8;
-   csp->csp_auth_key = sav->key_auth->key_data;
+   if (csp->csp_auth_alg != CRYPTO_NULL_HMAC) {
+   csp->csp_auth_klen = _KEYBITS(sav->key_auth) / 8;
+   csp->csp_auth_key = sav->key_auth->key_data;
+   };
csp->csp_auth_mlen = AUTHSIZE(sav);
 
return 0;

Modified: head/sys/netipsec/xform_esp.c
==
--- head/sys/netipsec/xform_esp.c   Sat May  2 00:10:25 2020
(r360559)
+++ head/sys/netipsec/xform_esp.c   Sat May  2 01:00:29 2020
(r360560)
@@ -220,9 +220,11 @@ esp_init(struct secasvar *sav, struct xformsw *xsp)
 
/* Initialize crypto session. */
csp.csp_cipher_alg = sav->tdb_encalgxform->type;
-   csp.csp_cipher_key = sav->key_enc->key_data;
-   csp.csp_cipher_klen = _KEYBITS(sav->key_enc) / 8 -
-   SAV_ISCTRORGCM(sav) * 4;
+   if (csp.csp_cipher_alg != CRYPTO_NULL_CBC) {
+   csp.csp_cipher_key = sav->key_enc->key_data;
+   csp.csp_cipher_klen = _KEYBITS(sav->key_enc) / 8 -
+   SAV_ISCTRORGCM(sav) * 4;
+   };
csp.csp_ivlen = txform->ivsize;
 
error = crypto_newsession(>tdb_cryptoid, , V_crypto_support);
___
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: r360557 - in head: lib/libipsec sbin/setkey sys/netipsec usr.bin/netstat

2020-05-01 Thread John Baldwin
On 5/1/20 5:06 PM, John Baldwin wrote:
> Author: jhb
> Date: Sat May  2 00:06:58 2020
> New Revision: 360557
> URL: https://svnweb.freebsd.org/changeset/base/360557
> 
> Log:
>   Remove support for IPsec algorithms deprecated in r348205 and r360202.
>   
>   Examples of depecrated algorithms in manual pages and sample configs
>   are updated where relevant.  I removed the one example of combining
>   ESP and AH (vs using a cipher and auth in ESP) as RFC 8221 says this
>   combination is NOT RECOMMENDED.
>   
>   Specifically, this removes support for the following ciphers:
>   - des-cbc
>   - 3des-cbc
>   - blowfish-cbc
>   - cast128-cbc
>   - des-deriv
>   - des-32iv
>   - camellia-cbc
>   
>   This also removes support for the following authentication algorithms:
>   - hmac-md5
>   - keyed-md5
>   - keyed-sha1
>   - hmac-ripemd160
>   
>   Reviewed by:cem, gnn (older verisons)
>   Relnotes:   yes
>   Sponsored by:   Chelsio Communications
>   Differential Revision:  https://reviews.freebsd.org/D24342

Oops, forgot:

PR: 245834 (exp-run)

-- 
John Baldwin
___
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: r360559 - head/sbin/dumpfs

2020-05-01 Thread Chuck Silvers
Author: chs
Date: Sat May  2 00:10:25 2020
New Revision: 360559
URL: https://svnweb.freebsd.org/changeset/base/360559

Log:
  Print the fs last-mounted time too.
  
  Reviewed by:  mckusick
  Approved by:  mckusick (mentor)
  Sponsored by: Netflix

Modified:
  head/sbin/dumpfs/dumpfs.c

Modified: head/sbin/dumpfs/dumpfs.c
==
--- head/sbin/dumpfs/dumpfs.c   Sat May  2 00:08:44 2020(r360558)
+++ head/sbin/dumpfs/dumpfs.c   Sat May  2 00:10:25 2020(r360559)
@@ -156,7 +156,7 @@ dumpfsid(void)
 static int
 dumpfs(const char *name)
 {
-   time_t fstime;
+   time_t fstime, fsmtime;
int64_t fssize;
int32_t fsflags;
int i;
@@ -165,8 +165,10 @@ dumpfs(const char *name)
case 2:
fssize = afs.fs_size;
fstime = afs.fs_time;
-   printf("magic\t%x (UFS2)\ttime\t%s",
-   afs.fs_magic, ctime());
+   fsmtime = afs.fs_mtime;
+   printf("magic\t%x (UFS2)\n", afs.fs_magic);
+   printf("last mounted time\t%s", ctime());
+   printf("last modified time\t%s", ctime());
printf("superblock location\t%jd\tid\t[ %08x %08x ]\n",
(intmax_t)afs.fs_sblockloc, afs.fs_id[0], afs.fs_id[1]);
printf("ncg\t%d\tsize\t%jd\tblocks\t%jd\n",
___
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: r360558 - head

2020-05-01 Thread John Baldwin
Author: jhb
Date: Sat May  2 00:08:44 2020
New Revision: 360558
URL: https://svnweb.freebsd.org/changeset/base/360558

Log:
  Document removal of deprecated IPsec algorithms.

Modified:
  head/RELNOTES

Modified: head/RELNOTES
==
--- head/RELNOTES   Sat May  2 00:06:58 2020(r360557)
+++ head/RELNOTES   Sat May  2 00:08:44 2020(r360558)
@@ -10,6 +10,11 @@ newline.  Entries should be separated by a newline.
 
 Changes to this file should not be MFCed.
 
+r360557:
+   Remove support for DES, Triple DES, Blowfish, Cast, and
+   Camellia ciphers from IPsec(4).  Remove support for MD5-HMAC,
+   Keyed MD5, Keyed SHA1, and RIPEMD160-HMAC from IPsec(4).
+
 r359945:
Remove support for Triple DES, Blowfish, and MD5 HMAC from
geli(4).
___
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: r360557 - in head: lib/libipsec sbin/setkey sys/netipsec usr.bin/netstat

2020-05-01 Thread John Baldwin
Author: jhb
Date: Sat May  2 00:06:58 2020
New Revision: 360557
URL: https://svnweb.freebsd.org/changeset/base/360557

Log:
  Remove support for IPsec algorithms deprecated in r348205 and r360202.
  
  Examples of depecrated algorithms in manual pages and sample configs
  are updated where relevant.  I removed the one example of combining
  ESP and AH (vs using a cipher and auth in ESP) as RFC 8221 says this
  combination is NOT RECOMMENDED.
  
  Specifically, this removes support for the following ciphers:
  - des-cbc
  - 3des-cbc
  - blowfish-cbc
  - cast128-cbc
  - des-deriv
  - des-32iv
  - camellia-cbc
  
  This also removes support for the following authentication algorithms:
  - hmac-md5
  - keyed-md5
  - keyed-sha1
  - hmac-ripemd160
  
  Reviewed by:  cem, gnn (older verisons)
  Relnotes: yes
  Sponsored by: Chelsio Communications
  Differential Revision:https://reviews.freebsd.org/D24342

Modified:
  head/lib/libipsec/pfkey_dump.c
  head/sbin/setkey/sample.cf
  head/sbin/setkey/setkey.8
  head/sbin/setkey/test-pfkey.c
  head/sbin/setkey/token.l
  head/sys/netipsec/ipsec.c
  head/sys/netipsec/ipsec.h
  head/sys/netipsec/key.c
  head/sys/netipsec/xform_ah.c
  head/sys/netipsec/xform_esp.c
  head/usr.bin/netstat/ipsec.c

Modified: head/lib/libipsec/pfkey_dump.c
==
--- head/lib/libipsec/pfkey_dump.c  Fri May  1 23:07:23 2020
(r360556)
+++ head/lib/libipsec/pfkey_dump.c  Sat May  2 00:06:58 2020
(r360557)
@@ -57,22 +57,10 @@ __FBSDID("$FreeBSD$");
 #include "libpfkey.h"
 
 /* cope with old kame headers - ugly */
-#ifndef SADB_X_AALG_MD5
-#define SADB_X_AALG_MD5SADB_AALG_MD5   
-#endif
-#ifndef SADB_X_AALG_SHA
-#define SADB_X_AALG_SHASADB_AALG_SHA
-#endif
 #ifndef SADB_X_AALG_NULL
 #define SADB_X_AALG_NULL   SADB_AALG_NULL
 #endif
 
-#ifndef SADB_X_EALG_BLOWFISHCBC
-#define SADB_X_EALG_BLOWFISHCBCSADB_EALG_BLOWFISHCBC
-#endif
-#ifndef SADB_X_EALG_CAST128CBC
-#define SADB_X_EALG_CAST128CBC SADB_EALG_CAST128CBC
-#endif
 #ifndef SADB_X_EALG_RC5CBC
 #ifdef SADB_EALG_RC5CBC
 #define SADB_X_EALG_RC5CBC SADB_EALG_RC5CBC
@@ -147,10 +135,7 @@ static char *str_state[] = {
 
 static struct val2str str_alg_auth[] = {
{ SADB_AALG_NONE, "none", },
-   { SADB_AALG_MD5HMAC, "hmac-md5", },
{ SADB_AALG_SHA1HMAC, "hmac-sha1", },
-   { SADB_X_AALG_MD5, "md5", },
-   { SADB_X_AALG_SHA, "sha", },
{ SADB_X_AALG_NULL, "null", },
{ SADB_X_AALG_TCP_MD5, "tcp-md5", },
 #ifdef SADB_X_AALG_SHA2_256
@@ -162,9 +147,6 @@ static struct val2str str_alg_auth[] = {
 #ifdef SADB_X_AALG_SHA2_512
{ SADB_X_AALG_SHA2_512, "hmac-sha2-512", },
 #endif
-#ifdef SADB_X_AALG_RIPEMD160HMAC
-   { SADB_X_AALG_RIPEMD160HMAC, "hmac-ripemd160", },
-#endif
 #ifdef SADB_X_AALG_AES_XCBC_MAC
{ SADB_X_AALG_AES_XCBC_MAC, "aes-xcbc-mac", },
 #endif
@@ -173,14 +155,10 @@ static struct val2str str_alg_auth[] = {
 
 static struct val2str str_alg_enc[] = {
{ SADB_EALG_NONE, "none", },
-   { SADB_EALG_DESCBC, "des-cbc", },
-   { SADB_EALG_3DESCBC, "3des-cbc", },
{ SADB_EALG_NULL, "null", },
 #ifdef SADB_X_EALG_RC5CBC
{ SADB_X_EALG_RC5CBC, "rc5-cbc", },
 #endif
-   { SADB_X_EALG_CAST128CBC, "cast128-cbc", },
-   { SADB_X_EALG_BLOWFISHCBC, "blowfish-cbc", },
 #ifdef SADB_X_EALG_RIJNDAELCBC
{ SADB_X_EALG_RIJNDAELCBC, "rijndael-cbc", },
 #endif
@@ -192,9 +170,6 @@ static struct val2str str_alg_enc[] = {
 #endif
 #ifdef SADB_X_EALG_AESGCM16
{ SADB_X_EALG_AESGCM16, "aes-gcm-16", },
-#endif
-#ifdef SADB_X_EALG_CAMELLIACBC
-   { SADB_X_EALG_CAMELLIACBC, "camellia-cbc", },
 #endif
{ -1, NULL, },
 };

Modified: head/sbin/setkey/sample.cf
==
--- head/sbin/setkey/sample.cf  Fri May  1 23:07:23 2020(r360556)
+++ head/sbin/setkey/sample.cf  Sat May  2 00:06:58 2020(r360557)
@@ -34,9 +34,9 @@
 # parameters when you configure by manual keying.
 
 # ESP transport mode is recommended for TCP port number 110 between
-# Host-A and Host-B. Encryption algorithm is blowfish-cbc whose key
-# is "kamekame", and authentication algorithm is hmac-sha1 whose key
-# is "this is the test key".
+# Host-A and Host-B. Encryption algorithm is aes-cbc whose key
+# is "kamekamekamekamekamekamekamekame", and authentication algorithm is
+# hmac-sha2-512 whose key is "this is the test key".
 #
 #    ESP 
 #   |   |
@@ -50,17 +50,17 @@ spdadd fec0::11[110] fec0::10[any] tcp -P in ipsec
esp/transport//use ;
 add fec0::10 fec0::11 esp 0x10001
-m transport
-   -E blowfish-cbc "kamekame"
-   -A hmac-sha1 "this is the test key" ;
+   -E aes-cbc "kamekamekamekamekamekamekamekame"
+   -A hmac-sha2-512 "this is the test key" ;
 add fec0::11 fec0::10 

svn commit: r360556 - stable/11/sys/fs/nfsserver

2020-05-01 Thread Rick Macklem
Author: rmacklem
Date: Fri May  1 23:07:23 2020
New Revision: 360556
URL: https://svnweb.freebsd.org/changeset/base/360556

Log:
  MFC: r360032
  Add a sanity check for nes_numsecflavor to the NFS server.
  
  Ryan Moeller reported crashes in the NFS server that appear to be
  caused by stack corruption in nfsrv_compound(). It appears that
  the stack got corrupted just after a NFSv4.1 Lookup that crosses
  a server mount point.
  Although it is just a "theory" at this point, the most obvious way
  the stack could get corrupted would be if nfsvno_checkexp() somehow
  acquires an export with a bogus nes_numsecflavor value. This would
  cause the copying of the secflavors to run off the end of the array,
  which is allocated on the stack below where the corruption occurs.
  
  This sanity check is simple to do and would stop the stack corruption
  if the theory is correct. Otherwise, doing the sanity check seems to
  be a reasonable safety belt to add to the code.

Modified:
  stable/11/sys/fs/nfsserver/nfs_nfsdport.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/fs/nfsserver/nfs_nfsdport.c
==
--- stable/11/sys/fs/nfsserver/nfs_nfsdport.c   Fri May  1 22:37:09 2020
(r360555)
+++ stable/11/sys/fs/nfsserver/nfs_nfsdport.c   Fri May  1 23:07:23 2020
(r360556)
@@ -2746,6 +2746,11 @@ nfsvno_checkexp(struct mount *mp, struct sockaddr *nam
exp->nes_numsecflavor = 0;
error = 0;
}
+   } else if (exp->nes_numsecflavor < 1 || exp->nes_numsecflavor >
+   MAXSECFLAVORS) {
+   printf("nfsvno_checkexp: numsecflavors out of range\n");
+   exp->nes_numsecflavor = 0;
+   error = EACCES;
} else {
/* Copy the security flavors. */
for (i = 0; i < exp->nes_numsecflavor; i++)
@@ -2782,6 +2787,12 @@ nfsvno_fhtovp(struct mount *mp, fhandle_t *fhp, struct
} else {
vput(*vpp);
}
+   } else if (exp->nes_numsecflavor < 1 || exp->nes_numsecflavor >
+   MAXSECFLAVORS) {
+   printf("nfsvno_fhtovp: numsecflavors out of range\n");
+   exp->nes_numsecflavor = 0;
+   error = EACCES;
+   vput(*vpp);
} else {
/* Copy the security flavors. */
for (i = 0; i < exp->nes_numsecflavor; i++)
___
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: r360555 - stable/12/sys/fs/nfsserver

2020-05-01 Thread Rick Macklem
Author: rmacklem
Date: Fri May  1 22:37:09 2020
New Revision: 360555
URL: https://svnweb.freebsd.org/changeset/base/360555

Log:
  MFC: r360032
  Add a sanity check for nes_numsecflavor to the NFS server.
  
  Ryan Moeller reported crashes in the NFS server that appear to be
  caused by stack corruption in nfsrv_compound(). It appears that
  the stack got corrupted just after a NFSv4.1 Lookup that crosses
  a server mount point.
  Although it is just a "theory" at this point, the most obvious way
  the stack could get corrupted would be if nfsvno_checkexp() somehow
  acquires an export with a bogus nes_numsecflavor value. This would
  cause the copying of the secflavors to run off the end of the array,
  which is allocated on the stack below where the corruption occurs.
  
  This sanity check is simple to do and would stop the stack corruption
  if the theory is correct. Otherwise, doing the sanity check seems to
  be a reasonable safety belt to add to the code.

Modified:
  stable/12/sys/fs/nfsserver/nfs_nfsdport.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/fs/nfsserver/nfs_nfsdport.c
==
--- stable/12/sys/fs/nfsserver/nfs_nfsdport.c   Fri May  1 21:59:47 2020
(r360554)
+++ stable/12/sys/fs/nfsserver/nfs_nfsdport.c   Fri May  1 22:37:09 2020
(r360555)
@@ -3015,6 +3015,11 @@ nfsvno_checkexp(struct mount *mp, struct sockaddr *nam
exp->nes_numsecflavor = 0;
error = 0;
}
+   } else if (exp->nes_numsecflavor < 1 || exp->nes_numsecflavor >
+   MAXSECFLAVORS) {
+   printf("nfsvno_checkexp: numsecflavors out of range\n");
+   exp->nes_numsecflavor = 0;
+   error = EACCES;
} else {
/* Copy the security flavors. */
for (i = 0; i < exp->nes_numsecflavor; i++)
@@ -3051,6 +3056,12 @@ nfsvno_fhtovp(struct mount *mp, fhandle_t *fhp, struct
} else {
vput(*vpp);
}
+   } else if (exp->nes_numsecflavor < 1 || exp->nes_numsecflavor >
+   MAXSECFLAVORS) {
+   printf("nfsvno_fhtovp: numsecflavors out of range\n");
+   exp->nes_numsecflavor = 0;
+   error = EACCES;
+   vput(*vpp);
} else {
/* Copy the security flavors. */
for (i = 0; i < exp->nes_numsecflavor; i++)
___
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: r360554 - head/sys/riscv/riscv

2020-05-01 Thread Mitchell Horne
Author: mhorne
Date: Fri May  1 21:59:47 2020
New Revision: 360554
URL: https://svnweb.freebsd.org/changeset/base/360554

Log:
  Use the HSM SBI extension to halt CPUs
  
  Differential Revision:https://reviews.freebsd.org/D24498

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

Modified: head/sys/riscv/riscv/machdep.c
==
--- head/sys/riscv/riscv/machdep.c  Fri May  1 21:58:19 2020
(r360553)
+++ head/sys/riscv/riscv/machdep.c  Fri May  1 21:59:47 2020
(r360554)
@@ -473,9 +473,16 @@ void
 cpu_halt(void)
 {
 
+   /*
+* Try to power down using the HSM SBI extension and fall back to a
+* simple wfi loop.
+*/
intr_disable();
+   if (sbi_probe_extension(SBI_EXT_ID_HSM) != 0)
+   sbi_hsm_hart_stop();
for (;;)
__asm __volatile("wfi");
+   /* NOTREACHED */
 }
 
 /*
___
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: r360553 - head/sys/riscv/riscv

2020-05-01 Thread Mitchell Horne
Author: mhorne
Date: Fri May  1 21:58:19 2020
New Revision: 360553
URL: https://svnweb.freebsd.org/changeset/base/360553

Log:
  Use the HSM SBI extension to start APs
  
  The addition of the HSM SBI extension to OpenSBI introduces a new
  breaking change: secondary harts will remain parked in the firmware,
  until they are brought up explicitly via sbi_hsm_hart_start(). Add
  the call to do this, sending the secondary harts to mpentry.
  
  If the HSM extension is not present, secondary harts are assumed to be
  released by the firmware, as is the case for OpenSBI =< v0.6 and BBL.
  
  In the case that the HSM call fails we exclude the CPU, notify the
  user, and allow the system to proceed with booting.
  
  Reviewed by:  markj (older version)
  Differential Revision:https://reviews.freebsd.org/D24497

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

Modified: head/sys/riscv/riscv/mp_machdep.c
==
--- head/sys/riscv/riscv/mp_machdep.c   Fri May  1 21:55:51 2020
(r360552)
+++ head/sys/riscv/riscv/mp_machdep.c   Fri May  1 21:58:19 2020
(r360553)
@@ -97,6 +97,7 @@ static uint32_t cpu_reg[MAXCPU][2];
 #endif
 static device_t cpu_list[MAXCPU];
 
+void mpentry(u_long hartid);
 void init_secondary(uint64_t);
 
 static struct mtx ap_boot_mtx;
@@ -297,7 +298,7 @@ smp_after_idle_runnable(void *arg __unused)
struct pcpu *pc;
int cpu;
 
-   for (cpu = 1; cpu < mp_ncpus; cpu++) {
+   for (cpu = 1; cpu <= mp_maxid; cpu++) {
if (bootstacks[cpu] != NULL) {
pc = pcpu_find(cpu);
while (atomic_load_ptr(>pc_curpcb) == NULL)
@@ -399,9 +400,11 @@ static boolean_t
 cpu_init_fdt(u_int id, phandle_t node, u_int addr_size, pcell_t *reg)
 {
struct pcpu *pcpup;
+   vm_paddr_t start_addr;
uint64_t hart;
u_int cpuid;
int naps;
+   int error;
 
/* Check if this hart supports MMU. */
if (OF_getproplen(node, "mmu-type") < 0)
@@ -440,6 +443,23 @@ cpu_init_fdt(u_int id, phandle_t node, u_int addr_size
/* Check if we are able to start this cpu */
if (cpuid > mp_maxid)
return (0);
+
+   /*
+* Depending on the SBI implementation, APs are waiting either in
+* locore.S or to be activated explicitly, via SBI call.
+*/
+   if (sbi_probe_extension(SBI_EXT_ID_HSM) != 0) {
+   start_addr = pmap_kextract((vm_offset_t)mpentry);
+   error = sbi_hsm_hart_start(hart, start_addr, 0);
+   if (error != 0) {
+   mp_ncpus--;
+
+   /* Send a warning to the user and continue. */
+   printf("AP %u (hart %lu) failed to start, error %d\n",
+   cpuid, hart, error);
+   return (0);
+   }
+   }
 
pcpup = &__pcpu[cpuid];
pcpu_init(pcpup, cpuid, sizeof(struct pcpu));
___
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: r360552 - in head/sys/riscv: include riscv

2020-05-01 Thread Mitchell Horne
Author: mhorne
Date: Fri May  1 21:55:51 2020
New Revision: 360552
URL: https://svnweb.freebsd.org/changeset/base/360552

Log:
  Add support for HSM SBI extension
  
  The Hardware State Management (HSM) extension provides a set of SBI
  calls that allow the supervisor software to start and stop hart
  execution.
  
  The HSM extension has been implemented in OpenSBI and is present in
  the v0.7 release.
  
  [1] https://github.com/riscv/riscv-sbi-doc/blob/master/riscv-sbi.adoc
  
  Reviewed by:  br
  Differential Revision:https://reviews.freebsd.org/D24496

Modified:
  head/sys/riscv/include/sbi.h
  head/sys/riscv/riscv/sbi.c

Modified: head/sys/riscv/include/sbi.h
==
--- head/sys/riscv/include/sbi.hFri May  1 21:52:29 2020
(r360551)
+++ head/sys/riscv/include/sbi.hFri May  1 21:55:51 2020
(r360552)
@@ -55,6 +55,7 @@
 #defineSBI_ERR_INVALID_PARAM   -3
 #defineSBI_ERR_DENIED  -4
 #defineSBI_ERR_INVALID_ADDRESS -5
+#defineSBI_ERR_ALREADY_AVAILABLE   -6
 
 /* SBI Base Extension */
 #defineSBI_EXT_ID_BASE 0x10
@@ -66,6 +67,16 @@
 #defineSBI_BASE_GET_MARCHID5
 #defineSBI_BASE_GET_MIMPID 6
 
+/* Hart State Management (HSM) Extension */
+#defineSBI_EXT_ID_HSM  0x48534D
+#defineSBI_HSM_HART_START  0
+#defineSBI_HSM_HART_STOP   1
+#defineSBI_HSM_HART_STATUS 2
+#define SBI_HSM_STATUS_STARTED 0
+#define SBI_HSM_STATUS_STOPPED 1
+#define SBI_HSM_STATUS_START_PENDING   2
+#define SBI_HSM_STATUS_STOP_PENDING3
+
 /* Legacy Extensions */
 #defineSBI_SET_TIMER   0
 #defineSBI_CONSOLE_PUTCHAR 1
@@ -127,6 +138,30 @@ sbi_probe_extension(long id)
 {
return (SBI_CALL1(SBI_EXT_ID_BASE, SBI_BASE_PROBE_EXTENSION, id).value);
 }
+
+/* Hart State Management extension functions. */
+
+/*
+ * Start execution on the specified hart at physical address start_addr. The
+ * register a0 will contain the hart's ID, and a1 will contain the value of
+ * priv.
+ */
+int sbi_hsm_hart_start(u_long hart, u_long start_addr, u_long priv);
+
+/*
+ * Stop execution on the current hart. Interrupts should be disabled, or this
+ * function may return.
+ */
+void sbi_hsm_hart_stop(void);
+
+/*
+ * Get the execution status of the specified hart. The status will be one of:
+ *  - SBI_HSM_STATUS_STARTED
+ *  - SBI_HSM_STATUS_STOPPED
+ *  - SBI_HSM_STATUS_START_PENDING
+ *  - SBI_HSM_STATUS_STOP_PENDING
+ */
+int sbi_hsm_hart_status(u_long hart);
 
 /* Legacy extension functions. */
 static __inline void

Modified: head/sys/riscv/riscv/sbi.c
==
--- head/sys/riscv/riscv/sbi.c  Fri May  1 21:52:29 2020(r360551)
+++ head/sys/riscv/riscv/sbi.c  Fri May  1 21:55:51 2020(r360552)
@@ -113,6 +113,31 @@ sbi_print_version(void)
printf("SBI Specification Version: %u.%u\n", major, minor);
 }
 
+int
+sbi_hsm_hart_start(u_long hart, u_long start_addr, u_long priv)
+{
+   struct sbi_ret ret;
+
+   ret = SBI_CALL3(SBI_EXT_ID_HSM, SBI_HSM_HART_START, hart, start_addr, 
priv);
+   return (ret.error != 0 ? (int)ret.error : 0);
+}
+
+void
+sbi_hsm_hart_stop(void)
+{
+   (void)SBI_CALL0(SBI_EXT_ID_HSM, SBI_HSM_HART_STOP);
+}
+
+int
+sbi_hsm_hart_status(u_long hart)
+{
+   struct sbi_ret ret;
+
+   ret = SBI_CALL1(SBI_EXT_ID_HSM, SBI_HSM_HART_STATUS, hart);
+
+   return (ret.error != 0 ? (int)ret.error : (int)ret.value);
+}
+
 void
 sbi_init(void)
 {
___
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: r360551 - head/sys/riscv/riscv

2020-05-01 Thread Mitchell Horne
Author: mhorne
Date: Fri May  1 21:52:29 2020
New Revision: 360551
URL: https://svnweb.freebsd.org/changeset/base/360551

Log:
  Make mpentry independent of _start
  
  APs enter the kernel at the same point as the BSP, the _start routine.
  They then jump to mpentry, but not before storing the kernel's physical
  load address in the s9 register. Extract this calculation into its own
  routine, so that APs can be instructed to enter directly from mpentry.
  
  Differential Revision:https://reviews.freebsd.org/D24495

Modified:
  head/sys/riscv/riscv/locore.S

Modified: head/sys/riscv/riscv/locore.S
==
--- head/sys/riscv/riscv/locore.S   Fri May  1 21:24:19 2020
(r360550)
+++ head/sys/riscv/riscv/locore.S   Fri May  1 21:52:29 2020
(r360551)
@@ -59,13 +59,6 @@ _start:
lla gp, __global_pointer$
 .option pop
 
-   /* Get the physical address kernel loaded to */
-   lla t0, virt_map
-   ld  t1, 0(t0)
-   sub t1, t1, t0
-   li  t2, KERNBASE
-   sub s9, t2, t1  /* s9 = physmem base */
-
/*
 * a0 = hart id
 * a1 = dtbp
@@ -87,6 +80,9 @@ _start:
 * Page tables
 */
 1:
+   /* Get the kernel's load address */
+   jal get_physmem
+
/* Add L1 entry for kernel */
lla s1, pagetable_l1
lla s2, pagetable_l2/* Link to next level PN */
@@ -224,6 +220,17 @@ va:
call_C_LABEL(initriscv) /* Off we go */
call_C_LABEL(mi_startup)
 
+/*
+ * Get the physical address the kernel is loaded to. Returned in s9.
+ */
+get_physmem:
+   lla t0, virt_map/* physical address of virt_map */
+   ld  t1, 0(t0)   /* virtual address of virt_map */
+   sub t1, t1, t0  /* calculate phys->virt delta */
+   li  t2, KERNBASE
+   sub s9, t2, t1  /* s9 = physmem base */
+   ret
+
.align  4
 initstack:
.space  (PAGE_SIZE * KSTACK_PAGES)
@@ -302,6 +309,9 @@ ENTRY(mpentry)
/* Setup stack pointer */
lla t0, bootstack
ld  sp, 0(t0)
+
+   /* Get the kernel's load address */
+   jal get_physmem
 
/* Setup supervisor trap vector */
lla t0, mpva
___
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: r360549 - head/sys/dev/nvme

2020-05-01 Thread Warner Losh
Author: imp
Date: Fri May  1 21:24:15 2020
New Revision: 360549
URL: https://svnweb.freebsd.org/changeset/base/360549

Log:
  Rename ns notification function...
  
  This function is called whenever the namespace is added, deleted or
  changes. Update the name to reflect that. No functional change.

Modified:
  head/sys/dev/nvme/nvme_sim.c

Modified: head/sys/dev/nvme/nvme_sim.c
==
--- head/sys/dev/nvme/nvme_sim.cFri May  1 21:22:26 2020
(r360548)
+++ head/sys/dev/nvme/nvme_sim.cFri May  1 21:24:15 2020
(r360549)
@@ -315,7 +315,7 @@ err1:
 }
 
 static void *
-nvme_sim_new_ns(struct nvme_namespace *ns, void *sc_arg)
+nvme_sim_ns_change(struct nvme_namespace *ns, void *sc_arg)
 {
struct nvme_sim_softc *sc = sc_arg;
union ccb *ccb;
@@ -339,7 +339,7 @@ nvme_sim_new_ns(struct nvme_namespace *ns, void *sc_ar
}
xpt_rescan(ccb);
 
-   return (ns);
+   return (sc_arg);
 }
 
 static void
@@ -362,7 +362,7 @@ nvme_sim_init(void)
if (nvme_use_nvd)
return;
 
-   consumer_cookie = nvme_register_consumer(nvme_sim_new_ns,
+   consumer_cookie = nvme_register_consumer(nvme_sim_ns_change,
nvme_sim_new_controller, NULL, nvme_sim_controller_fail);
 }
 
___
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: r360550 - head/sys/dev/nvme

2020-05-01 Thread Warner Losh
Author: imp
Date: Fri May  1 21:24:19 2020
New Revision: 360550
URL: https://svnweb.freebsd.org/changeset/base/360550

Log:
  Add KASSERT to ensure sane nsid.
  
  All callers are currently filtering bad nsid to this function,
  however, we'll have undefined behavior if that's not true. Add the
  KASSERT to prevent that.

Modified:
  head/sys/dev/nvme/nvme.c

Modified: head/sys/dev/nvme/nvme.c
==
--- head/sys/dev/nvme/nvme.cFri May  1 21:24:15 2020(r360549)
+++ head/sys/dev/nvme/nvme.cFri May  1 21:24:19 2020(r360550)
@@ -285,13 +285,18 @@ void
 nvme_notify_ns(struct nvme_controller *ctrlr, int nsid)
 {
struct nvme_consumer*cons;
-   struct nvme_namespace   *ns = >ns[nsid - 1];
+   struct nvme_namespace   *ns;
void*ctrlr_cookie;
uint32_ti;
 
+   KASSERT(nsid <= NVME_MAX_NAMESPACES,
+   ("%s: Namespace notification to nsid %d exceeds range\n",
+   device_get_nameunit(ctrlr->dev), nsid));
+
if (!ctrlr->is_initialized)
return;
 
+   ns = >ns[nsid - 1];
for (i = 0; i < NVME_MAX_CONSUMERS; i++) {
cons = _consumer[i];
if (cons->id != INVALID_CONSUMER_ID && cons->ns_fn != NULL &&
___
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: r360548 - stable/12/sys/dev/cxgbe/iw_cxgbe

2020-05-01 Thread Navdeep Parhar
Author: np
Date: Fri May  1 21:22:26 2020
New Revision: 360548
URL: https://svnweb.freebsd.org/changeset/base/360548

Log:
  MFC r360211:
  
  cxgbe/iw_cxgbe: Create a LinuxKPI pci device for an adapter and use it
  as the dma_device during RDMA registration.
  
  cxgbe's struct device cannot be used as-is because it's a native FreeBSD
  driver and ibcore is LinuxKPI based.
  
  Sponsored by: Chelsio Communications

Modified:
  stable/12/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h
  stable/12/sys/dev/cxgbe/iw_cxgbe/provider.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h
==
--- stable/12/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h Fri May  1 20:29:51 2020
(r360547)
+++ stable/12/sys/dev/cxgbe/iw_cxgbe/iw_cxgbe.h Fri May  1 21:22:26 2020
(r360548)
@@ -261,6 +261,7 @@ out:
 
 struct c4iw_dev {
struct ib_device ibdev;
+   struct pci_dev pdev;
struct c4iw_rdev rdev;
u32 device_cap_flags;
struct idr cqidr;

Modified: stable/12/sys/dev/cxgbe/iw_cxgbe/provider.c
==
--- stable/12/sys/dev/cxgbe/iw_cxgbe/provider.c Fri May  1 20:29:51 2020
(r360547)
+++ stable/12/sys/dev/cxgbe/iw_cxgbe/provider.c Fri May  1 21:22:26 2020
(r360548)
@@ -434,6 +434,9 @@ c4iw_register_device(struct c4iw_dev *dev)
 
CTR3(KTR_IW_CXGBE, "%s c4iw_dev %p, adapter %p", __func__, dev, sc);
BUG_ON(!sc->port[0]);
+   ret = linux_pci_attach_device(sc->dev, NULL, NULL, >pdev);
+   if (ret)
+   return (ret);
strlcpy(ibdev->name, device_get_nameunit(sc->dev), sizeof(ibdev->name));
memset(>node_guid, 0, sizeof(ibdev->node_guid));
memcpy(>node_guid, sc->port[0]->vi[0].hw_addr, ETHER_ADDR_LEN);
@@ -465,7 +468,7 @@ c4iw_register_device(struct c4iw_dev *dev)
strlcpy(ibdev->node_desc, C4IW_NODE_DESC, sizeof(ibdev->node_desc));
ibdev->phys_port_cnt = sc->params.nports;
ibdev->num_comp_vectors = 1;
-   ibdev->dma_device = NULL;
+   ibdev->dma_device = >pdev.dev;
ibdev->query_device = c4iw_query_device;
ibdev->query_port = c4iw_query_port;
ibdev->modify_port = c4iw_modify_port;
@@ -517,8 +520,10 @@ c4iw_register_device(struct c4iw_dev *dev)
ibdev->iwcm = iwcm;
 
ret = ib_register_device(>ibdev, NULL);
-   if (ret)
+   if (ret) {
kfree(iwcm);
+   linux_pci_detach_device(>pdev);
+   }
 
return (ret);
 }
@@ -531,6 +536,7 @@ c4iw_unregister_device(struct c4iw_dev *dev)
dev->rdev.adap);
ib_unregister_device(>ibdev);
kfree(dev->ibdev.iwcm);
+   linux_pci_detach_device(>pdev);
return;
 }
 #endif
___
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: r360547 - head/sbin/nvmecontrol

2020-05-01 Thread Warner Losh
Author: imp
Date: Fri May  1 20:29:51 2020
New Revision: 360547
URL: https://svnweb.freebsd.org/changeset/base/360547

Log:
  Document the passthru commands.
  
  Reviewed by: bcr@ (earlier version)
  Differential Revision: https://reviews.freebsd.org/D24639

Modified:
  head/sbin/nvmecontrol/nvmecontrol.8
  head/sbin/nvmecontrol/passthru.c

Modified: head/sbin/nvmecontrol/nvmecontrol.8
==
--- head/sbin/nvmecontrol/nvmecontrol.8 Fri May  1 20:29:46 2020
(r360546)
+++ head/sbin/nvmecontrol/nvmecontrol.8 Fri May  1 20:29:51 2020
(r360547)
@@ -194,6 +194,14 @@
 .\" .Nm
 .\" .Ic wdc purge-monitor
 .\" .Aq device-id
+.Nm
+.Ic admin-passthru
+.Op args
+.Aq Ar device-id
+.Nm
+.Ic io-passthru
+.Op args
+.Aq Ar namespace-id
 .Sh DESCRIPTION
 NVM Express (NVMe) is a storage protocol standard, for SSDs and other
 high-speed storage devices over PCI Express.
@@ -466,6 +474,68 @@ the drive's serial number and the type of dump it is f
 by .bin.
 These logs must be sent to the vendor for analysis.
 This tool only provides a way to extract them.
+.Ss passthru
+The
+.Dq admin-passthru
+and
+.Dq io-passthru
+commands send NVMe commands to
+either the administrative or the data part of the device.
+These commands are expected to be compatible with nvme-cli.
+Please see
+.St The NVMe Standard
+for details.
+.Bl -tag -width 16n
+.It Fl o -opcode Ar opcode
+Opcode to send.
+.It Fl 2 -cdw2 Ar value
+32-bit value for CDW2.
+.It Fl 3 -cdw3 Ar value
+32-bit value for CDW3.
+.It Fl 4 -cdw10 Ar value
+32-bit value for CDW10.
+.It Fl 5 -cdw11 Ar value
+32-bit value for CDW11.
+.It Fl 6 -cdw12 Ar value
+32-bit value for CDW12.
+.It Fl 7 -cdw13 Ar value
+32-bit value for CDW13.
+.It Fl 8 -cdw14 Ar value
+32-bit value for CDW14.
+.It Fl 9 -cdw15 Ar value
+32-bit value for CDW15.
+.It Fl l -data-len
+Length of the data for I/O (bytes).
+.It Fl m -metadata-len
+Length of the metadata segment for command (bytes).
+This is ignored and not implemented in
+.Xr nvme 4 .
+.It Fl f -flags
+Nvme command flags.
+.It Fl n -namespace-id
+Namespace ID for command (Ignored).
+.It Fl p -prefill
+Value to prefill payload with.
+.It Fl b -raw-binary
+Output in binary format (otherwise a hex dump is produced).
+.It Fl d -dry-run
+Do not actually execute the command, but perform sanity checks on it.
+.It Fl r -read
+Command reads data from the device.
+.It Fl s -show-command
+Show all the command values on stdout.
+.It Fl w -write
+Command writes data to the device.
+.El
+Send arbitrary commands to the device.
+Can be used to extract vendor specific logs.
+Transfers to/from the device possible, but limited to
+.Dv MAXPHYS
+bytes.
+Commands either read data or write it, but not both.
+Commands needing metadata are not supported by the
+.Xr nvme 4
+drive.
 .Sh DEVICE NAMES
 Where
 .Aq Ar namespace-id

Modified: head/sbin/nvmecontrol/passthru.c
==
--- head/sbin/nvmecontrol/passthru.cFri May  1 20:29:46 2020
(r360546)
+++ head/sbin/nvmecontrol/passthru.cFri May  1 20:29:51 2020
(r360547)
@@ -292,7 +292,7 @@ static struct cmd io_pass_cmd = {
.ctx_size = sizeof(struct options),
.opts = opts,
.args = args,
-   .descr = "Send a pass through Admin command to the specified device",
+   .descr = "Send a pass through I/O command to the specified device",
 };
 
 CMD_COMMAND(admin_pass_cmd);
___
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: r360546 - head/sbin/nvmecontrol

2020-05-01 Thread Warner Losh
Author: imp
Date: Fri May  1 20:29:46 2020
New Revision: 360546
URL: https://svnweb.freebsd.org/changeset/base/360546

Log:
  Various improvements to this man page:
  
  o Be consistent about device-id and namespace-id
  o Use consistent arg markup for these
  o document you can use disk names too
  o document nsid command better
  o document the idenntify command
  o add a couple of examples.
  
  Differential Revision: https://reviews.freebsd.org/D24638

Modified:
  head/sbin/nvmecontrol/nvmecontrol.8

Modified: head/sbin/nvmecontrol/nvmecontrol.8
==
--- head/sbin/nvmecontrol/nvmecontrol.8 Fri May  1 20:20:23 2020
(r360545)
+++ head/sbin/nvmecontrol/nvmecontrol.8 Fri May  1 20:29:46 2020
(r360546)
@@ -1,4 +1,5 @@
 .\"
+.\" Copyright (c) 2020 Warner Losh 
 .\" Copyright (c) 2018-2019 Alexander Motin 
 .\" Copyright (c) 2012 Intel Corporation
 .\" All rights reserved.
@@ -34,7 +35,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd August 5, 2019
+.Dd April 30, 2020
 .Dt NVMECONTROL 8
 .Os
 .Sh NAME
@@ -47,8 +48,8 @@
 .Ic identify
 .Op Fl v
 .Op Fl x
-.Aq device id
-.Aq namespace id
+.Op Fl n Ar nsid
+.Aq Ar device-id | Ar namespace-id
 .Nm
 .Ic perftest
 .Aq Fl n Ar num_threads
@@ -56,10 +57,10 @@
 .Op Fl p
 .Aq Fl s Ar size_in_bytes
 .Aq Fl t Ar time_in_sec
-.Aq namespace id
+.Aq Ar namespace-id
 .Nm
 .Ic reset
-.Aq controller id
+.Aq Ar device-id
 .Nm
 .Ic logpage
 .Aq Fl p Ar page_id
@@ -69,26 +70,25 @@
 .Op Fl f Ar LSP
 .Op Fl i Ar LSI
 .Op Fl r
-.Aq device id
-.Aq namespace id
+.Aq Ar device-id | Ar namespace-id
 .Nm
 .Ic ns active
-.Aq device id
+.Aq Ar device-id
 .Nm
 .Ic ns allocated
-.Aq device id
+.Aq Ar device-id
 .Nm
 .Ic ns attach
 .Aq Fl n Ar nsid
 .Aq Fl c Ar cntid
-.Aq device id
+.Aq Ar device-id
 .Nm
 .Ic ns attached
 .Aq Fl n Ar nsid
-.Aq device id
+.Aq Ar device-id
 .Nm
 .Ic ns controllers
-.Aq device id
+.Aq Ar device-id
 .Nm
 .Ic ns create
 .Aq Fl s Ar nsze
@@ -100,33 +100,32 @@
 .Op Fl l Ar pil
 .Op Fl L Ar flbas
 .Op Fl d Ar dps
-.Aq device id
+.Aq Ar device-id
 .Nm
 .Ic ns delete
 .Aq Fl n Ar nsid
-.Aq device id
+.Aq Ar device-id
 .Nm
 .Ic ns detach
 .Aq Fl n Ar nsid
 .Aq Fl c Ar cntid
-.Aq device id
+.Aq Ar device-id
 .Nm
 .Ic ns identify
 .Op Fl v
 .Op Fl x
 .Aq Fl n Ar nsid
-.Aq device id
+.Aq Ar device-id
 .Nm
 .Ic nsid
-.Aq device id
-.Aq namespace id
+.Aq Ar device-id | Ar namespace-id
 .Nm
 .Ic resv acquire
 .Aq Fl c Ar crkey
 .Op Fl p Ar prkey
 .Aq Fl t Ar rtype
 .Aq Fl a Ar racqa
-.Aq namespace id
+.Aq Ar namespace-id
 .Nm
 .Ic resv register
 .Op Fl c Ar crkey
@@ -134,25 +133,25 @@
 .Aq Fl r Ar rrega
 .Op Fl i Ar iekey
 .Op Fl p Ar cptpl
-.Aq namespace id
+.Aq Ar namespace-id
 .Nm
 .Ic resv release
 .Aq Fl c Ar crkey
 .Aq Fl t Ar rtype
 .Aq Fl a Ar rrela
-.Aq namespace id
+.Aq Ar namespace-id
 .Nm
 .Ic resv report
 .Op Fl e
 .Op Fl v
 .Op Fl x
-.Aq namespace id
+.Aq Ar namespace-id
 .Nm
 .Ic firmware
 .Op Fl s Ar slot
 .Op Fl f Ar path_to_firmware
 .Op Fl a
-.Aq device id
+.Aq Ar device-id
 .Nm
 .Ic format
 .Op Fl f Ar fmt
@@ -161,8 +160,7 @@
 .Op Fl l Ar pil
 .Op Fl E
 .Op Fl C
-.Aq device id
-.Aq namespace id
+.Aq Ar device-id | Ar namespace-id
 .Nm
 .Ic sanitize
 .Aq Fl a Ar sanact
@@ -172,7 +170,7 @@
 .Op Fl r
 .Op Fl I
 .Op Fl U
-.Aq device id
+.Aq Ar device-id
 .Nm
 .Ic power
 .Op Fl l
@@ -181,25 +179,57 @@
 .Nm
 .Ic wdc cap-diag
 .Op Fl o path_template
-.Aq device id
+.Aq Ar device-id
 .Nm
 .Ic wdc drive-log
 .Op Fl o path_template
-.Aq device id
+.Aq Ar device-id
 .Nm
 .Ic wdc get-crash-dump
 .Op Fl o path_template
-.Aq device id
+.Aq Ar device-id
 .\" .Nm
 .\" .Ic wdc purge
-.\" .Aq device id
+.\" .Aq device-id
 .\" .Nm
 .\" .Ic wdc purge-monitor
-.\" .Aq device id
+.\" .Aq device-id
 .Sh DESCRIPTION
 NVM Express (NVMe) is a storage protocol standard, for SSDs and other
 high-speed storage devices over PCI Express.
 .Pp
+.Ss identify
+The identify commands reports information from the drive's
+.Dv IDENTIFY_CONTROLLER
+if a
+.Ar device-id
+is specified.
+It reports
+.Dv IDENTIFY_NAMESPACE
+data if a
+.Ar namespace-id
+is specified.
+When used with disk names, the
+.Dv IDENTIFY_NAMESPACE
+data is reported, unless the namespace
+.Ar nsid
+is overridden with the
+.Fl n
+flag.
+Then that namespace's data is reported, if it exists.
+The command accepts the following parameters:
+.Bl -tag -width 6n
+.It Fl n
+The namespace
+.Aq nsid
+to use instead of the namespace associated with the device.
+A
+.Ar nsid
+of
+.Dq 0
+is used to retrieve the
+.Dv IDENTIFY_CONTROLLER
+data associated with that drive.
 .Ss logpage
 The logpage command knows how to print log pages of various types.
 It also knows about vendor specific log pages from hgst/wdc and intel.
@@ -250,6 +280,12 @@ will set Retain Asynchronous Event.
 Various namespace management commands.
 If namespace management is supported by device, allow list, create and delete
 namespaces, list, attach and detach controllers to namespaces.
+.Ss nsid

svn commit: r360544 - stable/12/sys/compat/linuxkpi/common/include/linux

2020-05-01 Thread Hans Petter Selasky
Author: hselasky
Date: Fri May  1 19:07:26 2020
New Revision: 360544
URL: https://svnweb.freebsd.org/changeset/base/360544

Log:
  Unbreak DRM KMS build by adding the needed compatibility field in the 
LinuxKPI.
  
  Reported by:  zeising @
  Sponsored by: Mellanox Technologies

Modified:
  stable/12/sys/compat/linuxkpi/common/include/linux/device.h

Modified: stable/12/sys/compat/linuxkpi/common/include/linux/device.h
==
--- stable/12/sys/compat/linuxkpi/common/include/linux/device.h Fri May  1 
18:36:48 2020(r360543)
+++ stable/12/sys/compat/linuxkpi/common/include/linux/device.h Fri May  1 
19:07:26 2020(r360544)
@@ -108,7 +108,10 @@ struct device {
struct class*class;
void(*release)(struct device *dev);
struct kobject  kobj;
-   void*dma_priv;
+   union {
+   const u64 *dma_mask;/* XXX for backwards compat */
+   void*dma_priv;
+   };
void*driver_data;
unsigned intirq;
 #defineLINUX_IRQ_INVALID   65535
___
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: r360543 - head/stand/libofw

2020-05-01 Thread Warner Losh
Author: imp
Date: Fri May  1 18:36:48 2020
New Revision: 360543
URL: https://svnweb.freebsd.org/changeset/base/360543

Log:
  Redo r360540 to retain the ifndef sparc code, not delete it.
  
  Also undo the BROKEN stuff, since it was based on the same misreading.
  
  Noticed by: Jens Schweikhardt

Modified:
  head/stand/libofw/ofw_net.c

Modified: head/stand/libofw/ofw_net.c
==
--- head/stand/libofw/ofw_net.c Fri May  1 18:27:14 2020(r360542)
+++ head/stand/libofw/ofw_net.c Fri May  1 18:36:48 2020(r360543)
@@ -73,9 +73,7 @@ struct netif_driver ofwnet = {
 
 static ihandle_t   netinstance;
 
-#ifdef BROKEN
 static void*dmabuf;
-#endif
 
 static int
 ofwn_match(struct netif *nif, void *machdep_hint)
@@ -112,12 +110,10 @@ ofwn_put(struct iodesc *desc, void *pkt, size_t len)
 #endif
}
 
-#ifdef BROKEN
if (dmabuf) {
bcopy(pkt, dmabuf, sendlen);
pkt = dmabuf;
}
-#endif
 
rv = OF_write(netinstance, pkt, len);
 
@@ -220,6 +216,16 @@ ofwn_init(struct iodesc *desc, void *machdep_hint)
 #if defined(NETIF_DEBUG)
printf("ofwn_init: Open Firmware instance handle: %08x\n", netinstance);
 #endif
+   dmabuf = NULL;
+   if (OF_call_method("dma-alloc", netinstance, 1, 1, (64 * 1024), )
+   < 0) {
+   printf("Failed to allocate DMA buffer (got %p).\n", dmabuf);
+   goto punt;
+   }
+#if defined(NETIF_DEBUG)
+   printf("ofwn_init: allocated DMA buffer: %p\n", dmabuf);
+#endif
+
return;
 
 punt:
___
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: r360542 - in stable: 10 11 12

2020-05-01 Thread Dimitry Andric
Author: dim
Date: Fri May  1 18:27:14 2020
New Revision: 360542
URL: https://svnweb.freebsd.org/changeset/base/360542

Log:
  MFC r360322:
  
  Fix race between prebuilding libsbuf and libgeom
  
  The latter needs the former, but with a multi-job build on a fast
  machine, the race is sometimes lost. This leads to "ld: error: unable to
  find library -lsbuf", when linking libgeom.so.
  
  Submitted by: kevans

Modified:
  stable/10/Makefile.inc1
Directory Properties:
  stable/10/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/11/Makefile.inc1
  stable/12/Makefile.inc1
Directory Properties:
  stable/11/   (props changed)
  stable/12/   (props changed)

Modified: stable/10/Makefile.inc1
==
--- stable/10/Makefile.inc1 Fri May  1 17:50:26 2020(r360541)
+++ stable/10/Makefile.inc1 Fri May  1 18:27:14 2020(r360542)
@@ -1738,7 +1738,7 @@ gnu/lib/libdialog__L: lib/msun__L lib/ncurses/ncursesw
 _prebuild_libs+= lib/libc++
 .endif
 
-lib/libgeom__L: lib/libexpat__L
+lib/libgeom__L: lib/libexpat__L lib/libsbuf__L
 
 .if defined(WITH_ATF) || ${MK_TESTS} != "no"
 .if !defined(WITH_ATF)
___
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: r360542 - in stable: 10 11 12

2020-05-01 Thread Dimitry Andric
Author: dim
Date: Fri May  1 18:27:14 2020
New Revision: 360542
URL: https://svnweb.freebsd.org/changeset/base/360542

Log:
  MFC r360322:
  
  Fix race between prebuilding libsbuf and libgeom
  
  The latter needs the former, but with a multi-job build on a fast
  machine, the race is sometimes lost. This leads to "ld: error: unable to
  find library -lsbuf", when linking libgeom.so.
  
  Submitted by: kevans

Modified:
  stable/11/Makefile.inc1
Directory Properties:
  stable/11/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/10/Makefile.inc1
  stable/12/Makefile.inc1
Directory Properties:
  stable/10/   (props changed)
  stable/12/   (props changed)

Modified: stable/11/Makefile.inc1
==
--- stable/11/Makefile.inc1 Fri May  1 17:50:26 2020(r360541)
+++ stable/11/Makefile.inc1 Fri May  1 18:27:14 2020(r360542)
@@ -2183,7 +2183,7 @@ gnu/lib/libdialog__L: lib/msun__L lib/ncurses/ncursesw
 _prebuild_libs+= lib/libc++
 .endif
 
-lib/libgeom__L: lib/libexpat__L
+lib/libgeom__L: lib/libexpat__L lib/libsbuf__L
 lib/libkvm__L: lib/libelf__L
 
 .if ${MK_LIBTHR} != "no"
___
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: r360542 - in stable: 10 11 12

2020-05-01 Thread Dimitry Andric
Author: dim
Date: Fri May  1 18:27:14 2020
New Revision: 360542
URL: https://svnweb.freebsd.org/changeset/base/360542

Log:
  MFC r360322:
  
  Fix race between prebuilding libsbuf and libgeom
  
  The latter needs the former, but with a multi-job build on a fast
  machine, the race is sometimes lost. This leads to "ld: error: unable to
  find library -lsbuf", when linking libgeom.so.
  
  Submitted by: kevans

Modified:
  stable/12/Makefile.inc1
Directory Properties:
  stable/12/   (props changed)

Changes in other areas also in this revision:
Modified:
  stable/10/Makefile.inc1
  stable/11/Makefile.inc1
Directory Properties:
  stable/10/   (props changed)
  stable/11/   (props changed)

Modified: stable/12/Makefile.inc1
==
--- stable/12/Makefile.inc1 Fri May  1 17:50:26 2020(r360541)
+++ stable/12/Makefile.inc1 Fri May  1 18:27:14 2020(r360542)
@@ -2626,7 +2626,7 @@ gnu/lib/libdialog__L: lib/msun__L lib/ncurses/ncursesw
 _prebuild_libs+= lib/libc++
 .endif
 
-lib/libgeom__L: lib/libexpat__L
+lib/libgeom__L: lib/libexpat__L lib/libsbuf__L
 lib/libkvm__L: lib/libelf__L
 
 .if ${MK_LIBTHR} != "no"
___
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: r360540 - head/stand/libofw

2020-05-01 Thread Warner Losh
Author: imp
Date: Fri May  1 17:50:21 2020
New Revision: 360540
URL: https://svnweb.freebsd.org/changeset/base/360540

Log:
  Remove more stray sparc64 ifdefs.
  
  Also, dmabuf appears to only be set for sparc64 case, but there was a
  comment at its only use that says it was broken for some apple
  adapters. #ifdef it all of that out now that nothing sets it.

Modified:
  head/stand/libofw/ofw_net.c

Modified: head/stand/libofw/ofw_net.c
==
--- head/stand/libofw/ofw_net.c Fri May  1 17:17:01 2020(r360539)
+++ head/stand/libofw/ofw_net.c Fri May  1 17:50:21 2020(r360540)
@@ -73,7 +73,9 @@ struct netif_driver ofwnet = {
 
 static ihandle_t   netinstance;
 
+#ifdef BROKEN
 static void*dmabuf;
+#endif
 
 static int
 ofwn_match(struct netif *nif, void *machdep_hint)
@@ -110,10 +112,12 @@ ofwn_put(struct iodesc *desc, void *pkt, size_t len)
 #endif
}
 
+#ifdef BROKEN
if (dmabuf) {
bcopy(pkt, dmabuf, sendlen);
pkt = dmabuf;
}
+#endif
 
rv = OF_write(netinstance, pkt, len);
 
@@ -203,11 +207,7 @@ ofwn_init(struct iodesc *desc, void *machdep_hint)
if ((ch = strchr(path, ':')) != NULL)
*ch = '\0';
netdev = OF_finddevice(path);
-#ifdef __sparc64__
-   if (OF_getprop(netdev, "mac-address", desc->myea, 6) == -1)
-#else
if (OF_getprop(netdev, "local-mac-address", desc->myea, 6) == -1)
-#endif
goto punt;
 
printf("boot: ethernet address: %s\n", ether_sprintf(desc->myea));
@@ -220,20 +220,6 @@ ofwn_init(struct iodesc *desc, void *machdep_hint)
 #if defined(NETIF_DEBUG)
printf("ofwn_init: Open Firmware instance handle: %08x\n", netinstance);
 #endif
-
-#ifndef __sparc64__
-   dmabuf = NULL;
-   if (OF_call_method("dma-alloc", netinstance, 1, 1, (64 * 1024), )
-   < 0) {   
-   printf("Failed to allocate DMA buffer (got %p).\n", dmabuf);
-   goto punt;
-   }
-
-#if defined(NETIF_DEBUG)
-   printf("ofwn_init: allocated DMA buffer: %p\n", dmabuf);
-#endif
-#endif
-
return;
 
 punt:
___
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: r360541 - head/tools/boot

2020-05-01 Thread Warner Losh
Author: imp
Date: Fri May  1 17:50:26 2020
New Revision: 360541
URL: https://svnweb.freebsd.org/changeset/base/360541

Log:
  Spell LOADER correctly so we test lua build.

Modified:
  head/tools/boot/universe.sh

Modified: head/tools/boot/universe.sh
==
--- head/tools/boot/universe.sh Fri May  1 17:50:21 2020(r360540)
+++ head/tools/boot/universe.sh Fri May  1 17:50:26 2020(r360541)
@@ -97,7 +97,7 @@ for i in \
powerpc/powerpc powerpc/powerpc64 \
; do
 ta=${i##*/}
-dobuild $ta _.boot.${ta}.lua.log "MK_LOADEDER_LUA=yes MK_FORTH=no"
+dobuild $ta _.boot.${ta}.lua.log "MK_LOADER_LUA=yes MK_FORTH=no"
 done
 
 # Build w/o ZFS
___
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: r360539 - head/tools/boot

2020-05-01 Thread Warner Losh
Author: imp
Date: Fri May  1 17:17:01 2020
New Revision: 360539
URL: https://svnweb.freebsd.org/changeset/base/360539

Log:
  Catch up to arm/arm and sparc64 removal.

Modified:
  head/tools/boot/universe.sh

Modified: head/tools/boot/universe.sh
==
--- head/tools/boot/universe.sh Fri May  1 17:16:57 2020(r360538)
+++ head/tools/boot/universe.sh Fri May  1 17:17:01 2020(r360539)
@@ -77,12 +77,11 @@ done
 # Default build for a goodly selection of architectures
 for i in \
amd64/amd64 \
-   arm/arm arm/armv7 \
+   arm/armv7 \
arm64/aarch64 \
i386/i386 \
mips/mips mips/mips64 \
powerpc/powerpc powerpc/powerpc64 \
-   sparc64/sparc64 \
; do
 ta=${i##*/}
 dobuild $ta _.boot.${ta}.log ""
@@ -91,12 +90,11 @@ done
 # Default build for a goodly selection of architectures with Lua
 for i in \
amd64/amd64 \
-   arm/arm arm/armv7 \
+   arm/armv7 \
arm64/aarch64 \
i386/i386 \
mips/mips mips/mips64 \
powerpc/powerpc powerpc/powerpc64 \
-   sparc64/sparc64 \
; do
 ta=${i##*/}
 dobuild $ta _.boot.${ta}.lua.log "MK_LOADEDER_LUA=yes MK_FORTH=no"
@@ -106,7 +104,6 @@ done
 for i in \
amd64/amd64 \
i386/i386 \
-   sparc64/sparc64 \
; do
 ta=${i##*/}
 dobuild $ta _.boot.${ta}.no_zfs.log "MK_ZFS=no"
@@ -119,12 +116,4 @@ for i in \
; do
 ta=${i##*/}
 dobuild $ta _.boot.${ta}.firewire.log "MK_LOADER_FIREWIRE=yes"
-done
-
-# Build with LOADER_DEBUG, only sparc64 does this.
-for i in \
-   sparc64/sparc64 \
-   ; do
-ta=${i##*/}
-dobuild $ta _.boot.${ta}.debug.log "LOADER_DEBUG=yes"
 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: r360538 - head/tools/boot

2020-05-01 Thread Warner Losh
Author: imp
Date: Fri May  1 17:16:57 2020
New Revision: 360538
URL: https://svnweb.freebsd.org/changeset/base/360538

Log:
  When we have an invalid build option, don't rm -rf the current
  directory.
  
  Add a quick sanity check to objdir before using it.  It must start
  with /. If there was a make error getting it, report that and continue
  with the next target. If there was anything else, bail out.

Modified:
  head/tools/boot/universe.sh

Modified: head/tools/boot/universe.sh
==
--- head/tools/boot/universe.sh Fri May  1 16:56:36 2020(r360537)
+++ head/tools/boot/universe.sh Fri May  1 17:16:57 2020(r360538)
@@ -19,6 +19,12 @@
 # Output is put into _.boot.$TARGET_ARCH.log in sys.boot.
 #
 
+die()
+{
+echo $*
+exit 1
+}
+
 dobuild()
 {
 local ta=$1
@@ -27,6 +33,12 @@ dobuild()
 
 echo -n "Building $ta ${opt} ... "
 objdir=$(make buildenv TARGET_ARCH=$ta BUILDENV_SHELL="make -V .OBJDIR" | 
tail -1)
+case ${objdir} in
+   /*) ;;
+   make*) echo Error message from make: $objdir
+  continue ;;
+   *) die Crazy object dir: $objdir ;;
+esac
 rm -rf ${objdir}
 if ! make buildenv TARGET_ARCH=$ta BUILDENV_SHELL="make clean cleandepend 
cleandir obj depend"  \
 > $lf 2>&1; then
@@ -116,4 +128,3 @@ for i in \
 ta=${i##*/}
 dobuild $ta _.boot.${ta}.debug.log "LOADER_DEBUG=yes"
 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: r360537 - head/stand/powerpc/boot1.chrp

2020-05-01 Thread Brandon Bergren
Author: bdragon
Date: Fri May  1 16:56:36 2020
New Revision: 360537
URL: https://svnweb.freebsd.org/changeset/base/360537

Log:
  [PowerPC] Set fixed boot1.elf load address
  
  Due to the way claiming works, we need to ensure on AIM OFW machines that
  we don't have overlapping ranges on any step of the load.
  
  Load boot1.elf at 0x38000 so it will not overlap with anything even if the
  entire PReP partition gets loaded by OFW.
  
  Tested on an iBook G4, a PowerBook G4, a PowerMac G5, and qemu pseries.
  (qemu pseries is broken without this patch due to the high address used
  by lld10.)
  
  Reviewed by:  adalava
  Sponsored by: Tag1 Consulting, Inc.
  Differential Revision:https://reviews.freebsd.org/D24623

Modified:
  head/stand/powerpc/boot1.chrp/Makefile

Modified: head/stand/powerpc/boot1.chrp/Makefile
==
--- head/stand/powerpc/boot1.chrp/Makefile  Fri May  1 16:47:54 2020
(r360536)
+++ head/stand/powerpc/boot1.chrp/Makefile  Fri May  1 16:56:36 2020
(r360537)
@@ -10,7 +10,20 @@ FILES=   boot1.hfs
 SRCS=  boot1.c ashldi3.c syncicache.c
 
 CFLAGS+=-I${LDRSRC}
-LDFLAGS=-nostdlib -static -Wl,-N
+# Load boot1.elf below kernel.
+#
+# Due to limitiations in the way we load stuff, we have to avoid reusing
+# memory until the kernel MMU code has taken over.
+#
+# 0x38000 is high enough to not interfere with the trap area, but low
+# enough that it doesn't bump into the kernel area starting at 0x10,
+# even if the entire partition gets used as the load size by a buggy OFW.
+#
+# In theory 0xf would work too under the current 64k size limit for
+# boot1.elf defined in the HFS template, but sometimes boot1.elf is written
+# directly to the PReP partition.
+#
+LDFLAGS=-nostdlib -static -Wl,-N -Wl,-Ttext=0x38000
 
 .PATH:  ${SYSDIR}/libkern ${SRCTOP}/lib/libc/powerpc/gen ${.CURDIR}
 
___
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: r360536 - head/stand/common

2020-05-01 Thread Brandon Bergren
Author: bdragon
Date: Fri May  1 16:47:54 2020
New Revision: 360536
URL: https://svnweb.freebsd.org/changeset/base/360536

Log:
  Remove sparc relocation support from reloc_elf.c.
  
  It got missed in the sparc64 removal.

Modified:
  head/stand/common/reloc_elf.c

Modified: head/stand/common/reloc_elf.c
==
--- head/stand/common/reloc_elf.c   Fri May  1 14:30:59 2020
(r360535)
+++ head/stand/common/reloc_elf.c   Fri May  1 16:47:54 2020
(r360536)
@@ -52,32 +52,7 @@ int
 __elfN(reloc)(struct elf_file *ef, symaddr_fn *symaddr, const void *reldata,
 int reltype, Elf_Addr relbase, Elf_Addr dataaddr, void *data, size_t len)
 {
-#ifdef __sparc__
-   Elf_Size w;
-   const Elf_Rela *a;
-
-   switch (reltype) {
-   case ELF_RELOC_RELA:
-   a = reldata;
-if (relbase + a->r_offset >= dataaddr &&
-relbase + a->r_offset < dataaddr + len) {
-   switch (ELF_R_TYPE(a->r_info)) {
-   case R_SPARC_RELATIVE:
-   w = relbase + a->r_addend;
-   bcopy(, (u_char *)data + (relbase +
-   a->r_offset - dataaddr), sizeof(w));
-   break;
-   default:
-   printf("\nunhandled relocation type %u\n",
-   (u_int)ELF_R_TYPE(a->r_info));
-   return (EFTYPE);
-   }
-   }
-   break;
-   }
-
-   return (0);
-#elif (defined(__i386__) || defined(__amd64__)) && __ELF_WORD_SIZE == 64
+#if (defined(__i386__) || defined(__amd64__)) && __ELF_WORD_SIZE == 64
Elf64_Addr *where, val;
Elf_Addr addend, addr;
Elf_Size rtype, symidx;
___
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: r360517 - in head/sys/contrib/dev/acpica: . common compiler components/debugger components/disassembler components/dispatcher components/executer include

2020-05-01 Thread Conrad Meyer
Thanks, this looks like a big improvement!

On Thu, Apr 30, 2020 at 18:26 Jung-uk Kim  wrote:

> Author: jkim
> Date: Fri May  1 01:26:36 2020
> New Revision: 360517
> URL: https://svnweb.freebsd.org/changeset/base/360517
>
> Log:
>   MFV:  r360512
>
>   Merge ACPICA 20200430.
>
> --- head/sys/contrib/dev/acpica/changes.txt Fri May  1 00:41:41 2020
>   (r360516)
> +++ head/sys/contrib/dev/acpica/changes.txt Fri May  1 01:26:36 2020
>   (r360517)
> @@ -1,4 +1,61 @@
>  
> +
> +
> +30 April 2020. Summary of changes for version 20200430:
> ...
> +2) iASL Compiler/Disassembler and ACPICA tools:
> +
> +iASL DataTable Compiler:  Fixed a segfault on errors that aren't directly
> +associated with a field.
> +
> +Disassembler: has been made more resilient so that it will continue to
> +parse AML even if the AML generates ACPI namespace errors. This enables
> +iASL to disassemble some AML that may have been compiled using older
> +versions of iASL that no longer compile with newer versions of iASL.
> +
> +iASL: Fixed the required parameters for _NIH and _NIG. Previously, there
> +was a mixup where _NIG required one parameter and _NIH required zero
> +parameters. This change swaps these parameter requirements. Now it is
> +required that _NIH must be called with one parameter and _NIG requires
> +zero parameters.
> +
> +iASL: Allow use of undefined externals as long as they are protected by
> +an if (CondRefOf (...)) block when compiling multiple definition blocks.
> +
> +iASL: Fixed the type override behavior of named objects that are declared
> +as External. External declarations will no longer override the type of
> +the actual definition if it already exists.
> +
> +AcpiNames: Added setargv.obj to the MSVC 2017 link sequence to enable
> +command line wildcard support on Windows. Note: the AcpiNames utility is
> +essentially redundant with the AcpiExec utility (using the "namespace"
> +command) and is therefore deprecated. It will be removed in future
> +releases of ACPICA.
> +
> +Disassembler: ignore AE_ALREADY_EXISTS status when parsing create*
> +operators. The disassembler is intended to emit existing ASL code as-is.
> +Therefore, error messages emitted during disassembly should be ignored or
> +handled in a way such that the disassembler can continue to parse the
> +AML. This change ignores AE_ALREADY_EXISTS errors during the deferred Op
> +parsing for create operators in order to complete parsing ASL termlists.


All of the above should improve acpidump disassembler utility significantly.

Best,
Conrad
___
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: r360535 - head/sys/kern

2020-05-01 Thread Ed Maste
Author: emaste
Date: Fri May  1 14:30:59 2020
New Revision: 360535
URL: https://svnweb.freebsd.org/changeset/base/360535

Log:
  correct procctl(PROC_PROTMAX_STATUS _NOFORCE return
  
  Previously procctl(PROC_PROTMAX_STATUS, ... used the PROC_ASLR_NOFORCE
  macro for the "system-wide configured policy" status, instead of
  PROC_PROTMAX_NOFORCE.
  
  They both have a value of 3, so no functional change.
  
  Sponsored by: The FreeBSD Foundation

Modified:
  head/sys/kern/kern_procctl.c

Modified: head/sys/kern/kern_procctl.c
==
--- head/sys/kern/kern_procctl.cFri May  1 13:47:13 2020
(r360534)
+++ head/sys/kern/kern_procctl.cFri May  1 14:30:59 2020
(r360535)
@@ -449,7 +449,7 @@ protmax_status(struct thread *td, struct proc *p, int 
 
switch (p->p_flag2 & (P2_PROTMAX_ENABLE | P2_PROTMAX_DISABLE)) {
case 0:
-   d = PROC_ASLR_NOFORCE;
+   d = PROC_PROTMAX_NOFORCE;
break;
case P2_PROTMAX_ENABLE:
d = PROC_PROTMAX_FORCE_ENABLE;
___
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: r360534 - stable/11/sys/dev/mfi

2020-05-01 Thread Alexander Motin
Author: mav
Date: Fri May  1 13:47:13 2020
New Revision: 360534
URL: https://svnweb.freebsd.org/changeset/base/360534

Log:
  MFC r323320 (by scottl): Fix intrhook release in MFI as well

Modified:
  stable/11/sys/dev/mfi/mfi.c
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/sys/dev/mfi/mfi.c
==
--- stable/11/sys/dev/mfi/mfi.c Fri May  1 11:36:39 2020(r360533)
+++ stable/11/sys/dev/mfi/mfi.c Fri May  1 13:47:13 2020(r360534)
@@ -1264,8 +1264,6 @@ mfi_startup(void *arg)
 
sc = (struct mfi_softc *)arg;
 
-   config_intrhook_disestablish(>mfi_ich);
-
sc->mfi_enable_intr(sc);
sx_xlock(>mfi_config_lock);
mtx_lock(>mfi_io_lock);
@@ -1274,6 +1272,8 @@ mfi_startup(void *arg)
mfi_syspdprobe(sc);
mtx_unlock(>mfi_io_lock);
sx_xunlock(>mfi_config_lock);
+
+   config_intrhook_disestablish(>mfi_ich);
 }
 
 static void
___
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: r360533 - head/share/man/man9

2020-05-01 Thread Benedict Reuschling
Author: bcr (doc committer)
Date: Fri May  1 11:36:39 2020
New Revision: 360533
URL: https://svnweb.freebsd.org/changeset/base/360533

Log:
  Fix typo in r360492:
  
  appeard -> appeared
  
  Reported by:  trasz (via IRC)

Modified:
  head/share/man/man9/disk.9
  head/share/man/man9/epoch.9

Modified: head/share/man/man9/disk.9
==
--- head/share/man/man9/disk.9  Fri May  1 10:32:42 2020(r360532)
+++ head/share/man/man9/disk.9  Fri May  1 11:36:39 2020(r360533)
@@ -244,7 +244,7 @@ structure for this disk device.
 .Sh HISTORY
 The
 .Nm kernel disk storage API
-first appeard in
+first appeared in
 .Fx 4.9 .
 .Sh SEE ALSO
 .Xr GEOM 4 ,

Modified: head/share/man/man9/epoch.9
==
--- head/share/man/man9/epoch.9 Fri May  1 10:32:42 2020(r360532)
+++ head/share/man/man9/epoch.9 Fri May  1 11:36:39 2020(r360533)
@@ -284,7 +284,7 @@ kernel programming interface is under development and 
 .Sh HISTORY
 The
 .Nm
-framework first appeard in
+framework first appeared in
 .Fx 11.0 .
 .Sh SEE ALSO
 .Xr locking 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: r360532 - head/sys/compat/linuxkpi/common/include/linux

2020-05-01 Thread Hans Petter Selasky
Author: hselasky
Date: Fri May  1 10:32:42 2020
New Revision: 360532
URL: https://svnweb.freebsd.org/changeset/base/360532

Log:
  Implement more PCI-express bandwidth functions in the LinuxKPI.
  
  Submitted by: ashafer_badland.io (Austin Shafer)
  MFC after:1 week
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/compat/linuxkpi/common/include/linux/pci.h

Modified: head/sys/compat/linuxkpi/common/include/linux/pci.h
==
--- head/sys/compat/linuxkpi/common/include/linux/pci.h Fri May  1 10:28:21 
2020(r360531)
+++ head/sys/compat/linuxkpi/common/include/linux/pci.h Fri May  1 10:32:42 
2020(r360532)
@@ -954,6 +954,47 @@ pcie_get_width_cap(struct pci_dev *dev)
return (PCIE_LNK_WIDTH_UNKNOWN);
 }
 
+static inline int
+pcie_get_mps(struct pci_dev *dev)
+{
+   return (pci_get_max_payload(dev->dev.bsddev));
+}
+
+static inline uint32_t
+PCIE_SPEED2MBS_ENC(enum pci_bus_speed spd)
+{
+
+   switch(spd) {
+   case PCIE_SPEED_16_0GT:
+   return (16000 * 128 / 130);
+   case PCIE_SPEED_8_0GT:
+   return (8000 * 128 / 130);
+   case PCIE_SPEED_5_0GT:
+   return (5000 * 8 / 10);
+   case PCIE_SPEED_2_5GT:
+   return (2500 * 8 / 10);
+   default:
+   return (0);
+   }
+}
+
+static inline uint32_t
+pcie_bandwidth_available(struct pci_dev *pdev,
+struct pci_dev **limiting,
+enum pci_bus_speed *speed,
+enum pcie_link_width *width)
+{
+   enum pci_bus_speed nspeed = pcie_get_speed_cap(pdev);
+   enum pcie_link_width nwidth = pcie_get_width_cap(pdev);
+
+   if (speed)
+   *speed = nspeed;
+   if (width)
+   *width = nwidth;
+
+   return (nwidth * PCIE_SPEED2MBS_ENC(nspeed));
+}
+
 /*
  * The following functions can be used to attach/detach the LinuxKPI's
  * PCI device runtime. The pci_driver and pci_device_id pointer is
___
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: r360531 - head/sys/compat/linuxkpi/common/include/linux

2020-05-01 Thread Hans Petter Selasky
Author: hselasky
Date: Fri May  1 10:28:21 2020
New Revision: 360531
URL: https://svnweb.freebsd.org/changeset/base/360531

Log:
  Implement mutex_lock_killable() in the LinuxKPI.
  
  Submitted by: ashafer_badland.io (Austin Shafer)
  MFC after:1 week
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/compat/linuxkpi/common/include/linux/mutex.h

Modified: head/sys/compat/linuxkpi/common/include/linux/mutex.h
==
--- head/sys/compat/linuxkpi/common/include/linux/mutex.h   Fri May  1 
10:25:07 2020(r360530)
+++ head/sys/compat/linuxkpi/common/include/linux/mutex.h   Fri May  1 
10:28:21 2020(r360531)
@@ -66,6 +66,18 @@ typedef struct mutex {
linux_mutex_lock_interruptible(_m); \
 })
 
+/*
+ * Reuse the interruptable method since the SX
+ * lock handles both signals and interrupts:
+ */
+#definemutex_lock_killable(_m) ({  \
+   MUTEX_SKIP() ? 0 :  \
+   linux_mutex_lock_interruptible(_m); \
+})
+
+#definemutex_lock_killable_nested(_m, _sub)\
+   mutex_lock_killable(_m)
+
 #definemutex_unlock(_m) do {   \
if (MUTEX_SKIP())   \
break;  \
___
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: r360530 - head/sys/compat/linuxkpi/common/include/linux

2020-05-01 Thread Hans Petter Selasky
Author: hselasky
Date: Fri May  1 10:25:07 2020
New Revision: 360530
URL: https://svnweb.freebsd.org/changeset/base/360530

Log:
  Implement DIV64_U64_ROUND_UP() in the LinuxKPI.
  
  Submitted by: ashafer_badland.io (Austin Shafer)
  MFC after:1 week
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/compat/linuxkpi/common/include/linux/math64.h

Modified: head/sys/compat/linuxkpi/common/include/linux/math64.h
==
--- head/sys/compat/linuxkpi/common/include/linux/math64.h  Fri May  1 
10:18:07 2020(r360529)
+++ head/sys/compat/linuxkpi/common/include/linux/math64.h  Fri May  1 
10:25:07 2020(r360530)
@@ -91,4 +91,13 @@ mul_u32_u32(uint32_t a, uint32_t b)
return ((uint64_t)a * b);
 }
 
+static inline uint64_t
+div64_u64_round_up(uint64_t dividend, uint64_t divisor)
+{
+   return ((dividend + divisor - 1) / divisor);
+}
+
+#defineDIV64_U64_ROUND_UP(...) \
+   div64_u64_round_up(__VA_ARGS__)
+
 #endif /* _LINUX_MATH64_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: r360529 - head/sys/compat/linuxkpi/common/include/linux

2020-05-01 Thread Hans Petter Selasky
Author: hselasky
Date: Fri May  1 10:18:07 2020
New Revision: 360529
URL: https://svnweb.freebsd.org/changeset/base/360529

Log:
  Implement more lockdep macros in the LinuxKPI.
  
  Submitted by: ashafer_badland.io (Austin Shafer)
  MFC after:1 week
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/compat/linuxkpi/common/include/linux/lockdep.h

Modified: head/sys/compat/linuxkpi/common/include/linux/lockdep.h
==
--- head/sys/compat/linuxkpi/common/include/linux/lockdep.h Fri May  1 
10:14:45 2020(r360528)
+++ head/sys/compat/linuxkpi/common/include/linux/lockdep.h Fri May  1 
10:18:07 2020(r360529)
@@ -36,6 +36,7 @@ struct lock_class_key {
 };
 
 #definelockdep_set_class(lock, key)
+#definelockdep_set_subclass(lock, sub)
 #definelockdep_set_class_and_name(lock, key, name)
 #definelockdep_set_current_reclaim_state(g) do { } while (0)
 #definelockdep_clear_current_reclaim_state() do { } while (0)
@@ -60,6 +61,7 @@ lockdep_is_held(void *__m)
__lock = __m;
return (LOCK_CLASS(__lock)->lc_owner(__lock, &__td) != 0);
 }
+#definelockdep_is_held_type(_m, _t) lockdep_is_held(_m)
 
 #else
 #definelockdep_assert_held(m) do { } while (0)
@@ -67,6 +69,7 @@ lockdep_is_held(void *__m)
 #definelockdep_assert_held_once(m) do { } while (0)
 
 #definelockdep_is_held(m)  1
+#definelockdep_is_held_type(_m, _t)1
 #endif
 
 #definemight_lock(m)   do { } while (0)
@@ -75,5 +78,8 @@ lockdep_is_held(void *__m)
 #definelock_acquire(...) do { } while (0)
 #definelock_release(...) do { } while (0)
 #definelock_acquire_shared_recursive(...) do { } while (0)
+
+#definemutex_acquire(...) do { } while (0)
+#definemutex_release(...) do { } while (0)
 
 #endif /* _LINUX_LOCKDEP_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: r360528 - head/sys/compat/linuxkpi/common/include/linux

2020-05-01 Thread Hans Petter Selasky
Author: hselasky
Date: Fri May  1 10:14:45 2020
New Revision: 360528
URL: https://svnweb.freebsd.org/changeset/base/360528

Log:
  Implement kstrtou64() in the LinuxKPI.
  
  Submitted by: ashafer_badland.io (Austin Shafer)
  MFC after:1 week
  Sponsored by: Mellanox Technologies

Modified:
  head/sys/compat/linuxkpi/common/include/linux/kernel.h

Modified: head/sys/compat/linuxkpi/common/include/linux/kernel.h
==
--- head/sys/compat/linuxkpi/common/include/linux/kernel.h  Fri May  1 
10:02:38 2020(r360527)
+++ head/sys/compat/linuxkpi/common/include/linux/kernel.h  Fri May  1 
10:14:45 2020(r360528)
@@ -390,6 +390,21 @@ kstrtou32(const char *cp, unsigned int base, u32 *res)
 }
 
 static inline int
+kstrtou64(const char *cp, unsigned int base, u64 *res)
+{
+   char *end;
+
+   *res = strtouq(cp, , base);
+
+   /* skip newline character, if any */
+   if (*end == '\n')
+   end++;
+   if (*cp == 0 || *end != 0)
+   return (-EINVAL);
+   return (0);
+}
+
+static inline int
 kstrtobool(const char *s, bool *res)
 {
int 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: r360527 - head/share/man/man4

2020-05-01 Thread Benedict Reuschling
Author: bcr (doc committer)
Date: Fri May  1 10:02:38 2020
New Revision: 360527
URL: https://svnweb.freebsd.org/changeset/base/360527

Log:
  Fix a number of the following issues in man4:
  - Inconsistencies in .Dd like abbreviated month names,
  "th" after numbers, or leading zeros
  - No line breaks after a sentence stop
  - Whitespace at the end of the line
  - Use macros for BSD OS names instead of hardcoded names
  - CAVEATS instead of CAVEAT in section name
  
  No actual content change in terms of additions were made, so
  no bump of the .Dd for these man pages.
  All of these issues were found and fixed by Gordon Bergling.
  
  Submitted by: gbergling_gmail.com
  Approved by:  bcr
  Differential Revision:https://reviews.freebsd.org/D24648

Modified:
  head/share/man/man4/acpi_wmi.4
  head/share/man/man4/bhndb.4
  head/share/man/man4/bnxt.4
  head/share/man/man4/bridge.4
  head/share/man/man4/bwi.4
  head/share/man/man4/bxe.4
  head/share/man/man4/cyapa.4
  head/share/man/man4/hv_vss.4
  head/share/man/man4/ig4.4
  head/share/man/man4/pchtherm.4
  head/share/man/man4/ppbus.4

Modified: head/share/man/man4/acpi_wmi.4
==
--- head/share/man/man4/acpi_wmi.4  Fri May  1 09:50:36 2020
(r360526)
+++ head/share/man/man4/acpi_wmi.4  Fri May  1 10:02:38 2020
(r360527)
@@ -24,7 +24,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd Sep 5, 2019
+.Dd September 5, 2019
 .Dt ACPI_WMI 4
 .Os
 .Sh NAME

Modified: head/share/man/man4/bhndb.4
==
--- head/share/man/man4/bhndb.4 Fri May  1 09:50:36 2020(r360526)
+++ head/share/man/man4/bhndb.4 Fri May  1 10:02:38 2020(r360527)
@@ -28,7 +28,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd October 16th, 2017
+.Dd October 16, 2017
 .Dt BHNDB 4
 .Os
 .Sh NAME

Modified: head/share/man/man4/bnxt.4
==
--- head/share/man/man4/bnxt.4  Fri May  1 09:50:36 2020(r360526)
+++ head/share/man/man4/bnxt.4  Fri May  1 10:02:38 2020(r360527)
@@ -208,10 +208,12 @@ reasons to ignore Ethernet frames.
 .It Va dev.bnxt.X.hwstats.rxq0.tpa_*
 statistics related to HW LRO.
 .It Va dev.bnxt.X.hw_lro.*
-Enable / Disable HW LRO feature. Defaults to disable.
+Enable / Disable HW LRO feature.
+Defaults to disable.
 Enabling HW LRO could cause issues when forwarding is enabled on host.
 .It Va dev.bnxt.X.fc
-Enable / Disable Flow Control feature. Defaults to Enable
+Enable / Disable Flow Control feature.
+Defaults to Enable
 .El
 .Sh DIAGNOSTICS
 .Bl -diag
@@ -245,8 +247,8 @@ device driver first appeared in
 The
 .Nm
 driver was written by
-.An Jack Vogel Aq Mt jfvo...@gmail.com 
-and 
+.An Jack Vogel Aq Mt jfvo...@gmail.com
+and
 .An Stephen Hurd Aq Mt sh...@freebsd.org ,
 and is currently maintained by
 .An Broadcom Limited Aq Mt freebsd@broadcom.com .

Modified: head/share/man/man4/bridge.4
==
--- head/share/man/man4/bridge.4Fri May  1 09:50:36 2020
(r360526)
+++ head/share/man/man4/bridge.4Fri May  1 10:02:38 2020
(r360527)
@@ -35,7 +35,7 @@
 .\"
 .\" $FreeBSD$
 .\"
-.Dd February 01, 2020
+.Dd February 1, 2020
 .Dt IF_BRIDGE 4
 .Os
 .Sh NAME

Modified: head/share/man/man4/bwi.4
==
--- head/share/man/man4/bwi.4   Fri May  1 09:50:36 2020(r360526)
+++ head/share/man/man4/bwi.4   Fri May  1 10:02:38 2020(r360527)
@@ -140,7 +140,9 @@ driver first appeared in
 .An -nosplit
 The
 .Nm
-driver was written for DragonFly BSD by
+driver was written for
+.Dx
+by
 .An Sepherosa Ziehau
 and subsequently ported to
 .Fx .

Modified: head/share/man/man4/bxe.4
==
--- head/share/man/man4/bxe.4   Fri May  1 09:50:36 2020(r360526)
+++ head/share/man/man4/bxe.4   Fri May  1 10:02:38 2020(r360527)
@@ -164,7 +164,7 @@ Enable/Disable 4-tuple RSS for UDP: 0=DISABLED, 1=ENAB
 .Pp
 Special care must be taken when modifying the number of queues and receive
 buffers.
-FreeBSD imposes a limit on the maximum number of
+.Fx imposes a limit on the maximum number of
 .Xr mbuf 9
 allocations.
 If buffer allocations fail, the interface initialization will fail

Modified: head/share/man/man4/cyapa.4
==
--- head/share/man/man4/cyapa.4 Fri May  1 09:50:36 2020(r360526)
+++ head/share/man/man4/cyapa.4 Fri May  1 10:02:38 2020(r360527)
@@ -210,7 +210,9 @@ file:
 .An -nosplit
 The original
 .Nm
-driver was written for DragonFly BSD by
+driver was written for
+.Dx
+by
 .An Matthew Dillon .
 .Pp
 It has been ported, modified, and enhanced for

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

svn commit: r360526 - in stable/12/sys/compat/linuxkpi/common: include/linux src

2020-05-01 Thread Hans Petter Selasky
Author: hselasky
Date: Fri May  1 09:50:36 2020
New Revision: 360526
URL: https://svnweb.freebsd.org/changeset/base/360526

Log:
  MFC r360196:
  Factor code in LinuxKPI to allow attach and detach using any BSD device.
  This allows non-LinuxKPI based infiniband device drivers to attach
  correctly to ibcore.
  
  No functional change intended.
  
  Reviewed by:  np @
  Differential Revision:https://reviews.freebsd.org/D24514
  Sponsored by: Mellanox Technologies

Modified:
  stable/12/sys/compat/linuxkpi/common/include/linux/pci.h
  stable/12/sys/compat/linuxkpi/common/src/linux_pci.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/compat/linuxkpi/common/include/linux/pci.h
==
--- stable/12/sys/compat/linuxkpi/common/include/linux/pci.hFri May  1 
09:46:27 2020(r360525)
+++ stable/12/sys/compat/linuxkpi/common/include/linux/pci.hFri May  1 
09:50:36 2020(r360526)
@@ -954,4 +954,15 @@ pcie_get_width_cap(struct pci_dev *dev)
return (PCIE_LNK_WIDTH_UNKNOWN);
 }
 
+/*
+ * The following functions can be used to attach/detach the LinuxKPI's
+ * PCI device runtime. The pci_driver and pci_device_id pointer is
+ * allowed to be NULL. Other pointers must be all valid.
+ * The pci_dev structure should be zero-initialized before passed
+ * to the linux_pci_attach_device function.
+ */
+extern int linux_pci_attach_device(device_t, struct pci_driver *,
+const struct pci_device_id *, struct pci_dev *);
+extern int linux_pci_detach_device(struct pci_dev *);
+
 #endif /* _LINUX_PCI_H_ */

Modified: stable/12/sys/compat/linuxkpi/common/src/linux_pci.c
==
--- stable/12/sys/compat/linuxkpi/common/src/linux_pci.cFri May  1 
09:46:27 2020(r360525)
+++ stable/12/sys/compat/linuxkpi/common/src/linux_pci.cFri May  1 
09:50:36 2020(r360526)
@@ -213,22 +213,33 @@ linux_pci_probe(device_t dev)
 static int
 linux_pci_attach(device_t dev)
 {
+   const struct pci_device_id *id;
+   struct pci_driver *pdrv;
+   struct pci_dev *pdev;
+
+   pdrv = linux_pci_find(dev, );
+   pdev = device_get_softc(dev);
+
+   MPASS(pdrv != NULL);
+   MPASS(pdev != NULL);
+
+   return (linux_pci_attach_device(dev, pdrv, id, pdev));
+}
+
+int
+linux_pci_attach_device(device_t dev, struct pci_driver *pdrv,
+const struct pci_device_id *id, struct pci_dev *pdev)
+{
struct resource_list_entry *rle;
struct pci_bus *pbus;
-   struct pci_dev *pdev;
struct pci_devinfo *dinfo;
-   struct pci_driver *pdrv;
-   const struct pci_device_id *id;
device_t parent;
int error;
 
linux_set_current(curthread);
 
-   pdrv = linux_pci_find(dev, );
-   pdev = device_get_softc(dev);
-
-   parent = device_get_parent(dev);
-   if (pdrv->isdrm) {
+   if (pdrv != NULL && pdrv->isdrm) {
+   parent = device_get_parent(dev);
dinfo = device_get_ivars(parent);
device_set_ivars(dev, dinfo);
} else {
@@ -270,9 +281,11 @@ linux_pci_attach(device_t dev)
list_add(>links, _devices);
spin_unlock(_lock);
 
-   error = pdrv->probe(pdev, id);
-   if (error)
-   goto out_probe;
+   if (pdrv != NULL) {
+   error = pdrv->probe(pdev, id);
+   if (error)
+   goto out_probe;
+   }
return (0);
 
 out_probe:
@@ -291,18 +304,30 @@ linux_pci_detach(device_t dev)
 {
struct pci_dev *pdev;
 
-   linux_set_current(curthread);
pdev = device_get_softc(dev);
 
-   pdev->pdrv->remove(pdev);
+   MPASS(pdev != NULL);
 
+   device_set_desc(dev, NULL);
+
+   return (linux_pci_detach_device(pdev));
+}
+
+int
+linux_pci_detach_device(struct pci_dev *pdev)
+{
+
+   linux_set_current(curthread);
+
+   if (pdev->pdrv != NULL)
+   pdev->pdrv->remove(pdev);
+
free(pdev->bus, M_DEVBUF);
linux_pdev_dma_uninit(pdev);
 
spin_lock(_lock);
list_del(>links);
spin_unlock(_lock);
-   device_set_desc(dev, NULL);
put_device(>dev);
 
return (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: r360525 - in stable/12: sys/arm64/arm64 sys/arm64/include sys/compat/linuxkpi/common/include/linux sys/compat/linuxkpi/common/src sys/dev/ofw sys/dev/pci sys/kern sys/sys sys/x86/includ...

2020-05-01 Thread Hans Petter Selasky
Author: hselasky
Date: Fri May  1 09:46:27 2020
New Revision: 360525
URL: https://svnweb.freebsd.org/changeset/base/360525

Log:
  MFC r346645, r346664, r346687, r347387, r347836, r347088, 347089, r346956,
  r346957, r346958, r347088, r347089, r347385, r353938, r350570,
  r350572 and r350573:
  
  Implement full bus_dma(9) support in the LinuxKPI and pull in all 
dependencies.
  
  Bump FreeBSD version to force recompilation of external modules.
  
  Sponsored by: Mellanox Technologies

Modified:
  stable/12/sys/arm64/arm64/busdma_bounce.c
  stable/12/sys/arm64/include/bus_dma.h
  stable/12/sys/arm64/include/bus_dma_impl.h
  stable/12/sys/compat/linuxkpi/common/include/linux/device.h
  stable/12/sys/compat/linuxkpi/common/include/linux/dma-mapping.h
  stable/12/sys/compat/linuxkpi/common/include/linux/dmapool.h
  stable/12/sys/compat/linuxkpi/common/include/linux/gfp.h
  stable/12/sys/compat/linuxkpi/common/include/linux/io.h
  stable/12/sys/compat/linuxkpi/common/include/linux/pci.h
  stable/12/sys/compat/linuxkpi/common/include/linux/scatterlist.h
  stable/12/sys/compat/linuxkpi/common/src/linux_pci.c
  stable/12/sys/dev/ofw/ofwpci.c
  stable/12/sys/dev/pci/vga_pci.c
  stable/12/sys/kern/bus_if.m
  stable/12/sys/kern/subr_bus.c
  stable/12/sys/sys/bus.h
  stable/12/sys/sys/bus_dma.h
  stable/12/sys/sys/param.h
  stable/12/sys/x86/include/bus_dma.h
  stable/12/sys/x86/include/busdma_impl.h
  stable/12/sys/x86/iommu/busdma_dmar.c
  stable/12/sys/x86/x86/busdma_bounce.c
  stable/12/usr.sbin/camdd/camdd.c
Directory Properties:
  stable/12/   (props changed)

Modified: stable/12/sys/arm64/arm64/busdma_bounce.c
==
--- stable/12/sys/arm64/arm64/busdma_bounce.c   Fri May  1 06:10:09 2020
(r360524)
+++ stable/12/sys/arm64/arm64/busdma_bounce.c   Fri May  1 09:46:27 2020
(r360525)
@@ -152,6 +152,8 @@ static bus_addr_t add_bounce_page(bus_dma_tag_t dmat, 
 vm_offset_t vaddr, bus_addr_t addr, bus_size_t size);
 static void free_bounce_page(bus_dma_tag_t dmat, struct bounce_page *bpage);
 int run_filter(bus_dma_tag_t dmat, bus_addr_t paddr);
+static bool _bus_dmamap_pagesneeded(bus_dma_tag_t dmat, vm_paddr_t buf,
+bus_size_t buflen, int *pagesneeded);
 static void _bus_dmamap_count_pages(bus_dma_tag_t dmat, bus_dmamap_t map,
 pmap_t pmap, void *buf, bus_size_t buflen, int flags);
 static void _bus_dmamap_count_phys(bus_dma_tag_t dmat, bus_dmamap_t map,
@@ -271,6 +273,15 @@ out:
return (error);
 }
 
+static bool
+bounce_bus_dma_id_mapped(bus_dma_tag_t dmat, vm_paddr_t buf, bus_size_t buflen)
+{
+
+   if ((dmat->bounce_flags & BF_COULD_BOUNCE) == 0)
+   return (true);
+   return (!_bus_dmamap_pagesneeded(dmat, buf, buflen, NULL));
+}
+
 static bus_dmamap_t
 alloc_dmamap(bus_dma_tag_t dmat, int flags)
 {
@@ -539,29 +550,45 @@ bounce_bus_dmamem_free(bus_dma_tag_t dmat, void *vaddr
dmat->bounce_flags);
 }
 
+static bool
+_bus_dmamap_pagesneeded(bus_dma_tag_t dmat, vm_paddr_t buf, bus_size_t buflen,
+int *pagesneeded)
+{
+   bus_addr_t curaddr;
+   bus_size_t sgsize;
+   int count;
+
+   /*
+* Count the number of bounce pages needed in order to
+* complete this transfer
+*/
+   count = 0;
+   curaddr = buf;
+   while (buflen != 0) {
+   sgsize = MIN(buflen, dmat->common.maxsegsz);
+   if (bus_dma_run_filter(>common, curaddr)) {
+   sgsize = MIN(sgsize,
+   PAGE_SIZE - (curaddr & PAGE_MASK));
+   if (pagesneeded == NULL)
+   return (true);
+   count++;
+   }
+   curaddr += sgsize;
+   buflen -= sgsize;
+   }
+
+   if (pagesneeded != NULL)
+   *pagesneeded = count;
+   return (count != 0);
+}
+
 static void
 _bus_dmamap_count_phys(bus_dma_tag_t dmat, bus_dmamap_t map, vm_paddr_t buf,
 bus_size_t buflen, int flags)
 {
-   bus_addr_t curaddr;
-   bus_size_t sgsize;
 
if ((map->flags & DMAMAP_COULD_BOUNCE) != 0 && map->pagesneeded == 0) {
-   /*
-* Count the number of bounce pages
-* needed in order to complete this transfer
-*/
-   curaddr = buf;
-   while (buflen != 0) {
-   sgsize = MIN(buflen, dmat->common.maxsegsz);
-   if (bus_dma_run_filter(>common, curaddr)) {
-   sgsize = MIN(sgsize,
-   PAGE_SIZE - (curaddr & PAGE_MASK));
-   map->pagesneeded++;
-   }
-   curaddr += sgsize;
-   buflen -= sgsize;
-   }
+   _bus_dmamap_pagesneeded(dmat, buf, buflen, >pagesneeded);
CTR1(KTR_BUSDMA, "pagesneeded= 

svn commit: r360524 - stable/11/lib/liblzma

2020-05-01 Thread Xin LI
Author: delphij
Date: Fri May  1 06:10:09 2020
New Revision: 360524
URL: https://svnweb.freebsd.org/changeset/base/360524

Log:
  Fix build.

Modified:
  stable/11/lib/liblzma/config.h

Modified: stable/11/lib/liblzma/config.h
==
--- stable/11/lib/liblzma/config.h  Fri May  1 05:36:13 2020
(r360523)
+++ stable/11/lib/liblzma/config.h  Fri May  1 06:10:09 2020
(r360524)
@@ -312,6 +312,7 @@
 #define HAVE__MM_MOVEMASK_EPI8 1
 #endif
 
+#if defined(__clang__) && defined(__FreeBSD__)
 /* Define to 1 if the GNU C extension __builtin_assume_aligned is supported.
*/
 #define HAVE___BUILTIN_ASSUME_ALIGNED 1
@@ -319,6 +320,7 @@
 /* Define to 1 if the GNU C extensions __builtin_bswap16/32/64 are supported.
*/
 #define HAVE___BUILTIN_BSWAPXX 1
+#endif
 
 /* Define to the sub-directory where libtool stores uninstalled libraries. */
 #define LT_OBJDIR ".libs/"
___
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: r360523 - in stable/11: contrib/xz contrib/xz/src/common contrib/xz/src/liblzma/api contrib/xz/src/liblzma/api/lzma contrib/xz/src/liblzma/check contrib/xz/src/liblzma/common contrib/xz...

2020-05-01 Thread Xin LI
Author: delphij
Date: Fri May  1 05:36:13 2020
New Revision: 360523
URL: https://svnweb.freebsd.org/changeset/base/360523

Log:
  MFC r359201: MFV r359197: xz 5.2.5.

Modified:
  stable/11/contrib/xz/ChangeLog
  stable/11/contrib/xz/FREEBSD-Xlist
  stable/11/contrib/xz/README
  stable/11/contrib/xz/THANKS
  stable/11/contrib/xz/src/common/sysdefs.h
  stable/11/contrib/xz/src/common/tuklib_cpucores.c
  stable/11/contrib/xz/src/common/tuklib_exit.c
  stable/11/contrib/xz/src/common/tuklib_integer.h
  stable/11/contrib/xz/src/common/tuklib_mbstr.h
  stable/11/contrib/xz/src/common/tuklib_mbstr_fw.c
  stable/11/contrib/xz/src/common/tuklib_mbstr_width.c
  stable/11/contrib/xz/src/common/tuklib_physmem.c
  stable/11/contrib/xz/src/liblzma/api/lzma.h
  stable/11/contrib/xz/src/liblzma/api/lzma/block.h
  stable/11/contrib/xz/src/liblzma/api/lzma/filter.h
  stable/11/contrib/xz/src/liblzma/api/lzma/hardware.h
  stable/11/contrib/xz/src/liblzma/api/lzma/lzma12.h
  stable/11/contrib/xz/src/liblzma/api/lzma/version.h
  stable/11/contrib/xz/src/liblzma/api/lzma/vli.h
  stable/11/contrib/xz/src/liblzma/check/crc32_fast.c
  stable/11/contrib/xz/src/liblzma/check/crc32_table.c
  stable/11/contrib/xz/src/liblzma/check/crc64_fast.c
  stable/11/contrib/xz/src/liblzma/check/crc64_table.c
  stable/11/contrib/xz/src/liblzma/common/alone_decoder.c
  stable/11/contrib/xz/src/liblzma/common/alone_encoder.c
  stable/11/contrib/xz/src/liblzma/common/block_header_decoder.c
  stable/11/contrib/xz/src/liblzma/common/block_header_encoder.c
  stable/11/contrib/xz/src/liblzma/common/block_util.c
  stable/11/contrib/xz/src/liblzma/common/common.c
  stable/11/contrib/xz/src/liblzma/common/filter_common.h
  stable/11/contrib/xz/src/liblzma/common/filter_decoder.h
  stable/11/contrib/xz/src/liblzma/common/filter_flags_encoder.c
  stable/11/contrib/xz/src/liblzma/common/hardware_physmem.c
  stable/11/contrib/xz/src/liblzma/common/index.c
  stable/11/contrib/xz/src/liblzma/common/memcmplen.h
  stable/11/contrib/xz/src/liblzma/common/stream_encoder_mt.c
  stable/11/contrib/xz/src/liblzma/common/stream_flags_decoder.c
  stable/11/contrib/xz/src/liblzma/common/stream_flags_encoder.c
  stable/11/contrib/xz/src/liblzma/common/vli_decoder.c
  stable/11/contrib/xz/src/liblzma/delta/delta_decoder.c
  stable/11/contrib/xz/src/liblzma/lz/lz_decoder.c
  stable/11/contrib/xz/src/liblzma/lz/lz_encoder_hash.h
  stable/11/contrib/xz/src/liblzma/lz/lz_encoder_mf.c
  stable/11/contrib/xz/src/liblzma/lzma/fastpos.h
  stable/11/contrib/xz/src/liblzma/lzma/fastpos_tablegen.c
  stable/11/contrib/xz/src/liblzma/lzma/lzma2_decoder.c
  stable/11/contrib/xz/src/liblzma/lzma/lzma_common.h
  stable/11/contrib/xz/src/liblzma/lzma/lzma_decoder.c
  stable/11/contrib/xz/src/liblzma/lzma/lzma_encoder.c
  stable/11/contrib/xz/src/liblzma/lzma/lzma_encoder_optimum_normal.c
  stable/11/contrib/xz/src/liblzma/lzma/lzma_encoder_private.h
  stable/11/contrib/xz/src/liblzma/simple/arm.c
  stable/11/contrib/xz/src/liblzma/simple/armthumb.c
  stable/11/contrib/xz/src/liblzma/simple/ia64.c
  stable/11/contrib/xz/src/liblzma/simple/powerpc.c
  stable/11/contrib/xz/src/liblzma/simple/simple_coder.c
  stable/11/contrib/xz/src/liblzma/simple/simple_decoder.c
  stable/11/contrib/xz/src/liblzma/simple/simple_encoder.c
  stable/11/contrib/xz/src/liblzma/simple/x86.c
  stable/11/contrib/xz/src/xz/args.c
  stable/11/contrib/xz/src/xz/coder.c
  stable/11/contrib/xz/src/xz/file_io.c
  stable/11/contrib/xz/src/xz/file_io.h
  stable/11/contrib/xz/src/xz/hardware.c
  stable/11/contrib/xz/src/xz/main.c
  stable/11/contrib/xz/src/xz/message.c
  stable/11/contrib/xz/src/xz/message.h
  stable/11/contrib/xz/src/xz/mytime.c
  stable/11/contrib/xz/src/xz/mytime.h
  stable/11/contrib/xz/src/xz/options.c
  stable/11/contrib/xz/src/xz/private.h
  stable/11/contrib/xz/src/xz/signals.c
  stable/11/contrib/xz/src/xz/util.c
  stable/11/contrib/xz/src/xz/xz.1
  stable/11/contrib/xz/src/xzdec/xzdec.c
  stable/11/lib/liblzma/config.h
Directory Properties:
  stable/11/   (props changed)

Modified: stable/11/contrib/xz/ChangeLog
==
--- stable/11/contrib/xz/ChangeLog  Fri May  1 04:59:40 2020
(r360522)
+++ stable/11/contrib/xz/ChangeLog  Fri May  1 05:36:13 2020
(r360523)
@@ -1,3 +1,1335 @@
+commit 2327a461e1afce862c22269b80d3517801103c1b
+Author: Lasse Collin 
+Date:   2020-03-17 16:27:42 +0200
+
+Bump version and soname for 5.2.5.
+
+ src/liblzma/Makefile.am| 2 +-
+ src/liblzma/api/lzma/version.h | 2 +-
+ 2 files changed, 2 insertions(+), 2 deletions(-)
+
+commit 3be82d2f7dc882258caf0f0a69214e5916b2bdda
+Author: Lasse Collin 
+Date:   2020-03-17 16:26:04 +0200
+
+Update NEWS for 5.2.5.
+
+ NEWS | 105 +++
+ 1 file changed, 105 insertions(+)
+
+commit ab3e57539c7337f0653b13b75dbc5d03ade9700e
+Author: Lasse Collin 
+Date:   2020-03-16