From owner-svn-src-head@freebsd.org Sun Nov 29 00:20:32 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 457FA46F7F3; Sun, 29 Nov 2020 00:20:32 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Ck8CN1Yxpz3C8F; Sun, 29 Nov 2020 00:20:32 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 28AA021C; Sun, 29 Nov 2020 00:20:32 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AT0KWJo057410; Sun, 29 Nov 2020 00:20:32 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AT0KVGE056979; Sun, 29 Nov 2020 00:20:31 GMT (envelope-from mav@FreeBSD.org) Message-Id: <202011290020.0AT0KVGE056979@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 29 Nov 2020 00:20:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368132 - head/sys/dev/nvme X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/sys/dev/nvme X-SVN-Commit-Revision: 368132 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Nov 2020 00:20:32 -0000 Author: mav Date: Sun Nov 29 00:20:31 2020 New Revision: 368132 URL: https://svnweb.freebsd.org/changeset/base/368132 Log: Increase nvme(4) maximum transfer size from 1MB to 2MB. With 4KB page size the 2MB is the maximum we can address with one page PRP. Going further would require chaining, that would add some more complexity. On the other side, to reduce memory consumption, allocate the PRP memory respecting maximum transfer size reported in the controller identify data. Many of NVMe devices support much smaller values, starting from 128KB. To do that we have to change the initialization sequence to pull the data earlier, before setting up the I/O queue pairs. The admin queue pair is still allocated for full MIN(maxphys, 2MB) size, but it is not a big deal, since there is only one such queue with only 16 trackers. Reviewed by: imp MFC after: 2 weeks Sponsored by: iXsystems, Inc. Modified: head/sys/dev/nvme/nvme.h head/sys/dev/nvme/nvme_ctrlr.c head/sys/dev/nvme/nvme_private.h head/sys/dev/nvme/nvme_qpair.c Modified: head/sys/dev/nvme/nvme.h ============================================================================== --- head/sys/dev/nvme/nvme.h Sat Nov 28 23:24:19 2020 (r368131) +++ head/sys/dev/nvme/nvme.h Sun Nov 29 00:20:31 2020 (r368132) @@ -59,8 +59,8 @@ */ #define NVME_GLOBAL_NAMESPACE_TAG ((uint32_t)0xFFFFFFFF) -/* Cap nvme to 1MB transfers driver explodes with larger sizes */ -#define NVME_MAX_XFER_SIZE (maxphys < (1<<20) ? maxphys : (1<<20)) +/* Cap transfers by the maximum addressable by page-sized PRP (4KB -> 2MB). */ +#define NVME_MAX_XFER_SIZE MIN(maxphys, (PAGE_SIZE/8*PAGE_SIZE)) /* Register field definitions */ #define NVME_CAP_LO_REG_MQES_SHIFT (0) Modified: head/sys/dev/nvme/nvme_ctrlr.c ============================================================================== --- head/sys/dev/nvme/nvme_ctrlr.c Sat Nov 28 23:24:19 2020 (r368131) +++ head/sys/dev/nvme/nvme_ctrlr.c Sun Nov 29 00:20:31 2020 (r368132) @@ -1053,16 +1053,16 @@ nvme_ctrlr_start(void *ctrlr_arg, bool resetting) * the number of I/O queues supported, so cannot reset * the adminq again here. */ - if (resetting) + if (resetting) { nvme_qpair_reset(&ctrlr->adminq); + nvme_admin_qpair_enable(&ctrlr->adminq); + } if (ctrlr->ioq != NULL) { for (i = 0; i < ctrlr->num_io_queues; i++) nvme_qpair_reset(&ctrlr->ioq[i]); } - nvme_admin_qpair_enable(&ctrlr->adminq); - /* * If it was a reset on initialization command timeout, just * return here, letting initialization code fail gracefully. @@ -1070,7 +1070,7 @@ nvme_ctrlr_start(void *ctrlr_arg, bool resetting) if (resetting && !ctrlr->is_initialized) return; - if (nvme_ctrlr_identify(ctrlr) != 0) { + if (resetting && nvme_ctrlr_identify(ctrlr) != 0) { nvme_ctrlr_fail(ctrlr); return; } @@ -1145,7 +1145,8 @@ fail: nvme_qpair_reset(&ctrlr->adminq); nvme_admin_qpair_enable(&ctrlr->adminq); - if (nvme_ctrlr_set_num_qpairs(ctrlr) == 0 && + if (nvme_ctrlr_identify(ctrlr) == 0 && + nvme_ctrlr_set_num_qpairs(ctrlr) == 0 && nvme_ctrlr_construct_io_qpairs(ctrlr) == 0) nvme_ctrlr_start(ctrlr, false); else Modified: head/sys/dev/nvme/nvme_private.h ============================================================================== --- head/sys/dev/nvme/nvme_private.h Sat Nov 28 23:24:19 2020 (r368131) +++ head/sys/dev/nvme/nvme_private.h Sun Nov 29 00:20:31 2020 (r368132) @@ -56,15 +56,6 @@ MALLOC_DECLARE(M_NVME); #define IDT32_PCI_ID 0x80d0111d /* 32 channel board */ #define IDT8_PCI_ID 0x80d2111d /* 8 channel board */ -/* - * For commands requiring more than 2 PRP entries, one PRP will be - * embedded in the command (prp1), and the rest of the PRP entries - * will be in a list pointed to by the command (prp2). This means - * that real max number of PRP entries we support is 32+1, which - * results in a max xfer size of 32*PAGE_SIZE. - */ -#define NVME_MAX_PRP_LIST_ENTRIES (NVME_MAX_XFER_SIZE / PAGE_SIZE) - #define NVME_ADMIN_TRACKERS (16) #define NVME_ADMIN_ENTRIES (128) /* min and max are defined in admin queue attributes section of spec */ Modified: head/sys/dev/nvme/nvme_qpair.c ============================================================================== --- head/sys/dev/nvme/nvme_qpair.c Sat Nov 28 23:24:19 2020 (r368131) +++ head/sys/dev/nvme/nvme_qpair.c Sun Nov 29 00:20:31 2020 (r368132) @@ -687,8 +687,8 @@ nvme_qpair_construct(struct nvme_qpair *qpair, /* Note: NVMe PRP format is restricted to 4-byte alignment. */ err = bus_dma_tag_create(bus_get_dma_tag(ctrlr->dev), 4, PAGE_SIZE, BUS_SPACE_MAXADDR, - BUS_SPACE_MAXADDR, NULL, NULL, NVME_MAX_XFER_SIZE, - (NVME_MAX_XFER_SIZE/PAGE_SIZE)+1, PAGE_SIZE, 0, + BUS_SPACE_MAXADDR, NULL, NULL, ctrlr->max_xfer_size, + btoc(ctrlr->max_xfer_size) + 1, PAGE_SIZE, 0, NULL, NULL, &qpair->dma_tag_payload); if (err != 0) { nvme_printf(ctrlr, "payload tag create failed %d\n", err); @@ -703,7 +703,12 @@ nvme_qpair_construct(struct nvme_qpair *qpair, cmdsz = roundup2(cmdsz, PAGE_SIZE); cplsz = qpair->num_entries * sizeof(struct nvme_completion); cplsz = roundup2(cplsz, PAGE_SIZE); - prpsz = sizeof(uint64_t) * NVME_MAX_PRP_LIST_ENTRIES; + /* + * For commands requiring more than 2 PRP entries, one PRP will be + * embedded in the command (prp1), and the rest of the PRP entries + * will be in a list pointed to by the command (prp2). + */ + prpsz = sizeof(uint64_t) * btoc(ctrlr->max_xfer_size); prpmemsz = qpair->num_trackers * prpsz; allocsz = cmdsz + cplsz + prpmemsz; From owner-svn-src-head@freebsd.org Sun Nov 29 00:35:14 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 568D546FD53; Sun, 29 Nov 2020 00:35:14 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Ck8XL1xlZz3DFH; Sun, 29 Nov 2020 00:35:14 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 35A8B53C; Sun, 29 Nov 2020 00:35:14 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AT0ZD3d068555; Sun, 29 Nov 2020 00:35:13 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AT0ZDZs068554; Sun, 29 Nov 2020 00:35:13 GMT (envelope-from mav@FreeBSD.org) Message-Id: <202011290035.0AT0ZDZs068554@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 29 Nov 2020 00:35:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368133 - head/sys/dev/isp X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/sys/dev/isp X-SVN-Commit-Revision: 368133 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Nov 2020 00:35:14 -0000 Author: mav Date: Sun Nov 29 00:35:13 2020 New Revision: 368133 URL: https://svnweb.freebsd.org/changeset/base/368133 Log: Mark inline functions static. Modified: head/sys/dev/isp/isp_library.h Modified: head/sys/dev/isp/isp_library.h ============================================================================== --- head/sys/dev/isp/isp_library.h Sun Nov 29 00:20:31 2020 (r368132) +++ head/sys/dev/isp/isp_library.h Sun Nov 29 00:35:13 2020 (r368133) @@ -53,7 +53,7 @@ void isp_destroy_handle(ispsoftc_t *, uint32_t); /* * Request Queue allocation */ -inline int +static inline int isp_rqentry_avail(ispsoftc_t *isp, uint32_t num) { if (ISP_QAVAIL(isp) >= num) @@ -63,7 +63,7 @@ isp_rqentry_avail(ispsoftc_t *isp, uint32_t num) return (ISP_QAVAIL(isp) >= num); } -inline void * +static inline void * isp_getrqentry(ispsoftc_t *isp) { if (!isp_rqentry_avail(isp, 1)) From owner-svn-src-head@freebsd.org Sun Nov 29 00:49:15 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 019184707C3; Sun, 29 Nov 2020 00:49:15 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Ck8rV6fGYz3Dqy; Sun, 29 Nov 2020 00:49:14 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D724855D; Sun, 29 Nov 2020 00:49:14 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AT0nE0b075058; Sun, 29 Nov 2020 00:49:14 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AT0nExQ075057; Sun, 29 Nov 2020 00:49:14 GMT (envelope-from mav@FreeBSD.org) Message-Id: <202011290049.0AT0nExQ075057@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 29 Nov 2020 00:49:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368134 - head/sys/cam X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/sys/cam X-SVN-Commit-Revision: 368134 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Nov 2020 00:49:15 -0000 Author: mav Date: Sun Nov 29 00:49:14 2020 New Revision: 368134 URL: https://svnweb.freebsd.org/changeset/base/368134 Log: Remove alignment requirements for KVA buffer mapping. After r368124 vmapbuf() should happily map misaligned maxphys-sized buffers thanks to extra page added to pbuf_zone. Modified: head/sys/cam/cam_periph.c Modified: head/sys/cam/cam_periph.c ============================================================================== --- head/sys/cam/cam_periph.c Sun Nov 29 00:35:13 2020 (r368133) +++ head/sys/cam/cam_periph.c Sun Nov 29 00:49:14 2020 (r368134) @@ -783,7 +783,6 @@ cam_periph_mapmem(union ccb *ccb, struct cam_periph_ma u_int8_t **data_ptrs[CAM_PERIPH_MAXMAPS]; u_int32_t lengths[CAM_PERIPH_MAXMAPS]; u_int32_t dirs[CAM_PERIPH_MAXMAPS]; - bool misaligned[CAM_PERIPH_MAXMAPS]; bzero(mapinfo, sizeof(*mapinfo)); if (maxmap == 0) @@ -901,17 +900,6 @@ cam_periph_mapmem(union ccb *ccb, struct cam_periph_ma (long)(lengths[i]), (u_long)maxmap); return (E2BIG); } - - /* - * The userland data pointer passed in may not be page - * aligned. vmapbuf() truncates the address to a page - * boundary, so if the address isn't page aligned, we'll - * need enough space for the given transfer length, plus - * whatever extra space is necessary to make it to the page - * boundary. - */ - misaligned[i] = (lengths[i] + - (((vm_offset_t)(*data_ptrs[i])) & PAGE_MASK) > maxphys); } /* @@ -934,7 +922,7 @@ cam_periph_mapmem(union ccb *ccb, struct cam_periph_ma * small allocations malloc is backed by UMA, and so much * cheaper on SMP systems. */ - if ((lengths[i] <= periph_mapmem_thresh || misaligned[i]) && + if (lengths[i] <= periph_mapmem_thresh && ccb->ccb_h.func_code != XPT_MMC_IO) { *data_ptrs[i] = malloc(lengths[i], M_CAMPERIPH, M_WAITOK); From owner-svn-src-head@freebsd.org Sun Nov 29 00:57:19 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D3287470FC9; Sun, 29 Nov 2020 00:57:19 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Ck91q5fBKz3Ffv; Sun, 29 Nov 2020 00:57:19 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B048691E; Sun, 29 Nov 2020 00:57:19 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AT0vJvn081238; Sun, 29 Nov 2020 00:57:19 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AT0vJBa081237; Sun, 29 Nov 2020 00:57:19 GMT (envelope-from mav@FreeBSD.org) Message-Id: <202011290057.0AT0vJBa081237@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 29 Nov 2020 00:57:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368136 - head/sys/dev/nvme X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/sys/dev/nvme X-SVN-Commit-Revision: 368136 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Nov 2020 00:57:19 -0000 Author: mav Date: Sun Nov 29 00:57:19 2020 New Revision: 368136 URL: https://svnweb.freebsd.org/changeset/base/368136 Log: Remove aligment requirements for passthrough buffer. After r368124 vmapbuf() should happily map misaligned maxphys-sized buffers thanks to extra page added to pbuf_zone. Modified: head/sys/dev/nvme/nvme_ctrlr.c Modified: head/sys/dev/nvme/nvme_ctrlr.c ============================================================================== --- head/sys/dev/nvme/nvme_ctrlr.c Sun Nov 29 00:54:13 2020 (r368135) +++ head/sys/dev/nvme/nvme_ctrlr.c Sun Nov 29 00:57:19 2020 (r368136) @@ -1244,20 +1244,8 @@ nvme_ctrlr_passthrough_cmd(struct nvme_controller *ctr struct mtx *mtx; struct buf *buf = NULL; int ret = 0; - vm_offset_t addr, end; if (pt->len > 0) { - /* - * vmapbuf calls vm_fault_quick_hold_pages which only maps full - * pages. Ensure this request has fewer than maxphys bytes when - * extended to full pages. - */ - addr = (vm_offset_t)pt->buf; - end = round_page(addr + pt->len); - addr = trunc_page(addr); - if (end - addr > maxphys) - return EIO; - if (pt->len > ctrlr->max_xfer_size) { nvme_printf(ctrlr, "pt->len (%d) " "exceeds max_xfer_size (%d)\n", pt->len, From owner-svn-src-head@freebsd.org Sun Nov 29 01:30:17 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DDB66471C45; Sun, 29 Nov 2020 01:30:17 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Ck9ls5kQlz3HRG; Sun, 29 Nov 2020 01:30:17 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B768C1088; Sun, 29 Nov 2020 01:30:17 +0000 (UTC) (envelope-from mav@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AT1UHUV000192; Sun, 29 Nov 2020 01:30:17 GMT (envelope-from mav@FreeBSD.org) Received: (from mav@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AT1UHD1000191; Sun, 29 Nov 2020 01:30:17 GMT (envelope-from mav@FreeBSD.org) Message-Id: <202011290130.0AT1UHD1000191@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mav set sender to mav@FreeBSD.org using -f From: Alexander Motin Date: Sun, 29 Nov 2020 01:30:17 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368138 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mav X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 368138 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Nov 2020 01:30:17 -0000 Author: mav Date: Sun Nov 29 01:30:17 2020 New Revision: 368138 URL: https://svnweb.freebsd.org/changeset/base/368138 Log: Remove alignment requirements for KVA buffer mapping. After r368124 pbuf_zone has extra page to handle this particular case. Modified: head/sys/kern/kern_physio.c Modified: head/sys/kern/kern_physio.c ============================================================================== --- head/sys/kern/kern_physio.c Sun Nov 29 01:22:30 2020 (r368137) +++ head/sys/kern/kern_physio.c Sun Nov 29 01:30:17 2020 (r368138) @@ -30,11 +30,14 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include +#include #include +#include #include #include @@ -107,7 +110,7 @@ physio(struct cdev *dev, struct uio *uio, int ioflag) pbuf = uma_zalloc(pbuf_zone, M_WAITOK); MPASS((pbuf->b_flags & B_MAXPHYS) != 0); sa = pbuf->b_data; - maxpages = btoc(maxphys); + maxpages = PBUF_PAGES; pages = pbuf->b_pages; } prot = VM_PROT_READ; @@ -147,28 +150,6 @@ physio(struct cdev *dev, struct uio *uio, int ioflag) bp->bio_length = dev->si_iosize_max; if (bp->bio_length > maxphys) bp->bio_length = maxphys; - - /* - * Make sure the pbuf can map the request. - * The pbuf has kvasize = maxphys, so a request - * larger than maxphys - PAGE_SIZE must be - * page aligned or it will be fragmented. - */ - poff = (vm_offset_t)base & PAGE_MASK; - if (pbuf && bp->bio_length + poff > pbuf->b_kvasize) { - if (dev->si_flags & SI_NOSPLIT) { - uprintf("%s: request ptr %p is not " - "on a page boundary; cannot split " - "request\n", devtoname(dev), - base); - error = EFBIG; - goto doerror; - } - bp->bio_length = pbuf->b_kvasize; - if (poff != 0) - bp->bio_length -= PAGE_SIZE; - } - bp->bio_bcount = bp->bio_length; bp->bio_dev = dev; @@ -180,6 +161,7 @@ physio(struct cdev *dev, struct uio *uio, int ioflag) error = EFAULT; goto doerror; } + poff = (vm_offset_t)base & PAGE_MASK; if (pbuf && sa) { pmap_qenter((vm_offset_t)sa, pages, npages); From owner-svn-src-head@freebsd.org Sun Nov 29 01:43:05 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4D8D947252B; Sun, 29 Nov 2020 01:43:05 +0000 (UTC) (envelope-from yuripv@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CkB2d1j6Mz3J3F; Sun, 29 Nov 2020 01:43:05 +0000 (UTC) (envelope-from yuripv@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2DCF810C1; Sun, 29 Nov 2020 01:43:05 +0000 (UTC) (envelope-from yuripv@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AT1h53L012200; Sun, 29 Nov 2020 01:43:05 GMT (envelope-from yuripv@FreeBSD.org) Received: (from yuripv@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AT1h5Ze012199; Sun, 29 Nov 2020 01:43:05 GMT (envelope-from yuripv@FreeBSD.org) Message-Id: <202011290143.0AT1h5Ze012199@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: yuripv set sender to yuripv@FreeBSD.org using -f From: Yuri Pankov Date: Sun, 29 Nov 2020 01:43:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368140 - head/sys/x86/cpufreq X-SVN-Group: head X-SVN-Commit-Author: yuripv X-SVN-Commit-Paths: head/sys/x86/cpufreq X-SVN-Commit-Revision: 368140 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Nov 2020 01:43:05 -0000 Author: yuripv Date: Sun Nov 29 01:43:04 2020 New Revision: 368140 URL: https://svnweb.freebsd.org/changeset/base/368140 Log: hwpstate_intel: don't unconditionally print the error message Actually check the wrmsr_safe() return value when setting autonomous HWP for package. PR: 245582 Differential Revision: https://reviews.freebsd.org/D24744 Modified: head/sys/x86/cpufreq/hwpstate_intel.c Modified: head/sys/x86/cpufreq/hwpstate_intel.c ============================================================================== --- head/sys/x86/cpufreq/hwpstate_intel.c Sun Nov 29 01:32:53 2020 (r368139) +++ head/sys/x86/cpufreq/hwpstate_intel.c Sun Nov 29 01:43:04 2020 (r368140) @@ -461,8 +461,10 @@ set_autonomous_hwp(struct hwp_softc *sc) * not exist." (Intel SDM §14.4.4) */ ret = wrmsr_safe(MSR_IA32_HWP_REQUEST_PKG, sc->req); - device_printf(dev, - "Failed to set autonomous HWP for package\n"); + if (ret) { + device_printf(dev, + "Failed to set autonomous HWP for package\n"); + } } out: From owner-svn-src-head@freebsd.org Sun Nov 29 08:40:16 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B351747AC18; Sun, 29 Nov 2020 08:40:16 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CkMJ04h9rz3rkL; Sun, 29 Nov 2020 08:40:16 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 88F146696; Sun, 29 Nov 2020 08:40:16 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AT8eG8K067354; Sun, 29 Nov 2020 08:40:16 GMT (envelope-from mmel@FreeBSD.org) Received: (from mmel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AT8eClM067333; Sun, 29 Nov 2020 08:40:12 GMT (envelope-from mmel@FreeBSD.org) Message-Id: <202011290840.0AT8eClM067333@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmel set sender to mmel@FreeBSD.org using -f From: Michal Meloun Date: Sun, 29 Nov 2020 08:40:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368141 - in head/sys/arm: allwinner annapurna/alpine arm freescale/imx include mv versatile X-SVN-Group: head X-SVN-Commit-Author: mmel X-SVN-Commit-Paths: in head/sys/arm: allwinner annapurna/alpine arm freescale/imx include mv versatile X-SVN-Commit-Revision: 368141 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Nov 2020 08:40:16 -0000 Author: mmel Date: Sun Nov 29 08:40:12 2020 New Revision: 368141 URL: https://svnweb.freebsd.org/changeset/base/368141 Log: Remove the pre-ARMv6 and pre-INTRNG code. ARM has required ARMV6+ and INTRNg for some time now, so remove always false #ifdefs and unconditionally do always true #ifdefs. Deleted: head/sys/arm/annapurna/alpine/alpine_common.c head/sys/arm/freescale/imx/imx_common.c head/sys/arm/versatile/versatile_common.c Modified: head/sys/arm/allwinner/aw_gpio.c head/sys/arm/allwinner/files.allwinner head/sys/arm/annapurna/alpine/files.alpine head/sys/arm/arm/bcopyinout.S head/sys/arm/arm/bcopyinout_xscale.S head/sys/arm/arm/bus_space_base.c head/sys/arm/arm/copystr.S head/sys/arm/arm/cpuinfo.c head/sys/arm/arm/db_interface.c head/sys/arm/arm/debug_monitor.c head/sys/arm/arm/disassem.c head/sys/arm/arm/elf_machdep.c head/sys/arm/arm/exception.S head/sys/arm/arm/fiq.c head/sys/arm/arm/fusu.S head/sys/arm/arm/genassym.c head/sys/arm/arm/machdep.c head/sys/arm/arm/machdep_intr.c head/sys/arm/arm/machdep_kdb.c head/sys/arm/arm/mem.c head/sys/arm/arm/minidump_machdep.c head/sys/arm/arm/mp_machdep.c head/sys/arm/arm/nexus.c head/sys/arm/arm/stdatomic.c head/sys/arm/arm/sys_machdep.c head/sys/arm/arm/vm_machdep.c head/sys/arm/freescale/imx/files.imx5 head/sys/arm/include/_align.h head/sys/arm/include/armreg.h head/sys/arm/include/asmacros.h head/sys/arm/include/atomic-v6.h head/sys/arm/include/bus.h head/sys/arm/include/bus_dma.h head/sys/arm/include/cpu-v6.h head/sys/arm/include/cpufunc.h head/sys/arm/include/cpuinfo.h head/sys/arm/include/db_machdep.h head/sys/arm/include/debug_monitor.h head/sys/arm/include/fdt.h head/sys/arm/include/frame.h head/sys/arm/include/intr.h head/sys/arm/include/kdb.h head/sys/arm/include/machdep.h head/sys/arm/include/pcpu.h head/sys/arm/include/proc.h head/sys/arm/include/sf_buf.h head/sys/arm/include/sysarch.h head/sys/arm/include/sysreg.h head/sys/arm/include/vm.h head/sys/arm/mv/gpio.c head/sys/arm/mv/mpic.c head/sys/arm/mv/mv_common.c head/sys/arm/mv/mv_pci.c head/sys/arm/versatile/files.versatile Modified: head/sys/arm/allwinner/aw_gpio.c ============================================================================== --- head/sys/arm/allwinner/aw_gpio.c Sun Nov 29 01:43:04 2020 (r368140) +++ head/sys/arm/allwinner/aw_gpio.c Sun Nov 29 08:40:12 2020 (r368141) @@ -62,10 +62,7 @@ __FBSDID("$FreeBSD$"); #include "opt_soc.h" #endif -#ifdef INTRNG #include "pic_if.h" -#endif - #include "gpio_if.h" #define AW_GPIO_DEFAULT_CAPS (GPIO_PIN_INPUT | GPIO_PIN_OUTPUT | \ @@ -257,7 +254,6 @@ struct clk_list { clk_t clk; }; -#ifdef INTRNG struct gpio_irqsrc { struct intr_irqsrc isrc; u_int irq; @@ -269,7 +265,6 @@ struct gpio_irqsrc { uint32_t oldfunc; bool enabled; }; -#endif #define AW_GPIO_MEMRES 0 #define AW_GPIO_IRQRES 1 @@ -286,10 +281,8 @@ struct aw_gpio_softc { struct aw_gpio_conf *conf; TAILQ_HEAD(, clk_list) clk_list; -#ifdef INTRNG struct gpio_irqsrc *gpio_pic_irqsrc; int nirqs; -#endif }; static struct resource_spec aw_gpio_res_spec[] = { @@ -1071,10 +1064,8 @@ aw_gpio_attach(device_t dev) goto fail; } -#ifdef INTRNG aw_gpio_register_isrcs(sc); intr_pic_register(dev, OF_xref_from_node(ofw_bus_get_node(dev))); -#endif sc->sc_busdev = gpiobus_attach_bus(dev); if (sc->sc_busdev == NULL) @@ -1451,7 +1442,6 @@ static device_method_t aw_gpio_methods[] = { DEVMETHOD(device_attach, aw_gpio_attach), DEVMETHOD(device_detach, aw_gpio_detach), -#ifdef INTRNG /* Interrupt controller interface */ DEVMETHOD(pic_disable_intr, aw_gpio_pic_disable_intr), DEVMETHOD(pic_enable_intr, aw_gpio_pic_enable_intr), @@ -1461,7 +1451,6 @@ static device_method_t aw_gpio_methods[] = { DEVMETHOD(pic_post_filter, aw_gpio_pic_post_filter), DEVMETHOD(pic_post_ithread, aw_gpio_pic_post_ithread), DEVMETHOD(pic_pre_ithread, aw_gpio_pic_pre_ithread), -#endif /* GPIO protocol */ DEVMETHOD(gpio_get_bus, aw_gpio_get_bus), Modified: head/sys/arm/allwinner/files.allwinner ============================================================================== --- head/sys/arm/allwinner/files.allwinner Sun Nov 29 01:43:04 2020 (r368140) +++ head/sys/arm/allwinner/files.allwinner Sun Nov 29 08:40:12 2020 (r368141) @@ -10,7 +10,7 @@ arm/allwinner/aw_if_dwc.c optional dwc arm/allwinner/aw_machdep.c standard arm/allwinner/aw_mmc.c optional mmc | mmccam arm/allwinner/aw_mp.c optional smp -arm/allwinner/aw_nmi.c optional intrng +arm/allwinner/aw_nmi.c standard arm/allwinner/aw_rsb.c optional rsb | p2wi arm/allwinner/aw_rtc.c optional aw_rtc arm/allwinner/aw_syscon.c optional ext_resources syscon Modified: head/sys/arm/annapurna/alpine/files.alpine ============================================================================== --- head/sys/arm/annapurna/alpine/files.alpine Sun Nov 29 01:43:04 2020 (r368140) +++ head/sys/arm/annapurna/alpine/files.alpine Sun Nov 29 08:40:12 2020 (r368141) @@ -3,6 +3,5 @@ arm/versatile/sp804.c standard dev/uart/uart_dev_ns8250.c optional uart -arm/annapurna/alpine/alpine_common.c standard arm/annapurna/alpine/alpine_machdep.c standard arm/annapurna/alpine/alpine_machdep_mp.c optional smp Modified: head/sys/arm/arm/bcopyinout.S ============================================================================== --- head/sys/arm/arm/bcopyinout.S Sun Nov 29 01:43:04 2020 (r368140) +++ head/sys/arm/arm/bcopyinout.S Sun Nov 29 08:40:12 2020 (r368141) @@ -54,18 +54,9 @@ __FBSDID("$FreeBSD$"); .text .align 2 -#if __ARM_ARCH >= 6 #define GET_PCB(tmp) \ mrc p15, 0, tmp, c13, c0, 4; \ add tmp, tmp, #(TD_PCB) -#else -.Lcurpcb: - .word _C_LABEL(__pcpu) + PC_CURPCB - -#define GET_PCB(tmp) \ - ldr tmp, .Lcurpcb -#endif - #define SAVE_REGS stmfd sp!, {r4-r11}; _SAVE({r4-r11}) #define RESTORE_REGS ldmfd sp!, {r4-r11} Modified: head/sys/arm/arm/bcopyinout_xscale.S ============================================================================== --- head/sys/arm/arm/bcopyinout_xscale.S Sun Nov 29 01:43:04 2020 (r368140) +++ head/sys/arm/arm/bcopyinout_xscale.S Sun Nov 29 08:40:12 2020 (r368141) @@ -42,16 +42,9 @@ __FBSDID("$FreeBSD$"); .text .align 2 -#if __ARM_ARCH >= 6 #define GET_PCB(tmp) \ mrc p15, 0, tmp, c13, c0, 4; \ add tmp, tmp, #(TD_PCB) -#else -.Lcurpcb: - .word _C_LABEL(__pcpu) + PC_CURPCB -#define GET_PCB(tmp) \ - ldr tmp, .Lcurpcb -#endif /* * r0 = user space address Modified: head/sys/arm/arm/bus_space_base.c ============================================================================== --- head/sys/arm/arm/bus_space_base.c Sun Nov 29 01:43:04 2020 (r368140) +++ head/sys/arm/arm/bus_space_base.c Sun Nov 29 08:40:12 2020 (r368141) @@ -156,6 +156,3 @@ static struct bus_space arm_base_bus_space __aligned(C bus_space_tag_t fdtbus_bs_tag = &arm_base_bus_space; #endif -#if __ARM_ARCH < 6 -bus_space_tag_t arm_base_bs_tag = &arm_base_bus_space; -#endif Modified: head/sys/arm/arm/copystr.S ============================================================================== --- head/sys/arm/arm/copystr.S Sun Nov 29 01:43:04 2020 (r368140) +++ head/sys/arm/arm/copystr.S Sun Nov 29 08:40:12 2020 (r368141) @@ -48,17 +48,9 @@ __FBSDID("$FreeBSD$"); .text .align 2 -#if __ARM_ARCH >= 6 #define GET_PCB(tmp) \ mrc p15, 0, tmp, c13, c0, 4; \ add tmp, tmp, #(TD_PCB) -#else -.Lpcb: - .word _C_LABEL(__pcpu) + PC_CURPCB - -#define GET_PCB(tmp) \ - ldr tmp, .Lpcb -#endif #define SAVE_REGS stmfd sp!, {r4-r6} #define RESTORE_REGS ldmfd sp!, {r4-r6} Modified: head/sys/arm/arm/cpuinfo.c ============================================================================== --- head/sys/arm/arm/cpuinfo.c Sun Nov 29 01:43:04 2020 (r368140) +++ head/sys/arm/arm/cpuinfo.c Sun Nov 29 08:40:12 2020 (r368141) @@ -40,12 +40,10 @@ __FBSDID("$FreeBSD$"); #include #include -#if __ARM_ARCH >= 6 void reinit_mmu(uint32_t ttb, uint32_t aux_clr, uint32_t aux_set); int disable_bp_hardening; int spectre_v2_safe = 1; -#endif struct cpuinfo cpuinfo = { @@ -83,9 +81,7 @@ SYSCTL_INT(_hw_cpu_quirks, OID_AUTO, actlr_set, void cpuinfo_init(void) { -#if __ARM_ARCH >= 6 uint32_t tmp; -#endif /* * Prematurely fetch CPU quirks. Standard fetch for tunable @@ -130,16 +126,13 @@ cpuinfo_init(void) /* CP15 c0,c0 regs 0-7 exist on all CPUs (although aliased with MIDR) */ cpuinfo.ctr = cp15_ctr_get(); cpuinfo.tcmtr = cp15_tcmtr_get(); -#if __ARM_ARCH >= 6 cpuinfo.tlbtr = cp15_tlbtr_get(); cpuinfo.mpidr = cp15_mpidr_get(); cpuinfo.revidr = cp15_revidr_get(); -#endif /* if CPU is not v7 cpu id scheme */ if (cpuinfo.architecture != 0xF) return; -#if __ARM_ARCH >= 6 cpuinfo.id_pfr0 = cp15_id_pfr0_get(); cpuinfo.id_pfr1 = cp15_id_pfr1_get(); cpuinfo.id_dfr0 = cp15_id_dfr0_get(); @@ -240,10 +233,8 @@ cpuinfo_init(void) tmp = (cpuinfo.id_isar5 >> 16) & 0xF; /* CRC32 */ if (tmp >= 1) elf_hwcap2 |= HWCAP2_CRC32; -#endif } -#if __ARM_ARCH >= 6 /* * Get bits that must be set or cleared in ACLR register. * Note: Bits in ACLR register are IMPLEMENTATION DEFINED. @@ -535,5 +526,3 @@ SYSCTL_PROC(_machdep, OID_AUTO, disable_bp_hardening, SYSCTL_INT(_machdep, OID_AUTO, spectre_v2_safe, CTLFLAG_RD, &spectre_v2_safe, 0, "System is safe to Spectre Version 2 attacks"); - -#endif /* __ARM_ARCH >= 6 */ Modified: head/sys/arm/arm/db_interface.c ============================================================================== --- head/sys/arm/arm/db_interface.c Sun Nov 29 01:43:04 2020 (r368140) +++ head/sys/arm/arm/db_interface.c Sun Nov 29 08:40:12 2020 (r368141) @@ -153,10 +153,9 @@ void db_show_mdpcpu(struct pcpu *pc) { -#if __ARM_ARCH >= 6 db_printf("curpmap = %p\n", pc->pc_curpmap); -#endif } + int db_validate_address(vm_offset_t addr) { Modified: head/sys/arm/arm/debug_monitor.c ============================================================================== --- head/sys/arm/arm/debug_monitor.c Sun Nov 29 01:43:04 2020 (r368140) +++ head/sys/arm/arm/debug_monitor.c Sun Nov 29 08:40:12 2020 (r368141) @@ -257,7 +257,6 @@ kdb_cpu_pc_is_singlestep(db_addr_t pc) /* * XXX: If the platform fails to enable its debug arch. * there will be no stepping capabilities - * (SOFTWARE_SSTEP is not defined for __ARM_ARCH >= 6). */ if (!dbg_capable()) return (FALSE); Modified: head/sys/arm/arm/disassem.c ============================================================================== --- head/sys/arm/arm/disassem.c Sun Nov 29 01:43:04 2020 (r368140) +++ head/sys/arm/arm/disassem.c Sun Nov 29 08:40:12 2020 (r368141) @@ -131,7 +131,6 @@ static const struct arm32_insn arm32_i[] = { { 0x0c500000, 0x04100000, "ldr", "daW" }, { 0x0c500000, 0x04400000, "strb", "daW" }, { 0x0c500000, 0x04500000, "ldrb", "daW" }, -#if __ARM_ARCH >= 6 { 0x0fff0ff0, 0x06bf0fb0, "rev16", "dm" }, { 0xffffffff, 0xf57ff01f, "clrex", "c" }, { 0x0ff00ff0, 0x01800f90, "strex", "dmo" }, @@ -142,7 +141,6 @@ static const struct arm32_insn arm32_i[] = { { 0x0ff00fff, 0x01d00f9f, "ldrexb", "do" }, { 0x0ff00ff0, 0x01e00f90, "strexh", "dmo" }, { 0x0ff00fff, 0x01f00f9f, "ldrexh", "do" }, -#endif { 0x0e1f0000, 0x080d0000, "stm", "YnWl" },/* separate out r13 base */ { 0x0e1f0000, 0x081d0000, "ldm", "YnWl" },/* separate out r13 base */ { 0x0e100000, 0x08000000, "stm", "XnWl" }, Modified: head/sys/arm/arm/elf_machdep.c ============================================================================== --- head/sys/arm/arm/elf_machdep.c Sun Nov 29 01:43:04 2020 (r368140) +++ head/sys/arm/arm/elf_machdep.c Sun Nov 29 08:40:12 2020 (r368141) @@ -85,9 +85,7 @@ struct sysentvec elf32_freebsd_sysvec = { .sv_fixlimit = NULL, .sv_maxssiz = NULL, .sv_flags = -#if __ARM_ARCH >= 6 SV_ASLR | SV_SHP | SV_TIMEKEEP | SV_RNG_SEED_VER | -#endif SV_ABI_FREEBSD | SV_ILP32 | SV_ASLR, .sv_set_syscall_retval = cpu_set_syscall_retval, .sv_fetch_syscall_args = cpu_fetch_syscall_args, @@ -305,14 +303,8 @@ elf_cpu_load_file(linker_file_t lf) */ if (lf->id == 1) return (0); -#if __ARM_ARCH >= 6 dcache_wb_pou((vm_offset_t)lf->address, (vm_size_t)lf->size); icache_inv_all(); -#else - cpu_dcache_wb_range((vm_offset_t)lf->address, (vm_size_t)lf->size); - cpu_l2cache_wb_range((vm_offset_t)lf->address, (vm_size_t)lf->size); - cpu_icache_sync_range((vm_offset_t)lf->address, (vm_size_t)lf->size); -#endif #if defined(DDB) || defined(KDTRACE_HOOKS) || defined(STACK) /* Modified: head/sys/arm/arm/exception.S ============================================================================== --- head/sys/arm/arm/exception.S Sun Nov 29 01:43:04 2020 (r368140) +++ head/sys/arm/arm/exception.S Sun Nov 29 08:40:12 2020 (r368141) @@ -77,11 +77,7 @@ _C_LABEL(dtrace_invop_jump_addr): /* * PUSHFRAME - macro to push a trap frame on the stack in the current mode * Since the current mode is used, the SVC lr field is not defined. - * - * NOTE: r13 and r14 are stored separately as a work around for the - * SA110 rev 2 STM^ bug */ -#if __ARM_ARCH < 6 #define PUSHFRAME \ sub sp, sp, #4; /* Align the stack */ \ str lr, [sp, #-4]!; /* Push the return address */ \ @@ -91,41 +87,14 @@ _C_LABEL(dtrace_invop_jump_addr): stmia r0, {r13-r14}^; /* Push the user mode registers */ \ mov r0, r0; /* NOP for previous instruction */ \ mrs r0, spsr; /* Put the SPSR on the stack */ \ - str r0, [sp, #-4]!; \ - ldr r0, =ARM_RAS_START; \ - mov r1, #0; \ - str r1, [r0]; \ - mov r1, #0xffffffff; \ - str r1, [r0, #4]; -#else -#define PUSHFRAME \ - sub sp, sp, #4; /* Align the stack */ \ - str lr, [sp, #-4]!; /* Push the return address */ \ - sub sp, sp, #(4*17); /* Adjust the stack pointer */ \ - stmia sp, {r0-r12}; /* Push the user mode registers */ \ - add r0, sp, #(4*13); /* Adjust the stack pointer */ \ - stmia r0, {r13-r14}^; /* Push the user mode registers */ \ - mov r0, r0; /* NOP for previous instruction */ \ - mrs r0, spsr; /* Put the SPSR on the stack */ \ str r0, [sp, #-4]!; -#endif /* * PULLFRAME - macro to pull a trap frame from the stack in the current mode * Since the current mode is used, the SVC lr field is ignored. */ -#if __ARM_ARCH < 6 #define PULLFRAME \ - ldr r0, [sp], #4; /* Get the SPSR from stack */ \ - msr spsr_fsxc, r0; \ - ldmia sp, {r0-r14}^; /* Restore registers (usr mode) */ \ - mov r0, r0; /* NOP for previous instruction */ \ - add sp, sp, #(4*17); /* Adjust the stack pointer */ \ - ldr lr, [sp], #4; /* Pull the return address */ \ - add sp, sp, #4 /* Align the stack */ -#else -#define PULLFRAME \ ldr r0, [sp], #4 ; /* Get the SPSR from stack */ \ msr spsr_fsxc, r0; \ clrex; \ @@ -134,7 +103,6 @@ _C_LABEL(dtrace_invop_jump_addr): add sp, sp, #(4*17); /* Adjust the stack pointer */ \ ldr lr, [sp], #4; /* Pull the return address */ \ add sp, sp, #4 /* Align the stack */ -#endif /* * PUSHFRAMEINSVC - macro to push a trap frame on the stack in SVC32 mode @@ -142,54 +110,12 @@ _C_LABEL(dtrace_invop_jump_addr): * mode. The processor mode is switched to SVC mode and the trap frame is * stored. The SVC lr field is used to store the previous value of * lr in SVC mode. - * - * NOTE: r13 and r14 are stored separately as a work around for the - * SA110 rev 2 STM^ bug */ -#if __ARM_ARCH < 6 #define PUSHFRAMEINSVC \ stmdb sp, {r0-r3}; /* Save 4 registers */ \ mov r0, lr; /* Save xxx32 r14 */ \ mov r1, sp; /* Save xxx32 sp */ \ mrs r3, spsr; /* Save xxx32 spsr */ \ - mrs r2, cpsr; /* Get the CPSR */ \ - bic r2, r2, #(PSR_MODE); /* Fix for SVC mode */ \ - orr r2, r2, #(PSR_SVC32_MODE); \ - msr cpsr_c, r2; /* Punch into SVC mode */ \ - mov r2, sp; /* Save SVC sp */ \ - bic sp, sp, #7; /* Align sp to an 8-byte addrress */ \ - sub sp, sp, #(4 * 17); /* Pad trapframe to keep alignment */ \ - /* and for dtrace to emulate push/pop */ \ - str r0, [sp, #-4]!; /* Push return address */ \ - str lr, [sp, #-4]!; /* Push SVC lr */ \ - str r2, [sp, #-4]!; /* Push SVC sp */ \ - msr spsr_fsxc, r3; /* Restore correct spsr */ \ - ldmdb r1, {r0-r3}; /* Restore 4 regs from xxx mode */ \ - sub sp, sp, #(4*15); /* Adjust the stack pointer */ \ - stmia sp, {r0-r12}; /* Push the user mode registers */ \ - add r0, sp, #(4*13); /* Adjust the stack pointer */ \ - stmia r0, {r13-r14}^; /* Push the user mode registers */ \ - mov r0, r0; /* NOP for previous instruction */ \ - ldr r5, =ARM_RAS_START; /* Check if there's any RAS */ \ - ldr r4, [r5, #4]; /* reset it to point at the */ \ - cmp r4, #0xffffffff; /* end of memory if necessary; */ \ - movne r1, #0xffffffff; /* leave value in r4 for later */ \ - strne r1, [r5, #4]; /* comparison against PC. */ \ - ldr r3, [r5]; /* Retrieve global RAS_START */ \ - cmp r3, #0; /* and reset it if non-zero. */ \ - movne r1, #0; /* If non-zero RAS_START and */ \ - strne r1, [r5]; /* PC was lower than RAS_END, */ \ - ldrne r1, [r0, #16]; /* adjust the saved PC so that */ \ - cmpne r4, r1; /* execution later resumes at */ \ - strhi r3, [r0, #16]; /* the RAS_START location. */ \ - mrs r0, spsr; \ - str r0, [sp, #-4]! -#else -#define PUSHFRAMEINSVC \ - stmdb sp, {r0-r3}; /* Save 4 registers */ \ - mov r0, lr; /* Save xxx32 r14 */ \ - mov r1, sp; /* Save xxx32 sp */ \ - mrs r3, spsr; /* Save xxx32 spsr */ \ mrs r2, cpsr; /* Get the CPSR */ \ bic r2, r2, #(PSR_MODE); /* Fix for SVC mode */ \ orr r2, r2, #(PSR_SVC32_MODE); \ @@ -210,7 +136,6 @@ _C_LABEL(dtrace_invop_jump_addr): mov r0, r0; /* NOP for previous instruction */ \ mrs r0, spsr; /* Put the SPSR on the stack */ \ str r0, [sp, #-4]! -#endif /* * PULLFRAMEFROMSVCANDEXIT - macro to pull a trap frame from the stack @@ -219,24 +144,14 @@ _C_LABEL(dtrace_invop_jump_addr): * exit. */ -#if __ARM_ARCH < 6 #define PULLFRAMEFROMSVCANDEXIT \ ldr r0, [sp], #4; /* Get the SPSR from stack */ \ msr spsr_fsxc, r0; /* restore SPSR */ \ - ldmia sp, {r0-r14}^; /* Restore registers (usr mode) */ \ - mov r0, r0; /* NOP for previous instruction */ \ - add sp, sp, #(4*15); /* Adjust the stack pointer */ \ - ldmia sp, {sp, lr, pc}^ /* Restore lr and exit */ -#else -#define PULLFRAMEFROMSVCANDEXIT \ - ldr r0, [sp], #4; /* Get the SPSR from stack */ \ - msr spsr_fsxc, r0; /* restore SPSR */ \ clrex; \ ldmia sp, {r0-r14}^; /* Restore registers (usr mode) */ \ mov r0, r0; /* NOP for previous instruction */ \ add sp, sp, #(4*15); /* Adjust the stack pointer */ \ ldmia sp, {sp, lr, pc}^ /* Restore lr and exit */ -#endif /* * Unwind hints so we can unwind past functions that use Modified: head/sys/arm/arm/fiq.c ============================================================================== --- head/sys/arm/arm/fiq.c Sun Nov 29 01:43:04 2020 (r368140) +++ head/sys/arm/arm/fiq.c Sun Nov 29 08:40:12 2020 (r368141) @@ -75,15 +75,7 @@ fiq_installhandler(void *func, size_t size) { const uint32_t fiqvector = 7 * sizeof(uint32_t); -#if __ARM_ARCH < 6 && !defined(__ARM_FIQ_INDIRECT) - vector_page_setprot(VM_PROT_READ|VM_PROT_WRITE); -#endif - memcpy((void *)(vector_page + fiqvector), func, size); - -#if __ARM_ARCH < 6 && !defined(__ARM_FIQ_INDIRECT) - vector_page_setprot(VM_PROT_READ); -#endif icache_sync((vm_offset_t) fiqvector, size); } Modified: head/sys/arm/arm/fusu.S ============================================================================== --- head/sys/arm/arm/fusu.S Sun Nov 29 01:43:04 2020 (r368140) +++ head/sys/arm/arm/fusu.S Sun Nov 29 08:40:12 2020 (r368141) @@ -40,16 +40,9 @@ __FBSDID("$FreeBSD$"); .syntax unified -#if __ARM_ARCH >= 6 #define GET_PCB(tmp) \ mrc p15, 0, tmp, c13, c0, 4; \ add tmp, tmp, #(TD_PCB) -#else -.Lcurpcb: - .word _C_LABEL(__pcpu) + PC_CURPCB -#define GET_PCB(tmp) \ - ldr tmp, .Lcurpcb -#endif /* * casueword32(volatile uint32_t *base, uint32_t oldval, uint32_t *oldvalp, @@ -77,22 +70,14 @@ EENTRY_NP(casueword32) adr r4, .Lcasuwordfault str r4, [r6, #PCB_ONFAULT] -#if __ARM_ARCH >= 6 mov r5, #1 ldrex r4, [r0] cmp r4, r1 strexeq r5, r3, [r0] -#else - ldrt r4, [r0] - cmp r4, r1 - strteq r3, [r0] -#endif str r4, [r2] mov r0, #0 str r0, [r6, #PCB_ONFAULT] -#if __ARM_ARCH >= 6 mov r0, r5 -#endif 1: ldmfd sp!, {r4, r5, r6} RET Modified: head/sys/arm/arm/genassym.c ============================================================================== --- head/sys/arm/arm/genassym.c Sun Nov 29 01:43:04 2020 (r368140) +++ head/sys/arm/arm/genassym.c Sun Nov 29 08:40:12 2020 (r368141) @@ -62,18 +62,9 @@ __FBSDID("$FreeBSD$"); ASSYM(KERNBASE, KERNBASE); ASSYM(KERNVIRTADDR, KERNVIRTADDR); -#if __ARM_ARCH >= 6 ASSYM(CPU_ASID_KERNEL,CPU_ASID_KERNEL); -#endif ASSYM(PCB_ONFAULT, offsetof(struct pcb, pcb_onfault)); -#if __ARM_ARCH < 6 -ASSYM(PCB_DACR, offsetof(struct pcb, pcb_dacr)); -#endif ASSYM(PCB_PAGEDIR, offsetof(struct pcb, pcb_pagedir)); -#if __ARM_ARCH < 6 -ASSYM(PCB_L1VEC, offsetof(struct pcb, pcb_l1vec)); -ASSYM(PCB_PL1VEC, offsetof(struct pcb, pcb_pl1vec)); -#endif ASSYM(PCB_R4, offsetof(struct pcb, pcb_regs.sf_r4)); ASSYM(PCB_R5, offsetof(struct pcb, pcb_regs.sf_r5)); ASSYM(PCB_R6, offsetof(struct pcb, pcb_regs.sf_r6)); @@ -86,9 +77,7 @@ ASSYM(PCB_R12, offsetof(struct pcb, pcb_regs.sf_r12)); ASSYM(PCB_SP, offsetof(struct pcb, pcb_regs.sf_sp)); ASSYM(PCB_LR, offsetof(struct pcb, pcb_regs.sf_lr)); ASSYM(PCB_PC, offsetof(struct pcb, pcb_regs.sf_pc)); -#if __ARM_ARCH >= 6 ASSYM(PCB_TPIDRURW, offsetof(struct pcb, pcb_regs.sf_tpidrurw)); -#endif ASSYM(PC_CURPCB, offsetof(struct pcpu, pc_curpcb)); ASSYM(PC_CURTHREAD, offsetof(struct pcpu, pc_curthread)); @@ -97,24 +86,12 @@ ASSYM(M_DATA, offsetof(struct mbuf, m_data)); ASSYM(M_NEXT, offsetof(struct mbuf, m_next)); ASSYM(IP_SRC, offsetof(struct ip, ip_src)); ASSYM(IP_DST, offsetof(struct ip, ip_dst)); -#if __ARM_ARCH < 6 -ASSYM(CF_CONTEXT_SWITCH, offsetof(struct cpu_functions, cf_context_switch)); -ASSYM(CF_DCACHE_WB_RANGE, offsetof(struct cpu_functions, cf_dcache_wb_range)); -ASSYM(CF_IDCACHE_WBINV_ALL, offsetof(struct cpu_functions, cf_idcache_wbinv_all)); -ASSYM(CF_L2CACHE_WBINV_ALL, offsetof(struct cpu_functions, cf_l2cache_wbinv_all)); -ASSYM(CF_TLB_FLUSHID_SE, offsetof(struct cpu_functions, cf_tlb_flushID_SE)); -#endif ASSYM(TD_PCB, offsetof(struct thread, td_pcb)); ASSYM(TD_FLAGS, offsetof(struct thread, td_flags)); ASSYM(TD_PROC, offsetof(struct thread, td_proc)); ASSYM(TD_MD, offsetof(struct thread, td_md)); ASSYM(TD_LOCK, offsetof(struct thread, td_lock)); -#if __ARM_ARCH < 6 -ASSYM(MD_TP, offsetof(struct mdthread, md_tp)); -ASSYM(MD_RAS_START, offsetof(struct mdthread, md_ras_start)); -ASSYM(MD_RAS_END, offsetof(struct mdthread, md_ras_end)); -#endif ASSYM(TF_SPSR, offsetof(struct trapframe, tf_spsr)); ASSYM(TF_R0, offsetof(struct trapframe, tf_r0)); @@ -125,28 +102,17 @@ ASSYM(P_FLAG, offsetof(struct proc, p_flag)); ASSYM(SIGF_UC, offsetof(struct sigframe, sf_uc)); -#if __ARM_ARCH < 6 -ASSYM(ARM_TP_ADDRESS, ARM_TP_ADDRESS); -ASSYM(ARM_RAS_START, ARM_RAS_START); -ASSYM(ARM_RAS_END, ARM_RAS_END); -#endif - #ifdef VFP ASSYM(PCB_VFPSTATE, offsetof(struct pcb, pcb_vfpstate)); #endif -#if __ARM_ARCH >= 6 ASSYM(PC_CURPMAP, offsetof(struct pcpu, pc_curpmap)); ASSYM(PC_BP_HARDEN_KIND, offsetof(struct pcpu, pc_bp_harden_kind)); ASSYM(PCPU_BP_HARDEN_KIND_NONE, PCPU_BP_HARDEN_KIND_NONE); ASSYM(PCPU_BP_HARDEN_KIND_BPIALL, PCPU_BP_HARDEN_KIND_BPIALL); ASSYM(PCPU_BP_HARDEN_KIND_ICIALLU, PCPU_BP_HARDEN_KIND_ICIALLU); -#endif ASSYM(PAGE_SIZE, PAGE_SIZE); -#if __ARM_ARCH < 6 -ASSYM(PMAP_DOMAIN_KERNEL, PMAP_DOMAIN_KERNEL); -#endif #ifdef PMAP_INCLUDE_PTE_SYNC ASSYM(PMAP_INCLUDE_PTE_SYNC, 1); #endif Modified: head/sys/arm/arm/machdep.c ============================================================================== --- head/sys/arm/arm/machdep.c Sun Nov 29 01:43:04 2020 (r368140) +++ head/sys/arm/arm/machdep.c Sun Nov 29 08:40:12 2020 (r368141) @@ -106,9 +106,6 @@ __FBSDID("$FreeBSD$"); #error FreeBSD/arm doesn't provide compatibility with releases prior to 10 #endif -#if __ARM_ARCH >= 6 && !defined(INTRNG) -#error armv6 requires INTRNG -#endif #ifndef _ARM_ARCH_5E #error FreeBSD requires ARMv5 or later @@ -134,26 +131,10 @@ extern int *end; #ifdef FDT vm_paddr_t pmap_pa; -#if __ARM_ARCH >= 6 vm_offset_t systempage; vm_offset_t irqstack; vm_offset_t undstack; vm_offset_t abtstack; -#else -/* - * This is the number of L2 page tables required for covering max - * (hypothetical) memsize of 4GB and all kernel mappings (vectors, msgbuf, - * stacks etc.), uprounded to be divisible by 4. - */ -#define KERNEL_PT_MAX 78 -static struct pv_addr kernel_pt_table[KERNEL_PT_MAX]; -struct pv_addr systempage; -static struct pv_addr msgbufpv; -struct pv_addr irqstack; -struct pv_addr undstack; -struct pv_addr abtstack; -static struct pv_addr kernelstack; -#endif /* __ARM_ARCH >= 6 */ #endif /* FDT */ #ifdef PLATFORM @@ -197,22 +178,6 @@ arm_vector_init(vm_offset_t va, int which) icache_sync(va, (ARM_NVEC * 2) * sizeof(u_int)); vector_page = va; -#if __ARM_ARCH < 6 - if (va == ARM_VECTORS_HIGH) { - /* - * Enable high vectors in the system control reg (SCTLR). - * - * Assume the MD caller knows what it's doing here, and really - * does want the vector page relocated. - * - * Note: This has to be done here (and not just in - * cpu_setup()) because the vector page needs to be - * accessible *before* cpu_startup() is called. - * Think ddb(9) ... - */ - cpu_control(CPU_CONTROL_VECRELOC, CPU_CONTROL_VECRELOC); - } -#endif } static void @@ -220,9 +185,6 @@ cpu_startup(void *dummy) { struct pcb *pcb = thread0.td_pcb; const unsigned int mbyte = 1024 * 1024; -#if __ARM_ARCH < 6 && !defined(ARM_CACHE_LOCK_ENABLE) - vm_page_t m; -#endif identify_arm_cpu(); @@ -247,19 +209,6 @@ cpu_startup(void *dummy) pcb->pcb_regs.sf_sp = (u_int)thread0.td_kstack + USPACE_SVC_STACK_TOP; pmap_set_pcb_pagedir(kernel_pmap, pcb); -#if __ARM_ARCH < 6 - vector_page_setprot(VM_PROT_READ); - pmap_postinit(); -#ifdef ARM_CACHE_LOCK_ENABLE - pmap_kenter_user(ARM_TP_ADDRESS, ARM_TP_ADDRESS); - arm_lock_cache_line(ARM_TP_ADDRESS); -#else - m = vm_page_alloc(NULL, 0, VM_ALLOC_NOOBJ | VM_ALLOC_ZERO); - pmap_kenter_user(ARM_TP_ADDRESS, VM_PAGE_TO_PHYS(m)); -#endif - *(uint32_t *)ARM_RAS_START = 0; - *(uint32_t *)ARM_RAS_END = 0xffffffff; -#endif } SYSINIT(cpu, SI_SUB_CPU, SI_ORDER_FIRST, cpu_startup, NULL); @@ -279,7 +228,6 @@ cpu_flush_dcache(void *ptr, size_t len) int cpu_est_clockrate(int cpu_id, uint64_t *rate) { -#if __ARM_ARCH >= 6 struct pcpu *pc; pc = pcpu_find(cpu_id); @@ -292,9 +240,6 @@ cpu_est_clockrate(int cpu_id, uint64_t *rate) *rate = pc->pc_clock; return (0); -#else - return (ENXIO); -#endif } void @@ -737,9 +682,7 @@ makectx(struct trapframe *tf, struct pcb *pcb) void pcpu0_init(void) { -#if __ARM_ARCH >= 6 set_curthread(&thread0); -#endif pcpu_init(pcpup, 0, sizeof(struct pcpu)); PCPU_SET(curthread, &thread0); } @@ -762,7 +705,6 @@ init_proc0(vm_offset_t kstack) pcpup->pc_curpcb = thread0.td_pcb; } -#if __ARM_ARCH >= 6 void set_stackptrs(int cpu) { @@ -774,20 +716,7 @@ set_stackptrs(int cpu) set_stackptr(PSR_UND32_MODE, undstack + ((UND_STACK_SIZE * PAGE_SIZE) * (cpu + 1))); } -#else -void -set_stackptrs(int cpu) -{ - set_stackptr(PSR_IRQ32_MODE, - irqstack.pv_va + ((IRQ_STACK_SIZE * PAGE_SIZE) * (cpu + 1))); - set_stackptr(PSR_ABT32_MODE, - abtstack.pv_va + ((ABT_STACK_SIZE * PAGE_SIZE) * (cpu + 1))); - set_stackptr(PSR_UND32_MODE, - undstack.pv_va + ((UND_STACK_SIZE * PAGE_SIZE) * (cpu + 1))); -} -#endif - static void arm_kdb_init(void) { @@ -800,290 +729,10 @@ arm_kdb_init(void) } #ifdef FDT -#if __ARM_ARCH < 6 void * initarm(struct arm_boot_params *abp) { struct mem_region mem_regions[FDT_MEM_REGIONS]; - struct pv_addr kernel_l1pt; - struct pv_addr dpcpu; - vm_offset_t dtbp, freemempos, l2_start, lastaddr; - uint64_t memsize; - uint32_t l2size; - char *env; - void *kmdp; - u_int l1pagetable; - int i, j, err_devmap, mem_regions_sz; - - lastaddr = parse_boot_param(abp); - arm_physmem_kernaddr = abp->abp_physaddr; - - memsize = 0; - - cpuinfo_init(); - set_cpufuncs(); - - /* - * Find the dtb passed in by the boot loader. - */ - kmdp = preload_search_by_type("elf kernel"); - if (kmdp != NULL) - dtbp = MD_FETCH(kmdp, MODINFOMD_DTBP, vm_offset_t); - else - dtbp = (vm_offset_t)NULL; - -#if defined(FDT_DTB_STATIC) - /* - * In case the device tree blob was not retrieved (from metadata) try - * to use the statically embedded one. - */ - if (dtbp == (vm_offset_t)NULL) - dtbp = (vm_offset_t)&fdt_static_dtb; -#endif - - if (OF_install(OFW_FDT, 0) == FALSE) - panic("Cannot install FDT"); - - if (OF_init((void *)dtbp) != 0) - panic("OF_init failed with the found device tree"); - - /* Grab physical memory regions information from device tree. */ - if (fdt_get_mem_regions(mem_regions, &mem_regions_sz, &memsize) != 0) - panic("Cannot get physical memory regions"); - physmem_hardware_regions(mem_regions, mem_regions_sz); - - /* Grab reserved memory regions information from device tree. */ - if (fdt_get_reserved_regions(mem_regions, &mem_regions_sz) == 0) - physmem_exclude_regions(mem_regions, mem_regions_sz, - EXFLAG_NODUMP | EXFLAG_NOALLOC); - - /* Platform-specific initialisation */ - platform_probe_and_attach(); - - pcpu0_init(); - - /* Do basic tuning, hz etc */ - init_param1(); - - /* Calculate number of L2 tables needed for mapping vm_page_array */ - l2size = (memsize / PAGE_SIZE) * sizeof(struct vm_page); - l2size = (l2size >> L1_S_SHIFT) + 1; - - /* - * Add one table for end of kernel map, one for stacks, msgbuf and - * L1 and L2 tables map, one for vectors map and two for - * l2 structures from pmap_bootstrap. - */ - l2size += 5; - - /* Make it divisible by 4 */ - l2size = (l2size + 3) & ~3; - - freemempos = (lastaddr + PAGE_MASK) & ~PAGE_MASK; - - /* Define a macro to simplify memory allocation */ -#define valloc_pages(var, np) \ - alloc_pages((var).pv_va, (np)); \ - (var).pv_pa = (var).pv_va + (abp->abp_physaddr - KERNVIRTADDR); - -#define alloc_pages(var, np) \ - (var) = freemempos; \ - freemempos += (np * PAGE_SIZE); \ - memset((char *)(var), 0, ((np) * PAGE_SIZE)); - - while (((freemempos - L1_TABLE_SIZE) & (L1_TABLE_SIZE - 1)) != 0) - freemempos += PAGE_SIZE; - valloc_pages(kernel_l1pt, L1_TABLE_SIZE / PAGE_SIZE); - - for (i = 0, j = 0; i < l2size; ++i) { - if (!(i % (PAGE_SIZE / L2_TABLE_SIZE_REAL))) { - valloc_pages(kernel_pt_table[i], - L2_TABLE_SIZE / PAGE_SIZE); - j = i; - } else { - kernel_pt_table[i].pv_va = kernel_pt_table[j].pv_va + - L2_TABLE_SIZE_REAL * (i - j); - kernel_pt_table[i].pv_pa = - kernel_pt_table[i].pv_va - KERNVIRTADDR + - abp->abp_physaddr; - } - } - /* - * Allocate a page for the system page mapped to 0x00000000 - * or 0xffff0000. This page will just contain the system vectors - * and can be shared by all processes. - */ - valloc_pages(systempage, 1); - - /* Allocate dynamic per-cpu area. */ - valloc_pages(dpcpu, DPCPU_SIZE / PAGE_SIZE); - dpcpu_init((void *)dpcpu.pv_va, 0); - - /* Allocate stacks for all modes */ - valloc_pages(irqstack, IRQ_STACK_SIZE * MAXCPU); - valloc_pages(abtstack, ABT_STACK_SIZE * MAXCPU); - valloc_pages(undstack, UND_STACK_SIZE * MAXCPU); - valloc_pages(kernelstack, kstack_pages); - valloc_pages(msgbufpv, round_page(msgbufsize) / PAGE_SIZE); - - /* - * Now we start construction of the L1 page table - * We start by mapping the L2 page tables into the L1. - * This means that we can replace L1 mappings later on if necessary - */ - l1pagetable = kernel_l1pt.pv_va; - - /* - * Try to map as much as possible of kernel text and data using - * 1MB section mapping and for the rest of initial kernel address - * space use L2 coarse tables. - * - * Link L2 tables for mapping remainder of kernel (modulo 1MB) - * and kernel structures - */ - l2_start = lastaddr & ~(L1_S_OFFSET); - for (i = 0 ; i < l2size - 1; i++) - pmap_link_l2pt(l1pagetable, l2_start + i * L1_S_SIZE, - &kernel_pt_table[i]); - - pmap_curmaxkvaddr = l2_start + (l2size - 1) * L1_S_SIZE; - - /* Map kernel code and data */ - pmap_map_chunk(l1pagetable, KERNVIRTADDR, abp->abp_physaddr, - (((uint32_t)(lastaddr) - KERNVIRTADDR) + PAGE_MASK) & ~PAGE_MASK, - VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE); - - /* Map L1 directory and allocated L2 page tables */ - pmap_map_chunk(l1pagetable, kernel_l1pt.pv_va, kernel_l1pt.pv_pa, - L1_TABLE_SIZE, VM_PROT_READ|VM_PROT_WRITE, PTE_PAGETABLE); - - pmap_map_chunk(l1pagetable, kernel_pt_table[0].pv_va, - kernel_pt_table[0].pv_pa, - L2_TABLE_SIZE_REAL * l2size, - VM_PROT_READ|VM_PROT_WRITE, PTE_PAGETABLE); - - /* Map allocated DPCPU, stacks and msgbuf */ - pmap_map_chunk(l1pagetable, dpcpu.pv_va, dpcpu.pv_pa, - freemempos - dpcpu.pv_va, - VM_PROT_READ|VM_PROT_WRITE, PTE_CACHE); - - /* Link and map the vector page */ - pmap_link_l2pt(l1pagetable, ARM_VECTORS_HIGH, - &kernel_pt_table[l2size - 1]); - pmap_map_entry(l1pagetable, ARM_VECTORS_HIGH, systempage.pv_pa, - VM_PROT_READ|VM_PROT_WRITE|VM_PROT_EXECUTE, PTE_CACHE); - - /* Establish static device mappings. */ - err_devmap = platform_devmap_init(); - devmap_bootstrap(l1pagetable, NULL); - vm_max_kernel_address = platform_lastaddr(); - - cpu_domains((DOMAIN_CLIENT << (PMAP_DOMAIN_KERNEL * 2)) | DOMAIN_CLIENT); - pmap_pa = kernel_l1pt.pv_pa; - cpu_setttb(kernel_l1pt.pv_pa); - cpu_tlb_flushID(); - cpu_domains(DOMAIN_CLIENT << (PMAP_DOMAIN_KERNEL * 2)); - - /* - * Now that proper page tables are installed, call cpu_setup() to enable - * instruction and data caches and other chip-specific features. - */ - cpu_setup(); - - /* - * Only after the SOC registers block is mapped we can perform device - * tree fixups, as they may attempt to read parameters from hardware. - */ - OF_interpret("perform-fixup", 0); - - platform_gpio_init(); - - cninit(); - - debugf("initarm: console initialized\n"); - debugf(" arg1 kmdp = 0x%08x\n", (uint32_t)kmdp); - debugf(" boothowto = 0x%08x\n", boothowto); - debugf(" dtbp = 0x%08x\n", (uint32_t)dtbp); - arm_print_kenv(); - - /* - * Dump the boot metadata. We have to wait for cninit() since console - * output is required. If it's grossly incorrect the kernel will never - * make it this far. - */ - if (getenv_is_true("debug.dump_modinfo_at_boot")) - preload_dump(); - - env = kern_getenv("kernelname"); - if (env != NULL) { - strlcpy(kernelname, env, sizeof(kernelname)); - freeenv(env); - } - - if (err_devmap != 0) - printf("WARNING: could not fully configure devmap, error=%d\n", - err_devmap); - - platform_late_init(); - - /* - * Pages were allocated during the secondary bootstrap for the - * stacks for different CPU modes. - * We must now set the r13 registers in the different CPU modes to - * point to these stacks. - * Since the ARM stacks use STMFD etc. we must set r13 to the top end - * of the stack memory. - */ - cpu_control(CPU_CONTROL_MMU_ENABLE, CPU_CONTROL_MMU_ENABLE); - - set_stackptrs(0); - - /* - * We must now clean the cache again.... - * Cleaning may be done by reading new data to displace any - * dirty data in the cache. This will have happened in cpu_setttb() - * but since we are boot strapping the addresses used for the read - * may have just been remapped and thus the cache could be out - * of sync. A re-clean after the switch will cure this. - * After booting there are no gross relocations of the kernel thus - * this problem will not occur after initarm(). - */ - cpu_idcache_wbinv_all(); - - undefined_init(); - - init_proc0(kernelstack.pv_va); - - arm_vector_init(ARM_VECTORS_HIGH, ARM_VEC_ALL); - pmap_bootstrap(freemempos, &kernel_l1pt); - msgbufp = (void *)msgbufpv.pv_va; - msgbufinit(msgbufp, msgbufsize); - mutex_init(); - - /* - * Exclude the kernel (and all the things we allocated which immediately - * follow the kernel) from the VM allocation pool but not from crash - * dumps. virtual_avail is a global variable which tracks the kva we've - * "allocated" while setting up pmaps. - * *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Sun Nov 29 08:59:57 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 426CA47B07D; Sun, 29 Nov 2020 08:59:57 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (br1.CN84in.dnsmgr.net [69.59.192.140]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4CkMkh5yyHz3ssP; Sun, 29 Nov 2020 08:59:56 +0000 (UTC) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: from gndrsh.dnsmgr.net (localhost [127.0.0.1]) by gndrsh.dnsmgr.net (8.13.3/8.13.3) with ESMTP id 0AT8xsBi040040; Sun, 29 Nov 2020 00:59:54 -0800 (PST) (envelope-from freebsd@gndrsh.dnsmgr.net) Received: (from freebsd@localhost) by gndrsh.dnsmgr.net (8.13.3/8.13.3/Submit) id 0AT8xsHM040039; Sun, 29 Nov 2020 00:59:54 -0800 (PST) (envelope-from freebsd) From: "Rodney W. Grimes" Message-Id: <202011290859.0AT8xsHM040039@gndrsh.dnsmgr.net> Subject: Re: svn commit: r368130 - in head: share/man/man4 sys/dev/ftwd sys/modules sys/modules/ftwd In-Reply-To: <202011282234.0ASMYYo8094034@repo.freebsd.org> To: Poul-Henning Kamp Date: Sun, 29 Nov 2020 00:59:54 -0800 (PST) CC: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Reply-To: rgrimes@freebsd.org X-Mailer: ELM [version 2.4ME+ PL121h (25)] MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset=US-ASCII X-Rspamd-Queue-Id: 4CkMkh5yyHz3ssP X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Nov 2020 08:59:57 -0000 > Author: phk > Date: Sat Nov 28 22:34:33 2020 > New Revision: 368130 > URL: https://svnweb.freebsd.org/changeset/base/368130 > > Log: > Add watchdog(9) driver for the Fintek F81803 SuperIO chip > > Added: > head/share/man/man4/ftwd.4 (contents, props changed) > head/sys/dev/ftwd/ > head/sys/dev/ftwd/ftwd.c (contents, props changed) > head/sys/modules/ftwd/ > head/sys/modules/ftwd/Makefile (contents, props changed) > Modified: > head/share/man/man4/Makefile > head/sys/modules/Makefile > > Modified: head/share/man/man4/Makefile > ============================================================================== > --- head/share/man/man4/Makefile Sat Nov 28 18:09:16 2020 (r368129) > +++ head/share/man/man4/Makefile Sat Nov 28 22:34:33 2020 (r368130) > @@ -158,6 +158,7 @@ MAN= aac.4 \ > ffclock.4 \ > filemon.4 \ > firewire.4 \ > + ${_ftwd.4} \ > full.4 \ > fwe.4 \ > fwip.4 \ > @@ -785,6 +786,7 @@ _chvgpio.4= chvgpio.4 > _coretemp.4= coretemp.4 > _cpuctl.4= cpuctl.4 > _dpms.4= dpms.4 > +_ftwd.4= ftwd.4 > _hpt27xx.4= hpt27xx.4 > _hptiop.4= hptiop.4 > _hptmv.4= hptmv.4 > > Added: head/share/man/man4/ftwd.4 > ============================================================================== > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/share/man/man4/ftwd.4 Sat Nov 28 22:34:33 2020 (r368130) > @@ -0,0 +1,66 @@ > +.\" > +.\" SPDX-License-Identifier: BSD-2-Clause-FreeBSD > +.\" > +.\" Copyright (c) 2012 Bjoern A. Zeeb > +.\" Copyright (c) 2019 Andriy Gapon This appears to be a new file, perhaps cloned from some place else? And later you assert that you wrote this manual page, so shouldn't you also be the copyright holder? > +.\" > +.\" Redistribution and use in source and binary forms, with or without > +.\" modification, are permitted provided that the following conditions > +.\" are met: > +.\" 1. Redistributions of source code must retain the above copyright > +.\" notice, this list of conditions and the following disclaimer. > +.\" 2. Redistributions in binary form must reproduce the above copyright > +.\" notice, this list of conditions and the following disclaimer in the > +.\" documentation and/or other materials provided with the distribution. > +.\" > +.\" THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND > +.\" ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE > +.\" IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE > +.\" ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE > +.\" FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL > +.\" DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS > +.\" OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) > +.\" HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT > +.\" LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY > +.\" OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF > +.\" SUCH DAMAGE. > +.\" > +.\" $FreeBSD$ > +.\" > +.Dd November 26, 2020 > +.Dt FTWD 4 > +.Os > +.Sh NAME > +.Nm ftwd > +.Nd Fintek F81803 watchdog timer > +.Sh SYNOPSIS > +To compile this driver into the kernel, place the following lines in your > +kernel configuration file: > +.Bd -ragged -offset indent > +.Cd "device superio" > +.Cd "device ftwd" > +.Ed > +.Pp > +Alternatively, to load the driver as a module at boot time, place the following > +line in > +.Xr loader.conf 5 : > +.Bd -literal -offset indent > +ftwd_load="YES" > +.Ed > +.Sh DESCRIPTION > +The > +.Nm > +driver provides > +.Xr watchdog 4 > +support for the watchdog timer in the Fintek F81803 chip. > +.Sh SEE ALSO > +.Xr superio 4 , > +.Xr watchdog 4 , > +.Xr device.hints 5 , > +.Xr watchdog 8 , > +.Xr watchdogd 8 , > +.Xr watchdog 9 > +.Sh AUTHORS > +.An -nosplit > +This manual page was written by > +.An Poul-Henning Kamp Aq Mt phk@FreeBSD.org . Here you claim you wrote it... > > Added: head/sys/dev/ftwd/ftwd.c > ============================================================================== > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/sys/dev/ftwd/ftwd.c Sat Nov 28 22:34:33 2020 (r368130) > @@ -0,0 +1,157 @@ > +/*- > + * SPDX-License-Identifier: BSD-2-Clause > + * > + * Copyright (c) 2020 Poul-Henning Kamp > + * > + * Redistribution and use in source and binary forms, with or without > + * modification, are permitted provided that the following conditions > + * are met: > + * 1. Redistributions of source code must retain the above copyright > + * notice, this list of conditions and the following disclaimer. > + * 2. Redistributions in binary form must reproduce the above copyright > + * notice, this list of conditions and the following disclaimer in the > + * documentation and/or other materials provided with the distribution. > + * > + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND > + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE > + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE > + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE > + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL > + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS > + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) > + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT > + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY > + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF > + * SUCH DAMAGE. > + */ > + > +#include > +__FBSDID("$FreeBSD$"); > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > +#include > + > +#include > +#include > + > +struct ftwd_softc { > + eventhandler_tag wd_ev; > +}; > + > +static void > +ftwd_func(void *priv, u_int cmd, int *error) > +{ > + device_t dev = priv; > + uint64_t timeout; > + uint8_t val = 0; > + uint8_t minutes = 0; > + > + if (cmd != 0) { > + cmd &= WD_INTERVAL; > + > + /* Convert the requested timeout to seconds. */ > + if (cmd >= WD_TO_1SEC) > + timeout = (uint64_t)1 << (cmd - WD_TO_1SEC); > + else > + timeout = 1; > + > + if (timeout <= UINT8_MAX) { > + val = timeout; > + *error = 0; > + } else if ((timeout / 60) <= UINT8_MAX) { > + val = timeout / 60; > + minutes = 1; > + *error = 0; > + } > + } > + if (bootverbose) { > + if (val == 0) { > + device_printf(dev, "disabling watchdog\n"); > + } else { > + device_printf(dev, > + "arm watchdog to %d %s%s (Was: 0x%02x)\n", > + val, minutes ? "minute" : "second", > + val == 1 ? "" : "s", > + superio_read(dev, 0xf6) > + ); > + } > + } > + superio_write(dev, 0xf0, 0x00); // Disable WDTRST# > + superio_write(dev, 0xf6, val); // Set Counter > + > + if (minutes) > + superio_write(dev, 0xf5, 0x7d); // minutes, act high, 125ms > + else > + superio_write(dev, 0xf5, 0x75); // seconds, act high, 125ms > + > + if (val) > + superio_write(dev, 0xf7, 0x01); // Disable PME > + if (val) > + superio_write(dev, 0xf0, 0x81); // Enable WDTRST# > + else > + superio_write(dev, 0xf0, 0x00); // Disable WDTRST > +} > + > +static int > +ftwd_probe(device_t dev) > +{ > + > + if (superio_vendor(dev) != SUPERIO_VENDOR_FINTEK || > + superio_get_type(dev) != SUPERIO_DEV_WDT) > + return (ENXIO); > + device_set_desc(dev, "Watchdog Timer on Fintek SuperIO"); > + return (BUS_PROBE_DEFAULT); > +} > + > +static int > +ftwd_attach(device_t dev) > +{ > + struct ftwd_softc *sc = device_get_softc(dev); > + > + /* > + * We do not touch the watchdog at this time, it might be armed > + * by firmware to protect the full boot sequence. > + */ > + > + sc->wd_ev = EVENTHANDLER_REGISTER(watchdog_list, ftwd_func, dev, 0); > + return (0); > +} > + > +static int > +ftwd_detach(device_t dev) > +{ > + struct ftwd_softc *sc = device_get_softc(dev); > + int dummy; > + > + if (sc->wd_ev != NULL) > + EVENTHANDLER_DEREGISTER(watchdog_list, sc->wd_ev); > + ftwd_func(dev, 0, &dummy); > + return (0); > +} > + > +static device_method_t ftwd_methods[] = { > + DEVMETHOD(device_probe, ftwd_probe), > + DEVMETHOD(device_attach, ftwd_attach), > + DEVMETHOD(device_detach, ftwd_detach), > + { 0, 0 } > +}; > + > +static driver_t ftwd_driver = { > + "ftwd", > + ftwd_methods, > + sizeof (struct ftwd_softc) > +}; > + > +static devclass_t ftwd_devclass; > + > +DRIVER_MODULE(ftwd, superio, ftwd_driver, ftwd_devclass, NULL, NULL); > +MODULE_DEPEND(ftwd, superio, 1, 1, 1); > +MODULE_VERSION(ftwd, 1); > > Modified: head/sys/modules/Makefile > ============================================================================== > --- head/sys/modules/Makefile Sat Nov 28 18:09:16 2020 (r368129) > +++ head/sys/modules/Makefile Sat Nov 28 22:34:33 2020 (r368130) > @@ -121,6 +121,7 @@ SUBDIR= \ > filemon \ > firewire \ > firmware \ > + ${_ftwd} \ > fusefs \ > ${_fxp} \ > gem \ > @@ -618,6 +619,7 @@ _cpufreq= cpufreq > _dpms= dpms > _em= em > _et= et > +_ftwd= ftwd > _exca= exca > _if_ndis= if_ndis > _io= io > > Added: head/sys/modules/ftwd/Makefile > ============================================================================== > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/sys/modules/ftwd/Makefile Sat Nov 28 22:34:33 2020 (r368130) > @@ -0,0 +1,9 @@ > +# $FreeBSD$ > + > +.PATH: ${SRCTOP}/sys/dev/ftwd > + > +KMOD= ftwd > +SRCS= ftwd.c > +SRCS+= device_if.h bus_if.h isa_if.h > + > +.include > -- Rod Grimes rgrimes@freebsd.org From owner-svn-src-head@freebsd.org Sun Nov 29 10:30:56 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D17F147D3BD; Sun, 29 Nov 2020 10:30:56 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CkPlh5SGwz4S7c; Sun, 29 Nov 2020 10:30:56 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AE500787F; Sun, 29 Nov 2020 10:30:56 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0ATAUuGU035934; Sun, 29 Nov 2020 10:30:56 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0ATAUurV035933; Sun, 29 Nov 2020 10:30:56 GMT (envelope-from kib@FreeBSD.org) Message-Id: <202011291030.0ATAUurV035933@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 29 Nov 2020 10:30:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368142 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 368142 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Nov 2020 10:30:56 -0000 Author: kib Date: Sun Nov 29 10:30:56 2020 New Revision: 368142 URL: https://svnweb.freebsd.org/changeset/base/368142 Log: bio aio: Destroy ephemeral mapping before unwiring page. Apparently some architectures, like ppc in its hashed page tables variants, account mappings by pmap_qenter() in the response from pmap_is_page_mapped(). While there, eliminate useless userp variable. Noted and reviewed by: alc (previous version) Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D27409 Modified: head/sys/kern/vfs_aio.c Modified: head/sys/kern/vfs_aio.c ============================================================================== --- head/sys/kern/vfs_aio.c Sun Nov 29 08:40:12 2020 (r368141) +++ head/sys/kern/vfs_aio.c Sun Nov 29 10:30:56 2020 (r368142) @@ -2339,24 +2339,23 @@ static void aio_biowakeup(struct bio *bp) { struct kaiocb *job = (struct kaiocb *)bp->bio_caller1; - struct proc *userp; struct kaioinfo *ki; size_t nbytes; int error, nblks; /* Release mapping into kernel space. */ - userp = job->userproc; - ki = userp->p_aioinfo; - vm_page_unhold_pages(job->pages, job->npages); if (job->pbuf != NULL) { pmap_qremove((vm_offset_t)job->pbuf->b_data, job->npages); + vm_page_unhold_pages(job->pages, job->npages); uma_zfree(pbuf_zone, job->pbuf); job->pbuf = NULL; atomic_subtract_int(&num_buf_aio, 1); + ki = job->userproc->p_aioinfo; AIO_LOCK(ki); ki->kaio_buffer_count--; AIO_UNLOCK(ki); } else { + vm_page_unhold_pages(job->pages, job->npages); free(job->pages, M_TEMP); atomic_subtract_int(&num_unmapped_aio, 1); } From owner-svn-src-head@freebsd.org Sun Nov 29 10:32:39 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6101547D4FA; Sun, 29 Nov 2020 10:32:39 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CkPng2JTkz4SJc; Sun, 29 Nov 2020 10:32:39 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 420B57B3B; Sun, 29 Nov 2020 10:32:39 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0ATAWdMu041659; Sun, 29 Nov 2020 10:32:39 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0ATAWdqx041658; Sun, 29 Nov 2020 10:32:39 GMT (envelope-from kib@FreeBSD.org) Message-Id: <202011291032.0ATAWdqx041658@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 29 Nov 2020 10:32:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368143 - head/sys/amd64/vmm X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/amd64/vmm X-SVN-Commit-Revision: 368143 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Nov 2020 10:32:39 -0000 Author: kib Date: Sun Nov 29 10:32:38 2020 New Revision: 368143 URL: https://svnweb.freebsd.org/changeset/base/368143 Log: bhyve: limit max GPA to VM_MAXUSER_ADDRESS_LA48. We use 4-level EPT pages, correct the upper bound. Reviewed by: grehan Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D27402 Modified: head/sys/amd64/vmm/vmm.c Modified: head/sys/amd64/vmm/vmm.c ============================================================================== --- head/sys/amd64/vmm/vmm.c Sun Nov 29 10:30:56 2020 (r368142) +++ head/sys/amd64/vmm/vmm.c Sun Nov 29 10:32:38 2020 (r368143) @@ -49,12 +49,12 @@ __FBSDID("$FreeBSD$"); #include #include +#include +#include #include #include #include #include -#include -#include #include #include #include @@ -483,7 +483,7 @@ vm_create(const char *name, struct vm **retvm) if (name == NULL || strlen(name) >= VM_MAX_NAMELEN) return (EINVAL); - vmspace = vmmops_vmspace_alloc(0, VM_MAXUSER_ADDRESS); + vmspace = vmmops_vmspace_alloc(0, VM_MAXUSER_ADDRESS_LA48); if (vmspace == NULL) return (ENOMEM); From owner-svn-src-head@freebsd.org Sun Nov 29 12:22:53 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F264047FB6C; Sun, 29 Nov 2020 12:22:53 +0000 (UTC) (envelope-from phk@critter.freebsd.dk) Received: from phk.freebsd.dk (phk.freebsd.dk [130.225.244.222]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4CkSDs4Y3Jz4YVF; Sun, 29 Nov 2020 12:22:53 +0000 (UTC) (envelope-from phk@critter.freebsd.dk) Received: from critter.freebsd.dk (v-critter.freebsd.dk [192.168.55.3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by phk.freebsd.dk (Postfix) with ESMTPS id 7A5668C23A; Sun, 29 Nov 2020 12:22:50 +0000 (UTC) Received: from critter.freebsd.dk (localhost [127.0.0.1]) by critter.freebsd.dk (8.16.1/8.16.1) with ESMTPS id 0ATCMoaV057727 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Sun, 29 Nov 2020 12:22:50 GMT (envelope-from phk@critter.freebsd.dk) Received: (from phk@localhost) by critter.freebsd.dk (8.16.1/8.16.1/Submit) id 0ATCMnHV057726; Sun, 29 Nov 2020 12:22:49 GMT (envelope-from phk) To: rgrimes@freebsd.org, "Rodney W. Grimes" cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r368130 - in head: share/man/man4 sys/dev/ftwd sys/modules sys/modules/ftwd In-reply-to: <202011290859.0AT8xsHM040039@gndrsh.dnsmgr.net> From: "Poul-Henning Kamp" References: <202011290859.0AT8xsHM040039@gndrsh.dnsmgr.net> MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-ID: <57724.1606652569.1@critter.freebsd.dk> Content-Transfer-Encoding: quoted-printable Date: Sun, 29 Nov 2020 12:22:49 +0000 Message-ID: <57725.1606652569@critter.freebsd.dk> X-Rspamd-Queue-Id: 4CkSDs4Y3Jz4YVF X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Nov 2020 12:22:54 -0000 -------- Rodney W. Grimes writes: > > Added: head/share/man/man4/ftwd.4 > > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D > > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > > +++ head/share/man/man4/ftwd.4 Sat Nov 28 22:34:33 2020 (r368130) > > @@ -0,0 +1,66 @@ > > +.\" > > +.\" SPDX-License-Identifier: BSD-2-Clause-FreeBSD > > +.\" > > +.\" Copyright (c) 2012 Bjoern A. Zeeb > > +.\" Copyright (c) 2019 Andriy Gapon > > This appears to be a new file, perhaps cloned from some place else? > And later you assert that you wrote this manual page, > so shouldn't you also be the copyright holder? I started out with the itwb.4 page, and replaced a few lines of text, but all the markup, the order of things etc. etc, is from itwb.4. So ftwd.4 is indisputably a "derivative work" and therefore i left the copyrights from the original in. My own contribution hardly rises to the level of a protectable work, "mere recitation of facts" do not rise to the "original work" threshold, so I did not add myself to the copyright. > > +This manual page was written by > > +.An Poul-Henning Kamp Aq Mt phk@FreeBSD.org . > > Here you claim you wrote it... ... so that people reading the manual page know who to bother. -- = Poul-Henning Kamp | UNIX since Zilog Zeus 3.20 phk@FreeBSD.ORG | TCP/IP since RFC 956 FreeBSD committer | BSD since 4.3-tahoe = Never attribute to malice what can adequately be explained by incompetence= . From owner-svn-src-head@freebsd.org Sun Nov 29 13:04:04 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0F0CC4A1E11; Sun, 29 Nov 2020 13:04:04 +0000 (UTC) (envelope-from melounmichal@gmail.com) Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CkT8M1BHkz4Zpj; Sun, 29 Nov 2020 13:04:02 +0000 (UTC) (envelope-from melounmichal@gmail.com) Received: by mail-wr1-x435.google.com with SMTP id z7so11476217wrn.3; Sun, 29 Nov 2020 05:04:02 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:reply-to:subject:to:references:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=azVlTOGtAOcsKi2bhaXMW/PpL/EHb1gUAQVePREtqoc=; b=H7ksPMgnnnsZnsFXsZM2oO3JXd39wxxa+zB0euLsquR7wGSiC2UGF6ojfteSwSV5ag aHWPPD17VE3qjtK4ksEcue3xl5buuCdUo14chd/fQt+K1MtAXeQLZU62xYRJCHVar/NH s4WsrJMz/eSk2HX31RVHBhdE2KXgs0/T0lPuR53VIoyuETYmt7hJeU3SIXYhmTojm/az lE6Yz0bul7GuXu13tl4DRe8kgvZ64ScIorRCBgfjO4NbHnPrzV25/aA3UPuS14IUytri 0WWWAea3SbWik8dnKPeuKlw9bEGvaVu0BJahWDOg2EHs5dGcDdykzDS8eoDhI0rhelrB v6bw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:reply-to:subject:to:references :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=azVlTOGtAOcsKi2bhaXMW/PpL/EHb1gUAQVePREtqoc=; b=cyoCmlFZGHVzG1gy1ZHw9QC1MUyBKH2Io0HZArLYEip+w4P0ULN68+mKT603Q375nC lRQzhiYxBn8WImZDAkWK4O/kDzy9D6c1y1KdE23Hf4b5GemFgFOLvdfOep/epB6Iw5yJ bjazX8U3bQw8jXZl8e24Ur8vuX60iAYYYr1VvDOt2WjJYUbzc3Y2QSnBWRHCMYTmyIxx uVWvQ9lvRg+ZzLRppCXqRCgS+RQcMjZxYjlBzqNW6uMPOS0ABi5A7XwNFMjfUvkQz7pN DsGoyIT55Xvr2Vt5nZTEt+ZDuNw9drFTMpIh93kvn9RVYjSyn6w808G1UH/Wi4Bs6N6g ckHw== X-Gm-Message-State: AOAM532h9UMF0Tu016oLM0R64U/nu1DBU/sKc3oRFpdr4lB3RdA92x4+ y/iOmU9bNR6GW+qJuslYn6GTPyqwKIc= X-Google-Smtp-Source: ABdhPJyuwniHfbckjjkFre6aLassw94B5l4yCkEmguUeHeHFmwXa+HSn3EQpnkoe3cSO3aw1jud/jw== X-Received: by 2002:a5d:4f92:: with SMTP id d18mr22722720wru.118.1606655039339; Sun, 29 Nov 2020 05:03:59 -0800 (PST) Received: from [88.208.79.100] (halouny.humusoft.cz. [88.208.79.100]) by smtp.gmail.com with ESMTPSA id z6sm20852492wmi.1.2020.11.29.05.03.58 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 29 Nov 2020 05:03:58 -0800 (PST) Sender: Michal Meloun From: Michal Meloun X-Google-Original-From: Michal Meloun Reply-To: mmel@freebsd.org Subject: Re: svn commit: r368124 - in head/sys: cam cam/ata cam/ctl cam/mmc cam/nvme cam/scsi compat/linprocfs compat/linux conf contrib/openzfs/module/os/freebsd/zfs dev/ahci dev/ata dev/firewire dev/flash dev... To: Konstantin Belousov , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <202011281212.0ASCCpjQ006999@repo.freebsd.org> Message-ID: <56ede111-cf89-366e-fbda-aa26f4a78a23@freebsd.org> Date: Sun, 29 Nov 2020 14:03:57 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.5.0 MIME-Version: 1.0 In-Reply-To: <202011281212.0ASCCpjQ006999@repo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4CkT8M1BHkz4Zpj X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=H7ksPMgn; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of melounmichal@gmail.com designates 2a00:1450:4864:20::435 as permitted sender) smtp.mailfrom=melounmichal@gmail.com X-Spamd-Result: default: False [-2.75 / 15.00]; HAS_REPLYTO(0.00)[mmel@freebsd.org]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip6:2a00:1450:4000::/36:c]; FREEMAIL_FROM(0.00)[gmail.com]; RCVD_COUNT_THREE(0.00)[3]; DKIM_TRACE(0.00)[gmail.com:+]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; NEURAL_HAM_SHORT(-0.75)[-0.754]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US]; TAGGED_FROM(0.00)[]; RBL_DBL_DONT_QUERY_IPS(0.00)[2a00:1450:4864:20::435:from]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; REPLYTO_DOM_NEQ_FROM_DOM(0.00)[]; SPAMHAUS_ZRD(0.00)[2a00:1450:4864:20::435:from:127.0.2.255]; MID_RHS_MATCH_TO(1.00)[]; RCVD_IN_DNSWL_NONE(0.00)[2a00:1450:4864:20::435:from]; RCVD_TLS_ALL(0.00)[]; MAILMAN_DEST(0.00)[svn-src-head,svn-src-all] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Nov 2020 13:04:04 -0000 On 28.11.2020 13:12, Konstantin Belousov wrote: > Author: kib > Date: Sat Nov 28 12:12:51 2020 > New Revision: 368124 > URL: https://svnweb.freebsd.org/changeset/base/368124 > > Log: > Make MAXPHYS tunable. Bump MAXPHYS to 1M. > Unfortunately, bumping MAXPHYS broke arm kernel. The kernel runs out of KVA while running 'pbuf' keg init function. This causes that keg_alloc_slab() always returns NULL and for cycle in uma_prealloc() newer ends (whish should be considered as another bug). Do you think that MAXPHYS constant can depends on given arch? 128k (or 256k) sounds reasonable for arm32 systems... Michal > Replace MAXPHYS by runtime variable maxphys. It is initialized from > MAXPHYS by default, but can be also adjusted with the tunable kern.maxphys. > > Make b_pages[] array in struct buf flexible. Size b_pages[] for buffer > cache buffers exactly to atop(maxbcachebuf) (currently it is sized to > atop(MAXPHYS)), and b_pages[] for pbufs is sized to atop(maxphys) + 1. > The +1 for pbufs allow several pbuf consumers, among them vmapbuf(), > to use unaligned buffers still sized to maxphys, esp. when such > buffers come from userspace (*). Overall, we save significant amount > of otherwise wasted memory in b_pages[] for buffer cache buffers, > while bumping MAXPHYS to desired high value. > > Eliminate all direct uses of the MAXPHYS constant in kernel and driver > sources, except a place which initialize maxphys. Some random (and > arguably weird) uses of MAXPHYS, e.g. in linuxolator, are converted > straight. Some drivers, which use MAXPHYS to size embeded structures, > get private MAXPHYS-like constant; their convertion is out of scope > for this work. > > Changes to cam/, dev/ahci, dev/ata, dev/mpr, dev/mpt, dev/mvs, > dev/siis, where either submitted by, or based on changes by mav. > > Suggested by: mav (*) > Reviewed by: imp, mav, imp, mckusick, scottl (intermediate versions) > Tested by: pho > Sponsored by: The FreeBSD Foundation > Differential revision: https://reviews.freebsd.org/D27225 > > Modified: > head/sys/cam/ata/ata_da.c > head/sys/cam/cam_compat.c > head/sys/cam/cam_periph.c > head/sys/cam/cam_xpt.c > head/sys/cam/ctl/ctl_backend_block.c > head/sys/cam/mmc/mmc_da.c > head/sys/cam/nvme/nvme_da.c > head/sys/cam/scsi/scsi_cd.c > head/sys/cam/scsi/scsi_da.c > head/sys/cam/scsi/scsi_pass.c > head/sys/cam/scsi/scsi_sa.c > head/sys/cam/scsi/scsi_sg.c > head/sys/cam/scsi/scsi_target.c > head/sys/compat/linprocfs/linprocfs.c > head/sys/compat/linux/linux_ioctl.c > head/sys/conf/options > head/sys/contrib/openzfs/module/os/freebsd/zfs/vdev_geom.c > head/sys/contrib/openzfs/module/os/freebsd/zfs/zvol_os.c > head/sys/dev/ahci/ahci.c > head/sys/dev/ahci/ahci.h > head/sys/dev/ahci/ahciem.c > head/sys/dev/ata/ata-all.c > head/sys/dev/ata/ata-all.h > head/sys/dev/ata/ata-dma.c > head/sys/dev/firewire/sbp.c > head/sys/dev/flash/cqspi.c > head/sys/dev/isci/scil/sci_controller_constants.h > head/sys/dev/iscsi/iscsi.c > head/sys/dev/md/md.c > head/sys/dev/mfi/mfi.c > head/sys/dev/mpr/mpr.c > head/sys/dev/mps/mps.c > head/sys/dev/mpt/mpt.c > head/sys/dev/mpt/mpt.h > head/sys/dev/mrsas/mrsas.c > head/sys/dev/mvs/mvs.c > head/sys/dev/mvs/mvs.h > head/sys/dev/nvme/nvme.h > head/sys/dev/nvme/nvme_ctrlr.c > head/sys/dev/pms/freebsd/driver/ini/src/agdef.h > head/sys/dev/pms/freebsd/driver/ini/src/agtiapi.c > head/sys/dev/sdhci/sdhci.c > head/sys/dev/siis/siis.c > head/sys/dev/siis/siis.h > head/sys/dev/sym/sym_conf.h > head/sys/dev/usb/storage/umass.c > head/sys/dev/virtio/block/virtio_blk.c > head/sys/dev/virtio/scsi/virtio_scsi.c > head/sys/dev/xen/blkback/blkback.c > head/sys/dev/xen/blkfront/blkfront.c > head/sys/fs/cd9660/cd9660_vfsops.c > head/sys/fs/ext2fs/ext2_vfsops.c > head/sys/fs/fuse/fuse_vfsops.c > head/sys/fs/msdosfs/msdosfs_vfsops.c > head/sys/fs/udf/udf_vfsops.c > head/sys/geom/cache/g_cache.c > head/sys/geom/eli/g_eli_integrity.c > head/sys/geom/geom_dev.c > head/sys/geom/geom_io.c > head/sys/geom/journal/g_journal.c > head/sys/geom/journal/g_journal.h > head/sys/geom/mirror/g_mirror.c > head/sys/geom/nop/g_nop.c > head/sys/geom/part/g_part_apm.c > head/sys/geom/part/g_part_gpt.c > head/sys/geom/part/g_part_ldm.c > head/sys/geom/raid/md_ddf.c > head/sys/geom/raid/md_promise.c > head/sys/geom/raid3/g_raid3.c > head/sys/geom/shsec/g_shsec.c > head/sys/geom/stripe/g_stripe.c > head/sys/geom/uzip/g_uzip.c > head/sys/geom/vinum/geom_vinum_var.h > head/sys/geom/virstor/g_virstor.c > head/sys/geom/virstor/g_virstor.h > head/sys/kern/kern_mib.c > head/sys/kern/kern_physio.c > head/sys/kern/kern_sendfile.c > head/sys/kern/subr_param.c > head/sys/kern/vfs_aio.c > head/sys/kern/vfs_bio.c > head/sys/kern/vfs_cluster.c > head/sys/kern/vfs_default.c > head/sys/mips/ingenic/jz4780_mmc.c > head/sys/net/if.c > head/sys/powerpc/mambo/mambo_disk.c > head/sys/powerpc/mpc85xx/fsl_sata.c > head/sys/sys/aio.h > head/sys/sys/buf.h > head/sys/sys/param.h > head/sys/sys/systm.h > head/sys/ufs/ffs/ffs_vfsops.c > head/sys/vm/swap_pager.c > head/sys/vm/vm_fault.c > head/sys/vm/vm_init.c > head/sys/vm/vm_map.h > head/sys/vm/vm_pager.c > head/sys/vm/vm_pager.h > head/sys/vm/vnode_pager.c > > Modified: head/sys/cam/ata/ata_da.c > ============================================================================== > --- head/sys/cam/ata/ata_da.c Sat Nov 28 10:38:00 2020 (r368123) > +++ head/sys/cam/ata/ata_da.c Sat Nov 28 12:12:51 2020 (r368124) > @@ -3447,8 +3447,8 @@ adasetgeom(struct ada_softc *softc, struct ccb_getdev > maxio = softc->cpi.maxio; /* Honor max I/O size of SIM */ > if (maxio == 0) > maxio = DFLTPHYS; /* traditional default */ > - else if (maxio > MAXPHYS) > - maxio = MAXPHYS; /* for safety */ > + else if (maxio > maxphys) > + maxio = maxphys; /* for safety */ > if (softc->flags & ADA_FLAG_CAN_48BIT) > maxio = min(maxio, 65536 * softc->params.secsize); > else /* 28bit ATA command limit */ > > Modified: head/sys/cam/cam_compat.c > ============================================================================== > --- head/sys/cam/cam_compat.c Sat Nov 28 10:38:00 2020 (r368123) > +++ head/sys/cam/cam_compat.c Sat Nov 28 12:12:51 2020 (r368124) > @@ -368,7 +368,7 @@ cam_compat_translate_dev_match_0x18(union ccb *ccb) > > /* Remap the CCB into kernel address space */ > bzero(&mapinfo, sizeof(mapinfo)); > - cam_periph_mapmem(ccb, &mapinfo, MAXPHYS); > + cam_periph_mapmem(ccb, &mapinfo, maxphys); > > dm = ccb->cdm.matches; > /* Translate in-place: old fields are smaller */ > > Modified: head/sys/cam/cam_periph.c > ============================================================================== > --- head/sys/cam/cam_periph.c Sat Nov 28 10:38:00 2020 (r368123) > +++ head/sys/cam/cam_periph.c Sat Nov 28 12:12:51 2020 (r368124) > @@ -772,7 +772,7 @@ camperiphfree(struct cam_periph *periph) > * Map user virtual pointers into kernel virtual address space, so we can > * access the memory. This is now a generic function that centralizes most > * of the sanity checks on the data flags, if any. > - * This also only works for up to MAXPHYS memory. Since we use > + * This also only works for up to maxphys memory. Since we use > * buffers to map stuff in and out, we're limited to the buffer size. > */ > int > @@ -788,8 +788,8 @@ cam_periph_mapmem(union ccb *ccb, struct cam_periph_ma > bzero(mapinfo, sizeof(*mapinfo)); > if (maxmap == 0) > maxmap = DFLTPHYS; /* traditional default */ > - else if (maxmap > MAXPHYS) > - maxmap = MAXPHYS; /* for safety */ > + else if (maxmap > maxphys) > + maxmap = maxphys; /* for safety */ > switch(ccb->ccb_h.func_code) { > case XPT_DEV_MATCH: > if (ccb->cdm.match_buf_len == 0) { > @@ -813,9 +813,9 @@ cam_periph_mapmem(union ccb *ccb, struct cam_periph_ma > } > /* > * This request will not go to the hardware, no reason > - * to be so strict. vmapbuf() is able to map up to MAXPHYS. > + * to be so strict. vmapbuf() is able to map up to maxphys. > */ > - maxmap = MAXPHYS; > + maxmap = maxphys; > break; > case XPT_SCSI_IO: > case XPT_CONT_TARGET_IO: > @@ -881,9 +881,9 @@ cam_periph_mapmem(union ccb *ccb, struct cam_periph_ma > > /* > * This request will not go to the hardware, no reason > - * to be so strict. vmapbuf() is able to map up to MAXPHYS. > + * to be so strict. vmapbuf() is able to map up to maxphys. > */ > - maxmap = MAXPHYS; > + maxmap = maxphys; > break; > default: > return(EINVAL); > @@ -911,7 +911,7 @@ cam_periph_mapmem(union ccb *ccb, struct cam_periph_ma > * boundary. > */ > misaligned[i] = (lengths[i] + > - (((vm_offset_t)(*data_ptrs[i])) & PAGE_MASK) > MAXPHYS); > + (((vm_offset_t)(*data_ptrs[i])) & PAGE_MASK) > maxphys); > } > > /* > > Modified: head/sys/cam/cam_xpt.c > ============================================================================== > --- head/sys/cam/cam_xpt.c Sat Nov 28 10:38:00 2020 (r368123) > +++ head/sys/cam/cam_xpt.c Sat Nov 28 12:12:51 2020 (r368124) > @@ -553,7 +553,7 @@ xptdoioctl(struct cdev *dev, u_long cmd, caddr_t addr, > * Map the pattern and match buffers into kernel > * virtual address space. > */ > - error = cam_periph_mapmem(inccb, &mapinfo, MAXPHYS); > + error = cam_periph_mapmem(inccb, &mapinfo, maxphys); > > if (error) { > inccb->ccb_h.path = old_path; > > Modified: head/sys/cam/ctl/ctl_backend_block.c > ============================================================================== > --- head/sys/cam/ctl/ctl_backend_block.c Sat Nov 28 10:38:00 2020 (r368123) > +++ head/sys/cam/ctl/ctl_backend_block.c Sat Nov 28 12:12:51 2020 (r368124) > @@ -102,9 +102,11 @@ __FBSDID("$FreeBSD$"); > */ > #define CTLBLK_HALF_IO_SIZE (512 * 1024) > #define CTLBLK_MAX_IO_SIZE (CTLBLK_HALF_IO_SIZE * 2) > -#define CTLBLK_MAX_SEG MIN(CTLBLK_HALF_IO_SIZE, MAXPHYS) > -#define CTLBLK_HALF_SEGS MAX(CTLBLK_HALF_IO_SIZE / CTLBLK_MAX_SEG, 1) > +#define CTLBLK_MIN_SEG (128 * 1024) > +#define CTLBLK_MAX_SEG MIN(CTLBLK_HALF_IO_SIZE, maxphys) > +#define CTLBLK_HALF_SEGS MAX(CTLBLK_HALF_IO_SIZE / CTLBLK_MIN_SEG, 1) > #define CTLBLK_MAX_SEGS (CTLBLK_HALF_SEGS * 2) > +#define CTLBLK_NUM_SEGS (CTLBLK_MAX_IO_SIZE / CTLBLK_MAX_SEG) > > #ifdef CTLBLK_DEBUG > #define DPRINTF(fmt, args...) \ > @@ -189,10 +191,8 @@ struct ctl_be_block_softc { > int num_luns; > SLIST_HEAD(, ctl_be_block_lun) lun_list; > uma_zone_t beio_zone; > - uma_zone_t buf_zone; > -#if (CTLBLK_MAX_SEG > 131072) > - uma_zone_t buf128_zone; > -#endif > + uma_zone_t bufmin_zone; > + uma_zone_t bufmax_zone; > }; > > static struct ctl_be_block_softc backend_block_softc; > @@ -307,12 +307,13 @@ ctl_alloc_seg(struct ctl_be_block_softc *softc, struct > size_t len) > { > > -#if (CTLBLK_MAX_SEG > 131072) > - if (len <= 131072) > - sg->addr = uma_zalloc(softc->buf128_zone, M_WAITOK); > - else > -#endif > - sg->addr = uma_zalloc(softc->buf_zone, M_WAITOK); > + if (len <= CTLBLK_MIN_SEG) { > + sg->addr = uma_zalloc(softc->bufmin_zone, M_WAITOK); > + } else { > + KASSERT(len <= CTLBLK_MAX_SEG, > + ("Too large alloc %zu > %lu", len, CTLBLK_MAX_SEG)); > + sg->addr = uma_zalloc(softc->bufmax_zone, M_WAITOK); > + } > sg->len = len; > } > > @@ -320,12 +321,13 @@ static void > ctl_free_seg(struct ctl_be_block_softc *softc, struct ctl_sg_entry *sg) > { > > -#if (CTLBLK_MAX_SEG > 131072) > - if (sg->len <= 131072) > - uma_zfree(softc->buf128_zone, sg->addr); > - else > -#endif > - uma_zfree(softc->buf_zone, sg->addr); > + if (sg->len <= CTLBLK_MIN_SEG) { > + uma_zfree(softc->bufmin_zone, sg->addr); > + } else { > + KASSERT(sg->len <= CTLBLK_MAX_SEG, > + ("Too large free %zu > %lu", sg->len, CTLBLK_MAX_SEG)); > + uma_zfree(softc->bufmax_zone, sg->addr); > + } > } > > static struct ctl_be_block_io * > @@ -1344,7 +1346,7 @@ ctl_be_block_cw_dispatch_ws(struct ctl_be_block_lun *b > else > pbo = 0; > len_left = (uint64_t)lbalen->len * cbe_lun->blocksize; > - for (i = 0, lba = 0; i < CTLBLK_MAX_SEGS && len_left > 0; i++) { > + for (i = 0, lba = 0; i < CTLBLK_NUM_SEGS && len_left > 0; i++) { > /* > * Setup the S/G entry for this chunk. > */ > @@ -1631,7 +1633,7 @@ ctl_be_block_dispatch(struct ctl_be_block_lun *be_lun, > * Setup the S/G entry for this chunk. > */ > ctl_alloc_seg(softc, &beio->sg_segs[i], > - min(CTLBLK_MAX_SEG, len_left)); > + MIN(CTLBLK_MAX_SEG, len_left)); > > DPRINTF("segment %d addr %p len %zd\n", i, > beio->sg_segs[i].addr, beio->sg_segs[i].len); > @@ -2802,12 +2804,11 @@ ctl_be_block_init(void) > mtx_init(&softc->lock, "ctlblock", NULL, MTX_DEF); > softc->beio_zone = uma_zcreate("beio", sizeof(struct ctl_be_block_io), > NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0); > - softc->buf_zone = uma_zcreate("ctlblock", CTLBLK_MAX_SEG, > + softc->bufmin_zone = uma_zcreate("ctlblockmin", CTLBLK_MIN_SEG, > NULL, NULL, NULL, NULL, /*align*/ 0, /*flags*/0); > -#if (CTLBLK_MAX_SEG > 131072) > - softc->buf128_zone = uma_zcreate("ctlblock128", 131072, > - NULL, NULL, NULL, NULL, /*align*/ 0, /*flags*/0); > -#endif > + if (CTLBLK_MIN_SEG < CTLBLK_MAX_SEG) > + softc->bufmax_zone = uma_zcreate("ctlblockmax", CTLBLK_MAX_SEG, > + NULL, NULL, NULL, NULL, /*align*/ 0, /*flags*/0); > SLIST_INIT(&softc->lun_list); > return (0); > } > @@ -2832,10 +2833,9 @@ ctl_be_block_shutdown(void) > mtx_lock(&softc->lock); > } > mtx_unlock(&softc->lock); > - uma_zdestroy(softc->buf_zone); > -#if (CTLBLK_MAX_SEG > 131072) > - uma_zdestroy(softc->buf128_zone); > -#endif > + uma_zdestroy(softc->bufmin_zone); > + if (CTLBLK_MIN_SEG < CTLBLK_MAX_SEG) > + uma_zdestroy(softc->bufmax_zone); > uma_zdestroy(softc->beio_zone); > mtx_destroy(&softc->lock); > sx_destroy(&softc->modify_lock); > > Modified: head/sys/cam/mmc/mmc_da.c > ============================================================================== > --- head/sys/cam/mmc/mmc_da.c Sat Nov 28 10:38:00 2020 (r368123) > +++ head/sys/cam/mmc/mmc_da.c Sat Nov 28 12:12:51 2020 (r368124) > @@ -1592,7 +1592,7 @@ sdda_add_part(struct cam_periph *periph, u_int type, c > part->disk->d_name = part->name; > part->disk->d_drv1 = part; > part->disk->d_maxsize = > - MIN(MAXPHYS, sdda_get_max_data(periph, > + MIN(maxphys, sdda_get_max_data(periph, > (union ccb *)&cpi) * mmc_get_sector_size(periph)); > part->disk->d_unit = cnt; > part->disk->d_flags = 0; > > Modified: head/sys/cam/nvme/nvme_da.c > ============================================================================== > --- head/sys/cam/nvme/nvme_da.c Sat Nov 28 10:38:00 2020 (r368123) > +++ head/sys/cam/nvme/nvme_da.c Sat Nov 28 12:12:51 2020 (r368124) > @@ -906,8 +906,8 @@ ndaregister(struct cam_periph *periph, void *arg) > maxio = cpi.maxio; /* Honor max I/O size of SIM */ > if (maxio == 0) > maxio = DFLTPHYS; /* traditional default */ > - else if (maxio > MAXPHYS) > - maxio = MAXPHYS; /* for safety */ > + else if (maxio > maxphys) > + maxio = maxphys; /* for safety */ > disk->d_maxsize = maxio; > flbas_fmt = (nsd->flbas >> NVME_NS_DATA_FLBAS_FORMAT_SHIFT) & > NVME_NS_DATA_FLBAS_FORMAT_MASK; > > Modified: head/sys/cam/scsi/scsi_cd.c > ============================================================================== > --- head/sys/cam/scsi/scsi_cd.c Sat Nov 28 10:38:00 2020 (r368123) > +++ head/sys/cam/scsi/scsi_cd.c Sat Nov 28 12:12:51 2020 (r368124) > @@ -696,8 +696,8 @@ cdregister(struct cam_periph *periph, void *arg) > softc->disk->d_drv1 = periph; > if (cpi.maxio == 0) > softc->disk->d_maxsize = DFLTPHYS; /* traditional default */ > - else if (cpi.maxio > MAXPHYS) > - softc->disk->d_maxsize = MAXPHYS; /* for safety */ > + else if (cpi.maxio > maxphys) > + softc->disk->d_maxsize = maxphys; /* for safety */ > else > softc->disk->d_maxsize = cpi.maxio; > softc->disk->d_flags = 0; > > Modified: head/sys/cam/scsi/scsi_da.c > ============================================================================== > --- head/sys/cam/scsi/scsi_da.c Sat Nov 28 10:38:00 2020 (r368123) > +++ head/sys/cam/scsi/scsi_da.c Sat Nov 28 12:12:51 2020 (r368124) > @@ -2921,8 +2921,8 @@ daregister(struct cam_periph *periph, void *arg) > softc->disk->d_drv1 = periph; > if (cpi.maxio == 0) > softc->maxio = DFLTPHYS; /* traditional default */ > - else if (cpi.maxio > MAXPHYS) > - softc->maxio = MAXPHYS; /* for safety */ > + else if (cpi.maxio > maxphys) > + softc->maxio = maxphys; /* for safety */ > else > softc->maxio = cpi.maxio; > if (softc->quirks & DA_Q_128KB) > @@ -4819,7 +4819,7 @@ dadone_proberc(struct cam_periph *periph, union ccb *d > if (maxsector == 0) > maxsector = -1; > } > - if (block_size >= MAXPHYS) { > + if (block_size >= maxphys) { > xpt_print(periph->path, > "unsupportable block size %ju\n", > (uintmax_t) block_size); > > Modified: head/sys/cam/scsi/scsi_pass.c > ============================================================================== > --- head/sys/cam/scsi/scsi_pass.c Sat Nov 28 10:38:00 2020 (r368123) > +++ head/sys/cam/scsi/scsi_pass.c Sat Nov 28 12:12:51 2020 (r368124) > @@ -583,15 +583,15 @@ passregister(struct cam_periph *periph, void *arg) > periph->periph_name, periph->unit_number); > snprintf(softc->io_zone_name, sizeof(softc->io_zone_name), "%s%dIO", > periph->periph_name, periph->unit_number); > - softc->io_zone_size = MAXPHYS; > + softc->io_zone_size = maxphys; > knlist_init_mtx(&softc->read_select.si_note, cam_periph_mtx(periph)); > > xpt_path_inq(&cpi, periph->path); > > if (cpi.maxio == 0) > softc->maxio = DFLTPHYS; /* traditional default */ > - else if (cpi.maxio > MAXPHYS) > - softc->maxio = MAXPHYS; /* for safety */ > + else if (cpi.maxio > maxphys) > + softc->maxio = maxphys; /* for safety */ > else > softc->maxio = cpi.maxio; /* real value */ > > @@ -1507,7 +1507,7 @@ passmemsetup(struct cam_periph *periph, struct pass_io > > /* > * We allocate buffers in io_zone_size increments for an > - * S/G list. This will generally be MAXPHYS. > + * S/G list. This will generally be maxphys. > */ > if (lengths[0] <= softc->io_zone_size) > num_segs_needed = 1; > > Modified: head/sys/cam/scsi/scsi_sa.c > ============================================================================== > --- head/sys/cam/scsi/scsi_sa.c Sat Nov 28 10:38:00 2020 (r368123) > +++ head/sys/cam/scsi/scsi_sa.c Sat Nov 28 12:12:51 2020 (r368124) > @@ -2447,12 +2447,12 @@ saregister(struct cam_periph *periph, void *arg) > > /* > * If maxio isn't set, we fall back to DFLTPHYS. Otherwise we take > - * the smaller of cpi.maxio or MAXPHYS. > + * the smaller of cpi.maxio or maxphys. > */ > if (cpi.maxio == 0) > softc->maxio = DFLTPHYS; > - else if (cpi.maxio > MAXPHYS) > - softc->maxio = MAXPHYS; > + else if (cpi.maxio > maxphys) > + softc->maxio = maxphys; > else > softc->maxio = cpi.maxio; > > > Modified: head/sys/cam/scsi/scsi_sg.c > ============================================================================== > --- head/sys/cam/scsi/scsi_sg.c Sat Nov 28 10:38:00 2020 (r368123) > +++ head/sys/cam/scsi/scsi_sg.c Sat Nov 28 12:12:51 2020 (r368124) > @@ -327,8 +327,8 @@ sgregister(struct cam_periph *periph, void *arg) > > if (cpi.maxio == 0) > softc->maxio = DFLTPHYS; /* traditional default */ > - else if (cpi.maxio > MAXPHYS) > - softc->maxio = MAXPHYS; /* for safety */ > + else if (cpi.maxio > maxphys) > + softc->maxio = maxphys; /* for safety */ > else > softc->maxio = cpi.maxio; /* real value */ > > > Modified: head/sys/cam/scsi/scsi_target.c > ============================================================================== > --- head/sys/cam/scsi/scsi_target.c Sat Nov 28 10:38:00 2020 (r368123) > +++ head/sys/cam/scsi/scsi_target.c Sat Nov 28 12:12:51 2020 (r368124) > @@ -404,8 +404,8 @@ targenable(struct targ_softc *softc, struct cam_path * > } > if (cpi.maxio == 0) > softc->maxio = DFLTPHYS; /* traditional default */ > - else if (cpi.maxio > MAXPHYS) > - softc->maxio = MAXPHYS; /* for safety */ > + else if (cpi.maxio > maxphys) > + softc->maxio = maxphys; /* for safety */ > else > softc->maxio = cpi.maxio; /* real value */ > > > Modified: head/sys/compat/linprocfs/linprocfs.c > ============================================================================== > --- head/sys/compat/linprocfs/linprocfs.c Sat Nov 28 10:38:00 2020 (r368123) > +++ head/sys/compat/linprocfs/linprocfs.c Sat Nov 28 12:12:51 2020 (r368124) > @@ -1928,8 +1928,8 @@ linprocfs_doauxv(PFS_FILL_ARGS) > buflen = resid; > if (buflen > IOSIZE_MAX) > return (EINVAL); > - if (buflen > MAXPHYS) > - buflen = MAXPHYS; > + if (buflen > maxphys) > + buflen = maxphys; > if (resid <= 0) > return (0); > > > Modified: head/sys/compat/linux/linux_ioctl.c > ============================================================================== > --- head/sys/compat/linux/linux_ioctl.c Sat Nov 28 10:38:00 2020 (r368123) > +++ head/sys/compat/linux/linux_ioctl.c Sat Nov 28 12:12:51 2020 (r368124) > @@ -2152,7 +2152,7 @@ linux_ifconf(struct thread *td, struct ifconf *uifc) > if (error != 0) > return (error); > > - max_len = MAXPHYS - 1; > + max_len = maxphys - 1; > > CURVNET_SET(TD_TO_VNET(td)); > /* handle the 'request buffer size' case */ > > Modified: head/sys/conf/options > ============================================================================== > --- head/sys/conf/options Sat Nov 28 10:38:00 2020 (r368123) > +++ head/sys/conf/options Sat Nov 28 12:12:51 2020 (r368124) > @@ -602,7 +602,7 @@ INVARIANTS opt_global.h > KASSERT_PANIC_OPTIONAL opt_global.h > MAXCPU opt_global.h > MAXMEMDOM opt_global.h > -MAXPHYS opt_global.h > +MAXPHYS opt_maxphys.h > MCLSHIFT opt_global.h > MUTEX_NOINLINE opt_global.h > LOCK_PROFILING opt_global.h > > Modified: head/sys/contrib/openzfs/module/os/freebsd/zfs/vdev_geom.c > ============================================================================== > --- head/sys/contrib/openzfs/module/os/freebsd/zfs/vdev_geom.c Sat Nov 28 10:38:00 2020 (r368123) > +++ head/sys/contrib/openzfs/module/os/freebsd/zfs/vdev_geom.c Sat Nov 28 12:12:51 2020 (r368124) > @@ -379,7 +379,7 @@ vdev_geom_io(struct g_consumer *cp, int *cmds, void ** > int i, n_bios, j; > size_t bios_size; > > - maxio = MAXPHYS - (MAXPHYS % cp->provider->sectorsize); > + maxio = maxphys - (maxphys % cp->provider->sectorsize); > n_bios = 0; > > /* How many bios are required for all commands ? */ > > Modified: head/sys/contrib/openzfs/module/os/freebsd/zfs/zvol_os.c > ============================================================================== > --- head/sys/contrib/openzfs/module/os/freebsd/zfs/zvol_os.c Sat Nov 28 10:38:00 2020 (r368123) > +++ head/sys/contrib/openzfs/module/os/freebsd/zfs/zvol_os.c Sat Nov 28 12:12:51 2020 (r368124) > @@ -1191,7 +1191,7 @@ zvol_rename_minor(zvol_state_t *zv, const char *newnam > args.mda_si_drv2 = zv; > if (make_dev_s(&args, &dev, "%s/%s", ZVOL_DRIVER, newname) > == 0) { > - dev->si_iosize_max = MAXPHYS; > + dev->si_iosize_max = maxphys; > zsd->zsd_cdev = dev; > } > } > @@ -1327,7 +1327,7 @@ zvol_create_minor_impl(const char *name) > dmu_objset_disown(os, B_TRUE, FTAG); > goto out_giant; > } > - dev->si_iosize_max = MAXPHYS; > + dev->si_iosize_max = maxphys; > zsd->zsd_cdev = dev; > } > (void) strlcpy(zv->zv_name, name, MAXPATHLEN); > > Modified: head/sys/dev/ahci/ahci.c > ============================================================================== > --- head/sys/dev/ahci/ahci.c Sat Nov 28 10:38:00 2020 (r368123) > +++ head/sys/dev/ahci/ahci.c Sat Nov 28 12:12:51 2020 (r368124) > @@ -1124,8 +1124,7 @@ ahci_dmainit(device_t dev) > error = bus_dma_tag_create(bus_get_dma_tag(dev), 2, 0, > BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, > NULL, NULL, > - AHCI_SG_ENTRIES * PAGE_SIZE * ch->numslots, > - AHCI_SG_ENTRIES, AHCI_PRD_MAX, > + AHCI_SG_ENTRIES * PAGE_SIZE, AHCI_SG_ENTRIES, AHCI_PRD_MAX, > 0, busdma_lock_mutex, &ch->mtx, &ch->dma.data_tag); > if (error != 0) > goto error; > @@ -1187,6 +1186,7 @@ ahci_slotsalloc(device_t dev) > slot->ch = ch; > slot->slot = i; > slot->state = AHCI_SLOT_EMPTY; > + slot->ct_offset = AHCI_CT_OFFSET + AHCI_CT_SIZE * i; > slot->ccb = NULL; > callout_init_mtx(&slot->timeout, &ch->mtx, 0); > > @@ -1642,8 +1642,7 @@ ahci_dmasetprd(void *arg, bus_dma_segment_t *segs, int > } > KASSERT(nsegs <= AHCI_SG_ENTRIES, ("too many DMA segment entries\n")); > /* Get a piece of the workspace for this request */ > - ctp = (struct ahci_cmd_tab *) > - (ch->dma.work + AHCI_CT_OFFSET + (AHCI_CT_SIZE * slot->slot)); > + ctp = (struct ahci_cmd_tab *)(ch->dma.work + slot->ct_offset); > /* Fill S/G table */ > prd = &ctp->prd_tab[0]; > for (i = 0; i < nsegs; i++) { > @@ -1672,8 +1671,7 @@ ahci_execute_transaction(struct ahci_slot *slot) > uint16_t cmd_flags; > > /* Get a piece of the workspace for this request */ > - ctp = (struct ahci_cmd_tab *) > - (ch->dma.work + AHCI_CT_OFFSET + (AHCI_CT_SIZE * slot->slot)); > + ctp = (struct ahci_cmd_tab *)(ch->dma.work + slot->ct_offset); > /* Setup the FIS for this request */ > if (!(fis_size = ahci_setup_fis(ch, ctp, ccb, slot->slot))) { > device_printf(ch->dev, "Setting up SATA FIS failed\n"); > @@ -1710,8 +1708,7 @@ ahci_execute_transaction(struct ahci_slot *slot) > softreset = 0; > clp->bytecount = 0; > clp->cmd_flags = htole16(cmd_flags); > - clp->cmd_table_phys = htole64(ch->dma.work_bus + AHCI_CT_OFFSET + > - (AHCI_CT_SIZE * slot->slot)); > + clp->cmd_table_phys = htole64(ch->dma.work_bus + slot->ct_offset); > bus_dmamap_sync(ch->dma.work_tag, ch->dma.work_map, > BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); > bus_dmamap_sync(ch->dma.rfis_tag, ch->dma.rfis_map, > @@ -2868,7 +2865,7 @@ ahciaction(struct cam_sim *sim, union ccb *ccb) > cpi->transport_version = XPORT_VERSION_UNSPECIFIED; > cpi->protocol = PROTO_ATA; > cpi->protocol_version = PROTO_VERSION_UNSPECIFIED; > - cpi->maxio = MAXPHYS; > + cpi->maxio = ctob(AHCI_SG_ENTRIES - 1); > /* ATI SB600 can't handle 256 sectors with FPDMA (NCQ). */ > if (ch->quirks & AHCI_Q_MAXIO_64K) > cpi->maxio = min(cpi->maxio, 128 * 512); > > Modified: head/sys/dev/ahci/ahci.h > ============================================================================== > --- head/sys/dev/ahci/ahci.h Sat Nov 28 10:38:00 2020 (r368123) > +++ head/sys/dev/ahci/ahci.h Sat Nov 28 12:12:51 2020 (r368124) > @@ -310,13 +310,8 @@ > #define AHCI_P_DEVSLP_DM 0x0e000000 > #define AHCI_P_DEVSLP_DM_SHIFT 25 > > -/* Just to be sure, if building as module. */ > -#if MAXPHYS < 512 * 1024 > -#undef MAXPHYS > -#define MAXPHYS 512 * 1024 > -#endif > /* Pessimistic prognosis on number of required S/G entries */ > -#define AHCI_SG_ENTRIES (roundup(btoc(MAXPHYS) + 1, 8)) > +#define AHCI_SG_ENTRIES MIN(roundup(btoc(maxphys) + 1, 8), 65528) > /* Command list. 32 commands. First, 1Kbyte aligned. */ > #define AHCI_CL_OFFSET 0 > #define AHCI_CL_SIZE 32 > @@ -344,7 +339,7 @@ struct ahci_cmd_tab { > u_int8_t cfis[64]; > u_int8_t acmd[32]; > u_int8_t reserved[32]; > - struct ahci_dma_prd prd_tab[AHCI_SG_ENTRIES]; > + struct ahci_dma_prd prd_tab[]; > } __packed; > > struct ahci_cmd_list { > @@ -394,6 +389,7 @@ struct ahci_slot { > struct ahci_channel *ch; /* Channel */ > u_int8_t slot; /* Number of this slot */ > enum ahci_slot_states state; /* Slot state */ > + u_int ct_offset; /* cmd_tab offset */ > union ccb *ccb; /* CCB occupying slot */ > struct ata_dmaslot dma; /* DMA data of this slot */ > struct callout timeout; /* Execution timeout */ > > Modified: head/sys/dev/ahci/ahciem.c > ============================================================================== > --- head/sys/dev/ahci/ahciem.c Sat Nov 28 10:38:00 2020 (r368123) > +++ head/sys/dev/ahci/ahciem.c Sat Nov 28 12:12:51 2020 (r368124) > @@ -641,7 +641,7 @@ ahciemaction(struct cam_sim *sim, union ccb *ccb) > cpi->transport_version = XPORT_VERSION_UNSPECIFIED; > cpi->protocol = PROTO_ATA; > cpi->protocol_version = PROTO_VERSION_UNSPECIFIED; > - cpi->maxio = MAXPHYS; > + cpi->maxio = maxphys; > cpi->hba_vendor = pci_get_vendor(parent); > cpi->hba_device = pci_get_device(parent); > cpi->hba_subvendor = pci_get_subvendor(parent); > > Modified: head/sys/dev/ata/ata-all.c > ============================================================================== > --- head/sys/dev/ata/ata-all.c Sat Nov 28 10:38:00 2020 (r368123) > +++ head/sys/dev/ata/ata-all.c Sat Nov 28 12:12:51 2020 (r368124) > @@ -139,7 +139,7 @@ ata_attach(device_t dev) > if (ch->flags & ATA_SATA) > ch->user[i].bytecount = 8192; > else > - ch->user[i].bytecount = MAXPHYS; > + ch->user[i].bytecount = 65536; > ch->user[i].caps = 0; > ch->curr[i] = ch->user[i]; > if (ch->flags & ATA_SATA) { > > Modified: head/sys/dev/ata/ata-all.h > ============================================================================== > --- head/sys/dev/ata/ata-all.h Sat Nov 28 10:38:00 2020 (r368123) > +++ head/sys/dev/ata/ata-all.h Sat Nov 28 12:12:51 2020 (r368124) > @@ -152,7 +152,7 @@ > #define ATA_SACTIVE 16 > > /* DMA register defines */ > -#define ATA_DMA_ENTRIES 256 > +#define ATA_DMA_ENTRIES MAX(17, btoc(maxphys) + 1) > #define ATA_DMA_EOT 0x80000000 > > #define ATA_BMCMD_PORT 17 > > Modified: head/sys/dev/ata/ata-dma.c > ============================================================================== > --- head/sys/dev/ata/ata-dma.c Sat Nov 28 10:38:00 2020 (r368123) > +++ head/sys/dev/ata/ata-dma.c Sat Nov 28 12:12:51 2020 (r368124) > @@ -87,7 +87,7 @@ ata_dmainit(device_t dev) > if (ch->dma.segsize == 0) > ch->dma.segsize = 65536; > if (ch->dma.max_iosize == 0) > - ch->dma.max_iosize = MIN((ATA_DMA_ENTRIES - 1) * PAGE_SIZE, MAXPHYS); > + ch->dma.max_iosize = (ATA_DMA_ENTRIES - 1) * PAGE_SIZE; > if (ch->dma.max_address == 0) > ch->dma.max_address = BUS_SPACE_MAXADDR_32BIT; > if (ch->dma.dma_slots == 0) > > Modified: head/sys/dev/firewire/sbp.c > ============================================================================== > --- head/sys/dev/firewire/sbp.c Sat Nov 28 10:38:00 2020 (r368123) > +++ head/sys/dev/firewire/sbp.c Sat Nov 28 12:12:51 2020 (r368124) > @@ -71,7 +71,7 @@ > * because of CAM_SCSI2_MAXLUN in cam_xpt.c > */ > #define SBP_NUM_LUNS 64 > -#define SBP_MAXPHYS MIN(MAXPHYS, (512*1024) /* 512KB */) > +#define SBP_MAXPHYS (128 * 1024) > #define SBP_DMA_SIZE PAGE_SIZE > #define SBP_LOGIN_SIZE sizeof(struct sbp_login_res) > #define SBP_QUEUE_LEN ((SBP_DMA_SIZE - SBP_LOGIN_SIZE) / sizeof(struct sbp_ocb)) > > Modified: head/sys/dev/flash/cqspi.c > ============================================================================== > --- head/sys/dev/flash/cqspi.c Sat Nov 28 10:38:00 2020 (r368123) > +++ head/sys/dev/flash/cqspi.c Sat Nov 28 12:12:51 2020 (r368124) > @@ -721,9 +721,9 @@ cqspi_attach(device_t dev) > return (ENXIO); > } > > - xdma_prep_sg(sc->xchan_tx, TX_QUEUE_SIZE, MAXPHYS, 8, 16, 0, > + xdma_prep_sg(sc->xchan_tx, TX_QUEUE_SIZE, maxphys, 8, 16, 0, > BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR); > - xdma_prep_sg(sc->xchan_rx, TX_QUEUE_SIZE, MAXPHYS, 8, 16, 0, > + xdma_prep_sg(sc->xchan_rx, TX_QUEUE_SIZE, maxphys, 8, 16, 0, > BUS_SPACE_MAXADDR_32BIT, BUS_SPACE_MAXADDR); > > cqspi_init(sc); > > Modified: head/sys/dev/isci/scil/sci_controller_constants.h > ============================================================================== > --- head/sys/dev/isci/scil/sci_controller_constants.h Sat Nov 28 10:38:00 2020 (r368123) > +++ head/sys/dev/isci/scil/sci_controller_constants.h Sat Nov 28 12:12:51 2020 (r368124) > @@ -157,7 +157,7 @@ extern "C" { > * posted to hardware always contain pairs of elements (with second > * element set to zeroes if not needed). > */ > -#define __MAXPHYS_ELEMENTS ((MAXPHYS / PAGE_SIZE) + 1) > +#define __MAXPHYS_ELEMENTS ((128 * 1024 / PAGE_SIZE) + 1) > #define SCI_MAX_SCATTER_GATHER_ELEMENTS ((__MAXPHYS_ELEMENTS + 1) & ~0x1) > #endif > > > Modified: head/sys/dev/iscsi/iscsi.c > ============================================================================== > --- head/sys/dev/iscsi/iscsi.c Sat Nov 28 10:38:00 2020 (r368123) > +++ head/sys/dev/iscsi/iscsi.c Sat Nov 28 12:12:51 2020 (r368124) > @@ -2407,7 +2407,7 @@ iscsi_action(struct cam_sim *sim, union ccb *ccb) > cpi->transport_version = 0; > cpi->protocol = PROTO_SCSI; > cpi->protocol_version = SCSI_REV_SPC3; > - cpi->maxio = MAXPHYS; > + cpi->maxio = maxphys; > cpi->ccb_h.status = CAM_REQ_CMP; > break; > } > > Modified: head/sys/dev/md/md.c > ============================================================================== > --- head/sys/dev/md/md.c Sat Nov 28 10:38:00 2020 (r368123) > +++ head/sys/dev/md/md.c Sat Nov 28 12:12:51 2020 (r368124) > @@ -960,9 +960,10 @@ mdstart_vnode(struct md_s *sc, struct bio *bp) > piov = auio.uio_iov; > } else if ((bp->bio_flags & BIO_UNMAPPED) != 0) { > pb = uma_zalloc(md_pbuf_zone, M_WAITOK); > + MPASS((pb->b_flags & B_MAXPHYS) != 0); > bp->bio_resid = len; > unmapped_step: > - npages = atop(min(MAXPHYS, round_page(len + (ma_offs & > + npages = atop(min(maxphys, round_page(len + (ma_offs & > PAGE_MASK)))); > iolen = min(ptoa(npages) - (ma_offs & PAGE_MASK), len); > KASSERT(iolen > 0, ("zero iolen")); > @@ -1684,7 +1685,7 @@ kern_mdattach_locked(struct thread *td, struct md_req > sectsize = DEV_BSIZE; > else > sectsize = mdr->md_sectorsize; > - if (sectsize > MAXPHYS || mdr->md_mediasize < sectsize) > + if (sectsize > maxphys || mdr->md_mediasize < sectsize) > return (EINVAL); > if (mdr->md_options & MD_AUTOUNIT) > sc = mdnew(-1, &error, mdr->md_type); > > Modified: head/sys/dev/mfi/mfi.c > ============================================================================== > --- head/sys/dev/mfi/mfi.c Sat Nov 28 10:38:00 2020 (r368123) > +++ head/sys/dev/mfi/mfi.c Sat Nov 28 12:12:51 2020 (r368124) > @@ -457,7 +457,7 @@ mfi_attach(struct mfi_softc *sc) > /* > * Get information needed for sizing the contiguous memory for the > * frame pool. Size down the sgl parameter since we know that > - * we will never need more than what's required for MAXPHYS. > + * we will never need more than what's required for MFI_MAXPHYS. > * It would be nice if these constants were available at runtime > * instead of compile time. > */ > > Modified: head/sys/dev/mpr/mpr.c > ============================================================================== > --- head/sys/dev/mpr/mpr.c Sat Nov 28 10:38:00 2020 (r368123) > +++ head/sys/dev/mpr/mpr.c Sat Nov 28 12:12:51 2020 (r368124) > @@ -436,14 +436,14 @@ mpr_resize_queues(struct mpr_softc *sc) > > /* > * If I/O size limitation requested then use it and pass up to CAM. > - * If not, use MAXPHYS as an optimization hint, but report HW limit. > + * If not, use maxphys as an optimization hint, but report HW limit. > */ > if (sc->max_io_pages > 0) { > maxio = min(maxio, sc->max_io_pages * PAGE_SIZE); > sc->maxio = maxio; > } else { > sc->maxio = maxio; > - maxio = min(maxio, MAXPHYS); > + maxio = min(maxio, maxphys); > } > > sc->num_chains = (maxio / PAGE_SIZE + sges_per_frame - 2) / > > Modified: head/sys/dev/mps/mps.c > ============================================================================== > --- head/sys/dev/mps/mps.c Sat Nov 28 10:38:00 2020 (r368123) > +++ head/sys/dev/mps/mps.c Sat Nov 28 12:12:51 2020 (r368124) > @@ -418,14 +418,14 @@ mps_resize_queues(struct mps_softc *sc) > > /* > * If I/O size limitation requested, then use it and pass up to CAM. > - * If not, use MAXPHYS as an optimization hint, but report HW limit. > + * If not, use maxphys as an optimization hint, but report HW limit. > */ > if (sc->max_io_pages > 0) { > maxio = min(maxio, sc->max_io_pages * PAGE_SIZE); > sc->maxio = maxio; > } else { > sc->maxio = maxio; > - maxio = min(maxio, MAXPHYS); > + maxio = min(maxio, maxphys); > } > > sc->num_chains = (maxio / PAGE_SIZE + sges_per_frame - 2) / > > Modified: head/sys/dev/mpt/mpt.c > ============================================================================== > --- head/sys/dev/mpt/mpt.c Sat Nov 28 10:38:00 2020 (r368123) > +++ head/sys/dev/mpt/mpt.c Sat Nov 28 12:12:51 2020 (r368124) > @@ -2691,7 +2691,7 @@ mpt_configure_ioc(struct mpt_softc *mpt, int tn, int n > /* > * Use this as the basis for reporting the maximum I/O size to CAM. > */ > - mpt->max_cam_seg_cnt = min(mpt->max_seg_cnt, (MAXPHYS / PAGE_SIZE) + 1); > + mpt->max_cam_seg_cnt = min(mpt->max_seg_cnt, btoc(maxphys) + 1); > > /* XXX Lame Locking! */ > MPT_UNLOCK(mpt); > > Modified: head/sys/dev/mpt/mpt.h > ============================================================================== > --- head/sys/dev/mpt/mpt.h Sat Nov 28 10:38:00 2020 (r368123) > +++ head/sys/dev/mpt/mpt.h Sat Nov 28 12:12:51 2020 (r368124) > @@ -668,7 +668,7 @@ struct mpt_softc { > bus_addr_t request_phys; /* BusAddr of request memory */ > > uint32_t max_seg_cnt; /* calculated after IOC facts */ > - uint32_t max_cam_seg_cnt;/* calculated from MAXPHYS*/ > + uint32_t max_cam_seg_cnt;/* calculated from maxphys */ > > /* > * Hardware management > > Modified: head/sys/dev/mrsas/mrsas.c > ============================================================================== > --- head/sys/dev/mrsas/mrsas.c Sat Nov 28 10:38:00 2020 (r368123) > +++ head/sys/dev/mrsas/mrsas.c Sat Nov 28 12:12:51 2020 (r368124) > @@ -1922,9 +1922,9 @@ mrsas_alloc_mem(struct mrsas_softc *sc) > BUS_SPACE_MAXADDR, /* lowaddr */ > BUS_SPACE_MAXADDR, /* highaddr */ > NULL, NULL, /* filter, filterarg */ > - MAXPHYS, /* maxsize */ > + maxphys, /* maxsize */ > sc->max_num_sge, /* nsegments */ > - MAXPHYS, /* maxsegsize */ > + maxphys, /* maxsegsize */ > 0, /* flags */ > NULL, NULL, /* lockfunc, lockarg */ > &sc->mrsas_parent_tag /* tag */ > @@ -2154,9 +2154,9 @@ mrsas_alloc_mem(struct mrsas_softc *sc) > BUS_SPACE_MAXADDR, > BUS_SPACE_MAXADDR, > NULL, NULL, > - MAXPHYS, > + maxphys, > sc->max_num_sge, /* nsegments */ > - MAXPHYS, > + maxphys, > BUS_DMA_ALLOCNOW, > busdma_lock_mutex, > &sc->io_lock, > > Modified: head/sys/dev/mvs/mvs.c > ============================================================================== > --- head/sys/dev/mvs/mvs.c Sat Nov 28 10:38:00 2020 (r368123) > +++ head/sys/dev/mvs/mvs.c Sat Nov 28 12:12:51 2020 (r368124) > @@ -370,8 +370,7 @@ mvs_dmainit(device_t dev) > if (bus_dma_tag_create(bus_get_dma_tag(dev), 2, MVS_EPRD_MAX, > BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, > NULL, NULL, > - MVS_SG_ENTRIES * PAGE_SIZE * MVS_MAX_SLOTS, > - MVS_SG_ENTRIES, MVS_EPRD_MAX, > + MVS_SG_ENTRIES * PAGE_SIZE, MVS_SG_ENTRIES, MVS_EPRD_MAX, > 0, busdma_lock_mutex, &ch->mtx, &ch->dma.data_tag)) { > goto error; > } > @@ -438,6 +437,7 @@ mvs_slotsalloc(device_t dev) > slot->dev = dev; > slot->slot = i; > slot->state = MVS_SLOT_EMPTY; > + slot->eprd_offset = MVS_EPRD_OFFSET + MVS_EPRD_SIZE * i; > slot->ccb = NULL; > callout_init_mtx(&slot->timeout, &ch->mtx, 0); > > @@ -1286,8 +1286,7 @@ mvs_dmasetprd(void *arg, bus_dma_segment_t *segs, int > } else { > slot->dma.addr = 0; > /* Get a piece of the workspace for this EPRD */ > - eprd = (struct mvs_eprd *) > - (ch->dma.workrq + MVS_EPRD_OFFSET + (MVS_EPRD_SIZE * slot->slot)); > + eprd = (struct mvs_eprd *)(ch->dma.workrq + slot->eprd_offset); > /* Fill S/G table */ > for (i = 0; i < nsegs; i++) { > eprd[i].prdbal = htole32(segs[i].ds_addr); > @@ -1405,8 +1404,7 @@ mvs_legacy_execute_transaction(struct mvs_slot *slot) > DELAY(10); > if (ch->basic_dma) { > /* Start basic DMA. */ > - eprd = ch->dma.workrq_bus + MVS_EPRD_OFFSET + > - (MVS_EPRD_SIZE * slot->slot); > + eprd = ch->dma.workrq_bus + slot->eprd_offset; > ATA_OUTL(ch->r_mem, DMA_DTLBA, eprd); > ATA_OUTL(ch->r_mem, DMA_DTHBA, (eprd >> 16) >> 16); > ATA_OUTL(ch->r_mem, DMA_C, DMA_C_START | > @@ -1433,7 +1431,7 @@ mvs_execute_transaction(struct mvs_slot *slot) > int i; > > /* Get address of the prepared EPRD */ > - eprd = ch->dma.workrq_bus + MVS_EPRD_OFFSET + (MVS_EPRD_SIZE * slot->slot); > + eprd = ch->dma.workrq_bus + slot->eprd_offset; > /* Prepare CRQB. Gen IIe uses different CRQB format. */ > if (ch->quirks & MVS_Q_GENIIE) { > crqb2e = (struct mvs_crqb_gen2e *) > @@ -2423,7 +2421,7 @@ mvsaction(struct cam_sim *sim, union ccb *ccb) > cpi->transport_version = XPORT_VERSION_UNSPECIFIED; > cpi->protocol = PROTO_ATA; > cpi->protocol_version = PROTO_VERSION_UNSPECIFIED; > - cpi->maxio = MAXPHYS; > + cpi->maxio = maxphys; > if ((ch->quirks & MVS_Q_SOC) == 0) { > cpi->hba_vendor = pci_get_vendor(parent); > cpi->hba_device = pci_get_device(parent); > > Modified: head/sys/dev/mvs/mvs.h > ============================================================================== > --- head/sys/dev/mvs/mvs.h Sat Nov 28 10:38:00 2020 (r368123) > +++ head/sys/dev/mvs/mvs.h Sat Nov 28 12:12:51 2020 (r368124) > @@ -392,7 +392,7 @@ > #define MVS_MAX_SLOTS 32 > > /* Pessimistic prognosis on number of required S/G entries */ > -#define MVS_SG_ENTRIES (btoc(MAXPHYS) + 1) > +#define MVS_SG_ENTRIES (btoc(maxphys) + 1) > > /* EDMA Command Request Block (CRQB) Data */ > struct mvs_crqb { > @@ -505,6 +505,7 @@ struct mvs_slot { > int slot; /* Number of this slot */ > int tag; /* Used command tag */ > enum mvs_slot_states state; /* Slot state */ > + u_int eprd_offset; /* EPRD offset */ > union ccb *ccb; /* CCB occupying slot */ > struct ata_dmaslot dma; /* DMA data of this slot */ > struct callout timeout; /* Execution timeout */ > > Modified: head/sys/dev/nvme/nvme.h > ============================================================================== > --- head/sys/dev/nvme/nvme.h Sat Nov 28 10:38:00 2020 (r368123) > +++ head/sys/dev/nvme/nvme.h Sat Nov 28 12:12:51 2020 (r368124) > @@ -60,7 +60,7 @@ > #define NVME_GLOBAL_NAMESPACE_TAG ((uint32_t)0xFFFFFFFF) > > /* Cap nvme to 1MB transfers driver explodes with larger sizes */ > -#define NVME_MAX_XFER_SIZE (MAXPHYS < (1<<20) ? MAXPHYS : (1<<20)) > +#define NVME_MAX_XFER_SIZE (maxphys < (1<<20) ? maxphys : (1<<20)) > > /* Register field definitions */ > #define NVME_CAP_LO_REG_MQES_SHIFT (0) > > Modified: head/sys/dev/nvme/nvme_ctrlr.c > ============================================================================== > --- head/sys/dev/nvme/nvme_ctrlr.c Sat Nov 28 10:38:00 2020 (r368123) > +++ head/sys/dev/nvme/nvme_ctrlr.c Sat Nov 28 12:12:51 2020 (r368124) > @@ -1248,13 +1248,13 @@ nvme_ctrlr_passthrough_cmd(struct nvme_controller *ctr > if (pt->len > 0) { > /* > * vmapbuf calls vm_fault_quick_hold_pages which only maps full > - * pages. Ensure this request has fewer than MAXPHYS bytes when > + * pages. Ensure this request has fewer than maxphys bytes when > * extended to full pages. > */ > addr = (vm_offset_t)pt->buf; > end = round_page(addr + pt->len); > addr = trunc_page(addr); > - if (end - addr > MAXPHYS) > + if (end - addr > maxphys) > return EIO; > > if (pt->len > ctrlr->max_xfer_size) { > > Modified: head/sys/dev/pms/freebsd/driver/ini/src/agdef.h > ============================================================================== > --- head/sys/dev/pms/freebsd/driver/ini/src/agdef.h Sat Nov 28 10:38:00 2020 (r368123) > +++ head/sys/dev/pms/freebsd/driver/ini/src/agdef.h Sat Nov 28 12:12:51 2020 (r368124) > @@ -62,7 +62,7 @@ EW 09-17-2004 1.0.0 Constant definitions > #define AGTIAPI_MAX_DEVICE_7H 256 /*Max devices per channel in 7H */ > #define AGTIAPI_MAX_DEVICE_8H 512 /*Max devices per channel in 8H*/ > #define AGTIAPI_MAX_CAM_Q_DEPTH 1024 > -#define AGTIAPI_NSEGS (MAXPHYS / PAGE_SIZE) > +#define AGTIAPI_NSEGS (maxphys / PAGE_SIZE) > /* > ** Adapter specific defines > */ > > Modified: head/sys/dev/pms/freebsd/driver/ini/src/agtiapi.c > ============================================================================== > --- head/sys/dev/pms/freebsd/driver/ini/src/agtiapi.c Sat Nov 28 10:38:00 2020 (r368123) > +++ head/sys/dev/pms/freebsd/driver/ini/src/agtiapi.c Sat Nov 28 12:12:51 2020 (r368124) > @@ -1623,8 +1623,8 @@ int agtiapi_alloc_requests( struct agtiapi_softc *pmcs > > nsegs = AGTIAPI_NSEGS; > rsize = AGTIAPI_MAX_DMA_SEGS; // 128 > - AGTIAPI_PRINTK( "agtiapi_alloc_requests: MAXPHYS 0x%x PAGE_SIZE 0x%x \n", > - MAXPHYS, PAGE_SIZE ); > + AGTIAPI_PRINTK( "agtiapi_alloc_requests: maxphys 0x%lx PAGE_SIZE 0x%x \n", > + maxphys, PAGE_SIZE ); > AGTIAPI_PRINTK( "agtiapi_alloc_requests: nsegs %d rsize %d \n", > nsegs, rsize ); // 32, 128 > // This is for csio->data_ptr > > Modified: head/sys/dev/sdhci/sdhci.c > ============================================================================== > --- head/sys/dev/sdhci/sdhci.c Sat Nov 28 10:38:00 2020 (r368123) > +++ head/sys/dev/sdhci/sdhci.c Sat Nov 28 12:12:51 2020 (r368124) > @@ -722,19 +722,19 @@ sdhci_dma_alloc(struct sdhci_slot *slot) > int err; > > if (!(slot->quirks & SDHCI_QUIRK_BROKEN_SDMA_BOUNDARY)) { > - if (MAXPHYS <= 1024 * 4) > + if (maxphys <= 1024 * 4) > slot->sdma_boundary = SDHCI_BLKSZ_SDMA_BNDRY_4K; > - else if (MAXPHYS <= 1024 * 8) > + else if (maxphys <= 1024 * 8) > slot->sdma_boundary = SDHCI_BLKSZ_SDMA_BNDRY_8K; > - else if (MAXPHYS <= 1024 * 16) > + else if (maxphys <= 1024 * 16) > slot->sdma_boundary = SDHCI_BLKSZ_SDMA_BNDRY_16K; > - else if (MAXPHYS <= 1024 * 32) > + else if (maxphys <= 1024 * 32) > slot->sdma_boundary = SDHCI_BLKSZ_SDMA_BNDRY_32K; > - else if (MAXPHYS <= 1024 * 64) > + else if (maxphys <= 1024 * 64) > slot->sdma_boundary = SDHCI_BLKSZ_SDMA_BNDRY_64K; > - else if (MAXPHYS <= 1024 * 128) > + else if (maxphys <= 1024 * 128) > slot->sdma_boundary = SDHCI_BLKSZ_SDMA_BNDRY_128K; > - else if (MAXPHYS <= 1024 * 256) > + else if (maxphys <= 1024 * 256) > slot->sdma_boundary = SDHCI_BLKSZ_SDMA_BNDRY_256K; > else > slot->sdma_boundary = SDHCI_BLKSZ_SDMA_BNDRY_512K; > @@ -2534,7 +2534,7 @@ sdhci_cam_action(struct cam_sim *sim, union ccb *ccb) > > switch (ccb->ccb_h.func_code) { > case XPT_PATH_INQ: > - mmc_path_inq(&ccb->cpi, "Deglitch Networks", sim, MAXPHYS); > + mmc_path_inq(&ccb->cpi, "Deglitch Networks", sim, maxphys); > break; > > case XPT_GET_TRAN_SETTINGS: > > Modified: head/sys/dev/siis/siis.c > ============================================================================== > --- head/sys/dev/siis/siis.c Sat Nov 28 10:38:00 2020 (r368123) > +++ head/sys/dev/siis/siis.c Sat Nov 28 12:12:51 2020 (r368124) > @@ -688,8 +688,7 @@ siis_dmainit(device_t dev) > if (bus_dma_tag_create(bus_get_dma_tag(dev), 1, 0, > BUS_SPACE_MAXADDR, BUS_SPACE_MAXADDR, > NULL, NULL, > - SIIS_SG_ENTRIES * PAGE_SIZE * SIIS_MAX_SLOTS, > - SIIS_SG_ENTRIES, 0xFFFFFFFF, > + SIIS_SG_ENTRIES * PAGE_SIZE, SIIS_SG_ENTRIES, 0xFFFFFFFF, > 0, busdma_lock_mutex, &ch->mtx, &ch->dma.data_tag)) { > goto error; > } > @@ -745,6 +744,7 @@ siis_slotsalloc(device_t dev) > slot->dev = dev; > slot->slot = i; > slot->state = SIIS_SLOT_EMPTY; > + slot->prb_offset = SIIS_PRB_SIZE * i; > slot->ccb = NULL; > callout_init_mtx(&slot->timeout, &ch->mtx, 0); > > @@ -1034,8 +1034,7 @@ siis_dmasetprd(void *arg, bus_dma_segment_t *segs, int > slot->dma.nsegs = nsegs; > if (nsegs != 0) { > /* Get a piece of the workspace for this request */ > - ctp = (struct siis_cmd *)(ch->dma.work + SIIS_CT_OFFSET + > - (SIIS_CT_SIZE * slot->slot)); > + ctp = (struct siis_cmd *)(ch->dma.work + slot->prb_offset); > /* Fill S/G table */ > if (slot->ccb->ccb_h.func_code == XPT_ATA_IO) > prd = &ctp->u.ata.prd[0]; > @@ -1066,8 +1065,7 @@ siis_execute_transaction(struct siis_slot *slot) > > mtx_assert(&ch->mtx, MA_OWNED); > /* Get a piece of the workspace for this request */ > - ctp = (struct siis_cmd *) > - (ch->dma.work + SIIS_CT_OFFSET + (SIIS_CT_SIZE * slot->slot)); > + ctp = (struct siis_cmd *)(ch->dma.work + slot->prb_offset); > ctp->control = 0; > ctp->protocol_override = 0; > ctp->transfer_count = 0; > @@ -1117,8 +1115,7 @@ siis_execute_transaction(struct siis_slot *slot) > /* Issue command to the controller. */ > slot->state = SIIS_SLOT_RUNNING; > ch->rslots |= (1 << slot->slot); > - prb_bus = ch->dma.work_bus + > - SIIS_CT_OFFSET + (SIIS_CT_SIZE * slot->slot); > + prb_bus = ch->dma.work_bus + slot->prb_offset; > ATA_OUTL(ch->r_mem, SIIS_P_CACTL(slot->slot), prb_bus); > ATA_OUTL(ch->r_mem, SIIS_P_CACTH(slot->slot), prb_bus >> 32); > /* Start command execution timeout */ > @@ -1967,7 +1964,7 @@ siisaction(struct cam_sim *sim, union ccb *ccb) > cpi->transport_version = XPORT_VERSION_UNSPECIFIED; > cpi->protocol = PROTO_ATA; > cpi->protocol_version = PROTO_VERSION_UNSPECIFIED; > - cpi->maxio = MAXPHYS; > + cpi->maxio = maxphys; > cpi->hba_vendor = pci_get_vendor(parent); > cpi->hba_device = pci_get_device(parent); > cpi->hba_subvendor = pci_get_subvendor(parent); > > Modified: head/sys/dev/siis/siis.h > ============================================================================== > --- head/sys/dev/siis/siis.h Sat Nov 28 10:38:00 2020 (r368123) > +++ head/sys/dev/siis/siis.h Sat Nov 28 12:12:51 2020 (r368124) > @@ -263,18 +263,12 @@ > #define SIIS_OFFSET 0x100 > #define SIIS_STEP 0x80 > > -/* Just to be sure, if building as module. */ > -#if MAXPHYS < 512 * 1024 > -#undef MAXPHYS > -#define MAXPHYS 512 * 1024 > -#endif > /* Pessimistic prognosis on number of required S/G entries */ > -#define SIIS_SG_ENTRIES (roundup(btoc(MAXPHYS), 4) + 1) > -/* Command tables. Up to 32 commands, Each, 128byte aligned. */ > -#define SIIS_CT_OFFSET 0 > -#define SIIS_CT_SIZE (32 + 16 + SIIS_SG_ENTRIES * 16) > +#define SIIS_SG_ENTRIES (roundup(btoc(maxphys), 4) + 1) > +/* Port Request Block + S/G entries. 128byte aligned. */ > +#define SIIS_PRB_SIZE (32 + 16 + SIIS_SG_ENTRIES * 16) > /* Total main work area. */ > -#define SIIS_WORK_SIZE (SIIS_CT_OFFSET + SIIS_CT_SIZE * SIIS_MAX_SLOTS) > +#define SIIS_WORK_SIZE (SIIS_PRB_SIZE * SIIS_MAX_SLOTS) > > struct siis_dma_prd { > u_int64_t dba; > @@ -287,12 +281,12 @@ struct siis_dma_prd { > } __packed; > > struct siis_cmd_ata { > - struct siis_dma_prd prd[1 + SIIS_SG_ENTRIES]; > + struct siis_dma_prd prd[2]; > } __packed; > > struct siis_cmd_atapi { > u_int8_t ccb[16]; > - struct siis_dma_prd prd[SIIS_SG_ENTRIES]; > + struct siis_dma_prd prd[1]; > } __packed; > > struct siis_cmd { > @@ -349,6 +343,7 @@ struct siis_slot { > device_t dev; /* Device handle */ > u_int8_t slot; /* Number of this slot */ > enum siis_slot_states state; /* Slot state */ > + u_int prb_offset; /* PRB offset */ > union ccb *ccb; /* CCB occupying slot */ > struct ata_dmaslot dma; /* DMA data of this slot */ > struct callout timeout; /* Execution timeout */ > > Modified: head/sys/dev/sym/sym_conf.h > ============================================================================== > --- head/sys/dev/sym/sym_conf.h Sat Nov 28 10:38:00 2020 (r368123) > +++ head/sys/dev/sym/sym_conf.h Sat Nov 28 12:12:51 2020 (r368124) > @@ -95,9 +95,9 @@ > * Max number of scatter/gather entries for an I/O. > * Each entry costs 8 bytes in the internal CCB data structure. > * We use at most 33 segments but also no more than required for handling > - * MAXPHYS. > + * legacy MAXPHYS == 128 * 1024. > */ > -#define SYM_CONF_MAX_SG (MIN(33, (MAXPHYS / PAGE_SIZE) + 1)) > +#define SYM_CONF_MAX_SG (MIN(33, (128 * 1024 / PAGE_SIZE) + 1)) > > /* > * Max number of targets. > > *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** > From owner-svn-src-head@freebsd.org Sun Nov 29 13:27:26 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 77F674A2787; Sun, 29 Nov 2020 13:27:26 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CkTgL28Hzz4cWT; Sun, 29 Nov 2020 13:27:26 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3CC6A121B4; Sun, 29 Nov 2020 13:27:26 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0ATDRQsv048051; Sun, 29 Nov 2020 13:27:26 GMT (envelope-from melifaro@FreeBSD.org) Received: (from melifaro@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0ATDRPNU048047; Sun, 29 Nov 2020 13:27:25 GMT (envelope-from melifaro@FreeBSD.org) Message-Id: <202011291327.0ATDRPNU048047@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: melifaro set sender to melifaro@FreeBSD.org using -f From: "Alexander V. Chernikov" Date: Sun, 29 Nov 2020 13:27:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368146 - head/sys/net/route X-SVN-Group: head X-SVN-Commit-Author: melifaro X-SVN-Commit-Paths: head/sys/net/route X-SVN-Commit-Revision: 368146 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Nov 2020 13:27:26 -0000 Author: melifaro Date: Sun Nov 29 13:27:24 2020 New Revision: 368146 URL: https://svnweb.freebsd.org/changeset/base/368146 Log: Add tracking for rib/nhops/nhgrp objects and provide cumulative number accessors. The resulting KPI can be used by routing table consumers to estimate the required scale for route table export. * Add tracking for rib routes * Add accessors for number of nexthops/nexthop objects * Simplify rib_unsubscribe: store rnh we're attached to instead of requiring it up again on destruction. This helps in the cases when rnh is not linked yet/already unlinked. Differential Revision: https://reviews.freebsd.org/D27404 Modified: head/sys/net/route/nhgrp_ctl.c head/sys/net/route/nhop_ctl.c head/sys/net/route/route_ctl.c head/sys/net/route/route_ctl.h head/sys/net/route/route_var.h Modified: head/sys/net/route/nhgrp_ctl.c ============================================================================== --- head/sys/net/route/nhgrp_ctl.c Sun Nov 29 10:36:56 2020 (r368145) +++ head/sys/net/route/nhgrp_ctl.c Sun Nov 29 13:27:24 2020 (r368146) @@ -762,6 +762,21 @@ nhgrp_get_idx(const struct nhgrp_object *nhg) return (nhg_priv->nhg_idx); } +uint32_t +nhgrp_get_count(struct rib_head *rh) +{ + struct nh_control *ctl; + uint32_t count; + + ctl = rh->nh_control; + + NHOPS_RLOCK(ctl); + count = ctl->gr_head.items_count; + NHOPS_RUNLOCK(ctl); + + return (count); +} + int nhgrp_dump_sysctl(struct rib_head *rh, struct sysctl_req *w) { Modified: head/sys/net/route/nhop_ctl.c ============================================================================== --- head/sys/net/route/nhop_ctl.c Sun Nov 29 10:36:56 2020 (r368145) +++ head/sys/net/route/nhop_ctl.c Sun Nov 29 13:27:24 2020 (r368146) @@ -852,6 +852,21 @@ dump_nhop_entry(struct rib_head *rh, struct nhop_objec return (error); } +uint32_t +nhops_get_count(struct rib_head *rh) +{ + struct nh_control *ctl; + uint32_t count; + + ctl = rh->nh_control; + + NHOPS_RLOCK(ctl); + count = ctl->nh_head.items_count; + NHOPS_RUNLOCK(ctl); + + return (count); +} + int nhops_dump_sysctl(struct rib_head *rh, struct sysctl_req *w) { Modified: head/sys/net/route/route_ctl.c ============================================================================== --- head/sys/net/route/route_ctl.c Sun Nov 29 10:36:56 2020 (r368145) +++ head/sys/net/route/route_ctl.c Sun Nov 29 13:27:24 2020 (r368146) @@ -70,6 +70,7 @@ struct rib_subscription { CK_STAILQ_ENTRY(rib_subscription) next; rib_subscription_cb_t *func; void *arg; + struct rib_head *rnh; enum rib_subscription_type type; struct epoch_context epoch_ctx; }; @@ -669,6 +670,8 @@ rt_unlinkrte(struct rib_head *rnh, struct rt_addrinfo /* Finalize notification */ rnh->rnh_gen++; + rnh->rnh_prefixes--; + rc->rc_cmd = RTM_DELETE; rc->rc_rt = rt; rc->rc_nh_old = rt->rt_nhop; @@ -929,6 +932,7 @@ add_route_nhop(struct rib_head *rnh, struct rtentry *r /* Finalize notification */ rnh->rnh_gen++; + rnh->rnh_prefixes++; rc->rc_cmd = RTM_ADD; rc->rc_rt = rt; @@ -984,6 +988,8 @@ change_route_nhop(struct rib_head *rnh, struct rtentry /* Finalize notification */ rnh->rnh_gen++; + if (rnd->rnd_nhop == NULL) + rnh->rnh_prefixes--; rc->rc_cmd = (rnd->rnd_nhop != NULL) ? RTM_CHANGE : RTM_DELETE; rc->rc_rt = rt; @@ -1222,7 +1228,7 @@ allocate_subscription(rib_subscription_cb_t *f, void * enum rib_subscription_type type, bool waitok) { struct rib_subscription *rs; - int flags = M_ZERO | (waitok ? M_WAITOK : 0); + int flags = M_ZERO | (waitok ? M_WAITOK : M_NOWAIT); rs = malloc(sizeof(struct rib_subscription), M_RTABLE, flags); if (rs == NULL) @@ -1246,22 +1252,14 @@ rib_subscribe(uint32_t fibnum, int family, rib_subscri enum rib_subscription_type type, bool waitok) { struct rib_head *rnh; - struct rib_subscription *rs; struct epoch_tracker et; - if ((rs = allocate_subscription(f, arg, type, waitok)) == NULL) - return (NULL); - NET_EPOCH_ENTER(et); KASSERT((fibnum < rt_numfibs), ("%s: bad fibnum", __func__)); rnh = rt_tables_get_rnh(fibnum, family); - - RIB_WLOCK(rnh); - CK_STAILQ_INSERT_TAIL(&rnh->rnh_subscribers, rs, next); - RIB_WUNLOCK(rnh); NET_EPOCH_EXIT(et); - return (rs); + return (rib_subscribe_internal(rnh, f, arg, type, waitok)); } struct rib_subscription * @@ -1273,6 +1271,7 @@ rib_subscribe_internal(struct rib_head *rnh, rib_subsc if ((rs = allocate_subscription(f, arg, type, waitok)) == NULL) return (NULL); + rs->rnh = rnh; NET_EPOCH_ENTER(et); RIB_WLOCK(rnh); @@ -1284,32 +1283,22 @@ rib_subscribe_internal(struct rib_head *rnh, rib_subsc } /* - * Remove rtable subscription @rs from the table specified by @fibnum - * and @family. + * Remove rtable subscription @rs from the routing table. * Needs to be run in network epoch. - * - * Returns 0 on success. */ -int -rib_unsibscribe(uint32_t fibnum, int family, struct rib_subscription *rs) +void +rib_unsibscribe(struct rib_subscription *rs) { - struct rib_head *rnh; + struct rib_head *rnh = rs->rnh; NET_EPOCH_ASSERT(); - KASSERT((fibnum < rt_numfibs), ("%s: bad fibnum", __func__)); - rnh = rt_tables_get_rnh(fibnum, family); - if (rnh == NULL) - return (ENOENT); - RIB_WLOCK(rnh); CK_STAILQ_REMOVE(&rnh->rnh_subscribers, rs, rib_subscription, next); RIB_WUNLOCK(rnh); epoch_call(net_epoch_preempt, destroy_subscription_epoch, &rs->epoch_ctx); - - return (0); } /* Modified: head/sys/net/route/route_ctl.h ============================================================================== --- head/sys/net/route/route_ctl.h Sun Nov 29 10:36:56 2020 (r368145) +++ head/sys/net/route/route_ctl.h Sun Nov 29 13:27:24 2020 (r368146) @@ -87,13 +87,18 @@ const struct rtentry *rib_lookup_prefix(uint32_t fibnu const struct rtentry *rib_lookup_lpm(uint32_t fibnum, int family, const struct sockaddr *dst, struct route_nhop_data *rnd); +/* Nexthops */ +uint32_t nhops_get_count(struct rib_head *rh); + /* Multipath */ struct nhgrp_object; struct weightened_nhop; struct weightened_nhop *nhgrp_get_nhops(struct nhgrp_object *nhg, uint32_t *pnum_nhops); +uint32_t nhgrp_get_count(struct rib_head *rh); +/* Route subscriptions */ enum rib_subscription_type { RIB_NOTIFY_IMMEDIATE, RIB_NOTIFY_DELAYED @@ -109,6 +114,6 @@ struct rib_subscription *rib_subscribe(uint32_t fibnum struct rib_subscription *rib_subscribe_internal(struct rib_head *rnh, rib_subscription_cb_t *f, void *arg, enum rib_subscription_type type, bool waitok); -int rib_unsibscribe(uint32_t fibnum, int family, struct rib_subscription *rs); +void rib_unsibscribe(struct rib_subscription *rs); #endif Modified: head/sys/net/route/route_var.h ============================================================================== --- head/sys/net/route/route_var.h Sun Nov 29 10:36:56 2020 (r368145) +++ head/sys/net/route/route_var.h Sun Nov 29 13:27:24 2020 (r368146) @@ -70,6 +70,7 @@ struct rib_head { u_int rib_fibnum; /* fib number */ struct callout expire_callout; /* Callout for expiring dynamic routes */ time_t next_expire; /* Next expire run ts */ + uint32_t rnh_prefixes; /* Number of prefixes */ struct nh_control *nh_control; /* nexthop subsystem data */ CK_STAILQ_HEAD(, rib_subscription) rnh_subscribers;/* notification subscribers */ }; From owner-svn-src-head@freebsd.org Sun Nov 29 13:41:51 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 252634A2D2F; Sun, 29 Nov 2020 13:41:51 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CkTzz0Nthz4dPt; Sun, 29 Nov 2020 13:41:51 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0093E12161; Sun, 29 Nov 2020 13:41:51 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0ATDfooA058416; Sun, 29 Nov 2020 13:41:50 GMT (envelope-from melifaro@FreeBSD.org) Received: (from melifaro@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0ATDfoCd058411; Sun, 29 Nov 2020 13:41:50 GMT (envelope-from melifaro@FreeBSD.org) Message-Id: <202011291341.0ATDfoCd058411@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: melifaro set sender to melifaro@FreeBSD.org using -f From: "Alexander V. Chernikov" Date: Sun, 29 Nov 2020 13:41:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368147 - in head/sys: net netinet netinet6 X-SVN-Group: head X-SVN-Commit-Author: melifaro X-SVN-Commit-Paths: in head/sys: net netinet netinet6 X-SVN-Commit-Revision: 368147 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Nov 2020 13:41:51 -0000 Author: melifaro Date: Sun Nov 29 13:41:49 2020 New Revision: 368147 URL: https://svnweb.freebsd.org/changeset/base/368147 Log: Refactor fib4/fib6 functions. No functional changes. * Make lookup path of fib<4|6>_lookup_debugnet() separate functions (fib<46>_lookup_rt()). These will be used in the control plane code requiring unlocked radix operations and actual prefix pointer. * Make lookup part of fib<4|6>_check_urpf() separate functions. This change simplifies the switch to alternative lookup implementations, which helps algorithmic lookups introduction. * While here, use static initializers for IPv4/IPv6 keys Differential Revision: https://reviews.freebsd.org/D27405 Modified: head/sys/net/route.h head/sys/netinet/in_fib.c head/sys/netinet/in_fib.h head/sys/netinet6/in6_fib.c head/sys/netinet6/in6_fib.h Modified: head/sys/net/route.h ============================================================================== --- head/sys/net/route.h Sun Nov 29 13:27:24 2020 (r368146) +++ head/sys/net/route.h Sun Nov 29 13:41:49 2020 (r368147) @@ -230,6 +230,7 @@ VNET_DECLARE(u_int, fib_hash_outbound); /* Control plane route request flags */ #define NHR_COPY 0x100 /* Copy rte data */ +#define NHR_UNLOCKED 0x200 /* Do not lock table */ /* * Routing statistics. Modified: head/sys/netinet/in_fib.c ============================================================================== --- head/sys/netinet/in_fib.c Sun Nov 29 13:27:24 2020 (r368146) +++ head/sys/netinet/in_fib.c Sun Nov 29 13:41:49 2020 (r368147) @@ -75,7 +75,6 @@ struct _hash_5tuple_ipv4 { _Static_assert(sizeof(struct _hash_5tuple_ipv4) == 16, "_hash_5tuple_ipv4 size is wrong"); - uint32_t fib4_calc_software_hash(struct in_addr src, struct in_addr dst, unsigned short src_port, unsigned short dst_port, char proto, @@ -119,11 +118,11 @@ fib4_lookup(uint32_t fibnum, struct in_addr dst, uint3 return (NULL); /* Prepare lookup key */ - struct sockaddr_in sin4; - memset(&sin4, 0, sizeof(sin4)); - sin4.sin_family = AF_INET; - sin4.sin_len = sizeof(struct sockaddr_in); - sin4.sin_addr = dst; + struct sockaddr_in sin4 = { + .sin_family = AF_INET, + .sin_len = sizeof(struct sockaddr_in), + .sin_addr = dst, + }; nh = NULL; RIB_RLOCK(rh); @@ -181,28 +180,18 @@ check_urpf(struct nhop_object *nh, uint32_t flags, return (check_urpf_nhop(nh, flags, src_if)); } -/* - * Performs reverse path forwarding lookup. - * If @src_if is non-zero, verifies that at least 1 path goes via - * this interface. - * If @src_if is zero, verifies that route exist. - * if @flags contains NHR_NOTDEFAULT, do not consider default route. - * - * Returns 1 if route matching conditions is found, 0 otherwise. - */ -int -fib4_check_urpf(uint32_t fibnum, struct in_addr dst, uint32_t scopeid, - uint32_t flags, const struct ifnet *src_if) +static struct nhop_object * +lookup_nhop(uint32_t fibnum, struct in_addr dst, uint32_t scopeid) { RIB_RLOCK_TRACKER; struct rib_head *rh; struct radix_node *rn; - int ret; + struct nhop_object *nh; KASSERT((fibnum < rt_numfibs), ("fib4_check_urpf: bad fibnum")); rh = rt_tables_get_rnh(fibnum, AF_INET); if (rh == NULL) - return (0); + return (NULL); /* Prepare lookup key */ struct sockaddr_in sin4; @@ -210,49 +199,96 @@ fib4_check_urpf(uint32_t fibnum, struct in_addr dst, u sin4.sin_len = sizeof(struct sockaddr_in); sin4.sin_addr = dst; + nh = NULL; RIB_RLOCK(rh); rn = rh->rnh_matchaddr((void *)&sin4, &rh->head); - if (rn != NULL && ((rn->rn_flags & RNF_ROOT) == 0)) { - ret = check_urpf(RNTORT(rn)->rt_nhop, flags, src_if); - RIB_RUNLOCK(rh); - return (ret); - } + if (rn != NULL && ((rn->rn_flags & RNF_ROOT) == 0)) + nh = RNTORT(rn)->rt_nhop; RIB_RUNLOCK(rh); + return (nh); +} + +/* + * Performs reverse path forwarding lookup. + * If @src_if is non-zero, verifies that at least 1 path goes via + * this interface. + * If @src_if is zero, verifies that route exist. + * if @flags contains NHR_NOTDEFAULT, do not consider default route. + * + * Returns 1 if route matching conditions is found, 0 otherwise. + */ +int +fib4_check_urpf(uint32_t fibnum, struct in_addr dst, uint32_t scopeid, + uint32_t flags, const struct ifnet *src_if) +{ + struct nhop_object *nh; + + nh = lookup_nhop(fibnum, dst, scopeid); + if (nh != NULL) + return (check_urpf(nh, flags, src_if)); + return (0); } -struct nhop_object * -fib4_lookup_debugnet(uint32_t fibnum, struct in_addr dst, uint32_t scopeid, - uint32_t flags) +/* + * Function returning prefix match data along with the nexthop data. + * Intended to be used by the control plane code. + * Supported flags: + * NHR_UNLOCKED: do not lock radix during lookup. + * Returns pointer to rtentry and raw nexthop in @rnd. Both rtentry + * and nexthop are safe to use within current epoch. Note: + * Note: rnd_nhop can actually be the nexthop group. + */ +struct rtentry * +fib4_lookup_rt(uint32_t fibnum, struct in_addr dst, uint32_t scopeid, + uint32_t flags, struct route_nhop_data *rnd) { + RIB_RLOCK_TRACKER; struct rib_head *rh; struct radix_node *rn; - struct nhop_object *nh; + struct rtentry *rt; - KASSERT((fibnum < rt_numfibs), ("fib4_lookup_debugnet: bad fibnum")); + KASSERT((fibnum < rt_numfibs), ("fib4_lookup_rt: bad fibnum")); rh = rt_tables_get_rnh(fibnum, AF_INET); if (rh == NULL) return (NULL); /* Prepare lookup key */ - struct sockaddr_in sin4; - memset(&sin4, 0, sizeof(sin4)); - sin4.sin_family = AF_INET; - sin4.sin_len = sizeof(struct sockaddr_in); - sin4.sin_addr = dst; + struct sockaddr_in sin4 = { + .sin_family = AF_INET, + .sin_len = sizeof(struct sockaddr_in), + .sin_addr = dst, + }; - nh = NULL; - /* unlocked lookup */ + rt = NULL; + if (!(flags & NHR_UNLOCKED)) + RIB_RLOCK(rh); rn = rh->rnh_matchaddr((void *)&sin4, &rh->head); if (rn != NULL && ((rn->rn_flags & RNF_ROOT) == 0)) { - nh = nhop_select((RNTORT(rn))->rt_nhop, 0); + rt = (struct rtentry *)rn; + rnd->rnd_nhop = rt->rt_nhop; + rnd->rnd_weight = rt->rt_weight; + } + if (!(flags & NHR_UNLOCKED)) + RIB_RUNLOCK(rh); + + return (rt); +} + +struct nhop_object * +fib4_lookup_debugnet(uint32_t fibnum, struct in_addr dst, uint32_t scopeid, + uint32_t flags) +{ + struct rtentry *rt; + struct route_nhop_data rnd; + + rt = fib4_lookup_rt(fibnum, dst, scopeid, NHR_UNLOCKED, &rnd); + if (rt != NULL) { + struct nhop_object *nh = nhop_select(rnd.rnd_nhop, 0); /* Ensure route & ifp is UP */ - if (RT_LINK_IS_UP(nh->nh_ifp)) { - if (flags & NHR_REF) - nhop_ref_object(nh); + if (RT_LINK_IS_UP(nh->nh_ifp)) return (nh); - } } return (NULL); Modified: head/sys/netinet/in_fib.h ============================================================================== --- head/sys/netinet/in_fib.h Sun Nov 29 13:27:24 2020 (r368146) +++ head/sys/netinet/in_fib.h Sun Nov 29 13:41:49 2020 (r368147) @@ -45,10 +45,15 @@ struct route_in { struct sockaddr_in ro_dst4; }; +struct rtentry; +struct route_nhop_data; + struct nhop_object *fib4_lookup(uint32_t fibnum, struct in_addr dst, uint32_t scopeid, uint32_t flags, uint32_t flowid); int fib4_check_urpf(uint32_t fibnum, struct in_addr dst, uint32_t scopeid, uint32_t flags, const struct ifnet *src_if); +struct rtentry *fib4_lookup_rt(uint32_t fibnum, struct in_addr dst, uint32_t scopeid, + uint32_t flags, struct route_nhop_data *nrd); struct nhop_object *fib4_lookup_debugnet(uint32_t fibnum, struct in_addr dst, uint32_t scopeid, uint32_t flags); uint32_t fib4_calc_software_hash(struct in_addr src, struct in_addr dst, Modified: head/sys/netinet6/in6_fib.c ============================================================================== --- head/sys/netinet6/in6_fib.c Sun Nov 29 13:27:24 2020 (r368146) +++ head/sys/netinet6/in6_fib.c Sun Nov 29 13:41:49 2020 (r368147) @@ -119,19 +119,16 @@ fib6_lookup(uint32_t fibnum, const struct in6_addr *ds struct rib_head *rh; struct radix_node *rn; struct nhop_object *nh; - struct sockaddr_in6 sin6; KASSERT((fibnum < rt_numfibs), ("fib6_lookup: bad fibnum")); rh = rt_tables_get_rnh(fibnum, AF_INET6); if (rh == NULL) return (NULL); - /* TODO: radix changes */ - //addr = *dst6; - /* Prepare lookup key */ - memset(&sin6, 0, sizeof(sin6)); - sin6.sin6_len = sizeof(struct sockaddr_in6); - sin6.sin6_addr = *dst6; + struct sockaddr_in6 sin6 = { + .sin6_len = sizeof(struct sockaddr_in6), + .sin6_addr = *dst6, + }; /* Assume scopeid is valid and embed it directly */ if (IN6_IS_SCOPE_LINKLOCAL(dst6)) @@ -192,86 +189,121 @@ check_urpf(struct nhop_object *nh, uint32_t flags, return (check_urpf_nhop(nh, flags, src_if)); } -/* - * Performs reverse path forwarding lookup. - * If @src_if is non-zero, verifies that at least 1 path goes via - * this interface. - * If @src_if is zero, verifies that route exist. - * if @flags contains NHR_NOTDEFAULT, do not consider default route. - * - * Returns 1 if route matching conditions is found, 0 otherwise. - */ -int -fib6_check_urpf(uint32_t fibnum, const struct in6_addr *dst6, - uint32_t scopeid, uint32_t flags, const struct ifnet *src_if) +static struct nhop_object * +lookup_nhop(uint32_t fibnum, const struct in6_addr *dst6, + uint32_t scopeid) { RIB_RLOCK_TRACKER; struct rib_head *rh; struct radix_node *rn; - struct sockaddr_in6 sin6; - int ret; + struct nhop_object *nh; KASSERT((fibnum < rt_numfibs), ("fib6_check_urpf: bad fibnum")); rh = rt_tables_get_rnh(fibnum, AF_INET6); if (rh == NULL) - return (0); + return (NULL); - /* TODO: radix changes */ /* Prepare lookup key */ - memset(&sin6, 0, sizeof(sin6)); - sin6.sin6_len = sizeof(struct sockaddr_in6); - sin6.sin6_addr = *dst6; + struct sockaddr_in6 sin6 = { + .sin6_len = sizeof(struct sockaddr_in6), + .sin6_addr = *dst6, + }; /* Assume scopeid is valid and embed it directly */ if (IN6_IS_SCOPE_LINKLOCAL(dst6)) sin6.sin6_addr.s6_addr16[1] = htons(scopeid & 0xffff); + nh = NULL; RIB_RLOCK(rh); rn = rh->rnh_matchaddr((void *)&sin6, &rh->head); - if (rn != NULL && ((rn->rn_flags & RNF_ROOT) == 0)) { - ret = check_urpf(RNTORT(rn)->rt_nhop, flags, src_if); - RIB_RUNLOCK(rh); - return (ret); - } + if (rn != NULL && ((rn->rn_flags & RNF_ROOT) == 0)) + nh = RNTORT(rn)->rt_nhop; RIB_RUNLOCK(rh); + return (nh); +} + +/* + * Performs reverse path forwarding lookup. + * If @src_if is non-zero, verifies that at least 1 path goes via + * this interface. + * If @src_if is zero, verifies that route exist. + * if @flags contains NHR_NOTDEFAULT, do not consider default route. + * + * Returns 1 if route matching conditions is found, 0 otherwise. + */ +int +fib6_check_urpf(uint32_t fibnum, const struct in6_addr *dst6, + uint32_t scopeid, uint32_t flags, const struct ifnet *src_if) +{ + struct nhop_object *nh; + + nh = lookup_nhop(fibnum, dst6, scopeid); + if (nh != NULL) + return (check_urpf(nh, flags, src_if)); return (0); } -struct nhop_object * -fib6_lookup_debugnet(uint32_t fibnum, const struct in6_addr *dst6, - uint32_t scopeid, uint32_t flags) +/* + * Function returning prefix match data along with the nexthop data. + * Intended to be used by the control plane code. + * Supported flags: + * NHR_UNLOCKED: do not lock radix during lookup. + * Returns pointer to rtentry and raw nexthop in @rnd. Both rtentry + * and nexthop are safe to use within current epoch. Note: + * Note: rnd_nhop can actually be the nexthop group. + */ +struct rtentry * +fib6_lookup_rt(uint32_t fibnum, const struct in6_addr *dst6, + uint32_t scopeid, uint32_t flags, struct route_nhop_data *rnd) { + RIB_RLOCK_TRACKER; struct rib_head *rh; struct radix_node *rn; - struct nhop_object *nh; - struct sockaddr_in6 sin6; + struct rtentry *rt; KASSERT((fibnum < rt_numfibs), ("fib6_lookup: bad fibnum")); rh = rt_tables_get_rnh(fibnum, AF_INET6); if (rh == NULL) return (NULL); - /* TODO: radix changes */ - //addr = *dst6; - /* Prepare lookup key */ - memset(&sin6, 0, sizeof(sin6)); - sin6.sin6_len = sizeof(struct sockaddr_in6); - sin6.sin6_addr = *dst6; + struct sockaddr_in6 sin6 = { + .sin6_len = sizeof(struct sockaddr_in6), + .sin6_addr = *dst6, + }; /* Assume scopeid is valid and embed it directly */ if (IN6_IS_SCOPE_LINKLOCAL(dst6)) sin6.sin6_addr.s6_addr16[1] = htons(scopeid & 0xffff); + rt = NULL; + if (!(flags & NHR_UNLOCKED)) + RIB_RLOCK(rh); rn = rh->rnh_matchaddr((void *)&sin6, &rh->head); if (rn != NULL && ((rn->rn_flags & RNF_ROOT) == 0)) { - nh = nhop_select((RNTORT(rn))->rt_nhop, 0); + rt = (struct rtentry *)rn; + rnd->rnd_nhop = rt->rt_nhop; + rnd->rnd_weight = rt->rt_weight; + } + if (!(flags & NHR_UNLOCKED)) + RIB_RUNLOCK(rh); + + return (rt); +} + +struct nhop_object * +fib6_lookup_debugnet(uint32_t fibnum, const struct in6_addr *dst6, + uint32_t scopeid, uint32_t flags) +{ + struct rtentry *rt; + struct route_nhop_data rnd; + + rt = fib6_lookup_rt(fibnum, dst6, scopeid, NHR_UNLOCKED, &rnd); + if (rt != NULL) { + struct nhop_object *nh = nhop_select(rnd.rnd_nhop, 0); /* Ensure route & ifp is UP */ - if (RT_LINK_IS_UP(nh->nh_ifp)) { - if (flags & NHR_REF) - nhop_ref_object(nh); + if (RT_LINK_IS_UP(nh->nh_ifp)) return (nh); - } } return (NULL); Modified: head/sys/netinet6/in6_fib.h ============================================================================== --- head/sys/netinet6/in6_fib.h Sun Nov 29 13:27:24 2020 (r368146) +++ head/sys/netinet6/in6_fib.h Sun Nov 29 13:41:49 2020 (r368147) @@ -32,11 +32,16 @@ #ifndef _NETINET6_IN6_FIB_H_ #define _NETINET6_IN6_FIB_H_ +struct rtentry; +struct route_nhop_data; + struct nhop_object *fib6_lookup(uint32_t fibnum, const struct in6_addr *dst6, uint32_t scopeid, uint32_t flags, uint32_t flowid); int fib6_check_urpf(uint32_t fibnum, const struct in6_addr *dst6, uint32_t scopeid, uint32_t flags, const struct ifnet *src_if); +struct rtentry *fib6_lookup_rt(uint32_t fibnum, const struct in6_addr *dst6, + uint32_t scopeid, uint32_t flags, struct route_nhop_data *rnd); struct nhop_object *fib6_lookup_debugnet(uint32_t fibnum, const struct in6_addr *dst6, uint32_t scopeid, uint32_t flags); uint32_t fib6_calc_software_hash(const struct in6_addr *src, From owner-svn-src-head@freebsd.org Sun Nov 29 13:45:54 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7B4984A2C59; Sun, 29 Nov 2020 13:45:54 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CkV4f33mTz4dZG; Sun, 29 Nov 2020 13:45:54 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5C1FB1270A; Sun, 29 Nov 2020 13:45:54 +0000 (UTC) (envelope-from eugen@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0ATDjsIh060307; Sun, 29 Nov 2020 13:45:54 GMT (envelope-from eugen@FreeBSD.org) Received: (from eugen@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0ATDjs9X060306; Sun, 29 Nov 2020 13:45:54 GMT (envelope-from eugen@FreeBSD.org) Message-Id: <202011291345.0ATDjs9X060306@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: eugen set sender to eugen@FreeBSD.org using -f From: Eugene Grosbein Date: Sun, 29 Nov 2020 13:45:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368148 - head/sbin/hastd X-SVN-Group: head X-SVN-Commit-Author: eugen X-SVN-Commit-Paths: head/sbin/hastd X-SVN-Commit-Revision: 368148 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Nov 2020 13:45:54 -0000 Author: eugen Date: Sun Nov 29 13:45:53 2020 New Revision: 368148 URL: https://svnweb.freebsd.org/changeset/base/368148 Log: hastd(8) assumes it has no extra file descriptors opened and aborts otherwise, so call closefrom() early. PR: 227461 MFC after: 2 weeks Modified: head/sbin/hastd/hastd.c Modified: head/sbin/hastd/hastd.c ============================================================================== --- head/sbin/hastd/hastd.c Sun Nov 29 13:41:49 2020 (r368147) +++ head/sbin/hastd/hastd.c Sun Nov 29 13:45:53 2020 (r368148) @@ -1222,6 +1222,7 @@ main(int argc, char *argv[]) pjdlog_init(PJDLOG_MODE_STD); pjdlog_debug_set(debuglevel); + closefrom(MAX(MAX(STDIN_FILENO, STDOUT_FILENO), STDERR_FILENO) + 1); g_gate_load(); /* From owner-svn-src-head@freebsd.org Sun Nov 29 13:52:07 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A6FD84A3063; Sun, 29 Nov 2020 13:52:07 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CkVCq4PgDz4fMc; Sun, 29 Nov 2020 13:52:07 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8A1491298C; Sun, 29 Nov 2020 13:52:07 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0ATDq7cr066438; Sun, 29 Nov 2020 13:52:07 GMT (envelope-from melifaro@FreeBSD.org) Received: (from melifaro@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0ATDq6BZ066436; Sun, 29 Nov 2020 13:52:06 GMT (envelope-from melifaro@FreeBSD.org) Message-Id: <202011291352.0ATDq6BZ066436@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: melifaro set sender to melifaro@FreeBSD.org using -f From: "Alexander V. Chernikov" Date: Sun, 29 Nov 2020 13:52:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368149 - head/sys/net/route X-SVN-Group: head X-SVN-Commit-Author: melifaro X-SVN-Commit-Paths: head/sys/net/route X-SVN-Commit-Revision: 368149 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Nov 2020 13:52:07 -0000 Author: melifaro Date: Sun Nov 29 13:52:06 2020 New Revision: 368149 URL: https://svnweb.freebsd.org/changeset/base/368149 Log: Add nhop_ref_any() to unify referencing nhop or nexthop group. It allows code within routing subsystem to transparently reference nexthops and nexthop groups, similar to nhop_free_any(), abstracting ROUTE_MPATH details. Differential Revision: https://reviews.freebsd.org/D27410 Modified: head/sys/net/route/nhgrp_ctl.c head/sys/net/route/nhop_ctl.c head/sys/net/route/route_var.h Modified: head/sys/net/route/nhgrp_ctl.c ============================================================================== --- head/sys/net/route/nhgrp_ctl.c Sun Nov 29 13:45:53 2020 (r368148) +++ head/sys/net/route/nhgrp_ctl.c Sun Nov 29 13:52:06 2020 (r368149) @@ -294,6 +294,17 @@ alloc_nhgrp(struct weightened_nhop *wn, int num_nhops) } void +nhgrp_ref_object(struct nhgrp_object *nhg) +{ + struct nhgrp_priv *nhg_priv; + u_int old; + + nhg_priv = NHGRP_PRIV(nhg); + old = refcount_acquire(&nhg_priv->nhg_refcount); + KASSERT(old > 0, ("%s: nhgrp object %p has 0 refs", __func__, nhg)); +} + +void nhgrp_free(struct nhgrp_object *nhg) { struct nhgrp_priv *nhg_priv; Modified: head/sys/net/route/nhop_ctl.c ============================================================================== --- head/sys/net/route/nhop_ctl.c Sun Nov 29 13:45:53 2020 (r368148) +++ head/sys/net/route/nhop_ctl.c Sun Nov 29 13:52:06 2020 (r368149) @@ -691,6 +691,19 @@ nhop_free(struct nhop_object *nh) } void +nhop_ref_any(struct nhop_object *nh) +{ +#ifdef ROUTE_MPATH + if (!NH_IS_NHGRP(nh)) + nhop_ref_object(nh); + else + nhgrp_ref_object((struct nhgrp_object *)nh); +#else + nhop_ref_object(nh); +#endif +} + +void nhop_free_any(struct nhop_object *nh) { Modified: head/sys/net/route/route_var.h ============================================================================== --- head/sys/net/route/route_var.h Sun Nov 29 13:45:53 2020 (r368148) +++ head/sys/net/route/route_var.h Sun Nov 29 13:52:06 2020 (r368149) @@ -242,6 +242,7 @@ int nhops_init_rib(struct rib_head *rh); void nhops_destroy_rib(struct rib_head *rh); void nhop_ref_object(struct nhop_object *nh); int nhop_try_ref_object(struct nhop_object *nh); +void nhop_ref_any(struct nhop_object *nh); void nhop_free_any(struct nhop_object *nh); void nhop_set_type(struct nhop_object *nh, enum nhop_type nh_type); @@ -306,6 +307,7 @@ int nhgrp_get_addition_group(struct rib_head *rnh, struct route_nhop_data *rnd_orig, struct route_nhop_data *rnd_add, struct route_nhop_data *rnd_new); +void nhgrp_ref_object(struct nhgrp_object *nhg); uint32_t nhgrp_get_idx(const struct nhgrp_object *nhg); void nhgrp_free(struct nhgrp_object *nhg); From owner-svn-src-head@freebsd.org Sun Nov 29 13:54:50 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3EE824A332C; Sun, 29 Nov 2020 13:54:50 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CkVGy1MqPz4fcG; Sun, 29 Nov 2020 13:54:50 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 174C6122F5; Sun, 29 Nov 2020 13:54:50 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0ATDsnqh066598; Sun, 29 Nov 2020 13:54:49 GMT (envelope-from melifaro@FreeBSD.org) Received: (from melifaro@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0ATDsnvK066596; Sun, 29 Nov 2020 13:54:49 GMT (envelope-from melifaro@FreeBSD.org) Message-Id: <202011291354.0ATDsnvK066596@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: melifaro set sender to melifaro@FreeBSD.org using -f From: "Alexander V. Chernikov" Date: Sun, 29 Nov 2020 13:54:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368150 - head/sys/net/route X-SVN-Group: head X-SVN-Commit-Author: melifaro X-SVN-Commit-Paths: head/sys/net/route X-SVN-Commit-Revision: 368150 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Nov 2020 13:54:50 -0000 Author: melifaro Date: Sun Nov 29 13:54:49 2020 New Revision: 368150 URL: https://svnweb.freebsd.org/changeset/base/368150 Log: Introduce rib_walk_ext_internal() to allow iteration with rnh pointer. This solves the case when rib is not yet attached/detached to/from the system rib array. Differential Revision: https://reviews.freebsd.org/D27406 Modified: head/sys/net/route/route_ctl.h head/sys/net/route/route_helpers.c Modified: head/sys/net/route/route_ctl.h ============================================================================== --- head/sys/net/route/route_ctl.h Sun Nov 29 13:52:06 2020 (r368149) +++ head/sys/net/route/route_ctl.h Sun Nov 29 13:54:49 2020 (r368150) @@ -67,17 +67,19 @@ enum rib_walk_hook { }; typedef int rib_walktree_f_t(struct rtentry *, void *); typedef void rib_walk_hook_f_t(struct rib_head *rnh, enum rib_walk_hook stage, - void *arg); + void *arg); void rib_walk(uint32_t fibnum, int af, bool wlock, rib_walktree_f_t *wa_f, - void *arg); + void *arg); void rib_walk_ext(uint32_t fibnum, int af, bool wlock, rib_walktree_f_t *wa_f, - rib_walk_hook_f_t *hook_f, void *arg); + rib_walk_hook_f_t *hook_f, void *arg); +void rib_walk_ext_internal(struct rib_head *rnh, bool wlock, + rib_walktree_f_t *wa_f, rib_walk_hook_f_t *hook_f, void *arg); void rib_walk_del(u_int fibnum, int family, rib_filter_f_t *filter_f, - void *arg, bool report); + void *arg, bool report); void rib_foreach_table_walk(int family, bool wlock, rib_walktree_f_t *wa_f, - rib_walk_hook_f_t *hook_f, void *arg); + rib_walk_hook_f_t *hook_f, void *arg); void rib_foreach_table_walk_del(int family, rib_filter_f_t *filter_f, void *arg); struct route_nhop_data; Modified: head/sys/net/route/route_helpers.c ============================================================================== --- head/sys/net/route/route_helpers.c Sun Nov 29 13:52:06 2020 (r368149) +++ head/sys/net/route/route_helpers.c Sun Nov 29 13:54:49 2020 (r368150) @@ -77,15 +77,11 @@ __FBSDID("$FreeBSD$"); * Table is traversed under read lock unless @wlock is set. */ void -rib_walk_ext(uint32_t fibnum, int family, bool wlock, rib_walktree_f_t *wa_f, +rib_walk_ext_internal(struct rib_head *rnh, bool wlock, rib_walktree_f_t *wa_f, rib_walk_hook_f_t *hook_f, void *arg) { RIB_RLOCK_TRACKER; - struct rib_head *rnh; - if ((rnh = rt_tables_get_rnh(fibnum, family)) == NULL) - return; - if (wlock) RIB_WLOCK(rnh); else @@ -99,6 +95,16 @@ rib_walk_ext(uint32_t fibnum, int family, bool wlock, RIB_WUNLOCK(rnh); else RIB_RUNLOCK(rnh); +} + +void +rib_walk_ext(uint32_t fibnum, int family, bool wlock, rib_walktree_f_t *wa_f, + rib_walk_hook_f_t *hook_f, void *arg) +{ + struct rib_head *rnh; + + if ((rnh = rt_tables_get_rnh(fibnum, family)) != NULL) + rib_walk_ext_internal(rnh, wlock, wa_f, hook_f, arg); } /* From owner-svn-src-head@freebsd.org Sun Nov 29 15:04:41 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 19CDD4A4FC3; Sun, 29 Nov 2020 15:04:41 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CkWqY0ChWz4kV7; Sun, 29 Nov 2020 15:04:41 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EDB19135A9; Sun, 29 Nov 2020 15:04:40 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0ATF4eHC010178; Sun, 29 Nov 2020 15:04:40 GMT (envelope-from mmel@FreeBSD.org) Received: (from mmel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0ATF4deL010172; Sun, 29 Nov 2020 15:04:39 GMT (envelope-from mmel@FreeBSD.org) Message-Id: <202011291504.0ATF4deL010172@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmel set sender to mmel@FreeBSD.org using -f From: Michal Meloun Date: Sun, 29 Nov 2020 15:04:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368153 - head/sys/arm/arm X-SVN-Group: head X-SVN-Commit-Author: mmel X-SVN-Commit-Paths: head/sys/arm/arm X-SVN-Commit-Revision: 368153 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Nov 2020 15:04:41 -0000 Author: mmel Date: Sun Nov 29 15:04:39 2020 New Revision: 368153 URL: https://svnweb.freebsd.org/changeset/base/368153 Log: Remove remaining support of big endian byte order. Big endian support was ceased by removing ARMv4 sub architecture. Modified: head/sys/arm/arm/bcopyinout_xscale.S head/sys/arm/arm/cpufunc.c head/sys/arm/arm/fusu.S head/sys/arm/arm/in_cksum_arm.S head/sys/arm/arm/support.S head/sys/arm/arm/vm_machdep.c Modified: head/sys/arm/arm/bcopyinout_xscale.S ============================================================================== --- head/sys/arm/arm/bcopyinout_xscale.S Sun Nov 29 14:21:16 2020 (r368152) +++ head/sys/arm/arm/bcopyinout_xscale.S Sun Nov 29 15:04:39 2020 (r368153) @@ -298,25 +298,12 @@ ENTRY(copyin) b .Lcopyin_bad1 .Lcopyin_bad1_loop16: -#ifdef __ARMEB__ - mov r4, ip, lsl #8 -#else mov r4, ip, lsr #8 -#endif ldrt r5, [r0], #0x04 pld [r0, #0x018] ldrt r6, [r0], #0x04 ldrt r7, [r0], #0x04 ldrt ip, [r0], #0x04 -#ifdef __ARMEB__ - orr r4, r4, r5, lsr #24 - mov r5, r5, lsl #8 - orr r5, r5, r6, lsr #24 - mov r6, r6, lsl #8 - orr r6, r6, r7, lsr #24 - mov r7, r7, lsl #8 - orr r7, r7, ip, lsr #24 -#else orr r4, r4, r5, lsl #24 mov r5, r5, lsr #8 orr r5, r5, r6, lsl #24 @@ -324,7 +311,6 @@ ENTRY(copyin) orr r6, r6, r7, lsl #24 mov r7, r7, lsr #8 orr r7, r7, ip, lsl #24 -#endif str r4, [r1], #0x04 str r5, [r1], #0x04 str r6, [r1], #0x04 @@ -341,43 +327,22 @@ ENTRY(copyin) blt .Lcopyin_l4 .Lcopyin_bad1_loop4: -#ifdef __ARMEB__ - mov r4, ip, lsl #8 -#else mov r4, ip, lsr #8 -#endif ldrt ip, [r0], #0x04 subs r2, r2, #0x04 -#ifdef __ARMEB__ - orr r4, r4, ip, lsr #24 -#else orr r4, r4, ip, lsl #24 -#endif str r4, [r1], #0x04 bge .Lcopyin_bad1_loop4 sub r0, r0, #0x03 b .Lcopyin_l4 .Lcopyin_bad2_loop16: -#ifdef __ARMEB__ - mov r4, ip, lsl #16 -#else mov r4, ip, lsr #16 -#endif ldrt r5, [r0], #0x04 pld [r0, #0x018] ldrt r6, [r0], #0x04 ldrt r7, [r0], #0x04 ldrt ip, [r0], #0x04 -#ifdef __ARMEB__ - orr r4, r4, r5, lsr #16 - mov r5, r5, lsl #16 - orr r5, r5, r6, lsr #16 - mov r6, r6, lsl #16 - orr r6, r6, r7, lsr #16 - mov r7, r7, lsl #16 - orr r7, r7, ip, lsr #16 -#else orr r4, r4, r5, lsl #16 mov r5, r5, lsr #16 orr r5, r5, r6, lsl #16 @@ -385,7 +350,6 @@ ENTRY(copyin) orr r6, r6, r7, lsl #16 mov r7, r7, lsr #16 orr r7, r7, ip, lsl #16 -#endif str r4, [r1], #0x04 str r5, [r1], #0x04 str r6, [r1], #0x04 @@ -402,43 +366,22 @@ ENTRY(copyin) blt .Lcopyin_l4 .Lcopyin_bad2_loop4: -#ifdef __ARMEB__ - mov r4, ip, lsl #16 -#else mov r4, ip, lsr #16 -#endif ldrt ip, [r0], #0x04 subs r2, r2, #0x04 -#ifdef __ARMEB__ - orr r4, r4, ip, lsr #16 -#else orr r4, r4, ip, lsl #16 -#endif str r4, [r1], #0x04 bge .Lcopyin_bad2_loop4 sub r0, r0, #0x02 b .Lcopyin_l4 .Lcopyin_bad3_loop16: -#ifdef __ARMEB__ - mov r4, ip, lsl #24 -#else mov r4, ip, lsr #24 -#endif ldrt r5, [r0], #0x04 pld [r0, #0x018] ldrt r6, [r0], #0x04 ldrt r7, [r0], #0x04 ldrt ip, [r0], #0x04 -#ifdef __ARMEB__ - orr r4, r4, r5, lsr #8 - mov r5, r5, lsl #24 - orr r5, r5, r6, lsr #8 - mov r6, r6, lsl #24 - orr r6, r6, r7, lsr #8 - mov r7, r7, lsl #24 - orr r7, r7, ip, lsr #8 -#else orr r4, r4, r5, lsl #8 mov r5, r5, lsr #24 orr r5, r5, r6, lsl #8 @@ -446,7 +389,6 @@ ENTRY(copyin) orr r6, r6, r7, lsl #8 mov r7, r7, lsr #24 orr r7, r7, ip, lsl #8 -#endif str r4, [r1], #0x04 str r5, [r1], #0x04 str r6, [r1], #0x04 @@ -463,18 +405,10 @@ ENTRY(copyin) blt .Lcopyin_l4 .Lcopyin_bad3_loop4: -#ifdef __ARMEB__ - mov r4, ip, lsl #24 -#else mov r4, ip, lsr #24 -#endif ldrt ip, [r0], #0x04 subs r2, r2, #0x04 -#ifdef __ARMEB__ - orr r4, r4, ip, lsr #8 -#else orr r4, r4, ip, lsl #8 -#endif str r4, [r1], #0x04 bge .Lcopyin_bad3_loop4 sub r0, r0, #0x01 @@ -750,25 +684,12 @@ ENTRY(copyout) b .Lcopyout_bad1 .Lcopyout_bad1_loop16: -#ifdef __ARMEB__ - mov r4, ip, lsl #8 -#else mov r4, ip, lsr #8 -#endif ldr r5, [r0], #0x04 pld [r0, #0x018] ldr r6, [r0], #0x04 ldr r7, [r0], #0x04 ldr ip, [r0], #0x04 -#ifdef __ARMEB__ - orr r4, r4, r5, lsr #24 - mov r5, r5, lsl #8 - orr r5, r5, r6, lsr #24 - mov r6, r6, lsl #8 - orr r6, r6, r7, lsr #24 - mov r7, r7, lsl #8 - orr r7, r7, ip, lsr #24 -#else orr r4, r4, r5, lsl #24 mov r5, r5, lsr #8 orr r5, r5, r6, lsl #24 @@ -776,7 +697,6 @@ ENTRY(copyout) orr r6, r6, r7, lsl #24 mov r7, r7, lsr #8 orr r7, r7, ip, lsl #24 -#endif strt r4, [r1], #0x04 strt r5, [r1], #0x04 strt r6, [r1], #0x04 @@ -793,43 +713,22 @@ ENTRY(copyout) blt .Lcopyout_l4 .Lcopyout_bad1_loop4: -#ifdef __ARMEB__ - mov r4, ip, lsl #8 -#else mov r4, ip, lsr #8 -#endif ldr ip, [r0], #0x04 subs r2, r2, #0x04 -#ifdef __ARMEB__ - orr r4, r4, ip, lsr #24 -#else orr r4, r4, ip, lsl #24 -#endif strt r4, [r1], #0x04 bge .Lcopyout_bad1_loop4 sub r0, r0, #0x03 b .Lcopyout_l4 .Lcopyout_bad2_loop16: -#ifdef __ARMEB__ - mov r4, ip, lsl #16 -#else mov r4, ip, lsr #16 -#endif ldr r5, [r0], #0x04 pld [r0, #0x018] ldr r6, [r0], #0x04 ldr r7, [r0], #0x04 ldr ip, [r0], #0x04 -#ifdef __ARMEB__ - orr r4, r4, r5, lsr #16 - mov r5, r5, lsl #16 - orr r5, r5, r6, lsr #16 - mov r6, r6, lsl #16 - orr r6, r6, r7, lsr #16 - mov r7, r7, lsl #16 - orr r7, r7, ip, lsr #16 -#else orr r4, r4, r5, lsl #16 mov r5, r5, lsr #16 orr r5, r5, r6, lsl #16 @@ -837,7 +736,6 @@ ENTRY(copyout) orr r6, r6, r7, lsl #16 mov r7, r7, lsr #16 orr r7, r7, ip, lsl #16 -#endif strt r4, [r1], #0x04 strt r5, [r1], #0x04 strt r6, [r1], #0x04 @@ -854,43 +752,22 @@ ENTRY(copyout) blt .Lcopyout_l4 .Lcopyout_bad2_loop4: -#ifdef __ARMEB__ - mov r4, ip, lsl #16 -#else mov r4, ip, lsr #16 -#endif ldr ip, [r0], #0x04 subs r2, r2, #0x04 -#ifdef __ARMEB__ - orr r4, r4, ip, lsr #16 -#else orr r4, r4, ip, lsl #16 -#endif strt r4, [r1], #0x04 bge .Lcopyout_bad2_loop4 sub r0, r0, #0x02 b .Lcopyout_l4 .Lcopyout_bad3_loop16: -#ifdef __ARMEB__ - mov r4, ip, lsl #24 -#else mov r4, ip, lsr #24 -#endif ldr r5, [r0], #0x04 pld [r0, #0x018] ldr r6, [r0], #0x04 ldr r7, [r0], #0x04 ldr ip, [r0], #0x04 -#ifdef __ARMEB__ - orr r4, r4, r5, lsr #8 - mov r5, r5, lsl #24 - orr r5, r5, r6, lsr #8 - mov r6, r6, lsl #24 - orr r6, r6, r7, lsr #8 - mov r7, r7, lsl #24 - orr r7, r7, ip, lsr #8 -#else orr r4, r4, r5, lsl #8 mov r5, r5, lsr #24 orr r5, r5, r6, lsl #8 @@ -898,7 +775,6 @@ ENTRY(copyout) orr r6, r6, r7, lsl #8 mov r7, r7, lsr #24 orr r7, r7, ip, lsl #8 -#endif strt r4, [r1], #0x04 strt r5, [r1], #0x04 strt r6, [r1], #0x04 @@ -915,18 +791,10 @@ ENTRY(copyout) blt .Lcopyout_l4 .Lcopyout_bad3_loop4: -#ifdef __ARMEB__ - mov r4, ip, lsl #24 -#else mov r4, ip, lsr #24 -#endif ldr ip, [r0], #0x04 subs r2, r2, #0x04 -#ifdef __ARMEB__ - orr r4, r4, ip, lsr #8 -#else orr r4, r4, ip, lsl #8 -#endif strt r4, [r1], #0x04 bge .Lcopyout_bad3_loop4 sub r0, r0, #0x01 Modified: head/sys/arm/arm/cpufunc.c ============================================================================== --- head/sys/arm/arm/cpufunc.c Sun Nov 29 14:21:16 2020 (r368152) +++ head/sys/arm/arm/cpufunc.c Sun Nov 29 15:04:39 2020 (r368153) @@ -486,9 +486,6 @@ arm10_setup(void) cpuctrl |= CPU_CONTROL_AFLT_ENABLE; #endif -#ifdef __ARMEB__ - cpuctrl |= CPU_CONTROL_BEND_ENABLE; -#endif /* Clear out the cache */ cpu_idcache_wbinv_all(); Modified: head/sys/arm/arm/fusu.S ============================================================================== --- head/sys/arm/arm/fusu.S Sun Nov 29 14:21:16 2020 (r368152) +++ head/sys/arm/arm/fusu.S Sun Nov 29 15:04:39 2020 (r368153) @@ -151,11 +151,7 @@ ENTRY(fusword) ldrbt r3, [r0], #1 ldrbt ip, [r0] -#ifdef __ARMEB__ - orr r0, ip, r3, asl #8 -#else orr r0, r3, ip, asl #8 -#endif mov r1, #0x00000000 str r1, [r2, #PCB_ONFAULT] RET @@ -269,13 +265,8 @@ ENTRY(susword) adr r3, .Lfusufault str r3, [r2, #PCB_ONFAULT] -#ifdef __ARMEB__ - mov ip, r1, lsr #8 - strbt ip, [r0], #1 -#else strbt r1, [r0], #1 mov r1, r1, lsr #8 -#endif strbt r1, [r0] mov r0, #0x00000000 Modified: head/sys/arm/arm/in_cksum_arm.S ============================================================================== --- head/sys/arm/arm/in_cksum_arm.S Sun Nov 29 14:21:16 2020 (r368152) +++ head/sys/arm/arm/in_cksum_arm.S Sun Nov 29 15:04:39 2020 (r368153) @@ -133,20 +133,14 @@ ASENTRY_NP(L_cksumdata) movlt r5, #0x00 ldrbgt r6, [r0], #0x01 /* Fetch 3rd byte */ movle r6, #0x00 + /* Combine the three bytes depending on endianness and alignment */ -#ifdef __ARMEB__ - orreq r2, r5, r4, lsl #8 - orreq r2, r2, r6, lsl #24 - orrne r2, r4, r5, lsl #8 - orrne r2, r2, r6, lsl #16 -#else orreq r2, r4, r5, lsl #8 orreq r2, r2, r6, lsl #16 orrne r2, r5, r4, lsl #8 orrne r2, r2, r6, lsl #24 -#endif subs r1, r1, r7 /* Update length */ - RETeq /* All done? */ + RETeq /* All done? */ /* Buffer is now word aligned */ .Lcksumdata_wordaligned: @@ -326,17 +320,10 @@ ASENTRY_NP(L_cksumdata) movle r5, #0x00 /* Combine the three bytes depending on endianness and alignment */ tst r0, #0x01 -#ifdef __ARMEB__ - orreq r3, r4, r3, lsl #8 - orreq r3, r3, r5, lsl #24 - orrne r3, r3, r4, lsl #8 - orrne r3, r3, r5, lsl #16 -#else orreq r3, r3, r4, lsl #8 orreq r3, r3, r5, lsl #16 orrne r3, r4, r3, lsl #8 orrne r3, r3, r5, lsl #24 -#endif adds r2, r2, r3 adc r2, r2, #0x00 RET Modified: head/sys/arm/arm/support.S ============================================================================== --- head/sys/arm/arm/support.S Sun Nov 29 14:21:16 2020 (r368152) +++ head/sys/arm/arm/support.S Sun Nov 29 15:04:39 2020 (r368153) @@ -512,21 +512,8 @@ EENTRY(memmove) stmdb sp!, {r4, r5} .Lmemmove_fsrcul1loop16: -#ifdef __ARMEB__ - mov r3, lr, lsl #8 -#else mov r3, lr, lsr #8 -#endif ldmia r1!, {r4, r5, r12, lr} -#ifdef __ARMEB__ - orr r3, r3, r4, lsr #24 - mov r4, r4, lsl #8 - orr r4, r4, r5, lsr #24 - mov r5, r5, lsl #8 - orr r5, r5, r12, lsr #24 - mov r12, r12, lsl #8 - orr r12, r12, lr, lsr #24 -#else orr r3, r3, r4, lsl #24 mov r4, r4, lsr #8 orr r4, r4, r5, lsl #24 @@ -534,7 +521,6 @@ EENTRY(memmove) orr r5, r5, r12, lsl #24 mov r12, r12, lsr #8 orr r12, r12, lr, lsl #24 -#endif stmia r0!, {r3-r5, r12} subs r2, r2, #0x10 bge .Lmemmove_fsrcul1loop16 @@ -543,17 +529,9 @@ EENTRY(memmove) blt .Lmemmove_fsrcul1l4 .Lmemmove_fsrcul1loop4: -#ifdef __ARMEB__ - mov r12, lr, lsl #8 -#else mov r12, lr, lsr #8 -#endif ldr lr, [r1], #4 -#ifdef __ARMEB__ - orr r12, r12, lr, lsr #24 -#else orr r12, r12, lr, lsl #24 -#endif str r12, [r0], #4 subs r2, r2, #4 bge .Lmemmove_fsrcul1loop4 @@ -569,21 +547,8 @@ EENTRY(memmove) stmdb sp!, {r4, r5} .Lmemmove_fsrcul2loop16: -#ifdef __ARMEB__ - mov r3, lr, lsl #16 -#else mov r3, lr, lsr #16 -#endif ldmia r1!, {r4, r5, r12, lr} -#ifdef __ARMEB__ - orr r3, r3, r4, lsr #16 - mov r4, r4, lsl #16 - orr r4, r4, r5, lsr #16 - mov r5, r5, lsl #16 - orr r5, r5, r12, lsr #16 - mov r12, r12, lsl #16 - orr r12, r12, lr, lsr #16 -#else orr r3, r3, r4, lsl #16 mov r4, r4, lsr #16 orr r4, r4, r5, lsl #16 @@ -591,7 +556,6 @@ EENTRY(memmove) orr r5, r5, r12, lsl #16 mov r12, r12, lsr #16 orr r12, r12, lr, lsl #16 -#endif stmia r0!, {r3-r5, r12} subs r2, r2, #0x10 bge .Lmemmove_fsrcul2loop16 @@ -600,17 +564,9 @@ EENTRY(memmove) blt .Lmemmove_fsrcul2l4 .Lmemmove_fsrcul2loop4: -#ifdef __ARMEB__ - mov r12, lr, lsl #16 -#else mov r12, lr, lsr #16 -#endif ldr lr, [r1], #4 -#ifdef __ARMEB__ - orr r12, r12, lr, lsr #16 -#else orr r12, r12, lr, lsl #16 -#endif str r12, [r0], #4 subs r2, r2, #4 bge .Lmemmove_fsrcul2loop4 @@ -626,21 +582,8 @@ EENTRY(memmove) stmdb sp!, {r4, r5} .Lmemmove_fsrcul3loop16: -#ifdef __ARMEB__ - mov r3, lr, lsl #24 -#else mov r3, lr, lsr #24 -#endif ldmia r1!, {r4, r5, r12, lr} -#ifdef __ARMEB__ - orr r3, r3, r4, lsr #8 - mov r4, r4, lsl #24 - orr r4, r4, r5, lsr #8 - mov r5, r5, lsl #24 - orr r5, r5, r12, lsr #8 - mov r12, r12, lsl #24 - orr r12, r12, lr, lsr #8 -#else orr r3, r3, r4, lsl #8 mov r4, r4, lsr #24 orr r4, r4, r5, lsl #8 @@ -648,7 +591,6 @@ EENTRY(memmove) orr r5, r5, r12, lsl #8 mov r12, r12, lsr #24 orr r12, r12, lr, lsl #8 -#endif stmia r0!, {r3-r5, r12} subs r2, r2, #0x10 bge .Lmemmove_fsrcul3loop16 @@ -657,17 +599,9 @@ EENTRY(memmove) blt .Lmemmove_fsrcul3l4 .Lmemmove_fsrcul3loop4: -#ifdef __ARMEB__ - mov r12, lr, lsl #24 -#else mov r12, lr, lsr #24 -#endif ldr lr, [r1], #4 -#ifdef __ARMEB__ - orr r12, r12, lr, lsr #8 -#else orr r12, r12, lr, lsl #8 -#endif str r12, [r0], #4 subs r2, r2, #4 bge .Lmemmove_fsrcul3loop4 @@ -770,21 +704,8 @@ EENTRY(memmove) stmdb sp!, {r4, r5, lr} .Lmemmove_bsrcul3loop16: -#ifdef __ARMEB__ - mov lr, r3, lsr #8 -#else mov lr, r3, lsl #8 -#endif ldmdb r1!, {r3-r5, r12} -#ifdef __ARMEB__ - orr lr, lr, r12, lsl #24 - mov r12, r12, lsr #8 - orr r12, r12, r5, lsl #24 - mov r5, r5, lsr #8 - orr r5, r5, r4, lsl #24 - mov r4, r4, lsr #8 - orr r4, r4, r3, lsl #24 -#else orr lr, lr, r12, lsr #24 mov r12, r12, lsl #8 orr r12, r12, r5, lsr #24 @@ -792,7 +713,6 @@ EENTRY(memmove) orr r5, r5, r4, lsr #24 mov r4, r4, lsl #8 orr r4, r4, r3, lsr #24 -#endif stmdb r0!, {r4, r5, r12, lr} subs r2, r2, #0x10 bge .Lmemmove_bsrcul3loop16 @@ -801,17 +721,9 @@ EENTRY(memmove) blt .Lmemmove_bsrcul3l4 .Lmemmove_bsrcul3loop4: -#ifdef __ARMEB__ - mov r12, r3, lsr #8 -#else mov r12, r3, lsl #8 -#endif ldr r3, [r1, #-4]! -#ifdef __ARMEB__ - orr r12, r12, r3, lsl #24 -#else orr r12, r12, r3, lsr #24 -#endif str r12, [r0, #-4]! subs r2, r2, #4 bge .Lmemmove_bsrcul3loop4 @@ -827,21 +739,8 @@ EENTRY(memmove) stmdb sp!, {r4, r5, lr} .Lmemmove_bsrcul2loop16: -#ifdef __ARMEB__ - mov lr, r3, lsr #16 -#else mov lr, r3, lsl #16 -#endif ldmdb r1!, {r3-r5, r12} -#ifdef __ARMEB__ - orr lr, lr, r12, lsl #16 - mov r12, r12, lsr #16 - orr r12, r12, r5, lsl #16 - mov r5, r5, lsr #16 - orr r5, r5, r4, lsl #16 - mov r4, r4, lsr #16 - orr r4, r4, r3, lsl #16 -#else orr lr, lr, r12, lsr #16 mov r12, r12, lsl #16 orr r12, r12, r5, lsr #16 @@ -849,7 +748,6 @@ EENTRY(memmove) orr r5, r5, r4, lsr #16 mov r4, r4, lsl #16 orr r4, r4, r3, lsr #16 -#endif stmdb r0!, {r4, r5, r12, lr} subs r2, r2, #0x10 bge .Lmemmove_bsrcul2loop16 @@ -858,17 +756,9 @@ EENTRY(memmove) blt .Lmemmove_bsrcul2l4 .Lmemmove_bsrcul2loop4: -#ifdef __ARMEB__ - mov r12, r3, lsr #16 -#else mov r12, r3, lsl #16 -#endif ldr r3, [r1, #-4]! -#ifdef __ARMEB__ - orr r12, r12, r3, lsl #16 -#else orr r12, r12, r3, lsr #16 -#endif str r12, [r0, #-4]! subs r2, r2, #4 bge .Lmemmove_bsrcul2loop4 @@ -884,21 +774,8 @@ EENTRY(memmove) stmdb sp!, {r4, r5, lr} .Lmemmove_bsrcul1loop32: -#ifdef __ARMEB__ - mov lr, r3, lsr #24 -#else mov lr, r3, lsl #24 -#endif ldmdb r1!, {r3-r5, r12} -#ifdef __ARMEB__ - orr lr, lr, r12, lsl #8 - mov r12, r12, lsr #24 - orr r12, r12, r5, lsl #8 - mov r5, r5, lsr #24 - orr r5, r5, r4, lsl #8 - mov r4, r4, lsr #24 - orr r4, r4, r3, lsl #8 -#else orr lr, lr, r12, lsr #8 mov r12, r12, lsl #24 orr r12, r12, r5, lsr #8 @@ -906,7 +783,6 @@ EENTRY(memmove) orr r5, r5, r4, lsr #8 mov r4, r4, lsl #24 orr r4, r4, r3, lsr #8 -#endif stmdb r0!, {r4, r5, r12, lr} subs r2, r2, #0x10 bge .Lmemmove_bsrcul1loop32 @@ -915,17 +791,9 @@ EENTRY(memmove) blt .Lmemmove_bsrcul1l4 .Lmemmove_bsrcul1loop4: -#ifdef __ARMEB__ - mov r12, r3, lsr #24 -#else mov r12, r3, lsl #24 -#endif ldr r3, [r1, #-4]! -#ifdef __ARMEB__ - orr r12, r12, r3, lsl #8 -#else orr r12, r12, r3, lsr #8 -#endif str r12, [r0, #-4]! subs r2, r2, #4 bge .Lmemmove_bsrcul1loop4 @@ -1382,25 +1250,12 @@ ENTRY(memcpy) b .Lmemcpy_bad1 .Lmemcpy_bad1_loop16: -#ifdef __ARMEB__ - mov r4, ip, lsl #8 -#else mov r4, ip, lsr #8 -#endif ldr r5, [r1], #0x04 pld [r1, #0x018] ldr r6, [r1], #0x04 ldr r7, [r1], #0x04 ldr ip, [r1], #0x04 -#ifdef __ARMEB__ - orr r4, r4, r5, lsr #24 - mov r5, r5, lsl #8 - orr r5, r5, r6, lsr #24 - mov r6, r6, lsl #8 - orr r6, r6, r7, lsr #24 - mov r7, r7, lsl #8 - orr r7, r7, ip, lsr #24 -#else orr r4, r4, r5, lsl #24 mov r5, r5, lsr #8 orr r5, r5, r6, lsl #24 @@ -1408,7 +1263,6 @@ ENTRY(memcpy) orr r6, r6, r7, lsl #24 mov r7, r7, lsr #8 orr r7, r7, ip, lsl #24 -#endif str r4, [r3], #0x04 str r5, [r3], #0x04 str r6, [r3], #0x04 @@ -1425,43 +1279,22 @@ ENTRY(memcpy) blt .Lmemcpy_bad_done .Lmemcpy_bad1_loop4: -#ifdef __ARMEB__ - mov r4, ip, lsl #8 -#else mov r4, ip, lsr #8 -#endif ldr ip, [r1], #0x04 subs r2, r2, #0x04 -#ifdef __ARMEB__ - orr r4, r4, ip, lsr #24 -#else orr r4, r4, ip, lsl #24 -#endif str r4, [r3], #0x04 bge .Lmemcpy_bad1_loop4 sub r1, r1, #0x03 b .Lmemcpy_bad_done .Lmemcpy_bad2_loop16: -#ifdef __ARMEB__ - mov r4, ip, lsl #16 -#else mov r4, ip, lsr #16 -#endif ldr r5, [r1], #0x04 pld [r1, #0x018] ldr r6, [r1], #0x04 ldr r7, [r1], #0x04 ldr ip, [r1], #0x04 -#ifdef __ARMEB__ - orr r4, r4, r5, lsr #16 - mov r5, r5, lsl #16 - orr r5, r5, r6, lsr #16 - mov r6, r6, lsl #16 - orr r6, r6, r7, lsr #16 - mov r7, r7, lsl #16 - orr r7, r7, ip, lsr #16 -#else orr r4, r4, r5, lsl #16 mov r5, r5, lsr #16 orr r5, r5, r6, lsl #16 @@ -1469,7 +1302,6 @@ ENTRY(memcpy) orr r6, r6, r7, lsl #16 mov r7, r7, lsr #16 orr r7, r7, ip, lsl #16 -#endif str r4, [r3], #0x04 str r5, [r3], #0x04 str r6, [r3], #0x04 @@ -1486,43 +1318,22 @@ ENTRY(memcpy) blt .Lmemcpy_bad_done .Lmemcpy_bad2_loop4: -#ifdef __ARMEB__ - mov r4, ip, lsl #16 -#else mov r4, ip, lsr #16 -#endif ldr ip, [r1], #0x04 subs r2, r2, #0x04 -#ifdef __ARMEB__ - orr r4, r4, ip, lsr #16 -#else orr r4, r4, ip, lsl #16 -#endif str r4, [r3], #0x04 bge .Lmemcpy_bad2_loop4 sub r1, r1, #0x02 b .Lmemcpy_bad_done .Lmemcpy_bad3_loop16: -#ifdef __ARMEB__ - mov r4, ip, lsl #24 -#else mov r4, ip, lsr #24 -#endif ldr r5, [r1], #0x04 pld [r1, #0x018] ldr r6, [r1], #0x04 ldr r7, [r1], #0x04 ldr ip, [r1], #0x04 -#ifdef __ARMEB__ - orr r4, r4, r5, lsr #8 - mov r5, r5, lsl #24 - orr r5, r5, r6, lsr #8 - mov r6, r6, lsl #24 - orr r6, r6, r7, lsr #8 - mov r7, r7, lsl #24 - orr r7, r7, ip, lsr #8 -#else orr r4, r4, r5, lsl #8 mov r5, r5, lsr #24 orr r5, r5, r6, lsl #8 @@ -1530,7 +1341,6 @@ ENTRY(memcpy) orr r6, r6, r7, lsl #8 mov r7, r7, lsr #24 orr r7, r7, ip, lsl #8 -#endif str r4, [r3], #0x04 str r5, [r3], #0x04 str r6, [r3], #0x04 @@ -1547,18 +1357,10 @@ ENTRY(memcpy) blt .Lmemcpy_bad_done .Lmemcpy_bad3_loop4: -#ifdef __ARMEB__ - mov r4, ip, lsl #24 -#else mov r4, ip, lsr #24 -#endif ldr ip, [r1], #0x04 subs r2, r2, #0x04 -#ifdef __ARMEB__ - orr r4, r4, ip, lsr #8 -#else orr r4, r4, ip, lsl #8 -#endif str r4, [r3], #0x04 bge .Lmemcpy_bad3_loop4 sub r1, r1, #0x01 @@ -1633,13 +1435,8 @@ ENTRY(memcpy) */ ldr r3, [r1, #-1] /* BE:r3 = x012 LE:r3 = 210x */ ldr r2, [r1, #3] /* BE:r2 = 3xxx LE:r2 = xxx3 */ -#ifdef __ARMEB__ - mov r3, r3, lsl #8 /* r3 = 012. */ - orr r3, r3, r2, lsr #24 /* r3 = 0123 */ -#else mov r3, r3, lsr #8 /* r3 = .210 */ orr r3, r3, r2, lsl #24 /* r3 = 3210 */ -#endif str r3, [r0] RET LMEMCPY_4_PAD @@ -1647,13 +1444,8 @@ ENTRY(memcpy) /* * 0010: dst is 32-bit aligned, src is 16-bit aligned */ -#ifdef __ARMEB__ - ldrh r3, [r1] - ldrh r2, [r1, #0x02] -#else ldrh r3, [r1, #0x02] ldrh r2, [r1] -#endif orr r3, r2, r3, lsl #16 str r3, [r0] RET @@ -1664,13 +1456,8 @@ ENTRY(memcpy) */ ldr r3, [r1, #-3] /* BE:r3 = xxx0 LE:r3 = 0xxx */ ldr r2, [r1, #1] /* BE:r2 = 123x LE:r2 = x321 */ -#ifdef __ARMEB__ - mov r3, r3, lsl #24 /* r3 = 0... */ - orr r3, r3, r2, lsr #8 /* r3 = 0123 */ -#else mov r3, r3, lsr #24 /* r3 = ...0 */ orr r3, r3, r2, lsl #8 /* r3 = 3210 */ -#endif str r3, [r0] RET LMEMCPY_4_PAD @@ -1679,17 +1466,10 @@ ENTRY(memcpy) * 0100: dst is 8-bit aligned, src is 32-bit aligned */ ldr r2, [r1] -#ifdef __ARMEB__ - strb r2, [r0, #0x03] - mov r3, r2, lsr #8 - mov r1, r2, lsr #24 - strb r1, [r0] -#else strb r2, [r0] mov r3, r2, lsr #8 mov r1, r2, lsr #24 strb r1, [r0, #0x03] -#endif strh r3, [r0, #0x01] RET LMEMCPY_4_PAD @@ -1711,17 +1491,10 @@ ENTRY(memcpy) */ ldrh r2, [r1] /* BE:r2 = ..01 LE:r2 = ..10 */ ldrh r3, [r1, #0x02] /* LE:r3 = ..23 LE:r3 = ..32 */ -#ifdef __ARMEB__ mov r1, r2, lsr #8 /* r1 = ...0 */ strb r1, [r0] mov r2, r2, lsl #8 /* r2 = .01. */ orr r2, r2, r3, lsr #8 /* r2 = .012 */ -#else - strb r2, [r0] - mov r2, r2, lsr #8 /* r2 = ...1 */ - orr r2, r2, r3, lsl #8 /* r2 = .321 */ - mov r3, r3, lsr #8 /* r3 = ...3 */ -#endif strh r2, [r0, #0x01] strb r3, [r0, #0x03] RET @@ -1743,15 +1516,9 @@ ENTRY(memcpy) * 1000: dst is 16-bit aligned, src is 32-bit aligned */ ldr r2, [r1] -#ifdef __ARMEB__ - strh r2, [r0, #0x02] - mov r3, r2, lsr #16 - strh r3, [r0] -#else strh r2, [r0] mov r3, r2, lsr #16 strh r3, [r0, #0x02] -#endif RET LMEMCPY_4_PAD @@ -1762,13 +1529,8 @@ ENTRY(memcpy) ldr r3, [r1, #3] /* BE:r3 = 3xxx LE:r3 = xxx3 */ mov r1, r2, lsr #8 /* BE:r1 = .x01 LE:r1 = .210 */ strh r1, [r0] -#ifdef __ARMEB__ - mov r2, r2, lsl #8 /* r2 = 012. */ - orr r2, r2, r3, lsr #24 /* r2 = 0123 */ -#else mov r2, r2, lsr #24 /* r2 = ...2 */ orr r2, r2, r3, lsl #8 /* r2 = xx32 */ -#endif strh r2, [r0, #0x02] RET LMEMCPY_4_PAD @@ -1790,13 +1552,8 @@ ENTRY(memcpy) ldr r2, [r1, #-3] /* BE:r2 = xxx0 LE:r2 = 0xxx */ mov r1, r3, lsr #8 /* BE:r1 = .123 LE:r1 = .x32 */ strh r1, [r0, #0x02] -#ifdef __ARMEB__ - mov r3, r3, lsr #24 /* r3 = ...1 */ - orr r3, r3, r2, lsl #8 /* r3 = xx01 */ -#else mov r3, r3, lsl #8 /* r3 = 321. */ orr r3, r3, r2, lsr #24 /* r3 = 3210 */ -#endif strh r3, [r0] RET LMEMCPY_4_PAD @@ -1805,19 +1562,11 @@ ENTRY(memcpy) * 1100: dst is 8-bit aligned, src is 32-bit aligned */ ldr r2, [r1] /* BE:r2 = 0123 LE:r2 = 3210 */ -#ifdef __ARMEB__ - strb r2, [r0, #0x03] - mov r3, r2, lsr #8 - mov r1, r2, lsr #24 - strh r3, [r0, #0x01] - strb r1, [r0] -#else strb r2, [r0] mov r3, r2, lsr #8 mov r1, r2, lsr #24 strh r3, [r0, #0x01] strb r1, [r0, #0x03] -#endif RET LMEMCPY_4_PAD @@ -1836,17 +1585,7 @@ ENTRY(memcpy) /* * 1110: dst is 8-bit aligned, src is 16-bit aligned */ -#ifdef __ARMEB__ - ldrh r3, [r1, #0x02] /* BE:r3 = ..23 LE:r3 = ..32 */ ldrh r2, [r1] /* BE:r2 = ..01 LE:r2 = ..10 */ - strb r3, [r0, #0x03] - mov r3, r3, lsr #8 /* r3 = ...2 */ - orr r3, r3, r2, lsl #8 /* r3 = ..12 */ - strh r3, [r0, #0x01] - mov r2, r2, lsr #8 /* r2 = ...0 */ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Sun Nov 29 15:24:02 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1C7A24A4ECD; Sun, 29 Nov 2020 15:24:02 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CkXFt0H0Pz4lb5; Sun, 29 Nov 2020 15:24:02 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F06EA13B39; Sun, 29 Nov 2020 15:24:01 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0ATFO1Ut022771; Sun, 29 Nov 2020 15:24:01 GMT (envelope-from mmel@FreeBSD.org) Received: (from mmel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0ATFO12F022763; Sun, 29 Nov 2020 15:24:01 GMT (envelope-from mmel@FreeBSD.org) Message-Id: <202011291524.0ATFO12F022763@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmel set sender to mmel@FreeBSD.org using -f From: Michal Meloun Date: Sun, 29 Nov 2020 15:24:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368154 - in head/sys: arm/arm arm/include arm/mv conf X-SVN-Group: head X-SVN-Commit-Author: mmel X-SVN-Commit-Paths: in head/sys: arm/arm arm/include arm/mv conf X-SVN-Commit-Revision: 368154 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Nov 2020 15:24:02 -0000 Author: mmel Date: Sun Nov 29 15:24:00 2020 New Revision: 368154 URL: https://svnweb.freebsd.org/changeset/base/368154 Log: Remove remaining fragments of code for older already ceased ARM versions. Deleted: head/sys/arm/arm/cpufunc_asm_arm9.S head/sys/arm/arm/cpufunc_asm_armv4.S head/sys/arm/arm/cpufunc_asm_armv5_ec.S head/sys/arm/arm/cpufunc_asm_sheeva.S head/sys/arm/mv/std.mv Modified: head/sys/arm/arm/cpufunc.c head/sys/arm/include/cpufunc.h head/sys/arm/include/md_var.h head/sys/conf/files.arm Modified: head/sys/arm/arm/cpufunc.c ============================================================================== --- head/sys/arm/arm/cpufunc.c Sun Nov 29 15:04:39 2020 (r368153) +++ head/sys/arm/arm/cpufunc.c Sun Nov 29 15:24:00 2020 (r368154) @@ -80,9 +80,6 @@ u_int arm_cache_level; u_int arm_cache_type[14]; u_int arm_cache_loc; -#if defined(CPU_ARM9E) -static void arm10_setup(void); -#endif #ifdef CPU_MV_PJ4B static void pj4bv7_setup(void); #endif @@ -93,107 +90,6 @@ static void arm11x6_setup(void); static void cortexa_setup(void); #endif -#if defined(CPU_ARM9E) -struct cpu_functions armv5_ec_cpufuncs = { - /* CPU functions */ - - cpufunc_nullop, /* cpwait */ - - /* MMU functions */ - - cpufunc_control, /* control */ - armv5_ec_setttb, /* Setttb */ - - /* TLB functions */ - - armv4_tlb_flushID, /* tlb_flushID */ - arm9_tlb_flushID_SE, /* tlb_flushID_SE */ - armv4_tlb_flushD, /* tlb_flushD */ - armv4_tlb_flushD_SE, /* tlb_flushD_SE */ - - /* Cache operations */ - - armv5_ec_icache_sync_range, /* icache_sync_range */ - - armv5_ec_dcache_wbinv_all, /* dcache_wbinv_all */ - armv5_ec_dcache_wbinv_range, /* dcache_wbinv_range */ - armv5_ec_dcache_inv_range, /* dcache_inv_range */ - armv5_ec_dcache_wb_range, /* dcache_wb_range */ - - armv4_idcache_inv_all, /* idcache_inv_all */ - armv5_ec_idcache_wbinv_all, /* idcache_wbinv_all */ - armv5_ec_idcache_wbinv_range, /* idcache_wbinv_range */ - - cpufunc_nullop, /* l2cache_wbinv_all */ - (void *)cpufunc_nullop, /* l2cache_wbinv_range */ - (void *)cpufunc_nullop, /* l2cache_inv_range */ - (void *)cpufunc_nullop, /* l2cache_wb_range */ - (void *)cpufunc_nullop, /* l2cache_drain_writebuf */ - - /* Other functions */ - - armv4_drain_writebuf, /* drain_writebuf */ - - (void *)cpufunc_nullop, /* sleep */ - - /* Soft functions */ - - arm9_context_switch, /* context_switch */ - - arm10_setup /* cpu setup */ - -}; - -struct cpu_functions sheeva_cpufuncs = { - /* CPU functions */ - - cpufunc_nullop, /* cpwait */ - - /* MMU functions */ - - cpufunc_control, /* control */ - sheeva_setttb, /* Setttb */ - - /* TLB functions */ - - armv4_tlb_flushID, /* tlb_flushID */ - arm9_tlb_flushID_SE, /* tlb_flushID_SE */ - armv4_tlb_flushD, /* tlb_flushD */ - armv4_tlb_flushD_SE, /* tlb_flushD_SE */ - - /* Cache operations */ - - armv5_ec_icache_sync_range, /* icache_sync_range */ - - armv5_ec_dcache_wbinv_all, /* dcache_wbinv_all */ - sheeva_dcache_wbinv_range, /* dcache_wbinv_range */ - sheeva_dcache_inv_range, /* dcache_inv_range */ - sheeva_dcache_wb_range, /* dcache_wb_range */ - - armv4_idcache_inv_all, /* idcache_inv_all */ - armv5_ec_idcache_wbinv_all, /* idcache_wbinv_all */ - sheeva_idcache_wbinv_range, /* idcache_wbinv_all */ - - sheeva_l2cache_wbinv_all, /* l2cache_wbinv_all */ - sheeva_l2cache_wbinv_range, /* l2cache_wbinv_range */ - sheeva_l2cache_inv_range, /* l2cache_inv_range */ - sheeva_l2cache_wb_range, /* l2cache_wb_range */ - (void *)cpufunc_nullop, /* l2cache_drain_writebuf */ - - /* Other functions */ - - armv4_drain_writebuf, /* drain_writebuf */ - - sheeva_cpu_sleep, /* sleep */ - - /* Soft functions */ - - arm9_context_switch, /* context_switch */ - - arm10_setup /* cpu setup */ -}; -#endif /* CPU_ARM9E */ - #ifdef CPU_MV_PJ4B struct cpu_functions pj4bv7_cpufuncs = { /* Cache operations */ @@ -257,11 +153,6 @@ struct cpu_functions cortexa_cpufuncs = { struct cpu_functions cpufuncs; u_int cputype; -#if defined (CPU_ARM9E) || \ - defined(CPU_ARM1176) || \ - defined(CPU_MV_PJ4B) || \ - defined(CPU_CORTEXA) || defined(CPU_KRAIT) - static void get_cachetype_cp15(void); /* Additional cache information local to this file. Log2 of some of the @@ -371,7 +262,6 @@ get_cachetype_cp15(void) arm_dcache_align_mask = arm_dcache_align - 1; } } -#endif /* ARM9 || XSCALE */ /* * Cannot panic here as we may not have a console yet ... @@ -383,38 +273,6 @@ set_cpufuncs(void) cputype = cp15_midr_get(); cputype &= CPU_ID_CPU_MASK; -#if defined(CPU_ARM9E) - if (cputype == CPU_ID_MV88FR131 || cputype == CPU_ID_MV88FR571_VD || - cputype == CPU_ID_MV88FR571_41) { - uint32_t sheeva_ctrl; - - sheeva_ctrl = (MV_DC_STREAM_ENABLE | MV_BTB_DISABLE | - MV_L2_ENABLE); - /* - * Workaround for Marvell MV78100 CPU: Cache prefetch - * mechanism may affect the cache coherency validity, - * so it needs to be disabled. - * - * Refer to errata document MV-S501058-00C.pdf (p. 3.1 - * L2 Prefetching Mechanism) for details. - */ - if (cputype == CPU_ID_MV88FR571_VD || - cputype == CPU_ID_MV88FR571_41) - sheeva_ctrl |= MV_L2_PREFETCH_DISABLE; - - sheeva_control_ext(0xffffffff & ~MV_WA_ENABLE, sheeva_ctrl); - - cpufuncs = sheeva_cpufuncs; - get_cachetype_cp15(); - pmap_pte_init_generic(); - goto out; - } else if (cputype == CPU_ID_ARM926EJS) { - cpufuncs = armv5_ec_cpufuncs; - get_cachetype_cp15(); - pmap_pte_init_generic(); - goto out; - } -#endif /* CPU_ARM9E */ #if defined(CPU_ARM1176) if (cputype == CPU_ID_ARM1176JZS) { cpufuncs = arm1176_cpufuncs; @@ -466,43 +324,6 @@ out: * CPU Setup code */ -#if defined(CPU_ARM9E) -static void -arm10_setup(void) -{ - int cpuctrl, cpuctrlmask; - - cpuctrl = CPU_CONTROL_MMU_ENABLE | CPU_CONTROL_SYST_ENABLE - | CPU_CONTROL_IC_ENABLE | CPU_CONTROL_DC_ENABLE - | CPU_CONTROL_WBUF_ENABLE | CPU_CONTROL_BPRD_ENABLE; - cpuctrlmask = CPU_CONTROL_MMU_ENABLE | CPU_CONTROL_SYST_ENABLE - | CPU_CONTROL_IC_ENABLE | CPU_CONTROL_DC_ENABLE - | CPU_CONTROL_WBUF_ENABLE | CPU_CONTROL_ROM_ENABLE - | CPU_CONTROL_BEND_ENABLE | CPU_CONTROL_AFLT_ENABLE - | CPU_CONTROL_BPRD_ENABLE - | CPU_CONTROL_ROUNDROBIN | CPU_CONTROL_CPCLK; - -#ifndef ARM32_DISABLE_ALIGNMENT_FAULTS - cpuctrl |= CPU_CONTROL_AFLT_ENABLE; -#endif - - - /* Clear out the cache */ - cpu_idcache_wbinv_all(); - - /* Now really make sure they are clean. */ - __asm __volatile ("mcr\tp15, 0, r0, c7, c7, 0" : : ); - - if (vector_page == ARM_VECTORS_HIGH) - cpuctrl |= CPU_CONTROL_VECRELOC; - - /* Set the control register */ - cpu_control(0xffffffff, cpuctrl); - - /* And again. */ - cpu_idcache_wbinv_all(); -} -#endif /* CPU_ARM9E || CPU_ARM10 */ #if defined(CPU_ARM1176) \ || defined(CPU_MV_PJ4B) \ Modified: head/sys/arm/include/cpufunc.h ============================================================================== --- head/sys/arm/include/cpufunc.h Sun Nov 29 15:04:39 2020 (r368153) +++ head/sys/arm/include/cpufunc.h Sun Nov 29 15:24:00 2020 (r368154) @@ -93,24 +93,7 @@ void cpufunc_nullop (void); u_int cpufunc_control (u_int clear, u_int bic); void cpu_domains (u_int domains); -#if defined(CPU_ARM9E) -void arm9_tlb_flushID_SE (u_int va); -void arm9_context_switch (void); -u_int sheeva_control_ext (u_int, u_int); -void sheeva_cpu_sleep (int); -void sheeva_setttb (u_int); -void sheeva_dcache_wbinv_range (vm_offset_t, vm_size_t); -void sheeva_dcache_inv_range (vm_offset_t, vm_size_t); -void sheeva_dcache_wb_range (vm_offset_t, vm_size_t); -void sheeva_idcache_wbinv_range (vm_offset_t, vm_size_t); - -void sheeva_l2cache_wbinv_range (vm_offset_t, vm_size_t); -void sheeva_l2cache_inv_range (vm_offset_t, vm_size_t); -void sheeva_l2cache_wb_range (vm_offset_t, vm_size_t); -void sheeva_l2cache_wbinv_all (void); -#endif - #if defined(CPU_CORTEXA) || defined(CPU_MV_PJ4B) || defined(CPU_KRAIT) void armv7_cpu_sleep (int); #endif @@ -122,26 +105,6 @@ void pj4b_config (void); void arm11x6_sleep (int); /* no ref. for errata */ #endif -#if defined(CPU_ARM9E) -void armv5_ec_setttb(u_int); - -void armv5_ec_icache_sync_range(vm_offset_t, vm_size_t); - -void armv5_ec_dcache_wbinv_all(void); -void armv5_ec_dcache_wbinv_range(vm_offset_t, vm_size_t); -void armv5_ec_dcache_inv_range(vm_offset_t, vm_size_t); -void armv5_ec_dcache_wb_range(vm_offset_t, vm_size_t); - -void armv5_ec_idcache_wbinv_all(void); -void armv5_ec_idcache_wbinv_range(vm_offset_t, vm_size_t); - -void armv4_tlb_flushID (void); -void armv4_tlb_flushD (void); -void armv4_tlb_flushD_SE (u_int va); - -void armv4_drain_writebuf (void); -void armv4_idcache_inv_all (void); -#endif /* * Macros for manipulating CPU interrupts Modified: head/sys/arm/include/md_var.h ============================================================================== --- head/sys/arm/include/md_var.h Sun Nov 29 15:04:39 2020 (r368153) +++ head/sys/arm/include/md_var.h Sun Nov 29 15:24:00 2020 (r368154) @@ -54,14 +54,8 @@ extern int _min_bzero_size; enum cpu_class { CPU_CLASS_NONE, - CPU_CLASS_ARM9TDMI, - CPU_CLASS_ARM9ES, - CPU_CLASS_ARM9EJS, - CPU_CLASS_ARM10E, - CPU_CLASS_ARM10EJ, CPU_CLASS_CORTEXA, CPU_CLASS_KRAIT, - CPU_CLASS_XSCALE, CPU_CLASS_ARM11J, CPU_CLASS_MARVELL }; Modified: head/sys/conf/files.arm ============================================================================== --- head/sys/conf/files.arm Sun Nov 29 15:04:39 2020 (r368153) +++ head/sys/conf/files.arm Sun Nov 29 15:24:00 2020 (r368154) @@ -11,13 +11,9 @@ arm/arm/busdma_machdep.c standard arm/arm/copystr.S standard arm/arm/cpufunc.c standard arm/arm/cpufunc_asm.S standard -arm/arm/cpufunc_asm_arm9.S optional cpu_arm9e arm/arm/cpufunc_asm_arm11x6.S optional cpu_arm1176 -arm/arm/cpufunc_asm_armv4.S optional cpu_arm9e -arm/arm/cpufunc_asm_armv5_ec.S optional cpu_arm9e arm/arm/cpufunc_asm_armv7.S optional cpu_cortexa | cpu_krait | cpu_mv_pj4b arm/arm/cpufunc_asm_pj4b.S optional cpu_mv_pj4b -arm/arm/cpufunc_asm_sheeva.S optional cpu_arm9e arm/arm/cpuinfo.c standard arm/arm/cpu_asm-v6.S standard arm/arm/db_disasm.c optional ddb From owner-svn-src-head@freebsd.org Sun Nov 29 15:39:55 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A42E44A5A8B; Sun, 29 Nov 2020 15:39:55 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CkXcC4Db6z4mTx; Sun, 29 Nov 2020 15:39:55 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 79AEE13D92; Sun, 29 Nov 2020 15:39:55 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0ATFdtdw029459; Sun, 29 Nov 2020 15:39:55 GMT (envelope-from mmel@FreeBSD.org) Received: (from mmel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0ATFdt9A029458; Sun, 29 Nov 2020 15:39:55 GMT (envelope-from mmel@FreeBSD.org) Message-Id: <202011291539.0ATFdt9A029458@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmel set sender to mmel@FreeBSD.org using -f From: Michal Meloun Date: Sun, 29 Nov 2020 15:39:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368155 - head/sys/arm/conf X-SVN-Group: head X-SVN-Commit-Author: mmel X-SVN-Commit-Paths: head/sys/arm/conf X-SVN-Commit-Revision: 368155 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Nov 2020 15:39:55 -0000 Author: mmel Date: Sun Nov 29 15:39:54 2020 New Revision: 368155 URL: https://svnweb.freebsd.org/changeset/base/368155 Log: Remove orphaned configs. Deleted: head/sys/arm/conf/ARNDALE head/sys/arm/conf/ARNDALE-OCTA head/sys/arm/conf/EA3250.hints head/sys/arm/conf/SAM9G20EK.hints head/sys/arm/conf/VSATV102 head/sys/arm/conf/YYHD18 From owner-svn-src-head@freebsd.org Sun Nov 29 16:22:33 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C6D854A6DF6; Sun, 29 Nov 2020 16:22:33 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CkYYP5Bd4z4qwR; Sun, 29 Nov 2020 16:22:33 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A54FA14715; Sun, 29 Nov 2020 16:22:33 +0000 (UTC) (envelope-from andrew@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0ATGMXNW060781; Sun, 29 Nov 2020 16:22:33 GMT (envelope-from andrew@FreeBSD.org) Received: (from andrew@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0ATGMXZU060780; Sun, 29 Nov 2020 16:22:33 GMT (envelope-from andrew@FreeBSD.org) Message-Id: <202011291622.0ATGMXZU060780@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: andrew set sender to andrew@FreeBSD.org using -f From: Andrew Turner Date: Sun, 29 Nov 2020 16:22:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368156 - head/sys/dev/pci X-SVN-Group: head X-SVN-Commit-Author: andrew X-SVN-Commit-Paths: head/sys/dev/pci X-SVN-Commit-Revision: 368156 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Nov 2020 16:22:33 -0000 Author: andrew Date: Sun Nov 29 16:22:33 2020 New Revision: 368156 URL: https://svnweb.freebsd.org/changeset/base/368156 Log: Only set the PCI bus end when we are reducing it We read the bus end value from the _CRS method. On some systems we need to further limit it based on the MCFG table. Support this by setting a default value, then update it if needed in the _CRS table, and finally reduce it if it is past the end of the MCFG tabel. This will allow for both systems that use either method to encode this value. This partially reverts r347929, removing the error printf. Reviewed by: philip Tested by: philip, Andrey Fesenko MFC after: 2 weeks Sponsored by: Innovate UK Differential Revision: https://reviews.freebsd.org/D27274 Modified: head/sys/dev/pci/pci_host_generic_acpi.c Modified: head/sys/dev/pci/pci_host_generic_acpi.c ============================================================================== --- head/sys/dev/pci/pci_host_generic_acpi.c Sun Nov 29 15:39:54 2020 (r368155) +++ head/sys/dev/pci/pci_host_generic_acpi.c Sun Nov 29 16:22:33 2020 (r368156) @@ -201,7 +201,8 @@ pci_host_acpi_get_ecam_resource(device_t dev) mcfg_entry++; } if (found) { - sc->base.bus_end = mcfg_entry->EndBusNumber; + if (mcfg_entry->EndBusNumber < sc->base.bus_end) + sc->base.bus_end = mcfg_entry->EndBusNumber; base = mcfg_entry->Address; } else { device_printf(dev, "MCFG exists, but does not have bus %d-%d\n", @@ -210,10 +211,9 @@ pci_host_acpi_get_ecam_resource(device_t dev) } } else { status = acpi_GetInteger(handle, "_CBA", &val); - if (ACPI_SUCCESS(status)) { + if (ACPI_SUCCESS(status)) base = val; - sc->base.bus_end = 255; - } else + else return (ENXIO); } @@ -246,6 +246,7 @@ pci_host_generic_acpi_init(device_t dev) device_printf(dev, "No _BBN, using start bus 0\n"); sc->base.bus_start = 0; } + sc->base.bus_end = 255; /* Get PCI Segment (domain) needed for MCFG lookup */ status = acpi_GetInteger(handle, "_SEG", &sc->base.ecam); From owner-svn-src-head@freebsd.org Sun Nov 29 16:29:40 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DD39D4A7338; Sun, 29 Nov 2020 16:29:40 +0000 (UTC) (envelope-from yuripv@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CkYjc5wDVz4rPJ; Sun, 29 Nov 2020 16:29:40 +0000 (UTC) (envelope-from yuripv@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BDF8414353; Sun, 29 Nov 2020 16:29:40 +0000 (UTC) (envelope-from yuripv@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0ATGTetJ061706; Sun, 29 Nov 2020 16:29:40 GMT (envelope-from yuripv@FreeBSD.org) Received: (from yuripv@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0ATGTe4A061705; Sun, 29 Nov 2020 16:29:40 GMT (envelope-from yuripv@FreeBSD.org) Message-Id: <202011291629.0ATGTe4A061705@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: yuripv set sender to yuripv@FreeBSD.org using -f From: Yuri Pankov Date: Sun, 29 Nov 2020 16:29:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368157 - head/share/man/man7 X-SVN-Group: head X-SVN-Commit-Author: yuripv X-SVN-Commit-Paths: head/share/man/man7 X-SVN-Commit-Revision: 368157 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Nov 2020 16:29:40 -0000 Author: yuripv Date: Sun Nov 29 16:29:40 2020 New Revision: 368157 URL: https://svnweb.freebsd.org/changeset/base/368157 Log: security(7): fix copy/paste error and correct aslr oids Submitted by: Mina Galić Differential Revision: https://reviews.freebsd.org/D27408 Modified: head/share/man/man7/security.7 Modified: head/share/man/man7/security.7 ============================================================================== --- head/share/man/man7/security.7 Sun Nov 29 16:22:33 2020 (r368156) +++ head/share/man/man7/security.7 Sun Nov 29 16:29:40 2020 (r368157) @@ -28,7 +28,7 @@ .\" .\" $FreeBSD$ .\" -.Dd June 11, 2020 +.Dd November 28, 2020 .Dt SECURITY 7 .Os .Sh NAME @@ -1061,7 +1061,7 @@ position-independent (PIE) 32bit binaries. .It Dv kern.elf32.aslr.honor_sbrk Makes ASLR less aggressive and more compatible with old binaries relying on the sbrk area. -.It Dv kern.elf32.aslr.aslr_stack_gap +.It Dv kern.elf32.aslr.stack_gap If ASLR is enabled for a binary, a non-zero value creates a randomized stack gap between strings and the end of the aux vector. The value is the maximum percentage of main stack to waste on the gap. @@ -1072,7 +1072,7 @@ Cannot be greater than 50, i.e., at most half of the s 64bit PIE binaries ASLR control. .It Dv kern.elf64.aslr.honor_sbrk 64bit binaries ASLR sbrk compatibility control. -.It Dv kern.elf32.aslr.aslr_stack_gap +.It Dv kern.elf64.aslr.stack_gap Controls stack gap for 64bit binaries. .It Dv kern.elf32.nxstack Enables non-executable stack for 32bit processes. From owner-svn-src-head@freebsd.org Sun Nov 29 16:44:23 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A0AF04A7993; Sun, 29 Nov 2020 16:44:23 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CkZ2b46C2z4sYK; Sun, 29 Nov 2020 16:44:23 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7F1CD14A9F; Sun, 29 Nov 2020 16:44:23 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0ATGiN1A074328; Sun, 29 Nov 2020 16:44:23 GMT (envelope-from mmel@FreeBSD.org) Received: (from mmel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0ATGiMfn074322; Sun, 29 Nov 2020 16:44:22 GMT (envelope-from mmel@FreeBSD.org) Message-Id: <202011291644.0ATGiMfn074322@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmel set sender to mmel@FreeBSD.org using -f From: Michal Meloun Date: Sun, 29 Nov 2020 16:44:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368158 - head/sys/arm/arm X-SVN-Group: head X-SVN-Commit-Author: mmel X-SVN-Commit-Paths: head/sys/arm/arm X-SVN-Commit-Revision: 368158 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Nov 2020 16:44:23 -0000 Author: mmel Date: Sun Nov 29 16:44:22 2020 New Revision: 368158 URL: https://svnweb.freebsd.org/changeset/base/368158 Log: _ARM_ARCH_5E is always defined, we not support older CPUs. Modified: head/sys/arm/arm/bcopy_page.S head/sys/arm/arm/bcopyinout.S head/sys/arm/arm/in_cksum_arm.S head/sys/arm/arm/machdep.c head/sys/arm/arm/support.S Modified: head/sys/arm/arm/bcopy_page.S ============================================================================== --- head/sys/arm/arm/bcopy_page.S Sun Nov 29 16:29:40 2020 (r368157) +++ head/sys/arm/arm/bcopy_page.S Sun Nov 29 16:44:22 2020 (r368158) @@ -44,147 +44,8 @@ __FBSDID("$FreeBSD$"); #include "assym.inc" -#ifndef _ARM_ARCH_5E -/* #define BIG_LOOPS */ - /* - * bcopy_page(src, dest) - * - * Optimised copy page routine. - * - * On entry: - * r0 - src address - * r1 - dest address - * - * Requires: - * number of bytes per page (PAGE_SIZE) is a multiple of 512 (BIG_LOOPS), 128 - * otherwise. - */ - -#define CHUNK_SIZE 32 - -#define PREFETCH_FIRST_CHUNK /* nothing */ -#define PREFETCH_NEXT_CHUNK /* nothing */ - -#ifndef COPY_CHUNK -#define COPY_CHUNK \ - PREFETCH_NEXT_CHUNK ; \ - ldmia r0!, {r3-r8,ip,lr} ; \ - stmia r1!, {r3-r8,ip,lr} -#endif /* ! COPY_CHUNK */ - -#ifndef SAVE_REGS -#define SAVE_REGS stmfd sp!, {r4-r8, lr}; _SAVE({r4-r8, lr}) -#define RESTORE_REGS ldmfd sp!, {r4-r8, pc} -#endif - -ENTRY(bcopy_page) - PREFETCH_FIRST_CHUNK - SAVE_REGS -#ifdef BIG_LOOPS - mov r2, #(PAGE_SIZE >> 9) -#else - mov r2, #(PAGE_SIZE >> 7) -#endif - -1: - COPY_CHUNK - COPY_CHUNK - COPY_CHUNK - COPY_CHUNK - -#ifdef BIG_LOOPS - /* There is little point making the loop any larger; unless we are - running with the cache off, the load/store overheads will - completely dominate this loop. */ - COPY_CHUNK - COPY_CHUNK - COPY_CHUNK - COPY_CHUNK - - COPY_CHUNK - COPY_CHUNK - COPY_CHUNK - COPY_CHUNK - - COPY_CHUNK - COPY_CHUNK - COPY_CHUNK - COPY_CHUNK -#endif - subs r2, r2, #1 - bne 1b - - RESTORE_REGS /* ...and return. */ -END(bcopy_page) - -/* - * bzero_page(dest) - * - * Optimised zero page routine. - * - * On entry: - * r0 - dest address - * - * Requires: - * number of bytes per page (PAGE_SIZE) is a multiple of 512 (BIG_LOOPS), 128 - * otherwise - */ - -ENTRY(bzero_page) - stmfd sp!, {r4-r8, lr} - _SAVE({r4-r8, lr}) -#ifdef BIG_LOOPS - mov r2, #(PAGE_SIZE >> 9) -#else - mov r2, #(PAGE_SIZE >> 7) -#endif - mov r3, #0 - mov r4, #0 - mov r5, #0 - mov r6, #0 - mov r7, #0 - mov r8, #0 - mov ip, #0 - mov lr, #0 - -1: - stmia r0!, {r3-r8,ip,lr} - stmia r0!, {r3-r8,ip,lr} - stmia r0!, {r3-r8,ip,lr} - stmia r0!, {r3-r8,ip,lr} - -#ifdef BIG_LOOPS - /* There is little point making the loop any larger; unless we are - running with the cache off, the load/store overheads will - completely dominate this loop. */ - stmia r0!, {r3-r8,ip,lr} - stmia r0!, {r3-r8,ip,lr} - stmia r0!, {r3-r8,ip,lr} - stmia r0!, {r3-r8,ip,lr} - - stmia r0!, {r3-r8,ip,lr} - stmia r0!, {r3-r8,ip,lr} - stmia r0!, {r3-r8,ip,lr} - stmia r0!, {r3-r8,ip,lr} - - stmia r0!, {r3-r8,ip,lr} - stmia r0!, {r3-r8,ip,lr} - stmia r0!, {r3-r8,ip,lr} - stmia r0!, {r3-r8,ip,lr} - -#endif - - subs r2, r2, #1 - bne 1b - - ldmfd sp!, {r4-r8, pc} -END(bzero_page) - -#else /* _ARM_ARCH_5E */ - -/* * armv5e version of bcopy_page */ ENTRY(bcopy_page) @@ -279,4 +140,3 @@ ENTRY(bzero_page) bne 1b RET END(bzero_page) -#endif /* _ARM_ARCH_5E */ Modified: head/sys/arm/arm/bcopyinout.S ============================================================================== --- head/sys/arm/arm/bcopyinout.S Sun Nov 29 16:29:40 2020 (r368157) +++ head/sys/arm/arm/bcopyinout.S Sun Nov 29 16:44:22 2020 (r368158) @@ -47,510 +47,7 @@ .word _C_LABEL(_min_memcpy_size) __FBSDID("$FreeBSD$"); -#ifdef _ARM_ARCH_5E #include -#else - - .text - .align 2 - -#define GET_PCB(tmp) \ - mrc p15, 0, tmp, c13, c0, 4; \ - add tmp, tmp, #(TD_PCB) - -#define SAVE_REGS stmfd sp!, {r4-r11}; _SAVE({r4-r11}) -#define RESTORE_REGS ldmfd sp!, {r4-r11} - -#if defined(_ARM_ARCH_5E) -#define HELLOCPP # -#define PREFETCH(rx,o) pld [ rx , HELLOCPP (o) ] -#else -#define PREFETCH(rx,o) -#endif - -/* - * r0 = user space address - * r1 = kernel space address - * r2 = length - * - * Copies bytes from user space to kernel space - * - * We save/restore r4-r11: - * r4-r11 are scratch - */ -ENTRY(copyin) - /* Quick exit if length is zero */ - teq r2, #0 - moveq r0, #0 - RETeq - - adds r3, r0, r2 - movcs r0, #EFAULT - RETc(cs) - - ldr r12, =(VM_MAXUSER_ADDRESS + 1) - cmp r3, r12 - movcs r0, #EFAULT - RETc(cs) - - ldr r3, .L_arm_memcpy - ldr r3, [r3] - cmp r3, #0 - beq .Lnormal - ldr r3, .L_min_memcpy_size - ldr r3, [r3] - cmp r2, r3 - blt .Lnormal - stmfd sp!, {r0-r2, r4, lr} - mov r3, r0 - mov r0, r1 - mov r1, r3 - mov r3, #2 /* SRC_IS_USER */ - ldr r4, .L_arm_memcpy - mov lr, pc - ldr pc, [r4] - cmp r0, #0 - ldmfd sp!, {r0-r2, r4, lr} - moveq r0, #0 - RETeq - -.Lnormal: - SAVE_REGS - GET_PCB(r4) - ldr r4, [r4] - - - ldr r5, [r4, #PCB_ONFAULT] - adr r3, .Lcopyfault - str r3, [r4, #PCB_ONFAULT] - - PREFETCH(r0, 0) - PREFETCH(r1, 0) - - /* - * If not too many bytes, take the slow path. - */ - cmp r2, #0x08 - blt .Licleanup - - /* - * Align destination to word boundary. - */ - and r6, r1, #0x3 - ldr pc, [pc, r6, lsl #2] - b .Lialend - .word .Lialend - .word .Lial3 - .word .Lial2 - .word .Lial1 -.Lial3: ldrbt r6, [r0], #1 - sub r2, r2, #1 - strb r6, [r1], #1 -.Lial2: ldrbt r7, [r0], #1 - sub r2, r2, #1 - strb r7, [r1], #1 -.Lial1: ldrbt r6, [r0], #1 - sub r2, r2, #1 - strb r6, [r1], #1 -.Lialend: - - /* - * If few bytes left, finish slow. - */ - cmp r2, #0x08 - blt .Licleanup - - /* - * If source is not aligned, finish slow. - */ - ands r3, r0, #0x03 - bne .Licleanup - - cmp r2, #0x60 /* Must be > 0x5f for unrolled cacheline */ - blt .Licleanup8 - - /* - * Align destination to cacheline boundary. - * If source and destination are nicely aligned, this can be a big - * win. If not, it's still cheaper to copy in groups of 32 even if - * we don't get the nice cacheline alignment. - */ - and r6, r1, #0x1f - ldr pc, [pc, r6] - b .Licaligned - .word .Licaligned - .word .Lical28 - .word .Lical24 - .word .Lical20 - .word .Lical16 - .word .Lical12 - .word .Lical8 - .word .Lical4 -.Lical28:ldrt r6, [r0], #4 - sub r2, r2, #4 - str r6, [r1], #4 -.Lical24:ldrt r7, [r0], #4 - sub r2, r2, #4 - str r7, [r1], #4 -.Lical20:ldrt r6, [r0], #4 - sub r2, r2, #4 - str r6, [r1], #4 -.Lical16:ldrt r7, [r0], #4 - sub r2, r2, #4 - str r7, [r1], #4 -.Lical12:ldrt r6, [r0], #4 - sub r2, r2, #4 - str r6, [r1], #4 -.Lical8:ldrt r7, [r0], #4 - sub r2, r2, #4 - str r7, [r1], #4 -.Lical4:ldrt r6, [r0], #4 - sub r2, r2, #4 - str r6, [r1], #4 - - /* - * We start with > 0x40 bytes to copy (>= 0x60 got us into this - * part of the code, and we may have knocked that down by as much - * as 0x1c getting aligned). - * - * This loop basically works out to: - * do { - * prefetch-next-cacheline(s) - * bytes -= 0x20; - * copy cacheline - * } while (bytes >= 0x40); - * bytes -= 0x20; - * copy cacheline - */ -.Licaligned: - PREFETCH(r0, 32) - PREFETCH(r1, 32) - - sub r2, r2, #0x20 - - /* Copy a cacheline */ - ldrt r10, [r0], #4 - ldrt r11, [r0], #4 - ldrt r6, [r0], #4 - ldrt r7, [r0], #4 - ldrt r8, [r0], #4 - ldrt r9, [r0], #4 - stmia r1!, {r10-r11} - ldrt r10, [r0], #4 - ldrt r11, [r0], #4 - stmia r1!, {r6-r11} - - cmp r2, #0x40 - bge .Licaligned - - sub r2, r2, #0x20 - - /* Copy a cacheline */ - ldrt r10, [r0], #4 - ldrt r11, [r0], #4 - ldrt r6, [r0], #4 - ldrt r7, [r0], #4 - ldrt r8, [r0], #4 - ldrt r9, [r0], #4 - stmia r1!, {r10-r11} - ldrt r10, [r0], #4 - ldrt r11, [r0], #4 - stmia r1!, {r6-r11} - - cmp r2, #0x08 - blt .Liprecleanup - -.Licleanup8: - ldrt r8, [r0], #4 - ldrt r9, [r0], #4 - sub r2, r2, #8 - stmia r1!, {r8, r9} - cmp r2, #8 - bge .Licleanup8 - -.Liprecleanup: - /* - * If we're done, bail. - */ - cmp r2, #0 - beq .Lout - -.Licleanup: - and r6, r2, #0x3 - ldr pc, [pc, r6, lsl #2] - b .Licend - .word .Lic4 - .word .Lic1 - .word .Lic2 - .word .Lic3 -.Lic4: ldrbt r6, [r0], #1 - sub r2, r2, #1 - strb r6, [r1], #1 -.Lic3: ldrbt r7, [r0], #1 - sub r2, r2, #1 - strb r7, [r1], #1 -.Lic2: ldrbt r6, [r0], #1 - sub r2, r2, #1 - strb r6, [r1], #1 -.Lic1: ldrbt r7, [r0], #1 - subs r2, r2, #1 - strb r7, [r1], #1 -.Licend: - bne .Licleanup - -.Liout: - mov r0, #0 - - str r5, [r4, #PCB_ONFAULT] - RESTORE_REGS - - RET - -.Lcopyfault: - ldr r0, =EFAULT - str r5, [r4, #PCB_ONFAULT] - RESTORE_REGS - - RET -END(copyin) - -/* - * r0 = kernel space address - * r1 = user space address - * r2 = length - * - * Copies bytes from kernel space to user space - * - * We save/restore r4-r11: - * r4-r11 are scratch - */ - -ENTRY(copyout) - /* Quick exit if length is zero */ - teq r2, #0 - moveq r0, #0 - RETeq - - adds r3, r1, r2 - movcs r0, #EFAULT - RETc(cs) - - ldr r12, =(VM_MAXUSER_ADDRESS + 1) - cmp r3, r12 - movcs r0, #EFAULT - RETc(cs) - - ldr r3, .L_arm_memcpy - ldr r3, [r3] - cmp r3, #0 - beq .Lnormale - ldr r3, .L_min_memcpy_size - ldr r3, [r3] - cmp r2, r3 - blt .Lnormale - stmfd sp!, {r0-r2, r4, lr} - _SAVE({r0-r2, r4, lr}) - mov r3, r0 - mov r0, r1 - mov r1, r3 - mov r3, #1 /* DST_IS_USER */ - ldr r4, .L_arm_memcpy - mov lr, pc - ldr pc, [r4] - cmp r0, #0 - ldmfd sp!, {r0-r2, r4, lr} - moveq r0, #0 - RETeq - -.Lnormale: - SAVE_REGS - GET_PCB(r4) - ldr r4, [r4] - - ldr r5, [r4, #PCB_ONFAULT] - adr r3, .Lcopyfault - str r3, [r4, #PCB_ONFAULT] - - PREFETCH(r0, 0) - PREFETCH(r1, 0) - - /* - * If not too many bytes, take the slow path. - */ - cmp r2, #0x08 - blt .Lcleanup - - /* - * Align destination to word boundary. - */ - and r6, r1, #0x3 - ldr pc, [pc, r6, lsl #2] - b .Lalend - .word .Lalend - .word .Lal3 - .word .Lal2 - .word .Lal1 -.Lal3: ldrb r6, [r0], #1 - sub r2, r2, #1 - strbt r6, [r1], #1 -.Lal2: ldrb r7, [r0], #1 - sub r2, r2, #1 - strbt r7, [r1], #1 -.Lal1: ldrb r6, [r0], #1 - sub r2, r2, #1 - strbt r6, [r1], #1 -.Lalend: - - /* - * If few bytes left, finish slow. - */ - cmp r2, #0x08 - blt .Lcleanup - - /* - * If source is not aligned, finish slow. - */ - ands r3, r0, #0x03 - bne .Lcleanup - - cmp r2, #0x60 /* Must be > 0x5f for unrolled cacheline */ - blt .Lcleanup8 - - /* - * Align source & destination to cacheline boundary. - */ - and r6, r1, #0x1f - ldr pc, [pc, r6] - b .Lcaligned - .word .Lcaligned - .word .Lcal28 - .word .Lcal24 - .word .Lcal20 - .word .Lcal16 - .word .Lcal12 - .word .Lcal8 - .word .Lcal4 -.Lcal28:ldr r6, [r0], #4 - sub r2, r2, #4 - strt r6, [r1], #4 -.Lcal24:ldr r7, [r0], #4 - sub r2, r2, #4 - strt r7, [r1], #4 -.Lcal20:ldr r6, [r0], #4 - sub r2, r2, #4 - strt r6, [r1], #4 -.Lcal16:ldr r7, [r0], #4 - sub r2, r2, #4 - strt r7, [r1], #4 -.Lcal12:ldr r6, [r0], #4 - sub r2, r2, #4 - strt r6, [r1], #4 -.Lcal8: ldr r7, [r0], #4 - sub r2, r2, #4 - strt r7, [r1], #4 -.Lcal4: ldr r6, [r0], #4 - sub r2, r2, #4 - strt r6, [r1], #4 - - /* - * We start with > 0x40 bytes to copy (>= 0x60 got us into this - * part of the code, and we may have knocked that down by as much - * as 0x1c getting aligned). - * - * This loop basically works out to: - * do { - * prefetch-next-cacheline(s) - * bytes -= 0x20; - * copy cacheline - * } while (bytes >= 0x40); - * bytes -= 0x20; - * copy cacheline - */ -.Lcaligned: - PREFETCH(r0, 32) - PREFETCH(r1, 32) - - sub r2, r2, #0x20 - - /* Copy a cacheline */ - ldmia r0!, {r6-r11} - strt r6, [r1], #4 - strt r7, [r1], #4 - ldmia r0!, {r6-r7} - strt r8, [r1], #4 - strt r9, [r1], #4 - strt r10, [r1], #4 - strt r11, [r1], #4 - strt r6, [r1], #4 - strt r7, [r1], #4 - - cmp r2, #0x40 - bge .Lcaligned - - sub r2, r2, #0x20 - - /* Copy a cacheline */ - ldmia r0!, {r6-r11} - strt r6, [r1], #4 - strt r7, [r1], #4 - ldmia r0!, {r6-r7} - strt r8, [r1], #4 - strt r9, [r1], #4 - strt r10, [r1], #4 - strt r11, [r1], #4 - strt r6, [r1], #4 - strt r7, [r1], #4 - - cmp r2, #0x08 - blt .Lprecleanup - -.Lcleanup8: - ldmia r0!, {r8-r9} - sub r2, r2, #8 - strt r8, [r1], #4 - strt r9, [r1], #4 - cmp r2, #8 - bge .Lcleanup8 - -.Lprecleanup: - /* - * If we're done, bail. - */ - cmp r2, #0 - beq .Lout - -.Lcleanup: - and r6, r2, #0x3 - ldr pc, [pc, r6, lsl #2] - b .Lcend - .word .Lc4 - .word .Lc1 - .word .Lc2 - .word .Lc3 -.Lc4: ldrb r6, [r0], #1 - sub r2, r2, #1 - strbt r6, [r1], #1 -.Lc3: ldrb r7, [r0], #1 - sub r2, r2, #1 - strbt r7, [r1], #1 -.Lc2: ldrb r6, [r0], #1 - sub r2, r2, #1 - strbt r6, [r1], #1 -.Lc1: ldrb r7, [r0], #1 - subs r2, r2, #1 - strbt r7, [r1], #1 -.Lcend: - bne .Lcleanup - -.Lout: - mov r0, #0 - - str r5, [r4, #PCB_ONFAULT] - RESTORE_REGS - - RET -END(copyout) -#endif /* * int badaddr_read_1(const uint8_t *src, uint8_t *dest) Modified: head/sys/arm/arm/in_cksum_arm.S ============================================================================== --- head/sys/arm/arm/in_cksum_arm.S Sun Nov 29 16:29:40 2020 (r368157) +++ head/sys/arm/arm/in_cksum_arm.S Sun Nov 29 16:44:22 2020 (r368158) @@ -116,9 +116,7 @@ END(do_cksum) */ /* LINTSTUB: Ignore */ ASENTRY_NP(L_cksumdata) -#ifdef _ARM_ARCH_5E pld [r0] /* Pre-fetch the start of the buffer */ -#endif mov r2, #0 /* We first have to word-align the buffer. */ @@ -144,7 +142,6 @@ ASENTRY_NP(L_cksumdata) /* Buffer is now word aligned */ .Lcksumdata_wordaligned: -#ifdef _ARM_ARCH_5E cmp r1, #0x04 /* Less than 4 bytes left? */ blt .Lcksumdata_endgame /* Yup */ @@ -199,43 +196,10 @@ ASENTRY_NP(L_cksumdata) adcs r2, r2, r7 adc r2, r2, #0x00 -#else /* !_ARM_ARCH_5E */ - - subs r1, r1, #0x40 - blt .Lcksumdata_bigloop_end - -.Lcksumdata_bigloop: - ldmia r0!, {r3, r4, r5, r6} - adds r2, r2, r3 - adcs r2, r2, r4 - adcs r2, r2, r5 - ldmia r0!, {r3, r4, r5, r7} - adcs r2, r2, r6 - adcs r2, r2, r3 - adcs r2, r2, r4 - adcs r2, r2, r5 - ldmia r0!, {r3, r4, r5, r6} - adcs r2, r2, r7 - adcs r2, r2, r3 - adcs r2, r2, r4 - adcs r2, r2, r5 - ldmia r0!, {r3, r4, r5, r7} - adcs r2, r2, r6 - adcs r2, r2, r3 - adcs r2, r2, r4 - adcs r2, r2, r5 - adcs r2, r2, r7 - adc r2, r2, #0x00 - subs r1, r1, #0x40 - bge .Lcksumdata_bigloop -.Lcksumdata_bigloop_end: -#endif - adds r1, r1, #0x40 RETeq cmp r1, #0x20 -#ifdef _ARM_ARCH_5E ldrdge r4, [r0], #0x08 /* Avoid stalling pld and result */ blt .Lcksumdata_less_than_32 pld [r0, #0x18] @@ -250,19 +214,6 @@ ASENTRY_NP(L_cksumdata) adcs r2, r2, r5 adcs r2, r2, r6 /* XXX: Unavoidable result stall */ adcs r2, r2, r7 -#else - blt .Lcksumdata_less_than_32 - ldmia r0!, {r3, r4, r5, r6} - adds r2, r2, r3 - adcs r2, r2, r4 - adcs r2, r2, r5 - ldmia r0!, {r3, r4, r5, r7} - adcs r2, r2, r6 - adcs r2, r2, r3 - adcs r2, r2, r4 - adcs r2, r2, r5 - adcs r2, r2, r7 -#endif adc r2, r2, #0x00 subs r1, r1, #0x20 RETeq Modified: head/sys/arm/arm/machdep.c ============================================================================== --- head/sys/arm/arm/machdep.c Sun Nov 29 16:29:40 2020 (r368157) +++ head/sys/arm/arm/machdep.c Sun Nov 29 16:44:22 2020 (r368158) @@ -107,8 +107,8 @@ __FBSDID("$FreeBSD$"); #endif -#ifndef _ARM_ARCH_5E -#error FreeBSD requires ARMv5 or later +#ifndef _ARM_ARCH_6 +#error FreeBSD requires ARMv6 or later #endif struct pcpu __pcpu[MAXCPU]; Modified: head/sys/arm/arm/support.S ============================================================================== --- head/sys/arm/arm/support.S Sun Nov 29 16:29:40 2020 (r368157) +++ head/sys/arm/arm/support.S Sun Nov 29 16:44:22 2020 (r368158) @@ -149,17 +149,11 @@ do_memset: /* We are now word aligned */ .Lmemset_wordaligned: orr r3, r3, r3, lsl #8 /* Extend value to 16-bits */ -#ifdef _ARM_ARCH_5E tst ip, #0x04 /* Quad-align for armv5e */ -#else - cmp r1, #0x10 -#endif orr r3, r3, r3, lsl #16 /* Extend value to 32-bits */ -#ifdef _ARM_ARCH_5E subne r1, r1, #0x04 /* Quad-align if necessary */ strne r3, [ip], #0x04 cmp r1, #0x10 -#endif blt .Lmemset_loop4 /* If less than 16 then use words */ mov r2, r3 /* Duplicate data */ cmp r1, #0x80 /* If < 128 then skip the big loop */ @@ -168,7 +162,6 @@ do_memset: /* Do 128 bytes at a time */ .Lmemset_loop128: subs r1, r1, #0x80 -#ifdef _ARM_ARCH_5E strdge r2, [ip], #0x08 strdge r2, [ip], #0x08 strdge r2, [ip], #0x08 @@ -185,24 +178,6 @@ do_memset: strdge r2, [ip], #0x08 strdge r2, [ip], #0x08 strdge r2, [ip], #0x08 -#else - stmiage ip!, {r2-r3} - stmiage ip!, {r2-r3} - stmiage ip!, {r2-r3} - stmiage ip!, {r2-r3} - stmiage ip!, {r2-r3} - stmiage ip!, {r2-r3} - stmiage ip!, {r2-r3} - stmiage ip!, {r2-r3} - stmiage ip!, {r2-r3} - stmiage ip!, {r2-r3} - stmiage ip!, {r2-r3} - stmiage ip!, {r2-r3} - stmiage ip!, {r2-r3} - stmiage ip!, {r2-r3} - stmiage ip!, {r2-r3} - stmiage ip!, {r2-r3} -#endif bgt .Lmemset_loop128 RETeq /* Zero length so just exit */ @@ -211,30 +186,18 @@ do_memset: /* Do 32 bytes at a time */ .Lmemset_loop32: subs r1, r1, #0x20 -#ifdef _ARM_ARCH_5E strdge r2, [ip], #0x08 strdge r2, [ip], #0x08 strdge r2, [ip], #0x08 strdge r2, [ip], #0x08 -#else - stmiage ip!, {r2-r3} - stmiage ip!, {r2-r3} - stmiage ip!, {r2-r3} - stmiage ip!, {r2-r3} -#endif bgt .Lmemset_loop32 RETeq /* Zero length so just exit */ adds r1, r1, #0x10 /* Partially adjust for extra sub */ /* Deal with 16 bytes or more */ -#ifdef _ARM_ARCH_5E strdge r2, [ip], #0x08 strdge r2, [ip], #0x08 -#else - stmiage ip!, {r2-r3} - stmiage ip!, {r2-r3} -#endif RETeq /* Zero length so just exit */ addlt r1, r1, #0x10 /* Possibly adjust for extra sub */ @@ -246,14 +209,10 @@ do_memset: bgt .Lmemset_loop4 RETeq /* Zero length so just exit */ -#ifdef _ARM_ARCH_5E /* Compensate for 64-bit alignment check */ adds r1, r1, #0x04 RETeq cmp r1, #2 -#else - cmp r1, #-2 -#endif strb r3, [ip], #0x01 /* Set 1 byte */ strbge r3, [ip], #0x01 /* Set another byte */ @@ -804,243 +763,6 @@ EENTRY(memmove) EEND(memmove) END(bcopy) -#if !defined(_ARM_ARCH_5E) -ENTRY(memcpy) - /* save leaf functions having to store this away */ - /* Do not check arm_memcpy if we're running from flash */ -#if defined(FLASHADDR) && defined(PHYSADDR) -#if FLASHADDR > PHYSADDR - ldr r3, =FLASHADDR - cmp r3, pc - bls .Lnormal -#else - ldr r3, =FLASHADDR - cmp r3, pc - bhi .Lnormal -#endif -#endif - ldr r3, .L_arm_memcpy - ldr r3, [r3] - cmp r3, #0 - beq .Lnormal - ldr r3, .L_min_memcpy_size - ldr r3, [r3] - cmp r2, r3 - blt .Lnormal - stmfd sp!, {r0-r2, r4, lr} - mov r3, #0 - ldr r4, .L_arm_memcpy - mov lr, pc - ldr pc, [r4] - cmp r0, #0 - ldmfd sp!, {r0-r2, r4, lr} - RETeq - -.Lnormal: - stmdb sp!, {r0, lr} /* memcpy() returns dest addr */ - - subs r2, r2, #4 - blt .Lmemcpy_l4 /* less than 4 bytes */ - ands r12, r0, #3 - bne .Lmemcpy_destul /* oh unaligned destination addr */ - ands r12, r1, #3 - bne .Lmemcpy_srcul /* oh unaligned source addr */ - -.Lmemcpy_t8: - /* We have aligned source and destination */ - subs r2, r2, #8 - blt .Lmemcpy_l12 /* less than 12 bytes (4 from above) */ - subs r2, r2, #0x14 - blt .Lmemcpy_l32 /* less than 32 bytes (12 from above) */ - stmdb sp!, {r4} /* borrow r4 */ - - /* blat 32 bytes at a time */ - /* XXX for really big copies perhaps we should use more registers */ -.Lmemcpy_loop32: - ldmia r1!, {r3, r4, r12, lr} - stmia r0!, {r3, r4, r12, lr} - ldmia r1!, {r3, r4, r12, lr} - stmia r0!, {r3, r4, r12, lr} - subs r2, r2, #0x20 - bge .Lmemcpy_loop32 - - cmn r2, #0x10 - ldmiage r1!, {r3, r4, r12, lr} /* blat a remaining 16 bytes */ - stmiage r0!, {r3, r4, r12, lr} - subge r2, r2, #0x10 - ldmia sp!, {r4} /* return r4 */ - -.Lmemcpy_l32: - adds r2, r2, #0x14 - - /* blat 12 bytes at a time */ -.Lmemcpy_loop12: - ldmiage r1!, {r3, r12, lr} - stmiage r0!, {r3, r12, lr} - subsge r2, r2, #0x0c - bge .Lmemcpy_loop12 - -.Lmemcpy_l12: - adds r2, r2, #8 - blt .Lmemcpy_l4 - - subs r2, r2, #4 - ldrlt r3, [r1], #4 - strlt r3, [r0], #4 - ldmiage r1!, {r3, r12} - stmiage r0!, {r3, r12} - subge r2, r2, #4 - -.Lmemcpy_l4: - /* less than 4 bytes to go */ - adds r2, r2, #4 -#ifdef __APCS_26_ - ldmiaeq sp!, {r0, pc}^ /* done */ -#else - ldmiaeq sp!, {r0, pc} /* done */ -#endif - /* copy the crud byte at a time */ - cmp r2, #2 - ldrb r3, [r1], #1 - strb r3, [r0], #1 - ldrbge r3, [r1], #1 - strbge r3, [r0], #1 - ldrbgt r3, [r1], #1 - strbgt r3, [r0], #1 - ldmia sp!, {r0, pc} - - /* erg - unaligned destination */ -.Lmemcpy_destul: - rsb r12, r12, #4 - cmp r12, #2 - - /* align destination with byte copies */ - ldrb r3, [r1], #1 - strb r3, [r0], #1 - ldrbge r3, [r1], #1 - strbge r3, [r0], #1 - ldrbgt r3, [r1], #1 - strbgt r3, [r0], #1 - subs r2, r2, r12 - blt .Lmemcpy_l4 /* less the 4 bytes */ - - ands r12, r1, #3 - beq .Lmemcpy_t8 /* we have an aligned source */ - - /* erg - unaligned source */ - /* This is where it gets nasty ... */ -.Lmemcpy_srcul: - bic r1, r1, #3 - ldr lr, [r1], #4 - cmp r12, #2 - bgt .Lmemcpy_srcul3 - beq .Lmemcpy_srcul2 - cmp r2, #0x0c *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Sun Nov 29 17:36:35 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 93AB74A8848; Sun, 29 Nov 2020 17:36:35 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4CkbBq1VrQz4vtL; Sun, 29 Nov 2020 17:36:34 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.16.1/8.16.1) with ESMTPS id 0ATHaL6W070086 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Sun, 29 Nov 2020 19:36:24 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 0ATHaL6W070086 Received: (from kostik@localhost) by tom.home (8.16.1/8.16.1/Submit) id 0ATHaLkE070085; Sun, 29 Nov 2020 19:36:21 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Sun, 29 Nov 2020 19:36:21 +0200 From: Konstantin Belousov To: mmel@freebsd.org Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r368124 - in head/sys: cam cam/ata cam/ctl cam/mmc cam/nvme cam/scsi compat/linprocfs compat/linux conf contrib/openzfs/module/os/freebsd/zfs dev/ahci dev/ata dev/firewire dev/flash dev... Message-ID: References: <202011281212.0ASCCpjQ006999@repo.freebsd.org> <56ede111-cf89-366e-fbda-aa26f4a78a23@freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <56ede111-cf89-366e-fbda-aa26f4a78a23@freebsd.org> X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on tom.home X-Rspamd-Queue-Id: 4CkbBq1VrQz4vtL X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Nov 2020 17:36:35 -0000 On Sun, Nov 29, 2020 at 02:03:57PM +0100, Michal Meloun wrote: > On 28.11.2020 13:12, Konstantin Belousov wrote: > > Author: kib > > Date: Sat Nov 28 12:12:51 2020 > > New Revision: 368124 > > URL: https://svnweb.freebsd.org/changeset/base/368124 > > > > Log: > > Make MAXPHYS tunable. Bump MAXPHYS to 1M. > > > Unfortunately, bumping MAXPHYS broke arm kernel. The kernel runs out of KVA > while running 'pbuf' keg init function. This causes that keg_alloc_slab() > always returns NULL and for cycle in uma_prealloc() newer ends (whish should > be considered as another bug). > Do you think that MAXPHYS constant can depends on given arch? > 128k (or 256k) sounds reasonable for arm32 systems... I think it is reasonable to return to 128KB for 32bit systems. diff --git a/sys/sys/param.h b/sys/sys/param.h index 00fb0c860e7..076b1fcde05 100644 --- a/sys/sys/param.h +++ b/sys/sys/param.h @@ -159,8 +159,12 @@ #ifndef DFLTPHYS #define DFLTPHYS (64 * 1024) /* default max raw I/O transfer size */ #endif -#ifndef MAXPHYS -#define MAXPHYS (1024 * 1024) /* max raw I/O transfer size */ +#ifndef MAXPHYS /* max raw I/O transfer size */ +#ifdef __ILP32__ +#define MAXPHYS (128 * 1024) +#else +#define MAXPHYS (1024 * 1024) +#endif #endif #ifndef MAXDUMPPGS #define MAXDUMPPGS (DFLTPHYS/PAGE_SIZE) From owner-svn-src-head@freebsd.org Sun Nov 29 17:42:33 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EB2964A8C98; Sun, 29 Nov 2020 17:42:33 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CkbKj5svQz3C18; Sun, 29 Nov 2020 17:42:33 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BC8FC15782; Sun, 29 Nov 2020 17:42:33 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0ATHgXoa011828; Sun, 29 Nov 2020 17:42:33 GMT (envelope-from mmel@FreeBSD.org) Received: (from mmel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0ATHgXcF011823; Sun, 29 Nov 2020 17:42:33 GMT (envelope-from mmel@FreeBSD.org) Message-Id: <202011291742.0ATHgXcF011823@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmel set sender to mmel@FreeBSD.org using -f From: Michal Meloun Date: Sun, 29 Nov 2020 17:42:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368159 - in head/sys: arm/conf conf X-SVN-Group: head X-SVN-Commit-Author: mmel X-SVN-Commit-Paths: in head/sys: arm/conf conf X-SVN-Commit-Revision: 368159 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Nov 2020 17:42:34 -0000 Author: mmel Date: Sun Nov 29 17:42:32 2020 New Revision: 368159 URL: https://svnweb.freebsd.org/changeset/base/368159 Log: Remove unused options. Marvell files and their related SOC_MV_ options should be cleaned up in another pass. Modified: head/sys/arm/conf/NOTES head/sys/arm/conf/std.armv6 head/sys/arm/conf/std.armv7 head/sys/conf/options.arm Modified: head/sys/arm/conf/NOTES ============================================================================== --- head/sys/arm/conf/NOTES Sun Nov 29 16:44:22 2020 (r368158) +++ head/sys/arm/conf/NOTES Sun Nov 29 17:42:32 2020 (r368159) @@ -9,7 +9,6 @@ makeoptions CONF_CFLAGS+="-march=armv7a" # Add options for armv7 that are not in sys/conf/NOTES... -options ARM_L2_PIPT # Only L2 PIPT is supported options FDT # Flattened device tree support options FREEBSD_BOOT_LOADER # Process metadata passed from loader(8) options INTRNG # Include INTRNG framework Modified: head/sys/arm/conf/std.armv6 ============================================================================== --- head/sys/arm/conf/std.armv6 Sun Nov 29 16:44:22 2020 (r368158) +++ head/sys/arm/conf/std.armv6 Sun Nov 29 17:42:32 2020 (r368159) @@ -3,7 +3,6 @@ # $FreeBSD$ options HZ=1000 -options ARM_L2_PIPT # Only L2 PIPT is supported options INTRNG # All arm systems use INTRNG these days options PREEMPTION # Enable kernel thread preemption options VIMAGE # Subsystem virtualization, e.g. VNET Modified: head/sys/arm/conf/std.armv7 ============================================================================== --- head/sys/arm/conf/std.armv7 Sun Nov 29 16:44:22 2020 (r368158) +++ head/sys/arm/conf/std.armv7 Sun Nov 29 17:42:32 2020 (r368159) @@ -3,7 +3,6 @@ # $FreeBSD$ options HZ=1000 -options ARM_L2_PIPT # Only L2 PIPT is supported options INTRNG # All arm systems use INTRNG these days options PREEMPTION # Enable kernel thread preemption options VIMAGE # Subsystem virtualization, e.g. VNET Modified: head/sys/conf/options.arm ============================================================================== --- head/sys/conf/options.arm Sun Nov 29 16:44:22 2020 (r368158) +++ head/sys/conf/options.arm Sun Nov 29 17:42:32 2020 (r368159) @@ -1,13 +1,7 @@ #$FreeBSD$ ARMV6 opt_global.h ARMV7 opt_global.h -ARM_CACHE_LOCK_ENABLE opt_global.h -ARM_KERN_DIRECTMAP opt_vm.h -ARM_L2_PIPT opt_global.h -ARM_MANY_BOARD opt_global.h -ARM_WANT_TP_ADDRESS opt_global.h CPSW_ETHERSWITCH opt_cpsw.h -CPU_ARM9E opt_global.h CPU_ARM1176 opt_global.h CPU_CORTEXA opt_global.h CPU_KRAIT opt_global.h @@ -23,7 +17,6 @@ FREEBSD_BOOT_LOADER opt_global.h KERNBASE opt_global.h KERNVIRTADDR opt_global.h LINUX_BOOT_ABI opt_global.h -LOADERRAMADDR opt_global.h LOCORE_MAP_MB opt_locore.h NKPT2PG opt_pmap.h PHYSADDR opt_global.h @@ -31,7 +24,6 @@ PLATFORM opt_global.h SOCDEV_PA opt_global.h SOCDEV_VA opt_global.h PV_STATS opt_pmap.h -QEMU_WORKAROUNDS opt_global.h SOC_ALLWINNER_A10 opt_global.h SOC_ALLWINNER_A13 opt_global.h SOC_ALLWINNER_A20 opt_global.h @@ -56,13 +48,6 @@ SOC_MV_KIRKWOOD opt_global.h SOC_MV_ORION opt_global.h SOC_OMAP3 opt_global.h SOC_OMAP4 opt_global.h -SOC_ROCKCHIP_RK3188 opt_global.h SOC_TI_AM335X opt_global.h -SOC_TEGRA2 opt_global.h -XSCALE_CACHE_READ_WRITE_ALLOCATE opt_global.h -VERBOSE_INIT_ARM opt_global.h VM_MAXUSER_ADDRESS opt_global.h -GFB_DEBUG opt_gfb.h -GFB_NO_FONT_LOADING opt_gfb.h -GFB_NO_MODE_CHANGE opt_gfb.h VFP opt_global.h From owner-svn-src-head@freebsd.org Sun Nov 29 17:46:34 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4CC054A8C52; Sun, 29 Nov 2020 17:46:34 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-io1-f52.google.com (mail-io1-f52.google.com [209.85.166.52]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CkbQL1cVdz3CRd; Sun, 29 Nov 2020 17:46:33 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: by mail-io1-f52.google.com with SMTP id z5so9490294iob.11; Sun, 29 Nov 2020 09:46:33 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=va3bGKlxE1cYCRJSokKOr/91QQaLiqdzsL72YcrBPrE=; b=uSDU+mkWi3cIKWHyUGHq9KPvKThj2UQ/A0e78t0xGNcQZJgmGsWSN9udOpjYTLwAGC LQpZ6E3D7JE2Q4pvqGx7g+ld8mg5PrWkfQTSKyjkaAH5+vg5gmvSX6G2DphlmxvMoe1F xzOjLjZFuHKCMg2Yaljt4HpHTGiN6DA6/NDhDAunl8xsR76tWk6bI1oHwEtBc8luZPRc jV6Lv/+Apg0sztfVn6IlVVXMGZQXc26awNVRvgfKpJq4lhPOUFwIIOuFTk8FQz9d4u3k slqGywwcduERmj5ABGUhOxf+R6JsbaxeC7uHWCxqiYZrX513zHRchR9fOxAMobxM173c OSuQ== X-Gm-Message-State: AOAM531MPGOAS9SnstNcLl7S10PnOBubIop10GPPf+QBs7paJZ9pwDun zSai4VCQ7sVAM6jWxqrnpi+b4h0Hi/uWL8d5dAU= X-Google-Smtp-Source: ABdhPJxIftLl2qBHKYw5EaqDl7HNrmd2Q4zfCX+3Ey2qD4YS8kISTLINZOdEn59ArKgXkqSbjM+mbqQiIvEp4ax1I30= X-Received: by 2002:a05:6638:31b:: with SMTP id w27mr49138jap.8.1606671992610; Sun, 29 Nov 2020 09:46:32 -0800 (PST) MIME-Version: 1.0 References: <202011281212.0ASCCpjQ006999@repo.freebsd.org> <56ede111-cf89-366e-fbda-aa26f4a78a23@freebsd.org> In-Reply-To: From: Ed Maste Date: Sun, 29 Nov 2020 12:46:20 -0500 Message-ID: Subject: Re: svn commit: r368124 - in head/sys: cam cam/ata cam/ctl cam/mmc cam/nvme cam/scsi compat/linprocfs compat/linux conf contrib/openzfs/module/os/freebsd/zfs dev/ahci dev/ata dev/firewire dev/flash dev... To: Konstantin Belousov Cc: Michal Meloun , src-committers , svn-src-all , svn-src-head Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4CkbQL1cVdz3CRd X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Nov 2020 17:46:34 -0000 On Sun, 29 Nov 2020 at 12:36, Konstantin Belousov wrote: > > I think it is reasonable to return to 128KB for 32bit systems. ... > +#ifndef MAXPHYS /* max raw I/O transfer size */ > +#ifdef __ILP32__ > +#define MAXPHYS (128 * 1024) > +#else > +#define MAXPHYS (1024 * 1024) > +#endif This seems reasonable to me. From owner-svn-src-head@freebsd.org Sun Nov 29 18:00:51 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4AC4A4A9042; Sun, 29 Nov 2020 18:00:51 +0000 (UTC) (envelope-from melounmichal@gmail.com) Received: from mail-wr1-x42f.google.com (mail-wr1-x42f.google.com [IPv6:2a00:1450:4864:20::42f]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Ckbkq1GP1z3D2l; Sun, 29 Nov 2020 18:00:50 +0000 (UTC) (envelope-from melounmichal@gmail.com) Received: by mail-wr1-x42f.google.com with SMTP id g14so12046669wrm.13; Sun, 29 Nov 2020 10:00:50 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:reply-to:subject:to:cc:references:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=/WvHTUN2aVZ1cFtw19e2SjH9VGCXkzivdGxVfZeXbdw=; b=Wp+oNHYCkfdFU9dNHGel8GNcH+FNZHZll2TxeFyGl+/KMOGEhKST6v4ZX0OO3BF8uh T5dkIWXPZY2j7xItyOM84BLAmVJmAT030ugroJ12v/4mZGSHSEWJrpNgUT64hym5CagU II4vN/qIR/PJ+IwIThrhvOKAoh4XulZGFRLRjP4vZVOjSXCyVG4LgDjHVp1LweprCE2R XgMsdL8kmH6j8pIOYOiB/Z3Sq/oFDbWEiEvyHKX7d4z9fizHZL9xPhSPXE9XsKvRoFGe 4GNP+yA+F31/q1MZrA66EuOkWnQii77C15xSBWP9EqxCD9FO8DRFhvExZQuTFQu9/qyb Kz9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:reply-to:subject:to:cc:references :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=/WvHTUN2aVZ1cFtw19e2SjH9VGCXkzivdGxVfZeXbdw=; b=XT42c9YweJzK29FZSF2cK0+0BkP6+TkkPVUEDuxOvMzVXbC4QkJhqupj16ibjqdmmq L33iCvsqC2U3xe3a5dHTHsUs6W0pBJa/lHBi2Nac2XmecuyBaOqtPF969Bppv+4F1c8U 9EKYHB/LtxFlvP93zCFK3MaM8kR8sMHDkIcQ4g0t4QlS/pe6ESEKg6LqHLSRtXSKGGDE Ub7Qh6qxdS3Eglzp6hZdhPJ4AAuOofcoRPk8iVxZwoG26FFVvRAgD3KoZom+9GHZLSqX vyGA4jyXT2BCDwR9sUVuMOFZaO/+J5ERX8rVVBrPxfhBY4RAMTga8hQkYiooUQEIBXv+ zE/A== X-Gm-Message-State: AOAM533airZOQ/IqpELyxdrEKt1NnJx8aEoyKaBUEa2FrsVzsj3EJjmE 7hNmmgxyj5ZiSIW3vTCHQxjgmdbWhKBZfA== X-Google-Smtp-Source: ABdhPJxx+bpZmPWk5ks4N4uRyZIwFTjhcNuzEstbr4p0M446asA1G/W5sTgzhOn34UACiWo/czDJTA== X-Received: by 2002:adf:e44d:: with SMTP id t13mr23593259wrm.144.1606672848502; Sun, 29 Nov 2020 10:00:48 -0800 (PST) Received: from [88.208.79.100] (halouny.humusoft.cz. [88.208.79.100]) by smtp.gmail.com with ESMTPSA id w3sm22037509wma.3.2020.11.29.10.00.47 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sun, 29 Nov 2020 10:00:48 -0800 (PST) Sender: Michal Meloun From: Michal Meloun X-Google-Original-From: Michal Meloun Reply-To: mmel@freebsd.org Subject: Re: svn commit: r368124 - in head/sys: cam cam/ata cam/ctl cam/mmc cam/nvme cam/scsi compat/linprocfs compat/linux conf contrib/openzfs/module/os/freebsd/zfs dev/ahci dev/ata dev/firewire dev/flash dev... To: Ed Maste , Konstantin Belousov Cc: src-committers , svn-src-all , svn-src-head References: <202011281212.0ASCCpjQ006999@repo.freebsd.org> <56ede111-cf89-366e-fbda-aa26f4a78a23@freebsd.org> Message-ID: <6ad1d3be-1431-cb96-8afa-1b26d270d7f7@freebsd.org> Date: Sun, 29 Nov 2020 19:00:48 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.5.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4Ckbkq1GP1z3D2l X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; TAGGED_FROM(0.00)[]; REPLY(-4.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Nov 2020 18:00:51 -0000 On 29.11.2020 18:46, Ed Maste wrote: > On Sun, 29 Nov 2020 at 12:36, Konstantin Belousov wrote: >> >> I think it is reasonable to return to 128KB for 32bit systems. > ... >> +#ifndef MAXPHYS /* max raw I/O transfer size */ >> +#ifdef __ILP32__ >> +#define MAXPHYS (128 * 1024) >> +#else >> +#define MAXPHYS (1024 * 1024) >> +#endif > > This seems reasonable to me. > Agree. Please commit it. Michal From owner-svn-src-head@freebsd.org Sun Nov 29 18:22:15 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 49CE84A9DB1; Sun, 29 Nov 2020 18:22:15 +0000 (UTC) (envelope-from fernape@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CkcCW1hHZz3G84; Sun, 29 Nov 2020 18:22:15 +0000 (UTC) (envelope-from fernape@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2D41A15B4B; Sun, 29 Nov 2020 18:22:15 +0000 (UTC) (envelope-from fernape@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0ATIMEIX036915; Sun, 29 Nov 2020 18:22:14 GMT (envelope-from fernape@FreeBSD.org) Received: (from fernape@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0ATIME1L036914; Sun, 29 Nov 2020 18:22:14 GMT (envelope-from fernape@FreeBSD.org) Message-Id: <202011291822.0ATIME1L036914@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: fernape set sender to fernape@FreeBSD.org using -f From: =?UTF-8?Q?Fernando_Apestegu=c3=ada?= Date: Sun, 29 Nov 2020 18:22:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368160 - head/usr.bin/iconv X-SVN-Group: head X-SVN-Commit-Author: fernape X-SVN-Commit-Paths: head/usr.bin/iconv X-SVN-Commit-Revision: 368160 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Nov 2020 18:22:15 -0000 Author: fernape (ports committer) Date: Sun Nov 29 18:22:14 2020 New Revision: 368160 URL: https://svnweb.freebsd.org/changeset/base/368160 Log: iconv(1): Add EXAMPLE Just a small example to show simple usage. Approved by: manpages (0mp@) MFC after: 2 weeks Differential Revision: https://reviews.freebsd.org/D27385 Modified: head/usr.bin/iconv/iconv.1 Modified: head/usr.bin/iconv/iconv.1 ============================================================================== --- head/usr.bin/iconv/iconv.1 Sun Nov 29 17:42:32 2020 (r368159) +++ head/usr.bin/iconv/iconv.1 Sun Nov 29 18:22:14 2020 (r368160) @@ -104,6 +104,13 @@ Specifies the destination codeset name as .El .Sh EXIT STATUS .Ex -std iconv +.Sh EXAMPLES +Convert +.Pa file.txt +from IBM273 to UTF-8 and save the result to +.Pa converted.txt : +.Pp +.Dl iconv -f IBM273 -t UTF-8 file.txt > converted.txt .Sh SEE ALSO .Xr mkcsmapper 1 , .Xr mkesdb 1 , From owner-svn-src-head@freebsd.org Sun Nov 29 18:59:02 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0DDEE4AA45C; Sun, 29 Nov 2020 18:59:02 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Ckd1x708rz3Hx1; Sun, 29 Nov 2020 18:59:01 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E2B77163CD; Sun, 29 Nov 2020 18:59:01 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0ATIx1T7055983; Sun, 29 Nov 2020 18:59:01 GMT (envelope-from mmel@FreeBSD.org) Received: (from mmel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0ATIx1fs055981; Sun, 29 Nov 2020 18:59:01 GMT (envelope-from mmel@FreeBSD.org) Message-Id: <202011291859.0ATIx1fs055981@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmel set sender to mmel@FreeBSD.org using -f From: Michal Meloun Date: Sun, 29 Nov 2020 18:59:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368161 - in head/sys/arm: arm include X-SVN-Group: head X-SVN-Commit-Author: mmel X-SVN-Commit-Paths: in head/sys/arm: arm include X-SVN-Commit-Revision: 368161 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Nov 2020 18:59:02 -0000 Author: mmel Date: Sun Nov 29 18:59:01 2020 New Revision: 368161 URL: https://svnweb.freebsd.org/changeset/base/368161 Log: Store MPIDR register in pcpu. MPIDR represents physical locality of given core and it should be used as the only viable/robust connection between cpuid (which have zero relation to cores topology) and external description (for example in FDT). It can be used for determining which interrupt is associated to given per-CPU PMU or by scheduler for determining big/little core or cluster topology. MFC after: 3 weeks Modified: head/sys/arm/arm/machdep.c head/sys/arm/arm/mp_machdep.c head/sys/arm/include/pcpu.h Modified: head/sys/arm/arm/machdep.c ============================================================================== --- head/sys/arm/arm/machdep.c Sun Nov 29 18:22:14 2020 (r368160) +++ head/sys/arm/arm/machdep.c Sun Nov 29 18:59:01 2020 (r368161) @@ -302,6 +302,8 @@ DELAY(int usec) void cpu_pcpu_init(struct pcpu *pcpu, int cpuid, size_t size) { + + pcpu->pc_mpidr = 0xffffffff; } void @@ -684,6 +686,7 @@ pcpu0_init(void) { set_curthread(&thread0); pcpu_init(pcpup, 0, sizeof(struct pcpu)); + pcpup->pc_mpidr = cp15_mpidr_get() & 0xFFFFFF; PCPU_SET(curthread, &thread0); } Modified: head/sys/arm/arm/mp_machdep.c ============================================================================== --- head/sys/arm/arm/mp_machdep.c Sun Nov 29 18:22:14 2020 (r368160) +++ head/sys/arm/arm/mp_machdep.c Sun Nov 29 18:59:01 2020 (r368161) @@ -162,6 +162,7 @@ init_secondary(int cpu) ; pcpu_init(pc, cpu, sizeof(struct pcpu)); + pc->pc_mpidr = cp15_mpidr_get() & 0xFFFFFF; dpcpu_init(dpcpu[cpu - 1], cpu); #if defined(DDB) dbg_monitor_init_secondary(); Modified: head/sys/arm/include/pcpu.h ============================================================================== --- head/sys/arm/include/pcpu.h Sun Nov 29 18:22:14 2020 (r368160) +++ head/sys/arm/include/pcpu.h Sun Nov 29 18:59:01 2020 (r368161) @@ -65,7 +65,8 @@ struct vmspace; int pc_bp_harden_kind; \ uint32_t pc_original_actlr; \ uint64_t pc_clock; \ - char __pad[139] + uint32_t pc_mpidr; \ + char __pad[135] #ifdef _KERNEL From owner-svn-src-head@freebsd.org Sun Nov 29 19:06:32 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A14084AA666; Sun, 29 Nov 2020 19:06:32 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CkdBc43ssz3JFt; Sun, 29 Nov 2020 19:06:32 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7DD3A1679D; Sun, 29 Nov 2020 19:06:32 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0ATJ6WKb062222; Sun, 29 Nov 2020 19:06:32 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0ATJ6WLl062221; Sun, 29 Nov 2020 19:06:32 GMT (envelope-from kib@FreeBSD.org) Message-Id: <202011291906.0ATJ6WLl062221@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Sun, 29 Nov 2020 19:06:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368162 - head/sys/sys X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/sys X-SVN-Commit-Revision: 368162 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Nov 2020 19:06:32 -0000 Author: kib Date: Sun Nov 29 19:06:32 2020 New Revision: 368162 URL: https://svnweb.freebsd.org/changeset/base/368162 Log: Reduce MAXPHYS back to 128KB on 32bit architectures. Some of them have limited KVA, like arm, which prevents startup from allocating needed number of large pbufs. Other, for instance i386, are dis-balanced enough after 4/4 that blind bump is probably harmful because it allows for much more in-flight io than other tunables are ready for. Requested by: mmel Reviewed by: emaste, mmel Sponsored by: The FreeBSD Foundation Modified: head/sys/sys/param.h Modified: head/sys/sys/param.h ============================================================================== --- head/sys/sys/param.h Sun Nov 29 18:59:01 2020 (r368161) +++ head/sys/sys/param.h Sun Nov 29 19:06:32 2020 (r368162) @@ -159,8 +159,12 @@ #ifndef DFLTPHYS #define DFLTPHYS (64 * 1024) /* default max raw I/O transfer size */ #endif -#ifndef MAXPHYS -#define MAXPHYS (1024 * 1024) /* max raw I/O transfer size */ +#ifndef MAXPHYS /* max raw I/O transfer size */ +#ifdef __ILP32__ +#define MAXPHYS (128 * 1024) +#else +#define MAXPHYS (1024 * 1024) +#endif #endif #ifndef MAXDUMPPGS #define MAXDUMPPGS (DFLTPHYS/PAGE_SIZE) From owner-svn-src-head@freebsd.org Sun Nov 29 19:14:52 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A8DFD4AADBB for ; Sun, 29 Nov 2020 19:14:52 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: from mail-qv1-xf2d.google.com (mail-qv1-xf2d.google.com [IPv6:2607:f8b0:4864:20::f2d]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CkdND44vCz3Jqg for ; Sun, 29 Nov 2020 19:14:52 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: by mail-qv1-xf2d.google.com with SMTP id cv2so4618228qvb.9 for ; Sun, 29 Nov 2020 11:14:52 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hardenedbsd.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=c0zu+bS5uGaP8/9h+T27dIrzCtwPwXnHXD6Tb2/5jN8=; b=jaJj9UEc4idXpiRwCzNS7Sk8T0AiAEuCWcPw7cQ32gHcJMUOTyH/IYx4uGJp8sCXwI mhWzE0s9ntOE8ZMZBfrfM4dqEwfUQ//hqb5vPwXHwtXf7G+C+r8zJ9ityz2nrG9I1hYk uP/3K5jaAeVTHGrRHQ/ALJwMUV5KePzgrHUQAuNKDaU0m9WAHomKZpXUaQ2mvX1zYtRq CHNE9njE8+9SJUTmcsyFpY0KkGFx6+j/U8m1+CuwGkOi6dsRAXg/uOC6+YD/l54yPp19 RZPQCFRhlqZyDnQdLQuD6n91B3W8/0neoD+d6TcYH8OHMeZ8hwIUM1CDNdNUJM2nzrqh jGTA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=c0zu+bS5uGaP8/9h+T27dIrzCtwPwXnHXD6Tb2/5jN8=; b=nEKwjUIPQgljgSZwzLqKkQol6azLdtUctS3vnQPmn/ZQs/LoLpp7ect7cpMjFKXO1U 5mAWyd+3tSYB5y03AG+y21qyV1iiOYDZj+sD6nIT9Moh6f/eQOGifZVXD9c2Om6eBM9v +J9Mnpi9KPwBGOXmDnjzU4JkwMV/625/JjmZb/P22g7BQqXXNenfZv4kcWOHcdW/tIUd u9spEP+Tfd7W8umk6peDcRwIsTSi8LPmsbcAvITtO96dxl8FdmiChw85QPK+2piWXyJ1 MFZf4u8/VugVsnfPGZdx47YFojI4Kg5CbKRnbTIe3TG/BRJxYPfMfW2F0nQ4a4drm1Bb q+SQ== X-Gm-Message-State: AOAM531RLfIm2NH3SqiuSnfCsW+o/HQtNTG7SMDyPFJUJSxPaF9wcZ1W b3AlNrYXKf1ywmSjMFyNSypG7Q== X-Google-Smtp-Source: ABdhPJwjBWWDtdzw3a0ucK+DkPigsFhKFj81PLv4lGWCS30x1UWXO8Y0L4tvykyPNgo5CWatiUA5tw== X-Received: by 2002:a0c:f981:: with SMTP id t1mr18361949qvn.60.1606677291606; Sun, 29 Nov 2020 11:14:51 -0800 (PST) Received: from mutt-hbsd (pool-100-16-222-53.bltmmd.fios.verizon.net. [100.16.222.53]) by smtp.gmail.com with ESMTPSA id x22sm12675581qts.53.2020.11.29.11.14.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Nov 2020 11:14:50 -0800 (PST) Date: Sun, 29 Nov 2020 14:14:50 -0500 From: Shawn Webb To: Michal Meloun Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r368141 - in head/sys/arm: allwinner annapurna/alpine arm freescale/imx include mv versatile Message-ID: <20201129191450.7c56z7qsiz76vumu@mutt-hbsd> X-Operating-System: FreeBSD mutt-hbsd 13.0-CURRENT-HBSD FreeBSD 13.0-CURRENT-HBSD X-PGP-Key: http://pgp.mit.edu/pks/lookup?op=vindex&search=0xFF2E67A277F8E1FA References: <202011290840.0AT8eClM067333@repo.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="hemgpxx6h5xu7c2k" Content-Disposition: inline In-Reply-To: <202011290840.0AT8eClM067333@repo.freebsd.org> X-Rspamd-Queue-Id: 4CkdND44vCz3Jqg X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Nov 2020 19:14:52 -0000 --hemgpxx6h5xu7c2k Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Nov 29, 2020 at 08:40:12AM +0000, Michal Meloun wrote: > Author: mmel > Date: Sun Nov 29 08:40:12 2020 > New Revision: 368141 > URL: https://svnweb.freebsd.org/changeset/base/368141 >=20 > Log: > Remove the pre-ARMv6 and pre-INTRNG code. > ARM has required ARMV6+ and INTRNg for some time now, so remove > always false #ifdefs and unconditionally do always true #ifdefs. >=20 > .sv_flags =3D > -#if __ARM_ARCH >=3D 6 > SV_ASLR | SV_SHP | SV_TIMEKEEP | SV_RNG_SEED_VER | > -#endif > SV_ABI_FREEBSD | SV_ILP32 | SV_ASLR, This causes SV_ASLR to be set twice. Thanks, --=20 Shawn Webb Cofounder / Security Engineer HardenedBSD GPG Key ID: 0xFF2E67A277F8E1FA GPG Key Fingerprint: D206 BB45 15E0 9C49 0CF9 3633 C85B 0AF8 AB23 0FB2 https://git-01.md.hardenedbsd.org/HardenedBSD/pubkeys/src/branch/master/Sha= wn_Webb/03A4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc --hemgpxx6h5xu7c2k Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEA6TL67gupaZ9nzhT/y5nonf44foFAl/D8ycACgkQ/y5nonf4 4fpbkg//RLwTgu5m15x/kDSYmtRn5zwfbpaf0F2SG9GGr1s8Fk8GAaDCM22Tf+lt pYvxvmNo6yUiCc2VrbSsW0V9EEwgJDH/DdElbcqCLieXAPwxQFA+QyGEkBAA7CZ1 uopsaIKM+Xaj5iFPjkNnhLYiG6JjDduMeUuA2U8YnvHFEN4bbNDS4dpIFb6ra+62 4ps+Qt35R6LXVWSXejlfMcK/haM1Q0J42mas5rLNKbPI/KP12H5O8QDs+tv340HG UTa7p2f5sTzuhUXToR9BEu36W7wwt7iqPZxUArGbbz5XR07aHrKRDnLRYA1OqEFL aCikNIe7xSIUdqmAMXtUoAUP5fwUI4WIE6YscM8/aRjF6znnpS3mLtou9xjs/H00 VRDYBYzYLk0MaDI5xuPBv+cNpE/CAKU8EsPS7pxhpIVCjre8yzv0p5XOJZitx5DS Cd/jIl0Aji/0Mji9QnWQ3IrxF9wsVL3h7IdF2PjD9vKUrrAl703370AbgMju4l2j 15ELGYLfyEP2akkxulQCij5pI6qwbN5Z4rg7/6R22LcAa5x0r1SWVckvOck+CQbZ Uz7wpK2ZldWeBQwXs8y5kN5vTgq4QcQ7y4Etyq7IlpupnxHSE90DvVpHZaQhLCVS c7WYMY0pkvOo0gNCK0SQCh9sQLI5R7VwyXFbuIre3ed6MFDwJiw= =e+iE -----END PGP SIGNATURE----- --hemgpxx6h5xu7c2k-- From owner-svn-src-head@freebsd.org Sun Nov 29 19:38:05 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id ADC2F4AB625; Sun, 29 Nov 2020 19:38:05 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Ckdv14SR7z3LC4; Sun, 29 Nov 2020 19:38:05 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8138816CB2; Sun, 29 Nov 2020 19:38:05 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0ATJc5JW081200; Sun, 29 Nov 2020 19:38:05 GMT (envelope-from mmacy@FreeBSD.org) Received: (from mmacy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0ATJc4Z3081193; Sun, 29 Nov 2020 19:38:04 GMT (envelope-from mmacy@FreeBSD.org) Message-Id: <202011291938.0ATJc4Z3081193@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmacy set sender to mmacy@FreeBSD.org using -f From: Matt Macy Date: Sun, 29 Nov 2020 19:38:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368163 - in head: sbin/ifconfig sys/dev/if_wg sys/dev/if_wg/include sys/dev/if_wg/include/crypto sys/dev/if_wg/include/sys sys/dev/if_wg/include/zinc sys/dev/if_wg/module sys/dev/if_wg... X-SVN-Group: head X-SVN-Commit-Author: mmacy X-SVN-Commit-Paths: in head: sbin/ifconfig sys/dev/if_wg sys/dev/if_wg/include sys/dev/if_wg/include/crypto sys/dev/if_wg/include/sys sys/dev/if_wg/include/zinc sys/dev/if_wg/module sys/dev/if_wg/module/crypto/zinc sys/d... X-SVN-Commit-Revision: 368163 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Nov 2020 19:38:05 -0000 Author: mmacy Date: Sun Nov 29 19:38:03 2020 New Revision: 368163 URL: https://svnweb.freebsd.org/changeset/base/368163 Log: Import kernel WireGuard support Data path largely shared with the OpenBSD implementation by Matt Dunwoodie Reviewed by: grehan@freebsd.org MFC after: 1 month Sponsored by: Rubicon LLC, (Netgate) Differential Revision: https://reviews.freebsd.org/D26137 Added: head/sbin/ifconfig/ifwg.c (contents, props changed) head/sys/dev/if_wg/ head/sys/dev/if_wg/include/ head/sys/dev/if_wg/include/crypto/blake2s.h (contents, props changed) head/sys/dev/if_wg/include/crypto/curve25519.h (contents, props changed) head/sys/dev/if_wg/include/crypto/zinc.h (contents, props changed) head/sys/dev/if_wg/include/sys/ head/sys/dev/if_wg/include/sys/if_wg_session.h (contents, props changed) head/sys/dev/if_wg/include/sys/if_wg_session_vars.h (contents, props changed) head/sys/dev/if_wg/include/sys/simd-x86_64.h (contents, props changed) head/sys/dev/if_wg/include/sys/support.h (contents, props changed) head/sys/dev/if_wg/include/sys/wg_cookie.h (contents, props changed) head/sys/dev/if_wg/include/sys/wg_module.h (contents, props changed) head/sys/dev/if_wg/include/sys/wg_noise.h (contents, props changed) head/sys/dev/if_wg/include/zinc/blake2s.h (contents, props changed) head/sys/dev/if_wg/include/zinc/chacha20.h (contents, props changed) head/sys/dev/if_wg/include/zinc/chacha20poly1305.h (contents, props changed) head/sys/dev/if_wg/include/zinc/curve25519.h (contents, props changed) head/sys/dev/if_wg/include/zinc/poly1305.h (contents, props changed) head/sys/dev/if_wg/module/ head/sys/dev/if_wg/module/blake2s.c (contents, props changed) head/sys/dev/if_wg/module/blake2s.h (contents, props changed) head/sys/dev/if_wg/module/chacha20-x86_64.S (contents, props changed) head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20-arm-glue.c (contents, props changed) head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20-arm.pl (contents, props changed) head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20-arm64.pl (contents, props changed) head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20-mips-glue.c (contents, props changed) head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20-mips.S (contents, props changed) head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20-unrolled-arm.S (contents, props changed) head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20-x86_64-glue.c (contents, props changed) head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20-x86_64.pl (contents, props changed) head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20.c (contents, props changed) head/sys/dev/if_wg/module/crypto/zinc/chacha20poly1305.c (contents, props changed) head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-arm-glue.c (contents, props changed) head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-arm.pl (contents, props changed) head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-arm64.pl (contents, props changed) head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-donna32.c (contents, props changed) head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-donna64.c (contents, props changed) head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-mips-glue.c (contents, props changed) head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-mips.S (contents, props changed) head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-mips64.pl (contents, props changed) head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-x86_64-glue.c (contents, props changed) head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-x86_64.pl (contents, props changed) head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305.c (contents, props changed) head/sys/dev/if_wg/module/crypto/zinc/selftest/blake2s.c (contents, props changed) head/sys/dev/if_wg/module/crypto/zinc/selftest/chacha20.c (contents, props changed) head/sys/dev/if_wg/module/crypto/zinc/selftest/chacha20poly1305.c (contents, props changed) head/sys/dev/if_wg/module/crypto/zinc/selftest/curve25519.c (contents, props changed) head/sys/dev/if_wg/module/crypto/zinc/selftest/poly1305.c (contents, props changed) head/sys/dev/if_wg/module/crypto/zinc/selftest/run.h (contents, props changed) head/sys/dev/if_wg/module/curve25519.c (contents, props changed) head/sys/dev/if_wg/module/if_wg_session.c (contents, props changed) head/sys/dev/if_wg/module/module.c (contents, props changed) head/sys/dev/if_wg/module/poly1305-x86_64.S (contents, props changed) head/sys/dev/if_wg/module/wg_cookie.c (contents, props changed) head/sys/dev/if_wg/module/wg_noise.c (contents, props changed) head/sys/modules/if_wg/ head/sys/modules/if_wg/Makefile (contents, props changed) Directory Properties: head/sys/dev/if_wg/include/crypto/ (props changed) head/sys/dev/if_wg/include/zinc/ (props changed) head/sys/dev/if_wg/module/crypto/ (props changed) head/sys/dev/if_wg/module/crypto/zinc/ (props changed) head/sys/dev/if_wg/module/crypto/zinc/chacha20/ (props changed) head/sys/dev/if_wg/module/crypto/zinc/poly1305/ (props changed) head/sys/dev/if_wg/module/crypto/zinc/selftest/ (props changed) Modified: head/sbin/ifconfig/Makefile head/sys/kern/subr_gtaskqueue.c head/sys/modules/Makefile head/sys/net/iflib_clone.c head/sys/sys/gtaskqueue.h Modified: head/sbin/ifconfig/Makefile ============================================================================== --- head/sbin/ifconfig/Makefile Sun Nov 29 19:06:32 2020 (r368162) +++ head/sbin/ifconfig/Makefile Sun Nov 29 19:38:03 2020 (r368163) @@ -35,6 +35,7 @@ SRCS+= ifvxlan.c # VXLAN support SRCS+= ifgre.c # GRE keys etc SRCS+= ifgif.c # GIF reversed header workaround SRCS+= ifipsec.c # IPsec VTI +SRCS+= ifwg.c # Wireguard SRCS+= sfp.c # SFP/SFP+ information LIBADD+= ifconfig m util @@ -68,6 +69,7 @@ CFLAGS+= -DINET CFLAGS+= -DJAIL LIBADD+= jail .endif +LIBADD+= nv MAN= ifconfig.8 Added: head/sbin/ifconfig/ifwg.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sbin/ifconfig/ifwg.c Sun Nov 29 19:38:03 2020 (r368163) @@ -0,0 +1,618 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause + * + * Copyright (c) 2020 Rubicon Communications, LLC (Netgate) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#ifndef RESCUE +#include +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include /* NB: for offsetof */ +#include +#include +#include + +#include "ifconfig.h" + +typedef enum { + WGC_GET = 0x5, + WGC_SET = 0x6, +} wg_cmd_t; + +static nvlist_t *nvl_params; +static bool do_peer; +static int allowed_ips_count; +static int allowed_ips_max; +struct allowedip { + struct sockaddr_storage a_addr; + struct sockaddr_storage a_mask; +}; +struct allowedip *allowed_ips; + +#define ALLOWEDIPS_START 16 +#define WG_KEY_LEN 32 +#define WG_KEY_LEN_BASE64 ((((WG_KEY_LEN) + 2) / 3) * 4 + 1) +#define WG_KEY_LEN_HEX (WG_KEY_LEN * 2 + 1) +#define WG_MAX_STRLEN 64 + +static bool +key_from_base64(uint8_t key[static WG_KEY_LEN], const char *base64) +{ + + if (strlen(base64) != WG_KEY_LEN_BASE64 - 1) { + warnx("bad key len - need %d got %zu\n", WG_KEY_LEN_BASE64 - 1, strlen(base64)); + return false; + } + if (base64[WG_KEY_LEN_BASE64 - 2] != '=') { + warnx("bad key terminator, expected '=' got '%c'", base64[WG_KEY_LEN_BASE64 - 2]); + return false; + } + return (b64_pton(base64, key, WG_KEY_LEN)); +} + +static void +parse_endpoint(const char *endpoint_) +{ + int err; + char *base, *endpoint, *port, *colon, *tmp; + struct addrinfo hints, *res; + + endpoint = base = strdup(endpoint_); + colon = rindex(endpoint, ':'); + if (colon == NULL) + errx(1, "bad endpoint format %s - no port delimiter found", endpoint); + *colon = '\0'; + port = colon + 1; + + /* [::]:<> */ + if (endpoint[0] == '[') { + endpoint++; + tmp = index(endpoint, ']'); + if (tmp == NULL) + errx(1, "bad endpoint format %s - '[' found with no matching ']'", endpoint); + *tmp = '\0'; + } + bzero(&hints, sizeof(hints)); + hints.ai_family = AF_UNSPEC; + err = getaddrinfo(endpoint, port, &hints, &res); + if (err) + errx(1, "%s", gai_strerror(err)); + nvlist_add_binary(nvl_params, "endpoint", res->ai_addr, res->ai_addrlen); + freeaddrinfo(res); + free(base); +} + +static void +in_len2mask(struct in_addr *mask, u_int len) +{ + u_int i; + u_char *p; + + p = (u_char *)mask; + memset(mask, 0, sizeof(*mask)); + for (i = 0; i < len / NBBY; i++) + p[i] = 0xff; + if (len % NBBY) + p[i] = (0xff00 >> (len % NBBY)) & 0xff; +} + +static u_int +in_mask2len(struct in_addr *mask) +{ + u_int x, y; + u_char *p; + + p = (u_char *)mask; + for (x = 0; x < sizeof(*mask); x++) { + if (p[x] != 0xff) + break; + } + y = 0; + if (x < sizeof(*mask)) { + for (y = 0; y < NBBY; y++) { + if ((p[x] & (0x80 >> y)) == 0) + break; + } + } + return x * NBBY + y; +} + +static void +in6_prefixlen2mask(struct in6_addr *maskp, int len) +{ + static const u_char maskarray[NBBY] = {0x80, 0xc0, 0xe0, 0xf0, 0xf8, 0xfc, 0xfe, 0xff}; + int bytelen, bitlen, i; + + /* sanity check */ + if (len < 0 || len > 128) { + errx(1, "in6_prefixlen2mask: invalid prefix length(%d)\n", + len); + return; + } + + memset(maskp, 0, sizeof(*maskp)); + bytelen = len / NBBY; + bitlen = len % NBBY; + for (i = 0; i < bytelen; i++) + maskp->s6_addr[i] = 0xff; + if (bitlen) + maskp->s6_addr[bytelen] = maskarray[bitlen - 1]; +} + +static int +in6_mask2len(struct in6_addr *mask, u_char *lim0) +{ + int x = 0, y; + u_char *lim = lim0, *p; + + /* ignore the scope_id part */ + if (lim0 == NULL || lim0 - (u_char *)mask > sizeof(*mask)) + lim = (u_char *)mask + sizeof(*mask); + for (p = (u_char *)mask; p < lim; x++, p++) { + if (*p != 0xff) + break; + } + y = 0; + if (p < lim) { + for (y = 0; y < NBBY; y++) { + if ((*p & (0x80 >> y)) == 0) + break; + } + } + + /* + * when the limit pointer is given, do a stricter check on the + * remaining bits. + */ + if (p < lim) { + if (y != 0 && (*p & (0x00ff >> y)) != 0) + return -1; + for (p = p + 1; p < lim; p++) + if (*p != 0) + return -1; + } + + return x * NBBY + y; +} + +static bool +parse_ip(struct allowedip *aip, const char *value) +{ + struct addrinfo hints, *res; + int err; + + bzero(&aip->a_addr, sizeof(aip->a_addr)); + bzero(&hints, sizeof(hints)); + hints.ai_family = AF_UNSPEC; + hints.ai_flags = AI_NUMERICHOST; + err = getaddrinfo(value, NULL, &hints, &res); + if (err) + errx(1, "%s", gai_strerror(err)); + + memcpy(&aip->a_addr, res->ai_addr, res->ai_addrlen); + + freeaddrinfo(res); + return (true); +} + +static void +sa_ntop(const struct sockaddr *sa, char *buf, int *port) +{ + const struct sockaddr_in *sin; + const struct sockaddr_in6 *sin6; + int err; + + err = getnameinfo(sa, sa->sa_len, buf, INET6_ADDRSTRLEN, NULL, + 0, NI_NUMERICHOST); + + if (sa->sa_family == AF_INET) { + sin = (const struct sockaddr_in *)sa; + if (port) + *port = sin->sin_port; + } else if (sa->sa_family == AF_INET6) { + sin6 = (const struct sockaddr_in6 *)sa; + if (port) + *port = sin6->sin6_port; + } + + if (err) + errx(1, "%s", gai_strerror(err)); +} + +static void +dump_peer(const nvlist_t *nvl_peer) +{ + const void *key; + const struct allowedip *aips; + const struct sockaddr *endpoint; + char outbuf[WG_MAX_STRLEN]; + char addr_buf[INET6_ADDRSTRLEN]; + size_t size; + int count, port; + + printf("[Peer]\n"); + if (nvlist_exists_binary(nvl_peer, "public-key")) { + key = nvlist_get_binary(nvl_peer, "public-key", &size); + b64_ntop((const uint8_t *)key, size, outbuf, WG_MAX_STRLEN); + printf("PublicKey = %s\n", outbuf); + } + if (nvlist_exists_binary(nvl_peer, "endpoint")) { + endpoint = nvlist_get_binary(nvl_peer, "endpoint", &size); + sa_ntop(endpoint, addr_buf, &port); + printf("Endpoint = %s:%d\n", addr_buf, ntohs(port)); + } + + if (!nvlist_exists_binary(nvl_peer, "allowed-ips")) + return; + aips = nvlist_get_binary(nvl_peer, "allowed-ips", &size); + if (size == 0 || size % sizeof(struct allowedip) != 0) { + errx(1, "size %zu not integer multiple of allowedip", size); + } + printf("AllowedIPs = "); + count = size / sizeof(struct allowedip); + for (int i = 0; i < count; i++) { + int mask; + sa_family_t family; + void *bitmask; + struct sockaddr *sa; + + sa = __DECONST(void *, &aips[i].a_addr); + bitmask = __DECONST(void *, + ((const struct sockaddr *)&aips->a_mask)->sa_data); + family = aips[i].a_addr.ss_family; + getnameinfo(sa, sa->sa_len, addr_buf, INET6_ADDRSTRLEN, NULL, + 0, NI_NUMERICHOST); + if (family == AF_INET) + mask = in_mask2len(bitmask); + else if (family == AF_INET6) + mask = in6_mask2len(bitmask, NULL); + else + errx(1, "bad family in peer %d\n", family); + printf("%s/%d", addr_buf, mask); + if (i < count -1) + printf(", "); + } + printf("\n"); +} + +static int +get_nvl_out_size(int sock, u_long op, size_t *size) +{ + struct ifdrv ifd; + int err; + + memset(&ifd, 0, sizeof(ifd)); + + strlcpy(ifd.ifd_name, name, sizeof(ifd.ifd_name)); + ifd.ifd_cmd = op; + ifd.ifd_len = 0; + ifd.ifd_data = NULL; + + err = ioctl(sock, SIOCGDRVSPEC, &ifd); + if (err) + return (err); + *size = ifd.ifd_len; + return (0); +} + +static int +do_cmd(int sock, u_long op, void *arg, size_t argsize, int set) +{ + struct ifdrv ifd; + + memset(&ifd, 0, sizeof(ifd)); + + strlcpy(ifd.ifd_name, name, sizeof(ifd.ifd_name)); + ifd.ifd_cmd = op; + ifd.ifd_len = argsize; + ifd.ifd_data = arg; + + return (ioctl(sock, set ? SIOCSDRVSPEC : SIOCGDRVSPEC, &ifd)); +} + +static +DECL_CMD_FUNC(peerlist, val, d) +{ + size_t size, peercount; + void *packed; + const nvlist_t *nvl, *nvl_peer; + const nvlist_t *const *nvl_peerlist; + + if (get_nvl_out_size(s, WGC_GET, &size)) + errx(1, "can't get peer list size"); + if ((packed = malloc(size)) == NULL) + errx(1, "malloc failed for peer list"); + if (do_cmd(s, WGC_GET, packed, size, 0)) + errx(1, "failed to obtain peer list"); + + nvl = nvlist_unpack(packed, size, 0); + if (!nvlist_exists_nvlist_array(nvl, "peer-list")) + return; + nvl_peerlist = nvlist_get_nvlist_array(nvl, "peer-list", &peercount); + + for (int i = 0; i < peercount; i++, nvl_peerlist++) { + nvl_peer = *nvl_peerlist; + dump_peer(nvl_peer); + } +} + +static void +peerfinish(int s, void *arg) +{ + nvlist_t *nvl, **nvl_array; + void *packed; + size_t size; + + if ((nvl = nvlist_create(0)) == NULL) + errx(1, "failed to allocate nvlist"); + if ((nvl_array = calloc(sizeof(void *), 1)) == NULL) + errx(1, "failed to allocate nvl_array"); + if (!nvlist_exists_binary(nvl_params, "public-key")) + errx(1, "must specify a public-key for adding peer"); + if (!nvlist_exists_binary(nvl_params, "endpoint")) + errx(1, "must specify an endpoint for adding peer"); + if (allowed_ips_count == 0) + errx(1, "must specify at least one range of allowed-ips to add a peer"); + + nvl_array[0] = nvl_params; + nvlist_add_nvlist_array(nvl, "peer-list", (const nvlist_t * const *)nvl_array, 1); + packed = nvlist_pack(nvl, &size); + + if (do_cmd(s, WGC_SET, packed, size, true)) + errx(1, "failed to install peer"); +} + +static +DECL_CMD_FUNC(peerstart, val, d) +{ + do_peer = true; + callback_register(peerfinish, NULL); + allowed_ips = malloc(ALLOWEDIPS_START * sizeof(struct allowedip)); + allowed_ips_max = ALLOWEDIPS_START; + if (allowed_ips == NULL) + errx(1, "failed to allocate array for allowedips"); +} + +static +DECL_CMD_FUNC(setwglistenport, val, d) +{ + struct addrinfo hints, *res; + const struct sockaddr_in *sin; + const struct sockaddr_in6 *sin6; + + u_long ul; + int err; + + bzero(&hints, sizeof(hints)); + hints.ai_family = AF_UNSPEC; + hints.ai_flags = AI_NUMERICHOST; + err = getaddrinfo(NULL, val, &hints, &res); + if (err) + errx(1, "%s", gai_strerror(err)); + + if (res->ai_family == AF_INET) { + sin = (struct sockaddr_in *)res->ai_addr; + ul = sin->sin_port; + } else if (res->ai_family == AF_INET6) { + sin6 = (struct sockaddr_in6 *)res->ai_addr; + ul = sin6->sin6_port; + } else { + errx(1, "unknown family"); + } + ul = ntohs((u_short)ul); + nvlist_add_number(nvl_params, "listen-port", ul); +} + +static +DECL_CMD_FUNC(setwgprivkey, val, d) +{ + uint8_t key[WG_KEY_LEN]; + + if (!key_from_base64(key, val)) + errx(1, "invalid key %s", val); + nvlist_add_binary(nvl_params, "private-key", key, WG_KEY_LEN); +} + +static +DECL_CMD_FUNC(setwgpubkey, val, d) +{ + uint8_t key[WG_KEY_LEN]; + + if (!do_peer) + errx(1, "setting public key only valid when adding peer"); + + if (!key_from_base64(key, val)) + errx(1, "invalid key %s", val); + nvlist_add_binary(nvl_params, "public-key", key, WG_KEY_LEN); +} + +static +DECL_CMD_FUNC(setallowedips, val, d) +{ + char *base, *allowedip, *mask; + u_long ul; + char *endp; + struct allowedip *aip; + + if (!do_peer) + errx(1, "setting allowed ip only valid when adding peer"); + if (allowed_ips_count == allowed_ips_max) { + /* XXX grow array */ + } + aip = &allowed_ips[allowed_ips_count]; + base = allowedip = strdup(val); + mask = index(allowedip, '/'); + if (mask == NULL) + errx(1, "mask separator not found in allowedip %s", val); + *mask = '\0'; + mask++; + parse_ip(aip, allowedip); + ul = strtoul(mask, &endp, 0); + if (*endp != '\0') + errx(1, "invalid value for allowedip mask"); + bzero(&aip->a_mask, sizeof(aip->a_mask)); + if (aip->a_addr.ss_family == AF_INET) + in_len2mask((struct in_addr *)&((struct sockaddr *)&aip->a_mask)->sa_data, ul); + else if (aip->a_addr.ss_family == AF_INET6) + in6_prefixlen2mask((struct in6_addr *)&((struct sockaddr *)&aip->a_mask)->sa_data, ul); + else + errx(1, "invalid address family %d\n", aip->a_addr.ss_family); + allowed_ips_count++; + if (allowed_ips_count > 1) + nvlist_free_binary(nvl_params, "allowed-ips"); + nvlist_add_binary(nvl_params, "allowed-ips", allowed_ips, + allowed_ips_count*sizeof(*aip)); + + dump_peer(nvl_params); + free(base); +} + +static +DECL_CMD_FUNC(setendpoint, val, d) +{ + if (!do_peer) + errx(1, "setting endpoint only valid when adding peer"); + parse_endpoint(val); +} + +static void +wireguard_status(int s) +{ + size_t size; + void *packed; + nvlist_t *nvl; + char buf[WG_KEY_LEN_BASE64]; + const void *key; + uint16_t listen_port; + + if (get_nvl_out_size(s, WGC_GET, &size)) + return; + if ((packed = malloc(size)) == NULL) + return; + if (do_cmd(s, WGC_GET, packed, size, 0)) + return; + nvl = nvlist_unpack(packed, size, 0); + if (nvlist_exists_number(nvl, "listen-port")) { + listen_port = nvlist_get_number(nvl, "listen-port"); + printf("\tlisten-port: %d\n", listen_port); + } + if (nvlist_exists_binary(nvl, "private-key")) { + key = nvlist_get_binary(nvl, "private-key", &size); + b64_ntop((const uint8_t *)key, size, buf, WG_MAX_STRLEN); + printf("\tprivate-key: %s\n", buf); + } + if (nvlist_exists_binary(nvl, "public-key")) { + key = nvlist_get_binary(nvl, "public-key", &size); + b64_ntop((const uint8_t *)key, size, buf, WG_MAX_STRLEN); + printf("\tpublic-key: %s\n", buf); + } +} + +static struct cmd wireguard_cmds[] = { + DEF_CLONE_CMD_ARG("listen-port", setwglistenport), + DEF_CLONE_CMD_ARG("private-key", setwgprivkey), + DEF_CMD("peer-list", 0, peerlist), + DEF_CMD("peer", 0, peerstart), + DEF_CMD_ARG("public-key", setwgpubkey), + DEF_CMD_ARG("allowed-ips", setallowedips), + DEF_CMD_ARG("endpoint", setendpoint), +}; + +static struct afswtch af_wireguard = { + .af_name = "af_wireguard", + .af_af = AF_UNSPEC, + .af_other_status = wireguard_status, +}; + +static void +wg_create(int s, struct ifreq *ifr) +{ + struct iovec iov; + void *packed; + size_t size; + + setproctitle("ifconfig %s create ...\n", name); + if (!nvlist_exists_number(nvl_params, "listen-port")) + goto legacy; + if (!nvlist_exists_binary(nvl_params, "private-key")) + goto legacy; + + packed = nvlist_pack(nvl_params, &size); + if (packed == NULL) + errx(1, "failed to setup create request"); + iov.iov_len = size; + iov.iov_base = packed; + ifr->ifr_data = (caddr_t)&iov; + if (ioctl(s, SIOCIFCREATE2, ifr) < 0) + err(1, "SIOCIFCREATE2"); + return; +legacy: + ifr->ifr_data == NULL; + if (ioctl(s, SIOCIFCREATE, ifr) < 0) + err(1, "SIOCIFCREATE"); +} + +static __constructor void +wireguard_ctor(void) +{ + int i; + + nvl_params = nvlist_create(0); + for (i = 0; i < nitems(wireguard_cmds); i++) + cmd_register(&wireguard_cmds[i]); + af_register(&af_wireguard); + clone_setdefcallback_prefix("wg", wg_create); +} + +#endif Added: head/sys/dev/if_wg/include/crypto/blake2s.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/if_wg/include/crypto/blake2s.h Sun Nov 29 19:38:03 2020 (r368163) @@ -0,0 +1,56 @@ +/* SPDX-License-Identifier: GPL-2.0 OR MIT */ +/* + * Copyright (C) 2015-2019 Jason A. Donenfeld . All Rights Reserved. + */ + +#include + +#ifndef _BLAKE2S_H_ +#define _BLAKE2S_H_ + + +enum blake2s_lengths { + BLAKE2S_BLOCK_SIZE = 64, + BLAKE2S_HASH_SIZE = 32, + BLAKE2S_KEY_SIZE = 32 +}; + +struct blake2s_state { + uint32_t h[8]; + uint32_t t[2]; + uint32_t f[2]; + uint8_t buf[BLAKE2S_BLOCK_SIZE]; + size_t buflen; + uint8_t last_node; +}; + +void blake2s_init(struct blake2s_state *state, const size_t outlen); +void blake2s_init_key(struct blake2s_state *state, const size_t outlen, + const void *key, const size_t keylen); +void blake2s_update(struct blake2s_state *state, const uint8_t *in, size_t inlen); +void blake2s_final(struct blake2s_state *state, uint8_t *out, const size_t outlen); + +static inline void blake2s(uint8_t *out, const uint8_t *in, const uint8_t *key, + const size_t outlen, const size_t inlen, + const size_t keylen) +{ + struct blake2s_state state; +#ifdef __linux___ + WARN_ON(IS_ENABLED(DEBUG) && ((!in && inlen > 0) || !out || !outlen || + outlen > BLAKE2S_HASH_SIZE || keylen > BLAKE2S_KEY_SIZE || + (!key && keylen))); +#endif + + if (keylen) + blake2s_init_key(&state, outlen, key, keylen); + else + blake2s_init(&state, outlen); + + blake2s_update(&state, in, inlen); + blake2s_final(&state, out, outlen); +} + +void blake2s_hmac(uint8_t *out, const uint8_t *in, const uint8_t *key, + const size_t outlen, const size_t inlen, const size_t keylen); + +#endif /* _BLAKE2S_H_ */ Added: head/sys/dev/if_wg/include/crypto/curve25519.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/if_wg/include/crypto/curve25519.h Sun Nov 29 19:38:03 2020 (r368163) @@ -0,0 +1,74 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2019-2020 Rubicon Communications, LLC (Netgate) + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _CURVE25519_H_ +#define _CURVE25519_H_ + +#include + +#define CURVE25519_KEY_SIZE 32 + +void curve25519_generic(u8 [CURVE25519_KEY_SIZE], + const u8 [CURVE25519_KEY_SIZE], + const u8 [CURVE25519_KEY_SIZE]); + +static inline void curve25519_clamp_secret(u8 secret[CURVE25519_KEY_SIZE]) +{ + secret[0] &= 248; + secret[31] = (secret[31] & 127) | 64; +} + +static const u8 null_point[CURVE25519_KEY_SIZE] = { 0 }; + +static inline int curve25519(u8 mypublic[CURVE25519_KEY_SIZE], + const u8 secret[CURVE25519_KEY_SIZE], + const u8 basepoint[CURVE25519_KEY_SIZE]) +{ + curve25519_generic(mypublic, secret, basepoint); + return timingsafe_bcmp(mypublic, null_point, CURVE25519_KEY_SIZE); +} + +static inline int curve25519_generate_public(u8 pub[CURVE25519_KEY_SIZE], + const u8 secret[CURVE25519_KEY_SIZE]) +{ + static const u8 basepoint[CURVE25519_KEY_SIZE] __aligned(32) = { 9 }; + + if (timingsafe_bcmp(secret, null_point, CURVE25519_KEY_SIZE) == 0) + return 0; + + return curve25519(pub, secret, basepoint); +} + +static inline void curve25519_generate_secret(u8 secret[CURVE25519_KEY_SIZE]) +{ + arc4random_buf(secret, CURVE25519_KEY_SIZE); + curve25519_clamp_secret(secret); +} + +#endif /* _CURVE25519_H_ */ Added: head/sys/dev/if_wg/include/crypto/zinc.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/if_wg/include/crypto/zinc.h Sun Nov 29 19:38:03 2020 (r368163) @@ -0,0 +1,15 @@ +/* SPDX-License-Identifier: GPL-2.0 OR MIT */ +/* + * Copyright (C) 2015-2019 Jason A. Donenfeld . All Rights Reserved. + */ + +#ifndef _WG_ZINC_H +#define _WG_ZINC_H + +int chacha20_mod_init(void); +int poly1305_mod_init(void); +int chacha20poly1305_mod_init(void); +int blake2s_mod_init(void); +int curve25519_mod_init(void); + +#endif Added: head/sys/dev/if_wg/include/sys/if_wg_session.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/if_wg/include/sys/if_wg_session.h Sun Nov 29 19:38:03 2020 (r368163) @@ -0,0 +1,89 @@ +/* + * Copyright (c) 2019 Matt Dunwoodie + * + * 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$ + */ + +#ifndef __IF_WG_H__ +#define __IF_WG_H__ + +#include +#include + +/* + * This is the public interface to the WireGuard network interface. + * + * It is designed to be used by tools such as ifconfig(8) and wg(4). + */ + +#define WG_KEY_SIZE 32 + +#define WG_DEVICE_HAS_PUBKEY (1 << 0) +#define WG_DEVICE_HAS_PRIVKEY (1 << 1) +#define WG_DEVICE_HAS_MASKED_PRIVKEY (1 << 2) +#define WG_DEVICE_HAS_PORT (1 << 3) +#define WG_DEVICE_HAS_RDOMAIN (1 << 4) +#define WG_DEVICE_REPLACE_PEERS (1 << 5) + +#define WG_PEER_HAS_PUBKEY (1 << 0) +#define WG_PEER_HAS_SHAREDKEY (1 << 1) +#define WG_PEER_HAS_MASKED_SHAREDKEY (1 << 2) +#define WG_PEER_HAS_ENDPOINT (1 << 3) +#define WG_PEER_HAS_PERSISTENTKEEPALIVE (1 << 4) +#define WG_PEER_REPLACE_CIDRS (1 << 5) +#define WG_PEER_REMOVE (1 << 6) + +#define SIOCSWG _IOWR('i', 200, struct wg_device_io) +#define SIOCGWG _IOWR('i', 201, struct wg_device_io) + +#define WG_PEERS_FOREACH(p, d) \ + for (p = (d)->d_peers; p < (d)->d_peers + (d)->d_num_peers; p++) +#define WG_CIDRS_FOREACH(c, p) \ + for (c = (p)->p_cidrs; c < (p)->p_cidrs + (p)->p_num_cidrs; c++) + +struct wg_allowedip { + struct sockaddr_storage a_addr; + struct sockaddr_storage a_mask; +}; + +enum { + WG_PEER_CTR_TX_BYTES, + WG_PEER_CTR_RX_BYTES, + WG_PEER_CTR_NUM, +}; + +struct wg_device_io { + char d_name[IFNAMSIZ]; + uint8_t d_flags; + in_port_t d_port; + int d_rdomain; + uint8_t d_pubkey[WG_KEY_SIZE]; + uint8_t d_privkey[WG_KEY_SIZE]; + size_t d_num_peers; + size_t d_num_cidrs; + struct wg_peer_io *d_peers; +}; + + +#ifndef ENOKEY +#define ENOKEY ENOTCAPABLE +#endif + +typedef enum { + WGC_GET = 0x5, + WGC_SET = 0x6, +} wg_cmd_t; + +#endif /* __IF_WG_H__ */ Added: head/sys/dev/if_wg/include/sys/if_wg_session_vars.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/if_wg/include/sys/if_wg_session_vars.h Sun Nov 29 19:38:03 2020 (r368163) @@ -0,0 +1,322 @@ +/* + * Copyright (c) 2019 Matt Dunwoodie + * Copyright (c) 2019-2020 Rubicon Communications, LLC (Netgate) + * + * 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$ + */ + +#ifndef _IF_WG_VARS_H_ +#define _IF_WG_VARS_H_ + +#include +#include +#include + +#include +#include +#include + + +#include +#include +#include +#include +#include +#include + +#include +#include +/* This is only needed for wg_keypair. */ +#include + +#define UNIMPLEMENTED() panic("%s not implemented\n", __func__) + +#define WG_KEY_SIZE 32 +#define WG_MSG_PADDING_SIZE 16 + + +/* Constant for session */ +#define REKEY_TIMEOUT 5 +#define REKEY_TIMEOUT_JITTER 500 /* TODO ok? jason */ +#define REJECT_AFTER_TIME 180 +#define KEEPALIVE_TIMEOUT 10 +#define MAX_TIMER_HANDSHAKES (90 / REKEY_TIMEOUT) +#define NEW_HANDSHAKE_TIMEOUT (REKEY_TIMEOUT + KEEPALIVE_TIMEOUT) + +#define MAX_QUEUED_INCOMING_HANDSHAKES 4096 /* TODO: replace this with DQL */ +#define MAX_QUEUED_PACKETS 1024 /* TODO: replace this with DQL */ + +#define HASHTABLE_PEER_SIZE (1 << 6) //1 << 11 +#define HASHTABLE_INDEX_SIZE (HASHTABLE_PEER_SIZE * 3) //1 << 13 + +#define PEER_MAGIC1 0xCAFEBABEB00FDADDULL +#define PEER_MAGIC2 0xCAAFD0D0D00DBABEULL +#define PEER_MAGIC3 0xD00DBABEF00DFADEULL + + +enum message_type { + MESSAGE_INVALID = 0, + MESSAGE_HANDSHAKE_INITIATION = 1, + MESSAGE_HANDSHAKE_RESPONSE = 2, + MESSAGE_HANDSHAKE_COOKIE = 3, + MESSAGE_DATA = 4 +}; + +struct wg_softc; + +#if __FreeBSD_version > 1300000 +typedef void timeout_t (void *); +#endif + +/* Socket */ +struct wg_endpoint { + union wg_remote { + struct sockaddr r_sa; + struct sockaddr_in r_sin; + struct sockaddr_in6 r_sin6; + } e_remote; + union wg_source { + struct in_addr l_in; + struct in6_pktinfo l_pktinfo6; +#define l_in6 l_pktinfo6.ipi6_addr + } e_local; +}; + +struct wg_socket { + struct mtx so_mtx; + in_port_t so_port; + struct socket *so_so4; + struct socket *so_so6; +}; + +struct wg_queue { + struct mtx q_mtx; + struct mbufq q; +}; + +struct wg_index { + LIST_ENTRY(wg_index) i_entry; + SLIST_ENTRY(wg_index) i_unused_entry; + uint32_t i_key; *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Sun Nov 29 19:43:35 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CE7154AB778; Sun, 29 Nov 2020 19:43:35 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Ckf1M5Qtvz3LGy; Sun, 29 Nov 2020 19:43:35 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AD3221701E; Sun, 29 Nov 2020 19:43:35 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0ATJhZXS086930; Sun, 29 Nov 2020 19:43:35 GMT (envelope-from melifaro@FreeBSD.org) Received: (from melifaro@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0ATJhYWu086923; Sun, 29 Nov 2020 19:43:34 GMT (envelope-from melifaro@FreeBSD.org) Message-Id: <202011291943.0ATJhYWu086923@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: melifaro set sender to melifaro@FreeBSD.org using -f From: "Alexander V. Chernikov" Date: Sun, 29 Nov 2020 19:43:34 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368164 - in head/sys: conf net net/route netinet netinet6 X-SVN-Group: head X-SVN-Commit-Author: melifaro X-SVN-Commit-Paths: in head/sys: conf net net/route netinet netinet6 X-SVN-Commit-Revision: 368164 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 29 Nov 2020 19:43:35 -0000 Author: melifaro Date: Sun Nov 29 19:43:33 2020 New Revision: 368164 URL: https://svnweb.freebsd.org/changeset/base/368164 Log: Remove RADIX_MPATH config option. ROUTE_MPATH is the new config option controlling new multipath routing implementation. Remove the last pieces of RADIX_MPATH-related code and the config option. Reviewed by: glebius Differential Revision: https://reviews.freebsd.org/D27244 Deleted: head/sys/net/radix_mpath.c head/sys/net/radix_mpath.h Modified: head/sys/conf/options head/sys/net/route.c head/sys/net/route/route_ctl.c head/sys/net/route/route_ifaddrs.c head/sys/net/rtsock.c head/sys/netinet/ip_input.c head/sys/netinet6/nd6.c Modified: head/sys/conf/options ============================================================================== --- head/sys/conf/options Sun Nov 29 19:38:03 2020 (r368163) +++ head/sys/conf/options Sun Nov 29 19:43:33 2020 (r368164) @@ -452,7 +452,6 @@ MROUTING opt_mrouting.h NFSLOCKD PCBGROUP opt_pcbgroup.h PF_DEFAULT_TO_DROP opt_pf.h -RADIX_MPATH opt_mpath.h ROUTE_MPATH opt_route.h ROUTETABLES opt_route.h RSS opt_rss.h Modified: head/sys/net/route.c ============================================================================== --- head/sys/net/route.c Sun Nov 29 19:38:03 2020 (r368163) +++ head/sys/net/route.c Sun Nov 29 19:43:33 2020 (r368164) @@ -65,10 +65,6 @@ #include #include -#ifdef RADIX_MPATH -#include -#endif - #include #include @@ -674,87 +670,6 @@ rt_print(char *buf, int buflen, struct rtentry *rt) } return (i); -} -#endif - -#ifdef RADIX_MPATH -/* - * Deletes key for single-path routes, unlinks rtentry with - * gateway specified in @info from multi-path routes. - * - * Returnes unlinked entry. In case of failure, returns NULL - * and sets @perror to ESRCH. - */ -struct radix_node * -rt_mpath_unlink(struct rib_head *rnh, struct rt_addrinfo *info, - struct rtentry *rto, int *perror) -{ - /* - * if we got multipath routes, we require users to specify - * a matching RTAX_GATEWAY. - */ - struct rtentry *rt; // *rto = NULL; - struct radix_node *rn; - struct sockaddr *gw; - - gw = info->rti_info[RTAX_GATEWAY]; - rt = rt_mpath_matchgate(rto, gw); - if (rt == NULL) { - *perror = ESRCH; - return (NULL); - } - - /* - * this is the first entry in the chain - */ - if (rto == rt) { - rn = rn_mpath_next((struct radix_node *)rt); - /* - * there is another entry, now it's active - */ - if (rn) { - rto = RNTORT(rn); - rto->rte_flags |= RTF_UP; - } else if (rt->rte_flags & RTF_GATEWAY) { - /* - * For gateway routes, we need to - * make sure that we we are deleting - * the correct gateway. - * rt_mpath_matchgate() does not - * check the case when there is only - * one route in the chain. - */ - if (gw && - (rt->rt_nhop->gw_sa.sa_len != gw->sa_len || - memcmp(&rt->rt_nhop->gw_sa, gw, gw->sa_len))) { - *perror = ESRCH; - return (NULL); - } - } - - /* - * use the normal delete code to remove - * the first entry - */ - rn = rnh->rnh_deladdr(info->rti_info[RTAX_DST], - info->rti_info[RTAX_NETMASK], - &rnh->head); - if (rn != NULL) { - *perror = 0; - } else { - *perror = ESRCH; - } - return (rn); - } - - /* - * if the entry is 2nd and on up - */ - if (rt_mpath_deldup(rto, rt) == 0) - panic ("rtrequest1: rt_mpath_deldup"); - *perror = 0; - rn = (struct radix_node *)rt; - return (rn); } #endif Modified: head/sys/net/route/route_ctl.c ============================================================================== --- head/sys/net/route/route_ctl.c Sun Nov 29 19:38:03 2020 (r368163) +++ head/sys/net/route/route_ctl.c Sun Nov 29 19:43:33 2020 (r368164) @@ -54,10 +54,6 @@ __FBSDID("$FreeBSD$"); #include #include -#ifdef RADIX_MPATH -#include -#endif - #include /* Modified: head/sys/net/route/route_ifaddrs.c ============================================================================== --- head/sys/net/route/route_ifaddrs.c Sun Nov 29 19:38:03 2020 (r368163) +++ head/sys/net/route/route_ifaddrs.c Sun Nov 29 19:43:33 2020 (r368164) @@ -32,7 +32,6 @@ * $FreeBSD$ */ -#include "opt_mpath.h" #include "opt_route.h" #include Modified: head/sys/net/rtsock.c ============================================================================== --- head/sys/net/rtsock.c Sun Nov 29 19:38:03 2020 (r368163) +++ head/sys/net/rtsock.c Sun Nov 29 19:43:33 2020 (r368164) @@ -64,9 +64,6 @@ #include #include #include -#ifdef RADIX_MPATH -#include -#endif #include #include Modified: head/sys/netinet/ip_input.c ============================================================================== --- head/sys/netinet/ip_input.c Sun Nov 29 19:38:03 2020 (r368163) +++ head/sys/netinet/ip_input.c Sun Nov 29 19:43:33 2020 (r368164) @@ -981,11 +981,7 @@ ip_forward(struct mbuf *m, int srcrt) sin->sin_family = AF_INET; sin->sin_len = sizeof(*sin); sin->sin_addr = ip->ip_dst; -#ifdef RADIX_MPATH - flowid = ntohl(ip->ip_src.s_addr ^ ip->ip_dst.s_addr); -#else flowid = m->m_pkthdr.flowid; -#endif ro.ro_nh = fib4_lookup(M_GETFIB(m), ip->ip_dst, 0, NHR_REF, flowid); if (ro.ro_nh != NULL) { ia = ifatoia(ro.ro_nh->nh_ifa); Modified: head/sys/netinet6/nd6.c ============================================================================== --- head/sys/netinet6/nd6.c Sun Nov 29 19:38:03 2020 (r368163) +++ head/sys/netinet6/nd6.c Sun Nov 29 19:43:33 2020 (r368164) @@ -1316,11 +1316,7 @@ restart: * This is the case where multiple interfaces * have the same prefix, but only one is installed * into the routing table and that prefix entry - * is not the one being examined here. In the case - * where RADIX_MPATH is enabled, multiple route - * entries (of the same rt_key value) will be - * installed because the interface addresses all - * differ. + * is not the one being examined here. */ if (!IN6_ARE_ADDR_EQUAL(&pr->ndpr_prefix.sin6_addr, &rt_key.sin6_addr)) From owner-svn-src-head@freebsd.org Mon Nov 30 00:20:29 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5E4044694DB for ; Mon, 30 Nov 2020 00:20:29 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: from mail-qt1-x831.google.com (mail-qt1-x831.google.com [IPv6:2607:f8b0:4864:20::831]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Ckm8s1mlxz3qYk for ; Mon, 30 Nov 2020 00:20:28 +0000 (UTC) (envelope-from shawn.webb@hardenedbsd.org) Received: by mail-qt1-x831.google.com with SMTP id v11so7066034qtq.12 for ; Sun, 29 Nov 2020 16:20:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hardenedbsd.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=ZkBCPTb7eYZHxofshMIhObUAr43w9niEd8b2B80Az+s=; b=i8stVTPA9OufNaZiw9OaUw66KjjXgIdHYzN9RuaQEXes3cpMjXqx/l6L028yTJqBjj 3NhkBQqJdkKphqnR3RRy8CWYb6kSRzBAZ4d9XoOupCnpaVGwpookqE+ux/dfWLCtG6Re F2PjzolxpNLa39IEE9ab49WpMDVGl0Vh+ASiiCBUBuI7Y9A3CT3xWSZa1VBAgiEPEp/k 8++SmZ4cZDszVgMWQev/cPWe/HFo+74hRtJ7RNwc0L5VVahKdeVbP9sA356F/9xXM12K D9A9u6Xcxel/MkXj5dr9kUrMRYHHKLygpRDdBE4BfUrPjjC1g01zoWm6fDaPTV0S9LZB jAxQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=ZkBCPTb7eYZHxofshMIhObUAr43w9niEd8b2B80Az+s=; b=KZGH+8cOKSJyfdJgyFqQ1bjH5c9Sc7gp6tdpIHb2jBCBbLGm1bHqB/YFrSCrT4bm7v 25b28cG5wVG3yBYiSDg0QVev3AHVI33xWfTPeYYVn5hOSuPnSut9GiJv5wYs6gcntFv8 zk1+AjsmBGq7QX6A7Q+m6MWqBbYjnSqDPwiubnym5TzAbt3EGsKV3lhABJ3RPt/U0Yma 2vpLwyB8MzV/K6EtMfEbqy++iPcr4wDRepTpU2OdjGDO8sWKEVl+gX3D0/GIO1vVFfrh wk2ko1VDYVMj39f3w/mZ/o/Rh64x1xBAM1sY1bqRGufU9GKO+g2jxPCoEdSuDgIUKBY1 uzpA== X-Gm-Message-State: AOAM530Qbt1Ks2QjgP4spnGV+Tb2tmiM4c+YDpIhi7jqcGbQvYOi1i4I XlkvVcVJFYGDIsVJA2zY5sym0ymxT6JHZutb X-Google-Smtp-Source: ABdhPJwbRVYbyp0NJqZH4okKv9Q1GlYiPcblcPxgdRGPrk59AdlJ54eA5lEGokg55SO3TTs2qLfNnQ== X-Received: by 2002:ac8:7a7b:: with SMTP id w27mr19512118qtt.381.1606695628133; Sun, 29 Nov 2020 16:20:28 -0800 (PST) Received: from mutt-hbsd (pool-100-16-222-53.bltmmd.fios.verizon.net. [100.16.222.53]) by smtp.gmail.com with ESMTPSA id z73sm13813096qkb.112.2020.11.29.16.20.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 29 Nov 2020 16:20:27 -0800 (PST) Date: Sun, 29 Nov 2020 19:20:26 -0500 From: Shawn Webb To: Matt Macy Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r368163 - in head: sbin/ifconfig sys/dev/if_wg sys/dev/if_wg/include sys/dev/if_wg/include/crypto sys/dev/if_wg/include/sys sys/dev/if_wg/include/zinc sys/dev/if_wg/module sys/dev/if_wg... Message-ID: <20201130002026.myksmgoj4p3preaj@mutt-hbsd> X-Operating-System: FreeBSD mutt-hbsd 13.0-CURRENT-HBSD FreeBSD 13.0-CURRENT-HBSD X-PGP-Key: http://pgp.mit.edu/pks/lookup?op=vindex&search=0xFF2E67A277F8E1FA References: <202011291938.0ATJc4Z3081193@repo.freebsd.org> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="rz3ytqlo4iounjcu" Content-Disposition: inline In-Reply-To: <202011291938.0ATJc4Z3081193@repo.freebsd.org> X-Rspamd-Queue-Id: 4Ckm8s1mlxz3qYk X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Nov 2020 00:20:29 -0000 --rz3ytqlo4iounjcu Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun, Nov 29, 2020 at 07:38:04PM +0000, Matt Macy wrote: > Author: mmacy > Date: Sun Nov 29 19:38:03 2020 > New Revision: 368163 > URL: https://svnweb.freebsd.org/changeset/base/368163 >=20 > Log: > Import kernel WireGuard support > =20 > Data path largely shared with the OpenBSD implementation by > Matt Dunwoodie > =20 > Reviewed by: grehan@freebsd.org > MFC after: 1 month > Sponsored by: Rubicon LLC, (Netgate) > Differential Revision: https://reviews.freebsd.org/D26137 RELNOTES: yes? Thanks, --=20 Shawn Webb Cofounder / Security Engineer HardenedBSD GPG Key ID: 0xFF2E67A277F8E1FA GPG Key Fingerprint: D206 BB45 15E0 9C49 0CF9 3633 C85B 0AF8 AB23 0FB2 https://git-01.md.hardenedbsd.org/HardenedBSD/pubkeys/src/branch/master/Sha= wn_Webb/03A4CBEBB82EA5A67D9F3853FF2E67A277F8E1FA.pub.asc --rz3ytqlo4iounjcu Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAABCAAdFiEEA6TL67gupaZ9nzhT/y5nonf44foFAl/EOsgACgkQ/y5nonf4 4fqCcA//cNps6v8qKVZfR/NVDaGTtTiPA0CeasZM4B5IpyJm2wXcjy9ZRM1cS5GG ykATRGS0c7qmwV0Tb1UmPbTCbPLk596jm3yMZmQ2CmZd8XheveaLFIcurOumXti1 hWxRu275K93pLoVD6iXHWN32Fga+py0fLvG4Uf1HFomSqV1pZ6zB/Xql68PMqzHf Ayw9WNvzSzOlvVNW03Knpc1qZizp+R2hjqVwvPaF/6o1Y7R7uBAiGx6IA+9QvK5I Pft84/BEWzCMJxRBN9l3y4zsXExJtnE5Lv/3qY1CEeYgn4Ela3p6mHj5ki1Ci0mI y8lnIhsWRfYZl84BBgysm7W2uM0Hl335pNeBkH28H4zl91tDESPPI8SohROenZtl kfKZ4ykgdvcRM1VodAbHReAHaRoDRUPd0Pldemt/MRIXdZlTQizY3Prr+CzULXH+ Uk7iNKC0LTSiruCN5yRutFS1NtZ5P1nMqzFQEl8pTo1Diu2hkknIYzjCzCzpHj0m TGS0vQrTHP9hgjejSnVGk88m8m5nJtSVHcjVBYTy3ynIwgONRpnYT8n9gkNQOYGH X3qcDPLrEqJsc2E2P+LY50ijKO1eJ8aUHwONkgaiemRdWFv17ssxxvwZ7ctdMuQ4 MgE/laVgsP8ERLR9nZMInyLEGvgqt3rbH0Co9oZsdrdhWzLOeiM= =hM+j -----END PGP SIGNATURE----- --rz3ytqlo4iounjcu-- From owner-svn-src-head@freebsd.org Mon Nov 30 00:26:19 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6FE71469866 for ; Mon, 30 Nov 2020 00:26:19 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound5a.ore.mailhop.org (outbound5a.ore.mailhop.org [44.233.67.66]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4CkmHb0y93z3rHk for ; Mon, 30 Nov 2020 00:26:18 +0000 (UTC) (envelope-from ian@freebsd.org) ARC-Seal: i=1; a=rsa-sha256; t=1606695971; cv=none; d=outbound.mailhop.org; s=arc-outbound20181012; b=c52e1RaDQiq8nqCQClWMENOGZgJ67gzFZlVh4ouxG5xNzzZW/lXHPgm4OID4mcWxDGF2GRNPH8oSG cFtGKlMQVFxGQfnH+CnSK4A60MH72gHA8CrbwB9m2nNHd1HTuLPEWiApdvz2kIonX5X3Bjm6thfJcQ qEWNDLzbpKTtYsFu6sn9l1pAq8WOooUnIVUpeFYGT01vb+pnV9gKS0XORvgNFA3U3HjAW4veYW+sT6 JbUwdHB2oFhhpuZCr6oE+hVhdiXnPE744IWXKmBNlxKGuEoZbj9aclQl/ROMy4azkAtkk5a8lIgdsz XvPYpFK/NHiT0+FXe9yeZcZrx09vm3g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=arc-outbound20181012; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:cc:to:from:subject:message-id:dkim-signature:from; bh=h0Fkq7Z6kVIV33w+zXjY4JTW3my4Nnfkck7HRXyE7AA=; b=IvGRokrKFP1OqrBOfSbWBeN6pHdiVbjgQkgW5KX20TJGwK9Vp56cCacIcgp55hg/5TwNFnCDY+WI2 +mAl4WVNwZ6uR1eJpCL1PVCo/W99QxiNENE2FQZL9wQvEz6YY7RqeXHqibqojQt71HVOeordlzLxBf O9bjCCyY4hCUM7L0l0ArchTR88PtcPmtuuh+Wzpcayaj5jFlAHYEdHa3AjRfS3hBRLeL8wDvkwp31d VfNLGo6Mm1sY1mJjfd/XKS7rnEtlMDmTTw/FWGw3La/kEfmhdlZVuk/Th6NGKEN8d/yhtrrcb283/Y PynXOR4pFTospKBEPo80RhOdOHZvqhg== ARC-Authentication-Results: i=1; outbound3.ore.mailhop.org; spf=softfail smtp.mailfrom=freebsd.org smtp.remote-ip=67.177.211.60; dmarc=none header.from=freebsd.org; arc=none header.oldest-pass=0; DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=dkim-high; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:cc:to:from:subject:message-id:from; bh=h0Fkq7Z6kVIV33w+zXjY4JTW3my4Nnfkck7HRXyE7AA=; b=Yn06fY4ZuLNFGxSQwKBNuUTw/AVuTqnsBjk6bvmyIq1fQH2xVuTAIdR9fUVqqnY9S3JKHY5lkdN56 4cuIQCHFfKTRr/Ysshbmb08GRrFLlClbK7O4N7J/vxxddWgnGzPkuKmn9QwIfMoOxdODHEDAg/QDLV qrYDFtT2Zgsm6uzg+rXzgjrZAAiqL7R9fZYusF+XIu498mes3NJWcqwi+3M6k3YnvJjTtL3DvwKxKH XHlpl4jy+IOGgNNbqGQ60RqOLuaRnqBwP2DAJIPWttRoLpvfIaBZ1/bpeQPRc9cUPYAY3xhEaZ8LJ0 p/uiYLnBKaAL/4+C9qguYNvCvVrLjAg== X-MHO-RoutePath: aGlwcGll X-MHO-User: a47c1d41-32a2-11eb-8b39-614106969e8d X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 67.177.211.60 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (c-67-177-211-60.hsd1.co.comcast.net [67.177.211.60]) by outbound3.ore.mailhop.org (Halon) with ESMTPSA id a47c1d41-32a2-11eb-8b39-614106969e8d; Mon, 30 Nov 2020 00:26:10 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id 0AU0Q8id088567; Sun, 29 Nov 2020 17:26:08 -0700 (MST) (envelope-from ian@freebsd.org) Message-ID: Subject: Re: svn commit: r368163 - in head: sbin/ifconfig sys/dev/if_wg sys/dev/if_wg/include sys/dev/if_wg/include/crypto sys/dev/if_wg/include/sys sys/dev/if_wg/include/zinc sys/dev/if_wg/module sys/dev/if_wg... From: Ian Lepore To: Shawn Webb , Matt Macy Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Date: Sun, 29 Nov 2020 17:26:08 -0700 In-Reply-To: <20201130002026.myksmgoj4p3preaj@mutt-hbsd> References: <202011291938.0ATJc4Z3081193@repo.freebsd.org> <20201130002026.myksmgoj4p3preaj@mutt-hbsd> Content-Type: text/plain; charset="ASCII" X-Mailer: Evolution 3.28.5 FreeBSD GNOME Team Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4CkmHb0y93z3rHk X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Nov 2020 00:26:19 -0000 On Sun, 2020-11-29 at 19:20 -0500, Shawn Webb wrote: > On Sun, Nov 29, 2020 at 07:38:04PM +0000, Matt Macy wrote: > > Author: mmacy > > Date: Sun Nov 29 19:38:03 2020 > > New Revision: 368163 > > URL: https://svnweb.freebsd.org/changeset/base/368163 > > > > Log: > > Import kernel WireGuard support > > > > Data path largely shared with the OpenBSD implementation by > > Matt Dunwoodie > > > > Reviewed by: grehan@freebsd.org > > MFC after: 1 month > > Sponsored by: Rubicon LLC, (Netgate) > > Differential Revision: https://reviews.freebsd.org/D26137 > > RELNOTES: yes? > > Thanks, > Or maybe an entry in src/RELNOTES, preferably one that (unlike the commit message) has at least some tiny shred of a clue about what Wireguard is. -- Ian From owner-svn-src-head@freebsd.org Mon Nov 30 01:13:28 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DBFEF46AD18; Mon, 30 Nov 2020 01:13:28 +0000 (UTC) (envelope-from bzeeb-lists@lists.zabbadoz.net) Received: from mx1.sbone.de (mx1.sbone.de [IPv6:2a01:4f8:13b:39f::9f:25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mx1.sbone.de", Issuer "SBone.DE" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CknL04z3dz3tL3; Mon, 30 Nov 2020 01:13:25 +0000 (UTC) (envelope-from bzeeb-lists@lists.zabbadoz.net) Received: from mail.sbone.de (mail.sbone.de [IPv6:fde9:577b:c1a9:31::2013:587]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.sbone.de (Postfix) with ESMTPS id 1C15B8D4A222; Mon, 30 Nov 2020 01:13:17 +0000 (UTC) Received: from content-filter.sbone.de (content-filter.sbone.de [IPv6:fde9:577b:c1a9:31::2013:2742]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPS id 95CD4E707C6; Mon, 30 Nov 2020 01:13:16 +0000 (UTC) X-Virus-Scanned: amavisd-new at sbone.de Received: from mail.sbone.de ([IPv6:fde9:577b:c1a9:31::2013:587]) by content-filter.sbone.de (content-filter.sbone.de [fde9:577b:c1a9:31::2013:2742]) (amavisd-new, port 10024) with ESMTP id 00vY7uy0YmU3; Mon, 30 Nov 2020 01:13:13 +0000 (UTC) Received: from [127.0.0.1] (unknown [IPv6:fde9:577b:c1a9:4902:59d5:6d49:9c08:9559]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPSA id 47911E707AD; Mon, 30 Nov 2020 01:13:13 +0000 (UTC) From: "Bjoern A. Zeeb" To: "Matt Macy" Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r368163 - in head: sbin/ifconfig sys/dev/if_wg sys/dev/if_wg/include sys/dev/if_wg/include/crypto sys/dev/if_wg/include/sys sys/dev/if_wg/include/zinc sys/dev/if_wg/module sys/dev/if_wg... Date: Mon, 30 Nov 2020 01:13:12 +0000 X-Mailer: MailMate (2.0BETAr6151) Message-ID: In-Reply-To: <202011291938.0ATJc4Z3081193@repo.freebsd.org> References: <202011291938.0ATJc4Z3081193@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; format=flowed X-Rspamd-Queue-Id: 4CknL04z3dz3tL3 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Nov 2020 01:13:28 -0000 On 29 Nov 2020, at 19:38, Matt Macy wrote: > Author: mmacy > Date: Sun Nov 29 19:38:03 2020 > New Revision: 368163 > URL: https://svnweb.freebsd.org/changeset/base/368163 > > Log: > Import kernel WireGuard support > > Data path largely shared with the OpenBSD implementation by > Matt Dunwoodie > > Reviewed by: grehan@freebsd.org > MFC after: 1 month > Sponsored by: Rubicon LLC, (Netgate) > Differential Revision: https://reviews.freebsd.org/D26137 > > Added: > head/sbin/ifconfig/ifwg.c (contents, props changed) > head/sys/dev/if_wg/ > head/sys/dev/if_wg/include/ > head/sys/dev/if_wg/include/crypto/blake2s.h (contents, props > changed) > head/sys/dev/if_wg/include/crypto/curve25519.h (contents, props > changed) > head/sys/dev/if_wg/include/crypto/zinc.h (contents, props changed) > head/sys/dev/if_wg/include/sys/ > head/sys/dev/if_wg/include/sys/if_wg_session.h (contents, props > changed) > head/sys/dev/if_wg/include/sys/if_wg_session_vars.h (contents, > props changed) > head/sys/dev/if_wg/include/sys/simd-x86_64.h (contents, props > changed) > head/sys/dev/if_wg/include/sys/support.h (contents, props changed) > head/sys/dev/if_wg/include/sys/wg_cookie.h (contents, props > changed) > head/sys/dev/if_wg/include/sys/wg_module.h (contents, props > changed) > head/sys/dev/if_wg/include/sys/wg_noise.h (contents, props > changed) > head/sys/dev/if_wg/include/zinc/blake2s.h (contents, props > changed) > head/sys/dev/if_wg/include/zinc/chacha20.h (contents, props > changed) > head/sys/dev/if_wg/include/zinc/chacha20poly1305.h (contents, > props changed) > head/sys/dev/if_wg/include/zinc/curve25519.h (contents, props > changed) > head/sys/dev/if_wg/include/zinc/poly1305.h (contents, props > changed) > head/sys/dev/if_wg/module/ > head/sys/dev/if_wg/module/blake2s.c (contents, props changed) > head/sys/dev/if_wg/module/blake2s.h (contents, props changed) > head/sys/dev/if_wg/module/chacha20-x86_64.S (contents, props > changed) > head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20-arm-glue.c > (contents, props changed) > head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20-arm.pl > (contents, props changed) > head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20-arm64.pl > (contents, props changed) > head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20-mips-glue.c > (contents, props changed) > head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20-mips.S > (contents, props changed) > head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20-unrolled-arm.S > (contents, props changed) > head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20-x86_64-glue.c > (contents, props changed) > head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20-x86_64.pl > (contents, props changed) > head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20.c > (contents, props changed) > head/sys/dev/if_wg/module/crypto/zinc/chacha20poly1305.c > (contents, props changed) > head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-arm-glue.c > (contents, props changed) > head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-arm.pl > (contents, props changed) > head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-arm64.pl > (contents, props changed) > head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-donna32.c > (contents, props changed) > head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-donna64.c > (contents, props changed) > head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-mips-glue.c > (contents, props changed) > head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-mips.S > (contents, props changed) > head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-mips64.pl > (contents, props changed) > head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-x86_64-glue.c > (contents, props changed) > head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-x86_64.pl > (contents, props changed) > head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305.c > (contents, props changed) > head/sys/dev/if_wg/module/crypto/zinc/selftest/blake2s.c > (contents, props changed) > head/sys/dev/if_wg/module/crypto/zinc/selftest/chacha20.c > (contents, props changed) > head/sys/dev/if_wg/module/crypto/zinc/selftest/chacha20poly1305.c > (contents, props changed) > head/sys/dev/if_wg/module/crypto/zinc/selftest/curve25519.c > (contents, props changed) > head/sys/dev/if_wg/module/crypto/zinc/selftest/poly1305.c > (contents, props changed) > head/sys/dev/if_wg/module/crypto/zinc/selftest/run.h (contents, > props changed) > head/sys/dev/if_wg/module/curve25519.c (contents, props changed) > head/sys/dev/if_wg/module/if_wg_session.c (contents, props > changed) > head/sys/dev/if_wg/module/module.c (contents, props changed) > head/sys/dev/if_wg/module/poly1305-x86_64.S (contents, props > changed) > head/sys/dev/if_wg/module/wg_cookie.c (contents, props changed) > head/sys/dev/if_wg/module/wg_noise.c (contents, props changed) > head/sys/modules/if_wg/ > head/sys/modules/if_wg/Makefile (contents, props changed) > Directory Properties: > head/sys/dev/if_wg/include/crypto/ (props changed) > head/sys/dev/if_wg/include/zinc/ (props changed) > head/sys/dev/if_wg/module/crypto/ (props changed) > head/sys/dev/if_wg/module/crypto/zinc/ (props changed) > head/sys/dev/if_wg/module/crypto/zinc/chacha20/ (props changed) > head/sys/dev/if_wg/module/crypto/zinc/poly1305/ (props changed) > head/sys/dev/if_wg/module/crypto/zinc/selftest/ (props changed) Looking at sys/dev/if_wg/include/sys/support.h I wonder why zinc was not done as linuxkpi code? Could it be? /bz From owner-svn-src-head@freebsd.org Mon Nov 30 02:13:45 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 31A3646BFD7; Mon, 30 Nov 2020 02:13:45 +0000 (UTC) (envelope-from rpokala@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CkpgY0lQ6z4RN8; Mon, 30 Nov 2020 02:13:45 +0000 (UTC) (envelope-from rpokala@freebsd.org) Received: from [192.168.1.10] (c-98-207-126-143.hsd1.ca.comcast.net [98.207.126.143]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) (Authenticated sender: rpokala) by smtp.freebsd.org (Postfix) with ESMTPSA id 5024829600; Mon, 30 Nov 2020 02:13:44 +0000 (UTC) (envelope-from rpokala@freebsd.org) User-Agent: Microsoft-MacOutlook/16.43.20110804 Date: Sun, 29 Nov 2020 18:13:40 -0800 Subject: Re: svn commit: r368163 - in head: sbin/ifconfig sys/dev/if_wg sys/dev/if_wg/include sys/dev/if_wg/include/crypto sys/dev/if_wg/include/sys sys/dev/if_wg/include/zinc sys/dev/if_wg/module sys/dev/if_wg... From: Ravi Pokala To: Ian Lepore , Shawn Webb , Matt Macy CC: , , Message-ID: Thread-Topic: svn commit: r368163 - in head: sbin/ifconfig sys/dev/if_wg sys/dev/if_wg/include sys/dev/if_wg/include/crypto sys/dev/if_wg/include/sys sys/dev/if_wg/include/zinc sys/dev/if_wg/module sys/dev/if_wg... References: <202011291938.0ATJc4Z3081193@repo.freebsd.org> <20201130002026.myksmgoj4p3preaj@mutt-hbsd> In-Reply-To: Mime-version: 1.0 Content-type: text/plain; charset="UTF-8" Content-transfer-encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Nov 2020 02:13:45 -0000 -----Original Message----- From: on behalf of Ian Lepore Date: 2020-11-29, Sunday at 16:26 To: Shawn Webb , Matt Macy Cc: , , Subject: Re: svn commit: r368163 - in head: sbin/ifconfig sys/dev/if_wg sys/dev/if_wg/include sys/dev/if_wg/include/crypto sys/dev/if_wg/include/sys sys/dev/if_wg/include/zinc sys/dev/if_wg/module sys/dev/if_wg... On Sun, 2020-11-29 at 19:20 -0500, Shawn Webb wrote: > On Sun, Nov 29, 2020 at 07:38:04PM +0000, Matt Macy wrote: > > Author: mmacy > > Date: Sun Nov 29 19:38:03 2020 > > New Revision: 368163 > > URL: https://svnweb.freebsd.org/changeset/base/368163 > > > > Log: > > Import kernel WireGuard support > > > > Data path largely shared with the OpenBSD implementation by > > Matt Dunwoodie > > > > Reviewed by: grehan@freebsd.org > > MFC after: 1 month > > Sponsored by: Rubicon LLC, (Netgate) > > Differential Revision: https://reviews.freebsd.org/D26137 > > RELNOTES: yes? > > Thanks, > Or maybe an entry in src/RELNOTES, preferably one that (unlike the commit message) has at least some tiny shred of a clue about what Wireguard is. -- Ian In addition to an update to RELNOTES, a manpage would also be greatly appreciated. -Ravi (rpokala@) From owner-svn-src-head@freebsd.org Mon Nov 30 07:01:12 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D0381471A91; Mon, 30 Nov 2020 07:01:12 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Ckx3D5c7Mz4fkS; Mon, 30 Nov 2020 07:01:12 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B32111F42B; Mon, 30 Nov 2020 07:01:12 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AU71CbI006436; Mon, 30 Nov 2020 07:01:12 GMT (envelope-from mmel@FreeBSD.org) Received: (from mmel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AU71CWr006435; Mon, 30 Nov 2020 07:01:12 GMT (envelope-from mmel@FreeBSD.org) Message-Id: <202011300701.0AU71CWr006435@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmel set sender to mmel@FreeBSD.org using -f From: Michal Meloun Date: Mon, 30 Nov 2020 07:01:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368167 - head/sys/dev/nvme X-SVN-Group: head X-SVN-Commit-Author: mmel X-SVN-Commit-Paths: head/sys/dev/nvme X-SVN-Commit-Revision: 368167 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Nov 2020 07:01:12 -0000 Author: mmel Date: Mon Nov 30 07:01:12 2020 New Revision: 368167 URL: https://svnweb.freebsd.org/changeset/base/368167 Log: NVME: Don't try to swap data on little endian machines. These swapping functions violate BUSDMA contract - we cannot write to armed (by bus_dmamap_sync(PRE_..)) buffers. Remove them at least from little endian machines until a better solution will be developed. Reviewed by: imp MFC after: 3 weeks Modified: head/sys/dev/nvme/nvme.h Modified: head/sys/dev/nvme/nvme.h ============================================================================== --- head/sys/dev/nvme/nvme.h Sun Nov 29 23:37:18 2020 (r368166) +++ head/sys/dev/nvme/nvme.h Mon Nov 30 07:01:12 2020 (r368167) @@ -1732,6 +1732,7 @@ extern int nvme_use_nvd; static inline void nvme_completion_swapbytes(struct nvme_completion *s) { +#if _BYTE_ORDER != _LITTLE_ENDIAN s->cdw0 = le32toh(s->cdw0); /* omit rsvd1 */ @@ -1739,22 +1740,26 @@ void nvme_completion_swapbytes(struct nvme_completion s->sqid = le16toh(s->sqid); /* omit cid */ s->status = le16toh(s->status); +#endif } static inline void nvme_power_state_swapbytes(struct nvme_power_state *s) { +#if _BYTE_ORDER != _LITTLE_ENDIAN s->mp = le16toh(s->mp); s->enlat = le32toh(s->enlat); s->exlat = le32toh(s->exlat); s->idlp = le16toh(s->idlp); s->actp = le16toh(s->actp); +#endif } static inline void nvme_controller_data_swapbytes(struct nvme_controller_data *s) { +#if _BYTE_ORDER != _LITTLE_ENDIAN int i; s->vid = le16toh(s->vid); @@ -1800,11 +1805,13 @@ void nvme_controller_data_swapbytes(struct nvme_contro s->mnan = le32toh(s->mnan); for (i = 0; i < 32; i++) nvme_power_state_swapbytes(&s->power_state[i]); +#endif } static inline void nvme_namespace_data_swapbytes(struct nvme_namespace_data *s) { +#if _BYTE_ORDER != _LITTLE_ENDIAN int i; s->nsze = le64toh(s->nsze); @@ -1827,11 +1834,13 @@ void nvme_namespace_data_swapbytes(struct nvme_namespa s->endgid = le16toh(s->endgid); for (i = 0; i < 16; i++) s->lbaf[i] = le32toh(s->lbaf[i]); +#endif } static inline void nvme_error_information_entry_swapbytes(struct nvme_error_information_entry *s) { +#if _BYTE_ORDER != _LITTLE_ENDIAN s->error_count = le64toh(s->error_count); s->sqid = le16toh(s->sqid); @@ -1842,6 +1851,7 @@ void nvme_error_information_entry_swapbytes(struct nvm s->nsid = le32toh(s->nsid); s->csi = le64toh(s->csi); s->ttsi = le16toh(s->ttsi); +#endif } static inline @@ -1857,14 +1867,13 @@ void nvme_le128toh(void *p) tmp[i] = tmp[15-i]; tmp[15-i] = b; } -#else - (void)p; #endif } static inline void nvme_health_information_page_swapbytes(struct nvme_health_information_page *s) { +#if _BYTE_ORDER != _LITTLE_ENDIAN int i; s->temperature = le16toh(s->temperature); @@ -1886,47 +1895,57 @@ void nvme_health_information_page_swapbytes(struct nvm s->tmt2tc = le32toh(s->tmt2tc); s->ttftmt1 = le32toh(s->ttftmt1); s->ttftmt2 = le32toh(s->ttftmt2); +#endif } static inline void nvme_firmware_page_swapbytes(struct nvme_firmware_page *s) { +#if _BYTE_ORDER != _LITTLE_ENDIAN int i; for (i = 0; i < 7; i++) s->revision[i] = le64toh(s->revision[i]); +#endif } static inline void nvme_ns_list_swapbytes(struct nvme_ns_list *s) { +#if _BYTE_ORDER != _LITTLE_ENDIAN int i; for (i = 0; i < 1024; i++) s->ns[i] = le32toh(s->ns[i]); +#endif } static inline void nvme_command_effects_page_swapbytes(struct nvme_command_effects_page *s) { +#if _BYTE_ORDER != _LITTLE_ENDIAN int i; for (i = 0; i < 256; i++) s->acs[i] = le32toh(s->acs[i]); for (i = 0; i < 256; i++) s->iocs[i] = le32toh(s->iocs[i]); +#endif } static inline void nvme_res_notification_page_swapbytes(struct nvme_res_notification_page *s) { +#if _BYTE_ORDER != _LITTLE_ENDIAN s->log_page_count = le64toh(s->log_page_count); s->nsid = le32toh(s->nsid); +#endif } static inline void nvme_sanitize_status_page_swapbytes(struct nvme_sanitize_status_page *s) { +#if _BYTE_ORDER != _LITTLE_ENDIAN s->sprog = le16toh(s->sprog); s->sstat = le16toh(s->sstat); s->scdw10 = le32toh(s->scdw10); @@ -1936,11 +1955,13 @@ void nvme_sanitize_status_page_swapbytes(struct nvme_s s->etfownd = le32toh(s->etfownd); s->etfbewnd = le32toh(s->etfbewnd); s->etfcewnd = le32toh(s->etfcewnd); +#endif } static inline void intel_log_temp_stats_swapbytes(struct intel_log_temp_stats *s) { +#if _BYTE_ORDER != _LITTLE_ENDIAN s->current = le64toh(s->current); s->overtemp_flag_last = le64toh(s->overtemp_flag_last); @@ -1951,11 +1972,13 @@ void intel_log_temp_stats_swapbytes(struct intel_log_t s->max_oper_temp = le64toh(s->max_oper_temp); s->min_oper_temp = le64toh(s->min_oper_temp); s->est_offset = le64toh(s->est_offset); +#endif } static inline void nvme_resv_status_swapbytes(struct nvme_resv_status *s, size_t size) { +#if _BYTE_ORDER != _LITTLE_ENDIAN u_int i, n; s->gen = le32toh(s->gen); @@ -1966,11 +1989,13 @@ void nvme_resv_status_swapbytes(struct nvme_resv_statu s->ctrlr[i].hostid = le64toh(s->ctrlr[i].hostid); s->ctrlr[i].rkey = le64toh(s->ctrlr[i].rkey); } +#endif } static inline void nvme_resv_status_ext_swapbytes(struct nvme_resv_status_ext *s, size_t size) { +#if _BYTE_ORDER != _LITTLE_ENDIAN u_int i, n; s->gen = le32toh(s->gen); @@ -1981,6 +2006,7 @@ void nvme_resv_status_ext_swapbytes(struct nvme_resv_s s->ctrlr[i].rkey = le64toh(s->ctrlr[i].rkey); nvme_le128toh((void *)s->ctrlr[i].hostid); } +#endif } #endif /* __NVME_H__ */ From owner-svn-src-head@freebsd.org Mon Nov 30 08:22:42 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AEFC8473078; Mon, 30 Nov 2020 08:22:42 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CkysG4MHRz4k7H; Mon, 30 Nov 2020 08:22:42 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7DE9D1FFF7; Mon, 30 Nov 2020 08:22:42 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AU8Mg66058740; Mon, 30 Nov 2020 08:22:42 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AU8Mev2058730; Mon, 30 Nov 2020 08:22:40 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <202011300822.0AU8Mev2058730@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Mon, 30 Nov 2020 08:22:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368168 - in head/sys: amd64/conf conf dev/hyperv/vmbus dev/vt/hw/vbefb i386/conf kern x86/include X-SVN-Group: head X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: in head/sys: amd64/conf conf dev/hyperv/vmbus dev/vt/hw/vbefb i386/conf kern x86/include X-SVN-Commit-Revision: 368168 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Nov 2020 08:22:42 -0000 Author: tsoome Date: Mon Nov 30 08:22:40 2020 New Revision: 368168 URL: https://svnweb.freebsd.org/changeset/base/368168 Log: Add VT driver for VBE framebuffer device Implement vt_vbefb to support Vesa Bios Extensions (VBE) framebuffer with VT. vt_vbefb is built based on vt_efifb and is assuming similar data for initialization, use MODINFOMD_VBE_FB to identify the structure vbe_fb in kernel metadata. struct vbe_fb, is populated by boot loader, and is passed to kernel via metadata payload. Differential Revision: https://reviews.freebsd.org/D27373 Added: head/sys/dev/vt/hw/vbefb/ head/sys/dev/vt/hw/vbefb/vbefb.c (contents, props changed) Modified: head/sys/amd64/conf/GENERIC head/sys/amd64/conf/MINIMAL head/sys/amd64/conf/NOTES head/sys/conf/files head/sys/dev/hyperv/vmbus/vmbus.c head/sys/i386/conf/MINIMAL head/sys/kern/subr_module.c head/sys/x86/include/metadata.h Modified: head/sys/amd64/conf/GENERIC ============================================================================== --- head/sys/amd64/conf/GENERIC Mon Nov 30 07:01:12 2020 (r368167) +++ head/sys/amd64/conf/GENERIC Mon Nov 30 08:22:40 2020 (r368168) @@ -218,6 +218,7 @@ options SC_PIXEL_MODE # add support for the raster t device vt device vt_vga device vt_efifb +device vt_vbefb device agp # support several AGP chipsets Modified: head/sys/amd64/conf/MINIMAL ============================================================================== --- head/sys/amd64/conf/MINIMAL Mon Nov 30 07:01:12 2020 (r368167) +++ head/sys/amd64/conf/MINIMAL Mon Nov 30 08:22:40 2020 (r368168) @@ -126,6 +126,7 @@ options SC_PIXEL_MODE # add support for the raster t device vt device vt_vga device vt_efifb +device vt_vbefb device agp # support several AGP chipsets Modified: head/sys/amd64/conf/NOTES ============================================================================== --- head/sys/amd64/conf/NOTES Mon Nov 30 07:01:12 2020 (r368167) +++ head/sys/amd64/conf/NOTES Mon Nov 30 08:22:40 2020 (r368168) @@ -255,6 +255,7 @@ options VGA_DEBUG # vt(4) drivers. device vt_vga # VGA device vt_efifb # EFI framebuffer +device vt_vbefb # VBE framebuffer # Linear framebuffer driver for S3 VESA 1.2 cards. Works on top of VESA. device s3pci Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Mon Nov 30 07:01:12 2020 (r368167) +++ head/sys/conf/files Mon Nov 30 08:22:40 2020 (r368168) @@ -3474,6 +3474,7 @@ dev/vt/colors/vt_termcolors.c optional vt dev/vt/font/vt_font_default.c optional vt dev/vt/font/vt_mouse_cursor.c optional vt dev/vt/hw/efifb/efifb.c optional vt_efifb +dev/vt/hw/vbefb/vbefb.c optional vt_vbefb dev/vt/hw/fb/vt_fb.c optional vt dev/vt/hw/vga/vt_vga.c optional vt vt_vga dev/vt/logo/logo_freebsd.c optional vt splash Modified: head/sys/dev/hyperv/vmbus/vmbus.c ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus.c Mon Nov 30 07:01:12 2020 (r368167) +++ head/sys/dev/hyperv/vmbus/vmbus.c Mon Nov 30 08:22:40 2020 (r368168) @@ -1337,8 +1337,8 @@ vmbus_get_mmio_res(device_t dev) /* * On Gen2 VMs, Hyper-V provides mmio space for framebuffer. * This mmio address range is not useable for other PCI devices. - * Currently only efifb driver is using this range without reserving - * it from system. + * Currently only efifb and vbefb drivers are using this range without + * reserving it from system. * Therefore, vmbus driver reserves it before any other PCI device * drivers start to request mmio addresses. */ @@ -1348,6 +1348,9 @@ static void vmbus_fb_mmio_res(device_t dev) { struct efi_fb *efifb; + struct vbe_fb *vbefb; + rman_res_t fb_start, fb_end, fb_count; + int fb_height, fb_width; caddr_t kmdp; struct vmbus_softc *sc = device_get_softc(dev); @@ -1359,30 +1362,43 @@ vmbus_fb_mmio_res(device_t dev) efifb = (struct efi_fb *)preload_search_info(kmdp, MODINFO_METADATA | MODINFOMD_EFI_FB); if (efifb == NULL) { + vbefb = (struct vbe_fb *)preload_search_info(kmdp, + MODINFO_METADATA | MODINFOMD_VBE_FB); + fb_start = vbefb->fb_addr; + fb_end = vbefb->fb_addr + vbefb->fb_size; + fb_count = vbefb->fb_size; + fb_height = efifb->fb_height; + fb_width = efifb->fb_width; + } else { + fb_start = efifb->fb_addr; + fb_end = efifb->fb_addr + efifb->fb_size; + fb_count = efifb->fb_size; + fb_height = efifb->fb_height; + fb_width = efifb->fb_width; + } + if (fb_start == 0) { if (bootverbose) device_printf(dev, - "fb has no preloaded kernel efi information\n"); + "no preloaded kernel fb information\n"); /* We are on Gen1 VM, just return. */ return; } else { if (bootverbose) device_printf(dev, - "efifb: fb_addr: %#jx, size: %#jx, " + "fb: fb_addr: %#jx, size: %#jx, " "actual size needed: 0x%x\n", - efifb->fb_addr, efifb->fb_size, - (int) efifb->fb_height * efifb->fb_width); + fb_start, fb_count, fb_height * fb_width); } hv_fb_res = pcib_host_res_alloc(&sc->vmbus_mmio_res, dev, - SYS_RES_MEMORY, &rid, - efifb->fb_addr, efifb->fb_addr + efifb->fb_size, efifb->fb_size, + SYS_RES_MEMORY, &rid, fb_start, fb_end, fb_count, RF_ACTIVE | rman_make_alignment_flags(PAGE_SIZE)); if (hv_fb_res && bootverbose) device_printf(dev, "successfully reserved memory for framebuffer " "starting at %#jx, size %#jx\n", - efifb->fb_addr, efifb->fb_size); + fb_start, fb_count); } static void Added: head/sys/dev/vt/hw/vbefb/vbefb.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/vt/hw/vbefb/vbefb.c Mon Nov 30 08:22:40 2020 (r368168) @@ -0,0 +1,153 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2014 The FreeBSD Foundation + * All rights reserved. + * + * This software was developed by Aleksandr Rybalko under sponsorship from the + * FreeBSD Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include + +#include "opt_platform.h" + +#include +#include +#include +#include + +#include +#include +#include + +static vd_init_t vt_vbefb_init; +static vd_probe_t vt_vbefb_probe; + +static struct vt_driver vt_vbefb_driver = { + .vd_name = "vbefb", + .vd_probe = vt_vbefb_probe, + .vd_init = vt_vbefb_init, + .vd_blank = vt_fb_blank, + .vd_bitblt_text = vt_fb_bitblt_text, + .vd_invalidate_text = vt_fb_invalidate_text, + .vd_bitblt_bmp = vt_fb_bitblt_bitmap, + .vd_drawrect = vt_fb_drawrect, + .vd_setpixel = vt_fb_setpixel, + .vd_fb_ioctl = vt_fb_ioctl, + .vd_fb_mmap = vt_fb_mmap, + .vd_suspend = vt_suspend, + .vd_resume = vt_resume, + /* Better than VGA, but still generic driver. */ + .vd_priority = VD_PRIORITY_GENERIC + 1, +}; + +static struct fb_info local_vbe_info; +VT_DRIVER_DECLARE(vt_vbefb, vt_vbefb_driver); + +static int +vt_vbefb_probe(struct vt_device *vd) +{ + int disabled; + struct vbe_fb *vbefb; + caddr_t kmdp; + + disabled = 0; + TUNABLE_INT_FETCH("hw.syscons.disable", &disabled); + if (disabled != 0) + return (CN_DEAD); + + kmdp = preload_search_by_type("elf kernel"); + if (kmdp == NULL) + kmdp = preload_search_by_type("elf64 kernel"); + vbefb = (struct vbe_fb *)preload_search_info(kmdp, + MODINFO_METADATA | MODINFOMD_VBE_FB); + if (vbefb == NULL) + return (CN_DEAD); + + return (CN_INTERNAL); +} + +static int +vt_vbefb_init(struct vt_device *vd) +{ + struct fb_info *info; + struct vbe_fb *vbefb; + caddr_t kmdp; + int format, roff, goff, boff; + + info = vd->vd_softc; + if (info == NULL) + info = vd->vd_softc = (void *)&local_vbe_info; + + kmdp = preload_search_by_type("elf kernel"); + if (kmdp == NULL) + kmdp = preload_search_by_type("elf64 kernel"); + vbefb = (struct vbe_fb *)preload_search_info(kmdp, + MODINFO_METADATA | MODINFOMD_VBE_FB); + if (vbefb == NULL) + return (CN_DEAD); + + info->fb_height = vbefb->fb_height; + info->fb_width = vbefb->fb_width; + + info->fb_depth = vbefb->fb_bpp; + /* Round to a multiple of the bits in a byte. */ + info->fb_bpp = roundup2(vbefb->fb_bpp, NBBY); + + /* Stride in bytes, not pixels */ + info->fb_stride = vbefb->fb_stride * (info->fb_bpp / NBBY); + + if (info->fb_depth == 8) + format = COLOR_FORMAT_VGA; + else + format = COLOR_FORMAT_RGB; + + roff = ffs(vbefb->fb_mask_red) - 1; + goff = ffs(vbefb->fb_mask_green) - 1; + boff = ffs(vbefb->fb_mask_blue) - 1; + vt_generate_cons_palette(info->fb_cmap, format, + vbefb->fb_mask_red >> roff, roff, + vbefb->fb_mask_green >> goff, goff, + vbefb->fb_mask_blue >> boff, boff); + + /* Mark cmap initialized. */ + info->fb_cmsize = NCOLORS; + + info->fb_size = info->fb_height * info->fb_stride; + info->fb_pbase = vbefb->fb_addr; + info->fb_vbase = (intptr_t)pmap_mapdev_attr(info->fb_pbase, + info->fb_size, VM_MEMATTR_WRITE_COMBINING); + + vt_fb_init(vd); + + return (CN_INTERNAL); +} Modified: head/sys/i386/conf/MINIMAL ============================================================================== --- head/sys/i386/conf/MINIMAL Mon Nov 30 07:01:12 2020 (r368167) +++ head/sys/i386/conf/MINIMAL Mon Nov 30 08:22:40 2020 (r368168) @@ -126,6 +126,7 @@ options SC_PIXEL_MODE # add support for the raster t device vt device vt_vga device vt_efifb +device vt_vbefb device agp # support several AGP chipsets Modified: head/sys/kern/subr_module.c ============================================================================== --- head/sys/kern/subr_module.c Mon Nov 30 07:01:12 2020 (r368167) +++ head/sys/kern/subr_module.c Mon Nov 30 08:22:40 2020 (r368168) @@ -416,6 +416,11 @@ preload_modinfo_type(struct sbuf *sbp, int type) sbuf_cat(sbp, "MODINFOMD_MODULEP"); break; #endif +#ifdef MODINFOMD_VBE_FB + case MODINFOMD_VBE_FB: + sbuf_cat(sbp, "MODINFOMD_VBE_FB"); + break; +#endif default: sbuf_cat(sbp, "unrecognized metadata type"); } @@ -461,6 +466,9 @@ preload_modinfo_value(struct sbuf *sbp, uint32_t *bptr #endif #ifdef MODINFOMD_EFI_FB case MODINFO_METADATA | MODINFOMD_EFI_FB: +#endif +#ifdef MODINFOMD_VBE_FB + case MODINFO_METADATA | MODINFOMD_VBE_FB: #endif sbuf_print_vmoffset(sbp, *(vm_offset_t *)bptr); break; Modified: head/sys/x86/include/metadata.h ============================================================================== --- head/sys/x86/include/metadata.h Mon Nov 30 07:01:12 2020 (r368167) +++ head/sys/x86/include/metadata.h Mon Nov 30 08:22:40 2020 (r368168) @@ -35,6 +35,7 @@ #define MODINFOMD_EFI_MAP 0x1004 #define MODINFOMD_EFI_FB 0x1005 #define MODINFOMD_MODULEP 0x1006 +#define MODINFOMD_VBE_FB 0x1007 struct efi_map_header { uint64_t memory_size; @@ -52,6 +53,19 @@ struct efi_fb { uint32_t fb_mask_green; uint32_t fb_mask_blue; uint32_t fb_mask_reserved; +}; + +struct vbe_fb { + uint64_t fb_addr; + uint64_t fb_size; + uint32_t fb_height; + uint32_t fb_width; + uint32_t fb_stride; + uint32_t fb_mask_red; + uint32_t fb_mask_green; + uint32_t fb_mask_blue; + uint32_t fb_mask_reserved; + uint32_t fb_bpp; }; #endif /* !_MACHINE_METADATA_H_ */ From owner-svn-src-head@freebsd.org Mon Nov 30 08:31:42 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 627974738DE; Mon, 30 Nov 2020 08:31:42 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Ckz3f2LZLz4kfN; Mon, 30 Nov 2020 08:31:42 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4397820717; Mon, 30 Nov 2020 08:31:42 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AU8Vg3J064036; Mon, 30 Nov 2020 08:31:42 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AU8VgPM064035; Mon, 30 Nov 2020 08:31:42 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <202011300831.0AU8VgPM064035@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Mon, 30 Nov 2020 08:31:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368169 - head/sys/dev/hyperv/vmbus X-SVN-Group: head X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: head/sys/dev/hyperv/vmbus X-SVN-Commit-Revision: 368169 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Nov 2020 08:31:42 -0000 Author: tsoome Date: Mon Nov 30 08:31:41 2020 New Revision: 368169 URL: https://svnweb.freebsd.org/changeset/base/368169 Log: fix vmbus_fb_mmio_res after r368168 mixed efifb versus vbefb struct use did slip in by mistake. Modified: head/sys/dev/hyperv/vmbus/vmbus.c Modified: head/sys/dev/hyperv/vmbus/vmbus.c ============================================================================== --- head/sys/dev/hyperv/vmbus/vmbus.c Mon Nov 30 08:22:40 2020 (r368168) +++ head/sys/dev/hyperv/vmbus/vmbus.c Mon Nov 30 08:31:41 2020 (r368169) @@ -1367,8 +1367,8 @@ vmbus_fb_mmio_res(device_t dev) fb_start = vbefb->fb_addr; fb_end = vbefb->fb_addr + vbefb->fb_size; fb_count = vbefb->fb_size; - fb_height = efifb->fb_height; - fb_width = efifb->fb_width; + fb_height = vbefb->fb_height; + fb_width = vbefb->fb_width; } else { fb_start = efifb->fb_addr; fb_end = efifb->fb_addr + efifb->fb_size; @@ -1376,6 +1376,7 @@ vmbus_fb_mmio_res(device_t dev) fb_height = efifb->fb_height; fb_width = efifb->fb_width; } + if (fb_start == 0) { if (bootverbose) device_printf(dev, From owner-svn-src-head@freebsd.org Mon Nov 30 09:28:07 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8B1B94751A3; Mon, 30 Nov 2020 09:28:07 +0000 (UTC) (envelope-from manu@bidouilliste.com) Received: from mx.blih.net (mx.blih.net [212.83.155.74]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "mx.blih.net", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Cl0Jl0KZmz4pfn; Mon, 30 Nov 2020 09:28:06 +0000 (UTC) (envelope-from manu@bidouilliste.com) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bidouilliste.com; s=mx; t=1606728478; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=XWo0x+qrgHukIjvH2TOEmBnKh0wTjGt/LQaWgKc4OSI=; b=XAf13VjQWIBi8Lf82OZHVAQvnegRiczrYEhB4Oyim8cJskY9kbTCXPcmPKVeee0eR4/+e1 BUv+M8Pbwp5Y/KePV+j6EGhFR45HIw5vyiW+Zu0BFqQEPqIJ+f1IMaJeyWrYXjWHTBM/wD zpO+GuxSN5TQQ38jopXXzXq5GzjtEAo= Received: from amy.home (lfbn-idf2-1-288-247.w82-123.abo.wanadoo.fr [82.123.126.247]) by mx.blih.net (OpenSMTPD) with ESMTPSA id 49e063c6 (TLSv1.3:TLS_AES_256_GCM_SHA384:256:NO); Mon, 30 Nov 2020 09:27:58 +0000 (UTC) Date: Mon, 30 Nov 2020 10:27:58 +0100 From: Emmanuel Vadot To: "Bjoern A. Zeeb" Cc: "Matt Macy" , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r368163 - in head: sbin/ifconfig sys/dev/if_wg sys/dev/if_wg/include sys/dev/if_wg/include/crypto sys/dev/if_wg/include/sys sys/dev/if_wg/include/zinc sys/dev/if_wg/module sys/dev/if_wg... Message-Id: <20201130102758.c600f147a801933bb66529c7@bidouilliste.com> In-Reply-To: References: <202011291938.0ATJc4Z3081193@repo.freebsd.org> X-Mailer: Sylpheed 3.7.0 (GTK+ 2.24.32; amd64-portbld-freebsd13.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4Cl0Jl0KZmz4pfn X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Nov 2020 09:28:07 -0000 On Mon, 30 Nov 2020 01:13:12 +0000 "Bjoern A. Zeeb" wrote: > On 29 Nov 2020, at 19:38, Matt Macy wrote: > > > Author: mmacy > > Date: Sun Nov 29 19:38:03 2020 > > New Revision: 368163 > > URL: https://svnweb.freebsd.org/changeset/base/368163 > > > > Log: > > Import kernel WireGuard support > > > > Data path largely shared with the OpenBSD implementation by > > Matt Dunwoodie > > > > Reviewed by: grehan@freebsd.org > > MFC after: 1 month > > Sponsored by: Rubicon LLC, (Netgate) > > Differential Revision: https://reviews.freebsd.org/D26137 > > > > Added: > > head/sbin/ifconfig/ifwg.c (contents, props changed) > > head/sys/dev/if_wg/ > > head/sys/dev/if_wg/include/ > > head/sys/dev/if_wg/include/crypto/blake2s.h (contents, props > > changed) > > head/sys/dev/if_wg/include/crypto/curve25519.h (contents, props > > changed) > > head/sys/dev/if_wg/include/crypto/zinc.h (contents, props changed) > > head/sys/dev/if_wg/include/sys/ > > head/sys/dev/if_wg/include/sys/if_wg_session.h (contents, props > > changed) > > head/sys/dev/if_wg/include/sys/if_wg_session_vars.h (contents, > > props changed) > > head/sys/dev/if_wg/include/sys/simd-x86_64.h (contents, props > > changed) > > head/sys/dev/if_wg/include/sys/support.h (contents, props changed) > > head/sys/dev/if_wg/include/sys/wg_cookie.h (contents, props > > changed) > > head/sys/dev/if_wg/include/sys/wg_module.h (contents, props > > changed) > > head/sys/dev/if_wg/include/sys/wg_noise.h (contents, props > > changed) > > head/sys/dev/if_wg/include/zinc/blake2s.h (contents, props > > changed) > > head/sys/dev/if_wg/include/zinc/chacha20.h (contents, props > > changed) > > head/sys/dev/if_wg/include/zinc/chacha20poly1305.h (contents, > > props changed) > > head/sys/dev/if_wg/include/zinc/curve25519.h (contents, props > > changed) > > head/sys/dev/if_wg/include/zinc/poly1305.h (contents, props > > changed) > > head/sys/dev/if_wg/module/ > > head/sys/dev/if_wg/module/blake2s.c (contents, props changed) > > head/sys/dev/if_wg/module/blake2s.h (contents, props changed) > > head/sys/dev/if_wg/module/chacha20-x86_64.S (contents, props > > changed) > > head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20-arm-glue.c > > (contents, props changed) > > head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20-arm.pl > > (contents, props changed) > > head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20-arm64.pl > > (contents, props changed) > > head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20-mips-glue.c > > (contents, props changed) > > head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20-mips.S > > (contents, props changed) > > head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20-unrolled-arm.S > > (contents, props changed) > > head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20-x86_64-glue.c > > (contents, props changed) > > head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20-x86_64.pl > > (contents, props changed) > > head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20.c > > (contents, props changed) > > head/sys/dev/if_wg/module/crypto/zinc/chacha20poly1305.c > > (contents, props changed) > > head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-arm-glue.c > > (contents, props changed) > > head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-arm.pl > > (contents, props changed) > > head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-arm64.pl > > (contents, props changed) > > head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-donna32.c > > (contents, props changed) > > head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-donna64.c > > (contents, props changed) > > head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-mips-glue.c > > (contents, props changed) > > head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-mips.S > > (contents, props changed) > > head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-mips64.pl > > (contents, props changed) > > head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-x86_64-glue.c > > (contents, props changed) > > head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-x86_64.pl > > (contents, props changed) > > head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305.c > > (contents, props changed) > > head/sys/dev/if_wg/module/crypto/zinc/selftest/blake2s.c > > (contents, props changed) > > head/sys/dev/if_wg/module/crypto/zinc/selftest/chacha20.c > > (contents, props changed) > > head/sys/dev/if_wg/module/crypto/zinc/selftest/chacha20poly1305.c > > (contents, props changed) > > head/sys/dev/if_wg/module/crypto/zinc/selftest/curve25519.c > > (contents, props changed) > > head/sys/dev/if_wg/module/crypto/zinc/selftest/poly1305.c > > (contents, props changed) > > head/sys/dev/if_wg/module/crypto/zinc/selftest/run.h (contents, > > props changed) > > head/sys/dev/if_wg/module/curve25519.c (contents, props changed) > > head/sys/dev/if_wg/module/if_wg_session.c (contents, props > > changed) > > head/sys/dev/if_wg/module/module.c (contents, props changed) > > head/sys/dev/if_wg/module/poly1305-x86_64.S (contents, props > > changed) > > head/sys/dev/if_wg/module/wg_cookie.c (contents, props changed) > > head/sys/dev/if_wg/module/wg_noise.c (contents, props changed) > > head/sys/modules/if_wg/ > > head/sys/modules/if_wg/Makefile (contents, props changed) > > Directory Properties: > > head/sys/dev/if_wg/include/crypto/ (props changed) > > head/sys/dev/if_wg/include/zinc/ (props changed) > > head/sys/dev/if_wg/module/crypto/ (props changed) > > head/sys/dev/if_wg/module/crypto/zinc/ (props changed) > > head/sys/dev/if_wg/module/crypto/zinc/chacha20/ (props changed) > > head/sys/dev/if_wg/module/crypto/zinc/poly1305/ (props changed) > > head/sys/dev/if_wg/module/crypto/zinc/selftest/ (props changed) > > > Looking at sys/dev/if_wg/include/sys/support.h I wonder why zinc was not > done as linuxkpi code? Could it be? > > > /bz Adding a dependancy on linuxkpi for just a few compat funcs looks overkill, also having it done that way means that mallocs are typed with M_WG instead of the global M_LINUXKPI so it's better to track leaks, if any. -- Emmanuel Vadot From owner-svn-src-head@freebsd.org Mon Nov 30 09:47:54 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5771F4753CA; Mon, 30 Nov 2020 09:47:54 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Cl0lZ20FZz4r9X; Mon, 30 Nov 2020 09:47:54 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 376E121261; Mon, 30 Nov 2020 09:47:54 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AU9ls6L009116; Mon, 30 Nov 2020 09:47:54 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AU9lsSQ009115; Mon, 30 Nov 2020 09:47:54 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202011300947.0AU9lsSQ009115@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Mon, 30 Nov 2020 09:47:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368182 - head/sys/compat/linuxkpi/common/include/linux X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/compat/linuxkpi/common/include/linux X-SVN-Commit-Revision: 368182 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Nov 2020 09:47:54 -0000 Author: hselasky Date: Mon Nov 30 09:47:53 2020 New Revision: 368182 URL: https://svnweb.freebsd.org/changeset/base/368182 Log: Use function macro for sema_init() in the LinuxKPI to limit macro expansion scope. MFC after: 1 week Sponsored by: Mellanox Technologies // NVIDIA Networking Modified: head/sys/compat/linuxkpi/common/include/linux/semaphore.h Modified: head/sys/compat/linuxkpi/common/include/linux/semaphore.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/semaphore.h Mon Nov 30 09:45:44 2020 (r368181) +++ head/sys/compat/linuxkpi/common/include/linux/semaphore.h Mon Nov 30 09:47:53 2020 (r368182) @@ -65,6 +65,6 @@ init_MUTEX(struct semaphore *sem) sema_init(&sem->sema, 1, "lnxsema"); } -#define sema_init linux_sema_init +#define sema_init(...) linux_sema_init(__VA_ARGS__) #endif /* _LINUX_SEMAPHORE_H_ */ From owner-svn-src-head@freebsd.org Mon Nov 30 10:35:15 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A611A476498; Mon, 30 Nov 2020 10:35:15 +0000 (UTC) (envelope-from tuexen@freebsd.org) Received: from drew.franken.de (drew.ipv6.franken.de [IPv6:2001:638:a02:a001:20e:cff:fe4a:feaa]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.franken.de", Issuer "Sectigo RSA Domain Validation Secure Server CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Cl1pC3TNRz4tBW; Mon, 30 Nov 2020 10:35:15 +0000 (UTC) (envelope-from tuexen@freebsd.org) Received: from mbp.fritz.box (ip4d16e8c9.dynamic.kabel-deutschland.de [77.22.232.201]) (Authenticated sender: macmic) by mail-n.franken.de (Postfix) with ESMTPSA id 08F607220B80B; Mon, 30 Nov 2020 11:35:05 +0100 (CET) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.20.0.2.21\)) Subject: Re: svn commit: r368167 - head/sys/dev/nvme From: Michael Tuexen In-Reply-To: <202011300701.0AU71CWr006435@repo.freebsd.org> Date: Mon, 30 Nov 2020 11:35:04 +0100 Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: quoted-printable Message-Id: <8A805005-1EB5-477E-B8EA-003F91A9B337@freebsd.org> References: <202011300701.0AU71CWr006435@repo.freebsd.org> To: Michal Meloun X-Mailer: Apple Mail (2.3654.20.0.2.21) X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=disabled version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on mail-n.franken.de X-Rspamd-Queue-Id: 4Cl1pC3TNRz4tBW X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Nov 2020 10:35:15 -0000 > On 30. Nov 2020, at 08:01, Michal Meloun wrote: >=20 > Author: mmel > Date: Mon Nov 30 07:01:12 2020 > New Revision: 368167 > URL: https://svnweb.freebsd.org/changeset/base/368167 >=20 > Log: > NVME: Don't try to swap data on little endian machines. > These swapping functions violate BUSDMA contract - we cannot write > to armed (by bus_dmamap_sync(PRE_..)) buffers. Remove them at least > from little endian machines until a better solution will be = developed. This breaks building libsysdecode on a little endian (amd64) system: tuexen@cirrus:~/head/lib/libsysdecode % sudo make Password: env CPP=3D"cpp" MK_PF=3D"yes" /bin/sh = /usr/home/tuexen/head/lib/libsysdecode/mkioctls /usr/include > = ioctl.c.tmp if [ ! -e ioctl.c ] || ! cmp -s ioctl.c ioctl.c.tmp; then mv -f = ioctl.c.tmp ioctl.c; fi cc -O2 -pipe -fno-common = -I/usr/obj/usr/home/tuexen/head/amd64.amd64/lib/libsysdecode = -I/usr/home/tuexen/head/sys -I/usr/home/tuexen/head/libexec/rtld-elf = -DPF -g -MD -MF.depend.ioctl.o -MTioctl.o -std=3Dgnu99 = -Wno-format-zero-length -fstack-protector-strong -Wsystem-headers = -Werror -Wall -Wno-format-y2k -W -Wno-unused-parameter = -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wreturn-type = -Wcast-qual -Wwrite-strings -Wswitch -Wshadow -Wunused-parameter = -Wcast-align -Wchar-subscripts -Winline -Wnested-externs = -Wredundant-decls -Wold-style-definition -Wno-pointer-sign = -Wmissing-variable-declarations -Wthread-safety -Wno-empty-body = -Wno-string-plus-int -Wno-unused-const-variable -Qunused-arguments = -c ioctl.c -o ioctl.o In file included from ioctl.c:33: In file included from = /usr/home/tuexen/head/sys/./cam/scsi/scsi_pass.h:35: In file included from /usr/home/tuexen/head/sys/cam/cam_ccb.h:46: In file included from /usr/home/tuexen/head/sys/cam/nvme/nvme_all.h:33: /usr/home/tuexen/head/sys/dev/nvme/nvme.h:1733:56: error: unused = parameter 's' [-Werror,-Wunused-parameter] void nvme_completion_swapbytes(struct nvme_completion *s) ^ /usr/home/tuexen/head/sys/dev/nvme/nvme.h:1747:58: error: unused = parameter 's' [-Werror,-Wunused-parameter] void nvme_power_state_swapbytes(struct nvme_power_state *s) ^ /usr/home/tuexen/head/sys/dev/nvme/nvme.h:1760:66: error: unused = parameter 's' [-Werror,-Wunused-parameter] void nvme_controller_data_swapbytes(struct nvme_controller_data *s) ^ /usr/home/tuexen/head/sys/dev/nvme/nvme.h:1812:64: error: unused = parameter 's' [-Werror,-Wunused-parameter] void nvme_namespace_data_swapbytes(struct nvme_namespace_data *s) ^ /usr/home/tuexen/head/sys/dev/nvme/nvme.h:1841:82: error: unused = parameter 's' [-Werror,-Wunused-parameter] void nvme_error_information_entry_swapbytes(struct = nvme_error_information_entry *s) = ^ /usr/home/tuexen/head/sys/dev/nvme/nvme.h:1858:26: error: unused = parameter 'p' [-Werror,-Wunused-parameter] void nvme_le128toh(void *p) ^ /usr/home/tuexen/head/sys/dev/nvme/nvme.h:1874:82: error: unused = parameter 's' [-Werror,-Wunused-parameter] void nvme_health_information_page_swapbytes(struct = nvme_health_information_page *s) = ^ /usr/home/tuexen/head/sys/dev/nvme/nvme.h:1902:62: error: unused = parameter 's' [-Werror,-Wunused-parameter] void nvme_firmware_page_swapbytes(struct nvme_firmware_page *s) ^ /usr/home/tuexen/head/sys/dev/nvme/nvme.h:1913:50: error: unused = parameter 's' [-Werror,-Wunused-parameter] void nvme_ns_list_swapbytes(struct nvme_ns_list *s) ^ /usr/home/tuexen/head/sys/dev/nvme/nvme.h:1924:76: error: unused = parameter 's' [-Werror,-Wunused-parameter] void nvme_command_effects_page_swapbytes(struct = nvme_command_effects_page *s) = ^ /usr/home/tuexen/head/sys/dev/nvme/nvme.h:1937:78: error: unused = parameter 's' [-Werror,-Wunused-parameter] void nvme_res_notification_page_swapbytes(struct = nvme_res_notification_page *s) = ^ /usr/home/tuexen/head/sys/dev/nvme/nvme.h:1946:76: error: unused = parameter 's' [-Werror,-Wunused-parameter] void nvme_sanitize_status_page_swapbytes(struct = nvme_sanitize_status_page *s) = ^ /usr/home/tuexen/head/sys/dev/nvme/nvme.h:1962:66: error: unused = parameter 's' [-Werror,-Wunused-parameter] void intel_log_temp_stats_swapbytes(struct intel_log_temp_stats *s) ^ /usr/home/tuexen/head/sys/dev/nvme/nvme.h:1979:58: error: unused = parameter 's' [-Werror,-Wunused-parameter] void nvme_resv_status_swapbytes(struct nvme_resv_status *s, size_t = size) ^ /usr/home/tuexen/head/sys/dev/nvme/nvme.h:1979:68: error: unused = parameter 'size' [-Werror,-Wunused-parameter] void nvme_resv_status_swapbytes(struct nvme_resv_status *s, size_t = size) ^ /usr/home/tuexen/head/sys/dev/nvme/nvme.h:1996:66: error: unused = parameter 's' [-Werror,-Wunused-parameter] void nvme_resv_status_ext_swapbytes(struct nvme_resv_status_ext *s, = size_t size) ^ /usr/home/tuexen/head/sys/dev/nvme/nvme.h:1996:76: error: unused = parameter 'size' [-Werror,-Wunused-parameter] void nvme_resv_status_ext_swapbytes(struct nvme_resv_status_ext *s, = size_t size) = ^ 17 errors generated. *** Error code 1 Stop. make: stopped in /usr/home/tuexen/head/lib/libsysdecode Best regards Michael >=20 > Reviewed by: imp > MFC after: 3 weeks >=20 > Modified: > head/sys/dev/nvme/nvme.h >=20 > Modified: head/sys/dev/nvme/nvme.h > = =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D > --- head/sys/dev/nvme/nvme.h Sun Nov 29 23:37:18 2020 = (r368166) > +++ head/sys/dev/nvme/nvme.h Mon Nov 30 07:01:12 2020 = (r368167) > @@ -1732,6 +1732,7 @@ extern int nvme_use_nvd; > static inline > void nvme_completion_swapbytes(struct nvme_completion *s) > { > +#if _BYTE_ORDER !=3D _LITTLE_ENDIAN >=20 > s->cdw0 =3D le32toh(s->cdw0); > /* omit rsvd1 */ > @@ -1739,22 +1740,26 @@ void nvme_completion_swapbytes(struct = nvme_completion=20 > s->sqid =3D le16toh(s->sqid); > /* omit cid */ > s->status =3D le16toh(s->status); > +#endif > } >=20 > static inline > void nvme_power_state_swapbytes(struct nvme_power_state *s) > { > +#if _BYTE_ORDER !=3D _LITTLE_ENDIAN >=20 > s->mp =3D le16toh(s->mp); > s->enlat =3D le32toh(s->enlat); > s->exlat =3D le32toh(s->exlat); > s->idlp =3D le16toh(s->idlp); > s->actp =3D le16toh(s->actp); > +#endif > } >=20 > static inline > void nvme_controller_data_swapbytes(struct nvme_controller_data *s) > { > +#if _BYTE_ORDER !=3D _LITTLE_ENDIAN > int i; >=20 > s->vid =3D le16toh(s->vid); > @@ -1800,11 +1805,13 @@ void nvme_controller_data_swapbytes(struct = nvme_contro > s->mnan =3D le32toh(s->mnan); > for (i =3D 0; i < 32; i++) > nvme_power_state_swapbytes(&s->power_state[i]); > +#endif > } >=20 > static inline > void nvme_namespace_data_swapbytes(struct nvme_namespace_data *s) > { > +#if _BYTE_ORDER !=3D _LITTLE_ENDIAN > int i; >=20 > s->nsze =3D le64toh(s->nsze); > @@ -1827,11 +1834,13 @@ void nvme_namespace_data_swapbytes(struct = nvme_namespa > s->endgid =3D le16toh(s->endgid); > for (i =3D 0; i < 16; i++) > s->lbaf[i] =3D le32toh(s->lbaf[i]); > +#endif > } >=20 > static inline > void nvme_error_information_entry_swapbytes(struct = nvme_error_information_entry *s) > { > +#if _BYTE_ORDER !=3D _LITTLE_ENDIAN >=20 > s->error_count =3D le64toh(s->error_count); > s->sqid =3D le16toh(s->sqid); > @@ -1842,6 +1851,7 @@ void = nvme_error_information_entry_swapbytes(struct nvm > s->nsid =3D le32toh(s->nsid); > s->csi =3D le64toh(s->csi); > s->ttsi =3D le16toh(s->ttsi); > +#endif > } >=20 > static inline > @@ -1857,14 +1867,13 @@ void nvme_le128toh(void *p) > tmp[i] =3D tmp[15-i]; > tmp[15-i] =3D b; > } > -#else > - (void)p; > #endif > } >=20 > static inline > void nvme_health_information_page_swapbytes(struct = nvme_health_information_page *s) > { > +#if _BYTE_ORDER !=3D _LITTLE_ENDIAN > int i; >=20 > s->temperature =3D le16toh(s->temperature); > @@ -1886,47 +1895,57 @@ void = nvme_health_information_page_swapbytes(struct nvm > s->tmt2tc =3D le32toh(s->tmt2tc); > s->ttftmt1 =3D le32toh(s->ttftmt1); > s->ttftmt2 =3D le32toh(s->ttftmt2); > +#endif > } >=20 > static inline > void nvme_firmware_page_swapbytes(struct nvme_firmware_page *s) > { > +#if _BYTE_ORDER !=3D _LITTLE_ENDIAN > int i; >=20 > for (i =3D 0; i < 7; i++) > s->revision[i] =3D le64toh(s->revision[i]); > +#endif > } >=20 > static inline > void nvme_ns_list_swapbytes(struct nvme_ns_list *s) > { > +#if _BYTE_ORDER !=3D _LITTLE_ENDIAN > int i; >=20 > for (i =3D 0; i < 1024; i++) > s->ns[i] =3D le32toh(s->ns[i]); > +#endif > } >=20 > static inline > void nvme_command_effects_page_swapbytes(struct = nvme_command_effects_page *s) > { > +#if _BYTE_ORDER !=3D _LITTLE_ENDIAN > int i; >=20 > for (i =3D 0; i < 256; i++) > s->acs[i] =3D le32toh(s->acs[i]); > for (i =3D 0; i < 256; i++) > s->iocs[i] =3D le32toh(s->iocs[i]); > +#endif > } >=20 > static inline > void nvme_res_notification_page_swapbytes(struct = nvme_res_notification_page *s) > { > +#if _BYTE_ORDER !=3D _LITTLE_ENDIAN > s->log_page_count =3D le64toh(s->log_page_count); > s->nsid =3D le32toh(s->nsid); > +#endif > } >=20 > static inline > void nvme_sanitize_status_page_swapbytes(struct = nvme_sanitize_status_page *s) > { > +#if _BYTE_ORDER !=3D _LITTLE_ENDIAN > s->sprog =3D le16toh(s->sprog); > s->sstat =3D le16toh(s->sstat); > s->scdw10 =3D le32toh(s->scdw10); > @@ -1936,11 +1955,13 @@ void = nvme_sanitize_status_page_swapbytes(struct nvme_s > s->etfownd =3D le32toh(s->etfownd); > s->etfbewnd =3D le32toh(s->etfbewnd); > s->etfcewnd =3D le32toh(s->etfcewnd); > +#endif > } >=20 > static inline > void intel_log_temp_stats_swapbytes(struct intel_log_temp_stats *s) > { > +#if _BYTE_ORDER !=3D _LITTLE_ENDIAN >=20 > s->current =3D le64toh(s->current); > s->overtemp_flag_last =3D le64toh(s->overtemp_flag_last); > @@ -1951,11 +1972,13 @@ void intel_log_temp_stats_swapbytes(struct = intel_log_t > s->max_oper_temp =3D le64toh(s->max_oper_temp); > s->min_oper_temp =3D le64toh(s->min_oper_temp); > s->est_offset =3D le64toh(s->est_offset); > +#endif > } >=20 > static inline > void nvme_resv_status_swapbytes(struct nvme_resv_status *s, size_t = size) > { > +#if _BYTE_ORDER !=3D _LITTLE_ENDIAN > u_int i, n; >=20 > s->gen =3D le32toh(s->gen); > @@ -1966,11 +1989,13 @@ void nvme_resv_status_swapbytes(struct = nvme_resv_statu > s->ctrlr[i].hostid =3D le64toh(s->ctrlr[i].hostid); > s->ctrlr[i].rkey =3D le64toh(s->ctrlr[i].rkey); > } > +#endif > } >=20 > static inline > void nvme_resv_status_ext_swapbytes(struct nvme_resv_status_ext *s, = size_t size) > { > +#if _BYTE_ORDER !=3D _LITTLE_ENDIAN > u_int i, n; >=20 > s->gen =3D le32toh(s->gen); > @@ -1981,6 +2006,7 @@ void nvme_resv_status_ext_swapbytes(struct = nvme_resv_s > s->ctrlr[i].rkey =3D le64toh(s->ctrlr[i].rkey); > nvme_le128toh((void *)s->ctrlr[i].hostid); > } > +#endif > } >=20 > #endif /* __NVME_H__ */ From owner-svn-src-head@freebsd.org Mon Nov 30 11:45:48 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4F35D478DB6; Mon, 30 Nov 2020 11:45:48 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Cl3Mc1p4Qz3GCK; Mon, 30 Nov 2020 11:45:48 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3085D22ABF; Mon, 30 Nov 2020 11:45:48 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AUBjmfr083609; Mon, 30 Nov 2020 11:45:48 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AUBjlAa083605; Mon, 30 Nov 2020 11:45:47 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <202011301145.0AUBjlAa083605@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Mon, 30 Nov 2020 11:45:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368184 - in head/sys: dev/vt kern sys X-SVN-Group: head X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: in head/sys: dev/vt kern sys X-SVN-Commit-Revision: 368184 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Nov 2020 11:45:48 -0000 Author: tsoome Date: Mon Nov 30 11:45:47 2020 New Revision: 368184 URL: https://svnweb.freebsd.org/changeset/base/368184 Log: vt: if loader did pass the font via metadata, use it The built in 8x16 font may be way too small with large framebuffer resolutions, to improve readability, use loader provied font. Modified: head/sys/dev/vt/vt_core.c head/sys/kern/subr_module.c head/sys/sys/font.h head/sys/sys/linker.h Modified: head/sys/dev/vt/vt_core.c ============================================================================== --- head/sys/dev/vt/vt_core.c Mon Nov 30 10:58:06 2020 (r368183) +++ head/sys/dev/vt/vt_core.c Mon Nov 30 11:45:47 2020 (r368184) @@ -39,9 +39,11 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include +#include #include #include #include @@ -163,8 +165,15 @@ extern unsigned char vt_logo_image[]; const unsigned int vt_logo_sprite_height; #endif -/* Font. */ +/* + * Console font. vt_font_loader will be filled with font data passed + * by loader. If there is no font passed by boot loader, we use built in + * default. + */ extern struct vt_font vt_font_default; +static struct vt_font vt_font_loader; +static struct vt_font *vt_font_assigned = &vt_font_default; + #ifndef SC_NO_CUTPASTE extern struct vt_mouse_cursor vt_default_mouse_pointer; #endif @@ -1445,7 +1454,131 @@ vtterm_splash(struct vt_device *vd) } #endif +static struct vt_font * +parse_font_info_static(struct font_info *fi) +{ + struct vt_font *vfp; + uintptr_t ptr; + uint32_t checksum; + + if (fi == NULL) + return (NULL); + + ptr = (uintptr_t)fi; + /* + * Compute and verify checksum. The total sum of all the fields + * must be 0. + */ + checksum = fi->fi_width; + checksum += fi->fi_height; + checksum += fi->fi_bitmap_size; + for (unsigned i = 0; i < VFNT_MAPS; i++) + checksum += fi->fi_map_count[i]; + + if (checksum + fi->fi_checksum != 0) + return (NULL); + + ptr += sizeof(struct font_info); + ptr = roundup2(ptr, 8); + + vfp = &vt_font_loader; + vfp->vf_height = fi->fi_height; + vfp->vf_width = fi->fi_width; + for (unsigned i = 0; i < VFNT_MAPS; i++) { + if (fi->fi_map_count[i] == 0) + continue; + vfp->vf_map_count[i] = fi->fi_map_count[i]; + vfp->vf_map[i] = (vfnt_map_t *)ptr; + ptr += (fi->fi_map_count[i] * sizeof(vfnt_map_t)); + ptr = roundup2(ptr, 8); + } + vfp->vf_bytes = (uint8_t *)ptr; + return (vfp); +} + +static struct vt_font * +parse_font_info(struct font_info *fi) +{ + struct vt_font *vfp; + uintptr_t ptr; + uint32_t checksum; + size_t size; + + if (fi == NULL) + return (NULL); + + ptr = (uintptr_t)fi; + /* + * Compute and verify checksum. The total sum of all the fields + * must be 0. + */ + checksum = fi->fi_width; + checksum += fi->fi_height; + checksum += fi->fi_bitmap_size; + for (unsigned i = 0; i < VFNT_MAPS; i++) + checksum += fi->fi_map_count[i]; + + if (checksum + fi->fi_checksum != 0) + return (NULL); + + ptr += sizeof(struct font_info); + ptr = roundup2(ptr, 8); + + vfp = &vt_font_loader; + vfp->vf_height = fi->fi_height; + vfp->vf_width = fi->fi_width; + for (unsigned i = 0; i < VFNT_MAPS; i++) { + if (fi->fi_map_count[i] == 0) + continue; + vfp->vf_map_count[i] = fi->fi_map_count[i]; + size = fi->fi_map_count[i] * sizeof(vfnt_map_t); + vfp->vf_map[i] = malloc(size, M_VT, M_WAITOK | M_ZERO); + bcopy((vfnt_map_t *)ptr, vfp->vf_map[i], size); + ptr += size; + ptr = roundup2(ptr, 8); + } + vfp->vf_bytes = malloc(fi->fi_bitmap_size, M_VT, M_WAITOK | M_ZERO); + bcopy((uint8_t *)ptr, vfp->vf_bytes, fi->fi_bitmap_size); + return (vfp); +} + static void +vt_init_font(void *arg) +{ + caddr_t kmdp; + struct font_info *fi; + struct vt_font *font; + + kmdp = preload_search_by_type("elf kernel"); + if (kmdp == NULL) + kmdp = preload_search_by_type("elf64 kernel"); + fi = MD_FETCH(kmdp, MODINFOMD_FONT, struct font_info *); + + font = parse_font_info(fi); + if (font != NULL) + vt_font_assigned = font; +} + +SYSINIT(vt_init_font, SI_SUB_KMEM, SI_ORDER_ANY, vt_init_font, &vt_consdev); + +static void +vt_init_font_static(void) +{ + caddr_t kmdp; + struct font_info *fi; + struct vt_font *font; + + kmdp = preload_search_by_type("elf kernel"); + if (kmdp == NULL) + kmdp = preload_search_by_type("elf64 kernel"); + fi = MD_FETCH(kmdp, MODINFOMD_FONT, struct font_info *); + + font = parse_font_info_static(fi); + if (font != NULL) + vt_font_assigned = font; +} + +static void vtterm_cnprobe(struct terminal *tm, struct consdev *cp) { struct vt_driver *vtd, **vtdlist, *vtdbest = NULL; @@ -1491,9 +1624,11 @@ vtterm_cnprobe(struct terminal *tm, struct consdev *cp vd->vd_windows[VT_CONSWINDOW] = vw; sprintf(cp->cn_name, "ttyv%r", VT_UNIT(vw)); + vt_init_font_static(); + /* Attach default font if not in TEXTMODE. */ if ((vd->vd_flags & VDF_TEXTMODE) == 0) { - vw->vw_font = vtfont_ref(&vt_font_default); + vw->vw_font = vtfont_ref(vt_font_assigned); vt_compute_drawable_area(vw); } @@ -2431,7 +2566,7 @@ skip_thunk: } case PIO_VFONT_DEFAULT: { /* Reset to default font. */ - error = vt_change_font(vw, &vt_font_default); + error = vt_change_font(vw, vt_font_assigned); return (error); } case GIO_SCRNMAP: { @@ -2691,7 +2826,7 @@ vt_allocate_window(struct vt_device *vd, unsigned int vw->vw_kbdmode = K_XLATE; if ((vd->vd_flags & VDF_TEXTMODE) == 0) { - vw->vw_font = vtfont_ref(&vt_font_default); + vw->vw_font = vtfont_ref(vt_font_assigned); vt_compute_drawable_area(vw); } @@ -2788,7 +2923,7 @@ vt_resize(struct vt_device *vd) VT_LOCK(vd); /* Assign default font to window, if not textmode. */ if (!(vd->vd_flags & VDF_TEXTMODE) && vw->vw_font == NULL) - vw->vw_font = vtfont_ref(&vt_font_default); + vw->vw_font = vtfont_ref(vt_font_assigned); VT_UNLOCK(vd); /* Resize terminal windows */ Modified: head/sys/kern/subr_module.c ============================================================================== --- head/sys/kern/subr_module.c Mon Nov 30 10:58:06 2020 (r368183) +++ head/sys/kern/subr_module.c Mon Nov 30 11:45:47 2020 (r368184) @@ -295,6 +295,7 @@ preload_bootstrap_relocate(vm_offset_t offset) /* Deal with the ones that we know we have to fix */ switch (hdr[0]) { case MODINFO_ADDR: + case MODINFO_METADATA|MODINFOMD_FONT: case MODINFO_METADATA|MODINFOMD_SSYM: case MODINFO_METADATA|MODINFOMD_ESYM: ptr = (vm_offset_t *)(curp + (sizeof(uint32_t) * 2)); Modified: head/sys/sys/font.h ============================================================================== --- head/sys/sys/font.h Mon Nov 30 10:58:06 2020 (r368183) +++ head/sys/sys/font.h Mon Nov 30 11:45:47 2020 (r368184) @@ -57,6 +57,14 @@ enum vfnt_map_type { VFNT_MAPS /* Number of maps. */ }; +struct font_info { + int32_t fi_checksum; + uint32_t fi_width; + uint32_t fi_height; + uint32_t fi_bitmap_size; + uint32_t fi_map_count[VFNT_MAPS]; +}; + struct vfnt_map { uint32_t vfm_src; uint16_t vfm_dst; Modified: head/sys/sys/linker.h ============================================================================== --- head/sys/sys/linker.h Mon Nov 30 10:58:06 2020 (r368183) +++ head/sys/sys/linker.h Mon Nov 30 11:45:47 2020 (r368184) @@ -226,6 +226,7 @@ void *linker_hwpmc_list_objects(void); #define MODINFOMD_CTORS_SIZE 0x000b /* size of .ctors */ #define MODINFOMD_FW_HANDLE 0x000c /* Firmware dependent handle */ #define MODINFOMD_KEYBUF 0x000d /* Crypto key intake buffer */ +#define MODINFOMD_FONT 0x000e /* Console font */ #define MODINFOMD_NOCOPY 0x8000 /* don't copy this metadata to the kernel */ #define MODINFOMD_DEPLIST (0x4001 | MODINFOMD_NOCOPY) /* depends on */ From owner-svn-src-head@freebsd.org Mon Nov 30 13:11:35 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7DA8E47BEB9; Mon, 30 Nov 2020 13:11:35 +0000 (UTC) (envelope-from bzeeb-lists@lists.zabbadoz.net) Received: from mx1.sbone.de (mx1.sbone.de [IPv6:2a01:4f8:13b:39f::9f:25]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mx1.sbone.de", Issuer "SBone.DE" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Cl5Gb2TLkz3Mcj; Mon, 30 Nov 2020 13:11:35 +0000 (UTC) (envelope-from bzeeb-lists@lists.zabbadoz.net) Received: from mail.sbone.de (mail.sbone.de [IPv6:fde9:577b:c1a9:31::2013:587]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.sbone.de (Postfix) with ESMTPS id D2CEF8D4A222; Mon, 30 Nov 2020 13:11:32 +0000 (UTC) Received: from content-filter.sbone.de (content-filter.sbone.de [IPv6:fde9:577b:c1a9:31::2013:2742]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPS id 64711E707C6; Mon, 30 Nov 2020 13:11:32 +0000 (UTC) X-Virus-Scanned: amavisd-new at sbone.de Received: from mail.sbone.de ([IPv6:fde9:577b:c1a9:31::2013:587]) by content-filter.sbone.de (content-filter.sbone.de [fde9:577b:c1a9:31::2013:2742]) (amavisd-new, port 10024) with ESMTP id IU_qJI3wedLk; Mon, 30 Nov 2020 13:11:30 +0000 (UTC) Received: from [127.0.0.1] (unknown [IPv6:fde9:577b:c1a9:4902:59d5:6d49:9c08:9559]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPSA id 53A06E707AD; Mon, 30 Nov 2020 13:11:30 +0000 (UTC) From: "Bjoern A. Zeeb" To: "Matt Macy" Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r368163 - in head: sbin/ifconfig sys/dev/if_wg sys/dev/if_wg/include sys/dev/if_wg/include/crypto sys/dev/if_wg/include/sys sys/dev/if_wg/include/zinc sys/dev/if_wg/module sys/dev/if_wg... Date: Mon, 30 Nov 2020 13:11:29 +0000 X-Mailer: MailMate (2.0BETAr6151) Message-ID: <303609C9-75FC-490F-8ED8-4FC79182E0C8@lists.zabbadoz.net> In-Reply-To: <202011291938.0ATJc4Z3081193@repo.freebsd.org> References: <202011291938.0ATJc4Z3081193@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4Cl5Gb2TLkz3Mcj X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Nov 2020 13:11:35 -0000 On 29 Nov 2020, at 19:38, Matt Macy wrote: Hi, > Author: mmacy > Date: Sun Nov 29 19:38:03 2020 > New Revision: 368163 > URL: https://svnweb.freebsd.org/changeset/base/368163 > > Log: > Import kernel WireGuard support > > Data path largely shared with the OpenBSD implementation by > Matt Dunwoodie > > MFC after: 1 month > > Added: probably an oversight as all the other files seem at least dual-licensed. This one is GPL-2.0 only: /* SPDX-License-Identifier: GPL-2.0 */ > head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20-unrolled-arm.S > (contents, props changed) Seems we don’t actually use most of these non-amd64 files (currently). Can we remove at least this one please to avoid accidentally compiling it in in the future (and then not MFC it please)? Thanks, Bjoern From owner-svn-src-head@freebsd.org Mon Nov 30 13:44:55 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4011047CDFB; Mon, 30 Nov 2020 13:44:55 +0000 (UTC) (envelope-from bzeeb-lists@lists.zabbadoz.net) Received: from mx1.sbone.de (cross.sbone.de [195.201.62.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mx1.sbone.de", Issuer "SBone.DE" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Cl6130f2Rz3Q6L; Mon, 30 Nov 2020 13:44:54 +0000 (UTC) (envelope-from bzeeb-lists@lists.zabbadoz.net) Received: from mail.sbone.de (mail.sbone.de [IPv6:fde9:577b:c1a9:31::2013:587]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.sbone.de (Postfix) with ESMTPS id C20618D4A222; Mon, 30 Nov 2020 13:44:46 +0000 (UTC) Received: from content-filter.sbone.de (content-filter.sbone.de [IPv6:fde9:577b:c1a9:31::2013:2742]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPS id 311ACE707C6; Mon, 30 Nov 2020 13:44:46 +0000 (UTC) X-Virus-Scanned: amavisd-new at sbone.de Received: from mail.sbone.de ([IPv6:fde9:577b:c1a9:31::2013:587]) by content-filter.sbone.de (content-filter.sbone.de [fde9:577b:c1a9:31::2013:2742]) (amavisd-new, port 10024) with ESMTP id 6FwmQig7xNxM; Mon, 30 Nov 2020 13:44:42 +0000 (UTC) Received: from [127.0.0.1] (unknown [IPv6:fde9:577b:c1a9:4902:59d5:6d49:9c08:9559]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPSA id 8C022E707AD; Mon, 30 Nov 2020 13:44:42 +0000 (UTC) From: "Bjoern A. Zeeb" To: "Emmanuel Vadot" Cc: "Matt Macy" , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r368163 - in head: sbin/ifconfig sys/dev/if_wg sys/dev/if_wg/include sys/dev/if_wg/include/crypto sys/dev/if_wg/include/sys sys/dev/if_wg/include/zinc sys/dev/if_wg/module sys/dev/if_wg... Date: Mon, 30 Nov 2020 13:44:41 +0000 X-Mailer: MailMate (2.0BETAr6151) Message-ID: <01F4B070-2CBE-4662-ACDC-20F5E87B751A@lists.zabbadoz.net> In-Reply-To: <20201130102758.c600f147a801933bb66529c7@bidouilliste.com> References: <202011291938.0ATJc4Z3081193@repo.freebsd.org> <20201130102758.c600f147a801933bb66529c7@bidouilliste.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4Cl6130f2Rz3Q6L X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Nov 2020 13:44:55 -0000 On 30 Nov 2020, at 9:27, Emmanuel Vadot wrote: > On Mon, 30 Nov 2020 01:13:12 +0000 > "Bjoern A. Zeeb" wrote: > >> On 29 Nov 2020, at 19:38, Matt Macy wrote: >> >>> Author: mmacy >>> Date: Sun Nov 29 19:38:03 2020 >>> New Revision: 368163 >>> URL: https://svnweb.freebsd.org/changeset/base/368163 >>> >>> Log: >>> Import kernel WireGuard support >>> >>> Data path largely shared with the OpenBSD implementation by >>> Matt Dunwoodie >>> >>> Reviewed by: grehan@freebsd.org >>> MFC after: 1 month >>> Sponsored by: Rubicon LLC, (Netgate) >>> Differential Revision: https://reviews.freebsd.org/D26137 >>> >>> Added: >>> head/sbin/ifconfig/ifwg.c (contents, props changed) >>> head/sys/dev/if_wg/ >>> head/sys/dev/if_wg/include/ >>> head/sys/dev/if_wg/include/crypto/blake2s.h (contents, props >>> changed) >>> head/sys/dev/if_wg/include/crypto/curve25519.h (contents, props >>> changed) >>> head/sys/dev/if_wg/include/crypto/zinc.h (contents, props >>> changed) >>> head/sys/dev/if_wg/include/sys/ >>> head/sys/dev/if_wg/include/sys/if_wg_session.h (contents, props >>> changed) >>> head/sys/dev/if_wg/include/sys/if_wg_session_vars.h (contents, >>> props changed) >>> head/sys/dev/if_wg/include/sys/simd-x86_64.h (contents, props >>> changed) >>> head/sys/dev/if_wg/include/sys/support.h (contents, props >>> changed) >>> head/sys/dev/if_wg/include/sys/wg_cookie.h (contents, props >>> changed) >>> head/sys/dev/if_wg/include/sys/wg_module.h (contents, props >>> changed) >>> head/sys/dev/if_wg/include/sys/wg_noise.h (contents, props >>> changed) >>> head/sys/dev/if_wg/include/zinc/blake2s.h (contents, props >>> changed) >>> head/sys/dev/if_wg/include/zinc/chacha20.h (contents, props >>> changed) >>> head/sys/dev/if_wg/include/zinc/chacha20poly1305.h (contents, >>> props changed) >>> head/sys/dev/if_wg/include/zinc/curve25519.h (contents, props >>> changed) >>> head/sys/dev/if_wg/include/zinc/poly1305.h (contents, props >>> changed) >>> head/sys/dev/if_wg/module/ >>> head/sys/dev/if_wg/module/blake2s.c (contents, props changed) >>> head/sys/dev/if_wg/module/blake2s.h (contents, props changed) >>> head/sys/dev/if_wg/module/chacha20-x86_64.S (contents, props >>> changed) >>> head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20-arm-glue.c >>> (contents, props changed) >>> head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20-arm.pl >>> (contents, props changed) >>> head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20-arm64.pl >>> (contents, props changed) >>> head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20-mips-glue.c >>> (contents, props changed) >>> head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20-mips.S >>> (contents, props changed) >>> head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20-unrolled-arm.S >>> (contents, props changed) >>> head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20-x86_64-glue.c >>> (contents, props changed) >>> head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20-x86_64.pl >>> (contents, props changed) >>> head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20.c >>> (contents, props changed) >>> head/sys/dev/if_wg/module/crypto/zinc/chacha20poly1305.c >>> (contents, props changed) >>> head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-arm-glue.c >>> (contents, props changed) >>> head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-arm.pl >>> (contents, props changed) >>> head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-arm64.pl >>> (contents, props changed) >>> head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-donna32.c >>> (contents, props changed) >>> head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-donna64.c >>> (contents, props changed) >>> head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-mips-glue.c >>> (contents, props changed) >>> head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-mips.S >>> (contents, props changed) >>> head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-mips64.pl >>> (contents, props changed) >>> head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-x86_64-glue.c >>> (contents, props changed) >>> head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-x86_64.pl >>> (contents, props changed) >>> head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305.c >>> (contents, props changed) >>> head/sys/dev/if_wg/module/crypto/zinc/selftest/blake2s.c >>> (contents, props changed) >>> head/sys/dev/if_wg/module/crypto/zinc/selftest/chacha20.c >>> (contents, props changed) >>> head/sys/dev/if_wg/module/crypto/zinc/selftest/chacha20poly1305.c >>> (contents, props changed) >>> head/sys/dev/if_wg/module/crypto/zinc/selftest/curve25519.c >>> (contents, props changed) >>> head/sys/dev/if_wg/module/crypto/zinc/selftest/poly1305.c >>> (contents, props changed) >>> head/sys/dev/if_wg/module/crypto/zinc/selftest/run.h (contents, >>> props changed) >>> head/sys/dev/if_wg/module/curve25519.c (contents, props changed) >>> head/sys/dev/if_wg/module/if_wg_session.c (contents, props >>> changed) >>> head/sys/dev/if_wg/module/module.c (contents, props changed) >>> head/sys/dev/if_wg/module/poly1305-x86_64.S (contents, props >>> changed) >>> head/sys/dev/if_wg/module/wg_cookie.c (contents, props changed) >>> head/sys/dev/if_wg/module/wg_noise.c (contents, props changed) >>> head/sys/modules/if_wg/ >>> head/sys/modules/if_wg/Makefile (contents, props changed) >>> Directory Properties: >>> head/sys/dev/if_wg/include/crypto/ (props changed) >>> head/sys/dev/if_wg/include/zinc/ (props changed) >>> head/sys/dev/if_wg/module/crypto/ (props changed) >>> head/sys/dev/if_wg/module/crypto/zinc/ (props changed) >>> head/sys/dev/if_wg/module/crypto/zinc/chacha20/ (props changed) >>> head/sys/dev/if_wg/module/crypto/zinc/poly1305/ (props changed) >>> head/sys/dev/if_wg/module/crypto/zinc/selftest/ (props changed) >> >> >> Looking at sys/dev/if_wg/include/sys/support.h I wonder why zinc was >> not >> done as linuxkpi code? Could it be? >> >> >> /bz > > Adding a dependancy on linuxkpi for just a few compat funcs looks > overkill, also having it done that way means that mallocs are typed > with M_WG instead of the global M_LINUXKPI so it's better to track > leaks, if any. I am sorry, but I am getting tired of hearing this same sentence all over: (a) for a lot of simple defines including the header files is purely enough and doesn’t need the module dependency. You are not redefining uint32_t in every single driver either but include sys/types.h (same goes for byte swapping functions, likely(), ..) and the same does go for the linuxkpi header files. That avoids having re-typed, re-defined definitions of these things n+1 times in kernel. (b) the alloc compat #defines in support.h are used in two of the crypto compat code bits for function local buffers, which are freed before the only return. Tracking those is hopefully not a problem. (c) There are bits in this change which linuxkpi does not have yet, so we’ll implement them a 2nd time in the kernel again one day and linuxkpi is all about not doing exactly that. zinc is a Linux KPI and the majority of files in this commit and the 2nd half of my question was if it could be move into linuxkpi (unless we’ll take it natively as part of our crypto KPI, which was put on the table by others already from my understanding). /bz From owner-svn-src-head@freebsd.org Mon Nov 30 14:21:47 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 53C8B47DAE9; Mon, 30 Nov 2020 14:21:47 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [88.99.82.50]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4Cl6qb0h0Cz3hXT; Mon, 30 Nov 2020 14:21:46 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2020.home.selasky.org (unknown [178.17.145.105]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id B484626011F; Mon, 30 Nov 2020 15:21:44 +0100 (CET) Subject: Re: svn commit: r368163 - in head: sbin/ifconfig sys/dev/if_wg sys/dev/if_wg/include sys/dev/if_wg/include/crypto sys/dev/if_wg/include/sys sys/dev/if_wg/include/zinc sys/dev/if_wg/module sys/dev/if_wg... To: "Bjoern A. Zeeb" , Emmanuel Vadot Cc: Matt Macy , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <202011291938.0ATJc4Z3081193@repo.freebsd.org> <20201130102758.c600f147a801933bb66529c7@bidouilliste.com> <01F4B070-2CBE-4662-ACDC-20F5E87B751A@lists.zabbadoz.net> From: Hans Petter Selasky Message-ID: Date: Mon, 30 Nov 2020 15:21:34 +0100 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:78.0) Gecko/20100101 Thunderbird/78.5.0 MIME-Version: 1.0 In-Reply-To: <01F4B070-2CBE-4662-ACDC-20F5E87B751A@lists.zabbadoz.net> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4Cl6qb0h0Cz3hXT X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Nov 2020 14:21:47 -0000 On 11/30/20 2:44 PM, Bjoern A. Zeeb wrote: > On 30 Nov 2020, at 9:27, Emmanuel Vadot wrote: > >> On Mon, 30 Nov 2020 01:13:12 +0000 >> "Bjoern A. Zeeb" wrote: >> >>> On 29 Nov 2020, at 19:38, Matt Macy wrote: >>> >>>> Author: mmacy >>>> Date: Sun Nov 29 19:38:03 2020 >>>> New Revision: 368163 >>>> URL: https://svnweb.freebsd.org/changeset/base/368163 >>>> >>>> Log: >>>>   Import kernel WireGuard support >>>> >>>>   Data path largely shared with the OpenBSD implementation by >>>>   Matt Dunwoodie >>>> >>>>   Reviewed by:    grehan@freebsd.org >>>>   MFC after:    1 month >>>>   Sponsored by:    Rubicon LLC, (Netgate) >>>>   Differential Revision:    https://reviews.freebsd.org/D26137 >>>> >>>> Added: >>>>   head/sbin/ifconfig/ifwg.c   (contents, props changed) >>>>   head/sys/dev/if_wg/ >>>>   head/sys/dev/if_wg/include/ >>>>   head/sys/dev/if_wg/include/crypto/blake2s.h   (contents, props >>>> changed) >>>>   head/sys/dev/if_wg/include/crypto/curve25519.h   (contents, props >>>> changed) >>>>   head/sys/dev/if_wg/include/crypto/zinc.h   (contents, props changed) >>>>   head/sys/dev/if_wg/include/sys/ >>>>   head/sys/dev/if_wg/include/sys/if_wg_session.h   (contents, props >>>> changed) >>>>   head/sys/dev/if_wg/include/sys/if_wg_session_vars.h   (contents, >>>> props changed) >>>>   head/sys/dev/if_wg/include/sys/simd-x86_64.h   (contents, props >>>> changed) >>>>   head/sys/dev/if_wg/include/sys/support.h   (contents, props changed) >>>>   head/sys/dev/if_wg/include/sys/wg_cookie.h   (contents, props >>>> changed) >>>>   head/sys/dev/if_wg/include/sys/wg_module.h   (contents, props >>>> changed) >>>>   head/sys/dev/if_wg/include/sys/wg_noise.h   (contents, props >>>> changed) >>>>   head/sys/dev/if_wg/include/zinc/blake2s.h   (contents, props >>>> changed) >>>>   head/sys/dev/if_wg/include/zinc/chacha20.h   (contents, props >>>> changed) >>>>   head/sys/dev/if_wg/include/zinc/chacha20poly1305.h   (contents, >>>> props changed) >>>>   head/sys/dev/if_wg/include/zinc/curve25519.h   (contents, props >>>> changed) >>>>   head/sys/dev/if_wg/include/zinc/poly1305.h   (contents, props >>>> changed) >>>>   head/sys/dev/if_wg/module/ >>>>   head/sys/dev/if_wg/module/blake2s.c   (contents, props changed) >>>>   head/sys/dev/if_wg/module/blake2s.h   (contents, props changed) >>>>   head/sys/dev/if_wg/module/chacha20-x86_64.S   (contents, props >>>> changed) >>>>   head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20-arm-glue.c >>>> (contents, props changed) >>>>   head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20-arm.pl >>>> (contents, props changed) >>>>   head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20-arm64.pl >>>> (contents, props changed) >>>>   head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20-mips-glue.c >>>>  (contents, props changed) >>>>   head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20-mips.S >>>> (contents, props changed) >>>> >>>> head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20-unrolled-arm.S >>>>   (contents, props changed) >>>>   head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20-x86_64-glue.c >>>>   (contents, props changed) >>>>   head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20-x86_64.pl >>>> (contents, props changed) >>>>   head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20.c >>>> (contents, props changed) >>>>   head/sys/dev/if_wg/module/crypto/zinc/chacha20poly1305.c >>>> (contents, props changed) >>>>   head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-arm-glue.c >>>> (contents, props changed) >>>>   head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-arm.pl >>>> (contents, props changed) >>>>   head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-arm64.pl >>>> (contents, props changed) >>>>   head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-donna32.c >>>> (contents, props changed) >>>>   head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-donna64.c >>>> (contents, props changed) >>>>   head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-mips-glue.c >>>>  (contents, props changed) >>>>   head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-mips.S >>>> (contents, props changed) >>>>   head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-mips64.pl >>>> (contents, props changed) >>>>   head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-x86_64-glue.c >>>>   (contents, props changed) >>>>   head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-x86_64.pl >>>> (contents, props changed) >>>>   head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305.c >>>> (contents, props changed) >>>>   head/sys/dev/if_wg/module/crypto/zinc/selftest/blake2s.c >>>> (contents, props changed) >>>>   head/sys/dev/if_wg/module/crypto/zinc/selftest/chacha20.c >>>> (contents, props changed) >>>>   head/sys/dev/if_wg/module/crypto/zinc/selftest/chacha20poly1305.c >>>> (contents, props changed) >>>>   head/sys/dev/if_wg/module/crypto/zinc/selftest/curve25519.c >>>> (contents, props changed) >>>>   head/sys/dev/if_wg/module/crypto/zinc/selftest/poly1305.c >>>> (contents, props changed) >>>>   head/sys/dev/if_wg/module/crypto/zinc/selftest/run.h   (contents, >>>> props changed) >>>>   head/sys/dev/if_wg/module/curve25519.c   (contents, props changed) >>>>   head/sys/dev/if_wg/module/if_wg_session.c   (contents, props >>>> changed) >>>>   head/sys/dev/if_wg/module/module.c   (contents, props changed) >>>>   head/sys/dev/if_wg/module/poly1305-x86_64.S   (contents, props >>>> changed) >>>>   head/sys/dev/if_wg/module/wg_cookie.c   (contents, props changed) >>>>   head/sys/dev/if_wg/module/wg_noise.c   (contents, props changed) >>>>   head/sys/modules/if_wg/ >>>>   head/sys/modules/if_wg/Makefile   (contents, props changed) >>>> Directory Properties: >>>>   head/sys/dev/if_wg/include/crypto/   (props changed) >>>>   head/sys/dev/if_wg/include/zinc/   (props changed) >>>>   head/sys/dev/if_wg/module/crypto/   (props changed) >>>>   head/sys/dev/if_wg/module/crypto/zinc/   (props changed) >>>>   head/sys/dev/if_wg/module/crypto/zinc/chacha20/   (props changed) >>>>   head/sys/dev/if_wg/module/crypto/zinc/poly1305/   (props changed) >>>>   head/sys/dev/if_wg/module/crypto/zinc/selftest/   (props changed) >>> >>> >>> Looking at sys/dev/if_wg/include/sys/support.h I wonder why zinc was not >>> done as linuxkpi code?  Could it be? >>> >>> >>> /bz >> >>  Adding a dependancy on linuxkpi for just a few compat funcs looks >> overkill, also having it done that way means that mallocs are typed >> with M_WG instead of the global M_LINUXKPI so it's better to track >> leaks, if any. > > I am sorry, but I am getting tired of hearing this same sentence all over: > > (a) for a lot of simple defines including the header files is purely enough >     and doesn’t need the module dependency.   You are not redefining > uint32_t >     in every single driver either but include sys/types.h (same goes > for byte >     swapping functions, likely(), ..) and the same does go for the > linuxkpi >     header files. >     That avoids having re-typed, re-defined definitions of these things >     n+1 times in kernel. > > (b) the alloc compat #defines in support.h are used in two of the crypto >     compat code bits for function local buffers, which are freed before > the >     only return.  Tracking those is hopefully not a problem. > > (c) There are bits in this change which linuxkpi does not have yet, >     so we’ll implement them a 2nd time in the kernel again one day and >     linuxkpi is all about not doing exactly that. > >     zinc is a Linux KPI and the majority of files in this commit and the >     2nd half of my question was if it could be move into linuxkpi (unless >     we’ll take it natively as part of our crypto KPI, which was put on >     the table by others already from my understanding). > Hi, I had a look at support.h and have the following additional suggestions: https://svnweb.freebsd.org/base/head/sys/dev/if_wg/include/sys/support.h?view=markup&pathrev=368163 > #define rw_enter_write rw_wlock > 67 #define rw_exit_write rw_wunlock > 68 #define rw_enter_read rw_rlock > 69 #define rw_exit_read rw_runlock > 70 #define rw_exit rw_unlock Please use function macros for functions! > 337 #define kmalloc(size, flag) malloc((size), M_WG, M_WAITOK) > 338 #define kfree(p) free(p, M_WG) > 339 #define vzalloc(size) malloc((size), M_WG, M_WAITOK|M_ZERO) > 340 #define vfree(p) free(p, M_WG) Instead of overloading the existing kmalloc() definitions in the LinuxKPI, I suggest you create some uppercased macros like: WG_ALLOC(size, flag) WG_FREE(ptr) WG_ZALLOC(size, flag) WG_ZFREE(ptr) This will reduce the amount of namespace conflicts when using tools like Doxygen. Else I agree with Bjoern. Try to use the LinuxKPI in FreeBSD when possible for code that use Linux compatible APIs. --HPS From owner-svn-src-head@freebsd.org Mon Nov 30 14:48:51 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8D9A647E7B6; Mon, 30 Nov 2020 14:48:51 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Cl7Qq3b3Vz3kWj; Mon, 30 Nov 2020 14:48:51 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 698CB24CFD; Mon, 30 Nov 2020 14:48:51 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AUEmpd4096520; Mon, 30 Nov 2020 14:48:51 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AUEmpnP096519; Mon, 30 Nov 2020 14:48:51 GMT (envelope-from manu@FreeBSD.org) Message-Id: <202011301448.0AUEmpnP096519@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Mon, 30 Nov 2020 14:48:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368185 - head/sys/arm/allwinner X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: head/sys/arm/allwinner X-SVN-Commit-Revision: 368185 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Nov 2020 14:48:51 -0000 Author: manu Date: Mon Nov 30 14:48:50 2020 New Revision: 368185 URL: https://svnweb.freebsd.org/changeset/base/368185 Log: arm: allwinner: aw_mmc: Add a sysctl for debuging Add a new hw.aw_mmc.debug sysctl to help debugging the driver. Bit 0 will debug card changes (removal, insertion, power up/down) Bit 1 will debug ios changes Bit 2 will debug interrupts received Bit 3 will debug commands sent Modified: head/sys/arm/allwinner/aw_mmc.c Modified: head/sys/arm/allwinner/aw_mmc.c ============================================================================== --- head/sys/arm/allwinner/aw_mmc.c Mon Nov 30 11:45:47 2020 (r368184) +++ head/sys/arm/allwinner/aw_mmc.c Mon Nov 30 14:48:50 2020 (r368185) @@ -191,6 +191,17 @@ static void aw_mmc_cam_handle_mmcio(struct cam_sim *, #define AW_MMC_WRITE_4(_sc, _reg, _value) \ bus_write_4((_sc)->aw_res[AW_MMC_MEMRES], _reg, _value) +SYSCTL_NODE(_hw, OID_AUTO, aw_mmc, CTLFLAG_RD | CTLFLAG_MPSAFE, 0, + "aw_mmc driver"); + +static int aw_mmc_debug = 0; +SYSCTL_INT(_hw_aw_mmc, OID_AUTO, debug, CTLFLAG_RWTUN, &aw_mmc_debug, 0, + "Debug level bit0=card changes bit1=ios changes, bit2=interrupts, bit3=commands"); +#define AW_MMC_DEBUG_CARD 0x1 +#define AW_MMC_DEBUG_IOS 0x2 +#define AW_MMC_DEBUG_INT 0x4 +#define AW_MMC_DEBUG_CMD 0x8 + #ifdef MMCCAM static void aw_mmc_cam_handle_mmcio(struct cam_sim *sim, union ccb *ccb) @@ -227,7 +238,7 @@ aw_mmc_cam_action(struct cam_sim *sim, union ccb *ccb) { struct ccb_trans_settings *cts = &ccb->cts; - if (bootverbose) + if (__predict_false(aw_mmc_debug & AW_MMC_DEBUG_IOS)) device_printf(sc->aw_dev, "Got XPT_GET_TRAN_SETTINGS\n"); cts->protocol = PROTO_MMCSD; @@ -247,14 +258,14 @@ aw_mmc_cam_action(struct cam_sim *sim, union ccb *ccb) } case XPT_SET_TRAN_SETTINGS: { - if (bootverbose) + if (__predict_false(aw_mmc_debug & AW_MMC_DEBUG_IOS)) device_printf(sc->aw_dev, "Got XPT_SET_TRAN_SETTINGS\n"); aw_mmc_cam_settran_settings(sc, ccb); ccb->ccb_h.status = CAM_REQ_CMP; break; } case XPT_RESET_BUS: - if (bootverbose) + if (__predict_false(aw_mmc_debug & AW_MMC_DEBUG_IOS)) device_printf(sc->aw_dev, "Got XPT_RESET_BUS, ACK it...\n"); ccb->ccb_h.status = CAM_REQ_CMP; break; @@ -300,37 +311,37 @@ aw_mmc_cam_settran_settings(struct aw_mmc_softc *sc, u /* Update only requested fields */ if (cts->ios_valid & MMC_CLK) { ios->clock = new_ios->clock; - if (bootverbose) + if (__predict_false(aw_mmc_debug & AW_MMC_DEBUG_IOS)) device_printf(sc->aw_dev, "Clock => %d\n", ios->clock); } if (cts->ios_valid & MMC_VDD) { ios->vdd = new_ios->vdd; - if (bootverbose) + if (__predict_false(aw_mmc_debug & AW_MMC_DEBUG_IOS)) device_printf(sc->aw_dev, "VDD => %d\n", ios->vdd); } if (cts->ios_valid & MMC_CS) { ios->chip_select = new_ios->chip_select; - if (bootverbose) + if (__predict_false(aw_mmc_debug & AW_MMC_DEBUG_IOS)) device_printf(sc->aw_dev, "CS => %d\n", ios->chip_select); } if (cts->ios_valid & MMC_BW) { ios->bus_width = new_ios->bus_width; - if (bootverbose) + if (__predict_false(aw_mmc_debug & AW_MMC_DEBUG_IOS)) device_printf(sc->aw_dev, "Bus width => %d\n", ios->bus_width); } if (cts->ios_valid & MMC_PM) { ios->power_mode = new_ios->power_mode; - if (bootverbose) + if (__predict_false(aw_mmc_debug & AW_MMC_DEBUG_IOS)) device_printf(sc->aw_dev, "Power mode => %d\n", ios->power_mode); } if (cts->ios_valid & MMC_BT) { ios->timing = new_ios->timing; - if (bootverbose) + if (__predict_false(aw_mmc_debug & AW_MMC_DEBUG_IOS)) device_printf(sc->aw_dev, "Timing => %d\n", ios->timing); } if (cts->ios_valid & MMC_BM) { ios->bus_mode = new_ios->bus_mode; - if (bootverbose) + if (__predict_false(aw_mmc_debug & AW_MMC_DEBUG_IOS)) device_printf(sc->aw_dev, "Bus mode => %d\n", ios->bus_mode); } @@ -346,14 +357,12 @@ aw_mmc_cam_request(struct aw_mmc_softc *sc, union ccb AW_MMC_LOCK(sc); -#ifdef DEBUG - if (__predict_false(bootverbose)) { + if (__predict_false(aw_mmc_debug & AW_MMC_DEBUG_CMD)) { device_printf(sc->aw_dev, "CMD%u arg %#x flags %#x dlen %u dflags %#x\n", mmcio->cmd.opcode, mmcio->cmd.arg, mmcio->cmd.flags, mmcio->cmd.data != NULL ? (unsigned int) mmcio->cmd.data->len : 0, mmcio->cmd.data != NULL ? mmcio->cmd.data->flags: 0); } -#endif if (mmcio->cmd.data != NULL) { if (mmcio->cmd.data->len == 0 || mmcio->cmd.data->flags == 0) panic("data->len = %d, data->flags = %d -- something is b0rked", @@ -384,7 +393,7 @@ aw_mmc_helper_cd_handler(device_t dev, bool present) AW_MMC_LOCK(sc); if (present) { if (sc->child == NULL) { - if (bootverbose) + if (__predict_false(aw_mmc_debug & AW_MMC_DEBUG_CARD)) device_printf(sc->aw_dev, "Card inserted\n"); sc->child = device_add_child(sc->aw_dev, "mmc", -1); @@ -398,7 +407,7 @@ aw_mmc_helper_cd_handler(device_t dev, bool present) } else { /* Card isn't present, detach if necessary */ if (sc->child != NULL) { - if (bootverbose) + if (__predict_false(aw_mmc_debug & AW_MMC_DEBUG_CARD)) device_printf(sc->aw_dev, "Card removed\n"); AW_MMC_UNLOCK(sc); @@ -871,11 +880,9 @@ aw_mmc_req_done(struct aw_mmc_softc *sc) #else cmd = sc->aw_req->cmd; #endif -#ifdef DEBUG - if (bootverbose) { + if (__predict_false(aw_mmc_debug & AW_MMC_DEBUG_CMD)) { device_printf(sc->aw_dev, "%s: cmd %d err %d\n", __func__, cmd->opcode, cmd->error); } -#endif if (cmd->error != MMC_ERR_NONE) { /* Reset the FIFO and DMA engines. */ mask = AW_MMC_GCTL_FIFO_RST | AW_MMC_GCTL_DMA_RST; @@ -1019,10 +1026,10 @@ aw_mmc_intr(void *arg) AW_MMC_UNLOCK(sc); return; } -#ifdef DEBUG - device_printf(sc->aw_dev, "idst: %#x, imask: %#x, rint: %#x\n", - idst, imask, rint); -#endif + if (__predict_false(aw_mmc_debug & AW_MMC_DEBUG_INT)) { + device_printf(sc->aw_dev, "idst: %#x, imask: %#x, rint: %#x\n", + idst, imask, rint); + } #ifdef MMCCAM if (sc->ccb == NULL) { #else @@ -1035,9 +1042,10 @@ aw_mmc_intr(void *arg) goto end; } if (rint & AW_MMC_INT_ERR_BIT) { - if (bootverbose) + if (__predict_false(aw_mmc_debug & AW_MMC_DEBUG_INT)) { device_printf(sc->aw_dev, "error rint: 0x%08X\n", rint); - aw_mmc_print_error(rint); + aw_mmc_print_error(rint); + } if (rint & AW_MMC_INT_RESP_TIMEOUT) set_mmc_error(sc, MMC_ERR_TIMEOUT); else @@ -1046,7 +1054,8 @@ aw_mmc_intr(void *arg) goto end; } if (idst & AW_MMC_IDST_ERROR) { - device_printf(sc->aw_dev, "error idst: 0x%08x\n", idst); + if (__predict_false(aw_mmc_debug & AW_MMC_DEBUG_INT)) + device_printf(sc->aw_dev, "error idst: 0x%08x\n", idst); set_mmc_error(sc, MMC_ERR_FAILED); aw_mmc_req_done(sc); goto end; @@ -1106,14 +1115,13 @@ aw_mmc_request(device_t bus, device_t child, struct mm sc->aw_req = req; cmd = req->cmd; -#ifdef DEBUG - if (bootverbose) + if (__predict_false(aw_mmc_debug & AW_MMC_DEBUG_CMD)) { device_printf(sc->aw_dev, "CMD%u arg %#x flags %#x dlen %u dflags %#x\n", cmd->opcode, cmd->arg, cmd->flags, cmd->data != NULL ? (unsigned int)cmd->data->len : 0, cmd->data != NULL ? cmd->data->flags: 0); + } #endif -#endif cmdreg = AW_MMC_CMDR_LOAD; imask = AW_MMC_INT_ERR_BIT; sc->aw_intr_wait = 0; @@ -1413,7 +1421,7 @@ aw_mmc_update_ios(device_t bus, device_t child) case power_on: break; case power_off: - if (bootverbose) + if (__predict_false(aw_mmc_debug & AW_MMC_DEBUG_CARD)) device_printf(sc->aw_dev, "Powering down sd/mmc\n"); if (sc->mmc_helper.vmmc_supply) @@ -1424,7 +1432,7 @@ aw_mmc_update_ios(device_t bus, device_t child) aw_mmc_reset(sc); break; case power_up: - if (bootverbose) + if (__predict_false(aw_mmc_debug & AW_MMC_DEBUG_CARD)) device_printf(sc->aw_dev, "Powering up sd/mmc\n"); if (sc->mmc_helper.vmmc_supply) From owner-svn-src-head@freebsd.org Mon Nov 30 14:49:13 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A834047E824; Mon, 30 Nov 2020 14:49:13 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Cl7RF4Rf3z3kMD; Mon, 30 Nov 2020 14:49:13 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8B87824FB2; Mon, 30 Nov 2020 14:49:13 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AUEnDEr096584; Mon, 30 Nov 2020 14:49:13 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AUEnD4x096583; Mon, 30 Nov 2020 14:49:13 GMT (envelope-from manu@FreeBSD.org) Message-Id: <202011301449.0AUEnD4x096583@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Mon, 30 Nov 2020 14:49:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368186 - head/sys/cam/mmc X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: head/sys/cam/mmc X-SVN-Commit-Revision: 368186 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Nov 2020 14:49:13 -0000 Author: manu Date: Mon Nov 30 14:49:13 2020 New Revision: 368186 URL: https://svnweb.freebsd.org/changeset/base/368186 Log: mmccam: Convert some printf to CAM_DEBUG This not not useful if you are not debuging mmccam Modified: head/sys/cam/mmc/mmc_xpt.c Modified: head/sys/cam/mmc/mmc_xpt.c ============================================================================== --- head/sys/cam/mmc/mmc_xpt.c Mon Nov 30 14:48:50 2020 (r368185) +++ head/sys/cam/mmc/mmc_xpt.c Mon Nov 30 14:49:13 2020 (r368186) @@ -263,8 +263,8 @@ mmc_scan_lun(struct cam_periph *periph, struct cam_pat xpt_done(request_ccb); } } else { - if (bootverbose) - xpt_print(path, " Set up the mmcprobe device...\n"); + CAM_DEBUG(path, CAM_DEBUG_INFO, + (" Set up the mmcprobe device...\n")); status = cam_periph_alloc(mmcprobe_register, NULL, mmcprobe_cleanup, @@ -382,7 +382,8 @@ mmc_announce_periph(struct cam_periph *periph) if ((cts.ccb_h.status & CAM_STATUS_MASK) != CAM_REQ_CMP) return; xpt_path_inq(&cpi, periph->path); - printf("XPT info: CLK %04X, ...\n", cts.proto_specific.mmc.ios.clock); + CAM_DEBUG(path, CAM_DEBUG_INFO, + ("XPT info: CLK %04d, ...\n", cts.proto_specific.mmc.ios.clock)); } void From owner-svn-src-head@freebsd.org Mon Nov 30 14:51:49 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4948547E778; Mon, 30 Nov 2020 14:51:49 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Cl7VF1g3mz3kq9; Mon, 30 Nov 2020 14:51:49 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2C5052540A; Mon, 30 Nov 2020 14:51:49 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AUEpne5002537; Mon, 30 Nov 2020 14:51:49 GMT (envelope-from mmel@FreeBSD.org) Received: (from mmel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AUEpn9w002536; Mon, 30 Nov 2020 14:51:49 GMT (envelope-from mmel@FreeBSD.org) Message-Id: <202011301451.0AUEpn9w002536@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmel set sender to mmel@FreeBSD.org using -f From: Michal Meloun Date: Mon, 30 Nov 2020 14:51:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368187 - head/sys/dev/nvme X-SVN-Group: head X-SVN-Commit-Author: mmel X-SVN-Commit-Paths: head/sys/dev/nvme X-SVN-Commit-Revision: 368187 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Nov 2020 14:51:49 -0000 Author: mmel Date: Mon Nov 30 14:51:48 2020 New Revision: 368187 URL: https://svnweb.freebsd.org/changeset/base/368187 Log: Unbreak r368167 in userland. Decorate unused arguments. Reported by: kp, tuexen, jenkins, and many others MFC with: r368167 Modified: head/sys/dev/nvme/nvme.h Modified: head/sys/dev/nvme/nvme.h ============================================================================== --- head/sys/dev/nvme/nvme.h Mon Nov 30 14:49:13 2020 (r368186) +++ head/sys/dev/nvme/nvme.h Mon Nov 30 14:51:48 2020 (r368187) @@ -1728,9 +1728,15 @@ extern int nvme_use_nvd; #endif /* _KERNEL */ +#if _BYTE_ORDER != _LITTLE_ENDIAN +#define MODIF +#else +#define MODIF __unused +#endif + /* Endianess conversion functions for NVMe structs */ static inline -void nvme_completion_swapbytes(struct nvme_completion *s) +void nvme_completion_swapbytes(struct nvme_completion *s MODIF) { #if _BYTE_ORDER != _LITTLE_ENDIAN @@ -1744,7 +1750,7 @@ void nvme_completion_swapbytes(struct nvme_completion } static inline -void nvme_power_state_swapbytes(struct nvme_power_state *s) +void nvme_power_state_swapbytes(struct nvme_power_state *s MODIF) { #if _BYTE_ORDER != _LITTLE_ENDIAN @@ -1757,7 +1763,7 @@ void nvme_power_state_swapbytes(struct nvme_power_stat } static inline -void nvme_controller_data_swapbytes(struct nvme_controller_data *s) +void nvme_controller_data_swapbytes(struct nvme_controller_data *s MODIF) { #if _BYTE_ORDER != _LITTLE_ENDIAN int i; @@ -1809,7 +1815,7 @@ void nvme_controller_data_swapbytes(struct nvme_contro } static inline -void nvme_namespace_data_swapbytes(struct nvme_namespace_data *s) +void nvme_namespace_data_swapbytes(struct nvme_namespace_data *s MODIF) { #if _BYTE_ORDER != _LITTLE_ENDIAN int i; @@ -1838,7 +1844,8 @@ void nvme_namespace_data_swapbytes(struct nvme_namespa } static inline -void nvme_error_information_entry_swapbytes(struct nvme_error_information_entry *s) +void nvme_error_information_entry_swapbytes( + struct nvme_error_information_entry *s MODIF) { #if _BYTE_ORDER != _LITTLE_ENDIAN @@ -1855,7 +1862,7 @@ void nvme_error_information_entry_swapbytes(struct nvm } static inline -void nvme_le128toh(void *p) +void nvme_le128toh(void *p MODIF) { #if _BYTE_ORDER != _LITTLE_ENDIAN /* Swap 16 bytes in place */ @@ -1871,7 +1878,8 @@ void nvme_le128toh(void *p) } static inline -void nvme_health_information_page_swapbytes(struct nvme_health_information_page *s) +void nvme_health_information_page_swapbytes( + struct nvme_health_information_page *s MODIF) { #if _BYTE_ORDER != _LITTLE_ENDIAN int i; @@ -1899,7 +1907,7 @@ void nvme_health_information_page_swapbytes(struct nvm } static inline -void nvme_firmware_page_swapbytes(struct nvme_firmware_page *s) +void nvme_firmware_page_swapbytes(struct nvme_firmware_page *s MODIF) { #if _BYTE_ORDER != _LITTLE_ENDIAN int i; @@ -1910,7 +1918,7 @@ void nvme_firmware_page_swapbytes(struct nvme_firmware } static inline -void nvme_ns_list_swapbytes(struct nvme_ns_list *s) +void nvme_ns_list_swapbytes(struct nvme_ns_list *s MODIF) { #if _BYTE_ORDER != _LITTLE_ENDIAN int i; @@ -1921,7 +1929,8 @@ void nvme_ns_list_swapbytes(struct nvme_ns_list *s) } static inline -void nvme_command_effects_page_swapbytes(struct nvme_command_effects_page *s) +void nvme_command_effects_page_swapbytes( + struct nvme_command_effects_page *s MODIF) { #if _BYTE_ORDER != _LITTLE_ENDIAN int i; @@ -1934,7 +1943,8 @@ void nvme_command_effects_page_swapbytes(struct nvme_c } static inline -void nvme_res_notification_page_swapbytes(struct nvme_res_notification_page *s) +void nvme_res_notification_page_swapbytes( + struct nvme_res_notification_page *s MODIF) { #if _BYTE_ORDER != _LITTLE_ENDIAN s->log_page_count = le64toh(s->log_page_count); @@ -1943,7 +1953,8 @@ void nvme_res_notification_page_swapbytes(struct nvme_ } static inline -void nvme_sanitize_status_page_swapbytes(struct nvme_sanitize_status_page *s) +void nvme_sanitize_status_page_swapbytes( + struct nvme_sanitize_status_page *s MODIF) { #if _BYTE_ORDER != _LITTLE_ENDIAN s->sprog = le16toh(s->sprog); @@ -1959,7 +1970,7 @@ void nvme_sanitize_status_page_swapbytes(struct nvme_s } static inline -void intel_log_temp_stats_swapbytes(struct intel_log_temp_stats *s) +void intel_log_temp_stats_swapbytes(struct intel_log_temp_stats *s MODIF) { #if _BYTE_ORDER != _LITTLE_ENDIAN @@ -1976,7 +1987,8 @@ void intel_log_temp_stats_swapbytes(struct intel_log_t } static inline -void nvme_resv_status_swapbytes(struct nvme_resv_status *s, size_t size) +void nvme_resv_status_swapbytes(struct nvme_resv_status *s MODIF, + size_t size MODIF) { #if _BYTE_ORDER != _LITTLE_ENDIAN u_int i, n; @@ -1993,7 +2005,8 @@ void nvme_resv_status_swapbytes(struct nvme_resv_statu } static inline -void nvme_resv_status_ext_swapbytes(struct nvme_resv_status_ext *s, size_t size) +void nvme_resv_status_ext_swapbytes(struct nvme_resv_status_ext *s MODIF, + size_t size MODIF) { #if _BYTE_ORDER != _LITTLE_ENDIAN u_int i, n; @@ -2008,5 +2021,6 @@ void nvme_resv_status_ext_swapbytes(struct nvme_resv_s } #endif } +#undef MODIF #endif /* __NVME_H__ */ From owner-svn-src-head@freebsd.org Mon Nov 30 14:53:34 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D10E347E8F7 for ; Mon, 30 Nov 2020 14:53:34 +0000 (UTC) (envelope-from cglogic@protonmail.com) Received: from mail-40141.protonmail.ch (mail-40141.protonmail.ch [185.70.40.141]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "protonmail.com", Issuer "SwissSign Server Gold CA 2014 - G22" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Cl7XG4QKBz3ktq; Mon, 30 Nov 2020 14:53:34 +0000 (UTC) (envelope-from cglogic@protonmail.com) Date: Mon, 30 Nov 2020 14:53:19 +0000 To: "Bjoern A. Zeeb" From: cglogic Cc: Emmanuel Vadot , Matt Macy , "src-committers@freebsd.org" , "svn-src-all@freebsd.org" , "svn-src-head@freebsd.org" Reply-To: cglogic Subject: Re: svn commit: r368163 - in head: sbin/ifconfig sys/dev/if_wg sys/dev/if_wg/include sys/dev/if_wg/include/crypto sys/dev/if_wg/include/sys sys/dev/if_wg/include/zinc sys/dev/if_wg/module sys/dev/if_wg... Message-ID: <-0GA0tF-2zZxdb99WE9WoUnv9YVf9efjJnMin4IL0bctNp-Bab2Qw2RbUuZTa6y9hP7r0UEUUXGkRSz-OF4k5yR5YmUgU-JJxNWcl48tVSQ=@protonmail.com> In-Reply-To: <01F4B070-2CBE-4662-ACDC-20F5E87B751A@lists.zabbadoz.net> References: <202011291938.0ATJc4Z3081193@repo.freebsd.org> <20201130102758.c600f147a801933bb66529c7@bidouilliste.com> <01F4B070-2CBE-4662-ACDC-20F5E87B751A@lists.zabbadoz.net> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-1.2 required=10.0 tests=ALL_TRUSTED,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM shortcircuit=no autolearn=disabled version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on mailout.protonmail.ch X-Rspamd-Queue-Id: 4Cl7XG4QKBz3ktq X-Spamd-Bar: ---- X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Nov 2020 14:53:34 -0000 On Monday, November 30, 2020 3:44 PM, Bjoern A. Zeeb wrote: > On 30 Nov 2020, at 9:27, Emmanuel Vadot wrote: > > > On Mon, 30 Nov 2020 01:13:12 +0000 > > "Bjoern A. Zeeb" bzeeb-lists@lists.zabbadoz.net wrote: > > > > > On 29 Nov 2020, at 19:38, Matt Macy wrote: > > > > > > > Author: mmacy > > > > Date: Sun Nov 29 19:38:03 2020 > > > > New Revision: 368163 > > > > URL: https://svnweb.freebsd.org/changeset/base/368163 > > > > Log: > > > > Import kernel WireGuard support > > > > Data path largely shared with the OpenBSD implementation by > > > > Matt Dunwoodie ncon@nconroy.net > > > > Reviewed by: grehan@freebsd.org > > > > MFC after: 1 month > > > > Sponsored by: Rubicon LLC, (Netgate) > > > > Differential Revision: https://reviews.freebsd.org/D26137 > > > > Added: > > > > head/sbin/ifconfig/ifwg.c (contents, props changed) > > > > head/sys/dev/if_wg/ > > > > head/sys/dev/if_wg/include/ > > > > head/sys/dev/if_wg/include/crypto/blake2s.h (contents, props > > > > changed) > > > > head/sys/dev/if_wg/include/crypto/curve25519.h (contents, props > > > > changed) > > > > head/sys/dev/if_wg/include/crypto/zinc.h (contents, props > > > > changed) > > > > head/sys/dev/if_wg/include/sys/ > > > > head/sys/dev/if_wg/include/sys/if_wg_session.h (contents, props > > > > changed) > > > > head/sys/dev/if_wg/include/sys/if_wg_session_vars.h (contents, > > > > props changed) > > > > head/sys/dev/if_wg/include/sys/simd-x86_64.h (contents, props > > > > changed) > > > > head/sys/dev/if_wg/include/sys/support.h (contents, props > > > > changed) > > > > head/sys/dev/if_wg/include/sys/wg_cookie.h (contents, props > > > > changed) > > > > head/sys/dev/if_wg/include/sys/wg_module.h (contents, props > > > > changed) > > > > head/sys/dev/if_wg/include/sys/wg_noise.h (contents, props > > > > changed) > > > > head/sys/dev/if_wg/include/zinc/blake2s.h (contents, props > > > > changed) > > > > head/sys/dev/if_wg/include/zinc/chacha20.h (contents, props > > > > changed) > > > > head/sys/dev/if_wg/include/zinc/chacha20poly1305.h (contents, > > > > props changed) > > > > head/sys/dev/if_wg/include/zinc/curve25519.h (contents, props > > > > changed) > > > > head/sys/dev/if_wg/include/zinc/poly1305.h (contents, props > > > > changed) > > > > head/sys/dev/if_wg/module/ > > > > head/sys/dev/if_wg/module/blake2s.c (contents, props changed) > > > > head/sys/dev/if_wg/module/blake2s.h (contents, props changed) > > > > head/sys/dev/if_wg/module/chacha20-x86_64.S (contents, props > > > > changed) > > > > head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20-arm-glue.c > > > > (contents, props changed) > > > > head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20-arm.pl > > > > (contents, props changed) > > > > head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20-arm64.pl > > > > (contents, props changed) > > > > head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20-mips-glue.c > > > > (contents, props changed) > > > > head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20-mips.S > > > > (contents, props changed) > > > > head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20-unrolled-ar= m.S > > > > (contents, props changed) > > > > head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20-x86_64-glue= .c > > > > (contents, props changed) > > > > head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20-x86_64.pl > > > > (contents, props changed) > > > > head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20.c > > > > (contents, props changed) > > > > head/sys/dev/if_wg/module/crypto/zinc/chacha20poly1305.c > > > > (contents, props changed) > > > > head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-arm-glue.c > > > > (contents, props changed) > > > > head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-arm.pl > > > > (contents, props changed) > > > > head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-arm64.pl > > > > (contents, props changed) > > > > head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-donna32.c > > > > (contents, props changed) > > > > head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-donna64.c > > > > (contents, props changed) > > > > head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-mips-glue.c > > > > (contents, props changed) > > > > head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-mips.S > > > > (contents, props changed) > > > > head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-mips64.pl > > > > (contents, props changed) > > > > head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-x86_64-glue= .c > > > > (contents, props changed) > > > > head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-x86_64.pl > > > > (contents, props changed) > > > > head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305.c > > > > (contents, props changed) > > > > head/sys/dev/if_wg/module/crypto/zinc/selftest/blake2s.c > > > > (contents, props changed) > > > > head/sys/dev/if_wg/module/crypto/zinc/selftest/chacha20.c > > > > (contents, props changed) > > > > head/sys/dev/if_wg/module/crypto/zinc/selftest/chacha20poly1305.c > > > > (contents, props changed) > > > > head/sys/dev/if_wg/module/crypto/zinc/selftest/curve25519.c > > > > (contents, props changed) > > > > head/sys/dev/if_wg/module/crypto/zinc/selftest/poly1305.c > > > > (contents, props changed) > > > > head/sys/dev/if_wg/module/crypto/zinc/selftest/run.h (contents, > > > > props changed) > > > > head/sys/dev/if_wg/module/curve25519.c (contents, props changed) > > > > head/sys/dev/if_wg/module/if_wg_session.c (contents, props > > > > changed) > > > > head/sys/dev/if_wg/module/module.c (contents, props changed) > > > > head/sys/dev/if_wg/module/poly1305-x86_64.S (contents, props > > > > changed) > > > > head/sys/dev/if_wg/module/wg_cookie.c (contents, props changed) > > > > head/sys/dev/if_wg/module/wg_noise.c (contents, props changed) > > > > head/sys/modules/if_wg/ > > > > head/sys/modules/if_wg/Makefile (contents, props changed) > > > > Directory Properties: > > > > head/sys/dev/if_wg/include/crypto/ (props changed) > > > > head/sys/dev/if_wg/include/zinc/ (props changed) > > > > head/sys/dev/if_wg/module/crypto/ (props changed) > > > > head/sys/dev/if_wg/module/crypto/zinc/ (props changed) > > > > head/sys/dev/if_wg/module/crypto/zinc/chacha20/ (props changed) > > > > head/sys/dev/if_wg/module/crypto/zinc/poly1305/ (props changed) > > > > head/sys/dev/if_wg/module/crypto/zinc/selftest/ (props changed) > > > > > > Looking at sys/dev/if_wg/include/sys/support.h I wonder why zinc was > > > not > > > done as linuxkpi code? Could it be? > > > /bz > > > > Adding a dependancy on linuxkpi for just a few compat funcs looks > > overkill, also having it done that way means that mallocs are typed > > with M_WG instead of the global M_LINUXKPI so it's better to track > > leaks, if any. > > I am sorry, but I am getting tired of hearing this same sentence all > over: > > (a) for a lot of simple defines including the header files is purely > enough > and doesn=E2=80=99t need the module dependency. You are not redefining > uint32_t > in every single driver either but include sys/types.h (same goes > for byte > swapping functions, likely(), ..) and the same does go for the > linuxkpi > header files. > That avoids having re-typed, re-defined definitions of these things > n+1 times in kernel. > > (b) the alloc compat #defines in support.h are used in two of the crypto > compat code bits for function local buffers, which are freed before > the > only return. Tracking those is hopefully not a problem. > > (c) There are bits in this change which linuxkpi does not have yet, > so we=E2=80=99ll implement them a 2nd time in the kernel again one day > and > linuxkpi is all about not doing exactly that. > > zinc is a Linux KPI and the majority of files in this commit and > the > 2nd half of my question was if it could be move into linuxkpi > (unless > we=E2=80=99ll take it natively as part of our crypto KPI, which was put > on > the table by others already from my understanding). > > /bz So you propose to make it dependent on linuxkpi? What have to do a user who= does not compile linuxkpi, but wants to use if_wg? From owner-svn-src-head@freebsd.org Mon Nov 30 15:04:34 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C6E6C47F191; Mon, 30 Nov 2020 15:04:34 +0000 (UTC) (envelope-from melounmichal@gmail.com) Received: from mail-ed1-x52a.google.com (mail-ed1-x52a.google.com [IPv6:2a00:1450:4864:20::52a]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Cl7my52BCz3lsB; Mon, 30 Nov 2020 15:04:34 +0000 (UTC) (envelope-from melounmichal@gmail.com) Received: by mail-ed1-x52a.google.com with SMTP id n24so14430352edb.4; Mon, 30 Nov 2020 07:04:34 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:reply-to:subject:to:cc:references:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=CS7HNvBOWmamwxA24THVCt+l8y6x2WS27hKYfpPQUQE=; b=FcosGlVjJRaEqWKT096FgBXieFia1e6QOcnxRZu0WPCL4U7C/pDxsjuHahhi3a2ne/ inNkcq8wWfLOO7ig+MQpsIiGmLzAOCMEmZRneV1+TjJyOkNkIdn53vmjbI16XzA7YFbM u7Vw9nCz1cmGCl+1QYV3XUWUr/NKK1jiWLRc1wabAWEH9aHVbN4czBEsvgbXOP/URuGJ Fqfs5wn0V5byElgnDRVo2HYasFkxF+Phq3EAALwO2AfVDSIeq/u2LXaTUpEYzXhblsnp h2XOfACfR/BMhmNPuBu1e12EcNsCuSaIp0FxMgYd8R7O1BxQ2Cck/42R3KmsyPgsf3qg jwFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:reply-to:subject:to:cc:references :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=CS7HNvBOWmamwxA24THVCt+l8y6x2WS27hKYfpPQUQE=; b=Bb40GJezyFFE0knt0yqNQwxlIPLvpy6B015ZRjDU3duUDMcMAPAitWeHB3m5S7sRQn x01g+Ts+6Z5/bPnV/KqjHKcooIOrm/LB4Ah8Wtv2jpAmXc5pLVDWfIp8JK83aU7kwOoh 95UoQSTpB9GMrocQP7DRWLNGf/G3rL8l1JZ7U1AfBZMwVnRzJwn3DhU5kDRE5TYw/2IB tDaHPATFcrfuM3LAaeccO3jeKEj2ohJwIoKSSeUXsNySQ7G8KH/I7/1YsbGLX9i7eA37 gi6zO/qmEyOJRfoa0JMcNplxsIyG3LEPmA12ROHNfFkhkousw9JU+uc0TpPTuAyr62pv PcRg== X-Gm-Message-State: AOAM5336BYlFNr1cZX0CEPrw9WbAs3CkuwRd5kJAxhkfegKhQuAB3zXd ebwUcvMmwLOEQnnRo2Be0IRzylUqD0ruQg== X-Google-Smtp-Source: ABdhPJwrQfgPV+jMlUcr1np0k6BXDjlPTnyRgXDvn2e0OR4K3MZr2rscfYR7xEk/LN9MtAlLLsthpw== X-Received: by 2002:aa7:db8a:: with SMTP id u10mr22238304edt.204.1606748672753; Mon, 30 Nov 2020 07:04:32 -0800 (PST) Received: from [88.208.79.100] (halouny.humusoft.cz. [88.208.79.100]) by smtp.gmail.com with ESMTPSA id h12sm6849574eja.113.2020.11.30.07.04.32 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 30 Nov 2020 07:04:32 -0800 (PST) Sender: Michal Meloun From: Michal Meloun X-Google-Original-From: Michal Meloun Reply-To: mmel@freebsd.org Subject: Re: svn commit: r368167 - head/sys/dev/nvme To: Michael Tuexen Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <202011300701.0AU71CWr006435@repo.freebsd.org> <8A805005-1EB5-477E-B8EA-003F91A9B337@freebsd.org> Message-ID: <366bcdc5-4b81-2bad-d565-6bf76d904a11@freebsd.org> Date: Mon, 30 Nov 2020 16:04:31 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.5.0 MIME-Version: 1.0 In-Reply-To: <8A805005-1EB5-477E-B8EA-003F91A9B337@freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4Cl7my52BCz3lsB X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; TAGGED_FROM(0.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Nov 2020 15:04:34 -0000 On 30.11.2020 11:35, Michael Tuexen wrote: >> On 30. Nov 2020, at 08:01, Michal Meloun wrote: >> >> Author: mmel >> Date: Mon Nov 30 07:01:12 2020 >> New Revision: 368167 >> URL: https://svnweb.freebsd.org/changeset/base/368167 >> >> Log: >> NVME: Don't try to swap data on little endian machines. >> These swapping functions violate BUSDMA contract - we cannot write >> to armed (by bus_dmamap_sync(PRE_..)) buffers. Remove them at least >> from little endian machines until a better solution will be developed. > This breaks building libsysdecode on a little endian (amd64) system: > Fixed in r368187. Sorry for troubles. Michal From owner-svn-src-head@freebsd.org Mon Nov 30 15:04:36 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D80E647F02E; Mon, 30 Nov 2020 15:04:36 +0000 (UTC) (envelope-from olivier@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Cl7n05KJkz3ln4; Mon, 30 Nov 2020 15:04:36 +0000 (UTC) (envelope-from olivier@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8E077255D5; Mon, 30 Nov 2020 15:04:36 +0000 (UTC) (envelope-from olivier@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AUF4aTT008705; Mon, 30 Nov 2020 15:04:36 GMT (envelope-from olivier@FreeBSD.org) Received: (from olivier@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AUF4aMW008702; Mon, 30 Nov 2020 15:04:36 GMT (envelope-from olivier@FreeBSD.org) Message-Id: <202011301504.0AUF4aMW008702@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: olivier set sender to olivier@FreeBSD.org using -f From: Olivier Cochard Date: Mon, 30 Nov 2020 15:04:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368188 - head/tools/tools/ifinfo X-SVN-Group: head X-SVN-Commit-Author: olivier X-SVN-Commit-Paths: head/tools/tools/ifinfo X-SVN-Commit-Revision: 368188 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Nov 2020 15:04:37 -0000 Author: olivier (ports committer) Date: Mon Nov 30 15:04:35 2020 New Revision: 368188 URL: https://svnweb.freebsd.org/changeset/base/368188 Log: Fix compilation on head and while here: - remove unwanted whitespaces - remove useless function ifphys() - fix the Makefile to install it into /usr/bin PR: 250133 Reviewed by: glebius, maxim Approved by: glebius Differential Revision: https://reviews.freebsd.org/D27155 Modified: head/tools/tools/ifinfo/Makefile head/tools/tools/ifinfo/ifinfo.c Modified: head/tools/tools/ifinfo/Makefile ============================================================================== --- head/tools/tools/ifinfo/Makefile Mon Nov 30 14:51:48 2020 (r368187) +++ head/tools/tools/ifinfo/Makefile Mon Nov 30 15:04:35 2020 (r368188) @@ -3,5 +3,6 @@ PROG= ifinfo SRCS= ifinfo.c rfc1650.c MAN= +BINDIR?= /usr/bin .include Modified: head/tools/tools/ifinfo/ifinfo.c ============================================================================== --- head/tools/tools/ifinfo/ifinfo.c Mon Nov 30 14:51:48 2020 (r368187) +++ head/tools/tools/ifinfo/ifinfo.c Mon Nov 30 15:04:35 2020 (r368188) @@ -12,7 +12,7 @@ * no representations about the suitability of this software for any * purpose. It is provided "as is" without express or implied * warranty. - * + * * THIS SOFTWARE IS PROVIDED BY M.I.T. ``AS IS''. M.I.T. DISCLAIMS * ALL EXPRESS OR IMPLIED WARRANTIES WITH REGARD TO THIS SOFTWARE, * INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF @@ -49,7 +49,6 @@ static void printit(const struct ifmibdata *, const char *); static const char *iftype(int); -static const char *ifphys(int, int); static int isit(int, char **, const char *); static printfcn findlink(int); @@ -83,7 +82,7 @@ main(int argc, char **argv) usage(argv[0]); } } - + retval = 1; name[0] = CTL_NET; @@ -132,15 +131,15 @@ main(int argc, char **argv) if (dolink && (pf = findlink(ifmd.ifmd_data.ifi_type))) { name[5] = IFDATA_LINKSPECIFIC; if (sysctl(name, 6, 0, &linkmiblen, 0, 0) < 0) - err(EX_OSERR, + err(EX_OSERR, "sysctl(net.link.ifdata.%d.linkspec) size", i); linkmib = malloc(linkmiblen); if (!linkmib) - err(EX_OSERR, "malloc(%lu)", + err(EX_OSERR, "malloc(%lu)", (u_long)linkmiblen); if (sysctl(name, 6, linkmib, &linkmiblen, 0, 0) < 0) - err(EX_OSERR, + err(EX_OSERR, "sysctl(net.link.ifdata.%d.linkspec)", i); pf(linkmib, linkmiblen); @@ -165,15 +164,13 @@ printit(const struct ifmibdata *ifmd, const char *dnam printf("\tsend queue max length: %d\n", ifmd->ifmd_snd_maxlen); printf("\tsend queue drops: %d\n", ifmd->ifmd_snd_drops); printf("\ttype: %s\n", iftype(ifmd->ifmd_data.ifi_type)); - printf("\tphysical: %s\n", ifphys(ifmd->ifmd_data.ifi_type, - ifmd->ifmd_data.ifi_physical)); printf("\taddress length: %d\n", ifmd->ifmd_data.ifi_addrlen); printf("\theader length: %d\n", ifmd->ifmd_data.ifi_hdrlen); printf("\tlink state: %u\n", ifmd->ifmd_data.ifi_link_state); printf("\tvhid: %u\n", ifmd->ifmd_data.ifi_vhid); printf("\tdatalen: %u\n", ifmd->ifmd_data.ifi_datalen); - printf("\tmtu: %lu\n", ifmd->ifmd_data.ifi_mtu); - printf("\tmetric: %lu\n", ifmd->ifmd_data.ifi_metric); + printf("\tmtu: %u\n", ifmd->ifmd_data.ifi_mtu); + printf("\tmetric: %u\n", ifmd->ifmd_data.ifi_metric); printf("\tline rate: %lu bit/s\n", ifmd->ifmd_data.ifi_baudrate); printf("\tpackets received: %lu\n", ifmd->ifmd_data.ifi_ipackets); printf("\tinput errors: %lu\n", ifmd->ifmd_data.ifi_ierrors); @@ -185,7 +182,7 @@ printit(const struct ifmibdata *ifmd, const char *dnam printf("\tmulticasts received: %lu\n", ifmd->ifmd_data.ifi_imcasts); printf("\tmulticasts transmitted: %lu\n", ifmd->ifmd_data.ifi_omcasts); printf("\tinput queue drops: %lu\n", ifmd->ifmd_data.ifi_iqdrops); - printf("\tpackets for unknown protocol: %lu\n", + printf("\tpackets for unknown protocol: %lu\n", ifmd->ifmd_data.ifi_noproto); printf("\tHW offload capabilities: 0x%lx\n", ifmd->ifmd_data.ifi_hwassist); @@ -193,7 +190,7 @@ printit(const struct ifmibdata *ifmd, const char *dnam ifmd->ifmd_data.ifi_epoch); #ifdef notdef printf("\treceive timing: %lu usec\n", ifmd->ifmd_data.ifi_recvtiming); - printf("\ttransmit timing: %lu usec\n", + printf("\ttransmit timing: %lu usec\n", ifmd->ifmd_data.ifi_xmittiming); #endif } @@ -258,7 +255,7 @@ static const char *const if_types[] = { "IPv6-to-IPv4 TCP relay capturing interface", "6to4 tunnel interface" }; -#define NIFTYPES ((sizeof if_types)/(sizeof if_types[0])) +#define NIFTYPES (int)((sizeof if_types)/(sizeof if_types[0])) static const char * iftype(int type) @@ -271,15 +268,6 @@ iftype(int type) } return if_types[type]; -} - -static const char * -ifphys(int type, int phys) -{ - static char buf[256]; - - sprintf(buf, "unknown physical %d", phys); - return buf; } static int From owner-svn-src-head@freebsd.org Mon Nov 30 16:03:03 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 04B4D4A1E0A for ; Mon, 30 Nov 2020 16:03:03 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound2k.ore.mailhop.org (outbound2k.ore.mailhop.org [54.148.219.64]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4Cl94Q592nz3qvc for ; Mon, 30 Nov 2020 16:03:02 +0000 (UTC) (envelope-from ian@freebsd.org) ARC-Seal: i=1; a=rsa-sha256; t=1606752180; cv=none; d=outbound.mailhop.org; s=arc-outbound20181012; b=CeA08vJXumKtk7NwfY02+7k/bayFVL6851N5qM7efVAK9szekVbHObFzTkdxQ529vjVdQrAcSGzhf +SovkUBpEcmPTObbUU4Q49IXHLesLgykzPz2NBlGwaON779MQuiY+OmFAIrPaqs9zHuem0qn16RBjY kB9qOthVm5VAPYxQWPsXy3isQrKw2sG1Awxhr7092VgYI9y7pF3g6d+BqqN6ddaeKttGyzu1e6Jfct KO7FQtF/OeFUVP7awKnw2PyLtTI1DhRATWiv/izXC5+YCgeMtxbTExkOrc0uyDClZ6RjrC6wBjAEU2 eaQut7EwrvmP/eWaX2kzqUoDOgjnqxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=arc-outbound20181012; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:to:from:subject:message-id:dkim-signature:from; bh=X2pZnyVNDYsDxoSSmcLnkxRF6SsiJMhpzJnWlS5MRBI=; b=eTnkY1AqsOCQ2tIOfsLK5aCJJ8qUdYpFe8IyXHJhCmoqnSEgWo0oSSJcJQaifNU7EFPssQxLuvShU J+V2yYyB0KelKH32S4v7uxV+fmGcDJfRhyntWo9fMAsH94naioLJmnpe8USKkhIyHur/jFLp7G2CZG KbWuDLrzI0QfgnQ3fzXmW4lvs2/PD42wM2itxwgqLWhWmfYlrptiqFPQE3S7RGARNS3U1/KPjCdcbx QS8GGt5A7UvuBhmnZJ3uLcoBDkU6f+H5zg5bYw6fNCyLKqDhLJEtobxmedZhf+DQbFV4LMpdJTtfjh 4QwJcjdhZi1HUpi1+kuzeO7ILNILpEA== ARC-Authentication-Results: i=1; outbound4.ore.mailhop.org; spf=softfail smtp.mailfrom=freebsd.org smtp.remote-ip=67.177.211.60; dmarc=none header.from=freebsd.org; arc=none header.oldest-pass=0; DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=dkim-high; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:to:from:subject:message-id:from; bh=X2pZnyVNDYsDxoSSmcLnkxRF6SsiJMhpzJnWlS5MRBI=; b=Ou5XW+yuV7EDyivckYH9w4bjrbCGTruf0aJFtn2dIu60Q3Zk9QgQvzivhO6vjYul4al+L5R8pAAvS SmbSk/zQTQ1Inp3qYX/bxaCMc2+AFMR8I5SGcRuLjSUXuIyZptLestp57s5/C0BTQtscSrHxsqJcTC atdD1CnwqpaREsFw5TgvtqiQBNL4g2QKwnXXQcl1G8dXoFloTfg0XbUn/qoELFQQrlmkXwSdPIPBy0 gF2NhJFB0c2J28tATqwPpqcVZGelDLz25lfzVyjZ5FeTNE3KUtu/PAm7nXItLAHv/Ku6rtNBoaKAzG L+Lo69ZQ4Dk/6oHa+M3fONagyk7dPhg== X-MHO-RoutePath: aGlwcGll X-MHO-User: 83bc4192-3325-11eb-9e13-df46ed8f892f X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 67.177.211.60 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (c-67-177-211-60.hsd1.co.comcast.net [67.177.211.60]) by outbound4.ore.mailhop.org (Halon) with ESMTPSA id 83bc4192-3325-11eb-9e13-df46ed8f892f; Mon, 30 Nov 2020 16:02:59 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id 0AUG2vkS091048; Mon, 30 Nov 2020 09:02:57 -0700 (MST) (envelope-from ian@freebsd.org) Message-ID: <5bd6eb969c3a198246ab915257375b02c7b14e0c.camel@freebsd.org> Subject: Re: svn commit: r368187 - head/sys/dev/nvme From: Ian Lepore To: Michal Meloun , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Date: Mon, 30 Nov 2020 09:02:57 -0700 In-Reply-To: <202011301451.0AUEpn9w002536@repo.freebsd.org> References: <202011301451.0AUEpn9w002536@repo.freebsd.org> Content-Type: text/plain; charset="ASCII" X-Mailer: Evolution 3.28.5 FreeBSD GNOME Team Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4Cl94Q592nz3qvc X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Nov 2020 16:03:03 -0000 On Mon, 2020-11-30 at 14:51 +0000, Michal Meloun wrote: > Author: mmel > Date: Mon Nov 30 14:51:48 2020 > New Revision: 368187 > URL: https://svnweb.freebsd.org/changeset/base/368187 > > Log: > Unbreak r368167 in userland. Decorate unused arguments. > > Reported by: kp, tuexen, jenkins, and many others > MFC with: r368167 > > Modified: > head/sys/dev/nvme/nvme.h > > Modified: head/sys/dev/nvme/nvme.h > ===================================================================== > ========= > --- head/sys/dev/nvme/nvme.h Mon Nov 30 14:49:13 2020 (r368186) > +++ head/sys/dev/nvme/nvme.h Mon Nov 30 14:51:48 2020 (r368187) > @@ -1728,9 +1728,15 @@ extern int nvme_use_nvd; > > #endif /* _KERNEL */ > > +#if _BYTE_ORDER != _LITTLE_ENDIAN > +#define MODIF > +#else > +#define MODIF __unused > +#endif > + > /* Endianess conversion functions for NVMe structs */ > static inline > -void nvme_completion_swapbytes(struct nvme_completion *s) > +void nvme_completion_swapbytes(struct nvme_completion *s MODIF) IMO, this is pretty ugly, it causes the brain to screech to a halt when you see it. Why not just add an unconditional __unused to the functions? The unused attribute is defined as marking the variable as "potentially unused" -- there is no penalty for having it there and then actually using the variable. -- Ian From owner-svn-src-head@freebsd.org Mon Nov 30 16:18:33 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EB2A34A2115; Mon, 30 Nov 2020 16:18:33 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Cl9QK6L0jz3s1q; Mon, 30 Nov 2020 16:18:33 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CC333262C6; Mon, 30 Nov 2020 16:18:33 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AUGIXd3053159; Mon, 30 Nov 2020 16:18:33 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AUGIXP0053158; Mon, 30 Nov 2020 16:18:33 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202011301618.0AUGIXP0053158@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 30 Nov 2020 16:18:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368189 - head/sys/vm X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/vm X-SVN-Commit-Revision: 368189 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Nov 2020 16:18:34 -0000 Author: markj Date: Mon Nov 30 16:18:33 2020 New Revision: 368189 URL: https://svnweb.freebsd.org/changeset/base/368189 Log: uma: Avoid allocating buckets with the cross-domain lock held Allocation of a bucket can trigger a cross-domain free in the bucket zone, e.g., if the per-CPU alloc bucket is empty, we free it and get migrated to a remote domain. This can lead to deadlocks since a bucket zone may allocate buckets from itself or a pair of bucket zones could be allocating from each other. Fix the problem by dropping the cross-domain lock before allocating a new bucket and handling refill races. Use a list of empty buckets to ensure that we can make forward progress. Reported by: imp, mjg (witness(9) warnings) Discussed with: jeff Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D27341 Modified: head/sys/vm/uma_core.c Modified: head/sys/vm/uma_core.c ============================================================================== --- head/sys/vm/uma_core.c Mon Nov 30 15:04:35 2020 (r368188) +++ head/sys/vm/uma_core.c Mon Nov 30 16:18:33 2020 (r368189) @@ -4250,7 +4250,7 @@ zfree_item: static void zone_free_cross(uma_zone_t zone, uma_bucket_t bucket, void *udata) { - struct uma_bucketlist fullbuckets; + struct uma_bucketlist emptybuckets, fullbuckets; uma_zone_domain_t zdom; uma_bucket_t b; smr_seq_t seq; @@ -4274,31 +4274,57 @@ zone_free_cross(uma_zone_t zone, uma_bucket_t bucket, * lock on the current crossfree bucket. A full matrix with * per-domain locking could be used if necessary. */ + STAILQ_INIT(&emptybuckets); STAILQ_INIT(&fullbuckets); ZONE_CROSS_LOCK(zone); - while (bucket->ub_cnt > 0) { + for (; bucket->ub_cnt > 0; bucket->ub_cnt--) { item = bucket->ub_bucket[bucket->ub_cnt - 1]; domain = item_domain(item); zdom = ZDOM_GET(zone, domain); if (zdom->uzd_cross == NULL) { - zdom->uzd_cross = bucket_alloc(zone, udata, M_NOWAIT); - if (zdom->uzd_cross == NULL) - break; + if ((b = STAILQ_FIRST(&emptybuckets)) != NULL) { + STAILQ_REMOVE_HEAD(&emptybuckets, ub_link); + zdom->uzd_cross = b; + } else { + /* + * Avoid allocating a bucket with the cross lock + * held, since allocation can trigger a + * cross-domain free and bucket zones may + * allocate from each other. + */ + ZONE_CROSS_UNLOCK(zone); + b = bucket_alloc(zone, udata, M_NOWAIT); + if (b == NULL) + goto out; + ZONE_CROSS_LOCK(zone); + if (zdom->uzd_cross != NULL) { + STAILQ_INSERT_HEAD(&emptybuckets, b, + ub_link); + } else { + zdom->uzd_cross = b; + } + } } b = zdom->uzd_cross; b->ub_bucket[b->ub_cnt++] = item; b->ub_seq = seq; if (b->ub_cnt == b->ub_entries) { STAILQ_INSERT_HEAD(&fullbuckets, b, ub_link); - zdom->uzd_cross = NULL; + if ((b = STAILQ_FIRST(&emptybuckets)) != NULL) + STAILQ_REMOVE_HEAD(&emptybuckets, ub_link); + zdom->uzd_cross = b; } - bucket->ub_cnt--; } ZONE_CROSS_UNLOCK(zone); +out: if (bucket->ub_cnt == 0) bucket->ub_seq = SMR_SEQ_INVALID; bucket_free(zone, bucket, udata); + while ((b = STAILQ_FIRST(&emptybuckets)) != NULL) { + STAILQ_REMOVE_HEAD(&emptybuckets, ub_link); + bucket_free(zone, b, udata); + } while ((b = STAILQ_FIRST(&fullbuckets)) != NULL) { STAILQ_REMOVE_HEAD(&fullbuckets, ub_link); domain = item_domain(b->ub_bucket[0]); From owner-svn-src-head@freebsd.org Mon Nov 30 16:33:06 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 768304A241F; Mon, 30 Nov 2020 16:33:06 +0000 (UTC) (envelope-from bzeeb-lists@lists.zabbadoz.net) Received: from mx1.sbone.de (cross.sbone.de [195.201.62.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mx1.sbone.de", Issuer "SBone.DE" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Cl9l54Kdgz3ssp; Mon, 30 Nov 2020 16:33:05 +0000 (UTC) (envelope-from bzeeb-lists@lists.zabbadoz.net) Received: from mail.sbone.de (mail.sbone.de [IPv6:fde9:577b:c1a9:31::2013:587]) (using TLSv1 with cipher ADH-CAMELLIA256-SHA (256/256 bits)) (No client certificate requested) by mx1.sbone.de (Postfix) with ESMTPS id 577848D4A23C; Mon, 30 Nov 2020 16:33:03 +0000 (UTC) Received: from content-filter.sbone.de (content-filter.sbone.de [IPv6:fde9:577b:c1a9:31::2013:2742]) (using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPS id C8600E707D8; Mon, 30 Nov 2020 16:33:02 +0000 (UTC) X-Virus-Scanned: amavisd-new at sbone.de Received: from mail.sbone.de ([IPv6:fde9:577b:c1a9:31::2013:587]) by content-filter.sbone.de (content-filter.sbone.de [fde9:577b:c1a9:31::2013:2742]) (amavisd-new, port 10024) with ESMTP id FPeAyZDgr3Pa; Mon, 30 Nov 2020 16:33:01 +0000 (UTC) Received: from [127.0.0.1] (unknown [IPv6:fde9:577b:c1a9:4902:59d5:6d49:9c08:9559]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.sbone.de (Postfix) with ESMTPSA id 7B6F9E707AD; Mon, 30 Nov 2020 16:33:01 +0000 (UTC) From: "Bjoern A. Zeeb" To: cglogic Cc: "Matt Macy" , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r368163 - in head: sbin/ifconfig sys/dev/if_wg sys/dev/if_wg/include sys/dev/if_wg/include/crypto sys/dev/if_wg/include/sys sys/dev/if_wg/include/zinc sys/dev/if_wg/module sys/dev/if_wg... Date: Mon, 30 Nov 2020 16:33:01 +0000 X-Mailer: MailMate (2.0BETAr6151) Message-ID: <6C2E5C72-BBB7-42D1-9615-07EC536F07ED@lists.zabbadoz.net> In-Reply-To: <-0GA0tF-2zZxdb99WE9WoUnv9YVf9efjJnMin4IL0bctNp-Bab2Qw2RbUuZTa6y9hP7r0UEUUXGkRSz-OF4k5yR5YmUgU-JJxNWcl48tVSQ=@protonmail.com> References: <202011291938.0ATJc4Z3081193@repo.freebsd.org> <20201130102758.c600f147a801933bb66529c7@bidouilliste.com> <01F4B070-2CBE-4662-ACDC-20F5E87B751A@lists.zabbadoz.net> <-0GA0tF-2zZxdb99WE9WoUnv9YVf9efjJnMin4IL0bctNp-Bab2Qw2RbUuZTa6y9hP7r0UEUUXGkRSz-OF4k5yR5YmUgU-JJxNWcl48tVSQ=@protonmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: 4Cl9l54Kdgz3ssp X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of bzeeb-lists@lists.zabbadoz.net designates 195.201.62.131 as permitted sender) smtp.mailfrom=bzeeb-lists@lists.zabbadoz.net X-Spamd-Result: default: False [-3.30 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; RCVD_COUNT_FIVE(0.00)[5]; MID_RHS_MATCH_FROM(0.00)[]; FROM_HAS_DN(0.00)[]; TO_DN_SOME(0.00)[]; R_SPF_ALLOW(-0.20)[+ip4:195.201.62.131]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[zabbadoz.net]; RBL_DBL_DONT_QUERY_IPS(0.00)[195.201.62.131:from]; RCPT_COUNT_FIVE(0.00)[5]; SPAMHAUS_ZRD(0.00)[195.201.62.131:from:127.0.2.255]; TO_MATCH_ENVRCPT_SOME(0.00)[]; NEURAL_HAM_SHORT(-1.00)[-1.000]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; FREEMAIL_TO(0.00)[protonmail.com]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:24940, ipnet:195.201.0.0/16, country:DE]; RCVD_TLS_LAST(0.00)[]; MAILMAN_DEST(0.00)[svn-src-all,svn-src-head] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Nov 2020 16:33:06 -0000 On 30 Nov 2020, at 14:53, cglogic wrote: > So you propose to make it dependent on linuxkpi? What have to do a > user who does not compile linuxkpi, but wants to use if_wg? If we’d move the implementations into linuxkpi you’d have to compile it to use if_wg. So that this however is only a question. Effectively you are using parts of linuxkpi now already, just copy&pasted (duplicated) into local files under if_wg; for as much as I can see for most of that would however not require linuxkpi to be loaded, just present at compile time like any other kernel headers. /bz From owner-svn-src-head@freebsd.org Mon Nov 30 16:56:40 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0C7164A27D9; Mon, 30 Nov 2020 16:56:40 +0000 (UTC) (envelope-from melounmichal@gmail.com) Received: from mail-ej1-x630.google.com (mail-ej1-x630.google.com [IPv6:2a00:1450:4864:20::630]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4ClBGH6b8Vz3vCF; Mon, 30 Nov 2020 16:56:39 +0000 (UTC) (envelope-from melounmichal@gmail.com) Received: by mail-ej1-x630.google.com with SMTP id a16so23117247ejj.5; Mon, 30 Nov 2020 08:56:39 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:reply-to:subject:to:references:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=JJAAee3n9JVdv3hIXhc77jmR/YMmlZZyIqdGNc69/u8=; b=szOVBkwGpthPknpT9q0u+l2o0zt2q830JwfqrA300kSTxYWuiV6CeI/khPcLLhdiLe WylesUdkWj7+TbmMGaDNSqP5oHu+k5TUgz5ywA+dyh561wxjGKEFqdQ3ZIjzoE3GeJx3 8TiBRwqX/AnzymMCf9a73A2PDueZIpRg3IqfaG52Y6+Zv56YrPf7swo7xLKey9kVX6VG TMPcv0aAFI9ckm4dCFGnffrIgMxItLP/ciOs+zNdUkjU7CshRN1rK0IotZRdMiqLoUSm dElFdOSCRRIPfdCZbV7RJs4LdL0OsYzUlQpfZP5Tzm6vsDP3Etuth6kCaHzCipgr05jI Cpfw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:reply-to:subject:to:references :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=JJAAee3n9JVdv3hIXhc77jmR/YMmlZZyIqdGNc69/u8=; b=D0kSZ761L+xYiI201BWVpxLqfB0eIrTAk1HSviUdUxYYsYMItzP+6DFHrjI+v6YwLu lNuqNV89hfy2FqBpcOLoUgouKz3OLEb5kb6rZZlkhdGTBLryxtKjOTGPZv1AUuR83Xfs 8cCfyHUh2Mqj9vKuynaMPrVZiiG/N8Rc45STHj4KvWYc35jmHdW6RW58mSUfdHFUCxPE Gr4aMc5ZiF4NPPiiO2lcOhsGKKwIRSInjTr8kBCLB4y+rNe5WX9smNT2RjNMqAR7pXja tZL8Dh/FF2FzDLmCf/mXPgMtVROzwfv4h8XHN2zqPa/HwM5ZsNoa2MCrGFBkKI3yuGIt ufEA== X-Gm-Message-State: AOAM532YT0Le6bXUc03+265VYL4YeJQWlF6TOcA3MrSbPlLjojIu61Bj 9UR92C1UKglhcYuZuy/G8V9Q0wVT3EJSJw== X-Google-Smtp-Source: ABdhPJyltabOMxZYrs20a8f2Fr4hDz1zUaccCYd15RjpEIGs+Zpp3C09y8TNfmNeTHYaQKwA8WkGnA== X-Received: by 2002:a17:906:391b:: with SMTP id f27mr19980137eje.195.1606755397865; Mon, 30 Nov 2020 08:56:37 -0800 (PST) Received: from [88.208.79.100] (halouny.humusoft.cz. [88.208.79.100]) by smtp.gmail.com with ESMTPSA id b14sm6738244edx.0.2020.11.30.08.56.37 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 30 Nov 2020 08:56:37 -0800 (PST) Sender: Michal Meloun From: Michal Meloun X-Google-Original-From: Michal Meloun Reply-To: mmel@freebsd.org Subject: Re: svn commit: r368187 - head/sys/dev/nvme To: Ian Lepore , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <202011301451.0AUEpn9w002536@repo.freebsd.org> <5bd6eb969c3a198246ab915257375b02c7b14e0c.camel@freebsd.org> Message-ID: Date: Mon, 30 Nov 2020 17:56:37 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.5.0 MIME-Version: 1.0 In-Reply-To: <5bd6eb969c3a198246ab915257375b02c7b14e0c.camel@freebsd.org> Content-Type: text/plain; charset=windows-1252; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4ClBGH6b8Vz3vCF X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; TAGGED_FROM(0.00)[]; REPLY(-4.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Nov 2020 16:56:40 -0000 On 30.11.2020 17:02, Ian Lepore wrote: > On Mon, 2020-11-30 at 14:51 +0000, Michal Meloun wrote: >> Author: mmel >> Date: Mon Nov 30 14:51:48 2020 >> New Revision: 368187 >> URL: https://svnweb.freebsd.org/changeset/base/368187 >> >> Log: >> Unbreak r368167 in userland. Decorate unused arguments. >> >> Reported by: kp, tuexen, jenkins, and many others >> MFC with: r368167 >> >> Modified: >> head/sys/dev/nvme/nvme.h >> >> Modified: head/sys/dev/nvme/nvme.h >> ===================================================================== >> ========= >> --- head/sys/dev/nvme/nvme.h Mon Nov 30 14:49:13 2020 (r368186) >> +++ head/sys/dev/nvme/nvme.h Mon Nov 30 14:51:48 2020 (r368187) >> @@ -1728,9 +1728,15 @@ extern int nvme_use_nvd; >> >> #endif /* _KERNEL */ >> >> +#if _BYTE_ORDER != _LITTLE_ENDIAN >> +#define MODIF >> +#else >> +#define MODIF __unused >> +#endif >> + >> /* Endianess conversion functions for NVMe structs */ >> static inline >> -void nvme_completion_swapbytes(struct nvme_completion *s) >> +void nvme_completion_swapbytes(struct nvme_completion *s MODIF) > > IMO, this is pretty ugly, it causes the brain to screech to a halt when > you see it. Why not just add an unconditional __unused to the > functions? The unused attribute is defined as marking the variable as > "potentially unused" -- there is no penalty for having it there and > then actually using the variable. > I understand, (and I have significant tendency to agree) but I did not find more correct way how to do it. Are you sure that __unused is defined as *potentially* unused? I cannot find nothing about this and you known how are compiler guys creative with generating of new warnings... I known that C++17 have 'maybe_unused' attribute, but relationship to standard '__unused' looks unclear. In any case, I have not single problem to change this to the proposed style if we found that this is the optimal way. Michal From owner-svn-src-head@freebsd.org Mon Nov 30 17:00:36 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 937124A2C03; Mon, 30 Nov 2020 17:00:36 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4ClBLr3mTHz3vDM; Mon, 30 Nov 2020 17:00:36 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7496D26BB2; Mon, 30 Nov 2020 17:00:36 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AUH0arf078839; Mon, 30 Nov 2020 17:00:36 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AUH0aHF078838; Mon, 30 Nov 2020 17:00:36 GMT (envelope-from kib@FreeBSD.org) Message-Id: <202011301700.0AUH0aHF078838@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 30 Nov 2020 17:00:36 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368190 - head/lib/libthr/thread X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/lib/libthr/thread X-SVN-Commit-Revision: 368190 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Nov 2020 17:00:36 -0000 Author: kib Date: Mon Nov 30 17:00:36 2020 New Revision: 368190 URL: https://svnweb.freebsd.org/changeset/base/368190 Log: Ensure that threading library is initialized in pthread_mutex_init(). We need at least thr_malloc ready. The situation is possible e.g. in case of libthr being listed in DT_NEEDED before some of its consumers. Reported and tested by: lev Sponsored by: The FreeBSD Foundation MFC after: 1 week Modified: head/lib/libthr/thread/thr_mutex.c Modified: head/lib/libthr/thread/thr_mutex.c ============================================================================== --- head/lib/libthr/thread/thr_mutex.c Mon Nov 30 16:18:33 2020 (r368189) +++ head/lib/libthr/thread/thr_mutex.c Mon Nov 30 17:00:36 2020 (r368190) @@ -384,6 +384,8 @@ __Tthr_mutex_init(pthread_mutex_t * __restrict mutex, struct pthread_mutex *pmtx; int ret; + _thr_check_init(); + if (mutex_attr != NULL) { ret = mutex_check_attr(*mutex_attr); if (ret != 0) From owner-svn-src-head@freebsd.org Mon Nov 30 17:03:26 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E26B84A2B45; Mon, 30 Nov 2020 17:03:26 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4ClBQ667dnz3vYc; Mon, 30 Nov 2020 17:03:26 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C583326E81; Mon, 30 Nov 2020 17:03:26 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AUH3Qjh084650; Mon, 30 Nov 2020 17:03:26 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AUH3Q4J084649; Mon, 30 Nov 2020 17:03:26 GMT (envelope-from kib@FreeBSD.org) Message-Id: <202011301703.0AUH3Q4J084649@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Mon, 30 Nov 2020 17:03:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368191 - head/sys/ufs/ffs X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/ufs/ffs X-SVN-Commit-Revision: 368191 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Nov 2020 17:03:26 -0000 Author: kib Date: Mon Nov 30 17:03:26 2020 New Revision: 368191 URL: https://svnweb.freebsd.org/changeset/base/368191 Log: ffs: do not read full direct blocks if they are going to be overwritten. BA_CLRBUF specifies that existing context of the block will be completely overwritten by caller, so there is no reason to spend io fetching existing data. We do the same for indirect blocks. Reported by: tmunro Reviewed by: mckusick, tmunro Tested by: pho, tmunro Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D27353 Modified: head/sys/ufs/ffs/ffs_balloc.c Modified: head/sys/ufs/ffs/ffs_balloc.c ============================================================================== --- head/sys/ufs/ffs/ffs_balloc.c Mon Nov 30 17:00:36 2020 (r368190) +++ head/sys/ufs/ffs/ffs_balloc.c Mon Nov 30 17:03:26 2020 (r368191) @@ -172,9 +172,17 @@ ffs_balloc_ufs1(struct vnode *vp, off_t startoffset, i panic("ffs_balloc_ufs1: BA_METAONLY for direct block"); nb = dp->di_db[lbn]; if (nb != 0 && ip->i_size >= smalllblktosize(fs, lbn + 1)) { - error = bread(vp, lbn, fs->fs_bsize, NOCRED, &bp); - if (error) { - return (error); + if ((flags & BA_CLRBUF) != 0) { + error = bread(vp, lbn, fs->fs_bsize, NOCRED, + &bp); + if (error != 0) + return (error); + } else { + bp = getblk(vp, lbn, fs->fs_bsize, 0, 0, + gbflags); + if (bp == NULL) + return (EIO); + vfs_bio_clrbuf(bp); } bp->b_blkno = fsbtodb(fs, nb); *bpp = bp; @@ -768,10 +776,17 @@ ffs_balloc_ufs2(struct vnode *vp, off_t startoffset, i panic("ffs_balloc_ufs2: BA_METAONLY for direct block"); nb = dp->di_db[lbn]; if (nb != 0 && ip->i_size >= smalllblktosize(fs, lbn + 1)) { - error = bread_gb(vp, lbn, fs->fs_bsize, NOCRED, - gbflags, &bp); - if (error) { - return (error); + if ((flags & BA_CLRBUF) != 0) { + error = bread_gb(vp, lbn, fs->fs_bsize, NOCRED, + gbflags, &bp); + if (error != 0) + return (error); + } else { + bp = getblk(vp, lbn, fs->fs_bsize, 0, 0, + gbflags); + if (bp == NULL) + return (EIO); + vfs_bio_clrbuf(bp); } bp->b_blkno = fsbtodb(fs, nb); *bpp = bp; From owner-svn-src-head@freebsd.org Mon Nov 30 17:04:15 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 671614A2D20 for ; Mon, 30 Nov 2020 17:04:15 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qk1-x72c.google.com (mail-qk1-x72c.google.com [IPv6:2607:f8b0:4864:20::72c]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4ClBR32ByRz3w4k for ; Mon, 30 Nov 2020 17:04:15 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qk1-x72c.google.com with SMTP id y197so11454806qkb.7 for ; Mon, 30 Nov 2020 09:04:15 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=fYtE6S0oR/+LlHTdDE9+1Oe2fX9JFvzCtA7tK+vxzEw=; b=e7YtjcGUGTWXiPSh1/eQD77rA86e36DETFoY9TzlaXBsGTOIV02Urk2yrcH9tW6HXz y54BzeC8zXjgdr1nzRF99sAnHFTcn76fK9TfjCWgXF/dG9q4J619XoUwpcorDxT1/vnH rUOdmM9cKK6HxOaBX/xKpx/g9ASQrLEdCk/ipfeiFya50eSAMHcgAzbNMeh8RvlS41NV jqKShJtnd7PI+B/9xZpjTvJ7KhL4lHzrFLf+spZcxLYrBsyza/+vxpxUmgh4WcGH6dXy /CI8ZrE98P0AqocCDDBEyxfz4KaHDrrg/a+Z2ohkrBKvaBcHmujxljrmMKZYToI1TxIx atnA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=fYtE6S0oR/+LlHTdDE9+1Oe2fX9JFvzCtA7tK+vxzEw=; b=KqO8Y/KFm+3QEzH0yRWBkoPWOdUBUFlXVfabjGoz+9BeCBEiTtnTz+4lEgAaTFIS8t qjBF93wvCEN5qvEJNbqTpHNUTkhbs4EK9CmUQjWutzp1Zf7qmMQNS5Jg90YvGOUXz6FH MRuB++jY/4GN7OtQXfTNkw3/LsdESy6hj7mIGoCjnM1RDXHaMxk2/ovWTKBXEdAVS7Lb 30r4mHqb0r+kbjoikBnNKRfxpZGm2QPBmhQ6WFeCaHm1vK5/YgD/wv5FrJzOH3zHOiuQ ShcclUU6Xx9kvh4O3pb1L0dINQQFpr3iYnWTu8QPrae+KR9fKKySlWNUgMKCL4HmRS3T d2NQ== X-Gm-Message-State: AOAM531LcA8Xjy6oOSYpdu1q8qq3AUojwrWE/UHH+FdBBrU3r88lM4FV u1ta5jkA4kd1valLtOrJspqRZ4LqA/bDdOvBtnUx3A== X-Google-Smtp-Source: ABdhPJyOFha1yCWcxSb9RjPhbtjhtBpSorRGS7EpiTzZ241SdP+MlHUpIwbINwfJkpbZQvREn8FjEYuKOVXipVFS16g= X-Received: by 2002:a37:78c:: with SMTP id 134mr24248489qkh.359.1606755854248; Mon, 30 Nov 2020 09:04:14 -0800 (PST) MIME-Version: 1.0 References: <202011301451.0AUEpn9w002536@repo.freebsd.org> <5bd6eb969c3a198246ab915257375b02c7b14e0c.camel@freebsd.org> In-Reply-To: From: Warner Losh Date: Mon, 30 Nov 2020 10:04:02 -0700 Message-ID: Subject: Re: svn commit: r368187 - head/sys/dev/nvme To: Michal Meloun Cc: Ian Lepore , src-committers , svn-src-all , svn-src-head X-Rspamd-Queue-Id: 4ClBR32ByRz3w4k X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Nov 2020 17:04:15 -0000 On Mon, Nov 30, 2020 at 9:56 AM Michal Meloun wrote: > > > On 30.11.2020 17:02, Ian Lepore wrote: > > On Mon, 2020-11-30 at 14:51 +0000, Michal Meloun wrote: > >> Author: mmel > >> Date: Mon Nov 30 14:51:48 2020 > >> New Revision: 368187 > >> URL: https://svnweb.freebsd.org/changeset/base/368187 > >> > >> Log: > >> Unbreak r368167 in userland. Decorate unused arguments. > >> > >> Reported by: kp, tuexen, jenkins, and many others > >> MFC with: r368167 > >> > >> Modified: > >> head/sys/dev/nvme/nvme.h > >> > >> Modified: head/sys/dev/nvme/nvme.h > >> ===================================================================== > >> ========= > >> --- head/sys/dev/nvme/nvme.h Mon Nov 30 14:49:13 2020 (r368186) > >> +++ head/sys/dev/nvme/nvme.h Mon Nov 30 14:51:48 2020 (r368187) > >> @@ -1728,9 +1728,15 @@ extern int nvme_use_nvd; > >> > >> #endif /* _KERNEL */ > >> > >> +#if _BYTE_ORDER != _LITTLE_ENDIAN > >> +#define MODIF > >> +#else > >> +#define MODIF __unused > >> +#endif > >> + > >> /* Endianess conversion functions for NVMe structs */ > >> static inline > >> -void nvme_completion_swapbytes(struct nvme_completion *s) > >> +void nvme_completion_swapbytes(struct nvme_completion *s MODIF) > > > > IMO, this is pretty ugly, it causes the brain to screech to a halt when > > you see it. Why not just add an unconditional __unused to the > > functions? The unused attribute is defined as marking the variable as > > "potentially unused" -- there is no penalty for having it there and > > then actually using the variable. > > > > I understand, (and I have significant tendency to agree) but I did not > find more correct way how to do it. > Are you sure that __unused is defined as *potentially* unused? I cannot > find nothing about this and you known how are compiler guys creative > with generating of new warnings... > I known that C++17 have 'maybe_unused' attribute, but relationship to > standard '__unused' looks unclear. > > In any case, I have not single problem to change this to the proposed > style if we found that this is the optimal way. > __unused means 'don't warn me if this is unused' elsewhere in the tree. Better to use it here. Warner From owner-svn-src-head@freebsd.org Mon Nov 30 17:38:55 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4699E4A382F; Mon, 30 Nov 2020 17:38:55 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4ClCC31J48z4S57; Mon, 30 Nov 2020 17:38:55 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro.local (ralph.baldwin.cx [66.234.199.215]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id 5A9A9491; Mon, 30 Nov 2020 17:38:54 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: svn commit: r368187 - head/sys/dev/nvme To: Warner Losh , Michal Meloun Cc: Ian Lepore , src-committers , svn-src-all , svn-src-head References: <202011301451.0AUEpn9w002536@repo.freebsd.org> <5bd6eb969c3a198246ab915257375b02c7b14e0c.camel@freebsd.org> From: John Baldwin Autocrypt: addr=jhb@FreeBSD.org; keydata= mQGiBETQ+XcRBADMFybiq69u+fJRy/0wzqTNS8jFfWaBTs5/OfcV7wWezVmf9sgwn8TW0Dk0 c9MBl0pz+H01dA2ZSGZ5fXlmFIsee1WEzqeJzpiwd/pejPgSzXB9ijbLHZ2/E0jhGBcVy5Yo /Tw5+U/+laeYKu2xb0XPvM0zMNls1ah5OnP9a6Ql6wCgupaoMySb7DXm2LHD1Z9jTsHcAQMD /1jzh2BoHriy/Q2s4KzzjVp/mQO5DSm2z14BvbQRcXU48oAosHA1u3Wrov6LfPY+0U1tG47X 1BGfnQH+rNAaH0livoSBQ0IPI/8WfIW7ub4qV6HYwWKVqkDkqwcpmGNDbz3gfaDht6nsie5Z pcuCcul4M9CW7Md6zzyvktjnbz61BADGDCopfZC4of0Z3Ka0u8Wik6UJOuqShBt1WcFS8ya1 oB4rc4tXfSHyMF63aPUBMxHR5DXeH+EO2edoSwViDMqWk1jTnYza51rbGY+pebLQOVOxAY7k do5Ordl3wklBPMVEPWoZ61SdbcjhHVwaC5zfiskcxj5wwXd2E9qYlBqRg7QeSm9obiBCYWxk d2luIDxqaGJARnJlZUJTRC5vcmc+iGAEExECACAFAkTQ+awCGwMGCwkIBwMCBBUCCAMEFgID AQIeAQIXgAAKCRBy3lIGd+N/BI6RAJ9S97fvbME+3hxzE3JUyUZ6vTewDACdE1stFuSfqMvM jomvZdYxIYyTUpC5Ag0ERND5ghAIAPwsO0B7BL+bz8sLlLoQktGxXwXQfS5cInvL17Dsgnr3 1AKa94j9EnXQyPEj7u0d+LmEe6CGEGDh1OcGFTMVrof2ZzkSy4+FkZwMKJpTiqeaShMh+Goj XlwIMDxyADYvBIg3eN5YdFKaPQpfgSqhT+7El7w+wSZZD8pPQuLAnie5iz9C8iKy4/cMSOrH YUK/tO+Nhw8Jjlw94Ik0T80iEhI2t+XBVjwdfjbq3HrJ0ehqdBwukyeJRYKmbn298KOFQVHO EVbHA4rF/37jzaMadK43FgJ0SAhPPF5l4l89z5oPu0b/+5e2inA3b8J3iGZxywjM+Csq1tqz hltEc7Q+E08AAwUIAL+15XH8bPbjNJdVyg2CMl10JNW2wWg2Q6qdljeaRqeR6zFus7EZTwtX sNzs5bP8y51PSUDJbeiy2RNCNKWFMndM22TZnk3GNG45nQd4OwYK0RZVrikalmJY5Q6m7Z16 4yrZgIXFdKj2t8F+x613/SJW1lIr9/bDp4U9tw0V1g3l2dFtD3p3ZrQ3hpoDtoK70ioIAjjH aIXIAcm3FGZFXy503DOA0KaTWwvOVdYCFLm3zWuSOmrX/GsEc7ovasOWwjPn878qVjbUKWwx Q4QkF4OhUV9zPtf9tDSAZ3x7QSwoKbCoRCZ/xbyTUPyQ1VvNy/mYrBcYlzHodsaqUDjHuW+I SQQYEQIACQUCRND5ggIbDAAKCRBy3lIGd+N/BCO8AJ9j1dWVQWxw/YdTbEyrRKOY8YZNwwCf afMAg8QvmOWnHx3wl8WslCaXaE8= Message-ID: Date: Mon, 30 Nov 2020 09:38:52 -0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:68.0) Gecko/20100101 Thunderbird/68.6.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Nov 2020 17:38:55 -0000 On 11/30/20 9:04 AM, Warner Losh wrote: > On Mon, Nov 30, 2020 at 9:56 AM Michal Meloun > wrote: > >> >> >> On 30.11.2020 17:02, Ian Lepore wrote: >>> On Mon, 2020-11-30 at 14:51 +0000, Michal Meloun wrote: >>>> Author: mmel >>>> Date: Mon Nov 30 14:51:48 2020 >>>> New Revision: 368187 >>>> URL: https://svnweb.freebsd.org/changeset/base/368187 >>>> >>>> Log: >>>> Unbreak r368167 in userland. Decorate unused arguments. >>>> >>>> Reported by: kp, tuexen, jenkins, and many others >>>> MFC with: r368167 >>>> >>>> Modified: >>>> head/sys/dev/nvme/nvme.h >>>> >>>> Modified: head/sys/dev/nvme/nvme.h >>>> ===================================================================== >>>> ========= >>>> --- head/sys/dev/nvme/nvme.h Mon Nov 30 14:49:13 2020 (r368186) >>>> +++ head/sys/dev/nvme/nvme.h Mon Nov 30 14:51:48 2020 (r368187) >>>> @@ -1728,9 +1728,15 @@ extern int nvme_use_nvd; >>>> >>>> #endif /* _KERNEL */ >>>> >>>> +#if _BYTE_ORDER != _LITTLE_ENDIAN >>>> +#define MODIF >>>> +#else >>>> +#define MODIF __unused >>>> +#endif >>>> + >>>> /* Endianess conversion functions for NVMe structs */ >>>> static inline >>>> -void nvme_completion_swapbytes(struct nvme_completion *s) >>>> +void nvme_completion_swapbytes(struct nvme_completion *s MODIF) >>> >>> IMO, this is pretty ugly, it causes the brain to screech to a halt when >>> you see it. Why not just add an unconditional __unused to the >>> functions? The unused attribute is defined as marking the variable as >>> "potentially unused" -- there is no penalty for having it there and >>> then actually using the variable. >>> >> >> I understand, (and I have significant tendency to agree) but I did not >> find more correct way how to do it. >> Are you sure that __unused is defined as *potentially* unused? I cannot >> find nothing about this and you known how are compiler guys creative >> with generating of new warnings... >> I known that C++17 have 'maybe_unused' attribute, but relationship to >> standard '__unused' looks unclear. >> >> In any case, I have not single problem to change this to the proposed >> style if we found that this is the optimal way. >> > > __unused means 'don't warn me if this is unused' elsewhere in the tree. > Better to use it here. Alternatively, given you already are using #ifdef's in all the function bodies, you could instead do something like this: #if _BYTE_ORDER != _LITTLE_ENDIAN /* Existing functions without #if */ #else #define nvme_completion_swapbytes(s) /* Empty macros for the rest */ #endif This gives only a single #if instead of duplicating them in each function, and it avoids the need for __unused. -- John Baldwin From owner-svn-src-head@freebsd.org Mon Nov 30 17:43:33 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A173C4A38C2 for ; Mon, 30 Nov 2020 17:43:33 +0000 (UTC) (envelope-from ian@freebsd.org) Received: from outbound2k.ore.mailhop.org (outbound2k.ore.mailhop.org [54.148.219.64]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4ClCJP2Np2z4SNZ for ; Mon, 30 Nov 2020 17:43:33 +0000 (UTC) (envelope-from ian@freebsd.org) ARC-Seal: i=1; a=rsa-sha256; t=1606758212; cv=none; d=outbound.mailhop.org; s=arc-outbound20181012; b=cuHlZQ0mLIZG8Xo6W74sKmtkkuoKqCcleXOXoC+J7UaIQkdLLPbjt8Ng9cGOBt7/tSq+qosVeojWE 2u88CB6ucy0QaxWm59foyQGnB7jk1aX56GZtvMGK7Zm2VULb1KDqUkF09Uty1Z4r1xSONKimygRMXO qO/mQYLDY14zwiv4MfxWqzu7ejCmSeyxDuebJHWON5i90eL852z3OFE1oWY6/9E3c7dfNz9J8H8FvY 3hPFudUAKFFZKwVaAydVbmt+1OZJu3SKKCwU85BWUTq0hUUrSHhRewHL48cfRnXk4kJJJcOGvMnRhg P97AjXAUqlTDePj7jZbE0OiES9XL08A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=arc-outbound20181012; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:to:from:subject:message-id:dkim-signature:from; bh=8hx53+qKgYigHLB57pMRUmV2L+BjzcrLuNThcZcWBn4=; b=lbOkNbzwYAIh7yJn66WiTMkK4ZhOZXtmo6ya19NT8LYZurxgB2M6OIm2pLk+0xSLI4IZ//s/GnJ/I jizlgMXIns1hx/lknOyMiUovbLzgjcDh4bcoCJaiQ+4sGP5LFmzFxRWWuYzUoSmxdMt+Tdq8p3wjp7 YQ6VElXWrQqlFIqtYFHHPIIPE6k1rn4pJ7Zwx4qtyZmF2H8AMyjxMtgRYUxacNwuMfJdyzjgMng7YV pwqGyaitEqBrk1XtBmhdxduspLwR812SJOq5LWCieZYZ7OdxKQ1HtGkyKHmpSyQlLBO3/yOpzoKmeN 2YAcM+9QGdYcc9578XpNZvaBhm22wQw== ARC-Authentication-Results: i=1; outbound4.ore.mailhop.org; spf=softfail smtp.mailfrom=freebsd.org smtp.remote-ip=67.177.211.60; dmarc=none header.from=freebsd.org; arc=none header.oldest-pass=0; DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=outbound.mailhop.org; s=dkim-high; h=content-transfer-encoding:mime-version:content-type:references:in-reply-to: date:to:from:subject:message-id:from; bh=8hx53+qKgYigHLB57pMRUmV2L+BjzcrLuNThcZcWBn4=; b=hfLvgOT7UsuwGADfOAdUtoNWmWC0IQPh8zsm2zP7BnvseXDx1+3SMO1BF2hsXn5pVzFHfeIpQMsMI R1JrEVNRtSlW0aNcFRb1LDqJlwjcPlBVdeU8SbI8JsgwIJrlGvylEbWjsJoO/sAnZisx3iQcaes2gt M39T+Rwz1NnuI129OG5o2TlXsMBs+OTM0C7EjnKYo0jBQ1ECDgRNvMXUe14SjikA2qNs8cmdsYjxdu O2CeO4wDQ3nuNFsuW18gIdb/LUsrH83OcWOHJiEazwy92PciwzjidBbt6xUGgOecsDTaM3O4P2DCG0 JNXTFhqzMgEnbn7fYWukaDsVsNvdZOA== X-MHO-RoutePath: aGlwcGll X-MHO-User: 8e901499-3333-11eb-9e13-df46ed8f892f X-Report-Abuse-To: https://support.duocircle.com/support/solutions/articles/5000540958-duocircle-standard-smtp-abuse-information X-Originating-IP: 67.177.211.60 X-Mail-Handler: DuoCircle Outbound SMTP Received: from ilsoft.org (c-67-177-211-60.hsd1.co.comcast.net [67.177.211.60]) by outbound4.ore.mailhop.org (Halon) with ESMTPSA id 8e901499-3333-11eb-9e13-df46ed8f892f; Mon, 30 Nov 2020 17:43:30 +0000 (UTC) Received: from rev (rev [172.22.42.240]) by ilsoft.org (8.15.2/8.15.2) with ESMTP id 0AUHhSZk091321; Mon, 30 Nov 2020 10:43:28 -0700 (MST) (envelope-from ian@freebsd.org) Message-ID: <53cedfd91e07e2cfc4b2f77ff0795c1d5cf68707.camel@freebsd.org> Subject: Re: svn commit: r368187 - head/sys/dev/nvme From: Ian Lepore To: mmel@freebsd.org, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Date: Mon, 30 Nov 2020 10:43:28 -0700 In-Reply-To: References: <202011301451.0AUEpn9w002536@repo.freebsd.org> <5bd6eb969c3a198246ab915257375b02c7b14e0c.camel@freebsd.org> Content-Type: text/plain; charset="ASCII" X-Mailer: Evolution 3.28.5 FreeBSD GNOME Team Mime-Version: 1.0 Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4ClCJP2Np2z4SNZ X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Nov 2020 17:43:33 -0000 On Mon, 2020-11-30 at 17:56 +0100, Michal Meloun wrote: > > On 30.11.2020 17:02, Ian Lepore wrote: > > On Mon, 2020-11-30 at 14:51 +0000, Michal Meloun wrote: > > > Author: mmel > > > Date: Mon Nov 30 14:51:48 2020 > > > New Revision: 368187 > > > URL: https://svnweb.freebsd.org/changeset/base/368187 > > > > > > Log: > > > Unbreak r368167 in userland. Decorate unused arguments. > > > > > > Reported by: kp, tuexen, jenkins, and many others > > > MFC with: r368167 > > > > > > Modified: > > > head/sys/dev/nvme/nvme.h > > > > > > Modified: head/sys/dev/nvme/nvme.h > > > ================================================================= > > > ==== > > > ========= > > > --- head/sys/dev/nvme/nvme.h Mon Nov 30 14:49:13 2020 ( > > > r368186) > > > +++ head/sys/dev/nvme/nvme.h Mon Nov 30 14:51:48 2020 ( > > > r368187) > > > @@ -1728,9 +1728,15 @@ extern int nvme_use_nvd; > > > > > > #endif /* _KERNEL */ > > > > > > +#if _BYTE_ORDER != _LITTLE_ENDIAN > > > +#define MODIF > > > +#else > > > +#define MODIF __unused > > > +#endif > > > + > > > /* Endianess conversion functions for NVMe structs */ > > > static inline > > > -void nvme_completion_swapbytes(struct nvme_completion *s) > > > +void nvme_completion_swapbytes(struct nvme_completion *s > > > MODIF) > > > > IMO, this is pretty ugly, it causes the brain to screech to a halt > > when > > you see it. Why not just add an unconditional __unused to the > > functions? The unused attribute is defined as marking the variable > > as > > "potentially unused" -- there is no penalty for having it there and > > then actually using the variable. > > > > I understand, (and I have significant tendency to agree) but I did > not > find more correct way how to do it. > Are you sure that __unused is defined as *potentially* unused? I > cannot > find nothing about this and you known how are compiler guys creative > with generating of new warnings... > I known that C++17 have 'maybe_unused' attribute, but relationship > to > standard '__unused' looks unclear. > > In any case, I have not single problem to change this to the > proposed > style if we found that this is the optimal way. > > Michal The __unused macro is defined in cdefs.h under #if __GNUC_PREREQ__(2, 7) as attribute((unused)) and the gcc docs for that attribute say "This attribute, attached to a [variable|function], means that the variable is meant to be possibly unused. GCC will not produce a warning for this variable." -- Ian From owner-svn-src-head@freebsd.org Mon Nov 30 18:16:57 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C05B14A4669; Mon, 30 Nov 2020 18:16:57 +0000 (UTC) (envelope-from tuexen@freebsd.org) Received: from drew.franken.de (mail-n.franken.de [193.175.24.27]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.franken.de", Issuer "Sectigo RSA Domain Validation Secure Server CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4ClD2x4XS2z4Vdw; Mon, 30 Nov 2020 18:16:57 +0000 (UTC) (envelope-from tuexen@freebsd.org) Received: from mbp.fritz.box (ip4d16e8c9.dynamic.kabel-deutschland.de [77.22.232.201]) (Authenticated sender: macmic) by mail-n.franken.de (Postfix) with ESMTPSA id 381617220B80B; Mon, 30 Nov 2020 19:16:54 +0100 (CET) Content-Type: text/plain; charset=us-ascii Mime-Version: 1.0 (Mac OS X Mail 14.0 \(3654.20.0.2.21\)) Subject: Re: svn commit: r368163 - in head: sbin/ifconfig sys/dev/if_wg sys/dev/if_wg/include sys/dev/if_wg/include/crypto sys/dev/if_wg/include/sys sys/dev/if_wg/include/zinc sys/dev/if_wg/module sys/dev/if_wg... From: Michael Tuexen In-Reply-To: <202011291938.0ATJc4Z3081193@repo.freebsd.org> Date: Mon, 30 Nov 2020 19:16:53 +0100 Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Transfer-Encoding: 7bit Message-Id: References: <202011291938.0ATJc4Z3081193@repo.freebsd.org> To: Matt Macy X-Mailer: Apple Mail (2.3654.20.0.2.21) X-Spam-Status: No, score=-2.9 required=5.0 tests=ALL_TRUSTED,BAYES_00 autolearn=disabled version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on mail-n.franken.de X-Rspamd-Queue-Id: 4ClD2x4XS2z4Vdw X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Nov 2020 18:16:57 -0000 > On 29. Nov 2020, at 20:38, Matt Macy wrote: > > Author: mmacy > Date: Sun Nov 29 19:38:03 2020 > New Revision: 368163 > URL: https://svnweb.freebsd.org/changeset/base/368163 > > Log: > Import kernel WireGuard support > > Data path largely shared with the OpenBSD implementation by > Matt Dunwoodie > > Reviewed by: grehan@freebsd.org > MFC after: 1 month > Sponsored by: Rubicon LLC, (Netgate) > Differential Revision: https://reviews.freebsd.org/D26137 > Is there some documentation available somewhere how to setup a tunnel? Best regards Michael From owner-svn-src-head@freebsd.org Mon Nov 30 18:41:08 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1DEC94A49D8; Mon, 30 Nov 2020 18:41:08 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [IPv6:2a01:4f8:c17:6c4b::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4ClDZp5HBlz4WKH; Mon, 30 Nov 2020 18:41:06 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2020.home.selasky.org (unknown [178.17.145.105]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 728CB260373; Mon, 30 Nov 2020 19:40:58 +0100 (CET) Subject: Re: svn commit: r366917 - in head: sbin/ifconfig sys/net tests/sys/net To: "Alexander V. Chernikov" , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <202010212128.09LLSK8d080756@repo.freebsd.org> From: Hans Petter Selasky Message-ID: Date: Mon, 30 Nov 2020 19:40:49 +0100 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:78.0) Gecko/20100101 Thunderbird/78.5.0 MIME-Version: 1.0 In-Reply-To: <202010212128.09LLSK8d080756@repo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4ClDZp5HBlz4WKH X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of hps@selasky.org designates 2a01:4f8:c17:6c4b::2 as permitted sender) smtp.mailfrom=hps@selasky.org X-Spamd-Result: default: False [-3.30 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; ARC_NA(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; TO_DN_SOME(0.00)[]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; R_SPF_ALLOW(-0.20)[+a:mail.turbocat.net]; RBL_DBL_DONT_QUERY_IPS(0.00)[2a01:4f8:c17:6c4b::2:from]; DMARC_NA(0.00)[selasky.org]; SPAMHAUS_ZRD(0.00)[2a01:4f8:c17:6c4b::2:from:127.0.2.255]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-1.00)[-1.000]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:24940, ipnet:2a01:4f8::/29, country:DE]; RCVD_TLS_ALL(0.00)[]; MAILMAN_DEST(0.00)[svn-src-all,svn-src-head]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Nov 2020 18:41:08 -0000 On 10/21/20 11:28 PM, Alexander V. Chernikov wrote: > Author: melifaro > Date: Wed Oct 21 21:28:20 2020 > New Revision: 366917 > URL: https://svnweb.freebsd.org/changeset/base/366917 > > Log: > Add support for stacked VLANs (IEEE 802.1ad, AKA Q-in-Q). > > 802.1ad interfaces are created with ifconfig using the "vlanproto" parameter. > Eg., the following creates a 802.1Q VLAN (id #42) over a 802.1ad S-VLAN > (id #5) over a physical Ethernet interface (em0). > > ifconfig vlan5 create vlandev em0 vlan 5 vlanproto 802.1ad up > ifconfig vlan42 create vlandev vlan5 vlan 42 inet 10.5.42.1/24 > > VLAN_MTU, VLAN_HWCSUM and VLAN_TSO capabilities should be properly > supported. VLAN_HWTAGGING is only partially supported, as there is > currently no IFCAP_VLAN_* denoting the possibility to set the VLAN > EtherType to anything else than 0x8100 (802.1ad uses 0x88A8). > > Submitted by: Olivier Piras > Sponsored by: RG Nets > Differential Revision: https://reviews.freebsd.org/D26436 > Hi Alexander, Any vlan ending in . is now treated the same regardless of network device: Try this sequence of commands starting in any order ifconfig vlan create ifconfig igb0. create ifconfig igb1. create You'll quickly see that only the first command you pick succeeds. The subsequent ones will fail. must be the same number, for example 5. I'm not sure exactly where the problem is yet, but investigation shows that ifc_name2unit would return EINVAL on igb0. . Now it returns 0 (success) and puts into the *unit argument. > diff --git a/sys/net/if_clone.c b/sys/net/if_clone.c > index a55ce9c3005..7f96757e12c 100644 > --- a/sys/net/if_clone.c > +++ b/sys/net/if_clone.c > @@ -582,9 +582,8 @@ ifc_name2unit(const char *name, int *unit) > int cutoff = INT_MAX / 10; > int cutlim = INT_MAX % 10; > > - if ((cp = strrchr(name, '.')) == NULL) > - cp = name; > - for (; *cp != '\0' && (*cp < '0' || *cp > '9'); cp++); > + for (cp = name; *cp != '\0' && (*cp < '0' || *cp > '9'); cp++) > + ; > if (*cp == '\0') { > *unit = -1; > } else if (cp[0] == '0' && cp[1] != '\0') { The chunk above is not a fix. Can you have a look at this. Should be easy to reproduce! Rolling back the kernel only to r366916 gives me: ifconfig igb1.11 create ifconfig: SIOCIFCREATE2: Invalid argument Rolling back ifconfig to r366916 aswell, gives me the expected result again: /usr/obj/usr/img/freebsd/amd64.amd64/sbin/ifconfig/ifconfig igb1.11 create /usr/obj/usr/img/freebsd/amd64.amd64/sbin/ifconfig/ifconfig vlan11 create --HPS From owner-svn-src-head@freebsd.org Mon Nov 30 19:18:51 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 35C094A5750; Mon, 30 Nov 2020 19:18:51 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4ClFQM13rdz4Ylf; Mon, 30 Nov 2020 19:18:51 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 12DB7811; Mon, 30 Nov 2020 19:18:51 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AUJIoDT066772; Mon, 30 Nov 2020 19:18:50 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AUJIoBX066771; Mon, 30 Nov 2020 19:18:50 GMT (envelope-from dim@FreeBSD.org) Message-Id: <202011301918.0AUJIoBX066771@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Mon, 30 Nov 2020 19:18:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368192 - head X-SVN-Group: head X-SVN-Commit-Author: dim X-SVN-Commit-Paths: head X-SVN-Commit-Revision: 368192 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Nov 2020 19:18:51 -0000 Author: dim Date: Mon Nov 30 19:18:50 2020 New Revision: 368192 URL: https://svnweb.freebsd.org/changeset/base/368192 Log: Add a few missed entries to ObsoleteFiles.inc: * libzfs.so was bumped from 3 to 4 in r364746 * libcap_random.so.1 was removed in r350307, but its .so symlink was not Modified: head/ObsoleteFiles.inc Modified: head/ObsoleteFiles.inc ============================================================================== --- head/ObsoleteFiles.inc Mon Nov 30 17:03:26 2020 (r368191) +++ head/ObsoleteFiles.inc Mon Nov 30 19:18:50 2020 (r368192) @@ -117,6 +117,10 @@ OLD_FILES+=boot/lua/logo-fbsdbw.lua OLD_FILES+=boot/lua/logo-orb.lua OLD_FILES+=boot/lua/logo-orbbw.lua +# 20200825: merged OpenZFS support +OLD_LIBS+=lib/libzfs.so.3 +OLD_LIBS+=usr/lib32/libzfs.so.3 + # 20200923: memfd_test moved to /usr/tests/sys/posixshm OLD_FILES+=usr/tests/sys/kern/memfd_test @@ -2366,6 +2370,7 @@ OLD_FILES+=usr/include/sys/inflate.h # 20190722: cap_random(3) removed OLD_LIBS+=lib/casper/libcap_random.so.1 OLD_FILES+=usr/include/casper/cap_random.h +OLD_LIBS+=usr/lib/casper/libcap_random.so OLD_FILES+=usr/share/man/man3/cap_random.3.gz OLD_FILES+=usr/share/man/man3/cap_random_buf.3.gz # 20190708: vm_page_hold() and _unhold() removed From owner-svn-src-head@freebsd.org Mon Nov 30 20:53:28 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 433564A7457; Mon, 30 Nov 2020 20:53:28 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4ClHWX1L2hz4fX9; Mon, 30 Nov 2020 20:53:28 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 20A781AA9; Mon, 30 Nov 2020 20:53:28 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AUKrSVG028798; Mon, 30 Nov 2020 20:53:28 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AUKrQi5028785; Mon, 30 Nov 2020 20:53:26 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202011302053.0AUKrQi5028785@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 30 Nov 2020 20:53:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368193 - in head/sys: dev/qat modules/qatfw/qat_c2xxx modules/qatfw/qat_c3xxx modules/qatfw/qat_c62x modules/qatfw/qat_d15xx modules/qatfw/qat_dh895xcc X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in head/sys: dev/qat modules/qatfw/qat_c2xxx modules/qatfw/qat_c3xxx modules/qatfw/qat_c62x modules/qatfw/qat_d15xx modules/qatfw/qat_dh895xcc X-SVN-Commit-Revision: 368193 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Nov 2020 20:53:28 -0000 Author: markj Date: Mon Nov 30 20:53:25 2020 New Revision: 368193 URL: https://svnweb.freebsd.org/changeset/base/368193 Log: qat: Fix firmware module autoloading If firmware_get() fails to find a loaded firmware image, it searches for candidate KLDs to load. It will search for a KLD containing a module with the same name as the requested image, and failing that, will load a KLD with the same basename as the requested image. The module name given by fw_stub.awk is simply "_fw". QAT firmware modules contain two images, neither of which match either of the names used during lookup, so automatic loading of firmware images after mountroot does not work. Work around this by using the same string for the first image name and for the KLD basename. MFC after: 3 days Sponsored by: Rubicon Communications, LLC (Netgate) Modified: head/sys/dev/qat/qat_c2xxxreg.h head/sys/dev/qat/qat_c3xxxreg.h head/sys/dev/qat/qat_c62xreg.h head/sys/dev/qat/qat_d15xxreg.h head/sys/dev/qat/qat_dh895xccreg.h head/sys/modules/qatfw/qat_c2xxx/Makefile head/sys/modules/qatfw/qat_c3xxx/Makefile head/sys/modules/qatfw/qat_c62x/Makefile head/sys/modules/qatfw/qat_d15xx/Makefile head/sys/modules/qatfw/qat_dh895xcc/Makefile Modified: head/sys/dev/qat/qat_c2xxxreg.h ============================================================================== --- head/sys/dev/qat/qat_c2xxxreg.h Mon Nov 30 19:18:50 2020 (r368192) +++ head/sys/dev/qat/qat_c2xxxreg.h Mon Nov 30 20:53:25 2020 (r368193) @@ -169,7 +169,7 @@ /* AE firmware */ #define AE_FW_PROD_TYPE_C2XXX 0x00800000 -#define AE_FW_MOF_NAME_C2XXX "mof_firmware_c2xxx" +#define AE_FW_MOF_NAME_C2XXX "qat_c2xxxfw" #define AE_FW_MMP_NAME_C2XXX "mmp_firmware_c2xxx" #define AE_FW_UOF_NAME_C2XXX_A0 "icp_qat_nae.uof" #define AE_FW_UOF_NAME_C2XXX_B0 "icp_qat_nae_b0.uof" Modified: head/sys/dev/qat/qat_c3xxxreg.h ============================================================================== --- head/sys/dev/qat/qat_c3xxxreg.h Mon Nov 30 19:18:50 2020 (r368192) +++ head/sys/dev/qat/qat_c3xxxreg.h Mon Nov 30 20:53:25 2020 (r368193) @@ -168,7 +168,7 @@ /* AE firmware */ #define AE_FW_PROD_TYPE_C3XXX 0x02000000 -#define AE_FW_MOF_NAME_C3XXX "qat_c3xxx" +#define AE_FW_MOF_NAME_C3XXX "qat_c3xxxfw" #define AE_FW_MMP_NAME_C3XXX "qat_c3xxx_mmp" #define AE_FW_UOF_NAME_C3XXX "icp_qat_ae.suof" Modified: head/sys/dev/qat/qat_c62xreg.h ============================================================================== --- head/sys/dev/qat/qat_c62xreg.h Mon Nov 30 19:18:50 2020 (r368192) +++ head/sys/dev/qat/qat_c62xreg.h Mon Nov 30 20:53:25 2020 (r368193) @@ -191,7 +191,7 @@ /* AE firmware */ #define AE_FW_PROD_TYPE_C62X 0x01000000 -#define AE_FW_MOF_NAME_C62X "qat_c62x" +#define AE_FW_MOF_NAME_C62X "qat_c62xfw" #define AE_FW_MMP_NAME_C62X "qat_c62x_mmp" #define AE_FW_UOF_NAME_C62X "icp_qat_ae.suof" Modified: head/sys/dev/qat/qat_d15xxreg.h ============================================================================== --- head/sys/dev/qat/qat_d15xxreg.h Mon Nov 30 19:18:50 2020 (r368192) +++ head/sys/dev/qat/qat_d15xxreg.h Mon Nov 30 20:53:25 2020 (r368193) @@ -191,7 +191,7 @@ /* AE firmware */ #define AE_FW_PROD_TYPE_D15XX 0x01000000 -#define AE_FW_MOF_NAME_D15XX "qat_d15xx" +#define AE_FW_MOF_NAME_D15XX "qat_d15xxfw" #define AE_FW_MMP_NAME_D15XX "qat_d15xx_mmp" #define AE_FW_UOF_NAME_D15XX "icp_qat_ae.suof" Modified: head/sys/dev/qat/qat_dh895xccreg.h ============================================================================== --- head/sys/dev/qat/qat_dh895xccreg.h Mon Nov 30 19:18:50 2020 (r368192) +++ head/sys/dev/qat/qat_dh895xccreg.h Mon Nov 30 20:53:25 2020 (r368193) @@ -109,7 +109,7 @@ /* AE firmware */ #define AE_FW_PROD_TYPE_DH895XCC 0x00400000 -#define AE_FW_MOF_NAME_DH895XCC "qat_895xcc" +#define AE_FW_MOF_NAME_DH895XCC "qat_895xccfw" #define AE_FW_MMP_NAME_DH895XCC "qat_895xcc_mmp" #define AE_FW_UOF_NAME_DH895XCC "icp_qat_ae.uof" Modified: head/sys/modules/qatfw/qat_c2xxx/Makefile ============================================================================== --- head/sys/modules/qatfw/qat_c2xxx/Makefile Mon Nov 30 19:18:50 2020 (r368192) +++ head/sys/modules/qatfw/qat_c2xxx/Makefile Mon Nov 30 20:53:25 2020 (r368193) @@ -6,6 +6,6 @@ KMOD= qat_c2xxxfw IMG1= mmp_firmware_c2xxx IMG2= mof_firmware_c2xxx -FIRMWS= ${IMG1}.bin:${IMG1}:111 ${IMG2}.bin:${IMG2}:111 +FIRMWS= ${IMG1}.bin:${KMOD}:111 ${IMG2}.bin:${IMG2}:111 .include Modified: head/sys/modules/qatfw/qat_c3xxx/Makefile ============================================================================== --- head/sys/modules/qatfw/qat_c3xxx/Makefile Mon Nov 30 19:18:50 2020 (r368192) +++ head/sys/modules/qatfw/qat_c3xxx/Makefile Mon Nov 30 20:53:25 2020 (r368193) @@ -6,6 +6,6 @@ KMOD= qat_c3xxxfw IMG1= qat_c3xxx IMG2= qat_c3xxx_mmp -FIRMWS= ${IMG1}.bin:${IMG1}:111 ${IMG2}.bin:${IMG2}:111 +FIRMWS= ${IMG1}.bin:${KMOD}:111 ${IMG2}.bin:${IMG2}:111 .include Modified: head/sys/modules/qatfw/qat_c62x/Makefile ============================================================================== --- head/sys/modules/qatfw/qat_c62x/Makefile Mon Nov 30 19:18:50 2020 (r368192) +++ head/sys/modules/qatfw/qat_c62x/Makefile Mon Nov 30 20:53:25 2020 (r368193) @@ -6,6 +6,6 @@ KMOD= qat_c62xfw IMG1= qat_c62x IMG2= qat_c62x_mmp -FIRMWS= ${IMG1}.bin:${IMG1}:111 ${IMG2}.bin:${IMG2}:111 +FIRMWS= ${IMG1}.bin:${KMOD}:111 ${IMG2}.bin:${IMG2}:111 .include Modified: head/sys/modules/qatfw/qat_d15xx/Makefile ============================================================================== --- head/sys/modules/qatfw/qat_d15xx/Makefile Mon Nov 30 19:18:50 2020 (r368192) +++ head/sys/modules/qatfw/qat_d15xx/Makefile Mon Nov 30 20:53:25 2020 (r368193) @@ -6,6 +6,6 @@ KMOD= qat_d15xxfw IMG1= qat_d15xx IMG2= qat_d15xx_mmp -FIRMWS= ${IMG1}.bin:${IMG1}:111 ${IMG2}.bin:${IMG2}:111 +FIRMWS= ${IMG1}.bin:${KMOD}:111 ${IMG2}.bin:${IMG2}:111 .include Modified: head/sys/modules/qatfw/qat_dh895xcc/Makefile ============================================================================== --- head/sys/modules/qatfw/qat_dh895xcc/Makefile Mon Nov 30 19:18:50 2020 (r368192) +++ head/sys/modules/qatfw/qat_dh895xcc/Makefile Mon Nov 30 20:53:25 2020 (r368193) @@ -6,6 +6,6 @@ KMOD= qat_dh895xccfw IMG1= qat_895xcc IMG2= qat_895xcc_mmp -FIRMWS= ${IMG1}.bin:${IMG1}:111 ${IMG2}.bin:${IMG2}:111 +FIRMWS= ${IMG1}.bin:${KMOD}:111 ${IMG2}.bin:${IMG2}:111 .include From owner-svn-src-head@freebsd.org Mon Nov 30 20:53:45 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 91BF64A7561; Mon, 30 Nov 2020 20:53:45 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4ClHWs3hqvz4flS; Mon, 30 Nov 2020 20:53:45 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 71C2B18EA; Mon, 30 Nov 2020 20:53:45 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AUKrj67028852; Mon, 30 Nov 2020 20:53:45 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AUKrjTW028851; Mon, 30 Nov 2020 20:53:45 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202011302053.0AUKrjTW028851@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Mon, 30 Nov 2020 20:53:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368194 - head/sys/dev/qat X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/dev/qat X-SVN-Commit-Revision: 368194 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Nov 2020 20:53:45 -0000 Author: markj Date: Mon Nov 30 20:53:45 2020 New Revision: 368194 URL: https://svnweb.freebsd.org/changeset/base/368194 Log: qat: Initialize the crypto device ID to -1 instead of 0 Otherwise qat_detach() may attempt to deregister an unrelated crypto driver if an error occurs in qat_attach() before crypto_get_driverid() is called, since 0 is a valid driver ID. MFC after: 3 days Sponsored by: Rubicon Communications, LLC (Netgate) Modified: head/sys/dev/qat/qat.c Modified: head/sys/dev/qat/qat.c ============================================================================== --- head/sys/dev/qat/qat.c Mon Nov 30 20:53:25 2020 (r368193) +++ head/sys/dev/qat/qat.c Mon Nov 30 20:53:45 2020 (r368194) @@ -357,6 +357,7 @@ qat_attach(device_t dev) sc->sc_dev = dev; sc->sc_rev = pci_get_revid(dev); + sc->sc_crypto.qcy_cid = -1; qatp = qat_lookup(dev); memcpy(&sc->sc_hw, qatp->qatp_hw, sizeof(struct qat_hw)); From owner-svn-src-head@freebsd.org Mon Nov 30 20:54:44 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F2A204A7850; Mon, 30 Nov 2020 20:54:44 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4ClHY06Z5Gz4ffK; Mon, 30 Nov 2020 20:54:44 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C996518EB; Mon, 30 Nov 2020 20:54:44 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AUKsieM028935; Mon, 30 Nov 2020 20:54:44 GMT (envelope-from mmacy@FreeBSD.org) Received: (from mmacy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AUKsiBb028934; Mon, 30 Nov 2020 20:54:44 GMT (envelope-from mmacy@FreeBSD.org) Message-Id: <202011302054.0AUKsiBb028934@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmacy set sender to mmacy@FreeBSD.org using -f From: Matt Macy Date: Mon, 30 Nov 2020 20:54:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368195 - head/sys/dev/if_wg/module/crypto/zinc/chacha20 X-SVN-Group: head X-SVN-Commit-Author: mmacy X-SVN-Commit-Paths: head/sys/dev/if_wg/module/crypto/zinc/chacha20 X-SVN-Commit-Revision: 368195 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Nov 2020 20:54:45 -0000 Author: mmacy Date: Mon Nov 30 20:54:44 2020 New Revision: 368195 URL: https://svnweb.freebsd.org/changeset/base/368195 Log: Remove (dead) GPL copyright code from wireguard sources Deleted: head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20-unrolled-arm.S From owner-svn-src-head@freebsd.org Mon Nov 30 20:58:42 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8B4DD4A747C; Mon, 30 Nov 2020 20:58:42 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4ClHdZ3XDPz4g70; Mon, 30 Nov 2020 20:58:42 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6C6151AAF; Mon, 30 Nov 2020 20:58:42 +0000 (UTC) (envelope-from mmacy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AUKwg7n029303; Mon, 30 Nov 2020 20:58:42 GMT (envelope-from mmacy@FreeBSD.org) Received: (from mmacy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AUKwgK5029302; Mon, 30 Nov 2020 20:58:42 GMT (envelope-from mmacy@FreeBSD.org) Message-Id: <202011302058.0AUKwgK5029302@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmacy set sender to mmacy@FreeBSD.org using -f From: Matt Macy Date: Mon, 30 Nov 2020 20:58:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368196 - head/sys/dev/if_wg/include/sys X-SVN-Group: head X-SVN-Commit-Author: mmacy X-SVN-Commit-Paths: head/sys/dev/if_wg/include/sys X-SVN-Commit-Revision: 368196 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Nov 2020 20:58:42 -0000 Author: mmacy Date: Mon Nov 30 20:58:42 2020 New Revision: 368196 URL: https://svnweb.freebsd.org/changeset/base/368196 Log: wireguard: fix zfs_ copy pasta in module init macro Reported by: Jessica Clarke Modified: head/sys/dev/if_wg/include/sys/support.h Modified: head/sys/dev/if_wg/include/sys/support.h ============================================================================== --- head/sys/dev/if_wg/include/sys/support.h Mon Nov 30 20:54:44 2020 (r368195) +++ head/sys/dev/if_wg/include/sys/support.h Mon Nov 30 20:58:42 2020 (r368196) @@ -296,7 +296,7 @@ wrap_ ## fn(void *dummy __unused) \ { \ fn(); \ } \ -SYSINIT(zfs_ ## fn, SI_SUB_LAST, SI_ORDER_FIRST, wrap_ ## fn, NULL) +SYSINIT(if_wg_ ## fn, SI_SUB_LAST, SI_ORDER_FIRST, wrap_ ## fn, NULL) #define module_exit(fn) \ @@ -305,7 +305,7 @@ wrap_ ## fn(void *dummy __unused) \ { \ fn(); \ } \ -SYSUNINIT(zfs_ ## fn, SI_SUB_LAST, SI_ORDER_FIRST, wrap_ ## fn, NULL) +SYSUNINIT(if_wg_ ## fn, SI_SUB_LAST, SI_ORDER_FIRST, wrap_ ## fn, NULL) #define module_param(a, b, c) #define MODULE_LICENSE(x) From owner-svn-src-head@freebsd.org Mon Nov 30 21:05:32 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 042AF4A7EB7; Mon, 30 Nov 2020 21:05:32 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4ClHnR6kYXz4h0j; Mon, 30 Nov 2020 21:05:31 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DA5771E85; Mon, 30 Nov 2020 21:05:31 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AUL5V7B035424; Mon, 30 Nov 2020 21:05:31 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AUL5VHd035423; Mon, 30 Nov 2020 21:05:31 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <202011302105.0AUL5VHd035423@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Mon, 30 Nov 2020 21:05:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368197 - head/sbin/bectl X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sbin/bectl X-SVN-Commit-Revision: 368197 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Nov 2020 21:05:32 -0000 Author: glebius Date: Mon Nov 30 21:05:31 2020 New Revision: 368197 URL: https://svnweb.freebsd.org/changeset/base/368197 Log: Print at least something when failing. Modified: head/sbin/bectl/bectl.c Modified: head/sbin/bectl/bectl.c ============================================================================== --- head/sbin/bectl/bectl.c Mon Nov 30 20:58:42 2020 (r368196) +++ head/sbin/bectl/bectl.c Mon Nov 30 21:05:31 2020 (r368197) @@ -584,8 +584,11 @@ main(int argc, char *argv[]) return (usage(false)); } - if ((be = libbe_init(root)) == NULL) + if ((be = libbe_init(root)) == NULL) { + fprintf(stderr, "libbe_init(\"%s\") failed.\n", + root != NULL ? root : ""); return (-1); + } libbe_print_on_error(be, !cmd->silent); From owner-svn-src-head@freebsd.org Mon Nov 30 21:42:55 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9187B4A93EA; Mon, 30 Nov 2020 21:42:55 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4ClJcb3j6zz4lN3; Mon, 30 Nov 2020 21:42:55 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 723E12705; Mon, 30 Nov 2020 21:42:55 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AULgtkU060213; Mon, 30 Nov 2020 21:42:55 GMT (envelope-from melifaro@FreeBSD.org) Received: (from melifaro@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AULgtM4060212; Mon, 30 Nov 2020 21:42:55 GMT (envelope-from melifaro@FreeBSD.org) Message-Id: <202011302142.0AULgtM4060212@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: melifaro set sender to melifaro@FreeBSD.org using -f From: "Alexander V. Chernikov" Date: Mon, 30 Nov 2020 21:42:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368198 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: melifaro X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 368198 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Nov 2020 21:42:55 -0000 Author: melifaro Date: Mon Nov 30 21:42:55 2020 New Revision: 368198 URL: https://svnweb.freebsd.org/changeset/base/368198 Log: Renumber NHR_* flags after NHR_IFAIF removal in r368127. Suggested by: rpokala Modified: head/sys/net/route.h Modified: head/sys/net/route.h ============================================================================== --- head/sys/net/route.h Mon Nov 30 21:05:31 2020 (r368197) +++ head/sys/net/route.h Mon Nov 30 21:42:55 2020 (r368198) @@ -223,10 +223,8 @@ VNET_DECLARE(u_int, fib_hash_outbound); /* Nexthop request flags */ #define NHR_NONE 0x00 /* empty flags field */ -#define NHR_REF 0x02 /* reference nexhop */ - -/* uRPF */ -#define NHR_NODEFAULT 0x04 /* do not consider default route */ +#define NHR_REF 0x01 /* reference nexhop */ +#define NHR_NODEFAULT 0x02 /* uRPF: do not consider default route */ /* Control plane route request flags */ #define NHR_COPY 0x100 /* Copy rte data */ From owner-svn-src-head@freebsd.org Mon Nov 30 21:59:53 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 427964A94FD; Mon, 30 Nov 2020 21:59:53 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4ClK091Sfpz4mML; Mon, 30 Nov 2020 21:59:53 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1A9A52722; Mon, 30 Nov 2020 21:59:53 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AULxqCW067093; Mon, 30 Nov 2020 21:59:52 GMT (envelope-from melifaro@FreeBSD.org) Received: (from melifaro@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AULxqtu067092; Mon, 30 Nov 2020 21:59:52 GMT (envelope-from melifaro@FreeBSD.org) Message-Id: <202011302159.0AULxqtu067092@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: melifaro set sender to melifaro@FreeBSD.org using -f From: "Alexander V. Chernikov" Date: Mon, 30 Nov 2020 21:59:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368199 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: melifaro X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 368199 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Nov 2020 21:59:53 -0000 Author: melifaro Date: Mon Nov 30 21:59:52 2020 New Revision: 368199 URL: https://svnweb.freebsd.org/changeset/base/368199 Log: Move inner loop logic out of sysctl_sysctl_next_ls(). Refactor sysctl_sysctl_next_ls(): * Move huge inner loop out of sysctl_sysctl_next_ls() into a separate non-recursive function, returning the next step to be taken. * Update resulting node oid parts only on successful lookup * Make sysctl_sysctl_next_ls() return boolean success/failure instead of errno, slightly simplifying logic Reviewed by: freqlabs Differential Revision: https://reviews.freebsd.org/D27029 Modified: head/sys/kern/kern_sysctl.c Modified: head/sys/kern/kern_sysctl.c ============================================================================== --- head/sys/kern/kern_sysctl.c Mon Nov 30 21:42:55 2020 (r368198) +++ head/sys/kern/kern_sysctl.c Mon Nov 30 21:59:52 2020 (r368199) @@ -1100,109 +1100,148 @@ sysctl_sysctl_name(SYSCTL_HANDLER_ARGS) static SYSCTL_NODE(_sysctl, CTL_SYSCTL_NAME, name, CTLFLAG_RD | CTLFLAG_MPSAFE | CTLFLAG_CAPRD, sysctl_sysctl_name, ""); +enum sysctl_iter_action { + ITER_SIBLINGS, /* Not matched, continue iterating siblings */ + ITER_CHILDREN, /* Node has children we need to iterate over them */ + ITER_FOUND, /* Matching node was found */ +}; + /* - * Walk the sysctl subtree at lsp until we find the given name, - * and return the next name in order by oid_number. + * Tries to find the next node for @name and @namelen. + * + * Returns next action to take. */ -static int -sysctl_sysctl_next_ls(struct sysctl_oid_list *lsp, int *name, u_int namelen, - int *next, int *len, int level, bool honor_skip) +static enum sysctl_iter_action +sysctl_sysctl_next_node(struct sysctl_oid *oidp, int *name, unsigned int namelen, + bool honor_skip) { - struct sysctl_oid *oidp; - SYSCTL_ASSERT_LOCKED(); - *len = level; - SLIST_FOREACH(oidp, lsp, oid_link) { - *next = oidp->oid_number; + if ((oidp->oid_kind & CTLFLAG_DORMANT) != 0) + return (ITER_SIBLINGS); - if ((oidp->oid_kind & CTLFLAG_DORMANT) != 0) - continue; + if (honor_skip && (oidp->oid_kind & CTLFLAG_SKIP) != 0) + return (ITER_SIBLINGS); - if (honor_skip && (oidp->oid_kind & CTLFLAG_SKIP) != 0) - continue; + if (namelen == 0) { + /* + * We have reached a node with a full name match and are + * looking for the next oid in its children. + * + * For CTL_SYSCTL_NEXTNOSKIP we are done. + * + * For CTL_SYSCTL_NEXT we skip CTLTYPE_NODE (unless it + * has a handler) and move on to the children. + */ + if (!honor_skip) + return (ITER_FOUND); + if ((oidp->oid_kind & CTLTYPE) != CTLTYPE_NODE) + return (ITER_FOUND); + /* If node does not have an iterator, treat it as leaf */ + if (oidp->oid_handler) + return (ITER_FOUND); - if (namelen == 0) { - /* - * We have reached a node with a full name match and are - * looking for the next oid in its children. - * - * For CTL_SYSCTL_NEXTNOSKIP we are done. - * - * For CTL_SYSCTL_NEXT we skip CTLTYPE_NODE (unless it - * has a handler) and move on to the children. - */ - if (!honor_skip) - return (0); - if ((oidp->oid_kind & CTLTYPE) != CTLTYPE_NODE) - return (0); - if (oidp->oid_handler) - return (0); - lsp = SYSCTL_CHILDREN(oidp); - if (!sysctl_sysctl_next_ls(lsp, NULL, 0, next + 1, len, - level + 1, honor_skip)) - return (0); - /* - * There were no useable children in this node. - * Continue searching for the next oid at this level. - */ - goto emptynode; - } + /* Report oid as a node to iterate */ + return (ITER_CHILDREN); + } + /* + * No match yet. Continue seeking the given name. + * + * We are iterating in order by oid_number, so skip oids lower + * than the one we are looking for. + * + * When the current oid_number is higher than the one we seek, + * that means we have reached the next oid in the sequence and + * should return it. + * + * If the oid_number matches the name at this level then we + * have to find a node to continue searching at the next level. + */ + if (oidp->oid_number < *name) + return (ITER_SIBLINGS); + if (oidp->oid_number > *name) { /* - * No match yet. Continue seeking the given name. + * We have reached the next oid. * - * We are iterating in order by oid_number, so skip oids lower - * than the one we are looking for. + * For CTL_SYSCTL_NEXTNOSKIP we are done. * - * When the current oid_number is higher than the one we seek, - * that means we have reached the next oid in the sequence and - * should return it. - * - * If the oid_number matches the name at this level then we - * have to find a node to continue searching at the next level. + * For CTL_SYSCTL_NEXT we skip CTLTYPE_NODE (unless it + * has a handler) and move on to the children. */ - if (oidp->oid_number < *name) - continue; - if (oidp->oid_number > *name) { - /* - * We have reached the next oid. - * - * For CTL_SYSCTL_NEXTNOSKIP we are done. - * - * For CTL_SYSCTL_NEXT we skip CTLTYPE_NODE (unless it - * has a handler) and move on to the children. - */ - if (!honor_skip) - return (0); - if ((oidp->oid_kind & CTLTYPE) != CTLTYPE_NODE) - return (0); - if (oidp->oid_handler) - return (0); - lsp = SYSCTL_CHILDREN(oidp); - if (!sysctl_sysctl_next_ls(lsp, name + 1, namelen - 1, - next + 1, len, level + 1, honor_skip)) - return (0); - goto next; - } + if (!honor_skip) + return (ITER_FOUND); if ((oidp->oid_kind & CTLTYPE) != CTLTYPE_NODE) - continue; + return (ITER_FOUND); + /* If node does not have an iterator, treat it as leaf */ if (oidp->oid_handler) + return (ITER_FOUND); + return (ITER_CHILDREN); + } + + /* match at a current level */ + if ((oidp->oid_kind & CTLTYPE) != CTLTYPE_NODE) + return (ITER_SIBLINGS); + if (oidp->oid_handler) + return (ITER_SIBLINGS); + + return (ITER_CHILDREN); +} + +/* + * Recursively walk the sysctl subtree at lsp until we find the given name. + * Returns true and fills in next oid data in @next and @len if oid is found. + */ +static bool +sysctl_sysctl_next_action(struct sysctl_oid_list *lsp, int *name, u_int namelen, + int *next, int *len, int level, bool honor_skip) +{ + struct sysctl_oid *oidp; + bool success = false; + enum sysctl_iter_action action; + + SYSCTL_ASSERT_LOCKED(); + SLIST_FOREACH(oidp, lsp, oid_link) { + action = sysctl_sysctl_next_node(oidp, name, namelen, honor_skip); + if (action == ITER_SIBLINGS) continue; + if (action == ITER_FOUND) { + success = true; + break; + } + KASSERT((action== ITER_CHILDREN), ("ret(%d)!=ITER_CHILDREN", action)); + lsp = SYSCTL_CHILDREN(oidp); - if (!sysctl_sysctl_next_ls(lsp, name + 1, namelen - 1, - next + 1, len, level + 1, honor_skip)) - return (0); - next: - /* - * There were no useable children in this node. - * Continue searching for the next oid at the root level. - */ - namelen = 1; - emptynode: - /* Reset len in case a failed recursive call changed it. */ - *len = level; + if (namelen == 0) { + success = sysctl_sysctl_next_action(lsp, NULL, 0, + next + 1, len, level + 1, honor_skip); + } else { + success = sysctl_sysctl_next_action(lsp, name + 1, namelen - 1, + next + 1, len, level + 1, honor_skip); + if (!success) { + + /* + * We maintain the invariant that current node oid + * is >= the oid provided in @name. + * As there are no usable children at this node, + * current node oid is strictly > than the requested + * oid. + * Hence, reduce namelen to 0 to allow for picking first + * nodes/leafs in the next node in list. + */ + namelen = 0; + } + } + if (success) + break; } - return (ENOENT); + + if (success) { + *next = oidp->oid_number; + if (level > *len) + *len = level; + } + + return (success); } static int @@ -1211,16 +1250,18 @@ sysctl_sysctl_next(SYSCTL_HANDLER_ARGS) int *name = (int *) arg1; u_int namelen = arg2; int len, error; + bool success; struct sysctl_oid_list *lsp = &sysctl__children; struct rm_priotracker tracker; int next[CTL_MAXNAME]; + len = 0; SYSCTL_RLOCK(&tracker); - error = sysctl_sysctl_next_ls(lsp, name, namelen, next, &len, 1, + success = sysctl_sysctl_next_action(lsp, name, namelen, next, &len, 1, oidp->oid_number == CTL_SYSCTL_NEXT); SYSCTL_RUNLOCK(&tracker); - if (error) - return (error); + if (!success) + return (ENOENT); error = SYSCTL_OUT(req, next, len * sizeof (int)); return (error); } From owner-svn-src-head@freebsd.org Mon Nov 30 22:16:11 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EBDF64AA08E; Mon, 30 Nov 2020 22:16:11 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4ClKLz6Njbz4nXJ; Mon, 30 Nov 2020 22:16:11 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CE34F293C; Mon, 30 Nov 2020 22:16:11 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0AUMGB24079193; Mon, 30 Nov 2020 22:16:11 GMT (envelope-from mhorne@FreeBSD.org) Received: (from mhorne@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0AUMGBVW079192; Mon, 30 Nov 2020 22:16:11 GMT (envelope-from mhorne@FreeBSD.org) Message-Id: <202011302216.0AUMGBVW079192@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mhorne set sender to mhorne@FreeBSD.org using -f From: Mitchell Horne Date: Mon, 30 Nov 2020 22:16:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368200 - head/usr.sbin/efibootmgr X-SVN-Group: head X-SVN-Commit-Author: mhorne X-SVN-Commit-Paths: head/usr.sbin/efibootmgr X-SVN-Commit-Revision: 368200 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 30 Nov 2020 22:16:12 -0000 Author: mhorne Date: Mon Nov 30 22:16:11 2020 New Revision: 368200 URL: https://svnweb.freebsd.org/changeset/base/368200 Log: efibootmgr: fix an incorrect error handling check efivar_device_path_to_unix_path() returns standard error codes on failure and zero on success. Checking for a return value less than zero means that the actual failure cases won't be handled. This could manifest as a segfault during the subsequent call to printf(). Reviewed by: imp MFC after: 3 days Differential Revision: https://reviews.freebsd.org/D27424 Modified: head/usr.sbin/efibootmgr/efibootmgr.c Modified: head/usr.sbin/efibootmgr/efibootmgr.c ============================================================================== --- head/usr.sbin/efibootmgr/efibootmgr.c Mon Nov 30 21:59:52 2020 (r368199) +++ head/usr.sbin/efibootmgr/efibootmgr.c Mon Nov 30 22:16:11 2020 (r368200) @@ -1034,7 +1034,7 @@ report_esp_device(bool do_dp, bool do_unix) printf("%s\n", buf); exit(0); } - if (efivar_device_path_to_unix_path(dp, &dev, &relpath, &abspath) < 0) + if (efivar_device_path_to_unix_path(dp, &dev, &relpath, &abspath) != 0) errx(1, "Can't convert to unix path"); if (do_unix) { if (abspath == NULL) From owner-svn-src-head@freebsd.org Tue Dec 1 02:29:10 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 60847468F85; Tue, 1 Dec 2020 02:29:10 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4ClQyt2KR1z3MmJ; Tue, 1 Dec 2020 02:29:10 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from mail-qk1-f179.google.com (mail-qk1-f179.google.com [209.85.222.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) (Authenticated sender: kevans) by smtp.freebsd.org (Postfix) with ESMTPSA id 3C8324630; Tue, 1 Dec 2020 02:29:10 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: by mail-qk1-f179.google.com with SMTP id u4so37256qkk.10; Mon, 30 Nov 2020 18:29:10 -0800 (PST) X-Gm-Message-State: AOAM531w3u2Ggiig3O/vVWeVnFKr2x56cn5KovcWccZ300pCrDsOtYG6 oBCaXxqt9QUCWs+Gj+mYeMRWDjzTTQCs04G49Ng= X-Google-Smtp-Source: ABdhPJw8QOkbAQn/0bN8osIueOCCXIj6JfI4BtS4AJLEzzn4KtD0QM9xBYousJ8VQwvAdl0DVLRHkrp7r845q+ZpODs= X-Received: by 2002:a37:9ecc:: with SMTP id h195mr734029qke.103.1606789749398; Mon, 30 Nov 2020 18:29:09 -0800 (PST) MIME-Version: 1.0 References: <202011302105.0AUL5VHd035423@repo.freebsd.org> In-Reply-To: <202011302105.0AUL5VHd035423@repo.freebsd.org> From: Kyle Evans Date: Mon, 30 Nov 2020 20:28:58 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r368197 - head/sbin/bectl To: Gleb Smirnoff Cc: src-committers , svn-src-all , svn-src-head Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Dec 2020 02:29:10 -0000 On Mon, Nov 30, 2020 at 3:05 PM Gleb Smirnoff wrote: > > Author: glebius > Date: Mon Nov 30 21:05:31 2020 > New Revision: 368197 > URL: https://svnweb.freebsd.org/changeset/base/368197 > > Log: > Print at least something when failing. > > Modified: > head/sbin/bectl/bectl.c > > Modified: head/sbin/bectl/bectl.c > ============================================================================== > --- head/sbin/bectl/bectl.c Mon Nov 30 20:58:42 2020 (r368196) > +++ head/sbin/bectl/bectl.c Mon Nov 30 21:05:31 2020 (r368197) > @@ -584,8 +584,11 @@ main(int argc, char *argv[]) > return (usage(false)); > } > > - if ((be = libbe_init(root)) == NULL) > + if ((be = libbe_init(root)) == NULL) { > + fprintf(stderr, "libbe_init(\"%s\") failed.\n", > + root != NULL ? root : ""); > return (-1); > + } > > libbe_print_on_error(be, !cmd->silent); > This should be gated on !cmd->silent, because some paths have consumers that are specifically designed to not have to deal with redirecting stderr. It was quite intentional that this didn't previously print anything. Thanks, Kyle Evans From owner-svn-src-head@freebsd.org Tue Dec 1 08:52:14 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3257F4A2A57; Tue, 1 Dec 2020 08:52:14 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4ClbSt0tGkz3DPP; Tue, 1 Dec 2020 08:52:14 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1163613190; Tue, 1 Dec 2020 08:52:14 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B18qDUr096065; Tue, 1 Dec 2020 08:52:13 GMT (envelope-from mmel@FreeBSD.org) Received: (from mmel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B18qDHN096064; Tue, 1 Dec 2020 08:52:13 GMT (envelope-from mmel@FreeBSD.org) Message-Id: <202012010852.0B18qDHN096064@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmel set sender to mmel@FreeBSD.org using -f From: Michal Meloun Date: Tue, 1 Dec 2020 08:52:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368203 - head/sys/dev/nvme X-SVN-Group: head X-SVN-Commit-Author: mmel X-SVN-Commit-Paths: head/sys/dev/nvme X-SVN-Commit-Revision: 368203 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Dec 2020 08:52:14 -0000 Author: mmel Date: Tue Dec 1 08:52:13 2020 New Revision: 368203 URL: https://svnweb.freebsd.org/changeset/base/368203 Log: Always use the __unused attribute even for potentially unused parameters. Requested by: ian, imp MFC with: r368167 Modified: head/sys/dev/nvme/nvme.h Modified: head/sys/dev/nvme/nvme.h ============================================================================== --- head/sys/dev/nvme/nvme.h Tue Dec 1 03:07:26 2020 (r368202) +++ head/sys/dev/nvme/nvme.h Tue Dec 1 08:52:13 2020 (r368203) @@ -1728,15 +1728,9 @@ extern int nvme_use_nvd; #endif /* _KERNEL */ -#if _BYTE_ORDER != _LITTLE_ENDIAN -#define MODIF -#else -#define MODIF __unused -#endif - /* Endianess conversion functions for NVMe structs */ static inline -void nvme_completion_swapbytes(struct nvme_completion *s MODIF) +void nvme_completion_swapbytes(struct nvme_completion *s __unused) { #if _BYTE_ORDER != _LITTLE_ENDIAN @@ -1750,7 +1744,7 @@ void nvme_completion_swapbytes(struct nvme_completion } static inline -void nvme_power_state_swapbytes(struct nvme_power_state *s MODIF) +void nvme_power_state_swapbytes(struct nvme_power_state *s __unused) { #if _BYTE_ORDER != _LITTLE_ENDIAN @@ -1763,7 +1757,7 @@ void nvme_power_state_swapbytes(struct nvme_power_stat } static inline -void nvme_controller_data_swapbytes(struct nvme_controller_data *s MODIF) +void nvme_controller_data_swapbytes(struct nvme_controller_data *s __unused) { #if _BYTE_ORDER != _LITTLE_ENDIAN int i; @@ -1815,7 +1809,7 @@ void nvme_controller_data_swapbytes(struct nvme_contro } static inline -void nvme_namespace_data_swapbytes(struct nvme_namespace_data *s MODIF) +void nvme_namespace_data_swapbytes(struct nvme_namespace_data *s __unused) { #if _BYTE_ORDER != _LITTLE_ENDIAN int i; @@ -1845,7 +1839,7 @@ void nvme_namespace_data_swapbytes(struct nvme_namespa static inline void nvme_error_information_entry_swapbytes( - struct nvme_error_information_entry *s MODIF) + struct nvme_error_information_entry *s __unused) { #if _BYTE_ORDER != _LITTLE_ENDIAN @@ -1862,7 +1856,7 @@ void nvme_error_information_entry_swapbytes( } static inline -void nvme_le128toh(void *p MODIF) +void nvme_le128toh(void *p __unused) { #if _BYTE_ORDER != _LITTLE_ENDIAN /* Swap 16 bytes in place */ @@ -1879,7 +1873,7 @@ void nvme_le128toh(void *p MODIF) static inline void nvme_health_information_page_swapbytes( - struct nvme_health_information_page *s MODIF) + struct nvme_health_information_page *s __unused) { #if _BYTE_ORDER != _LITTLE_ENDIAN int i; @@ -1907,7 +1901,7 @@ void nvme_health_information_page_swapbytes( } static inline -void nvme_firmware_page_swapbytes(struct nvme_firmware_page *s MODIF) +void nvme_firmware_page_swapbytes(struct nvme_firmware_page *s __unused) { #if _BYTE_ORDER != _LITTLE_ENDIAN int i; @@ -1918,7 +1912,7 @@ void nvme_firmware_page_swapbytes(struct nvme_firmware } static inline -void nvme_ns_list_swapbytes(struct nvme_ns_list *s MODIF) +void nvme_ns_list_swapbytes(struct nvme_ns_list *s __unused) { #if _BYTE_ORDER != _LITTLE_ENDIAN int i; @@ -1930,7 +1924,7 @@ void nvme_ns_list_swapbytes(struct nvme_ns_list *s MOD static inline void nvme_command_effects_page_swapbytes( - struct nvme_command_effects_page *s MODIF) + struct nvme_command_effects_page *s __unused) { #if _BYTE_ORDER != _LITTLE_ENDIAN int i; @@ -1944,7 +1938,7 @@ void nvme_command_effects_page_swapbytes( static inline void nvme_res_notification_page_swapbytes( - struct nvme_res_notification_page *s MODIF) + struct nvme_res_notification_page *s __unused) { #if _BYTE_ORDER != _LITTLE_ENDIAN s->log_page_count = le64toh(s->log_page_count); @@ -1954,7 +1948,7 @@ void nvme_res_notification_page_swapbytes( static inline void nvme_sanitize_status_page_swapbytes( - struct nvme_sanitize_status_page *s MODIF) + struct nvme_sanitize_status_page *s __unused) { #if _BYTE_ORDER != _LITTLE_ENDIAN s->sprog = le16toh(s->sprog); @@ -1970,7 +1964,7 @@ void nvme_sanitize_status_page_swapbytes( } static inline -void intel_log_temp_stats_swapbytes(struct intel_log_temp_stats *s MODIF) +void intel_log_temp_stats_swapbytes(struct intel_log_temp_stats *s __unused) { #if _BYTE_ORDER != _LITTLE_ENDIAN @@ -1987,8 +1981,8 @@ void intel_log_temp_stats_swapbytes(struct intel_log_t } static inline -void nvme_resv_status_swapbytes(struct nvme_resv_status *s MODIF, - size_t size MODIF) +void nvme_resv_status_swapbytes(struct nvme_resv_status *s __unused, + size_t size __unused) { #if _BYTE_ORDER != _LITTLE_ENDIAN u_int i, n; @@ -2005,8 +1999,8 @@ void nvme_resv_status_swapbytes(struct nvme_resv_statu } static inline -void nvme_resv_status_ext_swapbytes(struct nvme_resv_status_ext *s MODIF, - size_t size MODIF) +void nvme_resv_status_ext_swapbytes(struct nvme_resv_status_ext *s __unused, + size_t size __unused) { #if _BYTE_ORDER != _LITTLE_ENDIAN u_int i, n; @@ -2021,6 +2015,5 @@ void nvme_resv_status_ext_swapbytes(struct nvme_resv_s } #endif } -#undef MODIF #endif /* __NVME_H__ */ From owner-svn-src-head@freebsd.org Tue Dec 1 09:18:19 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0DF804A3419; Tue, 1 Dec 2020 09:18:19 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Clc2y6s7xz3F6k; Tue, 1 Dec 2020 09:18:18 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D9C7113689; Tue, 1 Dec 2020 09:18:18 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B19IIw7011879; Tue, 1 Dec 2020 09:18:18 GMT (envelope-from mmel@FreeBSD.org) Received: (from mmel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B19IIWX011878; Tue, 1 Dec 2020 09:18:18 GMT (envelope-from mmel@FreeBSD.org) Message-Id: <202012010918.0B19IIWX011878@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmel set sender to mmel@FreeBSD.org using -f From: Michal Meloun Date: Tue, 1 Dec 2020 09:18:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368204 - head/sys/arm/arm X-SVN-Group: head X-SVN-Commit-Author: mmel X-SVN-Commit-Paths: head/sys/arm/arm X-SVN-Commit-Revision: 368204 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Dec 2020 09:18:19 -0000 Author: mmel Date: Tue Dec 1 09:18:18 2020 New Revision: 368204 URL: https://svnweb.freebsd.org/changeset/base/368204 Log: Remove duplicated SV_ASLR from the elf flags. Reported by: lattera Modified: head/sys/arm/arm/elf_machdep.c Modified: head/sys/arm/arm/elf_machdep.c ============================================================================== --- head/sys/arm/arm/elf_machdep.c Tue Dec 1 08:52:13 2020 (r368203) +++ head/sys/arm/arm/elf_machdep.c Tue Dec 1 09:18:18 2020 (r368204) @@ -86,7 +86,7 @@ struct sysentvec elf32_freebsd_sysvec = { .sv_maxssiz = NULL, .sv_flags = SV_ASLR | SV_SHP | SV_TIMEKEEP | SV_RNG_SEED_VER | - SV_ABI_FREEBSD | SV_ILP32 | SV_ASLR, + SV_ABI_FREEBSD | SV_ILP32, .sv_set_syscall_retval = cpu_set_syscall_retval, .sv_fetch_syscall_args = cpu_fetch_syscall_args, .sv_syscallnames = syscallnames, From owner-svn-src-head@freebsd.org Tue Dec 1 10:10:19 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 894D34A47BD; Tue, 1 Dec 2020 10:10:19 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [88.99.82.50]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4CldBy4DkXz3HmW; Tue, 1 Dec 2020 10:10:18 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2020.home.selasky.org (unknown [178.17.145.105]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id BED2A26020A; Tue, 1 Dec 2020 11:10:16 +0100 (CET) Subject: Re: svn commit: r367714 - head/sys/kern To: Mateusz Guzik , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <202011160312.0AG3CLcm073334@repo.freebsd.org> From: Hans Petter Selasky Message-ID: <0af338b8-0696-3093-3bd9-8b3ea7207c17@selasky.org> Date: Tue, 1 Dec 2020 11:10:07 +0100 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:78.0) Gecko/20100101 Thunderbird/78.5.0 MIME-Version: 1.0 In-Reply-To: <202011160312.0AG3CLcm073334@repo.freebsd.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4CldBy4DkXz3HmW X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of hps@selasky.org designates 88.99.82.50 as permitted sender) smtp.mailfrom=hps@selasky.org X-Spamd-Result: default: False [-3.27 / 15.00]; ARC_NA(0.00)[]; RCVD_VIA_SMTP_AUTH(0.00)[]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+a:mail.turbocat.net:c]; TO_MATCH_ENVRCPT_ALL(0.00)[]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[selasky.org]; RBL_DBL_DONT_QUERY_IPS(0.00)[88.99.82.50:from]; TO_DN_SOME(0.00)[]; MID_RHS_MATCH_FROM(0.00)[]; SPAMHAUS_ZRD(0.00)[88.99.82.50:from:127.0.2.255]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_HAM_LONG(-1.00)[-1.000]; NEURAL_HAM_SHORT(-0.97)[-0.966]; FROM_EQ_ENVFROM(0.00)[]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:24940, ipnet:88.99.0.0/16, country:DE]; RCVD_COUNT_TWO(0.00)[2]; MAILMAN_DEST(0.00)[svn-src-all,svn-src-head] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Dec 2020 10:10:19 -0000 On 11/16/20 4:12 AM, Mateusz Guzik wrote: > Author: mjg > Date: Mon Nov 16 03:12:21 2020 > New Revision: 367714 > URL: https://svnweb.freebsd.org/changeset/base/367714 > > Log: > select: call seltdfini on process and thread exit > > Since thread_zone is marked NOFREE the thread_fini callback is never > executed, meaning memory allocated by seltdinit is never released. > > Adding the call to thread_dtor is not sufficient as exiting processes > cache the main thread. > > Modified: > head/sys/kern/kern_exit.c > head/sys/kern/kern_thread.c > > Modified: head/sys/kern/kern_exit.c > ============================================================================== > --- head/sys/kern/kern_exit.c Mon Nov 16 03:09:18 2020 (r367713) > +++ head/sys/kern/kern_exit.c Mon Nov 16 03:12:21 2020 (r367714) > @@ -355,6 +355,7 @@ exit1(struct thread *td, int rval, int signo) > PROC_UNLOCK(p); > > umtx_thread_exit(td); > + seltdfini(td); > > /* > * Reset any sigio structures pointing to us as a result of > > Modified: head/sys/kern/kern_thread.c > ============================================================================== > --- head/sys/kern/kern_thread.c Mon Nov 16 03:09:18 2020 (r367713) > +++ head/sys/kern/kern_thread.c Mon Nov 16 03:12:21 2020 (r367714) > @@ -329,6 +329,7 @@ thread_ctor(void *mem, int size, void *arg, int flags) > audit_thread_alloc(td); > #endif > umtx_thread_alloc(td); > + MPASS(td->td_sel == NULL); > return (0); > } > > @@ -369,6 +370,7 @@ thread_dtor(void *mem, int size, void *arg) > osd_thread_exit(td); > td_softdep_cleanup(td); > MPASS(td->td_su == NULL); > + seltdfini(td); > } > > /* > @@ -405,7 +407,7 @@ thread_fini(void *mem, int size) > turnstile_free(td->td_turnstile); > sleepq_free(td->td_sleepqueue); > umtx_thread_fini(td); > - seltdfini(td); > + MPASS(td->td_sel == NULL); > } > > /* Hi, The following panic() has been observed after this change: panic: Assertion mtx_unowned(m) failed at /usr/src/sys/kern/kern_mutex:1181 cpuid = 6 .... panic() _mtx_destroy() seltdfini() exit1() postsig() ast() doreti_ast() --HPS From owner-svn-src-head@freebsd.org Tue Dec 1 11:06:14 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9A4A04A56CE; Tue, 1 Dec 2020 11:06:14 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-wm1-x32b.google.com (mail-wm1-x32b.google.com [IPv6:2a00:1450:4864:20::32b]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4ClfRV3jvxz3Lbh; Tue, 1 Dec 2020 11:06:14 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: by mail-wm1-x32b.google.com with SMTP id g185so4117563wmf.3; Tue, 01 Dec 2020 03:06:14 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=j78UYVpSU56B2+SYIiDn0JgY2GG5OwkC64fUImd6x8g=; b=EqHF0pRejz2nVM7ObettoBEdlm+n3JFfCdPVMA/cNIiUY0JOGLfWDbx69WXYKcTX11 PDQjWvTXzRv8+iBN6/X0Fvf2ujK1kyfzSxhkgXUXK1tapXzg9ndl1O57aV72gJeZmZRE dUf3L5aqWHt3RPstSKE0NjthUnlrIWfcqYI8dXaPz/h+5SglXIpTasPMbWKUuo7so/rF Id5MlgUIDc6/Ret6qN6uLzjNbUww/XnQ2WGNcycApYEFRhu7bqWQA+/TJrVBv8225uI+ xgauWHMTnFtvW7uHzNEaYc82A8guHBLKTlV86yh+iLnTpiBWeHbgdILFJ0xknUGLDFbj G97A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=j78UYVpSU56B2+SYIiDn0JgY2GG5OwkC64fUImd6x8g=; b=bd9mqsg64W022fU/Bfss64DgFuEqE/ebPUThDTXlJWiJuTXwqlU5dPA41veMvHR6Gz VKlgzYJ39B7z/UQn7DVbzgoTGR6X9wPpsUo7l4MrSGN/T3Tu+92mTuobNEOeSbfvC6OL opY/APg9FUwbb83C9/f5Z1yCsonWZYmLu3FzlamzAjH9EdjcFxaYwTzUnspImQXI65OB dUn/10xOMa6uzXUvuBlf0bn0lOeW1xMr58KsGae2tPPGoZnZwf5RlDy30q3U+WShuPrm TbW+f9L4+7yobZytDlijuvNziK/tLC7Xal3t2epQF0XxNGUYQNRAYCd8bTKwKJa3kk7x 1Kpw== X-Gm-Message-State: AOAM5318S8zQ34Gj0sL7auSyBK1wJNq803KijUEQYBdgZ50JTpwWI/ep Wnyo1XqtqaLFhnBWMT3zIpfwRl3Dh4Xa+jVPJN8qxp5gh98= X-Google-Smtp-Source: ABdhPJyAjH6eE5e6MgzqmmeZlDAun4a6JpFsRIoZe7s/BgS9dzI0vrx5QaWCC5TwwvgF0GsMFacy9QWh/gLZ2zV+wjI= X-Received: by 2002:a7b:c012:: with SMTP id c18mr2150446wmb.10.1606820772582; Tue, 01 Dec 2020 03:06:12 -0800 (PST) MIME-Version: 1.0 Received: by 2002:a5d:4d47:0:0:0:0:0 with HTTP; Tue, 1 Dec 2020 03:06:11 -0800 (PST) In-Reply-To: <0af338b8-0696-3093-3bd9-8b3ea7207c17@selasky.org> References: <202011160312.0AG3CLcm073334@repo.freebsd.org> <0af338b8-0696-3093-3bd9-8b3ea7207c17@selasky.org> From: Mateusz Guzik Date: Tue, 1 Dec 2020 12:06:11 +0100 Message-ID: Subject: Re: svn commit: r367714 - head/sys/kern To: Hans Petter Selasky Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4ClfRV3jvxz3Lbh X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Dec 2020 11:06:14 -0000 I see what the bug is, will think about the right fix. Is this reproducible for you? On 12/1/20, Hans Petter Selasky wrote: > On 11/16/20 4:12 AM, Mateusz Guzik wrote: >> Author: mjg >> Date: Mon Nov 16 03:12:21 2020 >> New Revision: 367714 >> URL: https://svnweb.freebsd.org/changeset/base/367714 >> >> Log: >> select: call seltdfini on process and thread exit >> >> Since thread_zone is marked NOFREE the thread_fini callback is never >> executed, meaning memory allocated by seltdinit is never released. >> >> Adding the call to thread_dtor is not sufficient as exiting processes >> cache the main thread. >> >> Modified: >> head/sys/kern/kern_exit.c >> head/sys/kern/kern_thread.c >> >> Modified: head/sys/kern/kern_exit.c >> ============================================================================== >> --- head/sys/kern/kern_exit.c Mon Nov 16 03:09:18 2020 (r367713) >> +++ head/sys/kern/kern_exit.c Mon Nov 16 03:12:21 2020 (r367714) >> @@ -355,6 +355,7 @@ exit1(struct thread *td, int rval, int signo) >> PROC_UNLOCK(p); >> >> umtx_thread_exit(td); >> + seltdfini(td); >> >> /* >> * Reset any sigio structures pointing to us as a result of >> >> Modified: head/sys/kern/kern_thread.c >> ============================================================================== >> --- head/sys/kern/kern_thread.c Mon Nov 16 03:09:18 2020 (r367713) >> +++ head/sys/kern/kern_thread.c Mon Nov 16 03:12:21 2020 (r367714) >> @@ -329,6 +329,7 @@ thread_ctor(void *mem, int size, void *arg, int >> flags) >> audit_thread_alloc(td); >> #endif >> umtx_thread_alloc(td); >> + MPASS(td->td_sel == NULL); >> return (0); >> } >> >> @@ -369,6 +370,7 @@ thread_dtor(void *mem, int size, void *arg) >> osd_thread_exit(td); >> td_softdep_cleanup(td); >> MPASS(td->td_su == NULL); >> + seltdfini(td); >> } >> >> /* >> @@ -405,7 +407,7 @@ thread_fini(void *mem, int size) >> turnstile_free(td->td_turnstile); >> sleepq_free(td->td_sleepqueue); >> umtx_thread_fini(td); >> - seltdfini(td); >> + MPASS(td->td_sel == NULL); >> } >> >> /* > > Hi, > > The following panic() has been observed after this change: > > panic: Assertion mtx_unowned(m) failed at /usr/src/sys/kern/kern_mutex:1181 > cpuid = 6 > .... > panic() > _mtx_destroy() > seltdfini() > exit1() > postsig() > ast() > doreti_ast() > > --HPS > > -- Mateusz Guzik From owner-svn-src-head@freebsd.org Tue Dec 1 11:14:21 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4A0BA4A5A17; Tue, 1 Dec 2020 11:14:21 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [IPv6:2a01:4f8:c17:6c4b::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4Clfcs148lz3M62; Tue, 1 Dec 2020 11:14:20 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2020.home.selasky.org (unknown [178.17.145.105]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 093DF26020A; Tue, 1 Dec 2020 12:14:16 +0100 (CET) Subject: Re: svn commit: r367714 - head/sys/kern To: Mateusz Guzik Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <202011160312.0AG3CLcm073334@repo.freebsd.org> <0af338b8-0696-3093-3bd9-8b3ea7207c17@selasky.org> From: Hans Petter Selasky Message-ID: <6c5a6c72-4ae5-c6d1-2963-f49c42c3e685@selasky.org> Date: Tue, 1 Dec 2020 12:14:08 +0100 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:78.0) Gecko/20100101 Thunderbird/78.5.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4Clfcs148lz3M62 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Dec 2020 11:14:21 -0000 On 12/1/20 12:06 PM, Mateusz Guzik wrote: > I see what the bug is, will think about the right fix. > > Is this reproducible for you? Yes, I have a crash dump. --HPS From owner-svn-src-head@freebsd.org Tue Dec 1 11:26:41 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8DDB54A5E29; Tue, 1 Dec 2020 11:26:41 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-wr1-x429.google.com (mail-wr1-x429.google.com [IPv6:2a00:1450:4864:20::429]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Clfv534k1z3N26; Tue, 1 Dec 2020 11:26:41 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: by mail-wr1-x429.google.com with SMTP id l1so2078046wrb.9; Tue, 01 Dec 2020 03:26:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=IFhc5DDPbp19QReg6Mxs4LvzTK5TV31vtYlU2EPyuFU=; b=Yh2P4JLbc24ry6WihA2VdykfHSZ/Az2xamqDRScJlXuPZ5ZPA2Q1U/Eiu0Q+jdBgkY tRYOweJyo63NDwfL6yVdjZwxFz7s+Z/HYcqulntWp+nyArl5KOAFdouLpG2NsS/9ySCp wDUiWh7GHE5/juGtl8qNQb5D3TzIOvM8wyfcsei2RQ3AsoETo7iJYeGsfvpFYULeXRf3 zUza20OzoyFHQxkOe8n2es4ZcG7211BrYvc6ZvAjKErCXK0JscTSyykWSTkLStK1aur8 ve4OVm0Z2rJZ3AC1V2cYBcMfZuHfgeAjjePrmzB0ts7N6tdAN5zYGRRINOTzDmv3zge6 F6lg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=IFhc5DDPbp19QReg6Mxs4LvzTK5TV31vtYlU2EPyuFU=; b=boGqBfdplhAbE2jDjKDnOASahwfovfOQP3JMI4IkgV31+yCulkFYuPdNVMWSHX+RGM +cYZe3FXaCcfarhPf9R1OJWpW6tFn70Qz5kzc3Mhu4w48Idixu8QzB4k5xiwoNbx7FK4 e6vlzCEFO4MuSoPRlGr7LuIYH1j0PHV90I0Q5INumft1IqKJ6KGozf+85wV19m7zujXk 8fpvj+Z29TvDGE3E664v+qfChP0gjXYMPe+SU5H0efMREOnApaVPRU88WDKHqT1GeDso Un5yWx11UGNSQrDpU9S274WmTfMa2hZJvM/Z/rO2IUGumDDaWvoutL4cxWAPx+aozYKQ MnNg== X-Gm-Message-State: AOAM531FGA1nQcEMeA2+0a2X3pthTm0TyEzXAwuYPy7mU2pTKxEZ8Ec5 wn1ewlR0dlT8gCpl4nT5oX5gXH1aSEUPgnJyzb6nZY+cl50= X-Google-Smtp-Source: ABdhPJxGfGo/SRSKwLiKR4OyXkSDcBaQGQkE4hTf1TIcKUtogmZpt3HtthdZN91DC6PHN9KJQrwUikuFy+a04BjCE2k= X-Received: by 2002:a5d:5741:: with SMTP id q1mr3299344wrw.160.1606822000176; Tue, 01 Dec 2020 03:26:40 -0800 (PST) MIME-Version: 1.0 Received: by 2002:a5d:4d47:0:0:0:0:0 with HTTP; Tue, 1 Dec 2020 03:26:39 -0800 (PST) In-Reply-To: <6c5a6c72-4ae5-c6d1-2963-f49c42c3e685@selasky.org> References: <202011160312.0AG3CLcm073334@repo.freebsd.org> <0af338b8-0696-3093-3bd9-8b3ea7207c17@selasky.org> <6c5a6c72-4ae5-c6d1-2963-f49c42c3e685@selasky.org> From: Mateusz Guzik Date: Tue, 1 Dec 2020 12:26:39 +0100 Message-ID: Subject: Re: svn commit: r367714 - head/sys/kern To: Hans Petter Selasky Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4Clfv534k1z3N26 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Dec 2020 11:26:41 -0000 Does this fix it for you? https://people.freebsd.org/~mjg/poll.diff On 12/1/20, Hans Petter Selasky wrote: > On 12/1/20 12:06 PM, Mateusz Guzik wrote: >> I see what the bug is, will think about the right fix. >> >> Is this reproducible for you? > > Yes, I have a crash dump. > > --HPS > > -- Mateusz Guzik From owner-svn-src-head@freebsd.org Tue Dec 1 11:38:41 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B77244A5D74; Tue, 1 Dec 2020 11:38:41 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [88.99.82.50]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4Clg8x4CvYz3NcW; Tue, 1 Dec 2020 11:38:41 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2020.home.selasky.org (unknown [178.17.145.105]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 90B3326020A; Tue, 1 Dec 2020 12:38:34 +0100 (CET) Subject: Re: svn commit: r367714 - head/sys/kern To: Mateusz Guzik Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <202011160312.0AG3CLcm073334@repo.freebsd.org> <0af338b8-0696-3093-3bd9-8b3ea7207c17@selasky.org> <6c5a6c72-4ae5-c6d1-2963-f49c42c3e685@selasky.org> From: Hans Petter Selasky Message-ID: <635b7c88-0840-2183-4d94-46bdedb2fa5c@selasky.org> Date: Tue, 1 Dec 2020 12:38:27 +0100 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:78.0) Gecko/20100101 Thunderbird/78.5.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4Clg8x4CvYz3NcW X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Dec 2020 11:38:41 -0000 On 12/1/20 12:26 PM, Mateusz Guzik wrote: > Does this fix it for you?https://people.freebsd.org/~mjg/poll.diff Will take some time to reproduce. Testing right now. --HPS From owner-svn-src-head@freebsd.org Tue Dec 1 13:24:21 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6E9BF4A9938; Tue, 1 Dec 2020 13:24:21 +0000 (UTC) (envelope-from o.hartmann@walstatt.org) Received: from mout.gmx.net (mout.gmx.net [212.227.15.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "mout.gmx.net", Issuer "TeleSec ServerPass Class 2 CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CljVr229Vz3nQr; Tue, 1 Dec 2020 13:24:19 +0000 (UTC) (envelope-from o.hartmann@walstatt.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1606829058; bh=kTA+zHEhpWeY1x/0Yo+mxjg80GSA27GUtenfVG5jA9E=; h=X-UI-Sender-Class:Date:From:To:Cc:Subject:In-Reply-To:References; b=eAeazuF7vEVTfKvtIEqJT7tgrvOe1Hmw0lDzHLVkcGOhttDefs/VPchSjCH//lof5 jx3IM9Hclo11KBukWAZfHkdMjNTZekjUx7bOfKXveIqNjqThuQfq960sckpi576RUi MNvxHKwlF4AGCHwMTrPV7ZYTulv25mRiLevtVJBE= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from freyja ([46.88.81.135]) by mail.gmx.com (mrgmx004 [212.227.17.190]) with ESMTPSA (Nemesis) id 1MvK4Z-1jtdg01QI5-00rJL3; Tue, 01 Dec 2020 14:24:17 +0100 Date: Tue, 1 Dec 2020 14:24:04 +0100 From: "O. Hartmann" To: Matt Macy Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r368163 - in head: sbin/ifconfig sys/dev/if_wg sys/dev/if_wg/include sys/dev/if_wg/include/crypto sys/dev/if_wg/include/sys sys/dev/if_wg/include/zinc sys/dev/if_wg/module sys/dev/if_wg... Message-ID: <20201201142358.57225902@freyja> In-Reply-To: <202011291938.0ATJc4Z3081193@repo.freebsd.org> References: <202011291938.0ATJc4Z3081193@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:JA+MlFen6J67gBDSDYTzJNHrUdphU1Cep+O+gTDt8EHg6ldZ/mc unL8ZYp1sKU2UvvNYkz6vbe6tFN+33bUAa1ugh5Ctw0nQgU+e658jjYW0Tyk53T1YH1qdCk TqdV6x6BdrTXVkkcmzExNLTlLPI6z7AzP0Po3NR0jq2hn8c5rLHx+sQJTNsHowJyt84g11H Aep+wmhYSAt/DE8pONTpw== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:w0in/OfTLW8=:6WyBDZhjMM29B9HLg7R8XC ixLPmJJWPS8VKH6At8jsODXAQh4zNqFhqRmxhA35yqZbMW5/KX1UTxyz8foSrk5+FsHH6t1Tg y3nuRCifzRDk+giGDWWEexuYxWNW8115+zjIlpE3M/68BSf4ieBNOKPQT4rZ3iv+pF1D4x/uh j3aRuiZh2/fWnE4IJhl0MOhABV0aWhIuNX1LeLDtOYV4JRfb50TkgfJ7O3vM2qFSlgpJ7Gspz HpVD7X0JCp8umSf5P0XQwoRz4z0NEF6+d29j9omC5P28h0+h+hCeN7pP4LfCuf4IzM/g/Vazi bPbTz3lmmIQetRWjNrnwXKAWxrxyKtVzdD4ITxgBCDz9DE5H73oK0IhgaXKCWJYW+v/vKNEMW mywa5bT7EKYBSeo6CqDQwobIr9uDbsyHb3q/3r9e0WBcbmaAgIqPIZ6xTz9DLyEWZ5HhkhG0T OtXPs1oTI82r3+NA3k1hq/ET9IpVKI+MC9X4xK5e6ctZMzxHsVA+zM6zgjvFX28NG0xRq0XvU 1U1bdl19FWXSmScUDAAl6+qlcOFXYCS5tOW+REzGVKWSPfouljw0GWq8CN13Vy6Sr2SOvA4+4 9pvFualQJpJ9o7lKizUuKj8V9/XNY2hXI897/nEMBUUlXynhqbxtDBmcKsv7iWlVK1fYjgxJh oc1cdvDK00/oXvf2jmBe8NTTqRzWxEaFQ37XKeMsMeryIpdVKTZKNfwd5s3om6T37S9Q+eswn HU6edMf4H8b/Ngz+53AbxnMefrfF43uqK7jtridBfyf34vqVVP0onb2CesGkwU3/q+x9Lv/Hw 3IFEYioUaSCMtZ2zUG35VIW3wqu56DuVeSj1sguPcCthlOoVbZ72dM/uFup4h0sygJhNa4UHM D3JIrVe/b6MAstFmhQjw== X-Rspamd-Queue-Id: 4CljVr229Vz3nQr X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmx.net header.s=badeba3b8450 header.b=eAeazuF7; dmarc=none; spf=none (mx1.freebsd.org: domain of o.hartmann@walstatt.org has no SPF policy when checking 212.227.15.18) smtp.mailfrom=o.hartmann@walstatt.org X-Spamd-Result: default: False [-2.90 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; DKIM_TRACE(0.00)[gmx.net:+]; NEURAL_HAM_SHORT(-1.00)[-1.000]; RCVD_IN_DNSWL_LOW(-0.10)[212.227.15.18:from]; FROM_EQ_ENVFROM(0.00)[]; RBL_DBL_DONT_QUERY_IPS(0.00)[212.227.15.18:from]; RECEIVED_SPAMHAUS_PBL(0.00)[46.88.81.135:received]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:8560, ipnet:212.227.0.0/16, country:DE]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[gmx.net:s=badeba3b8450]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[walstatt.org]; SPAMHAUS_ZRD(0.00)[212.227.15.18:from:127.0.2.255]; R_SPF_NA(0.00)[no SPF record]; RWL_MAILSPIKE_POSSIBLE(0.00)[212.227.15.18:from]; MID_RHS_NOT_FQDN(0.50)[]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; MAILMAN_DEST(0.00)[svn-src-all,svn-src-head] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Dec 2020 13:24:21 -0000 On Sun, 29 Nov 2020 19:38:04 +0000 (UTC) Matt Macy wrote: > Author: mmacy > Date: Sun Nov 29 19:38:03 2020 > New Revision: 368163 > URL: https://svnweb.freebsd.org/changeset/base/368163 > > Log: > Import kernel WireGuard support > > Data path largely shared with the OpenBSD implementation by > Matt Dunwoodie > > Reviewed by: grehan@freebsd.org > MFC after: 1 month > Sponsored by: Rubicon LLC, (Netgate) > Differential Revision: https://reviews.freebsd.org/D26137 > > Added: > head/sbin/ifconfig/ifwg.c (contents, props changed) > head/sys/dev/if_wg/ > head/sys/dev/if_wg/include/ > head/sys/dev/if_wg/include/crypto/blake2s.h (contents, props changed= ) > head/sys/dev/if_wg/include/crypto/curve25519.h (contents, props chan= ged) > head/sys/dev/if_wg/include/crypto/zinc.h (contents, props changed) > head/sys/dev/if_wg/include/sys/ > head/sys/dev/if_wg/include/sys/if_wg_session.h (contents, props chan= ged) > head/sys/dev/if_wg/include/sys/if_wg_session_vars.h (contents, props > changed) head/sys/dev/if_wg/include/sys/simd-x86_64.h (contents, props > changed) head/sys/dev/if_wg/include/sys/support.h (contents, props cha= nged) > head/sys/dev/if_wg/include/sys/wg_cookie.h (contents, props changed) > head/sys/dev/if_wg/include/sys/wg_module.h (contents, props changed) > head/sys/dev/if_wg/include/sys/wg_noise.h (contents, props changed) > head/sys/dev/if_wg/include/zinc/blake2s.h (contents, props changed) > head/sys/dev/if_wg/include/zinc/chacha20.h (contents, props changed) > head/sys/dev/if_wg/include/zinc/chacha20poly1305.h (contents, props > changed) head/sys/dev/if_wg/include/zinc/curve25519.h (contents, props > changed) head/sys/dev/if_wg/include/zinc/poly1305.h (contents, props > changed) head/sys/dev/if_wg/module/ > head/sys/dev/if_wg/module/blake2s.c (contents, props changed) > head/sys/dev/if_wg/module/blake2s.h (contents, props changed) > head/sys/dev/if_wg/module/chacha20-x86_64.S (contents, props changed= ) > head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20-arm-glue.c > (contents, props changed) > head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20-arm.pl (conten= ts, > props changed) > head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20-arm64.pl (cont= ents, > props changed) > head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20-mips-glue.c > (contents, props changed) > head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20-mips.S (conten= ts, > props changed) > head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20-unrolled-arm.S > (contents, props changed) > head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20-x86_64-glue.c > (contents, props changed) > head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20-x86_64.pl > (contents, props changed) > head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20.c (contents, p= rops > changed) head/sys/dev/if_wg/module/crypto/zinc/chacha20poly1305.c > (contents, props changed) > head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-arm-glue.c > (contents, props changed) > head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-arm.pl (conten= ts, > props changed) > head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-arm64.pl (cont= ents, > props changed) > head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-donna32.c > (contents, props changed) > head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-donna64.c > (contents, props changed) > head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-mips-glue.c > (contents, props changed) > head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-mips.S (conten= ts, > props changed) > head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-mips64.pl > (contents, props changed) > head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-x86_64-glue.c > (contents, props changed) > head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-x86_64.pl > (contents, props changed) > head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305.c (contents, p= rops > changed) head/sys/dev/if_wg/module/crypto/zinc/selftest/blake2s.c > (contents, props changed) > head/sys/dev/if_wg/module/crypto/zinc/selftest/chacha20.c (contents, p= rops > changed) head/sys/dev/if_wg/module/crypto/zinc/selftest/chacha20poly1305= .c > (contents, props changed) > head/sys/dev/if_wg/module/crypto/zinc/selftest/curve25519.c (contents, > props changed) head/sys/dev/if_wg/module/crypto/zinc/selftest/poly1305.c > (contents, props changed) > head/sys/dev/if_wg/module/crypto/zinc/selftest/run.h (contents, props > changed) head/sys/dev/if_wg/module/curve25519.c (contents, props chang= ed) > head/sys/dev/if_wg/module/if_wg_session.c (contents, props changed) > head/sys/dev/if_wg/module/module.c (contents, props changed) > head/sys/dev/if_wg/module/poly1305-x86_64.S (contents, props changed) > head/sys/dev/if_wg/module/wg_cookie.c (contents, props changed) > head/sys/dev/if_wg/module/wg_noise.c (contents, props changed) > head/sys/modules/if_wg/ head/sys/modules/if_wg/Makefile (contents, pro= ps > changed) Directory Properties: head/sys/dev/if_wg/include/crypto/ (pro= ps > changed) head/sys/dev/if_wg/include/zinc/ (props changed) > head/sys/dev/if_wg/module/crypto/ (props changed) > head/sys/dev/if_wg/module/crypto/zinc/ (props changed) > head/sys/dev/if_wg/module/crypto/zinc/chacha20/ (props changed) > head/sys/dev/if_wg/module/crypto/zinc/poly1305/ (props changed) > head/sys/dev/if_wg/module/crypto/zinc/selftest/ (props changed) Modifi= ed: > head/sbin/ifconfig/Makefile head/sys/kern/subr_gtaskqueue.c > head/sys/modules/Makefile head/sys/net/iflib_clone.c head/sys/sys/gtaskq= ueue.h > > Modified: head/sbin/ifconfig/Makefile > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D > --- head/sbin/ifconfig/Makefile Sun Nov 29 19:06:32 2020 > (r368162) +++ head/sbin/ifconfig/Makefile Sun Nov 29 19:38:03 > 2020 (r368163) @@ -35,6 +35,7 @@ SRCS+=3D ifvxlan.c > # VXLAN support SRCS+=3D ifgre.c # GRE > keys etc SRCS+=3D ifgif.c # GIF reversed header > workaround SRCS+=3D ifipsec.c # IPsec VTI > +SRCS+=3D ifwg.c # Wireguard > > SRCS+=3D sfp.c # SFP/SFP+ information > LIBADD+=3D ifconfig m util > @@ -68,6 +69,7 @@ CFLAGS+=3D -DINET > CFLAGS+=3D -DJAIL > LIBADD+=3D jail > .endif > +LIBADD+=3D nv > > MAN=3D ifconfig.8 > > > Added: head/sbin/ifconfig/ifwg.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/sbin/ifconfig/ifwg.c Sun Nov 29 19:38:03 2020 (r368163) > @@ -0,0 +1,618 @@ > +/*- > + * SPDX-License-Identifier: BSD-2-Clause > + * > + * Copyright (c) 2020 Rubicon Communications, LLC (Netgate) > + * > + * Redistribution and use in source and binary forms, with or without > + * modification, are permitted provided that the following conditions > + * are met: > + * 1. Redistributions of source code must retain the above copyright > + * notice, this list of conditions and the following disclaimer. > + * 2. Redistributions in binary form must reproduce the above copyrig= ht > + * notice, this list of conditions and the following disclaimer in= the > + * documentation and/or other materials provided with the distribu= tion. > + * > + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' A= ND > + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, TH= E > + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR P= URPOSE > + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIA= BLE > + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQU= ENTIAL > + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GO= ODS > + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION= ) > + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, = STRICT > + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN AN= Y WAY > + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY = OF > + * SUCH DAMAGE. > + */ > + > +#include > +__FBSDID("$FreeBSD$"); > + > +#ifndef RESCUE > +#include > +#include > +#include > +#include > +#include > +#include > + > +#include > +#include > +#include > +#include > +#include > +#include > + > +#include > +#include > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include /* NB: for offsetof */ > +#include > +#include > +#include > + > +#include "ifconfig.h" > + > +typedef enum { > + WGC_GET =3D 0x5, > + WGC_SET =3D 0x6, > +} wg_cmd_t; > + > +static nvlist_t *nvl_params; > +static bool do_peer; > +static int allowed_ips_count; > +static int allowed_ips_max; > +struct allowedip { > + struct sockaddr_storage a_addr; > + struct sockaddr_storage a_mask; > +}; > +struct allowedip *allowed_ips; > + > +#define ALLOWEDIPS_START 16 > +#define WG_KEY_LEN 32 > +#define WG_KEY_LEN_BASE64 ((((WG_KEY_LEN) + 2) / 3) * 4 + 1) > +#define WG_KEY_LEN_HEX (WG_KEY_LEN * 2 + 1) > +#define WG_MAX_STRLEN 64 > + > +static bool > +key_from_base64(uint8_t key[static WG_KEY_LEN], const char *base64) > +{ > + > + if (strlen(base64) !=3D WG_KEY_LEN_BASE64 - 1) { > + warnx("bad key len - need %d got %zu\n", WG_KEY_LEN_BASE64 - > 1, strlen(base64)); > + return false; > + } > + if (base64[WG_KEY_LEN_BASE64 - 2] !=3D '=3D') { > + warnx("bad key terminator, expected '=3D' got '%c'", > base64[WG_KEY_LEN_BASE64 - 2]); > + return false; > + } > + return (b64_pton(base64, key, WG_KEY_LEN)); > +} > + > +static void > +parse_endpoint(const char *endpoint_) > +{ > + int err; > + char *base, *endpoint, *port, *colon, *tmp; > + struct addrinfo hints, *res; > + > + endpoint =3D base =3D strdup(endpoint_); > + colon =3D rindex(endpoint, ':'); > + if (colon =3D=3D NULL) > + errx(1, "bad endpoint format %s - no port delimiter found", > endpoint); > + *colon =3D '\0'; > + port =3D colon + 1; > + > + /* [::]:<> */ > + if (endpoint[0] =3D=3D '[') { > + endpoint++; > + tmp =3D index(endpoint, ']'); > + if (tmp =3D=3D NULL) > + errx(1, "bad endpoint format %s - '[' found with no > matching ']'", endpoint); > + *tmp =3D '\0'; > + } > + bzero(&hints, sizeof(hints)); > + hints.ai_family =3D AF_UNSPEC; > + err =3D getaddrinfo(endpoint, port, &hints, &res); > + if (err) > + errx(1, "%s", gai_strerror(err)); > + nvlist_add_binary(nvl_params, "endpoint", res->ai_addr, > res->ai_addrlen); > + freeaddrinfo(res); > + free(base); > +} > + > +static void > +in_len2mask(struct in_addr *mask, u_int len) > +{ > + u_int i; > + u_char *p; > + > + p =3D (u_char *)mask; > + memset(mask, 0, sizeof(*mask)); > + for (i =3D 0; i < len / NBBY; i++) > + p[i] =3D 0xff; > + if (len % NBBY) > + p[i] =3D (0xff00 >> (len % NBBY)) & 0xff; > +} > + > +static u_int > +in_mask2len(struct in_addr *mask) > +{ > + u_int x, y; > + u_char *p; > + > + p =3D (u_char *)mask; > + for (x =3D 0; x < sizeof(*mask); x++) { > + if (p[x] !=3D 0xff) > + break; > + } > + y =3D 0; > + if (x < sizeof(*mask)) { > + for (y =3D 0; y < NBBY; y++) { > + if ((p[x] & (0x80 >> y)) =3D=3D 0) > + break; > + } > + } > + return x * NBBY + y; > +} > + > +static void > +in6_prefixlen2mask(struct in6_addr *maskp, int len) > +{ > + static const u_char maskarray[NBBY] =3D {0x80, 0xc0, 0xe0, 0xf0, 0xf8, > 0xfc, 0xfe, 0xff}; > + int bytelen, bitlen, i; > + > + /* sanity check */ > + if (len < 0 || len > 128) { > + errx(1, "in6_prefixlen2mask: invalid prefix length(%d)\n", > + len); > + return; > + } > + > + memset(maskp, 0, sizeof(*maskp)); > + bytelen =3D len / NBBY; > + bitlen =3D len % NBBY; > + for (i =3D 0; i < bytelen; i++) > + maskp->s6_addr[i] =3D 0xff; > + if (bitlen) > + maskp->s6_addr[bytelen] =3D maskarray[bitlen - 1]; > +} > + > +static int > +in6_mask2len(struct in6_addr *mask, u_char *lim0) > +{ > + int x =3D 0, y; > + u_char *lim =3D lim0, *p; > + > + /* ignore the scope_id part */ > + if (lim0 =3D=3D NULL || lim0 - (u_char *)mask > sizeof(*mask)) > + lim =3D (u_char *)mask + sizeof(*mask); > + for (p =3D (u_char *)mask; p < lim; x++, p++) { > + if (*p !=3D 0xff) > + break; > + } > + y =3D 0; > + if (p < lim) { > + for (y =3D 0; y < NBBY; y++) { > + if ((*p & (0x80 >> y)) =3D=3D 0) > + break; > + } > + } > + > + /* > + * when the limit pointer is given, do a stricter check on the > + * remaining bits. > + */ > + if (p < lim) { > + if (y !=3D 0 && (*p & (0x00ff >> y)) !=3D 0) > + return -1; > + for (p =3D p + 1; p < lim; p++) > + if (*p !=3D 0) > + return -1; > + } > + > + return x * NBBY + y; > +} > + > +static bool > +parse_ip(struct allowedip *aip, const char *value) > +{ > + struct addrinfo hints, *res; > + int err; > + > + bzero(&aip->a_addr, sizeof(aip->a_addr)); > + bzero(&hints, sizeof(hints)); > + hints.ai_family =3D AF_UNSPEC; > + hints.ai_flags =3D AI_NUMERICHOST; > + err =3D getaddrinfo(value, NULL, &hints, &res); > + if (err) > + errx(1, "%s", gai_strerror(err)); > + > + memcpy(&aip->a_addr, res->ai_addr, res->ai_addrlen); > + > + freeaddrinfo(res); > + return (true); > +} > + > +static void > +sa_ntop(const struct sockaddr *sa, char *buf, int *port) > +{ > + const struct sockaddr_in *sin; > + const struct sockaddr_in6 *sin6; > + int err; > + > + err =3D getnameinfo(sa, sa->sa_len, buf, INET6_ADDRSTRLEN, NULL, > + 0, NI_NUMERICHOST); > + > + if (sa->sa_family =3D=3D AF_INET) { > + sin =3D (const struct sockaddr_in *)sa; > + if (port) > + *port =3D sin->sin_port; > + } else if (sa->sa_family =3D=3D AF_INET6) { > + sin6 =3D (const struct sockaddr_in6 *)sa; > + if (port) > + *port =3D sin6->sin6_port; > + } > + > + if (err) > + errx(1, "%s", gai_strerror(err)); > +} > + > +static void > +dump_peer(const nvlist_t *nvl_peer) > +{ > + const void *key; > + const struct allowedip *aips; > + const struct sockaddr *endpoint; > + char outbuf[WG_MAX_STRLEN]; > + char addr_buf[INET6_ADDRSTRLEN]; > + size_t size; > + int count, port; > + > + printf("[Peer]\n"); > + if (nvlist_exists_binary(nvl_peer, "public-key")) { > + key =3D nvlist_get_binary(nvl_peer, "public-key", &size); > + b64_ntop((const uint8_t *)key, size, outbuf, WG_MAX_STRLEN); > + printf("PublicKey =3D %s\n", outbuf); > + } > + if (nvlist_exists_binary(nvl_peer, "endpoint")) { > + endpoint =3D nvlist_get_binary(nvl_peer, "endpoint", &size); > + sa_ntop(endpoint, addr_buf, &port); > + printf("Endpoint =3D %s:%d\n", addr_buf, ntohs(port)); > + } > + > + if (!nvlist_exists_binary(nvl_peer, "allowed-ips")) > + return; > + aips =3D nvlist_get_binary(nvl_peer, "allowed-ips", &size); > + if (size =3D=3D 0 || size % sizeof(struct allowedip) !=3D 0) { > + errx(1, "size %zu not integer multiple of allowedip", size); > + } > + printf("AllowedIPs =3D "); > + count =3D size / sizeof(struct allowedip); > + for (int i =3D 0; i < count; i++) { > + int mask; > + sa_family_t family; > + void *bitmask; > + struct sockaddr *sa; > + > + sa =3D __DECONST(void *, &aips[i].a_addr); > + bitmask =3D __DECONST(void *, > + ((const struct sockaddr *)&aips->a_mask)->sa_data); > + family =3D aips[i].a_addr.ss_family; > + getnameinfo(sa, sa->sa_len, addr_buf, INET6_ADDRSTRLEN, NULL, > + 0, NI_NUMERICHOST); > + if (family =3D=3D AF_INET) > + mask =3D in_mask2len(bitmask); > + else if (family =3D=3D AF_INET6) > + mask =3D in6_mask2len(bitmask, NULL); > + else > + errx(1, "bad family in peer %d\n", family); > + printf("%s/%d", addr_buf, mask); > + if (i < count -1) > + printf(", "); > + } > + printf("\n"); > +} > + > +static int > +get_nvl_out_size(int sock, u_long op, size_t *size) > +{ > + struct ifdrv ifd; > + int err; > + > + memset(&ifd, 0, sizeof(ifd)); > + > + strlcpy(ifd.ifd_name, name, sizeof(ifd.ifd_name)); > + ifd.ifd_cmd =3D op; > + ifd.ifd_len =3D 0; > + ifd.ifd_data =3D NULL; > + > + err =3D ioctl(sock, SIOCGDRVSPEC, &ifd); > + if (err) > + return (err); > + *size =3D ifd.ifd_len; > + return (0); > +} > + > +static int > +do_cmd(int sock, u_long op, void *arg, size_t argsize, int set) > +{ > + struct ifdrv ifd; > + > + memset(&ifd, 0, sizeof(ifd)); > + > + strlcpy(ifd.ifd_name, name, sizeof(ifd.ifd_name)); > + ifd.ifd_cmd =3D op; > + ifd.ifd_len =3D argsize; > + ifd.ifd_data =3D arg; > + > + return (ioctl(sock, set ? SIOCSDRVSPEC : SIOCGDRVSPEC, &ifd)); > +} > + > +static > +DECL_CMD_FUNC(peerlist, val, d) > +{ > + size_t size, peercount; > + void *packed; > + const nvlist_t *nvl, *nvl_peer; > + const nvlist_t *const *nvl_peerlist; > + > + if (get_nvl_out_size(s, WGC_GET, &size)) > + errx(1, "can't get peer list size"); > + if ((packed =3D malloc(size)) =3D=3D NULL) > + errx(1, "malloc failed for peer list"); > + if (do_cmd(s, WGC_GET, packed, size, 0)) > + errx(1, "failed to obtain peer list"); > + > + nvl =3D nvlist_unpack(packed, size, 0); > + if (!nvlist_exists_nvlist_array(nvl, "peer-list")) > + return; > + nvl_peerlist =3D nvlist_get_nvlist_array(nvl, "peer-list", &peercount)= ; > + > + for (int i =3D 0; i < peercount; i++, nvl_peerlist++) { > + nvl_peer =3D *nvl_peerlist; > + dump_peer(nvl_peer); > + } > +} > + > +static void > +peerfinish(int s, void *arg) > +{ > + nvlist_t *nvl, **nvl_array; > + void *packed; > + size_t size; > + > + if ((nvl =3D nvlist_create(0)) =3D=3D NULL) > + errx(1, "failed to allocate nvlist"); > + if ((nvl_array =3D calloc(sizeof(void *), 1)) =3D=3D NULL) > + errx(1, "failed to allocate nvl_array"); > + if (!nvlist_exists_binary(nvl_params, "public-key")) > + errx(1, "must specify a public-key for adding peer"); > + if (!nvlist_exists_binary(nvl_params, "endpoint")) > + errx(1, "must specify an endpoint for adding peer"); > + if (allowed_ips_count =3D=3D 0) > + errx(1, "must specify at least one range of allowed-ips to > add a peer"); + > + nvl_array[0] =3D nvl_params; > + nvlist_add_nvlist_array(nvl, "peer-list", (const nvlist_t * const > *)nvl_array, 1); > + packed =3D nvlist_pack(nvl, &size); > + > + if (do_cmd(s, WGC_SET, packed, size, true)) > + errx(1, "failed to install peer"); > +} > + > +static > +DECL_CMD_FUNC(peerstart, val, d) > +{ > + do_peer =3D true; > + callback_register(peerfinish, NULL); > + allowed_ips =3D malloc(ALLOWEDIPS_START * sizeof(struct allowedip)); > + allowed_ips_max =3D ALLOWEDIPS_START; > + if (allowed_ips =3D=3D NULL) > + errx(1, "failed to allocate array for allowedips"); > +} > + > +static > +DECL_CMD_FUNC(setwglistenport, val, d) > +{ > + struct addrinfo hints, *res; > + const struct sockaddr_in *sin; > + const struct sockaddr_in6 *sin6; > + > + u_long ul; > + int err; > + > + bzero(&hints, sizeof(hints)); > + hints.ai_family =3D AF_UNSPEC; > + hints.ai_flags =3D AI_NUMERICHOST; > + err =3D getaddrinfo(NULL, val, &hints, &res); > + if (err) > + errx(1, "%s", gai_strerror(err)); > + > + if (res->ai_family =3D=3D AF_INET) { > + sin =3D (struct sockaddr_in *)res->ai_addr; > + ul =3D sin->sin_port; > + } else if (res->ai_family =3D=3D AF_INET6) { > + sin6 =3D (struct sockaddr_in6 *)res->ai_addr; > + ul =3D sin6->sin6_port; > + } else { > + errx(1, "unknown family"); > + } > + ul =3D ntohs((u_short)ul); > + nvlist_add_number(nvl_params, "listen-port", ul); > +} > + > +static > +DECL_CMD_FUNC(setwgprivkey, val, d) > +{ > + uint8_t key[WG_KEY_LEN]; > + > + if (!key_from_base64(key, val)) > + errx(1, "invalid key %s", val); > + nvlist_add_binary(nvl_params, "private-key", key, WG_KEY_LEN); > +} > + > +static > +DECL_CMD_FUNC(setwgpubkey, val, d) > +{ > + uint8_t key[WG_KEY_LEN]; > + > + if (!do_peer) > + errx(1, "setting public key only valid when adding peer"); > + > + if (!key_from_base64(key, val)) > + errx(1, "invalid key %s", val); > + nvlist_add_binary(nvl_params, "public-key", key, WG_KEY_LEN); > +} > + > +static > +DECL_CMD_FUNC(setallowedips, val, d) > +{ > + char *base, *allowedip, *mask; > + u_long ul; > + char *endp; > + struct allowedip *aip; > + > + if (!do_peer) > + errx(1, "setting allowed ip only valid when adding peer"); > + if (allowed_ips_count =3D=3D allowed_ips_max) { > + /* XXX grow array */ > + } > + aip =3D &allowed_ips[allowed_ips_count]; > + base =3D allowedip =3D strdup(val); > + mask =3D index(allowedip, '/'); > + if (mask =3D=3D NULL) > + errx(1, "mask separator not found in allowedip %s", val); > + *mask =3D '\0'; > + mask++; > + parse_ip(aip, allowedip); > + ul =3D strtoul(mask, &endp, 0); > + if (*endp !=3D '\0') > + errx(1, "invalid value for allowedip mask"); > + bzero(&aip->a_mask, sizeof(aip->a_mask)); > + if (aip->a_addr.ss_family =3D=3D AF_INET) > + in_len2mask((struct in_addr *)&((struct sockaddr > *)&aip->a_mask)->sa_data, ul); > + else if (aip->a_addr.ss_family =3D=3D AF_INET6) > + in6_prefixlen2mask((struct in6_addr *)&((struct sockaddr > *)&aip->a_mask)->sa_data, ul); > + else > + errx(1, "invalid address family %d\n", > aip->a_addr.ss_family); > + allowed_ips_count++; > + if (allowed_ips_count > 1) > + nvlist_free_binary(nvl_params, "allowed-ips"); > + nvlist_add_binary(nvl_params, "allowed-ips", allowed_ips, > + allowed_ips_count*sizeof(*aip)); > + > + dump_peer(nvl_params); > + free(base); > +} > + > +static > +DECL_CMD_FUNC(setendpoint, val, d) > +{ > + if (!do_peer) > + errx(1, "setting endpoint only valid when adding peer"); > + parse_endpoint(val); > +} > + > +static void > +wireguard_status(int s) > +{ > + size_t size; > + void *packed; > + nvlist_t *nvl; > + char buf[WG_KEY_LEN_BASE64]; > + const void *key; > + uint16_t listen_port; > + > + if (get_nvl_out_size(s, WGC_GET, &size)) > + return; > + if ((packed =3D malloc(size)) =3D=3D NULL) > + return; > + if (do_cmd(s, WGC_GET, packed, size, 0)) > + return; > + nvl =3D nvlist_unpack(packed, size, 0); > + if (nvlist_exists_number(nvl, "listen-port")) { > + listen_port =3D nvlist_get_number(nvl, "listen-port"); > + printf("\tlisten-port: %d\n", listen_port); > + } > + if (nvlist_exists_binary(nvl, "private-key")) { > + key =3D nvlist_get_binary(nvl, "private-key", &size); > + b64_ntop((const uint8_t *)key, size, buf, WG_MAX_STRLEN); > + printf("\tprivate-key: %s\n", buf); > + } > + if (nvlist_exists_binary(nvl, "public-key")) { > + key =3D nvlist_get_binary(nvl, "public-key", &size); > + b64_ntop((const uint8_t *)key, size, buf, WG_MAX_STRLEN); > + printf("\tpublic-key: %s\n", buf); > + } > +} > + > +static struct cmd wireguard_cmds[] =3D { > + DEF_CLONE_CMD_ARG("listen-port", setwglistenport), > + DEF_CLONE_CMD_ARG("private-key", setwgprivkey), > + DEF_CMD("peer-list", 0, peerlist), > + DEF_CMD("peer", 0, peerstart), > + DEF_CMD_ARG("public-key", setwgpubkey), > + DEF_CMD_ARG("allowed-ips", setallowedips), > + DEF_CMD_ARG("endpoint", setendpoint), > +}; > + > +static struct afswtch af_wireguard =3D { > + .af_name =3D "af_wireguard", > + .af_af =3D AF_UNSPEC, > + .af_other_status =3D wireguard_status, > +}; > + > +static void > +wg_create(int s, struct ifreq *ifr) > +{ > + struct iovec iov; > + void *packed; > + size_t size; > + > + setproctitle("ifconfig %s create ...\n", name); > + if (!nvlist_exists_number(nvl_params, "listen-port")) > + goto legacy; > + if (!nvlist_exists_binary(nvl_params, "private-key")) > + goto legacy; > + > + packed =3D nvlist_pack(nvl_params, &size); > + if (packed =3D=3D NULL) > + errx(1, "failed to setup create request"); > + iov.iov_len =3D size; > + iov.iov_base =3D packed; > + ifr->ifr_data =3D (caddr_t)&iov; > + if (ioctl(s, SIOCIFCREATE2, ifr) < 0) > + err(1, "SIOCIFCREATE2"); > + return; > +legacy: > + ifr->ifr_data =3D=3D NULL; > + if (ioctl(s, SIOCIFCREATE, ifr) < 0) > + err(1, "SIOCIFCREATE"); > +} > + > +static __constructor void > +wireguard_ctor(void) > +{ > + int i; > + > + nvl_params =3D nvlist_create(0); > + for (i =3D 0; i < nitems(wireguard_cmds); i++) > + cmd_register(&wireguard_cmds[i]); > + af_register(&af_wireguard); > + clone_setdefcallback_prefix("wg", wg_create); > +} > + > +#endif > > Added: head/sys/dev/if_wg/include/crypto/blake2s.h > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/sys/dev/if_wg/include/crypto/blake2s.h Sun Nov 29 19:38:03 > 2020 (r368163) @@ -0,0 +1,56 @@ > +/* SPDX-License-Identifier: GPL-2.0 OR MIT */ > +/* > + * Copyright (C) 2015-2019 Jason A. Donenfeld . All Ri= ghts > Reserved. > + */ > + > +#include > + > +#ifndef _BLAKE2S_H_ > +#define _BLAKE2S_H_ > + > + > +enum blake2s_lengths { > + BLAKE2S_BLOCK_SIZE =3D 64, > + BLAKE2S_HASH_SIZE =3D 32, > + BLAKE2S_KEY_SIZE =3D 32 > +}; > + > +struct blake2s_state { > + uint32_t h[8]; > + uint32_t t[2]; > + uint32_t f[2]; > + uint8_t buf[BLAKE2S_BLOCK_SIZE]; > + size_t buflen; > + uint8_t last_node; > +}; > + > +void blake2s_init(struct blake2s_state *state, const size_t outlen); > +void blake2s_init_key(struct blake2s_state *state, const size_t outlen, > + const void *key, const size_t keylen); > +void blake2s_update(struct blake2s_state *state, const uint8_t *in, siz= e_t > inlen); +void blake2s_final(struct blake2s_state *state, uint8_t *out, c= onst > size_t outlen); + > +static inline void blake2s(uint8_t *out, const uint8_t *in, const uint8= _t > *key, > + const size_t outlen, const size_t inlen, > + const size_t keylen) > +{ > + struct blake2s_state state; > +#ifdef __linux___ > + WARN_ON(IS_ENABLED(DEBUG) && ((!in && inlen > 0) || !out || !outlen > || > + outlen > BLAKE2S_HASH_SIZE || keylen > BLAKE2S_KEY_SIZE || > + (!key && keylen))); > +#endif > + > + if (keylen) > + blake2s_init_key(&state, outlen, key, keylen); > + else > + blake2s_init(&state, outlen); > + > + blake2s_update(&state, in, inlen); > + blake2s_final(&state, out, outlen); > +} > + > +void blake2s_hmac(uint8_t *out, const uint8_t *in, const uint8_t *key, > + const size_t outlen, const size_t inlen, const size_t > keylen); + > +#endif /* _BLAKE2S_H_ */ > > Added: head/sys/dev/if_wg/include/crypto/curve25519.h > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/sys/dev/if_wg/include/crypto/curve25519.h Sun Nov 29 19:38:03 > 2020 (r368163) @@ -0,0 +1,74 @@ > +/*- > + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD > + * > + * Copyright (c) 2019-2020 Rubicon Communications, LLC (Netgate) > + * > + * Redistribution and use in source and binary forms, with or without > + * modification, are permitted provided that the following conditions > + * are met: > + * 1. Redistributions of source code must retain the above copyright > + * notice, this list of conditions and the following disclaimer. > + * 2. Redistributions in binary form must reproduce the above copyrig= ht > + * notice, this list of conditions and the following disclaimer in= the > + * documentation and/or other materials provided with the distribu= tion. > + * > + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' A= ND > + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, TH= E > + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR P= URPOSE > + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIA= BLE > + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQU= ENTIAL > + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GO= ODS > + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION= ) > + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, = STRICT > + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN AN= Y WAY > + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY = OF > + * SUCH DAMAGE. > + * > + * $FreeBSD$ > + */ > + > +#ifndef _CURVE25519_H_ > +#define _CURVE25519_H_ > + > +#include > + > +#define CURVE25519_KEY_SIZE 32 > + > +void curve25519_generic(u8 [CURVE25519_KEY_SIZE], > + const u8 [CURVE25519_KEY_SIZE], > + const u8 [CURVE25519_KEY_SIZE]); > + > +static inline void curve25519_clamp_secret(u8 secret[CURVE25519_KEY_SIZ= E]) > +{ > + secret[0] &=3D 248; > + secret[31] =3D (secret[31] & 127) | 64; > +} > + > +static const u8 null_point[CURVE25519_KEY_SIZE] =3D { 0 }; > + > +static inline int curve25519(u8 mypublic[CURVE25519_KEY_SIZE], > + const u8 secret[CURVE25519_KEY_SIZE], > + const u8 basepoint[CURVE25519_KEY_SIZE]) > +{ > + curve25519_generic(mypublic, secret, basepoint); > + return timingsafe_bcmp(mypublic, null_point, CURVE25519_KEY_SIZE); > +} > + > +static inline int curve25519_generate_public(u8 pub[CURVE25519_KEY_SIZE= ], > + const u8 secret[CURVE25519_KEY_SIZE]) > +{ > + static const u8 basepoint[CURVE25519_KEY_SIZE] __aligned(32) =3D { 9 }= ; > + > + if (timingsafe_bcmp(secret, null_point, CURVE25519_KEY_SIZE) =3D=3D 0) > + return 0; > + > + return curve25519(pub, secret, basepoint); > +} > + > +static inline void curve25519_generate_secret(u8 secret[CURVE25519_KEY_= SIZE]) > +{ > + arc4random_buf(secret, CURVE25519_KEY_SIZE); > + curve25519_clamp_secret(secret); > +} > + > +#endif /* _CURVE25519_H_ */ > > Added: head/sys/dev/if_wg/include/crypto/zinc.h > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/sys/dev/if_wg/include/crypto/zinc.h Sun Nov 29 19:38:03 > 2020 (r368163) @@ -0,0 +1,15 @@ > +/* SPDX-License-Identifier: GPL-2.0 OR MIT */ > +/* > + * Copyright (C) 2015-2019 Jason A. Donenfeld . All Ri= ghts > Reserved. > + */ > + > +#ifndef _WG_ZINC_H > +#define _WG_ZINC_H > + > +int chacha20_mod_init(void); > +int poly1305_mod_init(void); > +int chacha20poly1305_mod_init(void); > +int blake2s_mod_init(void); > +int curve25519_mod_init(void); > + > +#endif > > Added: head/sys/dev/if_wg/include/sys/if_wg_session.h > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/sys/dev/if_wg/include/sys/if_wg_session.h Sun Nov 29 19:38:03 > 2020 (r368163) @@ -0,0 +1,89 @@ > +/* > + * Copyright (c) 2019 Matt Dunwoodie > + * > + * Permission to use, copy, modify, and distribute this software for an= y > + * purpose with or without fee is hereby granted, provided that the abo= ve > + * copyright notice and this permission notice appear in all copies. > + * > + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRAN= TIES > + * 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 DAMAG= ES > + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN A= N > + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT= OF > + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. > + * > + * $FreeBSD$ > + */ > + > +#ifndef __IF_WG_H__ > +#define __IF_WG_H__ > + > +#include > +#include > + > +/* > + * This is the public interface to the WireGuard network interface. > + * > + * It is designed to be used by tools such as ifconfig(8) and wg(4). > + */ > + > +#define WG_KEY_SIZE 32 > + > +#define WG_DEVICE_HAS_PUBKEY (1 << 0) > +#define WG_DEVICE_HAS_PRIVKEY (1 << 1) > +#define WG_DEVICE_HAS_MASKED_PRIVKEY (1 << 2) > +#define WG_DEVICE_HAS_PORT (1 << 3) > +#define WG_DEVICE_HAS_RDOMAIN (1 << 4) > +#define WG_DEVICE_REPLACE_PEERS (1 << 5) > + > +#define WG_PEER_HAS_PUBKEY (1 << 0) > +#define WG_PEER_HAS_SHAREDKEY (1 << 1) > +#define WG_PEER_HAS_MASKED_SHAREDKEY (1 << 2) > +#define WG_PEER_HAS_ENDPOINT (1 << 3) > +#define WG_PEER_HAS_PERSISTENTKEEPALIVE (1 << 4) > +#define WG_PEER_REPLACE_CIDRS (1 << 5) > +#define WG_PEER_REMOVE (1 << 6) > + > +#define SIOCSWG _IOWR('i', 200, struct wg_device_io) > +#define SIOCGWG _IOWR('i', 201, struct wg_device_io) > + > +#define WG_PEERS_FOREACH(p, d) \ > + for (p =3D (d)->d_peers; p < (d)->d_peers + (d)->d_num_peers; p++) > +#define WG_CIDRS_FOREACH(c, p) \ > + for (c =3D (p)->p_cidrs; c < (p)->p_cidrs + (p)->p_num_cidrs; c++) > + > +struct wg_allowedip { > + struct sockaddr_storage a_addr; > + struct sockaddr_storage a_mask; > +}; > + > +enum { > + WG_PEER_CTR_TX_BYTES, > + WG_PEER_CTR_RX_BYTES, > + WG_PEER_CTR_NUM, > +}; > + > +struct wg_device_io { > + char d_name[IFNAMSIZ]; > + uint8_t d_flags; > + in_port_t d_port; > + int d_rdomain; > + uint8_t d_pubkey[WG_KEY_SIZE]; > + uint8_t d_privkey[WG_KEY_SIZE]; > + size_t d_num_peers; > + size_t d_num_cidrs; > + struct wg_peer_io *d_peers; > +}; > + > + > +#ifndef ENOKEY > +#define ENOKEY ENOTCAPABLE > +#endif > + > +typedef enum { > + WGC_GET =3D 0x5, > + WGC_SET =3D 0x6, > +} wg_cmd_t; > + > +#endif /* __IF_WG_H__ */ > > Added: head/sys/dev/if_wg/include/sys/if_wg_session_vars.h > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/sys/dev/if_wg/include/sys/if_wg_session_vars.h Sun Nov 29 > 19:38:03 2020 (r368163) @@ -0,0 +1,322 @@ > +/* > + * Copyright (c) 2019 Matt Dunwoodie > + * Copyright (c) 2019-2020 Rubicon Communications, LLC (Netgate) > + * > + * Permission to use, copy, modify, and distribute this software for an= y > + * purpose with or without fee is hereby granted, provided that the abo= ve > + * copyright notice and this permission notice appear in all copies. > + * > + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRAN= TIES > + * 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 DAMAG= ES > + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN A= N > + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT= OF > + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. > + * > + * $FreeBSD$ > + */ > + > +#ifndef _IF_WG_VARS_H_ > +#define _IF_WG_VARS_H_ > + > +#include > +#include > +#include > + > +#include > +#include > +#include > + > + > +#include > +#include > +#include > +#include > +#include > +#include > + > +#include > +#include > +/* This is only needed for wg_keypair. */ > +#include > + > +#define UNIMPLEMENTED() panic("%s not implemented\n", __func__) > + > +#define WG_KEY_SIZE 32 > +#define WG_MSG_PADDING_SIZE 16 > + > + > +/* Constant for session */ > +#define REKEY_TIMEOUT 5 > +#define REKEY_TIMEOUT_JITTER 500 /* TODO ok? jason */ > +#define REJECT_AFTER_TIME 180 > +#define KEEPALIVE_TIMEOUT 10 > +#define MAX_TIMER_HANDSHAKES (90 / REKEY_TIMEOUT) > +#define NEW_HANDSHAKE_TIMEOUT (REKEY_TIMEOUT + > KEEPALIVE_TIMEOUT) + > +#define MAX_QUEUED_INCOMING_HANDSHAKES 4096 /* TODO: replace this > with DQL */ +#define MAX_QUEUED_PACKETS 1024 /* TODO: replace > this with DQL */ + > +#define HASHTABLE_PEER_SIZE (1 << 6) > //1 << 11 +#define HASHTABLE_INDEX_SIZE (HASHTABLE_PEER_SIZE * > 3) //1 << 13 + > +#define PEER_MAGIC1 0xCAFEBABEB00FDADDULL > +#define PEER_MAGIC2 0xCAAFD0D0D00DBABEULL > +#define PEER_MAGIC3 0xD00DBABEF00DFADEULL > + > + > +enum message_type { > + MESSAGE_INVALID =3D 0, > + MESSAGE_HANDSHAKE_INITIATION =3D 1, > + MESSAGE_HANDSHAKE_RESPONSE =3D 2, > + MESSAGE_HANDSHAKE_COOKIE =3D 3, > + MESSAGE_DATA =3D 4 > +}; > + > +struct wg_softc; > + > +#if __FreeBSD_version > 1300000 > +typedef void timeout_t (void *); > +#endif > + > +/* Socket */ > +struct wg_endpoint { > + union wg_remote { > + struct sockaddr r_sa; > + struct sockaddr_in r_sin; > + struct sockaddr_in6 r_sin6; > + } e_remote; > + union wg_source { > + struct in_addr l_in; > + struct in6_pktinfo l_pktinfo6; > +#define l_in6 l_pktinfo6.ipi6_addr > + } e_local; > +}; > + > +struct wg_socket { > + struct mtx so_mtx; > + in_port_t so_port; > + struct socket *so_so4; > + struct socket *so_so6; > +}; > + > +struct wg_queue { > + struct mtx q_mtx; > + struct mbufq q; > +}; > + > +struct wg_index { > + LIST_ENTRY(wg_index) i_entry; > + SLIST_ENTRY(wg_index) i_unused_entry; > + uint32_t i_key; > > *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** > _______________________________________________ > 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-unsubscribe@freebsd.org" "make installkernel" fails for me in a non-DEBUG environment with the erro= r shown below. Recent CURRENT source tree is r368226, failing systems are ru= nning at r368055 or r368226. [...] =3D=3D=3D> i2c/cyapa (install) =2D-- realinstall_subdir_if_wg --- install -T dbg -o root -g wheel -m 555 if_wg.ko.debug /usr/lib/debug/boot/kernel/ install: /usr/lib/debug/boot/kernel/: No such = file or directory --- realinstall_subdir_iflib --- =2D-- _kmodinstall --- =2D-- realinstall_subdir_if_wg --- *** [_kmodinstall] Error code 71 make[4]: stopped in /usr/src/sys/modules/if_wg 1 error make[4]: stopped in /usr/src/sys/modules/if_wg =2D-- realinstall_subdir_iflib --- install -T release -o root -g wheel -m 555 iflib.ko /boot/kernel/ =2D-- realinstall_subdir_if_wg --- =2D-- realinstall_subdir_geom --- =2D-- realinstall_subdir_iflib --- =2D-- realinstall_subdir_i2c --- *** [modules-install] Error code 2 [...] From owner-svn-src-head@freebsd.org Tue Dec 1 13:39:07 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 68C3D4AA281; Tue, 1 Dec 2020 13:39:07 +0000 (UTC) (envelope-from ohartmann@walstatt.org) Received: from mout.gmx.net (mout.gmx.net [212.227.17.22]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "mout.gmx.net", Issuer "TeleSec ServerPass Class 2 CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Cljqt1l8Rz3p0V; Tue, 1 Dec 2020 13:39:05 +0000 (UTC) (envelope-from ohartmann@walstatt.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1606829944; bh=kTA+zHEhpWeY1x/0Yo+mxjg80GSA27GUtenfVG5jA9E=; h=X-UI-Sender-Class:Date:From:To:Cc:Subject:In-Reply-To:References; b=RCTXXMArK4Utmit5lYMrNel7Z0MfNDKS1leWJEgTFEUiCWVgjiUegUTPqX7jETNu6 WN1YfNnJ5GE9dxXoopsw/hD4SqehnQTFUUEyl/KWG2ZFoy3h6VFw5qSMrDFLtiVd+b E8ceoCmttRldAHzOrSB+M0IBVlXQSLC58U94WawM= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from freyja ([46.88.81.135]) by mail.gmx.com (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MbzyJ-1kBrNg2ij9-00dXo6; Tue, 01 Dec 2020 14:39:04 +0100 Date: Tue, 1 Dec 2020 14:39:01 +0100 From: "O. Hartmann" To: Matt Macy Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r368163 - in head: sbin/ifconfig sys/dev/if_wg sys/dev/if_wg/include sys/dev/if_wg/include/crypto sys/dev/if_wg/include/sys sys/dev/if_wg/include/zinc sys/dev/if_wg/module sys/dev/if_wg... Message-ID: <20201201143901.72e74311@freyja> In-Reply-To: <202011291938.0ATJc4Z3081193@repo.freebsd.org> References: <202011291938.0ATJc4Z3081193@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:wX6WicJTeUrXjxF8kW0w+GE830sZgilAxBKn9doUWRcL7Zcmw5U Q/ELM8/LVxMcbGJ82M2hIBQv/lg2mi+5DCejaNd6lbvSv8W2mG5vlOscf0bY5C1nbqOvVgw qMx+TYJiJ5wugnuF8yc5bGxbn5ipnFptNKl1Ua/sVCvdvD5vJ2mM+L2Fuz5FZ03FZsom+oO l8zv5N4r+2CU6xMwqWwmA== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:0xvBKoxpti4=:pXpi1qzJPh7ySBY6KWqJD7 qPIx23o9VoGuhrqgs7IbLtnmcG3EQVwAPlbe/PRz+j/to6jSYGN6Co6Kq2r/9QK5gt4cBR7zR W2CJj4xRxxBkoBSPAU5IbRb0ya2TQ6243q3wM94s5gU9x6ZN+a2IkZbE9S/0IbWk3kjLj1Nco kXUqrRYs4GrNd3Vjffm6atGLjWiJxgXG62tVJfHWhUMhN4biV09XcnW30TBGROrixmXl2TJZo YMNWkwzEZHahJ/mfrZHeVtEsPSCnpoZ3ho0esHWG2Y9dcVBpRDxmqBgPchlr6zqEv3xSwjLe+ 5Bo5gPQ/8FpDHiAZX3ayoYGv2LmtHzSaeNi67IrhdLaueK2ifxjaiVwZa3aLII1A/X7Fty4hY OceuxC7uBVlQleuaoqoMsUOvCZG21YnQ44ejclO8JsdcjlmZoNFvR6mA0IDn/DxBIvdP4f+2a s0MldsTrXBvPo2uFu5/Qk854eCTi0F2rdJWBqj2CnteCCloYXD/T482OdtLo0MGgUH2dXI9eH 9dpy+JJBbTg4Ba+L6RstS0b5kWuQDTuTn1HhMDG51RFYuwOVqaPHNiBWuJQu/cjYP7aJRkq0t mM4wP5bGq+XgXczuRXhuz5rGol+f64xtn+dz2HnTi8Y0gd3s4EYwBHfoE7sbDYeUVxaW82ISy wY4UN2I75NqCGorwFsyehJRoh1Zc80Vg1PswtLbTjqjiBgY2s4jP4JCwMg+FCIfPhQcoEM9dO RE3o2R4css+5tYSJxHOBuNmwZKm2lN1ioFrtuxykq5sYYHPUuhm7uNBWnzzNWxWjdtqno5L/d 7AP+jtI4xLXQevzppfN4w3t2j6BVu6w7p4J0AXTIE+kjycJzCmsO5waqE+1HdkjBnZcvBI3RU WPpmCXm+hp0as+s2YcjQ== X-Rspamd-Queue-Id: 4Cljqt1l8Rz3p0V X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmx.net header.s=badeba3b8450 header.b=RCTXXMAr; dmarc=none; spf=none (mx1.freebsd.org: domain of ohartmann@walstatt.org has no SPF policy when checking 212.227.17.22) smtp.mailfrom=ohartmann@walstatt.org X-Spamd-Result: default: False [-2.90 / 15.00]; RCVD_VIA_SMTP_AUTH(0.00)[]; TO_DN_SOME(0.00)[]; DKIM_TRACE(0.00)[gmx.net:+]; NEURAL_HAM_SHORT(-1.00)[-1.000]; RECEIVED_SPAMHAUS_PBL(0.00)[46.88.81.135:received]; FROM_EQ_ENVFROM(0.00)[]; RBL_DBL_DONT_QUERY_IPS(0.00)[212.227.17.22:from]; ASN(0.00)[asn:8560, ipnet:212.227.0.0/16, country:DE]; MIME_TRACE(0.00)[0:+]; RCVD_IN_DNSWL_LOW(-0.10)[212.227.17.22:from]; ARC_NA(0.00)[]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; R_DKIM_ALLOW(-0.20)[gmx.net:s=badeba3b8450]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[walstatt.org]; SPAMHAUS_ZRD(0.00)[212.227.17.22:from:127.0.2.255]; R_SPF_NA(0.00)[no SPF record]; RWL_MAILSPIKE_POSSIBLE(0.00)[212.227.17.22:from]; MID_RHS_NOT_FQDN(0.50)[]; RCVD_COUNT_TWO(0.00)[2]; RCVD_TLS_ALL(0.00)[]; MAILMAN_DEST(0.00)[svn-src-all,svn-src-head] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Dec 2020 13:39:07 -0000 On Sun, 29 Nov 2020 19:38:04 +0000 (UTC) Matt Macy wrote: > Author: mmacy > Date: Sun Nov 29 19:38:03 2020 > New Revision: 368163 > URL: https://svnweb.freebsd.org/changeset/base/368163 > > Log: > Import kernel WireGuard support > > Data path largely shared with the OpenBSD implementation by > Matt Dunwoodie > > Reviewed by: grehan@freebsd.org > MFC after: 1 month > Sponsored by: Rubicon LLC, (Netgate) > Differential Revision: https://reviews.freebsd.org/D26137 > > Added: > head/sbin/ifconfig/ifwg.c (contents, props changed) > head/sys/dev/if_wg/ > head/sys/dev/if_wg/include/ > head/sys/dev/if_wg/include/crypto/blake2s.h (contents, props changed= ) > head/sys/dev/if_wg/include/crypto/curve25519.h (contents, props chan= ged) > head/sys/dev/if_wg/include/crypto/zinc.h (contents, props changed) > head/sys/dev/if_wg/include/sys/ > head/sys/dev/if_wg/include/sys/if_wg_session.h (contents, props chan= ged) > head/sys/dev/if_wg/include/sys/if_wg_session_vars.h (contents, props > changed) head/sys/dev/if_wg/include/sys/simd-x86_64.h (contents, props > changed) head/sys/dev/if_wg/include/sys/support.h (contents, props cha= nged) > head/sys/dev/if_wg/include/sys/wg_cookie.h (contents, props changed) > head/sys/dev/if_wg/include/sys/wg_module.h (contents, props changed) > head/sys/dev/if_wg/include/sys/wg_noise.h (contents, props changed) > head/sys/dev/if_wg/include/zinc/blake2s.h (contents, props changed) > head/sys/dev/if_wg/include/zinc/chacha20.h (contents, props changed) > head/sys/dev/if_wg/include/zinc/chacha20poly1305.h (contents, props > changed) head/sys/dev/if_wg/include/zinc/curve25519.h (contents, props > changed) head/sys/dev/if_wg/include/zinc/poly1305.h (contents, props > changed) head/sys/dev/if_wg/module/ > head/sys/dev/if_wg/module/blake2s.c (contents, props changed) > head/sys/dev/if_wg/module/blake2s.h (contents, props changed) > head/sys/dev/if_wg/module/chacha20-x86_64.S (contents, props changed= ) > head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20-arm-glue.c > (contents, props changed) > head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20-arm.pl (conten= ts, > props changed) > head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20-arm64.pl (cont= ents, > props changed) > head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20-mips-glue.c > (contents, props changed) > head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20-mips.S (conten= ts, > props changed) > head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20-unrolled-arm.S > (contents, props changed) > head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20-x86_64-glue.c > (contents, props changed) > head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20-x86_64.pl > (contents, props changed) > head/sys/dev/if_wg/module/crypto/zinc/chacha20/chacha20.c (contents, p= rops > changed) head/sys/dev/if_wg/module/crypto/zinc/chacha20poly1305.c > (contents, props changed) > head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-arm-glue.c > (contents, props changed) > head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-arm.pl (conten= ts, > props changed) > head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-arm64.pl (cont= ents, > props changed) > head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-donna32.c > (contents, props changed) > head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-donna64.c > (contents, props changed) > head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-mips-glue.c > (contents, props changed) > head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-mips.S (conten= ts, > props changed) > head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-mips64.pl > (contents, props changed) > head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-x86_64-glue.c > (contents, props changed) > head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305-x86_64.pl > (contents, props changed) > head/sys/dev/if_wg/module/crypto/zinc/poly1305/poly1305.c (contents, p= rops > changed) head/sys/dev/if_wg/module/crypto/zinc/selftest/blake2s.c > (contents, props changed) > head/sys/dev/if_wg/module/crypto/zinc/selftest/chacha20.c (contents, p= rops > changed) head/sys/dev/if_wg/module/crypto/zinc/selftest/chacha20poly1305= .c > (contents, props changed) > head/sys/dev/if_wg/module/crypto/zinc/selftest/curve25519.c (contents, > props changed) head/sys/dev/if_wg/module/crypto/zinc/selftest/poly1305.c > (contents, props changed) > head/sys/dev/if_wg/module/crypto/zinc/selftest/run.h (contents, props > changed) head/sys/dev/if_wg/module/curve25519.c (contents, props chang= ed) > head/sys/dev/if_wg/module/if_wg_session.c (contents, props changed) > head/sys/dev/if_wg/module/module.c (contents, props changed) > head/sys/dev/if_wg/module/poly1305-x86_64.S (contents, props changed) > head/sys/dev/if_wg/module/wg_cookie.c (contents, props changed) > head/sys/dev/if_wg/module/wg_noise.c (contents, props changed) > head/sys/modules/if_wg/ head/sys/modules/if_wg/Makefile (contents, pro= ps > changed) Directory Properties: head/sys/dev/if_wg/include/crypto/ (pro= ps > changed) head/sys/dev/if_wg/include/zinc/ (props changed) > head/sys/dev/if_wg/module/crypto/ (props changed) > head/sys/dev/if_wg/module/crypto/zinc/ (props changed) > head/sys/dev/if_wg/module/crypto/zinc/chacha20/ (props changed) > head/sys/dev/if_wg/module/crypto/zinc/poly1305/ (props changed) > head/sys/dev/if_wg/module/crypto/zinc/selftest/ (props changed) Modifi= ed: > head/sbin/ifconfig/Makefile head/sys/kern/subr_gtaskqueue.c > head/sys/modules/Makefile head/sys/net/iflib_clone.c head/sys/sys/gtaskq= ueue.h > > Modified: head/sbin/ifconfig/Makefile > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D > --- head/sbin/ifconfig/Makefile Sun Nov 29 19:06:32 2020 > (r368162) +++ head/sbin/ifconfig/Makefile Sun Nov 29 19:38:03 > 2020 (r368163) @@ -35,6 +35,7 @@ SRCS+=3D ifvxlan.c > # VXLAN support SRCS+=3D ifgre.c # GRE > keys etc SRCS+=3D ifgif.c # GIF reversed header > workaround SRCS+=3D ifipsec.c # IPsec VTI > +SRCS+=3D ifwg.c # Wireguard > > SRCS+=3D sfp.c # SFP/SFP+ information > LIBADD+=3D ifconfig m util > @@ -68,6 +69,7 @@ CFLAGS+=3D -DINET > CFLAGS+=3D -DJAIL > LIBADD+=3D jail > .endif > +LIBADD+=3D nv > > MAN=3D ifconfig.8 > > > Added: head/sbin/ifconfig/ifwg.c > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/sbin/ifconfig/ifwg.c Sun Nov 29 19:38:03 2020 (r368163) > @@ -0,0 +1,618 @@ > +/*- > + * SPDX-License-Identifier: BSD-2-Clause > + * > + * Copyright (c) 2020 Rubicon Communications, LLC (Netgate) > + * > + * Redistribution and use in source and binary forms, with or without > + * modification, are permitted provided that the following conditions > + * are met: > + * 1. Redistributions of source code must retain the above copyright > + * notice, this list of conditions and the following disclaimer. > + * 2. Redistributions in binary form must reproduce the above copyrig= ht > + * notice, this list of conditions and the following disclaimer in= the > + * documentation and/or other materials provided with the distribu= tion. > + * > + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' A= ND > + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, TH= E > + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR P= URPOSE > + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIA= BLE > + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQU= ENTIAL > + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GO= ODS > + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION= ) > + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, = STRICT > + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN AN= Y WAY > + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY = OF > + * SUCH DAMAGE. > + */ > + > +#include > +__FBSDID("$FreeBSD$"); > + > +#ifndef RESCUE > +#include > +#include > +#include > +#include > +#include > +#include > + > +#include > +#include > +#include > +#include > +#include > +#include > + > +#include > +#include > + > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include /* NB: for offsetof */ > +#include > +#include > +#include > + > +#include "ifconfig.h" > + > +typedef enum { > + WGC_GET =3D 0x5, > + WGC_SET =3D 0x6, > +} wg_cmd_t; > + > +static nvlist_t *nvl_params; > +static bool do_peer; > +static int allowed_ips_count; > +static int allowed_ips_max; > +struct allowedip { > + struct sockaddr_storage a_addr; > + struct sockaddr_storage a_mask; > +}; > +struct allowedip *allowed_ips; > + > +#define ALLOWEDIPS_START 16 > +#define WG_KEY_LEN 32 > +#define WG_KEY_LEN_BASE64 ((((WG_KEY_LEN) + 2) / 3) * 4 + 1) > +#define WG_KEY_LEN_HEX (WG_KEY_LEN * 2 + 1) > +#define WG_MAX_STRLEN 64 > + > +static bool > +key_from_base64(uint8_t key[static WG_KEY_LEN], const char *base64) > +{ > + > + if (strlen(base64) !=3D WG_KEY_LEN_BASE64 - 1) { > + warnx("bad key len - need %d got %zu\n", WG_KEY_LEN_BASE64 - > 1, strlen(base64)); > + return false; > + } > + if (base64[WG_KEY_LEN_BASE64 - 2] !=3D '=3D') { > + warnx("bad key terminator, expected '=3D' got '%c'", > base64[WG_KEY_LEN_BASE64 - 2]); > + return false; > + } > + return (b64_pton(base64, key, WG_KEY_LEN)); > +} > + > +static void > +parse_endpoint(const char *endpoint_) > +{ > + int err; > + char *base, *endpoint, *port, *colon, *tmp; > + struct addrinfo hints, *res; > + > + endpoint =3D base =3D strdup(endpoint_); > + colon =3D rindex(endpoint, ':'); > + if (colon =3D=3D NULL) > + errx(1, "bad endpoint format %s - no port delimiter found", > endpoint); > + *colon =3D '\0'; > + port =3D colon + 1; > + > + /* [::]:<> */ > + if (endpoint[0] =3D=3D '[') { > + endpoint++; > + tmp =3D index(endpoint, ']'); > + if (tmp =3D=3D NULL) > + errx(1, "bad endpoint format %s - '[' found with no > matching ']'", endpoint); > + *tmp =3D '\0'; > + } > + bzero(&hints, sizeof(hints)); > + hints.ai_family =3D AF_UNSPEC; > + err =3D getaddrinfo(endpoint, port, &hints, &res); > + if (err) > + errx(1, "%s", gai_strerror(err)); > + nvlist_add_binary(nvl_params, "endpoint", res->ai_addr, > res->ai_addrlen); > + freeaddrinfo(res); > + free(base); > +} > + > +static void > +in_len2mask(struct in_addr *mask, u_int len) > +{ > + u_int i; > + u_char *p; > + > + p =3D (u_char *)mask; > + memset(mask, 0, sizeof(*mask)); > + for (i =3D 0; i < len / NBBY; i++) > + p[i] =3D 0xff; > + if (len % NBBY) > + p[i] =3D (0xff00 >> (len % NBBY)) & 0xff; > +} > + > +static u_int > +in_mask2len(struct in_addr *mask) > +{ > + u_int x, y; > + u_char *p; > + > + p =3D (u_char *)mask; > + for (x =3D 0; x < sizeof(*mask); x++) { > + if (p[x] !=3D 0xff) > + break; > + } > + y =3D 0; > + if (x < sizeof(*mask)) { > + for (y =3D 0; y < NBBY; y++) { > + if ((p[x] & (0x80 >> y)) =3D=3D 0) > + break; > + } > + } > + return x * NBBY + y; > +} > + > +static void > +in6_prefixlen2mask(struct in6_addr *maskp, int len) > +{ > + static const u_char maskarray[NBBY] =3D {0x80, 0xc0, 0xe0, 0xf0, 0xf8, > 0xfc, 0xfe, 0xff}; > + int bytelen, bitlen, i; > + > + /* sanity check */ > + if (len < 0 || len > 128) { > + errx(1, "in6_prefixlen2mask: invalid prefix length(%d)\n", > + len); > + return; > + } > + > + memset(maskp, 0, sizeof(*maskp)); > + bytelen =3D len / NBBY; > + bitlen =3D len % NBBY; > + for (i =3D 0; i < bytelen; i++) > + maskp->s6_addr[i] =3D 0xff; > + if (bitlen) > + maskp->s6_addr[bytelen] =3D maskarray[bitlen - 1]; > +} > + > +static int > +in6_mask2len(struct in6_addr *mask, u_char *lim0) > +{ > + int x =3D 0, y; > + u_char *lim =3D lim0, *p; > + > + /* ignore the scope_id part */ > + if (lim0 =3D=3D NULL || lim0 - (u_char *)mask > sizeof(*mask)) > + lim =3D (u_char *)mask + sizeof(*mask); > + for (p =3D (u_char *)mask; p < lim; x++, p++) { > + if (*p !=3D 0xff) > + break; > + } > + y =3D 0; > + if (p < lim) { > + for (y =3D 0; y < NBBY; y++) { > + if ((*p & (0x80 >> y)) =3D=3D 0) > + break; > + } > + } > + > + /* > + * when the limit pointer is given, do a stricter check on the > + * remaining bits. > + */ > + if (p < lim) { > + if (y !=3D 0 && (*p & (0x00ff >> y)) !=3D 0) > + return -1; > + for (p =3D p + 1; p < lim; p++) > + if (*p !=3D 0) > + return -1; > + } > + > + return x * NBBY + y; > +} > + > +static bool > +parse_ip(struct allowedip *aip, const char *value) > +{ > + struct addrinfo hints, *res; > + int err; > + > + bzero(&aip->a_addr, sizeof(aip->a_addr)); > + bzero(&hints, sizeof(hints)); > + hints.ai_family =3D AF_UNSPEC; > + hints.ai_flags =3D AI_NUMERICHOST; > + err =3D getaddrinfo(value, NULL, &hints, &res); > + if (err) > + errx(1, "%s", gai_strerror(err)); > + > + memcpy(&aip->a_addr, res->ai_addr, res->ai_addrlen); > + > + freeaddrinfo(res); > + return (true); > +} > + > +static void > +sa_ntop(const struct sockaddr *sa, char *buf, int *port) > +{ > + const struct sockaddr_in *sin; > + const struct sockaddr_in6 *sin6; > + int err; > + > + err =3D getnameinfo(sa, sa->sa_len, buf, INET6_ADDRSTRLEN, NULL, > + 0, NI_NUMERICHOST); > + > + if (sa->sa_family =3D=3D AF_INET) { > + sin =3D (const struct sockaddr_in *)sa; > + if (port) > + *port =3D sin->sin_port; > + } else if (sa->sa_family =3D=3D AF_INET6) { > + sin6 =3D (const struct sockaddr_in6 *)sa; > + if (port) > + *port =3D sin6->sin6_port; > + } > + > + if (err) > + errx(1, "%s", gai_strerror(err)); > +} > + > +static void > +dump_peer(const nvlist_t *nvl_peer) > +{ > + const void *key; > + const struct allowedip *aips; > + const struct sockaddr *endpoint; > + char outbuf[WG_MAX_STRLEN]; > + char addr_buf[INET6_ADDRSTRLEN]; > + size_t size; > + int count, port; > + > + printf("[Peer]\n"); > + if (nvlist_exists_binary(nvl_peer, "public-key")) { > + key =3D nvlist_get_binary(nvl_peer, "public-key", &size); > + b64_ntop((const uint8_t *)key, size, outbuf, WG_MAX_STRLEN); > + printf("PublicKey =3D %s\n", outbuf); > + } > + if (nvlist_exists_binary(nvl_peer, "endpoint")) { > + endpoint =3D nvlist_get_binary(nvl_peer, "endpoint", &size); > + sa_ntop(endpoint, addr_buf, &port); > + printf("Endpoint =3D %s:%d\n", addr_buf, ntohs(port)); > + } > + > + if (!nvlist_exists_binary(nvl_peer, "allowed-ips")) > + return; > + aips =3D nvlist_get_binary(nvl_peer, "allowed-ips", &size); > + if (size =3D=3D 0 || size % sizeof(struct allowedip) !=3D 0) { > + errx(1, "size %zu not integer multiple of allowedip", size); > + } > + printf("AllowedIPs =3D "); > + count =3D size / sizeof(struct allowedip); > + for (int i =3D 0; i < count; i++) { > + int mask; > + sa_family_t family; > + void *bitmask; > + struct sockaddr *sa; > + > + sa =3D __DECONST(void *, &aips[i].a_addr); > + bitmask =3D __DECONST(void *, > + ((const struct sockaddr *)&aips->a_mask)->sa_data); > + family =3D aips[i].a_addr.ss_family; > + getnameinfo(sa, sa->sa_len, addr_buf, INET6_ADDRSTRLEN, NULL, > + 0, NI_NUMERICHOST); > + if (family =3D=3D AF_INET) > + mask =3D in_mask2len(bitmask); > + else if (family =3D=3D AF_INET6) > + mask =3D in6_mask2len(bitmask, NULL); > + else > + errx(1, "bad family in peer %d\n", family); > + printf("%s/%d", addr_buf, mask); > + if (i < count -1) > + printf(", "); > + } > + printf("\n"); > +} > + > +static int > +get_nvl_out_size(int sock, u_long op, size_t *size) > +{ > + struct ifdrv ifd; > + int err; > + > + memset(&ifd, 0, sizeof(ifd)); > + > + strlcpy(ifd.ifd_name, name, sizeof(ifd.ifd_name)); > + ifd.ifd_cmd =3D op; > + ifd.ifd_len =3D 0; > + ifd.ifd_data =3D NULL; > + > + err =3D ioctl(sock, SIOCGDRVSPEC, &ifd); > + if (err) > + return (err); > + *size =3D ifd.ifd_len; > + return (0); > +} > + > +static int > +do_cmd(int sock, u_long op, void *arg, size_t argsize, int set) > +{ > + struct ifdrv ifd; > + > + memset(&ifd, 0, sizeof(ifd)); > + > + strlcpy(ifd.ifd_name, name, sizeof(ifd.ifd_name)); > + ifd.ifd_cmd =3D op; > + ifd.ifd_len =3D argsize; > + ifd.ifd_data =3D arg; > + > + return (ioctl(sock, set ? SIOCSDRVSPEC : SIOCGDRVSPEC, &ifd)); > +} > + > +static > +DECL_CMD_FUNC(peerlist, val, d) > +{ > + size_t size, peercount; > + void *packed; > + const nvlist_t *nvl, *nvl_peer; > + const nvlist_t *const *nvl_peerlist; > + > + if (get_nvl_out_size(s, WGC_GET, &size)) > + errx(1, "can't get peer list size"); > + if ((packed =3D malloc(size)) =3D=3D NULL) > + errx(1, "malloc failed for peer list"); > + if (do_cmd(s, WGC_GET, packed, size, 0)) > + errx(1, "failed to obtain peer list"); > + > + nvl =3D nvlist_unpack(packed, size, 0); > + if (!nvlist_exists_nvlist_array(nvl, "peer-list")) > + return; > + nvl_peerlist =3D nvlist_get_nvlist_array(nvl, "peer-list", &peercount)= ; > + > + for (int i =3D 0; i < peercount; i++, nvl_peerlist++) { > + nvl_peer =3D *nvl_peerlist; > + dump_peer(nvl_peer); > + } > +} > + > +static void > +peerfinish(int s, void *arg) > +{ > + nvlist_t *nvl, **nvl_array; > + void *packed; > + size_t size; > + > + if ((nvl =3D nvlist_create(0)) =3D=3D NULL) > + errx(1, "failed to allocate nvlist"); > + if ((nvl_array =3D calloc(sizeof(void *), 1)) =3D=3D NULL) > + errx(1, "failed to allocate nvl_array"); > + if (!nvlist_exists_binary(nvl_params, "public-key")) > + errx(1, "must specify a public-key for adding peer"); > + if (!nvlist_exists_binary(nvl_params, "endpoint")) > + errx(1, "must specify an endpoint for adding peer"); > + if (allowed_ips_count =3D=3D 0) > + errx(1, "must specify at least one range of allowed-ips to > add a peer"); + > + nvl_array[0] =3D nvl_params; > + nvlist_add_nvlist_array(nvl, "peer-list", (const nvlist_t * const > *)nvl_array, 1); > + packed =3D nvlist_pack(nvl, &size); > + > + if (do_cmd(s, WGC_SET, packed, size, true)) > + errx(1, "failed to install peer"); > +} > + > +static > +DECL_CMD_FUNC(peerstart, val, d) > +{ > + do_peer =3D true; > + callback_register(peerfinish, NULL); > + allowed_ips =3D malloc(ALLOWEDIPS_START * sizeof(struct allowedip)); > + allowed_ips_max =3D ALLOWEDIPS_START; > + if (allowed_ips =3D=3D NULL) > + errx(1, "failed to allocate array for allowedips"); > +} > + > +static > +DECL_CMD_FUNC(setwglistenport, val, d) > +{ > + struct addrinfo hints, *res; > + const struct sockaddr_in *sin; > + const struct sockaddr_in6 *sin6; > + > + u_long ul; > + int err; > + > + bzero(&hints, sizeof(hints)); > + hints.ai_family =3D AF_UNSPEC; > + hints.ai_flags =3D AI_NUMERICHOST; > + err =3D getaddrinfo(NULL, val, &hints, &res); > + if (err) > + errx(1, "%s", gai_strerror(err)); > + > + if (res->ai_family =3D=3D AF_INET) { > + sin =3D (struct sockaddr_in *)res->ai_addr; > + ul =3D sin->sin_port; > + } else if (res->ai_family =3D=3D AF_INET6) { > + sin6 =3D (struct sockaddr_in6 *)res->ai_addr; > + ul =3D sin6->sin6_port; > + } else { > + errx(1, "unknown family"); > + } > + ul =3D ntohs((u_short)ul); > + nvlist_add_number(nvl_params, "listen-port", ul); > +} > + > +static > +DECL_CMD_FUNC(setwgprivkey, val, d) > +{ > + uint8_t key[WG_KEY_LEN]; > + > + if (!key_from_base64(key, val)) > + errx(1, "invalid key %s", val); > + nvlist_add_binary(nvl_params, "private-key", key, WG_KEY_LEN); > +} > + > +static > +DECL_CMD_FUNC(setwgpubkey, val, d) > +{ > + uint8_t key[WG_KEY_LEN]; > + > + if (!do_peer) > + errx(1, "setting public key only valid when adding peer"); > + > + if (!key_from_base64(key, val)) > + errx(1, "invalid key %s", val); > + nvlist_add_binary(nvl_params, "public-key", key, WG_KEY_LEN); > +} > + > +static > +DECL_CMD_FUNC(setallowedips, val, d) > +{ > + char *base, *allowedip, *mask; > + u_long ul; > + char *endp; > + struct allowedip *aip; > + > + if (!do_peer) > + errx(1, "setting allowed ip only valid when adding peer"); > + if (allowed_ips_count =3D=3D allowed_ips_max) { > + /* XXX grow array */ > + } > + aip =3D &allowed_ips[allowed_ips_count]; > + base =3D allowedip =3D strdup(val); > + mask =3D index(allowedip, '/'); > + if (mask =3D=3D NULL) > + errx(1, "mask separator not found in allowedip %s", val); > + *mask =3D '\0'; > + mask++; > + parse_ip(aip, allowedip); > + ul =3D strtoul(mask, &endp, 0); > + if (*endp !=3D '\0') > + errx(1, "invalid value for allowedip mask"); > + bzero(&aip->a_mask, sizeof(aip->a_mask)); > + if (aip->a_addr.ss_family =3D=3D AF_INET) > + in_len2mask((struct in_addr *)&((struct sockaddr > *)&aip->a_mask)->sa_data, ul); > + else if (aip->a_addr.ss_family =3D=3D AF_INET6) > + in6_prefixlen2mask((struct in6_addr *)&((struct sockaddr > *)&aip->a_mask)->sa_data, ul); > + else > + errx(1, "invalid address family %d\n", > aip->a_addr.ss_family); > + allowed_ips_count++; > + if (allowed_ips_count > 1) > + nvlist_free_binary(nvl_params, "allowed-ips"); > + nvlist_add_binary(nvl_params, "allowed-ips", allowed_ips, > + allowed_ips_count*sizeof(*aip)); > + > + dump_peer(nvl_params); > + free(base); > +} > + > +static > +DECL_CMD_FUNC(setendpoint, val, d) > +{ > + if (!do_peer) > + errx(1, "setting endpoint only valid when adding peer"); > + parse_endpoint(val); > +} > + > +static void > +wireguard_status(int s) > +{ > + size_t size; > + void *packed; > + nvlist_t *nvl; > + char buf[WG_KEY_LEN_BASE64]; > + const void *key; > + uint16_t listen_port; > + > + if (get_nvl_out_size(s, WGC_GET, &size)) > + return; > + if ((packed =3D malloc(size)) =3D=3D NULL) > + return; > + if (do_cmd(s, WGC_GET, packed, size, 0)) > + return; > + nvl =3D nvlist_unpack(packed, size, 0); > + if (nvlist_exists_number(nvl, "listen-port")) { > + listen_port =3D nvlist_get_number(nvl, "listen-port"); > + printf("\tlisten-port: %d\n", listen_port); > + } > + if (nvlist_exists_binary(nvl, "private-key")) { > + key =3D nvlist_get_binary(nvl, "private-key", &size); > + b64_ntop((const uint8_t *)key, size, buf, WG_MAX_STRLEN); > + printf("\tprivate-key: %s\n", buf); > + } > + if (nvlist_exists_binary(nvl, "public-key")) { > + key =3D nvlist_get_binary(nvl, "public-key", &size); > + b64_ntop((const uint8_t *)key, size, buf, WG_MAX_STRLEN); > + printf("\tpublic-key: %s\n", buf); > + } > +} > + > +static struct cmd wireguard_cmds[] =3D { > + DEF_CLONE_CMD_ARG("listen-port", setwglistenport), > + DEF_CLONE_CMD_ARG("private-key", setwgprivkey), > + DEF_CMD("peer-list", 0, peerlist), > + DEF_CMD("peer", 0, peerstart), > + DEF_CMD_ARG("public-key", setwgpubkey), > + DEF_CMD_ARG("allowed-ips", setallowedips), > + DEF_CMD_ARG("endpoint", setendpoint), > +}; > + > +static struct afswtch af_wireguard =3D { > + .af_name =3D "af_wireguard", > + .af_af =3D AF_UNSPEC, > + .af_other_status =3D wireguard_status, > +}; > + > +static void > +wg_create(int s, struct ifreq *ifr) > +{ > + struct iovec iov; > + void *packed; > + size_t size; > + > + setproctitle("ifconfig %s create ...\n", name); > + if (!nvlist_exists_number(nvl_params, "listen-port")) > + goto legacy; > + if (!nvlist_exists_binary(nvl_params, "private-key")) > + goto legacy; > + > + packed =3D nvlist_pack(nvl_params, &size); > + if (packed =3D=3D NULL) > + errx(1, "failed to setup create request"); > + iov.iov_len =3D size; > + iov.iov_base =3D packed; > + ifr->ifr_data =3D (caddr_t)&iov; > + if (ioctl(s, SIOCIFCREATE2, ifr) < 0) > + err(1, "SIOCIFCREATE2"); > + return; > +legacy: > + ifr->ifr_data =3D=3D NULL; > + if (ioctl(s, SIOCIFCREATE, ifr) < 0) > + err(1, "SIOCIFCREATE"); > +} > + > +static __constructor void > +wireguard_ctor(void) > +{ > + int i; > + > + nvl_params =3D nvlist_create(0); > + for (i =3D 0; i < nitems(wireguard_cmds); i++) > + cmd_register(&wireguard_cmds[i]); > + af_register(&af_wireguard); > + clone_setdefcallback_prefix("wg", wg_create); > +} > + > +#endif > > Added: head/sys/dev/if_wg/include/crypto/blake2s.h > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/sys/dev/if_wg/include/crypto/blake2s.h Sun Nov 29 19:38:03 > 2020 (r368163) @@ -0,0 +1,56 @@ > +/* SPDX-License-Identifier: GPL-2.0 OR MIT */ > +/* > + * Copyright (C) 2015-2019 Jason A. Donenfeld . All Ri= ghts > Reserved. > + */ > + > +#include > + > +#ifndef _BLAKE2S_H_ > +#define _BLAKE2S_H_ > + > + > +enum blake2s_lengths { > + BLAKE2S_BLOCK_SIZE =3D 64, > + BLAKE2S_HASH_SIZE =3D 32, > + BLAKE2S_KEY_SIZE =3D 32 > +}; > + > +struct blake2s_state { > + uint32_t h[8]; > + uint32_t t[2]; > + uint32_t f[2]; > + uint8_t buf[BLAKE2S_BLOCK_SIZE]; > + size_t buflen; > + uint8_t last_node; > +}; > + > +void blake2s_init(struct blake2s_state *state, const size_t outlen); > +void blake2s_init_key(struct blake2s_state *state, const size_t outlen, > + const void *key, const size_t keylen); > +void blake2s_update(struct blake2s_state *state, const uint8_t *in, siz= e_t > inlen); +void blake2s_final(struct blake2s_state *state, uint8_t *out, c= onst > size_t outlen); + > +static inline void blake2s(uint8_t *out, const uint8_t *in, const uint8= _t > *key, > + const size_t outlen, const size_t inlen, > + const size_t keylen) > +{ > + struct blake2s_state state; > +#ifdef __linux___ > + WARN_ON(IS_ENABLED(DEBUG) && ((!in && inlen > 0) || !out || !outlen > || > + outlen > BLAKE2S_HASH_SIZE || keylen > BLAKE2S_KEY_SIZE || > + (!key && keylen))); > +#endif > + > + if (keylen) > + blake2s_init_key(&state, outlen, key, keylen); > + else > + blake2s_init(&state, outlen); > + > + blake2s_update(&state, in, inlen); > + blake2s_final(&state, out, outlen); > +} > + > +void blake2s_hmac(uint8_t *out, const uint8_t *in, const uint8_t *key, > + const size_t outlen, const size_t inlen, const size_t > keylen); + > +#endif /* _BLAKE2S_H_ */ > > Added: head/sys/dev/if_wg/include/crypto/curve25519.h > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/sys/dev/if_wg/include/crypto/curve25519.h Sun Nov 29 19:38:03 > 2020 (r368163) @@ -0,0 +1,74 @@ > +/*- > + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD > + * > + * Copyright (c) 2019-2020 Rubicon Communications, LLC (Netgate) > + * > + * Redistribution and use in source and binary forms, with or without > + * modification, are permitted provided that the following conditions > + * are met: > + * 1. Redistributions of source code must retain the above copyright > + * notice, this list of conditions and the following disclaimer. > + * 2. Redistributions in binary form must reproduce the above copyrig= ht > + * notice, this list of conditions and the following disclaimer in= the > + * documentation and/or other materials provided with the distribu= tion. > + * > + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' A= ND > + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, TH= E > + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR P= URPOSE > + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIA= BLE > + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQU= ENTIAL > + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GO= ODS > + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION= ) > + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, = STRICT > + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN AN= Y WAY > + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY = OF > + * SUCH DAMAGE. > + * > + * $FreeBSD$ > + */ > + > +#ifndef _CURVE25519_H_ > +#define _CURVE25519_H_ > + > +#include > + > +#define CURVE25519_KEY_SIZE 32 > + > +void curve25519_generic(u8 [CURVE25519_KEY_SIZE], > + const u8 [CURVE25519_KEY_SIZE], > + const u8 [CURVE25519_KEY_SIZE]); > + > +static inline void curve25519_clamp_secret(u8 secret[CURVE25519_KEY_SIZ= E]) > +{ > + secret[0] &=3D 248; > + secret[31] =3D (secret[31] & 127) | 64; > +} > + > +static const u8 null_point[CURVE25519_KEY_SIZE] =3D { 0 }; > + > +static inline int curve25519(u8 mypublic[CURVE25519_KEY_SIZE], > + const u8 secret[CURVE25519_KEY_SIZE], > + const u8 basepoint[CURVE25519_KEY_SIZE]) > +{ > + curve25519_generic(mypublic, secret, basepoint); > + return timingsafe_bcmp(mypublic, null_point, CURVE25519_KEY_SIZE); > +} > + > +static inline int curve25519_generate_public(u8 pub[CURVE25519_KEY_SIZE= ], > + const u8 secret[CURVE25519_KEY_SIZE]) > +{ > + static const u8 basepoint[CURVE25519_KEY_SIZE] __aligned(32) =3D { 9 }= ; > + > + if (timingsafe_bcmp(secret, null_point, CURVE25519_KEY_SIZE) =3D=3D 0) > + return 0; > + > + return curve25519(pub, secret, basepoint); > +} > + > +static inline void curve25519_generate_secret(u8 secret[CURVE25519_KEY_= SIZE]) > +{ > + arc4random_buf(secret, CURVE25519_KEY_SIZE); > + curve25519_clamp_secret(secret); > +} > + > +#endif /* _CURVE25519_H_ */ > > Added: head/sys/dev/if_wg/include/crypto/zinc.h > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/sys/dev/if_wg/include/crypto/zinc.h Sun Nov 29 19:38:03 > 2020 (r368163) @@ -0,0 +1,15 @@ > +/* SPDX-License-Identifier: GPL-2.0 OR MIT */ > +/* > + * Copyright (C) 2015-2019 Jason A. Donenfeld . All Ri= ghts > Reserved. > + */ > + > +#ifndef _WG_ZINC_H > +#define _WG_ZINC_H > + > +int chacha20_mod_init(void); > +int poly1305_mod_init(void); > +int chacha20poly1305_mod_init(void); > +int blake2s_mod_init(void); > +int curve25519_mod_init(void); > + > +#endif > > Added: head/sys/dev/if_wg/include/sys/if_wg_session.h > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/sys/dev/if_wg/include/sys/if_wg_session.h Sun Nov 29 19:38:03 > 2020 (r368163) @@ -0,0 +1,89 @@ > +/* > + * Copyright (c) 2019 Matt Dunwoodie > + * > + * Permission to use, copy, modify, and distribute this software for an= y > + * purpose with or without fee is hereby granted, provided that the abo= ve > + * copyright notice and this permission notice appear in all copies. > + * > + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRAN= TIES > + * 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 DAMAG= ES > + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN A= N > + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT= OF > + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. > + * > + * $FreeBSD$ > + */ > + > +#ifndef __IF_WG_H__ > +#define __IF_WG_H__ > + > +#include > +#include > + > +/* > + * This is the public interface to the WireGuard network interface. > + * > + * It is designed to be used by tools such as ifconfig(8) and wg(4). > + */ > + > +#define WG_KEY_SIZE 32 > + > +#define WG_DEVICE_HAS_PUBKEY (1 << 0) > +#define WG_DEVICE_HAS_PRIVKEY (1 << 1) > +#define WG_DEVICE_HAS_MASKED_PRIVKEY (1 << 2) > +#define WG_DEVICE_HAS_PORT (1 << 3) > +#define WG_DEVICE_HAS_RDOMAIN (1 << 4) > +#define WG_DEVICE_REPLACE_PEERS (1 << 5) > + > +#define WG_PEER_HAS_PUBKEY (1 << 0) > +#define WG_PEER_HAS_SHAREDKEY (1 << 1) > +#define WG_PEER_HAS_MASKED_SHAREDKEY (1 << 2) > +#define WG_PEER_HAS_ENDPOINT (1 << 3) > +#define WG_PEER_HAS_PERSISTENTKEEPALIVE (1 << 4) > +#define WG_PEER_REPLACE_CIDRS (1 << 5) > +#define WG_PEER_REMOVE (1 << 6) > + > +#define SIOCSWG _IOWR('i', 200, struct wg_device_io) > +#define SIOCGWG _IOWR('i', 201, struct wg_device_io) > + > +#define WG_PEERS_FOREACH(p, d) \ > + for (p =3D (d)->d_peers; p < (d)->d_peers + (d)->d_num_peers; p++) > +#define WG_CIDRS_FOREACH(c, p) \ > + for (c =3D (p)->p_cidrs; c < (p)->p_cidrs + (p)->p_num_cidrs; c++) > + > +struct wg_allowedip { > + struct sockaddr_storage a_addr; > + struct sockaddr_storage a_mask; > +}; > + > +enum { > + WG_PEER_CTR_TX_BYTES, > + WG_PEER_CTR_RX_BYTES, > + WG_PEER_CTR_NUM, > +}; > + > +struct wg_device_io { > + char d_name[IFNAMSIZ]; > + uint8_t d_flags; > + in_port_t d_port; > + int d_rdomain; > + uint8_t d_pubkey[WG_KEY_SIZE]; > + uint8_t d_privkey[WG_KEY_SIZE]; > + size_t d_num_peers; > + size_t d_num_cidrs; > + struct wg_peer_io *d_peers; > +}; > + > + > +#ifndef ENOKEY > +#define ENOKEY ENOTCAPABLE > +#endif > + > +typedef enum { > + WGC_GET =3D 0x5, > + WGC_SET =3D 0x6, > +} wg_cmd_t; > + > +#endif /* __IF_WG_H__ */ > > Added: head/sys/dev/if_wg/include/sys/if_wg_session_vars.h > =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D=3D= =3D=3D=3D=3D=3D=3D > --- /dev/null 00:00:00 1970 (empty, because file is newly added) > +++ head/sys/dev/if_wg/include/sys/if_wg_session_vars.h Sun Nov 29 > 19:38:03 2020 (r368163) @@ -0,0 +1,322 @@ > +/* > + * Copyright (c) 2019 Matt Dunwoodie > + * Copyright (c) 2019-2020 Rubicon Communications, LLC (Netgate) > + * > + * Permission to use, copy, modify, and distribute this software for an= y > + * purpose with or without fee is hereby granted, provided that the abo= ve > + * copyright notice and this permission notice appear in all copies. > + * > + * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRAN= TIES > + * 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 DAMAG= ES > + * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN A= N > + * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT= OF > + * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. > + * > + * $FreeBSD$ > + */ > + > +#ifndef _IF_WG_VARS_H_ > +#define _IF_WG_VARS_H_ > + > +#include > +#include > +#include > + > +#include > +#include > +#include > + > + > +#include > +#include > +#include > +#include > +#include > +#include > + > +#include > +#include > +/* This is only needed for wg_keypair. */ > +#include > + > +#define UNIMPLEMENTED() panic("%s not implemented\n", __func__) > + > +#define WG_KEY_SIZE 32 > +#define WG_MSG_PADDING_SIZE 16 > + > + > +/* Constant for session */ > +#define REKEY_TIMEOUT 5 > +#define REKEY_TIMEOUT_JITTER 500 /* TODO ok? jason */ > +#define REJECT_AFTER_TIME 180 > +#define KEEPALIVE_TIMEOUT 10 > +#define MAX_TIMER_HANDSHAKES (90 / REKEY_TIMEOUT) > +#define NEW_HANDSHAKE_TIMEOUT (REKEY_TIMEOUT + > KEEPALIVE_TIMEOUT) + > +#define MAX_QUEUED_INCOMING_HANDSHAKES 4096 /* TODO: replace this > with DQL */ +#define MAX_QUEUED_PACKETS 1024 /* TODO: replace > this with DQL */ + > +#define HASHTABLE_PEER_SIZE (1 << 6) > //1 << 11 +#define HASHTABLE_INDEX_SIZE (HASHTABLE_PEER_SIZE * > 3) //1 << 13 + > +#define PEER_MAGIC1 0xCAFEBABEB00FDADDULL > +#define PEER_MAGIC2 0xCAAFD0D0D00DBABEULL > +#define PEER_MAGIC3 0xD00DBABEF00DFADEULL > + > + > +enum message_type { > + MESSAGE_INVALID =3D 0, > + MESSAGE_HANDSHAKE_INITIATION =3D 1, > + MESSAGE_HANDSHAKE_RESPONSE =3D 2, > + MESSAGE_HANDSHAKE_COOKIE =3D 3, > + MESSAGE_DATA =3D 4 > +}; > + > +struct wg_softc; > + > +#if __FreeBSD_version > 1300000 > +typedef void timeout_t (void *); > +#endif > + > +/* Socket */ > +struct wg_endpoint { > + union wg_remote { > + struct sockaddr r_sa; > + struct sockaddr_in r_sin; > + struct sockaddr_in6 r_sin6; > + } e_remote; > + union wg_source { > + struct in_addr l_in; > + struct in6_pktinfo l_pktinfo6; > +#define l_in6 l_pktinfo6.ipi6_addr > + } e_local; > +}; > + > +struct wg_socket { > + struct mtx so_mtx; > + in_port_t so_port; > + struct socket *so_so4; > + struct socket *so_so6; > +}; > + > +struct wg_queue { > + struct mtx q_mtx; > + struct mbufq q; > +}; > + > +struct wg_index { > + LIST_ENTRY(wg_index) i_entry; > + SLIST_ENTRY(wg_index) i_unused_entry; > + uint32_t i_key; > > *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** > _______________________________________________ > 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-unsubscribe@freebsd.org" "make installkernel" fails for me in a non-DEBUG environment with the erro= r shown below. Recent CURRENT source tree is r368226, failing systems are ru= nning at r368055 or r368226. [...] =3D=3D=3D> i2c/cyapa (install) =2D-- realinstall_subdir_if_wg --- install -T dbg -o root -g wheel -m 555 if_wg.ko.debug /usr/lib/debug/boot/kernel/ install: /usr/lib/debug/boot/kernel/: No such = file or directory --- realinstall_subdir_iflib --- =2D-- _kmodinstall --- =2D-- realinstall_subdir_if_wg --- *** [_kmodinstall] Error code 71 make[4]: stopped in /usr/src/sys/modules/if_wg 1 error make[4]: stopped in /usr/src/sys/modules/if_wg =2D-- realinstall_subdir_iflib --- install -T release -o root -g wheel -m 555 iflib.ko /boot/kernel/ =2D-- realinstall_subdir_if_wg --- =2D-- realinstall_subdir_geom --- =2D-- realinstall_subdir_iflib --- =2D-- realinstall_subdir_i2c --- *** [modules-install] Error code 2 [...] From owner-svn-src-head@freebsd.org Tue Dec 1 13:48:03 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 716974AA5A9; Tue, 1 Dec 2020 13:48:03 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Clk2C2k6nz3pcr; Tue, 1 Dec 2020 13:48:03 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from mail-qt1-f178.google.com (mail-qt1-f178.google.com [209.85.160.178]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) (Authenticated sender: kevans) by smtp.freebsd.org (Postfix) with ESMTPSA id 47EBD9D2E; Tue, 1 Dec 2020 13:48:03 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: by mail-qt1-f178.google.com with SMTP id l7so1080215qtp.8; Tue, 01 Dec 2020 05:48:03 -0800 (PST) X-Gm-Message-State: AOAM531Jq40dqLA3SA/myYPTJ5E8Ytq0mJJpcIupkrDS9j/6Eow+p9tg +HkySelYUNCy3aKwyXLUzyy3v9+GZ+/HvXTO7Pc= X-Google-Smtp-Source: ABdhPJzSZ87yrgvpuHFMKAekIuidblfbL1L1wFS2/9YS2znQ1Tq7JDwB46V51+LueefoDOAcDSmAiZN0fJAHdq06WlI= X-Received: by 2002:ac8:5345:: with SMTP id d5mr2957316qto.60.1606830482738; Tue, 01 Dec 2020 05:48:02 -0800 (PST) MIME-Version: 1.0 References: <202011291938.0ATJc4Z3081193@repo.freebsd.org> <20201201143901.72e74311@freyja> In-Reply-To: <20201201143901.72e74311@freyja> From: Kyle Evans Date: Tue, 1 Dec 2020 07:47:50 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r368163 - in head: sbin/ifconfig sys/dev/if_wg sys/dev/if_wg/include sys/dev/if_wg/include/crypto sys/dev/if_wg/include/sys sys/dev/if_wg/include/zinc sys/dev/if_wg/module sys/dev/if_wg... To: "O. Hartmann" Cc: Matt Macy , src-committers , svn-src-all , svn-src-head Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Dec 2020 13:48:03 -0000 On Tue, Dec 1, 2020 at 7:39 AM O. Hartmann wrote: > > On Sun, 29 Nov 2020 19:38:04 +0000 (UTC) > Matt Macy wrote: > > > Author: mmacy > > Date: Sun Nov 29 19:38:03 2020 > > New Revision: 368163 > > URL: https://svnweb.freebsd.org/changeset/base/368163 > > > > Log: > > Import kernel WireGuard support > > > > Data path largely shared with the OpenBSD implementation by > > Matt Dunwoodie > > > > Reviewed by: grehan@freebsd.org > > MFC after: 1 month > > Sponsored by: Rubicon LLC, (Netgate) > > Differential Revision: https://reviews.freebsd.org/D26137 > > > > [... snip ...] > > "make installkernel" fails for me in a non-DEBUG environment with the error > shown below. Recent CURRENT source tree is r368226, failing systems are running > at r368055 or r368226. > > [...] > > ===> i2c/cyapa (install) > --- realinstall_subdir_if_wg --- > install -T dbg -o root -g wheel -m 555 if_wg.ko.debug > /usr/lib/debug/boot/kernel/ install: /usr/lib/debug/boot/kernel/: No such file > or directory --- realinstall_subdir_iflib --- > --- _kmodinstall --- > --- realinstall_subdir_if_wg --- > *** [_kmodinstall] Error code 71 > > make[4]: stopped in /usr/src/sys/modules/if_wg > 1 error > > make[4]: stopped in /usr/src/sys/modules/if_wg > --- realinstall_subdir_iflib --- > install -T release -o root -g wheel -m 555 iflib.ko /boot/kernel/ > --- realinstall_subdir_if_wg --- > --- realinstall_subdir_geom --- > --- realinstall_subdir_iflib --- > --- realinstall_subdir_i2c --- > *** [modules-install] Error code 2 > > [...] Go to sys/modules/if_wg/Makefile and rip out the DEBUG_FLAGS line, this should fix it. From owner-svn-src-head@freebsd.org Tue Dec 1 15:53:17 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E709E4AC9D8; Tue, 1 Dec 2020 15:53:17 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Clmpj63syz4S3T; Tue, 1 Dec 2020 15:53:17 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C284B18134; Tue, 1 Dec 2020 15:53:17 +0000 (UTC) (envelope-from mm@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B1FrHZf062583; Tue, 1 Dec 2020 15:53:17 GMT (envelope-from mm@FreeBSD.org) Received: (from mm@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B1FrCja062556; Tue, 1 Dec 2020 15:53:12 GMT (envelope-from mm@FreeBSD.org) Message-Id: <202012011553.0B1FrCja062556@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mm set sender to mm@FreeBSD.org using -f From: Martin Matuska Date: Tue, 1 Dec 2020 15:53:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368234 - in head: contrib/libarchive contrib/libarchive/libarchive contrib/libarchive/libarchive/test contrib/libarchive/test_utils lib/libarchive lib/libarchive/tests usr.bin/bsdcat u... X-SVN-Group: head X-SVN-Commit-Author: mm X-SVN-Commit-Paths: in head: contrib/libarchive contrib/libarchive/libarchive contrib/libarchive/libarchive/test contrib/libarchive/test_utils lib/libarchive lib/libarchive/tests usr.bin/bsdcat usr.bin/cpio usr.bin/tar X-SVN-Commit-Revision: 368234 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Dec 2020 15:53:18 -0000 Author: mm Date: Tue Dec 1 15:53:12 2020 New Revision: 368234 URL: https://svnweb.freebsd.org/changeset/base/368234 Log: MFV r368207: Update libarchive to 3.5.0 Relevant vendor changes: Issue #1258: add archive_read_support_filter_by_code() PR #1347: mtree digest reader support Issue #1381: skip hardlinks pointing to itself on extraction PR #1387: fix writing of cpio archives with hardlinks without file type PR #1388: fix rdev field in cpio format for device nodes PR #1389: completed support for UTF-8 encoding conversion PR #1405: more formats in archive_read_support_format_by_code() PR #1408: fix uninitialized size in rar5_read_data PR #1409: system extended attribute support PR #1435: support for decompression of symbolic links in zipx archives Issue #1456: memory leak after unsuccessful archive_write_open_filename MFC after: 1 week Added: head/contrib/libarchive/libarchive/archive_read_support_filter_by_code.c - copied unchanged from r368207, vendor/libarchive/dist/libarchive/archive_read_support_filter_by_code.c head/contrib/libarchive/libarchive/test/test_read_format_zip_7z_lzma.zip.uu - copied unchanged from r368207, vendor/libarchive/dist/libarchive/test/test_read_format_zip_7z_lzma.zip.uu Modified: head/contrib/libarchive/COPYING head/contrib/libarchive/NEWS head/contrib/libarchive/libarchive/archive.h head/contrib/libarchive/libarchive/archive_acl.c head/contrib/libarchive/libarchive/archive_check_magic.c head/contrib/libarchive/libarchive/archive_cryptor.c head/contrib/libarchive/libarchive/archive_cryptor_private.h head/contrib/libarchive/libarchive/archive_digest_private.h head/contrib/libarchive/libarchive/archive_entry.c head/contrib/libarchive/libarchive/archive_entry.h head/contrib/libarchive/libarchive/archive_entry_private.h head/contrib/libarchive/libarchive/archive_ppmd7.c head/contrib/libarchive/libarchive/archive_read_disk_entry_from_file.c head/contrib/libarchive/libarchive/archive_read_filter.3 head/contrib/libarchive/libarchive/archive_read_set_format.c head/contrib/libarchive/libarchive/archive_read_support_format_by_code.c head/contrib/libarchive/libarchive/archive_read_support_format_cab.c head/contrib/libarchive/libarchive/archive_read_support_format_empty.c head/contrib/libarchive/libarchive/archive_read_support_format_mtree.c head/contrib/libarchive/libarchive/archive_read_support_format_rar.c head/contrib/libarchive/libarchive/archive_read_support_format_rar5.c head/contrib/libarchive/libarchive/archive_read_support_format_warc.c head/contrib/libarchive/libarchive/archive_read_support_format_zip.c head/contrib/libarchive/libarchive/archive_string.c head/contrib/libarchive/libarchive/archive_string.h head/contrib/libarchive/libarchive/archive_util.c head/contrib/libarchive/libarchive/archive_write.c head/contrib/libarchive/libarchive/archive_write_add_filter_xz.c head/contrib/libarchive/libarchive/archive_write_disk_posix.c head/contrib/libarchive/libarchive/archive_write_open.3 head/contrib/libarchive/libarchive/archive_write_open_fd.c head/contrib/libarchive/libarchive/archive_write_open_file.c head/contrib/libarchive/libarchive/archive_write_open_filename.c head/contrib/libarchive/libarchive/archive_write_open_memory.c head/contrib/libarchive/libarchive/archive_write_private.h head/contrib/libarchive/libarchive/archive_write_set_format_7zip.c head/contrib/libarchive/libarchive/archive_write_set_format_cpio.c head/contrib/libarchive/libarchive/archive_write_set_format_cpio_newc.c head/contrib/libarchive/libarchive/archive_write_set_format_iso9660.c head/contrib/libarchive/libarchive/archive_write_set_format_mtree.c head/contrib/libarchive/libarchive/archive_write_set_format_xar.c head/contrib/libarchive/libarchive/archive_write_set_format_zip.c head/contrib/libarchive/libarchive/test/test_archive_read_next_header_empty.c head/contrib/libarchive/libarchive/test/test_archive_read_support.c head/contrib/libarchive/libarchive/test/test_archive_string_conversion.c head/contrib/libarchive/libarchive/test/test_entry.c head/contrib/libarchive/libarchive/test/test_read_disk_directory_traversals.c head/contrib/libarchive/libarchive/test/test_read_format_mtree.c head/contrib/libarchive/libarchive/test/test_read_format_mtree.mtree.uu head/contrib/libarchive/libarchive/test/test_read_format_raw.c head/contrib/libarchive/libarchive/test/test_read_format_zip.c head/contrib/libarchive/libarchive/test/test_read_set_format.c head/contrib/libarchive/libarchive/test/test_write_disk_secure.c head/contrib/libarchive/libarchive/test/test_write_format_cpio.c head/contrib/libarchive/libarchive/test/test_write_format_warc.c head/contrib/libarchive/test_utils/test_common.h head/contrib/libarchive/test_utils/test_main.c head/lib/libarchive/Makefile head/lib/libarchive/config_freebsd.h head/lib/libarchive/tests/Makefile head/usr.bin/bsdcat/Makefile head/usr.bin/cpio/Makefile head/usr.bin/tar/Makefile Directory Properties: head/contrib/libarchive/ (props changed) Modified: head/contrib/libarchive/COPYING ============================================================================== --- head/contrib/libarchive/COPYING Tue Dec 1 15:15:18 2020 (r368233) +++ head/contrib/libarchive/COPYING Tue Dec 1 15:53:12 2020 (r368234) @@ -15,7 +15,6 @@ the actual statements in the files are controlling. * The following source files are also subject in whole or in part to a 3-clause UC Regents copyright; please read the individual source files for details: - libarchive/archive_entry.c libarchive/archive_read_support_filter_compress.c libarchive/archive_write_add_filter_compress.c libarchive/mtree.5 Modified: head/contrib/libarchive/NEWS ============================================================================== --- head/contrib/libarchive/NEWS Tue Dec 1 15:15:18 2020 (r368233) +++ head/contrib/libarchive/NEWS Tue Dec 1 15:53:12 2020 (r368234) @@ -1,3 +1,7 @@ +Dec 01, 2020: libarchive 3.5.0 released + +Oct 14, 2020: Support for system extended attributes + May 20, 2020: libarchive 3.4.3 released Apr 30, 2020: Support for pzstd compressed files Modified: head/contrib/libarchive/libarchive/archive.h ============================================================================== --- head/contrib/libarchive/libarchive/archive.h Tue Dec 1 15:15:18 2020 (r368233) +++ head/contrib/libarchive/libarchive/archive.h Tue Dec 1 15:53:12 2020 (r368234) @@ -36,7 +36,7 @@ * assert that ARCHIVE_VERSION_NUMBER >= 2012108. */ /* Note: Compiler will complain if this does not match archive_entry.h! */ -#define ARCHIVE_VERSION_NUMBER 3004003 +#define ARCHIVE_VERSION_NUMBER 3005000 #include #include /* for wchar_t */ @@ -155,7 +155,7 @@ __LA_DECL int archive_version_number(void); /* * Textual name/version of the library, useful for version displays. */ -#define ARCHIVE_VERSION_ONLY_STRING "3.4.3" +#define ARCHIVE_VERSION_ONLY_STRING "3.5.0" #define ARCHIVE_VERSION_STRING "libarchive " ARCHIVE_VERSION_ONLY_STRING __LA_DECL const char * archive_version_string(void); @@ -246,6 +246,8 @@ typedef int archive_open_callback(struct archive *, vo typedef int archive_close_callback(struct archive *, void *_client_data); +typedef int archive_free_callback(struct archive *, void *_client_data); + /* Switches from one client data object to the next/prev client data object. * This is useful for reading from different data blocks such as a set of files * that make up one large file. @@ -418,6 +420,7 @@ __LA_DECL int archive_read_support_compression_xz(stru #endif __LA_DECL int archive_read_support_filter_all(struct archive *); +__LA_DECL int archive_read_support_filter_by_code(struct archive *, int); __LA_DECL int archive_read_support_filter_bzip2(struct archive *); __LA_DECL int archive_read_support_filter_compress(struct archive *); __LA_DECL int archive_read_support_filter_gzip(struct archive *); @@ -817,9 +820,13 @@ __LA_DECL int archive_write_set_format_filter_by_ext(s __LA_DECL int archive_write_set_format_filter_by_ext_def(struct archive *a, const char *filename, const char * def_ext); __LA_DECL int archive_write_zip_set_compression_deflate(struct archive *); __LA_DECL int archive_write_zip_set_compression_store(struct archive *); +/* Deprecated; use archive_write_open2 instead */ __LA_DECL int archive_write_open(struct archive *, void *, archive_open_callback *, archive_write_callback *, archive_close_callback *); +__LA_DECL int archive_write_open2(struct archive *, void *, + archive_open_callback *, archive_write_callback *, + archive_close_callback *, archive_free_callback *); __LA_DECL int archive_write_open_fd(struct archive *, int _fd); __LA_DECL int archive_write_open_filename(struct archive *, const char *_file); __LA_DECL int archive_write_open_filename_w(struct archive *, Modified: head/contrib/libarchive/libarchive/archive_acl.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_acl.c Tue Dec 1 15:15:18 2020 (r368233) +++ head/contrib/libarchive/libarchive/archive_acl.c Tue Dec 1 15:53:12 2020 (r368234) @@ -595,7 +595,7 @@ archive_acl_text_len(struct archive_acl *acl, int want else length += sizeof(uid_t) * 3 + 1; } else { - r = archive_mstring_get_mbs_l(&ap->name, &name, + r = archive_mstring_get_mbs_l(a, &ap->name, &name, &len, sc); if (r != 0) return (0); @@ -968,7 +968,7 @@ archive_acl_to_text_l(struct archive_acl *acl, ssize_t else prefix = NULL; r = archive_mstring_get_mbs_l( - &ap->name, &name, &len, sc); + NULL, &ap->name, &name, &len, sc); if (r != 0) { free(s); return (NULL); @@ -1402,14 +1402,14 @@ isint_w(const wchar_t *start, const wchar_t *end, int if (start >= end) return (0); while (start < end) { - if (*start < '0' || *start > '9') + if (*start < L'0' || *start > L'9') return (0); if (n > (INT_MAX / 10) || - (n == INT_MAX / 10 && (*start - '0') > INT_MAX % 10)) { + (n == INT_MAX / 10 && (*start - L'0') > INT_MAX % 10)) { n = INT_MAX; } else { n *= 10; - n += *start - '0'; + n += *start - L'0'; } start++; } Modified: head/contrib/libarchive/libarchive/archive_check_magic.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_check_magic.c Tue Dec 1 15:15:18 2020 (r368233) +++ head/contrib/libarchive/libarchive/archive_check_magic.c Tue Dec 1 15:53:12 2020 (r368234) @@ -54,7 +54,7 @@ errmsg(const char *m) ssize_t written; while (s > 0) { - written = write(2, m, strlen(m)); + written = write(2, m, s); if (written <= 0) return; m += written; Modified: head/contrib/libarchive/libarchive/archive_cryptor.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_cryptor.c Tue Dec 1 15:15:18 2020 (r368233) +++ head/contrib/libarchive/libarchive/archive_cryptor.c Tue Dec 1 15:53:12 2020 (r368234) @@ -347,8 +347,31 @@ aes_ctr_init(archive_crypto_ctx *ctx, const uint8_t *k static int aes_ctr_encrypt_counter(archive_crypto_ctx *ctx) { +#if NETTLE_VERSION_MAJOR < 3 aes_set_encrypt_key(&ctx->ctx, ctx->key_len, ctx->key); aes_encrypt(&ctx->ctx, AES_BLOCK_SIZE, ctx->encr_buf, ctx->nonce); +#else + switch(ctx->key_len) { + case AES128_KEY_SIZE: + aes128_set_encrypt_key(&ctx->ctx.c128, ctx->key); + aes128_encrypt(&ctx->ctx.c128, AES_BLOCK_SIZE, ctx->encr_buf, + ctx->nonce); + break; + case AES192_KEY_SIZE: + aes192_set_encrypt_key(&ctx->ctx.c192, ctx->key); + aes192_encrypt(&ctx->ctx.c192, AES_BLOCK_SIZE, ctx->encr_buf, + ctx->nonce); + break; + case AES256_KEY_SIZE: + aes256_set_encrypt_key(&ctx->ctx.c256, ctx->key); + aes256_encrypt(&ctx->ctx.c256, AES_BLOCK_SIZE, ctx->encr_buf, + ctx->nonce); + break; + default: + return -1; + break; + } +#endif return 0; } Modified: head/contrib/libarchive/libarchive/archive_cryptor_private.h ============================================================================== --- head/contrib/libarchive/libarchive/archive_cryptor_private.h Tue Dec 1 15:15:18 2020 (r368233) +++ head/contrib/libarchive/libarchive/archive_cryptor_private.h Tue Dec 1 15:53:12 2020 (r368234) @@ -104,9 +104,18 @@ typedef struct { #include #endif #include +#include typedef struct { +#if NETTLE_VERSION_MAJOR < 3 struct aes_ctx ctx; +#else + union { + struct aes128_ctx c128; + struct aes192_ctx c192; + struct aes256_ctx c256; + } ctx; +#endif uint8_t key[AES_MAX_KEY_SIZE]; unsigned key_len; uint8_t nonce[AES_BLOCK_SIZE]; Modified: head/contrib/libarchive/libarchive/archive_digest_private.h ============================================================================== --- head/contrib/libarchive/libarchive/archive_digest_private.h Tue Dec 1 15:15:18 2020 (r368233) +++ head/contrib/libarchive/libarchive/archive_digest_private.h Tue Dec 1 15:53:12 2020 (r368234) @@ -30,6 +30,10 @@ #ifndef __LIBARCHIVE_BUILD #error This header is only to be used internally to libarchive. #endif +#ifndef __LIBARCHIVE_CONFIG_H_INCLUDED +#error "Should have include config.h first!" +#endif + /* * Crypto support in various Operating Systems: * Modified: head/contrib/libarchive/libarchive/archive_entry.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_entry.c Tue Dec 1 15:15:18 2020 (r368233) +++ head/contrib/libarchive/libarchive/archive_entry.c Tue Dec 1 15:53:12 2020 (r368234) @@ -208,6 +208,19 @@ archive_entry_clone(struct archive_entry *entry) /* Copy encryption status */ entry2->encryption = entry->encryption; + + /* Copy digests */ +#define copy_digest(_e2, _e, _t) \ + memcpy(_e2->digest._t, _e->digest._t, sizeof(_e2->digest._t)) + + copy_digest(entry2, entry, md5); + copy_digest(entry2, entry, rmd160); + copy_digest(entry2, entry, sha1); + copy_digest(entry2, entry, sha256); + copy_digest(entry2, entry, sha384); + copy_digest(entry2, entry, sha512); + +#undef copy_digest /* Copy ACL data over. */ archive_acl_copy(&entry2->acl, &entry->acl); @@ -450,7 +463,7 @@ int _archive_entry_gname_l(struct archive_entry *entry, const char **p, size_t *len, struct archive_string_conv *sc) { - return (archive_mstring_get_mbs_l(&entry->ae_gname, p, len, sc)); + return (archive_mstring_get_mbs_l(entry->archive, &entry->ae_gname, p, len, sc)); } const char * @@ -504,7 +517,7 @@ _archive_entry_hardlink_l(struct archive_entry *entry, *len = 0; return (0); } - return (archive_mstring_get_mbs_l(&entry->ae_hardlink, p, len, sc)); + return (archive_mstring_get_mbs_l(entry->archive, &entry->ae_hardlink, p, len, sc)); } la_int64_t @@ -595,7 +608,7 @@ int _archive_entry_pathname_l(struct archive_entry *entry, const char **p, size_t *len, struct archive_string_conv *sc) { - return (archive_mstring_get_mbs_l(&entry->ae_pathname, p, len, sc)); + return (archive_mstring_get_mbs_l(entry->archive, &entry->ae_pathname, p, len, sc)); } __LA_MODE_T @@ -723,7 +736,7 @@ _archive_entry_symlink_l(struct archive_entry *entry, *len = 0; return (0); } - return (archive_mstring_get_mbs_l( &entry->ae_symlink, p, len, sc)); + return (archive_mstring_get_mbs_l(entry->archive, &entry->ae_symlink, p, len, sc)); } la_int64_t @@ -769,7 +782,7 @@ int _archive_entry_uname_l(struct archive_entry *entry, const char **p, size_t *len, struct archive_string_conv *sc) { - return (archive_mstring_get_mbs_l(&entry->ae_uname, p, len, sc)); + return (archive_mstring_get_mbs_l(entry->archive, &entry->ae_uname, p, len, sc)); } int @@ -1414,6 +1427,62 @@ archive_entry_copy_mac_metadata(struct archive_entry * abort(); memcpy(entry->mac_metadata, p, s); } +} + +/* Digest handling */ +const unsigned char * +archive_entry_digest(struct archive_entry *entry, int type) +{ + switch (type) { + case ARCHIVE_ENTRY_DIGEST_MD5: + return entry->digest.md5; + case ARCHIVE_ENTRY_DIGEST_RMD160: + return entry->digest.rmd160; + case ARCHIVE_ENTRY_DIGEST_SHA1: + return entry->digest.sha1; + case ARCHIVE_ENTRY_DIGEST_SHA256: + return entry->digest.sha256; + case ARCHIVE_ENTRY_DIGEST_SHA384: + return entry->digest.sha384; + case ARCHIVE_ENTRY_DIGEST_SHA512: + return entry->digest.sha512; + default: + return NULL; + } +} + +int +archive_entry_set_digest(struct archive_entry *entry, int type, + const unsigned char *digest) +{ +#define copy_digest(_e, _t, _d)\ + memcpy(_e->digest._t, _d, sizeof(_e->digest._t)) + + switch (type) { + case ARCHIVE_ENTRY_DIGEST_MD5: + copy_digest(entry, md5, digest); + break; + case ARCHIVE_ENTRY_DIGEST_RMD160: + copy_digest(entry, rmd160, digest); + break; + case ARCHIVE_ENTRY_DIGEST_SHA1: + copy_digest(entry, sha1, digest); + break; + case ARCHIVE_ENTRY_DIGEST_SHA256: + copy_digest(entry, sha256, digest); + break; + case ARCHIVE_ENTRY_DIGEST_SHA384: + copy_digest(entry, sha384, digest); + break; + case ARCHIVE_ENTRY_DIGEST_SHA512: + copy_digest(entry, sha512, digest); + break; + default: + return ARCHIVE_WARN; + } + + return ARCHIVE_OK; +#undef copy_digest } /* Modified: head/contrib/libarchive/libarchive/archive_entry.h ============================================================================== --- head/contrib/libarchive/libarchive/archive_entry.h Tue Dec 1 15:15:18 2020 (r368233) +++ head/contrib/libarchive/libarchive/archive_entry.h Tue Dec 1 15:53:12 2020 (r368234) @@ -30,7 +30,7 @@ #define ARCHIVE_ENTRY_H_INCLUDED /* Note: Compiler will complain if this does not match archive.h! */ -#define ARCHIVE_VERSION_NUMBER 3004003 +#define ARCHIVE_VERSION_NUMBER 3005000 /* * Note: archive_entry.h is for use outside of libarchive; the @@ -395,6 +395,19 @@ __LA_DECL void archive_entry_copy_stat(struct archive_ __LA_DECL const void * archive_entry_mac_metadata(struct archive_entry *, size_t *); __LA_DECL void archive_entry_copy_mac_metadata(struct archive_entry *, const void *, size_t); + +/* + * Digest routine. This is used to query the raw hex digest for the + * given entry. The type of digest is provided as an argument. + */ +#define ARCHIVE_ENTRY_DIGEST_MD5 0x00000001 +#define ARCHIVE_ENTRY_DIGEST_RMD160 0x00000002 +#define ARCHIVE_ENTRY_DIGEST_SHA1 0x00000003 +#define ARCHIVE_ENTRY_DIGEST_SHA256 0x00000004 +#define ARCHIVE_ENTRY_DIGEST_SHA384 0x00000005 +#define ARCHIVE_ENTRY_DIGEST_SHA512 0x00000006 + +__LA_DECL const unsigned char * archive_entry_digest(struct archive_entry *, int /* type */); /* * ACL routines. This used to simply store and return text-format ACL Modified: head/contrib/libarchive/libarchive/archive_entry_private.h ============================================================================== --- head/contrib/libarchive/libarchive/archive_entry_private.h Tue Dec 1 15:15:18 2020 (r368233) +++ head/contrib/libarchive/libarchive/archive_entry_private.h Tue Dec 1 15:53:12 2020 (r368234) @@ -50,6 +50,15 @@ struct ae_sparse { int64_t length; }; +struct ae_digest { + unsigned char md5[16]; + unsigned char rmd160[20]; + unsigned char sha1[20]; + unsigned char sha256[32]; + unsigned char sha384[48]; + unsigned char sha512[64]; +}; + /* * Description of an archive entry. * @@ -162,6 +171,9 @@ struct archive_entry { void *mac_metadata; size_t mac_metadata_size; + /* Digest support. */ + struct ae_digest digest; + /* ACL support. */ struct archive_acl acl; @@ -180,5 +192,9 @@ struct archive_entry { /* Symlink type support */ int ae_symlink_type; }; + +int +archive_entry_set_digest(struct archive_entry *entry, int type, + const unsigned char *digest); #endif /* ARCHIVE_ENTRY_PRIVATE_H_INCLUDED */ Modified: head/contrib/libarchive/libarchive/archive_ppmd7.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_ppmd7.c Tue Dec 1 15:15:18 2020 (r368233) +++ head/contrib/libarchive/libarchive/archive_ppmd7.c Tue Dec 1 15:53:12 2020 (r368234) @@ -4,7 +4,7 @@ This code is based on PPMd var.H (2001): Dmitry Shkari #include "archive_platform.h" -#include +#include #include "archive_ppmd7_private.h" Modified: head/contrib/libarchive/libarchive/archive_read_disk_entry_from_file.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_disk_entry_from_file.c Tue Dec 1 15:15:18 2020 (r368233) +++ head/contrib/libarchive/libarchive/archive_read_disk_entry_from_file.c Tue Dec 1 15:53:12 2020 (r368234) @@ -103,6 +103,10 @@ __FBSDID("$FreeBSD"); static int setup_mac_metadata(struct archive_read_disk *, struct archive_entry *, int *fd); +#ifdef ARCHIVE_XATTR_FREEBSD +static int setup_xattrs_namespace(struct archive_read_disk *, + struct archive_entry *, int *, int); +#endif static int setup_xattrs(struct archive_read_disk *, struct archive_entry *, int *fd); static int setup_sparse(struct archive_read_disk *, @@ -701,14 +705,13 @@ setup_xattr(struct archive_read_disk *a, struct archiv } static int -setup_xattrs(struct archive_read_disk *a, - struct archive_entry *entry, int *fd) +setup_xattrs_namespace(struct archive_read_disk *a, + struct archive_entry *entry, int *fd, int namespace) { char buff[512]; char *list, *p; ssize_t list_size; const char *path; - int namespace = EXTATTR_NAMESPACE_USER; path = NULL; @@ -727,6 +730,8 @@ setup_xattrs(struct archive_read_disk *a, if (list_size == -1 && errno == EOPNOTSUPP) return (ARCHIVE_OK); + if (list_size == -1 && errno == EPERM) + return (ARCHIVE_OK); if (list_size == -1) { archive_set_error(&a->archive, errno, "Couldn't list extended attributes"); @@ -760,7 +765,17 @@ setup_xattrs(struct archive_read_disk *a, size_t len = 255 & (int)*p; char *name; - strcpy(buff, "user."); + if (namespace == EXTATTR_NAMESPACE_SYSTEM) { + if (!strcmp(p + 1, "nfs4.acl") || + !strcmp(p + 1, "posix1e.acl_access") || + !strcmp(p + 1, "posix1e.acl_default")) { + p += 1 + len; + continue; + } + strcpy(buff, "system."); + } else { + strcpy(buff, "user."); + } name = buff + strlen(buff); memcpy(name, p + 1, len); name[len] = '\0'; @@ -769,6 +784,31 @@ setup_xattrs(struct archive_read_disk *a, } free(list); + return (ARCHIVE_OK); +} + +static int +setup_xattrs(struct archive_read_disk *a, + struct archive_entry *entry, int *fd) +{ + int namespaces[2]; + int i, res; + + namespaces[0] = EXTATTR_NAMESPACE_USER; + namespaces[1] = EXTATTR_NAMESPACE_SYSTEM; + + for (i = 0; i < 2; i++) { + res = setup_xattrs_namespace(a, entry, fd, + namespaces[i]); + switch (res) { + case (ARCHIVE_OK): + case (ARCHIVE_WARN): + break; + default: + return (res); + } + } + return (ARCHIVE_OK); } Modified: head/contrib/libarchive/libarchive/archive_read_filter.3 ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_filter.3 Tue Dec 1 15:15:18 2020 (r368233) +++ head/contrib/libarchive/libarchive/archive_read_filter.3 Tue Dec 1 15:53:12 2020 (r368234) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd August 14, 2014 +.Dd June 9, 2020 .Dt ARCHIVE_READ_FILTER 3 .Os .Sh NAME @@ -50,6 +50,8 @@ Streaming Archive Library (libarchive, -larchive) .Ft int .Fn archive_read_support_filter_all "struct archive *" .Ft int +.Fn archive_read_support_filter_by_code "struct archive *" "int" +.Ft int .Fn archive_read_support_filter_bzip2 "struct archive *" .Ft int .Fn archive_read_support_filter_compress "struct archive *" @@ -116,6 +118,14 @@ Note that is always enabled by default. .It Fn archive_read_support_filter_all Enables all available decompression filters. +.It Fn archive_read_support_filter_by_code +Enables a single filter specified by the filter code. +This function does not work with +.Cm ARCHIVE_FILTER_PROGRAM . +Note: In statically-linked executables, this will cause +your program to include support for every filter. +If executable size is a concern, you may wish to avoid +using this function. .It Fn archive_read_support_filter_program Data is fed through the specified external program before being dearchived. Note that this disables automatic detection of the compression format, Modified: head/contrib/libarchive/libarchive/archive_read_set_format.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_set_format.c Tue Dec 1 15:15:18 2020 (r368233) +++ head/contrib/libarchive/libarchive/archive_read_set_format.c Tue Dec 1 15:53:12 2020 (r368234) @@ -61,6 +61,9 @@ archive_read_set_format(struct archive *_a, int code) case ARCHIVE_FORMAT_CPIO: strcpy(str, "cpio"); break; + case ARCHIVE_FORMAT_EMPTY: + strcpy(str, "empty"); + break; case ARCHIVE_FORMAT_ISO9660: strcpy(str, "iso9660"); break; @@ -76,8 +79,14 @@ archive_read_set_format(struct archive *_a, int code) case ARCHIVE_FORMAT_RAR_V5: strcpy(str, "rar5"); break; + case ARCHIVE_FORMAT_RAW: + strcpy(str, "raw"); + break; case ARCHIVE_FORMAT_TAR: strcpy(str, "tar"); + break; + case ARCHIVE_FORMAT_WARC: + strcpy(str, "warc"); break; case ARCHIVE_FORMAT_XAR: strcpy(str, "xar"); Copied: head/contrib/libarchive/libarchive/archive_read_support_filter_by_code.c (from r368207, vendor/libarchive/dist/libarchive/archive_read_support_filter_by_code.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/contrib/libarchive/libarchive/archive_read_support_filter_by_code.c Tue Dec 1 15:53:12 2020 (r368234, copy of r368207, vendor/libarchive/dist/libarchive/archive_read_support_filter_by_code.c) @@ -0,0 +1,83 @@ +/*- + * Copyright (c) 2020 Martin Matuska + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR(S) ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR(S) BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + */ + +#include "archive_platform.h" +__FBSDID("$FreeBSD$"); + +#include "archive.h" +#include "archive_private.h" + +int +archive_read_support_filter_by_code(struct archive *a, int filter_code) +{ + archive_check_magic(a, ARCHIVE_READ_MAGIC, + ARCHIVE_STATE_NEW, "archive_read_support_filter_by_code"); + + switch (filter_code) { + case ARCHIVE_FILTER_NONE: + return archive_read_support_filter_none(a); + break; + case ARCHIVE_FILTER_GZIP: + return archive_read_support_filter_gzip(a); + break; + case ARCHIVE_FILTER_BZIP2: + return archive_read_support_filter_bzip2(a); + break; + case ARCHIVE_FILTER_COMPRESS: + return archive_read_support_filter_compress(a); + break; + case ARCHIVE_FILTER_LZMA: + return archive_read_support_filter_lzma(a); + break; + case ARCHIVE_FILTER_XZ: + return archive_read_support_filter_xz(a); + break; + case ARCHIVE_FILTER_UU: + return archive_read_support_filter_uu(a); + break; + case ARCHIVE_FILTER_RPM: + return archive_read_support_filter_rpm(a); + break; + case ARCHIVE_FILTER_LZIP: + return archive_read_support_filter_lzip(a); + break; + case ARCHIVE_FILTER_LRZIP: + return archive_read_support_filter_lrzip(a); + break; + case ARCHIVE_FILTER_LZOP: + return archive_read_support_filter_lzop(a); + break; + case ARCHIVE_FILTER_GRZIP: + return archive_read_support_filter_grzip(a); + break; + case ARCHIVE_FILTER_LZ4: + return archive_read_support_filter_lz4(a); + break; + case ARCHIVE_FILTER_ZSTD: + return archive_read_support_filter_zstd(a); + break; + } + return (ARCHIVE_FATAL); +} Modified: head/contrib/libarchive/libarchive/archive_read_support_format_by_code.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_support_format_by_code.c Tue Dec 1 15:15:18 2020 (r368233) +++ head/contrib/libarchive/libarchive/archive_read_support_format_by_code.c Tue Dec 1 15:53:12 2020 (r368234) @@ -26,6 +26,10 @@ #include "archive_platform.h" __FBSDID("$FreeBSD$"); +#ifdef HAVE_ERRNO_H +#include +#endif + #include "archive.h" #include "archive_private.h" @@ -48,6 +52,9 @@ archive_read_support_format_by_code(struct archive *a, case ARCHIVE_FORMAT_CPIO: return archive_read_support_format_cpio(a); break; + case ARCHIVE_FORMAT_EMPTY: + return archive_read_support_format_empty(a); + break; case ARCHIVE_FORMAT_ISO9660: return archive_read_support_format_iso9660(a); break; @@ -63,9 +70,15 @@ archive_read_support_format_by_code(struct archive *a, case ARCHIVE_FORMAT_RAR_V5: return archive_read_support_format_rar5(a); break; + case ARCHIVE_FORMAT_RAW: + return archive_read_support_format_raw(a); + break; case ARCHIVE_FORMAT_TAR: return archive_read_support_format_tar(a); break; + case ARCHIVE_FORMAT_WARC: + return archive_read_support_format_warc(a); + break; case ARCHIVE_FORMAT_XAR: return archive_read_support_format_xar(a); break; @@ -73,5 +86,7 @@ archive_read_support_format_by_code(struct archive *a, return archive_read_support_format_zip(a); break; } + archive_set_error(a, ARCHIVE_ERRNO_PROGRAMMER, + "Invalid format code specified"); return (ARCHIVE_FATAL); } Modified: head/contrib/libarchive/libarchive/archive_read_support_format_cab.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_support_format_cab.c Tue Dec 1 15:15:18 2020 (r368233) +++ head/contrib/libarchive/libarchive/archive_read_support_format_cab.c Tue Dec 1 15:53:12 2020 (r368234) @@ -1172,7 +1172,7 @@ cab_checksum_finish(struct archive_read *a) cfdata->memimage + CFDATA_cbData, l, cfdata->sum_calculated); if (cfdata->sum_calculated != cfdata->sum) { archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, - "Checksum error CFDATA[%d] %x:%x in %d bytes", + "Checksum error CFDATA[%d] %" PRIx32 ":%" PRIx32 " in %d bytes", cab->entry_cffolder->cfdata_index -1, cfdata->sum, cfdata->sum_calculated, cfdata->compressed_size); Modified: head/contrib/libarchive/libarchive/archive_read_support_format_empty.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_support_format_empty.c Tue Dec 1 15:15:18 2020 (r368233) +++ head/contrib/libarchive/libarchive/archive_read_support_format_empty.c Tue Dec 1 15:53:12 2020 (r368234) @@ -47,7 +47,7 @@ archive_read_support_format_empty(struct archive *_a) r = __archive_read_register_format(a, NULL, - NULL, + "empty", archive_read_format_empty_bid, NULL, archive_read_format_empty_read_header, Modified: head/contrib/libarchive/libarchive/archive_read_support_format_mtree.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_support_format_mtree.c Tue Dec 1 15:15:18 2020 (r368233) +++ head/contrib/libarchive/libarchive/archive_read_support_format_mtree.c Tue Dec 1 15:53:12 2020 (r368234) @@ -51,6 +51,7 @@ __FBSDID("$FreeBSD$"); #include "archive.h" #include "archive_entry.h" +#include "archive_entry_private.h" #include "archive_private.h" #include "archive_rb.h" #include "archive_read_private.h" @@ -1482,6 +1483,84 @@ parse_device(dev_t *pdev, struct archive *a, char *val #undef MAX_PACK_ARGS } +static int +parse_hex_nibble(char c) +{ + if (c >= '0' && c <= '9') + return c - '0'; + if (c >= 'a' && c <= 'f') + return 10 + c - 'a'; +#if 0 + /* XXX: Is uppercase something we should support? */ + if (c >= 'A' && c <= 'F') + return 10 + c - 'A'; +#endif + + return -1; +} + +static int +parse_digest(struct archive_read *a, struct archive_entry *entry, + const char *digest, int type) +{ + unsigned char digest_buf[64]; + int high, low; + size_t i, j, len; + + switch (type) { + case ARCHIVE_ENTRY_DIGEST_MD5: + len = sizeof(entry->digest.md5); + break; + case ARCHIVE_ENTRY_DIGEST_RMD160: + len = sizeof(entry->digest.rmd160); + break; + case ARCHIVE_ENTRY_DIGEST_SHA1: + len = sizeof(entry->digest.sha1); + break; + case ARCHIVE_ENTRY_DIGEST_SHA256: + len = sizeof(entry->digest.sha256); + break; + case ARCHIVE_ENTRY_DIGEST_SHA384: + len = sizeof(entry->digest.sha384); + break; + case ARCHIVE_ENTRY_DIGEST_SHA512: + len = sizeof(entry->digest.sha512); + break; + default: + archive_set_error(&a->archive, ARCHIVE_ERRNO_PROGRAMMER, + "Internal error: Unknown digest type"); + return ARCHIVE_FATAL; + } + + if (len > sizeof(digest_buf)) { + archive_set_error(&a->archive, ARCHIVE_ERRNO_PROGRAMMER, + "Internal error: Digest storage too large"); + return ARCHIVE_FATAL; + } + + len *= 2; + + if (strnlen(digest, len+1) != len) { + archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, + "incorrect digest length, ignoring"); + return ARCHIVE_WARN; + } + + for (i = 0, j = 0; i < len; i += 2, j++) { + high = parse_hex_nibble(digest[i]); + low = parse_hex_nibble(digest[i+1]); + if (high == -1 || low == -1) { + archive_set_error(&a->archive, ARCHIVE_ERRNO_FILE_FORMAT, + "invalid digest data, ignoring"); + return ARCHIVE_WARN; + } + + digest_buf[j] = high << 4 | low; + } + + return archive_entry_set_digest(entry, type, digest_buf); +} + /* * Parse a single keyword and its value. */ @@ -1580,8 +1659,10 @@ parse_keyword(struct archive_read *a, struct mtree *mt } __LA_FALLTHROUGH; case 'm': - if (strcmp(key, "md5") == 0 || strcmp(key, "md5digest") == 0) - break; + if (strcmp(key, "md5") == 0 || strcmp(key, "md5digest") == 0) { + return parse_digest(a, entry, val, + ARCHIVE_ENTRY_DIGEST_MD5); + } if (strcmp(key, "mode") == 0) { if (val[0] >= '0' && val[0] <= '7') { *parsed_kws |= MTREE_HAS_PERM; @@ -1617,21 +1698,32 @@ parse_keyword(struct archive_read *a, struct mtree *mt return r; } if (strcmp(key, "rmd160") == 0 || - strcmp(key, "rmd160digest") == 0) - break; + strcmp(key, "rmd160digest") == 0) { + return parse_digest(a, entry, val, + ARCHIVE_ENTRY_DIGEST_RMD160); + } __LA_FALLTHROUGH; case 's': - if (strcmp(key, "sha1") == 0 || strcmp(key, "sha1digest") == 0) - break; + if (strcmp(key, "sha1") == 0 || + strcmp(key, "sha1digest") == 0) { + return parse_digest(a, entry, val, + ARCHIVE_ENTRY_DIGEST_SHA1); + } if (strcmp(key, "sha256") == 0 || - strcmp(key, "sha256digest") == 0) - break; + strcmp(key, "sha256digest") == 0) { + return parse_digest(a, entry, val, + ARCHIVE_ENTRY_DIGEST_SHA256); + } if (strcmp(key, "sha384") == 0 || - strcmp(key, "sha384digest") == 0) - break; + strcmp(key, "sha384digest") == 0) { + return parse_digest(a, entry, val, + ARCHIVE_ENTRY_DIGEST_SHA384); + } if (strcmp(key, "sha512") == 0 || - strcmp(key, "sha512digest") == 0) - break; + strcmp(key, "sha512digest") == 0) { + return parse_digest(a, entry, val, + ARCHIVE_ENTRY_DIGEST_SHA512); + } if (strcmp(key, "size") == 0) { archive_entry_set_size(entry, mtree_atol(&val, 10)); break; Modified: head/contrib/libarchive/libarchive/archive_read_support_format_rar.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_support_format_rar.c Tue Dec 1 15:15:18 2020 (r368233) +++ head/contrib/libarchive/libarchive/archive_read_support_format_rar.c Tue Dec 1 15:53:12 2020 (r368234) @@ -151,6 +151,9 @@ #undef minimum #define minimum(a, b) ((a)<(b)?(a):(b)) +/* Stack overflow check */ +#define MAX_COMPRESS_DEPTH 1024 + /* Fields common to all headers */ struct rar_header { @@ -340,7 +343,7 @@ static int read_symlink_stored(struct archive_read *, static int read_data_stored(struct archive_read *, const void **, size_t *, int64_t *); static int read_data_compressed(struct archive_read *, const void **, size_t *, - int64_t *); + int64_t *, size_t); static int rar_br_preparation(struct archive_read *, struct rar_br *); static int parse_codes(struct archive_read *); static void free_codes(struct archive_read *); @@ -1026,7 +1029,7 @@ archive_read_format_rar_read_data(struct archive_read case COMPRESS_METHOD_NORMAL: case COMPRESS_METHOD_GOOD: case COMPRESS_METHOD_BEST: - ret = read_data_compressed(a, buff, size, offset); + ret = read_data_compressed(a, buff, size, offset, 0); if (ret != ARCHIVE_OK && ret != ARCHIVE_WARN) { __archive_ppmd7_functions.Ppmd7_Free(&rar->ppmd7_context); rar->start_new_table = 1; @@ -1883,8 +1886,11 @@ read_data_stored(struct archive_read *a, const void ** static int read_data_compressed(struct archive_read *a, const void **buff, size_t *size, - int64_t *offset) + int64_t *offset, size_t looper) { + if (looper++ > MAX_COMPRESS_DEPTH) + return (ARCHIVE_FATAL); + struct rar *rar; int64_t start, end, actualend; size_t bs; @@ -1982,7 +1988,7 @@ read_data_compressed(struct archive_read *a, const voi { case 0: rar->start_new_table = 1; - return read_data_compressed(a, buff, size, offset); + return read_data_compressed(a, buff, size, offset, looper); case 2: rar->ppmd_eod = 1;/* End Of ppmd Data. */ Modified: head/contrib/libarchive/libarchive/archive_read_support_format_rar5.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_support_format_rar5.c Tue Dec 1 15:15:18 2020 (r368233) +++ head/contrib/libarchive/libarchive/archive_read_support_format_rar5.c Tue Dec 1 15:53:12 2020 (r368234) @@ -3831,7 +3831,7 @@ static int verify_checksums(struct archive_read* a) { DEBUG_CODE { printf("Checksum error: CRC32 " - "(was: %08x, expected: %08x)\n", + "(was: %08" PRIx32 ", expected: %08" PRIx32 ")\n", rar->file.calculated_crc32, rar->file.stored_crc32); } @@ -3845,7 +3845,7 @@ static int verify_checksums(struct archive_read* a) { } else { DEBUG_CODE { printf("Checksum OK: CRC32 " - "(%08x/%08x)\n", + "(%08" PRIx32 "/%08" PRIx32 ")\n", rar->file.stored_crc32, rar->file.calculated_crc32); } @@ -3905,6 +3905,9 @@ static int rar5_read_data(struct archive_read *a, cons size_t *size, int64_t *offset) { int ret; struct rar5* rar = get_context(a); + + if (size) + *size = 0; if(rar->file.dir > 0) { /* Don't process any data if this file entry was declared Modified: head/contrib/libarchive/libarchive/archive_read_support_format_warc.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_support_format_warc.c Tue Dec 1 15:15:18 2020 (r368233) +++ head/contrib/libarchive/libarchive/archive_read_support_format_warc.c Tue Dec 1 15:53:12 2020 (r368234) @@ -337,6 +337,14 @@ start_over: mtime = rtime; } break; + case WT_NONE: + case WT_INFO: + case WT_META: + case WT_REQ: + case WT_RVIS: + case WT_CONV: + case WT_CONT: + case LAST_WT: default: fnam.len = 0U; fnam.str = NULL; @@ -361,6 +369,14 @@ start_over: break; } /* FALLTHROUGH */ + case WT_NONE: + case WT_INFO: + case WT_META: + case WT_REQ: + case WT_RVIS: + case WT_CONV: + case WT_CONT: + case LAST_WT: default: /* consume the content and start over */ _warc_skip(a); Modified: head/contrib/libarchive/libarchive/archive_read_support_format_zip.c ============================================================================== --- head/contrib/libarchive/libarchive/archive_read_support_format_zip.c Tue Dec 1 15:15:18 2020 (r368233) +++ head/contrib/libarchive/libarchive/archive_read_support_format_zip.c Tue Dec 1 15:53:12 2020 (r368234) @@ -900,6 +900,79 @@ process_extra(struct archive_read *a, struct archive_e } /* + * Auxiliary function to uncompress data chunk from zipx archive + * (zip with lzma compression). + */ +static int +zipx_lzma_uncompress_buffer(const char *compressed_buffer, + size_t compressed_buffer_size, + char *uncompressed_buffer, + size_t uncompressed_buffer_size) +{ + int status = ARCHIVE_FATAL; + // length of 'lzma properties data' in lzma compressed + // data segment (stream) inside zip archive + const size_t lzma_params_length = 5; + // offset of 'lzma properties data' from the beginning of lzma stream + const size_t lzma_params_offset = 4; + // end position of 'lzma properties data' in lzma stream + const size_t lzma_params_end = lzma_params_offset + lzma_params_length; + if (compressed_buffer == NULL || + compressed_buffer_size < lzma_params_end || + uncompressed_buffer == NULL) + return status; + + // prepare header for lzma_alone_decoder to replace zipx header + // (see comments in 'zipx_lzma_alone_init' for justification) *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Tue Dec 1 16:06:31 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DB0364AD30A; Tue, 1 Dec 2020 16:06:31 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Cln5z5qZFz4Sx2; Tue, 1 Dec 2020 16:06:31 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B606D18148; Tue, 1 Dec 2020 16:06:31 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B1G6V1Y069342; Tue, 1 Dec 2020 16:06:31 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B1G6V12069341; Tue, 1 Dec 2020 16:06:31 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202012011606.0B1G6V12069341@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 1 Dec 2020 16:06:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368236 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 368236 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Dec 2020 16:06:31 -0000 Author: markj Date: Tue Dec 1 16:06:31 2020 New Revision: 368236 URL: https://svnweb.freebsd.org/changeset/base/368236 Log: vmem: Revert r364744 A pair of bugs are believed to have caused the hangs described in the commit log message for r364744: 1. uma_reclaim() could trigger reclamation of the reserve of boundary tags used to avoid deadlock. This was fixed by r366840. 2. The loop in vmem_xalloc() would in some cases try to allocate more boundary tags than the expected upper bound of BT_MAXALLOC. The reserve is sized based on the value BT_MAXMALLOC, so this behaviour could deplete the reserve without guaranteeing a successful allocation, resulting in a hang. This was fixed by r366838. PR: 248008 Tested by: rmacklem Modified: head/sys/kern/subr_vmem.c Modified: head/sys/kern/subr_vmem.c ============================================================================== --- head/sys/kern/subr_vmem.c Tue Dec 1 16:02:52 2020 (r368235) +++ head/sys/kern/subr_vmem.c Tue Dec 1 16:06:31 2020 (r368236) @@ -706,14 +706,10 @@ vmem_startup(void) vmem_zone = uma_zcreate("vmem", sizeof(struct vmem), NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, 0); -#ifdef UMA_MD_SMALL_ALLOC vmem_bt_zone = uma_zcreate("vmem btag", sizeof(struct vmem_btag), NULL, NULL, NULL, NULL, UMA_ALIGN_PTR, UMA_ZONE_VM); -#else - vmem_bt_zone = uma_zcreate("vmem btag", - sizeof(struct vmem_btag), NULL, NULL, NULL, NULL, - UMA_ALIGN_PTR, UMA_ZONE_VM | UMA_ZONE_NOFREE); +#ifndef UMA_MD_SMALL_ALLOC mtx_init(&vmem_bt_lock, "btag lock", NULL, MTX_DEF); uma_prealloc(vmem_bt_zone, BT_MAXALLOC); /* From owner-svn-src-head@freebsd.org Tue Dec 1 16:24:00 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 276204AD446; Tue, 1 Dec 2020 16:24:00 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4ClnV80jDKz4Tsy; Tue, 1 Dec 2020 16:24:00 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0B1B318831; Tue, 1 Dec 2020 16:24:00 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B1GNxvv081664; Tue, 1 Dec 2020 16:23:59 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B1GNx7c081663; Tue, 1 Dec 2020 16:23:59 GMT (envelope-from kp@FreeBSD.org) Message-Id: <202012011623.0B1GNx7c081663@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Tue, 1 Dec 2020 16:23:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368237 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: kp X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 368237 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Dec 2020 16:24:00 -0000 Author: kp Date: Tue Dec 1 16:23:59 2020 New Revision: 368237 URL: https://svnweb.freebsd.org/changeset/base/368237 Log: if: Fix panic when destroying vnet and epair simultaneously When destroying a vnet and an epair (with one end in the vnet) we often panicked. This was the result of the destruction of the epair, which destroys both ends simultaneously, happening while vnet_if_return() was moving the struct ifnet to its home vnet. This can result in a freed ifnet being re-added to the home vnet V_ifnet list. That in turn panics the next time the ifnet is used. Prevent this race by ensuring that vnet_if_return() cannot run at the same time as if_detach() or epair_clone_destroy(). PR: 238870, 234985, 244703, 250870 MFC after: 2 weeks Sponsored by: Modirum MDPay Differential Revision: https://reviews.freebsd.org/D27378 Modified: head/sys/net/if.c Modified: head/sys/net/if.c ============================================================================== --- head/sys/net/if.c Tue Dec 1 16:06:31 2020 (r368236) +++ head/sys/net/if.c Tue Dec 1 16:23:59 2020 (r368237) @@ -314,6 +314,9 @@ VNET_DEFINE(struct ifnet **, ifindex_table); struct sx ifnet_sxlock; SX_SYSINIT_FLAGS(ifnet_sx, &ifnet_sxlock, "ifnet_sx", SX_RECURSE); +struct sx ifnet_detach_sxlock; +SX_SYSINIT(ifnet_detach, &ifnet_detach_sxlock, "ifnet_detach_sx"); + /* * The allocation of network interfaces is a rather non-atomic affair; we * need to select an index before we are ready to expose the interface for @@ -543,7 +546,9 @@ vnet_if_return(const void *unused __unused) IFNET_WUNLOCK(); for (int j = 0; j < i; j++) { + sx_xlock(&ifnet_detach_sxlock); if_vmove(pending[j], pending[j]->if_home_vnet); + sx_xunlock(&ifnet_detach_sxlock); } free(pending, M_IFNET); @@ -1118,8 +1123,11 @@ if_detach(struct ifnet *ifp) CURVNET_SET_QUIET(ifp->if_vnet); found = if_unlink_ifnet(ifp, false); - if (found) + if (found) { + sx_slock(&ifnet_detach_sxlock); if_detach_internal(ifp, 0, NULL); + sx_sunlock(&ifnet_detach_sxlock); + } CURVNET_RESTORE(); } @@ -3010,8 +3018,12 @@ ifioctl(struct socket *so, u_long cmd, caddr_t data, s goto out_noref; case SIOCIFDESTROY: error = priv_check(td, PRIV_NET_IFDESTROY); - if (error == 0) + + if (error == 0) { + sx_slock(&ifnet_detach_sxlock); error = if_clone_destroy(ifr->ifr_name); + sx_sunlock(&ifnet_detach_sxlock); + } goto out_noref; case SIOCIFGCLONERS: From owner-svn-src-head@freebsd.org Tue Dec 1 16:34:44 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 27B934ADB4C; Tue, 1 Dec 2020 16:34:44 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4ClnkX0LZYz4VgV; Tue, 1 Dec 2020 16:34:44 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EEB8118D0A; Tue, 1 Dec 2020 16:34:43 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B1GYhCr087799; Tue, 1 Dec 2020 16:34:43 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B1GYhUa087798; Tue, 1 Dec 2020 16:34:43 GMT (envelope-from kp@FreeBSD.org) Message-Id: <202012011634.0B1GYhUa087798@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Tue, 1 Dec 2020 16:34:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368238 - head/sys/net X-SVN-Group: head X-SVN-Commit-Author: kp X-SVN-Commit-Paths: head/sys/net X-SVN-Commit-Revision: 368238 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Dec 2020 16:34:44 -0000 Author: kp Date: Tue Dec 1 16:34:43 2020 New Revision: 368238 URL: https://svnweb.freebsd.org/changeset/base/368238 Log: net: Revert vnet/epair cleanup race mitigation Revert the mitigation code for the vnet/epair cleanup race (done in r365457). r368237 introduced a more reliable fix. MFC after: 2 weeks Sponsored by: Modirum MDPay Modified: head/sys/net/if.c head/sys/net/if_epair.c Modified: head/sys/net/if.c ============================================================================== --- head/sys/net/if.c Tue Dec 1 16:23:59 2020 (r368237) +++ head/sys/net/if.c Tue Dec 1 16:34:43 2020 (r368238) @@ -1338,11 +1338,6 @@ if_vmove(struct ifnet *ifp, struct vnet *new_vnet) ifindex_free_locked(ifp->if_index); IFNET_WUNLOCK(); - - /* Don't re-attach DYING interfaces. */ - if (ifp->if_flags & IFF_DYING) - return (0); - /* * Perform interface-specific reassignment tasks, if provided by * the driver. Modified: head/sys/net/if_epair.c ============================================================================== --- head/sys/net/if_epair.c Tue Dec 1 16:23:59 2020 (r368237) +++ head/sys/net/if_epair.c Tue Dec 1 16:34:43 2020 (r368238) @@ -611,14 +611,8 @@ epair_qflush(struct ifnet *ifp) struct epair_softc *sc; sc = ifp->if_softc; - - /* - * See epair_clone_destroy(), we can end up getting called twice. - * Don't do anything on the second call. - */ - if (sc == NULL) - return; - + KASSERT(sc != NULL, ("%s: ifp=%p, epair_softc gone? sc=%p\n", + __func__, ifp, sc)); /* * Remove this ifp from all backpointer lists. The interface will not * usable for flushing anyway nor should it have anything to flush From owner-svn-src-head@freebsd.org Tue Dec 1 16:44:37 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E6F6E4AE22A; Tue, 1 Dec 2020 16:44:37 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Clnxx6CmBz4WMq; Tue, 1 Dec 2020 16:44:37 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C811018CC2; Tue, 1 Dec 2020 16:44:37 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B1GibZn094349; Tue, 1 Dec 2020 16:44:37 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B1GibRZ094346; Tue, 1 Dec 2020 16:44:37 GMT (envelope-from kp@FreeBSD.org) Message-Id: <202012011644.0B1GibRZ094346@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Tue, 1 Dec 2020 16:44:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368239 - head/tests/sys/netpfil/pf X-SVN-Group: head X-SVN-Commit-Author: kp X-SVN-Commit-Paths: head/tests/sys/netpfil/pf X-SVN-Commit-Revision: 368239 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Dec 2020 16:44:38 -0000 Author: kp Date: Tue Dec 1 16:44:36 2020 New Revision: 368239 URL: https://svnweb.freebsd.org/changeset/base/368239 Log: pf tests: Re-enable panicing tests We've fixed the vnet/epair cleanup race, so it is now safe to re-enable these tests. MFC after: 2 weeks Sponsored by: Modirum MDPay Modified: head/tests/sys/netpfil/pf/names.sh head/tests/sys/netpfil/pf/nat.sh head/tests/sys/netpfil/pf/synproxy.sh Modified: head/tests/sys/netpfil/pf/names.sh ============================================================================== --- head/tests/sys/netpfil/pf/names.sh Tue Dec 1 16:34:43 2020 (r368238) +++ head/tests/sys/netpfil/pf/names.sh Tue Dec 1 16:44:36 2020 (r368239) @@ -36,7 +36,6 @@ names_head() names_body() { - atf_skip "Kernel panics when flushing epair queue (bug238870)" pft_init epair=$(vnet_mkepair) Modified: head/tests/sys/netpfil/pf/nat.sh ============================================================================== --- head/tests/sys/netpfil/pf/nat.sh Tue Dec 1 16:34:43 2020 (r368238) +++ head/tests/sys/netpfil/pf/nat.sh Tue Dec 1 16:44:36 2020 (r368239) @@ -36,10 +36,6 @@ exhaust_head() exhaust_body() { - if [ "$(atf_config_get ci false)" = "true" ]; then - atf_skip "https://bugs.freebsd.org/244703" - fi - pft_init epair_nat=$(vnet_mkepair) Modified: head/tests/sys/netpfil/pf/synproxy.sh ============================================================================== --- head/tests/sys/netpfil/pf/synproxy.sh Tue Dec 1 16:34:43 2020 (r368238) +++ head/tests/sys/netpfil/pf/synproxy.sh Tue Dec 1 16:44:36 2020 (r368239) @@ -36,7 +36,6 @@ synproxy_head() synproxy_body() { - atf_skip "Kernel panics when flushing epair queue (bug238870)" pft_init epair=$(vnet_mkepair) From owner-svn-src-head@freebsd.org Tue Dec 1 17:04:48 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B2EEB4AE959; Tue, 1 Dec 2020 17:04:48 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4ClpPD4dbpz4Xnr; Tue, 1 Dec 2020 17:04:48 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8DB67191FD; Tue, 1 Dec 2020 17:04:48 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B1H4m4e007177; Tue, 1 Dec 2020 17:04:48 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B1H4lNN007171; Tue, 1 Dec 2020 17:04:47 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <202012011704.0B1H4lNN007171@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 1 Dec 2020 17:04:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368240 - in head/sys: cddl/dev/dtrace/amd64 cddl/dev/dtrace/i386 ddb riscv/riscv sys x86/x86 X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in head/sys: cddl/dev/dtrace/amd64 cddl/dev/dtrace/i386 ddb riscv/riscv sys x86/x86 X-SVN-Commit-Revision: 368240 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Dec 2020 17:04:48 -0000 Author: jhb Date: Tue Dec 1 17:04:46 2020 New Revision: 368240 URL: https://svnweb.freebsd.org/changeset/base/368240 Log: Add a kstack_contains() helper function. This is useful for stack unwinders which need to avoid out-of-bounds reads of a kernel stack which can trigger kernel faults. Reviewed by: kib, markj Obtained from: CheriBSD Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D27356 Modified: head/sys/cddl/dev/dtrace/amd64/dtrace_isa.c head/sys/cddl/dev/dtrace/i386/dtrace_isa.c head/sys/ddb/db_ps.c head/sys/riscv/riscv/stack_machdep.c head/sys/sys/proc.h head/sys/x86/x86/stack_machdep.c Modified: head/sys/cddl/dev/dtrace/amd64/dtrace_isa.c ============================================================================== --- head/sys/cddl/dev/dtrace/amd64/dtrace_isa.c Tue Dec 1 16:44:36 2020 (r368239) +++ head/sys/cddl/dev/dtrace/amd64/dtrace_isa.c Tue Dec 1 17:04:46 2020 (r368240) @@ -73,14 +73,10 @@ dtrace_getpcstack(pc_t *pcstack, int pcstack_limit, in frame = (struct amd64_frame *)rbp; td = curthread; while (depth < pcstack_limit) { - if (!INKERNEL((long) frame)) + if (!kstack_contains(curthread, (vm_offset_t)frame, + sizeof(*frame)) break; - if ((vm_offset_t)frame >= - td->td_kstack + ptoa(td->td_kstack_pages) || - (vm_offset_t)frame < td->td_kstack) - break; - callpc = frame->f_retaddr; if (!INKERNEL(callpc)) @@ -466,14 +462,11 @@ dtrace_getstackdepth(int aframes) frame = (struct amd64_frame *)rbp; depth++; for(;;) { - if (!INKERNEL((long) frame)) + if (!kstack_contains(curthread, (vm_offset_t)frame, + sizeof(*frame)) break; - if (!INKERNEL((long) frame->f_frame)) - break; depth++; - if (frame->f_frame <= frame || - (vm_offset_t)frame->f_frame >= curthread->td_kstack + - curthread->td_kstack_pages * PAGE_SIZE) + if (frame->f_frame <= frame) break; frame = frame->f_frame; } Modified: head/sys/cddl/dev/dtrace/i386/dtrace_isa.c ============================================================================== --- head/sys/cddl/dev/dtrace/i386/dtrace_isa.c Tue Dec 1 16:44:36 2020 (r368239) +++ head/sys/cddl/dev/dtrace/i386/dtrace_isa.c Tue Dec 1 17:04:46 2020 (r368240) @@ -73,7 +73,8 @@ dtrace_getpcstack(pc_t *pcstack, int pcstack_limit, in frame = (struct i386_frame *)ebp; while (depth < pcstack_limit) { - if (!INKERNEL(frame)) + if (!kstack_contains(curthread, (vm_offset_t)frame, + sizeof(*frame)) break; callpc = frame->f_retaddr; @@ -91,9 +92,7 @@ dtrace_getpcstack(pc_t *pcstack, int pcstack_limit, in pcstack[depth++] = callpc; } - if (frame->f_frame <= frame || - (vm_offset_t)frame->f_frame >= curthread->td_kstack + - curthread->td_kstack_pages * PAGE_SIZE) + if (frame->f_frame <= frame) break; frame = frame->f_frame; } @@ -484,14 +483,10 @@ dtrace_getstackdepth(int aframes) frame = (struct i386_frame *)ebp; depth++; for(;;) { - if (!INKERNEL((long) frame)) + if (!kstack_contains((vm_offset_t)frame, sizeof(*frame)) break; - if (!INKERNEL((long) frame->f_frame)) - break; depth++; - if (frame->f_frame <= frame || - (vm_offset_t)frame->f_frame >= curthread->td_kstack + - curthread->td_kstack_pages * PAGE_SIZE) + if (frame->f_frame <= frame) break; frame = frame->f_frame; } Modified: head/sys/ddb/db_ps.c ============================================================================== --- head/sys/ddb/db_ps.c Tue Dec 1 16:44:36 2020 (r368239) +++ head/sys/ddb/db_ps.c Tue Dec 1 17:04:46 2020 (r368240) @@ -527,8 +527,7 @@ db_findstack_cmd(db_expr_t addr, bool have_addr, db_ex FOREACH_PROC_IN_SYSTEM(p) { FOREACH_THREAD_IN_PROC(p, td) { - if (td->td_kstack <= saddr && saddr < td->td_kstack + - PAGE_SIZE * td->td_kstack_pages) { + if (kstack_contains(td, saddr, 1)) { db_printf("Thread %p\n", td); return; } Modified: head/sys/riscv/riscv/stack_machdep.c ============================================================================== --- head/sys/riscv/riscv/stack_machdep.c Tue Dec 1 16:44:36 2020 (r368239) +++ head/sys/riscv/riscv/stack_machdep.c Tue Dec 1 17:04:46 2020 (r368240) @@ -53,9 +53,8 @@ stack_capture(struct thread *td, struct stack *st, str stack_zero(st); while (1) { - if ((vm_offset_t)frame->fp < td->td_kstack || - (vm_offset_t)frame->fp >= td->td_kstack + - td->td_kstack_pages * PAGE_SIZE) + if (!kstack_contains(td, (vm_offset_t)frame->fp - + (sizeof(uintptr_t) * 2), sizeof(uintptr_t) * 2)) break; unwind_frame(frame); if (!INKERNEL((vm_offset_t)frame->pc)) Modified: head/sys/sys/proc.h ============================================================================== --- head/sys/sys/proc.h Tue Dec 1 16:44:36 2020 (r368239) +++ head/sys/sys/proc.h Tue Dec 1 17:04:46 2020 (r368240) @@ -1198,6 +1198,13 @@ curthread_pflags2_restore(int save) curthread->td_pflags2 &= save; } +static __inline bool +kstack_contains(struct thread *td, vm_offset_t va, size_t len) +{ + return (va >= td->td_kstack && va + len >= va && + va + len <= td->td_kstack + td->td_kstack_pages * PAGE_SIZE); +} + static __inline __pure2 struct td_sched * td_get_sched(struct thread *td) { Modified: head/sys/x86/x86/stack_machdep.c ============================================================================== --- head/sys/x86/x86/stack_machdep.c Tue Dec 1 16:44:36 2020 (r368239) +++ head/sys/x86/x86/stack_machdep.c Tue Dec 1 17:04:46 2020 (r368240) @@ -79,9 +79,7 @@ stack_capture(struct thread *td, struct stack *st, reg stack_zero(st); frame = (x86_frame_t)fp; while (1) { - if ((vm_offset_t)frame < td->td_kstack || - (vm_offset_t)frame >= td->td_kstack + - td->td_kstack_pages * PAGE_SIZE) + if (!kstack_contains(td, (vm_offset_t)frame, sizeof(*frame))) break; callpc = frame->f_retaddr; if (!INKERNEL(callpc)) From owner-svn-src-head@freebsd.org Tue Dec 1 17:11:27 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AED6D4AEA79; Tue, 1 Dec 2020 17:11:27 +0000 (UTC) (envelope-from ohartmann@walstatt.org) Received: from mout.gmx.net (mout.gmx.net [212.227.17.21]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "mout.gmx.net", Issuer "TeleSec ServerPass Class 2 CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4ClpXt1klJz4Ylq; Tue, 1 Dec 2020 17:11:25 +0000 (UTC) (envelope-from ohartmann@walstatt.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1606842683; bh=U1rXZ5MmGYAQdHeDF8yKuAvKv+7fRRAuaQP/vK2WUoE=; h=X-UI-Sender-Class:Date:From:To:Cc:Subject:In-Reply-To:References; b=aL9Cj+9FL3u+3E9rjcH6Otr2GE+9BVCJhW4PIcDaGHYoYxYwbM8vsxGav7QL9cAQ2 BMHclgywOj+RJPO2hk/dz9QttJvNieV9REeIOsTp5ku2/ztQk5luCOvNgGBPrL7mUT 8xR4tyx8kdg1a7KkQW2zOpQDaKE1ajfC0oDvVlHY= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from hermann.fritz.box ([77.11.181.74]) by mail.gmx.com (mrgmx104 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MeU0q-1k9zYM48xw-00aVJu; Tue, 01 Dec 2020 18:11:23 +0100 Date: Tue, 1 Dec 2020 18:11:15 +0100 From: "Hartmann, O." To: Kyle Evans Cc: "O. Hartmann" , Matt Macy , src-committers , svn-src-all , svn-src-head Subject: Re: svn commit: r368163 - in head: sbin/ifconfig sys/dev/if_wg sys/dev/if_wg/include sys/dev/if_wg/include/crypto sys/dev/if_wg/include/sys sys/dev/if_wg/include/zinc sys/dev/if_wg/module sys/dev/if_wg... Message-ID: <20201201181115.4f799e4a@hermann.fritz.box> In-Reply-To: References: <202011291938.0ATJc4Z3081193@repo.freebsd.org> <20201201143901.72e74311@freyja> Organization: walstatt.org MIME-Version: 1.0 Content-Type: multipart/signed; boundary="Sig_/KETrf1QMtADqrPF5IM2W=ZJ"; protocol="application/pgp-signature"; micalg=pgp-sha256 X-Provags-ID: V03:K1:F/LjHbNXTufUwG4nZXX2KyBlewz2X/iM88wC06TSxNNzdDM5lKo w4Il2hJVjxms8AP38C5hwheo1IEPgU/AaEoOfloqUdkVrw/vhzupFfXSTV0lTSBP7XGN4y6 0gMpTweeDTRdhxBEb01Ml9ixS7vH8+JufEsShrZAPBk2pm6V78ANHbpspveWmmlgozhEH36 L42dXlMKi/9HerJb76q2w== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:B3HVuc4hQLk=:oy7tff4plYlF0cEXqCPK6g kDS6GzvLtkOhGxYMsOzQxzbenueoNkwc8mo9dbBceObdTSIUlJGwUaviUZWwGHCn0UNwizgtA 7c1G+jUCHLl9tXUlfWQqg3p9loYxWExlId0mV4x/0gqZCjDGxWOf+yXTLwgGbTOzvjICPPVag b8sve/omDJagpPUffGqIGWfxdvvLVAUyUvqOD6x1eABo3U2mkoAcE4LMXnJurrgFb/kjMUDfE 3HfEs+STAagtfROHy2Fj0rBGPHlUvbTG1kgCl15z0g+Ff2UuwSEsjVdQGy32eEiLzVH0qjSuj 6ZwMiViqnMlfLsvzNPAcxpMB3P3QTPY69IbU5Aa0uMBy+KWGTi3R2Oo9jWmUzVcjG1nx6C986 Yomhw/5Eu4w5K42xWgNnsmH184THRa73prC/Bwj6LPKmjira4iYYC+t35P1Z6/Ttujhjesg6+ DuiEy2GLQ3yyuOSiUV5CpXl3zc7FWGVPpP1FKg/xWKiWysmnJvp5+p13uJN6j5LW/edwCdnkT dPQGE8L4A99fzgI2s+hCYZEAapP3xdOjLWtXI0KUOU52nfmPi+ekXsO1qu8WQh8KMvNOzyW0z WBXJi4Jlt1CJlv+SA3icLqz7ZEZ3P50YWYv34GuNgnkD6KZ+idFVs4ie5gpWofUcH8G2kKshl oPft9z32b+k5Opa7ImeIkdvX9+QXtBPlzn+xBdhFjlcyOTsj2tSuqMk1X9tQDYTzbaUcOZXth 4NlM4VtKqSXxWk6UqqwovD8mcRdlnzacspbEQYRVMxEHuyI6OuWKH9CmAGOMIOqwxvvesYcDH eashKK/UPt751cniNF6ffyGn0Z99xzQ1N9R8fiKuYChC0e1F5xJoGG1FI+qYGzR/ms1Ab/xi5 /aR2wpLG5j/Vzh0mHOug== X-Rspamd-Queue-Id: 4ClpXt1klJz4Ylq X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Dec 2020 17:11:28 -0000 --Sig_/KETrf1QMtADqrPF5IM2W=ZJ Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable On Tue, 1 Dec 2020 07:47:50 -0600 Kyle Evans wrote: > On Tue, Dec 1, 2020 at 7:39 AM O. Hartmann > wrote: > > > > On Sun, 29 Nov 2020 19:38:04 +0000 (UTC) > > Matt Macy wrote: > > =20 > > > Author: mmacy > > > Date: Sun Nov 29 19:38:03 2020 > > > New Revision: 368163 > > > URL: https://svnweb.freebsd.org/changeset/base/368163 > > > > > > Log: > > > Import kernel WireGuard support > > > > > > Data path largely shared with the OpenBSD implementation by > > > Matt Dunwoodie > > > > > > Reviewed by: grehan@freebsd.org > > > MFC after: 1 month > > > Sponsored by: Rubicon LLC, (Netgate) > > > Differential Revision: https://reviews.freebsd.org/D26137 > > > > > > [... snip ...] =20 > > > > "make installkernel" fails for me in a non-DEBUG environment with > > the error shown below. Recent CURRENT source tree is r368226, > > failing systems are running at r368055 or r368226. > > > > [...] > > =20 > > =3D=3D=3D> i2c/cyapa (install) =20 > > --- realinstall_subdir_if_wg --- > > install -T dbg -o root -g wheel -m 555 if_wg.ko.debug > > /usr/lib/debug/boot/kernel/ install: /usr/lib/debug/boot/kernel/: > > No such file or directory --- realinstall_subdir_iflib --- > > --- _kmodinstall --- > > --- realinstall_subdir_if_wg --- > > *** [_kmodinstall] Error code 71 > > > > make[4]: stopped in /usr/src/sys/modules/if_wg > > 1 error > > > > make[4]: stopped in /usr/src/sys/modules/if_wg > > --- realinstall_subdir_iflib --- > > install -T release -o root -g wheel -m 555 iflib.ko /boot/kernel/ > > --- realinstall_subdir_if_wg --- > > --- realinstall_subdir_geom --- > > --- realinstall_subdir_iflib --- > > --- realinstall_subdir_i2c --- > > *** [modules-install] Error code 2 > > > > [...] =20 >=20 > Go to sys/modules/if_wg/Makefile and rip out the DEBUG_FLAGS line, > this should fix it. Thankyou very much, that works as a workaround. Kind regards, oh --Sig_/KETrf1QMtADqrPF5IM2W=ZJ Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iHUEARYIAB0WIQSy8IBxAPDkqVBaTJ44N1ZZPba5RwUCX8Z5MwAKCRA4N1ZZPba5 R7dqAQC81RGKjazV2vdFLnv8YECxRAk5hGejmmbRz3cNRci4+AEAq/x+0+ac/fbM fP7/pqXMG680DA+PiL0+pqXyl35nHw4= =ilUN -----END PGP SIGNATURE----- --Sig_/KETrf1QMtADqrPF5IM2W=ZJ-- From owner-svn-src-head@freebsd.org Tue Dec 1 17:17:23 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9344F4AEFBB; Tue, 1 Dec 2020 17:17:23 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Clpgl3qLXz4ZGp; Tue, 1 Dec 2020 17:17:23 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 718A61940C; Tue, 1 Dec 2020 17:17:23 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B1HHNJO013860; Tue, 1 Dec 2020 17:17:23 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B1HHNr1013859; Tue, 1 Dec 2020 17:17:23 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <202012011717.0B1HHNr1013859@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 1 Dec 2020 17:17:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368241 - head/sys/mips/mips X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/mips/mips X-SVN-Commit-Revision: 368241 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Dec 2020 17:17:23 -0000 Author: jhb Date: Tue Dec 1 17:17:22 2020 New Revision: 368241 URL: https://svnweb.freebsd.org/changeset/base/368241 Log: Make stack_save*() more robust on MIPS. - Validate any stack addresses read from against td_kstack before reading. If an unwind operation would attempt to read outside the bounds of td_kstack, abort the unwind instead. - For stack_save_td(), don't use the PC and SP from the current thread, instead read the PC and SP from pcb_context[]. - For stack_save(), use the current PC and SP of the current thread, not the values from pcb_regs (the horribly named td_frame of the outermost trapframe). The result was that stack_trace() never logged _any_ kernel frames but only the frame from the saved userspace registers on entry from the kernel. - Inline the one use of stack_register_fetch(). - Add a VALID_PC() helper macro and simplify types to remove excessive casts in stack_capture(). - Fix stack_capture() to work on compilers written in this century. Don't treat function epilogues as function prologues by skipping additions to SP when searching for a function start. - Add some comments to stack_capture() and fix some style bugs. Reviewed by: arichardson Obtained from: CheriBSD Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D27358 Modified: head/sys/mips/mips/stack_machdep.c Modified: head/sys/mips/mips/stack_machdep.c ============================================================================== --- head/sys/mips/mips/stack_machdep.c Tue Dec 1 17:04:46 2020 (r368240) +++ head/sys/mips/mips/stack_machdep.c Tue Dec 1 17:17:22 2020 (r368241) @@ -41,30 +41,33 @@ __FBSDID("$FreeBSD$"); #include #include -static u_register_t -stack_register_fetch(u_register_t sp, u_register_t stack_pos) -{ - u_register_t * stack = - ((u_register_t *)(intptr_t)sp + (size_t)stack_pos/sizeof(u_register_t)); +#define VALID_PC(addr) ((addr) >= (uintptr_t)btext && (addr) % 4 == 0) - return *stack; -} - static void -stack_capture(struct stack *st, u_register_t pc, u_register_t sp) +stack_capture(struct stack *st, struct thread *td, uintptr_t pc, uintptr_t sp) { - u_register_t ra = 0, i, stacksize; - short ra_stack_pos = 0; + u_register_t ra; + uintptr_t i, ra_addr; + int ra_stack_pos, stacksize; InstFmt insn; stack_zero(st); for (;;) { - stacksize = 0; - if (pc <= (u_register_t)(intptr_t)btext) + if (!VALID_PC(pc)) break; - for (i = pc; i >= (u_register_t)(intptr_t)btext; i -= sizeof (insn)) { - bcopy((void *)(intptr_t)i, &insn, sizeof insn); + + /* + * Walk backward from the PC looking for the function + * start. Assume a subtraction from SP is the start + * of a function. Hope that we find the store of RA + * into the stack frame along the way and save the + * offset of the saved RA relative to SP. + */ + ra_stack_pos = -1; + stacksize = 0; + for (i = pc; VALID_PC(i); i -= sizeof(insn)) { + bcopy((void *)i, &insn, sizeof(insn)); switch (insn.IType.op) { case OP_ADDI: case OP_ADDIU: @@ -72,6 +75,17 @@ stack_capture(struct stack *st, u_register_t pc, u_reg case OP_DADDIU: if (insn.IType.rs != SP || insn.IType.rt != SP) break; + + /* + * Ignore stack fixups in "early" + * returns in a function, or if the + * call was from an unlikely branch + * moved after the end of the normal + * return. + */ + if ((short)insn.IType.imm > 0) + break; + stacksize = -(short)insn.IType.imm; break; @@ -85,36 +99,49 @@ stack_capture(struct stack *st, u_register_t pc, u_reg break; } - if (stacksize) + if (stacksize != 0) break; } if (stack_put(st, pc) == -1) break; - for (i = pc; !ra; i += sizeof (insn)) { - bcopy((void *)(intptr_t)i, &insn, sizeof insn); + if (ra_stack_pos == -1) + break; + /* + * Walk forward from the PC to find the function end + * (jr RA). If eret is hit instead, stop unwinding. + */ + ra_addr = sp + ra_stack_pos; + ra = 0; + for (i = pc; VALID_PC(i); i += sizeof(insn)) { + bcopy((void *)i, &insn, sizeof(insn)); + switch (insn.IType.op) { case OP_SPECIAL: if (insn.RType.func == OP_JR) { - if (ra >= (u_register_t)(intptr_t)btext) - break; if (insn.RType.rs != RA) break; - ra = stack_register_fetch(sp, - ra_stack_pos); - if (!ra) + if (!kstack_contains(td, ra_addr, + sizeof(ra))) goto done; + ra = *(u_register_t *)ra_addr; + if (ra == 0) + goto done; ra -= 8; } break; default: break; } + /* eret */ if (insn.word == 0x42000018) goto done; + + if (ra != 0) + break; } if (pc == ra && stacksize == 0) @@ -122,7 +149,6 @@ stack_capture(struct stack *st, u_register_t pc, u_reg sp += stacksize; pc = ra; - ra = 0; } done: return; @@ -131,7 +157,7 @@ done: int stack_save_td(struct stack *st, struct thread *td) { - u_register_t pc, sp; + uintptr_t pc, sp; THREAD_LOCK_ASSERT(td, MA_OWNED); KASSERT(!TD_IS_SWAPPED(td), @@ -140,21 +166,19 @@ stack_save_td(struct stack *st, struct thread *td) if (TD_IS_RUNNING(td)) return (EOPNOTSUPP); - pc = td->td_pcb->pcb_regs.pc; - sp = td->td_pcb->pcb_regs.sp; - stack_capture(st, pc, sp); + pc = td->td_pcb->pcb_context[PCB_REG_RA]; + sp = td->td_pcb->pcb_context[PCB_REG_SP]; + stack_capture(st, td, pc, sp); return (0); } void stack_save(struct stack *st) { - u_register_t pc, sp; + uintptr_t pc, sp; - if (curthread == NULL) - panic("stack_save: curthread == NULL"); - - pc = curthread->td_pcb->pcb_regs.pc; - sp = curthread->td_pcb->pcb_regs.sp; - stack_capture(st, pc, sp); + pc = (uintptr_t)&&here; + sp = (uintptr_t)__builtin_frame_address(0); +here: + stack_capture(st, curthread, pc, sp); } From owner-svn-src-head@freebsd.org Tue Dec 1 18:08:22 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F24734AFC77; Tue, 1 Dec 2020 18:08:22 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4ClqpZ6YpZz4f2j; Tue, 1 Dec 2020 18:08:22 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D490519DD4; Tue, 1 Dec 2020 18:08:22 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B1I8M0I047382; Tue, 1 Dec 2020 18:08:22 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B1I8MIG047380; Tue, 1 Dec 2020 18:08:22 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <202012011808.0B1I8MIG047380@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 1 Dec 2020 18:08:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368242 - head/sys/cddl/dev/dtrace/riscv X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/cddl/dev/dtrace/riscv X-SVN-Commit-Revision: 368242 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Dec 2020 18:08:23 -0000 Author: jhb Date: Tue Dec 1 18:08:22 2020 New Revision: 368242 URL: https://svnweb.freebsd.org/changeset/base/368242 Log: Use uintptr_t for pointers in stack frames. This catches up to the changes made to struct unwind_state in r364180. Reviewed by: mhorne Obtained from: CheriBSD Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D27360 Modified: head/sys/cddl/dev/dtrace/riscv/dtrace_isa.c Modified: head/sys/cddl/dev/dtrace/riscv/dtrace_isa.c ============================================================================== --- head/sys/cddl/dev/dtrace/riscv/dtrace_isa.c Tue Dec 1 17:17:22 2020 (r368241) +++ head/sys/cddl/dev/dtrace/riscv/dtrace_isa.c Tue Dec 1 18:08:22 2020 (r368242) @@ -85,9 +85,9 @@ dtrace_getpcstack(pc_t *pcstack, int pcstack_limit, in __asm __volatile("mv %0, sp" : "=&r" (sp)); - state.fp = (uint64_t)__builtin_frame_address(0); + state.fp = (uintptr_t)__builtin_frame_address(0); state.sp = sp; - state.pc = (uint64_t)dtrace_getpcstack; + state.pc = (uintptr_t)dtrace_getpcstack; while (depth < pcstack_limit) { if (unwind_frame(&state)) @@ -266,9 +266,9 @@ dtrace_getstackdepth(int aframes) __asm __volatile("mv %0, sp" : "=&r" (sp)); - state.fp = (uint64_t)__builtin_frame_address(0); + state.fp = (uintptr_t)__builtin_frame_address(0); state.sp = sp; - state.pc = (uint64_t)dtrace_getstackdepth; + state.pc = (uintptr_t)dtrace_getstackdepth; do { done = unwind_frame(&state); From owner-svn-src-head@freebsd.org Tue Dec 1 18:22:36 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 89DB54B0B32; Tue, 1 Dec 2020 18:22:36 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Clr703SrYz4g7l; Tue, 1 Dec 2020 18:22:36 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 69E461A146; Tue, 1 Dec 2020 18:22:36 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B1IMaFY059403; Tue, 1 Dec 2020 18:22:36 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B1IMZrH059398; Tue, 1 Dec 2020 18:22:35 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <202012011822.0B1IMZrH059398@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 1 Dec 2020 18:22:35 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368245 - in head/sys: arm64/arm64 arm64/include cddl/dev/dtrace/aarch64 X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in head/sys: arm64/arm64 arm64/include cddl/dev/dtrace/aarch64 X-SVN-Commit-Revision: 368245 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Dec 2020 18:22:36 -0000 Author: jhb Date: Tue Dec 1 18:22:34 2020 New Revision: 368245 URL: https://svnweb.freebsd.org/changeset/base/368245 Log: Use uintptr_t instead of uint64_t for pointers in stack frames. Reviewed by: andrew Obtained from: CheriBSD Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D27361 Modified: head/sys/arm64/arm64/db_trace.c head/sys/arm64/arm64/stack_machdep.c head/sys/arm64/arm64/unwind.c head/sys/arm64/include/csan.h head/sys/arm64/include/stack.h head/sys/cddl/dev/dtrace/aarch64/dtrace_isa.c Modified: head/sys/arm64/arm64/db_trace.c ============================================================================== --- head/sys/arm64/arm64/db_trace.c Tue Dec 1 18:13:57 2020 (r368244) +++ head/sys/arm64/arm64/db_trace.c Tue Dec 1 18:22:34 2020 (r368245) @@ -73,7 +73,7 @@ db_stack_trace_cmd(struct unwind_state *frame) db_expr_t offset; while (1) { - uint64_t pc = frame->pc; + uintptr_t pc = frame->pc; int ret; ret = unwind_frame(frame); @@ -109,9 +109,9 @@ db_trace_thread(struct thread *thr, int count) if (thr != curthread) { ctx = kdb_thr_ctx(thr); - frame.sp = (uint64_t)ctx->pcb_sp; - frame.fp = (uint64_t)ctx->pcb_x[29]; - frame.pc = (uint64_t)ctx->pcb_x[30]; + frame.sp = (uintptr_t)ctx->pcb_sp; + frame.fp = (uintptr_t)ctx->pcb_x[29]; + frame.pc = (uintptr_t)ctx->pcb_x[30]; db_stack_trace_cmd(&frame); } else db_trace_self(); @@ -122,12 +122,12 @@ void db_trace_self(void) { struct unwind_state frame; - uint64_t sp; + uintptr_t sp; __asm __volatile("mov %0, sp" : "=&r" (sp)); frame.sp = sp; - frame.fp = (uint64_t)__builtin_frame_address(0); - frame.pc = (uint64_t)db_trace_self; + frame.fp = (uintptr_t)__builtin_frame_address(0); + frame.pc = (uintptr_t)db_trace_self; db_stack_trace_cmd(&frame); } Modified: head/sys/arm64/arm64/stack_machdep.c ============================================================================== --- head/sys/arm64/arm64/stack_machdep.c Tue Dec 1 18:13:57 2020 (r368244) +++ head/sys/arm64/arm64/stack_machdep.c Tue Dec 1 18:22:34 2020 (r368245) @@ -81,13 +81,13 @@ void stack_save(struct stack *st) { struct unwind_state frame; - uint64_t sp; + uintptr_t sp; __asm __volatile("mov %0, sp" : "=&r" (sp)); frame.sp = sp; - frame.fp = (uint64_t)__builtin_frame_address(0); - frame.pc = (uint64_t)stack_save; + frame.fp = (uintptr_t)__builtin_frame_address(0); + frame.pc = (uintptr_t)stack_save; stack_capture(st, &frame); } Modified: head/sys/arm64/arm64/unwind.c ============================================================================== --- head/sys/arm64/arm64/unwind.c Tue Dec 1 18:13:57 2020 (r368244) +++ head/sys/arm64/arm64/unwind.c Tue Dec 1 18:22:34 2020 (r368245) @@ -37,17 +37,17 @@ __FBSDID("$FreeBSD$"); int unwind_frame(struct unwind_state *frame) { - uint64_t fp; + uintptr_t fp; fp = frame->fp; if (!INKERNEL(fp)) return (-1); - frame->sp = fp + 0x10; + frame->sp = fp + sizeof(uintptr_t) * 2; /* FP to previous frame (X29) */ - frame->fp = *(uint64_t *)(fp); + frame->fp = ((uintptr_t *)fp)[0]; /* LR (X30) */ - frame->pc = *(uint64_t *)(fp + 8) - 4; + frame->pc = ((uintptr_t *)fp)[1] - 4; return (0); } Modified: head/sys/arm64/include/csan.h ============================================================================== --- head/sys/arm64/include/csan.h Tue Dec 1 18:13:57 2020 (r368244) +++ head/sys/arm64/include/csan.h Tue Dec 1 18:22:34 2020 (r368245) @@ -76,14 +76,14 @@ kcsan_md_unwind(void) const char *symname; #endif struct unwind_state frame; - uint64_t sp; + uintptr_t sp; int nsym; __asm __volatile("mov %0, sp" : "=&r" (sp)); frame.sp = sp; - frame.fp = (uint64_t)__builtin_frame_address(0); - frame.pc = (uint64_t)kcsan_md_unwind; + frame.fp = (uintptr_t)__builtin_frame_address(0); + frame.pc = (uintptr_t)kcsan_md_unwind; nsym = 0; while (1) { Modified: head/sys/arm64/include/stack.h ============================================================================== --- head/sys/arm64/include/stack.h Tue Dec 1 18:13:57 2020 (r368244) +++ head/sys/arm64/include/stack.h Tue Dec 1 18:22:34 2020 (r368245) @@ -33,9 +33,9 @@ ((va) >= VM_MIN_KERNEL_ADDRESS && (va) <= VM_MAX_KERNEL_ADDRESS) struct unwind_state { - uint64_t fp; - uint64_t sp; - uint64_t pc; + uintptr_t fp; + uintptr_t sp; + uintptr_t pc; }; int unwind_frame(struct unwind_state *); Modified: head/sys/cddl/dev/dtrace/aarch64/dtrace_isa.c ============================================================================== --- head/sys/cddl/dev/dtrace/aarch64/dtrace_isa.c Tue Dec 1 18:13:57 2020 (r368244) +++ head/sys/cddl/dev/dtrace/aarch64/dtrace_isa.c Tue Dec 1 18:22:34 2020 (r368245) @@ -83,9 +83,9 @@ dtrace_getpcstack(pc_t *pcstack, int pcstack_limit, in __asm __volatile("mov %0, sp" : "=&r" (sp)); - state.fp = (uint64_t)__builtin_frame_address(0); + state.fp = (uintptr_t)__builtin_frame_address(0); state.sp = sp; - state.pc = (uint64_t)dtrace_getpcstack; + state.pc = (uintptr_t)dtrace_getpcstack; while (depth < pcstack_limit) { if (!INKERNEL(state.pc) || !INKERNEL(state.fp)) @@ -281,9 +281,9 @@ dtrace_getstackdepth(int aframes) __asm __volatile("mov %0, sp" : "=&r" (sp)); - state.fp = (uint64_t)__builtin_frame_address(0); + state.fp = (uintptr_t)__builtin_frame_address(0); state.sp = sp; - state.pc = (uint64_t)dtrace_getstackdepth; + state.pc = (uintptr_t)dtrace_getstackdepth; do { done = unwind_frame(&state); From owner-svn-src-head@freebsd.org Tue Dec 1 18:24:07 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9FDEC4B0AE7; Tue, 1 Dec 2020 18:24:07 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Clr8l4Cjtz4gHY; Tue, 1 Dec 2020 18:24:07 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 796851A032; Tue, 1 Dec 2020 18:24:07 +0000 (UTC) (envelope-from bz@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B1IO7pf059525; Tue, 1 Dec 2020 18:24:07 GMT (envelope-from bz@FreeBSD.org) Received: (from bz@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B1IO6Fi059523; Tue, 1 Dec 2020 18:24:06 GMT (envelope-from bz@FreeBSD.org) Message-Id: <202012011824.0B1IO6Fi059523@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bz set sender to bz@FreeBSD.org using -f From: "Bjoern A. Zeeb" Date: Tue, 1 Dec 2020 18:24:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368246 - in head/sys/dev/usb: quirk storage X-SVN-Group: head X-SVN-Commit-Author: bz X-SVN-Commit-Paths: in head/sys/dev/usb: quirk storage X-SVN-Commit-Revision: 368246 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Dec 2020 18:24:07 -0000 Author: bz Date: Tue Dec 1 18:24:06 2020 New Revision: 368246 URL: https://svnweb.freebsd.org/changeset/base/368246 Log: USB umass: add quirk to not probe Some USB WLAN devices have "on-board" storage showing up as umass and making the root mount wait for a very long time. The WLAN drivers know how to deal with that an issue an eject command later when attaching themselves. Introduce a quirk to not probe these devices as umass and avoid hangs and confusion altogether. Reviewed by: hselasky, imp MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D27434 Modified: head/sys/dev/usb/quirk/usb_quirk.c head/sys/dev/usb/quirk/usb_quirk.h head/sys/dev/usb/storage/umass.c Modified: head/sys/dev/usb/quirk/usb_quirk.c ============================================================================== --- head/sys/dev/usb/quirk/usb_quirk.c Tue Dec 1 18:22:34 2020 (r368245) +++ head/sys/dev/usb/quirk/usb_quirk.c Tue Dec 1 18:24:06 2020 (r368246) @@ -539,6 +539,7 @@ static struct usb_quirk_entry usb_quirks[USB_DEV_QUIRK USB_QUIRK(QUALCOMMINC, ZTE_MF730M, 0x0000, 0xffff, UQ_MSC_NO_GETMAXLUN, UQ_MSC_NO_INQUIRY, UQ_CFG_INDEX_0), USB_QUIRK(SMART2, G2MEMKEY, 0x0000, 0xffff, UQ_MSC_NO_INQUIRY), + USB_QUIRK(RALINK, RT_STOR, 0x0001, 0x0001, UQ_MSC_IGNORE), /* Non-standard USB MIDI devices */ USB_QUIRK(ROLAND, UM1, 0x0000, 0xffff, UQ_AU_VENDOR_CLASS), USB_QUIRK(ROLAND, SC8850, 0x0000, 0xffff, UQ_AU_VENDOR_CLASS), @@ -642,6 +643,7 @@ static const char *usb_quirk_str[USB_QUIRK_MAX] = { [UQ_MSC_FORCE_PROTO_ATAPI] = "UQ_MSC_FORCE_PROTO_ATAPI", [UQ_MSC_FORCE_PROTO_UFI] = "UQ_MSC_FORCE_PROTO_UFI", [UQ_MSC_FORCE_PROTO_RBC] = "UQ_MSC_FORCE_PROTO_RBC", + [UQ_MSC_IGNORE] = "UQ_MSC_IGNORE", [UQ_MSC_EJECT_HUAWEI] = "UQ_MSC_EJECT_HUAWEI", [UQ_MSC_EJECT_SIERRA] = "UQ_MSC_EJECT_SIERRA", [UQ_MSC_EJECT_SCSIEJECT] = "UQ_MSC_EJECT_SCSIEJECT", Modified: head/sys/dev/usb/quirk/usb_quirk.h ============================================================================== --- head/sys/dev/usb/quirk/usb_quirk.h Tue Dec 1 18:22:34 2020 (r368245) +++ head/sys/dev/usb/quirk/usb_quirk.h Tue Dec 1 18:24:06 2020 (r368246) @@ -93,6 +93,7 @@ enum { UQ_MSC_FORCE_PROTO_ATAPI, /* force ATAPI command protocol */ UQ_MSC_FORCE_PROTO_UFI, /* force UFI command protocol */ UQ_MSC_FORCE_PROTO_RBC, /* force RBC command protocol */ + UQ_MSC_IGNORE, /* device should be ignored by umass */ /* Ejection of mass storage (driver disk) */ UQ_MSC_EJECT_HUAWEI, /* ejects after Huawei USB command */ Modified: head/sys/dev/usb/storage/umass.c ============================================================================== --- head/sys/dev/usb/storage/umass.c Tue Dec 1 18:22:34 2020 (r368245) +++ head/sys/dev/usb/storage/umass.c Tue Dec 1 18:24:06 2020 (r368246) @@ -784,6 +784,12 @@ umass_probe_proto(device_t dev, struct usb_attach_arg memset(&ret, 0, sizeof(ret)); ret.error = BUS_PROBE_GENERIC; + /* Check if we should deny probing. */ + if (usb_test_quirk(uaa, UQ_MSC_IGNORE)) { + ret.error = ENXIO; + goto done; + } + /* Search for protocol enforcement */ if (usb_test_quirk(uaa, UQ_MSC_FORCE_WIRE_BBB)) { From owner-svn-src-head@freebsd.org Tue Dec 1 18:57:38 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 044E84B16B2; Tue, 1 Dec 2020 18:57:38 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4ClrvP6dgcz4jMs; Tue, 1 Dec 2020 18:57:37 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D53DB1A88A; Tue, 1 Dec 2020 18:57:37 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B1IvbgB078766; Tue, 1 Dec 2020 18:57:37 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B1Ivb4V078765; Tue, 1 Dec 2020 18:57:37 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <202012011857.0B1Ivb4V078765@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Tue, 1 Dec 2020 18:57:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368247 - head/share/man/man4 X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/share/man/man4 X-SVN-Commit-Revision: 368247 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Dec 2020 18:57:38 -0000 Author: jhb Date: Tue Dec 1 18:57:37 2020 New Revision: 368247 URL: https://svnweb.freebsd.org/changeset/base/368247 Log: Fix a couple of typos. Submitted by: rmacklem Modified: head/share/man/man4/ktls.4 Modified: head/share/man/man4/ktls.4 ============================================================================== --- head/share/man/man4/ktls.4 Tue Dec 1 18:24:06 2020 (r368246) +++ head/share/man/man4/ktls.4 Tue Dec 1 18:57:37 2020 (r368247) @@ -31,7 +31,7 @@ .\" .\" $FreeBSD$ .\" -.Dd November 25, 2020 +.Dd December 1, 2020 .Dt KTLS 4 .Os .Sh NAME @@ -78,13 +78,13 @@ is not enabled. .It Dv TCP_TLS_MODE_SW TLS records are encrypted or decrypted in the kernel in the socket layer. -Typically the encryption or decryption is performred in software, +Typically the encryption or decryption is performed in software, but it may also be performed by co-processors via .Xr crypto 9 . .It Dv TCP_TLS_MODE_IFNET TLS records are encrypted or decrypted by the network interface card (NIC). In this mode, the network stack does not work with encrypted data. -Instead, the NIC is encrypts TLS records as they are being transmitted, +Instead, the NIC encrypts TLS records as they are being transmitted, or decrypts received TLS records before providing them to the host. .Pp Network interfaces which support this feature will advertise the From owner-svn-src-head@freebsd.org Tue Dec 1 19:34:45 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5EACC4B2051; Tue, 1 Dec 2020 19:34:45 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4ClskF1zmYz4lFK; Tue, 1 Dec 2020 19:34:45 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 32BE11AED8; Tue, 1 Dec 2020 19:34:45 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B1JYj5U003752; Tue, 1 Dec 2020 19:34:45 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B1JYjZR003751; Tue, 1 Dec 2020 19:34:45 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202012011934.0B1JYjZR003751@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Tue, 1 Dec 2020 19:34:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368248 - head/usr.sbin/rtsold X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/usr.sbin/rtsold X-SVN-Commit-Revision: 368248 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Dec 2020 19:34:45 -0000 Author: markj Date: Tue Dec 1 19:34:44 2020 New Revision: 368248 URL: https://svnweb.freebsd.org/changeset/base/368248 Log: rtsold: Fix multiple buffer overflows Approved by: so Security: CVE-2020-25577 MFC after: now Modified: head/usr.sbin/rtsold/rtsol.c Modified: head/usr.sbin/rtsold/rtsol.c ============================================================================== --- head/usr.sbin/rtsold/rtsol.c Tue Dec 1 18:57:37 2020 (r368247) +++ head/usr.sbin/rtsold/rtsol.c Tue Dec 1 19:34:44 2020 (r368248) @@ -337,8 +337,8 @@ rtsol_input(int sock) newent_rai = 1; } -#define RA_OPT_NEXT_HDR(x) (struct nd_opt_hdr *)((char *)x + \ - (((struct nd_opt_hdr *)x)->nd_opt_len * 8)) +#define RA_OPT_NEXT_HDR(x) (struct nd_opt_hdr *)((char *)(x) + \ + (((struct nd_opt_hdr *)(x))->nd_opt_len * 8)) /* Process RA options. */ warnmsg(LOG_DEBUG, __func__, "Processing RA"); raoptp = (char *)icp + sizeof(struct nd_router_advert); @@ -350,6 +350,15 @@ rtsol_input(int sock) warnmsg(LOG_DEBUG, __func__, "ndo->nd_opt_len = %d", ndo->nd_opt_len); + if (ndo->nd_opt_len == 0) { + warnmsg(LOG_INFO, __func__, "invalid option length 0."); + break; + } + if ((char *)RA_OPT_NEXT_HDR(raoptp) > (char *)icp + msglen) { + warnmsg(LOG_INFO, __func__, "option length overflow."); + break; + } + switch (ndo->nd_opt_type) { case ND_OPT_RDNSS: rdnss = (struct nd_opt_rdnss *)raoptp; @@ -760,15 +769,18 @@ dname_labeldec(char *dst, size_t dlen, const char *src src_last = strchr(src, '\0'); dst_origin = dst; memset(dst, '\0', dlen); - while (src && (len = (uint8_t)(*src++) & 0x3f) && - (src + len) <= src_last && - (dst - dst_origin < (ssize_t)dlen)) { - if (dst != dst_origin) + while ((len = (*src++) & 0x3f) && + src + len <= src_last && + len + (dst == dst_origin ? 0 : 1) < dlen) { + if (dst != dst_origin) { *dst++ = '.'; + dlen--; + } warnmsg(LOG_DEBUG, __func__, "labellen = %zd", len); memcpy(dst, src, len); src += len; dst += len; + dlen -= len; } *dst = '\0'; From owner-svn-src-head@freebsd.org Tue Dec 1 20:10:55 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DBC374B2F51; Tue, 1 Dec 2020 20:10:55 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CltWz5tPhz4pZ7; Tue, 1 Dec 2020 20:10:55 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BCDED1B4BB; Tue, 1 Dec 2020 20:10:55 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B1KAtEH023995; Tue, 1 Dec 2020 20:10:55 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B1KAtL6023994; Tue, 1 Dec 2020 20:10:55 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <202012012010.0B1KAtL6023994@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Tue, 1 Dec 2020 20:10:55 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368258 - head/sys/arm64/include X-SVN-Group: head X-SVN-Commit-Author: gonzo X-SVN-Commit-Paths: head/sys/arm64/include X-SVN-Commit-Revision: 368258 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Dec 2020 20:10:55 -0000 Author: gonzo Date: Tue Dec 1 20:10:55 2020 New Revision: 368258 URL: https://svnweb.freebsd.org/changeset/base/368258 Log: [arm64] Bump MAXMEMDOM value to 8 to match amd64 On some of the server-grade ARM64 machines the number of NUMA domains is higher than 2. When booting GENERIC kernel on such machines the SRAT parser fails leaving the system with a single domain. To make GENERIC kernel usable on those server, match the parameter value with the one for amd64 arch. Reviewed by: allanjude Differential Revision: https://reviews.freebsd.org/D27368 Sponsored by: Ampere Computing Submitted by: Klara, Inc. Modified: head/sys/arm64/include/param.h Modified: head/sys/arm64/include/param.h ============================================================================== --- head/sys/arm64/include/param.h Tue Dec 1 19:40:58 2020 (r368257) +++ head/sys/arm64/include/param.h Tue Dec 1 20:10:55 2020 (r368258) @@ -63,7 +63,7 @@ #endif #ifndef MAXMEMDOM -#define MAXMEMDOM 2 +#define MAXMEMDOM 8 #endif #define ALIGNBYTES _ALIGNBYTES From owner-svn-src-head@freebsd.org Tue Dec 1 20:27:06 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D50B14B34C1; Tue, 1 Dec 2020 20:27:06 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Clttf5lMBz4qPg; Tue, 1 Dec 2020 20:27:06 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B82DC1B570; Tue, 1 Dec 2020 20:27:06 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B1KR62k036013; Tue, 1 Dec 2020 20:27:06 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B1KR670036012; Tue, 1 Dec 2020 20:27:06 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <202012012027.0B1KR670036012@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Tue, 1 Dec 2020 20:27:06 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368259 - head/sys/dev/acpica X-SVN-Group: head X-SVN-Commit-Author: gonzo X-SVN-Commit-Paths: head/sys/dev/acpica X-SVN-Commit-Revision: 368259 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Dec 2020 20:27:06 -0000 Author: gonzo Date: Tue Dec 1 20:27:06 2020 New Revision: 368259 URL: https://svnweb.freebsd.org/changeset/base/368259 Log: [arm64] Parse ACPI _PXM property on ARM64 platform Enable devices' NUMA proximity infromation parsing on ARM64 systems Sponsored by: Ampere Computing Submitted by: Klara, Inc. Modified: head/sys/dev/acpica/acpi.c Modified: head/sys/dev/acpica/acpi.c ============================================================================== --- head/sys/dev/acpica/acpi.c Tue Dec 1 20:10:55 2020 (r368258) +++ head/sys/dev/acpica/acpi.c Tue Dec 1 20:27:06 2020 (r368259) @@ -1122,7 +1122,7 @@ static int acpi_parse_pxm(device_t dev) { #ifdef NUMA -#if defined(__i386__) || defined(__amd64__) +#if defined(__i386__) || defined(__amd64__) || defined(__aarch64__) ACPI_HANDLE handle; ACPI_STATUS status; int pxm; From owner-svn-src-head@freebsd.org Tue Dec 1 22:28:02 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5AF4E468D46; Tue, 1 Dec 2020 22:28:02 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4ClxZB27rsz3K7b; Tue, 1 Dec 2020 22:28:02 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3B98D1D062; Tue, 1 Dec 2020 22:28:02 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B1MS2pp010539; Tue, 1 Dec 2020 22:28:02 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B1MS1dN010521; Tue, 1 Dec 2020 22:28:01 GMT (envelope-from kib@FreeBSD.org) Message-Id: <202012012228.0B1MS1dN010521@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 1 Dec 2020 22:28:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368260 - in head: libexec/rtld-elf sys/sys X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in head: libexec/rtld-elf sys/sys X-SVN-Commit-Revision: 368260 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Dec 2020 22:28:02 -0000 Author: kib Date: Tue Dec 1 22:28:01 2020 New Revision: 368260 URL: https://svnweb.freebsd.org/changeset/base/368260 Log: rtld: bump r_debug.r_version to 1 from current 0. Add r_ldbase. Requested and reviewed by: emaste Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D27429 Modified: head/libexec/rtld-elf/rtld.c head/sys/sys/link_elf.h Modified: head/libexec/rtld-elf/rtld.c ============================================================================== --- head/libexec/rtld-elf/rtld.c Tue Dec 1 20:27:06 2020 (r368259) +++ head/libexec/rtld-elf/rtld.c Tue Dec 1 22:28:01 2020 (r368260) @@ -2272,8 +2272,10 @@ init_rtld(caddr_t mapbase, Elf_Auxinfo **aux_info) parse_rtld_phdr(&obj_rtld); obj_enforce_relro(&obj_rtld); + r_debug.r_version = R_DEBUG_VERSION; r_debug.r_brk = r_debug_state; r_debug.r_state = RT_CONSISTENT; + r_debug.r_ldbase = obj_rtld.relocbase; } /* Modified: head/sys/sys/link_elf.h ============================================================================== --- head/sys/sys/link_elf.h Tue Dec 1 20:27:06 2020 (r368259) +++ head/sys/sys/link_elf.h Tue Dec 1 22:28:01 2020 (r368260) @@ -69,7 +69,7 @@ typedef struct link_map { } Link_map; struct r_debug { - int r_version; /* not used */ + int r_version; /* Currently '1' */ struct link_map *r_map; /* list of loaded images */ void (*r_brk)(struct r_debug *, struct link_map *); /* pointer to break point */ @@ -78,7 +78,10 @@ struct r_debug { RT_ADD, /* adding a shared library */ RT_DELETE /* removing a shared library */ } r_state; + void *r_ldbase; /* Base address of rtld */ }; + +#define R_DEBUG_VERSION 1 struct dl_phdr_info { From owner-svn-src-head@freebsd.org Tue Dec 1 22:28:02 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A2A5D468F71; Tue, 1 Dec 2020 22:28:02 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4ClxZB4HvNz3K1w; Tue, 1 Dec 2020 22:28:02 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 865B21D0A1; Tue, 1 Dec 2020 22:28:02 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B1MS2FJ010556; Tue, 1 Dec 2020 22:28:02 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B1MS2W0010555; Tue, 1 Dec 2020 22:28:02 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <202012012228.0B1MS2W0010555@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Tue, 1 Dec 2020 22:28:02 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368261 - head/stand/ficl X-SVN-Group: head X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: head/stand/ficl X-SVN-Commit-Revision: 368261 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Dec 2020 22:28:02 -0000 Author: tsoome Date: Tue Dec 1 22:28:02 2020 New Revision: 368261 URL: https://svnweb.freebsd.org/changeset/base/368261 Log: ficl: instead of pad, emit can use local variable Pad in forth is used as "scratchpad" and internal implementations should not use it. Ficl does not really follow this rule and this can fire back. emit has no need to use pad, we can use local variable instead. Modified: head/stand/ficl/words.c Modified: head/stand/ficl/words.c ============================================================================== --- head/stand/ficl/words.c Tue Dec 1 22:28:01 2020 (r368260) +++ head/stand/ficl/words.c Tue Dec 1 22:28:02 2020 (r368261) @@ -1015,7 +1015,7 @@ static void twoSwap(FICL_VM *pVM) static void emit(FICL_VM *pVM) { - char *cp = pVM->pad; + char cp[2]; int i; #if FICL_ROBUST > 1 From owner-svn-src-head@freebsd.org Tue Dec 1 22:30:33 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4B478468B4A; Tue, 1 Dec 2020 22:30:33 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Clxd519xkz3KBw; Tue, 1 Dec 2020 22:30:33 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1B58D1CF3F; Tue, 1 Dec 2020 22:30:33 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B1MUWiE010750; Tue, 1 Dec 2020 22:30:32 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B1MUW5H010749; Tue, 1 Dec 2020 22:30:32 GMT (envelope-from kib@FreeBSD.org) Message-Id: <202012012230.0B1MUW5H010749@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 1 Dec 2020 22:30:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368262 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 368262 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Dec 2020 22:30:33 -0000 Author: kib Date: Tue Dec 1 22:30:32 2020 New Revision: 368262 URL: https://svnweb.freebsd.org/changeset/base/368262 Log: vfs_aio.c: correct comment. Reviewed by: asomers Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D27421 Modified: head/sys/kern/vfs_aio.c Modified: head/sys/kern/vfs_aio.c ============================================================================== --- head/sys/kern/vfs_aio.c Tue Dec 1 22:28:02 2020 (r368261) +++ head/sys/kern/vfs_aio.c Tue Dec 1 22:30:32 2020 (r368262) @@ -248,8 +248,8 @@ struct aioproc { */ struct aioliojob { int lioj_flags; /* (a) listio flags */ - int lioj_count; /* (a) listio flags */ - int lioj_finished_count; /* (a) listio flags */ + int lioj_count; /* (a) count of jobs */ + int lioj_finished_count; /* (a) count of finished jobs */ struct sigevent lioj_signal; /* (a) signal on all I/O done */ TAILQ_ENTRY(aioliojob) lioj_list; /* (a) lio list */ struct knlist klist; /* (a) list of knotes */ From owner-svn-src-head@freebsd.org Tue Dec 1 22:44:24 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 87DC046958F; Tue, 1 Dec 2020 22:44:24 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Clxx43SsGz3L3m; Tue, 1 Dec 2020 22:44:24 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 696E61D2F4; Tue, 1 Dec 2020 22:44:24 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B1MiODj022500; Tue, 1 Dec 2020 22:44:24 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B1MiOfU022498; Tue, 1 Dec 2020 22:44:24 GMT (envelope-from kib@FreeBSD.org) Message-Id: <202012012244.0B1MiOfU022498@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 1 Dec 2020 22:44:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368263 - head/sys/cddl/dev/dtrace/amd64 X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/cddl/dev/dtrace/amd64 X-SVN-Commit-Revision: 368263 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Dec 2020 22:44:24 -0000 Author: kib Date: Tue Dec 1 22:44:23 2020 New Revision: 368263 URL: https://svnweb.freebsd.org/changeset/base/368263 Log: Fix syntax Modified: head/sys/cddl/dev/dtrace/amd64/dtrace_isa.c Modified: head/sys/cddl/dev/dtrace/amd64/dtrace_isa.c ============================================================================== --- head/sys/cddl/dev/dtrace/amd64/dtrace_isa.c Tue Dec 1 22:30:32 2020 (r368262) +++ head/sys/cddl/dev/dtrace/amd64/dtrace_isa.c Tue Dec 1 22:44:23 2020 (r368263) @@ -74,7 +74,7 @@ dtrace_getpcstack(pc_t *pcstack, int pcstack_limit, in td = curthread; while (depth < pcstack_limit) { if (!kstack_contains(curthread, (vm_offset_t)frame, - sizeof(*frame)) + sizeof(*frame))) break; callpc = frame->f_retaddr; @@ -463,7 +463,7 @@ dtrace_getstackdepth(int aframes) depth++; for(;;) { if (!kstack_contains(curthread, (vm_offset_t)frame, - sizeof(*frame)) + sizeof(*frame))) break; depth++; if (frame->f_frame <= frame) From owner-svn-src-head@freebsd.org Tue Dec 1 22:46:51 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E3EFF46934A; Tue, 1 Dec 2020 22:46:51 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Clxzv6C7Vz3LLX; Tue, 1 Dec 2020 22:46:51 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C79DE1D66A; Tue, 1 Dec 2020 22:46:51 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B1MkpUL022672; Tue, 1 Dec 2020 22:46:51 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B1Mkp6N022671; Tue, 1 Dec 2020 22:46:51 GMT (envelope-from kib@FreeBSD.org) Message-Id: <202012012246.0B1Mkp6N022671@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 1 Dec 2020 22:46:51 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368264 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 368264 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Dec 2020 22:46:52 -0000 Author: kib Date: Tue Dec 1 22:46:51 2020 New Revision: 368264 URL: https://svnweb.freebsd.org/changeset/base/368264 Log: vfs_aio.c: style. Mostly re-wrap conditions to split after binary ops. Reviewed by: asomers Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D27421 Modified: head/sys/kern/vfs_aio.c Modified: head/sys/kern/vfs_aio.c ============================================================================== --- head/sys/kern/vfs_aio.c Tue Dec 1 22:44:23 2020 (r368263) +++ head/sys/kern/vfs_aio.c Tue Dec 1 22:46:51 2020 (r368264) @@ -905,10 +905,10 @@ aio_bio_done_notify(struct proc *userp, struct kaiocb lj->lioj_flags |= LIOJ_KEVENT_POSTED; KNOTE_LOCKED(&lj->klist, 1); } - if ((lj->lioj_flags & (LIOJ_SIGNAL|LIOJ_SIGNAL_POSTED)) - == LIOJ_SIGNAL - && (lj->lioj_signal.sigev_notify == SIGEV_SIGNAL || - lj->lioj_signal.sigev_notify == SIGEV_THREAD_ID)) { + if ((lj->lioj_flags & (LIOJ_SIGNAL | LIOJ_SIGNAL_POSTED)) + == LIOJ_SIGNAL && + (lj->lioj_signal.sigev_notify == SIGEV_SIGNAL || + lj->lioj_signal.sigev_notify == SIGEV_THREAD_ID)) { aio_sendsig(userp, &lj->lioj_signal, &lj->lioj_ksi); lj->lioj_flags |= LIOJ_SIGNAL_POSTED; } @@ -2234,12 +2234,11 @@ kern_lio_listio(struct thread *td, int mode, struct ai lj->lioj_flags |= LIOJ_KEVENT_POSTED; KNOTE_LOCKED(&lj->klist, 1); } - if ((lj->lioj_flags & (LIOJ_SIGNAL|LIOJ_SIGNAL_POSTED)) - == LIOJ_SIGNAL - && (lj->lioj_signal.sigev_notify == SIGEV_SIGNAL || + if ((lj->lioj_flags & (LIOJ_SIGNAL | + LIOJ_SIGNAL_POSTED)) == LIOJ_SIGNAL && + (lj->lioj_signal.sigev_notify == SIGEV_SIGNAL || lj->lioj_signal.sigev_notify == SIGEV_THREAD_ID)) { - aio_sendsig(p, &lj->lioj_signal, - &lj->lioj_ksi); + aio_sendsig(p, &lj->lioj_signal, &lj->lioj_ksi); lj->lioj_flags |= LIOJ_SIGNAL_POSTED; } } From owner-svn-src-head@freebsd.org Tue Dec 1 22:53:34 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 380614695D2; Tue, 1 Dec 2020 22:53:34 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Cly7f1B61z3LKs; Tue, 1 Dec 2020 22:53:34 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1B8A71D902; Tue, 1 Dec 2020 22:53:34 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B1MrXqu028987; Tue, 1 Dec 2020 22:53:33 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B1MrXmL028986; Tue, 1 Dec 2020 22:53:33 GMT (envelope-from kib@FreeBSD.org) Message-Id: <202012012253.0B1MrXmL028986@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 1 Dec 2020 22:53:33 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368265 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 368265 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Dec 2020 22:53:34 -0000 Author: kib Date: Tue Dec 1 22:53:33 2020 New Revision: 368265 URL: https://svnweb.freebsd.org/changeset/base/368265 Log: lio_listio(2): send signal even if number of jobs is zero. Right now, if lio registered zero jobs, syscall frees lio job structure, cleaning up queued ksi. As result, the realtime signal is dequeued and never delivered. Fix it by allowing sendsig() to copy ksi when job count is zero. PR: 220398 Reported and reviewed by: asomers Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D27421 Modified: head/sys/kern/vfs_aio.c Modified: head/sys/kern/vfs_aio.c ============================================================================== --- head/sys/kern/vfs_aio.c Tue Dec 1 22:46:51 2020 (r368264) +++ head/sys/kern/vfs_aio.c Tue Dec 1 22:53:33 2020 (r368265) @@ -466,7 +466,7 @@ aio_init_aioinfo(struct proc *p) } static int -aio_sendsig(struct proc *p, struct sigevent *sigev, ksiginfo_t *ksi) +aio_sendsig(struct proc *p, struct sigevent *sigev, ksiginfo_t *ksi, bool ext) { struct thread *td; int error; @@ -477,7 +477,7 @@ aio_sendsig(struct proc *p, struct sigevent *sigev, ks if (!KSI_ONQ(ksi)) { ksiginfo_set_sigev(ksi, sigev); ksi->ksi_code = SI_ASYNCIO; - ksi->ksi_flags |= KSI_EXT | KSI_INS; + ksi->ksi_flags |= ext ? (KSI_EXT | KSI_INS) : 0; tdsendsignal(p, td, ksi->ksi_signo, ksi); } PROC_UNLOCK(p); @@ -896,7 +896,7 @@ aio_bio_done_notify(struct proc *userp, struct kaiocb if (job->uaiocb.aio_sigevent.sigev_notify == SIGEV_SIGNAL || job->uaiocb.aio_sigevent.sigev_notify == SIGEV_THREAD_ID) - aio_sendsig(userp, &job->uaiocb.aio_sigevent, &job->ksi); + aio_sendsig(userp, &job->uaiocb.aio_sigevent, &job->ksi, true); KNOTE_LOCKED(&job->klist, 1); @@ -909,7 +909,8 @@ aio_bio_done_notify(struct proc *userp, struct kaiocb == LIOJ_SIGNAL && (lj->lioj_signal.sigev_notify == SIGEV_SIGNAL || lj->lioj_signal.sigev_notify == SIGEV_THREAD_ID)) { - aio_sendsig(userp, &lj->lioj_signal, &lj->lioj_ksi); + aio_sendsig(userp, &lj->lioj_signal, &lj->lioj_ksi, + true); lj->lioj_flags |= LIOJ_SIGNAL_POSTED; } } @@ -2238,7 +2239,8 @@ kern_lio_listio(struct thread *td, int mode, struct ai LIOJ_SIGNAL_POSTED)) == LIOJ_SIGNAL && (lj->lioj_signal.sigev_notify == SIGEV_SIGNAL || lj->lioj_signal.sigev_notify == SIGEV_THREAD_ID)) { - aio_sendsig(p, &lj->lioj_signal, &lj->lioj_ksi); + aio_sendsig(p, &lj->lioj_signal, &lj->lioj_ksi, + lj->lioj_count != 1); lj->lioj_flags |= LIOJ_SIGNAL_POSTED; } } From owner-svn-src-head@freebsd.org Tue Dec 1 23:07:05 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E244E4698F3; Tue, 1 Dec 2020 23:07:05 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4ClyRF63KLz3MKv; Tue, 1 Dec 2020 23:07:05 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BE71F1D6B4; Tue, 1 Dec 2020 23:07:05 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B1N75IA035964; Tue, 1 Dec 2020 23:07:05 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B1N75j1035963; Tue, 1 Dec 2020 23:07:05 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <202012012307.0B1N75j1035963@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Tue, 1 Dec 2020 23:07:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368266 - head/stand/ficl/softwords X-SVN-Group: head X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: head/stand/ficl/softwords X-SVN-Commit-Revision: 368266 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Dec 2020 23:07:05 -0000 Author: tsoome Date: Tue Dec 1 23:07:05 2020 New Revision: 368266 URL: https://svnweb.freebsd.org/changeset/base/368266 Log: ficl: make dump a bit friendlier would be nice to have dump to output hex and ascii. Modified: head/stand/ficl/softwords/softcore.fr Modified: head/stand/ficl/softwords/softcore.fr ============================================================================== --- head/stand/ficl/softwords/softcore.fr Tue Dec 1 22:53:33 2020 (r368265) +++ head/stand/ficl/softwords/softcore.fr Tue Dec 1 23:07:05 2020 (r368266) @@ -67,6 +67,12 @@ variable span : tuck ( y x -- x y x) swap over ; : within ( test low high -- flag ) over - >r - r> u< ; +: u.r ( n +n -- ) + swap 0 <# #s #> + rot over - dup 0< if + drop else spaces + then + type space ; \ ** LOCAL EXT word set \ #if FICL_WANT_LOCALS @@ -91,12 +97,32 @@ variable span \ ** TOOLS word set... : ? ( addr -- ) @ . ; -: dump ( addr u -- ) - 0 ?do - dup c@ . 1+ - i 7 and 7 = if cr endif - loop drop -; + +Variable /dump + +: i' ( R:w R:w2 -- R:w R:w2 w ) + r> r> r> dup >r swap >r swap >r ; + +: .4 ( addr -- addr' ) + 4 0 DO -1 /dump +! /dump @ 0< + IF 3 spaces ELSE dup c@ 0 <# # # #> type space THEN + char+ LOOP ; + +: .chars ( addr -- ) + /dump @ over + swap + ?DO I c@ dup 127 bl within + IF drop [char] . THEN emit + LOOP ; + +: .line ( addr -- ) + dup .4 space .4 ." - " .4 space .4 drop 16 /dump +! space .chars ; + +: dump ( addr u -- ) \ tools dump + cr base @ >r hex \ save base on return stack + 0 ?DO I' I - 16 min /dump ! + dup 8 u.r ." : " dup .line cr 16 + + 16 +LOOP + drop r> base ! ; \ ** SEARCH+EXT words and ficl helpers \ BRAND-WORDLIST is a helper for ficl-named-wordlist. Usage idiom: From owner-svn-src-head@freebsd.org Tue Dec 1 23:25:21 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E0BB2469B5D; Tue, 1 Dec 2020 23:25:21 +0000 (UTC) (envelope-from jmg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4ClyrK5ysXz3N9V; Tue, 1 Dec 2020 23:25:21 +0000 (UTC) (envelope-from jmg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BB3E81DC39; Tue, 1 Dec 2020 23:25:21 +0000 (UTC) (envelope-from jmg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B1NPLuP047909; Tue, 1 Dec 2020 23:25:21 GMT (envelope-from jmg@FreeBSD.org) Received: (from jmg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B1NPLQi047907; Tue, 1 Dec 2020 23:25:21 GMT (envelope-from jmg@FreeBSD.org) Message-Id: <202012012325.0B1NPLQi047907@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jmg set sender to jmg@FreeBSD.org using -f From: John-Mark Gurney Date: Tue, 1 Dec 2020 23:25:21 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368267 - in head: sbin/devfs share/man/man5 X-SVN-Group: head X-SVN-Commit-Author: jmg X-SVN-Commit-Paths: in head: sbin/devfs share/man/man5 X-SVN-Commit-Revision: 368267 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Dec 2020 23:25:21 -0000 Author: jmg Date: Tue Dec 1 23:25:21 2020 New Revision: 368267 URL: https://svnweb.freebsd.org/changeset/base/368267 Log: add documentation that the rules need to be reloaded, and how to do it... MFC after: 1 week Modified: head/sbin/devfs/devfs.8 head/share/man/man5/devfs.rules.5 Modified: head/sbin/devfs/devfs.8 ============================================================================== --- head/sbin/devfs/devfs.8 Tue Dec 1 23:07:05 2020 (r368266) +++ head/sbin/devfs/devfs.8 Tue Dec 1 23:25:21 2020 (r368267) @@ -25,7 +25,7 @@ .\" .\" $FreeBSD$ .\" -.Dd October 5, 2016 +.Dd December 1, 2020 .Dt DEVFS 8 .Os .Sh NAME @@ -43,6 +43,15 @@ utility provides an interface to manipulate properties .Xr devfs 5 mounts. .Pp +The rules, by default as configured by +.Pa /etc/rc.conf , +are loaded at boot via the devfs +.Xr service 8 . +The rules can be reloaded by running the command: +.Bd -literal -offset indent +service devfs restart +.Ed +.Pp The .Ar keyword argument determines the context for @@ -374,7 +383,8 @@ this feature can be used to copy rulesets: .Xr devfs.rules 5 , .Xr chown 8 , .Xr jail 8 , -.Xr mknod 8 +.Xr mknod 8 , +.Xr service 8 .Sh HISTORY The .Nm Modified: head/share/man/man5/devfs.rules.5 ============================================================================== --- head/share/man/man5/devfs.rules.5 Tue Dec 1 23:07:05 2020 (r368266) +++ head/share/man/man5/devfs.rules.5 Tue Dec 1 23:25:21 2020 (r368267) @@ -24,7 +24,7 @@ .\" .\" $FreeBSD$ .\" -.Dd February 21, 2010 +.Dd December 1, 2020 .Dt DEVFS.RULES 5 .Os .Sh NAME @@ -81,6 +81,12 @@ file: .Bd -literal -offset indent devfs_system_ruleset="localrules" .Ed +.Pp +The rules are loaded at boot via the devfs service. +To load modified rules after the system has booted, run the command: +.Bd -literal -offset indent +service devfs restart +.Ed .Sh FILES .Bl -tag -compact -width Pa .It Pa /etc/defaults/devfs.rules @@ -122,7 +128,8 @@ group, a similar rule may be used: .Xr glob 3 , .Xr devfs 5 , .Xr devfs.conf 5 , -.Xr devfs 8 +.Xr devfs 8 , +.Xr service 8 .Sh AUTHORS This manual page was written by .An Roland Smith Aq Mt rsmith@xs4all.nl . From owner-svn-src-head@freebsd.org Tue Dec 1 23:33:11 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 54417469D76; Tue, 1 Dec 2020 23:33:11 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Clz1M1nrZz3NKF; Tue, 1 Dec 2020 23:33:11 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3081B1E017; Tue, 1 Dec 2020 23:33:11 +0000 (UTC) (envelope-from rmacklem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B1NXBKn054307; Tue, 1 Dec 2020 23:33:11 GMT (envelope-from rmacklem@FreeBSD.org) Received: (from rmacklem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B1NXBpL054306; Tue, 1 Dec 2020 23:33:11 GMT (envelope-from rmacklem@FreeBSD.org) Message-Id: <202012012333.0B1NXBpL054306@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rmacklem set sender to rmacklem@FreeBSD.org using -f From: Rick Macklem Date: Tue, 1 Dec 2020 23:33:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368268 - head/sbin/mount_nfs X-SVN-Group: head X-SVN-Commit-Author: rmacklem X-SVN-Commit-Paths: head/sbin/mount_nfs X-SVN-Commit-Revision: 368268 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Dec 2020 23:33:11 -0000 Author: rmacklem Date: Tue Dec 1 23:33:10 2020 New Revision: 368268 URL: https://svnweb.freebsd.org/changeset/base/368268 Log: Improve man page for AmazonEFS mounts. PR#250770 was actually just a misunderstanding of what NFS mount options are needed for AmazonEFS mounts. This patch attempts to clarify the manpage to clarify this. This is a content change. PR: 250770 Reviewed by: bcr MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D27430 Modified: head/sbin/mount_nfs/mount_nfs.8 Modified: head/sbin/mount_nfs/mount_nfs.8 ============================================================================== --- head/sbin/mount_nfs/mount_nfs.8 Tue Dec 1 23:25:21 2020 (r368267) +++ head/sbin/mount_nfs/mount_nfs.8 Tue Dec 1 23:33:10 2020 (r368268) @@ -28,7 +28,7 @@ .\" @(#)mount_nfs.8 8.3 (Berkeley) 3/29/95 .\" $FreeBSD$ .\" -.Dd November 20, 2020 +.Dd November 30, 2020 .Dt MOUNT_NFS 8 .Os .Sh NAME @@ -217,9 +217,18 @@ Make a minor version 1 or 2 of the NFS Version 4 proto OpenOwner for all Opens. This may be useful for a server with a very low limit on OpenOwners, such as AmazonEFS. -It ca only be used with an NFSv4.1 or NFSv4.2 mount. +This option cannot be used for an NFS Version 4, minor version 0 mount. +As such, this option requires the +.Cm minorversion +option be specified with a value of 1 for AmazonEFS, because AmazonEFS does +not support minor version 2 at this time. It may not work correctly when Delegations are being issued by a server, but note that the AmazonEFS server does not issued delegations at this time. +This option is only meaningful when used with the +.Cm nfsv4 +and +.Cm minorversion +options. .It Cm pnfs Enable support for parallel NFS (pNFS) for minor version 1 or 2 of the NFS Version 4 protocol. From owner-svn-src-head@freebsd.org Tue Dec 1 23:51:48 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BEB3A46AA49; Tue, 1 Dec 2020 23:51:48 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4ClzQr4zJ9z3PCD; Tue, 1 Dec 2020 23:51:48 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9E4091DECA; Tue, 1 Dec 2020 23:51:48 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B1NpmHV065326; Tue, 1 Dec 2020 23:51:48 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B1NpmRo065325; Tue, 1 Dec 2020 23:51:48 GMT (envelope-from kib@FreeBSD.org) Message-Id: <202012012351.0B1NpmRo065325@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Tue, 1 Dec 2020 23:51:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368269 - head/sys/cddl/dev/dtrace/i386 X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/cddl/dev/dtrace/i386 X-SVN-Commit-Revision: 368269 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 01 Dec 2020 23:51:48 -0000 Author: kib Date: Tue Dec 1 23:51:48 2020 New Revision: 368269 URL: https://svnweb.freebsd.org/changeset/base/368269 Log: Fix syntax Modified: head/sys/cddl/dev/dtrace/i386/dtrace_isa.c Modified: head/sys/cddl/dev/dtrace/i386/dtrace_isa.c ============================================================================== --- head/sys/cddl/dev/dtrace/i386/dtrace_isa.c Tue Dec 1 23:33:10 2020 (r368268) +++ head/sys/cddl/dev/dtrace/i386/dtrace_isa.c Tue Dec 1 23:51:48 2020 (r368269) @@ -74,7 +74,7 @@ dtrace_getpcstack(pc_t *pcstack, int pcstack_limit, in frame = (struct i386_frame *)ebp; while (depth < pcstack_limit) { if (!kstack_contains(curthread, (vm_offset_t)frame, - sizeof(*frame)) + sizeof(*frame))) break; callpc = frame->f_retaddr; @@ -483,7 +483,8 @@ dtrace_getstackdepth(int aframes) frame = (struct i386_frame *)ebp; depth++; for(;;) { - if (!kstack_contains((vm_offset_t)frame, sizeof(*frame)) + if (!kstack_contains(curthread, (vm_offset_t)frame, + sizeof(*frame))) break; depth++; if (frame->f_frame <= frame) From owner-svn-src-head@freebsd.org Wed Dec 2 00:48:15 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AA61046BE7B; Wed, 2 Dec 2020 00:48:15 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Cm0gz4VDgz3hHv; Wed, 2 Dec 2020 00:48:15 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 88F4D1EA6E; Wed, 2 Dec 2020 00:48:15 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B20mFf5098579; Wed, 2 Dec 2020 00:48:15 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B20mFQo098578; Wed, 2 Dec 2020 00:48:15 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202012020048.0B20mFQo098578@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Wed, 2 Dec 2020 00:48:15 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368271 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 368271 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Dec 2020 00:48:15 -0000 Author: mjg Date: Wed Dec 2 00:48:15 2020 New Revision: 368271 URL: https://svnweb.freebsd.org/changeset/base/368271 Log: select: make sure there are no wakeup attempts after selfdfree returns Prior to the patch returning selfdfree could still be racing against doselwakeup which set sf_si = NULL and now locks stp to wake up the other thread. A sufficiently unlucky pair can end up going all the way down to freeing select-related structures before the lock/wakeup/unlock finishes. This started manifesting itself as crashes since select data started getting freed in r367714. Modified: head/sys/kern/sys_generic.c Modified: head/sys/kern/sys_generic.c ============================================================================== --- head/sys/kern/sys_generic.c Wed Dec 2 00:45:35 2020 (r368270) +++ head/sys/kern/sys_generic.c Wed Dec 2 00:48:15 2020 (r368271) @@ -1820,14 +1820,17 @@ doselwakeup(struct selinfo *sip, int pri) */ TAILQ_REMOVE(&sip->si_tdlist, sfp, sf_threads); stp = sfp->sf_td; - /* - * Paired with selfdfree. - */ - atomic_store_rel_ptr((uintptr_t *)&sfp->sf_si, (uintptr_t)NULL); mtx_lock(&stp->st_mtx); stp->st_flags |= SELTD_PENDING; cv_broadcastpri(&stp->st_wait, pri); mtx_unlock(&stp->st_mtx); + /* + * Paired with selfdfree. + * + * Storing this only after the wakeup provides an invariant that + * stp is not used after selfdfree returns. + */ + atomic_store_rel_ptr((uintptr_t *)&sfp->sf_si, (uintptr_t)NULL); } mtx_unlock(sip->si_mtx); } @@ -1837,14 +1840,18 @@ seltdinit(struct thread *td) { struct seltd *stp; - if ((stp = td->td_sel) != NULL) - goto out; - td->td_sel = stp = malloc(sizeof(*stp), M_SELECT, M_WAITOK|M_ZERO); + stp = td->td_sel; + if (stp != NULL) { + MPASS(stp->st_flags == 0); + MPASS(STAILQ_EMPTY(&stp->st_selq)); + return; + } + stp = malloc(sizeof(*stp), M_SELECT, M_WAITOK|M_ZERO); mtx_init(&stp->st_mtx, "sellck", NULL, MTX_DEF); cv_init(&stp->st_wait, "select"); -out: stp->st_flags = 0; STAILQ_INIT(&stp->st_selq); + td->td_sel = stp; } static int @@ -1887,6 +1894,8 @@ seltdfini(struct thread *td) stp = td->td_sel; if (stp == NULL) return; + MPASS(stp->st_flags == 0); + MPASS(STAILQ_EMPTY(&stp->st_selq)); if (stp->st_free1) free(stp->st_free1, M_SELFD); if (stp->st_free2) From owner-svn-src-head@freebsd.org Wed Dec 2 00:48:52 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 626B746C09A; Wed, 2 Dec 2020 00:48:52 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-wm1-x330.google.com (mail-wm1-x330.google.com [IPv6:2a00:1450:4864:20::330]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Cm0hg4kVpz3hLR; Wed, 2 Dec 2020 00:48:51 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: by mail-wm1-x330.google.com with SMTP id a3so1229975wmb.5; Tue, 01 Dec 2020 16:48:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to; bh=eLrb9aoyb/Zjpc66m/L2QNsk+TuT7/eCpMQIiePFFj8=; b=XlJZycFoYp/EpQW230tP2pn92A0g6Ep4AW+YtMiHxRQaf9d12t7qPkb17FUL/QaKpK igg0ZJecjhwzgYmB6dQ1uFaa1XlQZgJpett0ndRcwe4iKxcid5nMz/UmLVlBUeEzP4lz ehyZXePfZPB/+3aleDRAM4RHA6QFCVe3ueV8OoNEas/mb9hrY3SrAAN8jLbu6TICB5y7 g3nkAurknS7R809Erwf2yMhm6jTL3vKXhv6fZ21hj1JifWudNxcCCGFz0+a3pOAeLe9N ZhHQuskQbyuU8+hBzCH0aO9OXrSUJVHETN02cfT+apRINFGEG/U/4H5MRbXvcWiv9dC9 XphA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to; bh=eLrb9aoyb/Zjpc66m/L2QNsk+TuT7/eCpMQIiePFFj8=; b=qDPChP74U6ceh32MnlJkapBNzZpiP44DmvRgCFVijXbI+QzPQY6Z9WuYkKL8CXHXph IBicDomn9gDOjpbMBT5YlUM/7D41kADIdAEFVYV20Q6ql3UbGMVK9yR4WP/lxtdUMpao QBz7Kl2OCCa21wZQK/QE5LyBciVul8CO9H7RXa0+i2AMwAiBSqGgmnGcoquh5CeOuDut e4DH4FQdvt4o/cNACQBbk50/U2VYzXy3LuuvwLrIQB+PxIezDXXwNrlG1gUncEEG3/7W mv1D0ekVwJvvegK7OTtV7qg7KiKSbmB2hkZevC4XHUaP8ozsCN/RpANYgiABqjBeVJqA 1Dyg== X-Gm-Message-State: AOAM530b4SG93xCqonidTyEybhijRSig8FgfblBNhKKcXXo5csbj9LFp aSkFLmOAqT8EJDLrftKcGTIWPKvGcuXmS7Wt4lI+Rkxl/Xw= X-Google-Smtp-Source: ABdhPJz5lOvmDTCrszLKY3w1SXqPtWnwqgF1jQ75ONxilTBjiVQgkW14AUOR1DvzS3BHosHX44J6w7Fyz2D+Ts0HDIc= X-Received: by 2002:a7b:c012:: with SMTP id c18mr274101wmb.10.1606870129819; Tue, 01 Dec 2020 16:48:49 -0800 (PST) MIME-Version: 1.0 Received: by 2002:a5d:4d47:0:0:0:0:0 with HTTP; Tue, 1 Dec 2020 16:48:49 -0800 (PST) In-Reply-To: <202012020048.0B20mFQo098578@repo.freebsd.org> References: <202012020048.0B20mFQo098578@repo.freebsd.org> From: Mateusz Guzik Date: Wed, 2 Dec 2020 01:48:49 +0100 Message-ID: Subject: Re: svn commit: r368271 - head/sys/kern To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4Cm0hg4kVpz3hLR X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=XlJZycFo; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of mjguzik@gmail.com designates 2a00:1450:4864:20::330 as permitted sender) smtp.mailfrom=mjguzik@gmail.com X-Spamd-Result: default: False [-2.00 / 15.00]; ARC_NA(0.00)[]; RBL_DBL_DONT_QUERY_IPS(0.00)[2a00:1450:4864:20::330:from]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[3]; R_SPF_ALLOW(-0.20)[+ip6:2a00:1450:4000::/36:c]; FREEMAIL_FROM(0.00)[gmail.com]; MIME_GOOD(-0.10)[text/plain]; TO_DN_NONE(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; TO_MATCH_ENVRCPT_ALL(0.00)[]; SPAMHAUS_ZRD(0.00)[2a00:1450:4864:20::330:from:127.0.2.255]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; NEURAL_SPAM_SHORT(1.00)[0.999]; DKIM_TRACE(0.00)[gmail.com:+]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; RCVD_IN_DNSWL_NONE(0.00)[2a00:1450:4864:20::330:from]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US]; RCVD_COUNT_TWO(0.00)[2]; MAILMAN_DEST(0.00)[svn-src-all,svn-src-head]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Dec 2020 00:48:52 -0000 On 12/2/20, Mateusz Guzik wrote: > Author: mjg > Date: Wed Dec 2 00:48:15 2020 > New Revision: 368271 > URL: https://svnweb.freebsd.org/changeset/base/368271 > > Log: > select: make sure there are no wakeup attempts after selfdfree returns > > Prior to the patch returning selfdfree could still be racing against > doselwakeup > which set sf_si = NULL and now locks stp to wake up the other thread. > > A sufficiently unlucky pair can end up going all the way down to freeing > select-related structures before the lock/wakeup/unlock finishes. > > This started manifesting itself as crashes since select data started > getting > freed in r367714. > Reported by: hps, mike tancsa > Modified: > head/sys/kern/sys_generic.c > > Modified: head/sys/kern/sys_generic.c > ============================================================================== > --- head/sys/kern/sys_generic.c Wed Dec 2 00:45:35 2020 (r368270) > +++ head/sys/kern/sys_generic.c Wed Dec 2 00:48:15 2020 (r368271) > @@ -1820,14 +1820,17 @@ doselwakeup(struct selinfo *sip, int pri) > */ > TAILQ_REMOVE(&sip->si_tdlist, sfp, sf_threads); > stp = sfp->sf_td; > - /* > - * Paired with selfdfree. > - */ > - atomic_store_rel_ptr((uintptr_t *)&sfp->sf_si, (uintptr_t)NULL); > mtx_lock(&stp->st_mtx); > stp->st_flags |= SELTD_PENDING; > cv_broadcastpri(&stp->st_wait, pri); > mtx_unlock(&stp->st_mtx); > + /* > + * Paired with selfdfree. > + * > + * Storing this only after the wakeup provides an invariant that > + * stp is not used after selfdfree returns. > + */ > + atomic_store_rel_ptr((uintptr_t *)&sfp->sf_si, (uintptr_t)NULL); > } > mtx_unlock(sip->si_mtx); > } > @@ -1837,14 +1840,18 @@ seltdinit(struct thread *td) > { > struct seltd *stp; > > - if ((stp = td->td_sel) != NULL) > - goto out; > - td->td_sel = stp = malloc(sizeof(*stp), M_SELECT, M_WAITOK|M_ZERO); > + stp = td->td_sel; > + if (stp != NULL) { > + MPASS(stp->st_flags == 0); > + MPASS(STAILQ_EMPTY(&stp->st_selq)); > + return; > + } > + stp = malloc(sizeof(*stp), M_SELECT, M_WAITOK|M_ZERO); > mtx_init(&stp->st_mtx, "sellck", NULL, MTX_DEF); > cv_init(&stp->st_wait, "select"); > -out: > stp->st_flags = 0; > STAILQ_INIT(&stp->st_selq); > + td->td_sel = stp; > } > > static int > @@ -1887,6 +1894,8 @@ seltdfini(struct thread *td) > stp = td->td_sel; > if (stp == NULL) > return; > + MPASS(stp->st_flags == 0); > + MPASS(STAILQ_EMPTY(&stp->st_selq)); > if (stp->st_free1) > free(stp->st_free1, M_SELFD); > if (stp->st_free2) > -- Mateusz Guzik From owner-svn-src-head@freebsd.org Wed Dec 2 00:49:31 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 4F15146C12D; Wed, 2 Dec 2020 00:49:31 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-wr1-x432.google.com (mail-wr1-x432.google.com [IPv6:2a00:1450:4864:20::432]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Cm0jR1dLMz3hhp; Wed, 2 Dec 2020 00:49:31 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: by mail-wr1-x432.google.com with SMTP id o1so115541wrx.7; Tue, 01 Dec 2020 16:49:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=365bcrOdVcv3itl2JzBhuf72DJcrYFt6jxUzpb6WB1s=; b=fUzHintDNiY6rm2N6xvSfmhwm10F/QHZl4zPZN3LOvHzinzGcWKMnBhIGs/0LwoTmK DI7Txs5ngSxRb5eBtc34OB/edO5Rszt9aDXMaoowiNMs+pWGYcUM78oiUyL6BMLQlNdX 2UHtDzy0q7ZoYXchBm3oPdH33IImS+KXQVwOlcaYDWJseKWJCPFX7h77HzZUqDkKKYCA PgKs6TmnGME5Kuk4CijtELa2OMXHzjlGdc8tML8VTZc6dCICySTSv+S0NPYwxzcXS/4X 5ItSBf5kn2iMsDATOLK+kS9QA12k4z2tyffqRYGbMVeBYOI2LAPcBRh2HtMVKTCZDbze u7pQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=365bcrOdVcv3itl2JzBhuf72DJcrYFt6jxUzpb6WB1s=; b=BK5S3Cf6bBKp6KWCecMsjsapyR7I1ve7W3j2dMFCLDhzWRcu9U2f162mvwiz+vZSRm sysPwVEHsld+3QTAJzjOH6MBk8DRzfXzrBoblU3PxTJrJ3nvDOEKaMuvgQj/QUDuaz/P 1uDSuFMwmHk2cH/YZvhfu2zUZPAnNsSYCqmITzn9heYrSZ1S1LirTrIRGq+g6wqczhYh pd3yb61ZZJXwQzcBxOom3sI+JnVsqMFpmjDwTI3eXT9/yLPlpgjl/NWS42Q/vcJlbK46 QhsD1fF5dQCnu6HnnclQfoKIh74lJ68cQEaEde35Ep5XWzas6DwvrarzGRDWFBfmp5qq iYCA== X-Gm-Message-State: AOAM5305b+kjoZVuHc+2V4607LQodjLpPUVWfUWvsmD+a/tFpvl56L3v g3rn7HX7XDFNDOFG+BJORxYU1QrHOrjV8rqT+KJ4MFzNLV8= X-Google-Smtp-Source: ABdhPJwfPxJe4EvfFedE8b2Nr12HV75NzaEmkibQNuhyhzZJS1M3O42KWzDHquXYwkKbdDhZlM27TdXVZ5+LijtocHQ= X-Received: by 2002:a5d:4d02:: with SMTP id z2mr7531579wrt.109.1606870170091; Tue, 01 Dec 2020 16:49:30 -0800 (PST) MIME-Version: 1.0 Received: by 2002:a5d:4d47:0:0:0:0:0 with HTTP; Tue, 1 Dec 2020 16:49:29 -0800 (PST) In-Reply-To: <635b7c88-0840-2183-4d94-46bdedb2fa5c@selasky.org> References: <202011160312.0AG3CLcm073334@repo.freebsd.org> <0af338b8-0696-3093-3bd9-8b3ea7207c17@selasky.org> <6c5a6c72-4ae5-c6d1-2963-f49c42c3e685@selasky.org> <635b7c88-0840-2183-4d94-46bdedb2fa5c@selasky.org> From: Mateusz Guzik Date: Wed, 2 Dec 2020 01:49:29 +0100 Message-ID: Subject: Re: svn commit: r367714 - head/sys/kern To: Hans Petter Selasky Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4Cm0jR1dLMz3hhp X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Dec 2020 00:49:31 -0000 zoo.freebsd.org crashed with what appears to be the same bug, so I went ahead and committed the fix in r368271. On 12/1/20, Hans Petter Selasky wrote: > On 12/1/20 12:26 PM, Mateusz Guzik wrote: >> Does this fix it for you?https://people.freebsd.org/~mjg/poll.diff > > Will take some time to reproduce. Testing right now. > > --HPS > -- Mateusz Guzik From owner-svn-src-head@freebsd.org Wed Dec 2 00:53:03 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9177346C1D0; Wed, 2 Dec 2020 00:53:03 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Cm0nW3k06z3jHV; Wed, 2 Dec 2020 00:53:03 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 72D5C1F022; Wed, 2 Dec 2020 00:53:03 +0000 (UTC) (envelope-from asomers@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B20r3h2004712; Wed, 2 Dec 2020 00:53:03 GMT (envelope-from asomers@FreeBSD.org) Received: (from asomers@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B20r37u004711; Wed, 2 Dec 2020 00:53:03 GMT (envelope-from asomers@FreeBSD.org) Message-Id: <202012020053.0B20r37u004711@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: asomers set sender to asomers@FreeBSD.org using -f From: Alan Somers Date: Wed, 2 Dec 2020 00:53:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368272 - head/tests/sys/aio X-SVN-Group: head X-SVN-Commit-Author: asomers X-SVN-Commit-Paths: head/tests/sys/aio X-SVN-Commit-Revision: 368272 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Dec 2020 00:53:03 -0000 Author: asomers Date: Wed Dec 2 00:53:03 2020 New Revision: 368272 URL: https://svnweb.freebsd.org/changeset/base/368272 Log: AIO tests: update expected failure messages after r368265 PR: 220398, 251515 MFC after: 1 week MFC-With: r368265 Modified: head/tests/sys/aio/lio_test.c Modified: head/tests/sys/aio/lio_test.c ============================================================================== --- head/tests/sys/aio/lio_test.c Wed Dec 2 00:48:15 2020 (r368271) +++ head/tests/sys/aio/lio_test.c Wed Dec 2 00:53:03 2020 (r368272) @@ -143,8 +143,8 @@ ATF_TC_BODY(lio_listio_empty_nowait_kevent, tc) int kq, result; void *udata = (void*)0xdeadbeefdeadbeef; - atf_tc_expect_timeout("Bug 220398 - lio_listio(2) never sends" - " asynchronous notification if nent==0"); + atf_tc_expect_timeout("Bug 251515 - lio_listio(2) never sends" + " kevent if nent==0"); kq = kqueue(); ATF_REQUIRE(kq > 0); sev.sigev_notify = SIGEV_KEVENT; @@ -168,8 +168,6 @@ ATF_TC_BODY(lio_listio_empty_nowait_signal, tc) struct aiocb *list = NULL; struct sigevent sev; - atf_tc_expect_timeout("Bug 220398 - lio_listio(2) never sends" - " asynchronous notification if nent==0"); ATF_REQUIRE_EQ(0, sem_init(&completions, false, 0)); sev.sigev_notify = SIGEV_SIGNAL; sev.sigev_signo = SIGUSR1; @@ -189,9 +187,6 @@ ATF_TC_BODY(lio_listio_empty_nowait_thread, tc) struct aiocb *list = NULL; struct sigevent sev; - atf_tc_skip("Sometimes hangs and sometimes passes"); - atf_tc_expect_timeout("Bug 220398 - lio_listio(2) never sends" - " asynchronous notification if nent==0"); ATF_REQUIRE_EQ(0, sem_init(&completions, false, 0)); bzero(&sev, sizeof(sev)); sev.sigev_notify = SIGEV_THREAD; From owner-svn-src-head@freebsd.org Wed Dec 2 08:14:56 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A8CF4474845; Wed, 2 Dec 2020 08:14:56 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CmBbN4F9Lz4Wl5; Wed, 2 Dec 2020 08:14:56 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7F87824601; Wed, 2 Dec 2020 08:14:56 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B28EuaG076802; Wed, 2 Dec 2020 08:14:56 GMT (envelope-from mmel@FreeBSD.org) Received: (from mmel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B28Euhf076801; Wed, 2 Dec 2020 08:14:56 GMT (envelope-from mmel@FreeBSD.org) Message-Id: <202012020814.0B28Euhf076801@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmel set sender to mmel@FreeBSD.org using -f From: Michal Meloun Date: Wed, 2 Dec 2020 08:14:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368273 - head/sys/arm/arm X-SVN-Group: head X-SVN-Commit-Author: mmel X-SVN-Commit-Paths: head/sys/arm/arm X-SVN-Commit-Revision: 368273 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Dec 2020 08:14:56 -0000 Author: mmel Date: Wed Dec 2 08:14:56 2020 New Revision: 368273 URL: https://svnweb.freebsd.org/changeset/base/368273 Log: Fix r368153. Wrong branch of #ifdef __ARMEB__ was deleted. Modified: head/sys/arm/arm/support.S Modified: head/sys/arm/arm/support.S ============================================================================== --- head/sys/arm/arm/support.S Wed Dec 2 00:53:03 2020 (r368272) +++ head/sys/arm/arm/support.S Wed Dec 2 08:14:56 2020 (r368273) @@ -1213,10 +1213,10 @@ ENTRY(memcpy) */ ldrh r2, [r1] /* BE:r2 = ..01 LE:r2 = ..10 */ ldrh r3, [r1, #0x02] /* LE:r3 = ..23 LE:r3 = ..32 */ - mov r1, r2, lsr #8 /* r1 = ...0 */ - strb r1, [r0] - mov r2, r2, lsl #8 /* r2 = .01. */ - orr r2, r2, r3, lsr #8 /* r2 = .012 */ + strb r2, [r0] + mov r2, r2, lsr #8 /* r2 = ...1 */ + orr r2, r2, r3, lsl #8 /* r2 = .321 */ + mov r3, r3, lsr #8 /* r3 = ...3 */ strh r2, [r0, #0x01] strb r3, [r0, #0x03] RET From owner-svn-src-head@freebsd.org Wed Dec 2 09:42:03 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5872D476432; Wed, 2 Dec 2020 09:42:03 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CmDWv26fLz4bPP; Wed, 2 Dec 2020 09:42:03 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3B6A125621; Wed, 2 Dec 2020 09:42:03 +0000 (UTC) (envelope-from tsoome@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B29g38G029864; Wed, 2 Dec 2020 09:42:03 GMT (envelope-from tsoome@FreeBSD.org) Received: (from tsoome@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B29g39q029863; Wed, 2 Dec 2020 09:42:03 GMT (envelope-from tsoome@FreeBSD.org) Message-Id: <202012020942.0B29g39q029863@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tsoome set sender to tsoome@FreeBSD.org using -f From: Toomas Soome Date: Wed, 2 Dec 2020 09:42:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368274 - head/share/vt/fonts X-SVN-Group: head X-SVN-Commit-Author: tsoome X-SVN-Commit-Paths: head/share/vt/fonts X-SVN-Commit-Revision: 368274 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Dec 2020 09:42:03 -0000 Author: tsoome Date: Wed Dec 2 09:42:02 2020 New Revision: 368274 URL: https://svnweb.freebsd.org/changeset/base/368274 Log: vt/fonts: fix typo add missing 'is'. Reported by: bcr Modified: head/share/vt/fonts/INDEX.fonts Modified: head/share/vt/fonts/INDEX.fonts ============================================================================== --- head/share/vt/fonts/INDEX.fonts Wed Dec 2 08:14:56 2020 (r368273) +++ head/share/vt/fonts/INDEX.fonts Wed Dec 2 09:42:02 2020 (r368274) @@ -13,7 +13,7 @@ # terminus-b32.fnt:de:Terminus Schriftart # terminus-b32.fnt:en:Terminus font # -# If lang empty use 'en' (us-english) as default. +# If lang is empty use 'en' (us-english) as default. # # See also setlocale(3), # /usr/share/locale, /usr/X11/lib/X11/locale/locale.alias From owner-svn-src-head@freebsd.org Wed Dec 2 15:59:09 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7C2D547E560; Wed, 2 Dec 2020 15:59:09 +0000 (UTC) (envelope-from chuck@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CmNv1340wz3DDB; Wed, 2 Dec 2020 15:59:09 +0000 (UTC) (envelope-from chuck@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5C06D1A52; Wed, 2 Dec 2020 15:59:09 +0000 (UTC) (envelope-from chuck@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B2Fx9li063684; Wed, 2 Dec 2020 15:59:09 GMT (envelope-from chuck@FreeBSD.org) Received: (from chuck@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B2Fx926063682; Wed, 2 Dec 2020 15:59:09 GMT (envelope-from chuck@FreeBSD.org) Message-Id: <202012021559.0B2Fx926063682@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: chuck set sender to chuck@FreeBSD.org using -f From: Chuck Tuffli Date: Wed, 2 Dec 2020 15:59:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368275 - head/sys/dev/nvme X-SVN-Group: head X-SVN-Commit-Author: chuck X-SVN-Commit-Paths: head/sys/dev/nvme X-SVN-Commit-Revision: 368275 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Dec 2020 15:59:09 -0000 Author: chuck Date: Wed Dec 2 15:59:08 2020 New Revision: 368275 URL: https://svnweb.freebsd.org/changeset/base/368275 Log: nvme: Fix typo in definition Change occurrences of "selt test" to "self tests in the NVMe header file. Reviewed by: imp, mav MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D27439 Modified: head/sys/dev/nvme/nvme.h head/sys/dev/nvme/nvme_qpair.c Modified: head/sys/dev/nvme/nvme.h ============================================================================== --- head/sys/dev/nvme/nvme.h Wed Dec 2 09:42:02 2020 (r368274) +++ head/sys/dev/nvme/nvme.h Wed Dec 2 15:59:08 2020 (r368275) @@ -733,7 +733,7 @@ enum nvme_command_specific_status_code { NVME_SC_NS_NOT_ATTACHED = 0x1a, NVME_SC_THIN_PROV_NOT_SUPPORTED = 0x1b, NVME_SC_CTRLR_LIST_INVALID = 0x1c, - NVME_SC_SELT_TEST_IN_PROGRESS = 0x1d, + NVME_SC_SELF_TEST_IN_PROGRESS = 0x1d, NVME_SC_BOOT_PART_WRITE_PROHIB = 0x1e, NVME_SC_INVALID_CTRLR_ID = 0x1f, NVME_SC_INVALID_SEC_CTRLR_STATE = 0x20, Modified: head/sys/dev/nvme/nvme_qpair.c ============================================================================== --- head/sys/dev/nvme/nvme_qpair.c Wed Dec 2 09:42:02 2020 (r368274) +++ head/sys/dev/nvme/nvme_qpair.c Wed Dec 2 15:59:08 2020 (r368275) @@ -269,7 +269,7 @@ static struct nvme_status_string command_specific_stat { NVME_SC_NS_NOT_ATTACHED, "NS NOT ATTACHED" }, { NVME_SC_THIN_PROV_NOT_SUPPORTED, "THIN PROVISIONING NOT SUPPORTED" }, { NVME_SC_CTRLR_LIST_INVALID, "CONTROLLER LIST INVALID" }, - { NVME_SC_SELT_TEST_IN_PROGRESS, "DEVICE SELT-TEST IN PROGRESS" }, + { NVME_SC_SELF_TEST_IN_PROGRESS, "DEVICE SELF-TEST IN PROGRESS" }, { NVME_SC_BOOT_PART_WRITE_PROHIB, "BOOT PARTITION WRITE PROHIBITED" }, { NVME_SC_INVALID_CTRLR_ID, "INVALID CONTROLLER IDENTIFIER" }, { NVME_SC_INVALID_SEC_CTRLR_STATE, "INVALID SECONDARY CONTROLLER STATE" }, From owner-svn-src-head@freebsd.org Wed Dec 2 16:01:44 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 15C9847EA8C; Wed, 2 Dec 2020 16:01:44 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CmNy007F7z3DVN; Wed, 2 Dec 2020 16:01:44 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EB8061A68; Wed, 2 Dec 2020 16:01:43 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B2G1htY067218; Wed, 2 Dec 2020 16:01:43 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B2G1h1e067217; Wed, 2 Dec 2020 16:01:43 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202012021601.0B2G1h1e067217@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 2 Dec 2020 16:01:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368276 - head/sys/netpfil/pf X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/netpfil/pf X-SVN-Commit-Revision: 368276 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Dec 2020 16:01:44 -0000 Author: markj Date: Wed Dec 2 16:01:43 2020 New Revision: 368276 URL: https://svnweb.freebsd.org/changeset/base/368276 Log: pf: Fix table entry counter toggling When updating a table, pf will keep existing table entry structures corresponding to addresses that are in both of the old and new tables. However, the update may also enable or disable per-entry counters which are allocated separately. Thus when toggling PFR_TFLAG_COUNTERS, the entries may be missing counters or may have unused counters allocated. Fix the problem by modifying pfr_ina_commit() to transfer counters from or to entries in the shadow table. PR: 251414 Reported by: sigsys@gmail.com Reviewed by: kp MFC after: 1 week Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D27440 Modified: head/sys/netpfil/pf/pf_table.c Modified: head/sys/netpfil/pf/pf_table.c ============================================================================== --- head/sys/netpfil/pf/pf_table.c Wed Dec 2 15:59:08 2020 (r368275) +++ head/sys/netpfil/pf/pf_table.c Wed Dec 2 16:01:43 2020 (r368276) @@ -1641,6 +1641,7 @@ pfr_ina_commit(struct pfr_table *trs, u_int32_t ticket static void pfr_commit_ktable(struct pfr_ktable *kt, long tzero) { + counter_u64_t *pkc, *qkc; struct pfr_ktable *shadow = kt->pfrkt_shadow; int nflags; @@ -1662,14 +1663,17 @@ pfr_commit_ktable(struct pfr_ktable *kt, long tzero) SLIST_INIT(&delq); SLIST_INIT(&garbageq); pfr_clean_node_mask(shadow, &addrq); - for (p = SLIST_FIRST(&addrq); p != NULL; p = next) { - next = SLIST_NEXT(p, pfrke_workq); /* XXX */ + SLIST_FOREACH_SAFE(p, &addrq, pfrke_workq, next) { pfr_copyout_addr(&ad, p); q = pfr_lookup_addr(kt, &ad, 1); if (q != NULL) { if (q->pfrke_not != p->pfrke_not) SLIST_INSERT_HEAD(&changeq, q, pfrke_workq); + pkc = &p->pfrke_counters.pfrkc_counters; + qkc = &q->pfrke_counters.pfrkc_counters; + if ((*pkc == NULL) != (*qkc == NULL)) + SWAP(counter_u64_t, *pkc, *qkc); q->pfrke_mark = 1; SLIST_INSERT_HEAD(&garbageq, p, pfrke_workq); } else { From owner-svn-src-head@freebsd.org Wed Dec 2 16:33:23 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CA91A47F2CA; Wed, 2 Dec 2020 16:33:23 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CmPfW5Rp7z3G5N; Wed, 2 Dec 2020 16:33:23 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id ADA162274; Wed, 2 Dec 2020 16:33:23 +0000 (UTC) (envelope-from kp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B2GXNMP088223; Wed, 2 Dec 2020 16:33:23 GMT (envelope-from kp@FreeBSD.org) Received: (from kp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B2GXNvP088222; Wed, 2 Dec 2020 16:33:23 GMT (envelope-from kp@FreeBSD.org) Message-Id: <202012021633.0B2GXNvP088222@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kp set sender to kp@FreeBSD.org using -f From: Kristof Provost Date: Wed, 2 Dec 2020 16:33:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368277 - head/tests/sys/netpfil/pf X-SVN-Group: head X-SVN-Commit-Author: kp X-SVN-Commit-Paths: head/tests/sys/netpfil/pf X-SVN-Commit-Revision: 368277 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Dec 2020 16:33:23 -0000 Author: kp Date: Wed Dec 2 16:33:23 2020 New Revision: 368277 URL: https://svnweb.freebsd.org/changeset/base/368277 Log: pf tests: Test case for bug #251414 Changing a table from not having counters to having counters (or vice versa) may trigger panics. PR: 251414 MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D27441 Modified: head/tests/sys/netpfil/pf/table.sh Modified: head/tests/sys/netpfil/pf/table.sh ============================================================================== --- head/tests/sys/netpfil/pf/table.sh Wed Dec 2 16:01:43 2020 (r368276) +++ head/tests/sys/netpfil/pf/table.sh Wed Dec 2 16:33:23 2020 (r368277) @@ -108,8 +108,47 @@ v6_counters_cleanup() pft_cleanup } +atf_test_case "pr251414" "cleanup" +pr251414_head() +{ + atf_set descr 'Test PR 251414' + atf_set require.user root +} + +pr251414_body() +{ + pft_init + + epair_send=$(vnet_mkepair) + ifconfig ${epair_send}a 192.0.2.1/24 up + + vnet_mkjail alcatraz ${epair_send}b + jexec alcatraz ifconfig ${epair_send}b 192.0.2.2/24 up + jexec alcatraz pfctl -e + + pft_set_rules alcatraz \ + "pass all" \ + "table { self }" \ + "pass in log to " + + pft_set_rules noflush alcatraz \ + "pass all" \ + "table counters { self }" \ + "pass in log to " + + atf_check -s exit:0 -o ignore ping -c 3 192.0.2.2 + + jexec alcatraz pfctl -t tab -T show -vv +} + +pr251414_cleanup() +{ + pft_cleanup +} + atf_init_test_cases() { atf_add_test_case "v4_counters" atf_add_test_case "v6_counters" + atf_add_test_case "pr251414" } From owner-svn-src-head@freebsd.org Wed Dec 2 16:46:47 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 09E0847F6C3; Wed, 2 Dec 2020 16:46:47 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CmPxy6vFyz3H0S; Wed, 2 Dec 2020 16:46:46 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DF9322AA0; Wed, 2 Dec 2020 16:46:46 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B2Gkk4a094540; Wed, 2 Dec 2020 16:46:46 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B2Gkjkn094535; Wed, 2 Dec 2020 16:46:46 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202012021646.0B2Gkjkn094535@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Wed, 2 Dec 2020 16:46:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368278 - head/usr.sbin/rtsold X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/usr.sbin/rtsold X-SVN-Commit-Revision: 368278 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Dec 2020 16:46:47 -0000 Author: markj Date: Wed Dec 2 16:46:45 2020 New Revision: 368278 URL: https://svnweb.freebsd.org/changeset/base/368278 Log: rtsold: Fix bugs reported by Coverity - Avoid leaking a socket if llflags_get() fails. - Avoid leaking a file handle if rtsold_init_dumpfile() fails. - Tighten the check in if_nametosdl() which determines whether we failed to find the specified interface. - Fix errno handling in an error path in rtsock_open(). MFC after: 1 week Modified: head/usr.sbin/rtsold/cap_llflags.c head/usr.sbin/rtsold/dump.c head/usr.sbin/rtsold/if.c head/usr.sbin/rtsold/rtsock.c Modified: head/usr.sbin/rtsold/cap_llflags.c ============================================================================== --- head/usr.sbin/rtsold/cap_llflags.c Wed Dec 2 16:33:23 2020 (r368277) +++ head/usr.sbin/rtsold/cap_llflags.c Wed Dec 2 16:46:45 2020 (r368278) @@ -72,9 +72,12 @@ llflags_get(const char *ifname, int *flagsp) if (s < 0) return (-1); - if (getifaddrs(&ifap) != 0) - return (-1); - error = -1; + ifap = NULL; + if (getifaddrs(&ifap) != 0) { + error = errno; + goto out; + } + error = ENOENT; for (ifa = ifap; ifa != NULL; ifa = ifa->ifa_next) { if (strcmp(ifa->ifa_name, ifname) != 0) continue; @@ -88,27 +91,29 @@ llflags_get(const char *ifname, int *flagsp) memset(&ifr6, 0, sizeof(ifr6)); if (strlcpy(ifr6.ifr_name, ifname, sizeof(ifr6.ifr_name)) >= sizeof(ifr6.ifr_name)) { - freeifaddrs(ifap); - errno = EINVAL; - return (-1); + error = errno; + goto out; } memcpy(&ifr6.ifr_ifru.ifru_addr, sin6, sin6->sin6_len); if (ioctl(s, SIOCGIFAFLAG_IN6, &ifr6) < 0) { error = errno; - freeifaddrs(ifap); - errno = error; - return (-1); + goto out; } *flagsp = ifr6.ifr_ifru.ifru_flags6; error = 0; break; } +out: (void)close(s); - freeifaddrs(ifap); - if (error == -1) - errno = ENOENT; - return (error); + if (ifap != NULL) + freeifaddrs(ifap); + if (error != 0) { + errno = error; + return (-1); + } else { + return (0); + } } int Modified: head/usr.sbin/rtsold/dump.c ============================================================================== --- head/usr.sbin/rtsold/dump.c Wed Dec 2 16:33:23 2020 (r368277) +++ head/usr.sbin/rtsold/dump.c Wed Dec 2 16:46:45 2020 (r368278) @@ -148,6 +148,7 @@ rtsold_init_dumpfile(const char *dumpfile) if (caph_rights_limit(fileno(fp), &rights) != 0) { warnmsg(LOG_WARNING, __func__, "caph_rights_limit(%s): %s", dumpfile, strerror(errno)); + (void)fclose(fp); return (NULL); } return (fp); Modified: head/usr.sbin/rtsold/if.c ============================================================================== --- head/usr.sbin/rtsold/if.c Wed Dec 2 16:33:23 2020 (r368277) +++ head/usr.sbin/rtsold/if.c Wed Dec 2 16:46:45 2020 (r368278) @@ -327,7 +327,7 @@ if_nametosdl(char *name) } } } - if (next == lim) { + if (next >= lim) { /* search failed */ free(buf); return (NULL); Modified: head/usr.sbin/rtsold/rtsock.c ============================================================================== --- head/usr.sbin/rtsold/rtsock.c Wed Dec 2 16:33:23 2020 (r368277) +++ head/usr.sbin/rtsold/rtsock.c Wed Dec 2 16:46:45 2020 (r368278) @@ -84,7 +84,7 @@ rtsock_open(void) if (caph_rights_limit(s, &rights) != 0) { error = errno; (void)close(s); - errno = errno; + errno = error; return (-1); } return (s); From owner-svn-src-head@freebsd.org Wed Dec 2 16:54:24 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B365147FE9E; Wed, 2 Dec 2020 16:54:24 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CmQ6m4MDzz3Hf0; Wed, 2 Dec 2020 16:54:24 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 885692A54; Wed, 2 Dec 2020 16:54:24 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B2GsOfv000764; Wed, 2 Dec 2020 16:54:24 GMT (envelope-from mmel@FreeBSD.org) Received: (from mmel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B2GsOP8000763; Wed, 2 Dec 2020 16:54:24 GMT (envelope-from mmel@FreeBSD.org) Message-Id: <202012021654.0B2GsOP8000763@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmel set sender to mmel@FreeBSD.org using -f From: Michal Meloun Date: Wed, 2 Dec 2020 16:54:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368279 - head/sys/dev/nvme X-SVN-Group: head X-SVN-Commit-Author: mmel X-SVN-Commit-Paths: head/sys/dev/nvme X-SVN-Commit-Revision: 368279 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Dec 2020 16:54:24 -0000 Author: mmel Date: Wed Dec 2 16:54:24 2020 New Revision: 368279 URL: https://svnweb.freebsd.org/changeset/base/368279 Log: NVME: Multiple busdma related fixes. - in nvme_qpair_process_completions() do dma sync before completion buffer is used. - in nvme_qpair_submit_tracker(), don't do explicit wmb() also for arm and arm64. Bus_dmamap_sync() on these architectures is sufficient to ensure that all CPU stores are visible to external (including DMA) observers. - Allocate completion buffer as BUS_DMA_COHERENT. On not-DMA coherent systems, buffers continuously owned (and accessed) by DMA must be allocated with this flag. Note that BUS_DMA_COHERENT flag is no-op on DMA coherent systems (or coherent buses in mixed systems). MFC after: 4 weeks Reviewed by: mav, imp Differential Revision: https://reviews.freebsd.org/D27446 Modified: head/sys/dev/nvme/nvme_qpair.c Modified: head/sys/dev/nvme/nvme_qpair.c ============================================================================== --- head/sys/dev/nvme/nvme_qpair.c Wed Dec 2 16:46:45 2020 (r368278) +++ head/sys/dev/nvme/nvme_qpair.c Wed Dec 2 16:54:24 2020 (r368279) @@ -547,6 +547,8 @@ nvme_qpair_process_completions(struct nvme_qpair *qpai if (!qpair->is_enabled) return (false); + bus_dmamap_sync(qpair->dma_tag, qpair->queuemem_map, + BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); /* * A panic can stop the CPU this routine is running on at any point. If * we're called during a panic, complete the sq_head wrap protocol for @@ -580,8 +582,6 @@ nvme_qpair_process_completions(struct nvme_qpair *qpai } } - bus_dmamap_sync(qpair->dma_tag, qpair->queuemem_map, - BUS_DMASYNC_POSTREAD | BUS_DMASYNC_POSTWRITE); while (1) { cpl = qpair->cpl[qpair->cq_head]; @@ -722,7 +722,7 @@ nvme_qpair_construct(struct nvme_qpair *qpair, bus_dma_tag_set_domain(qpair->dma_tag, qpair->domain); if (bus_dmamem_alloc(qpair->dma_tag, (void **)&queuemem, - BUS_DMA_NOWAIT, &qpair->queuemem_map)) { + BUS_DMA_COHERENT | BUS_DMA_NOWAIT, &qpair->queuemem_map)) { nvme_printf(ctrlr, "failed to alloc qpair memory\n"); goto out; } @@ -982,7 +982,7 @@ nvme_qpair_submit_tracker(struct nvme_qpair *qpair, st bus_dmamap_sync(qpair->dma_tag, qpair->queuemem_map, BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); -#ifndef __powerpc__ +#if !defined( __powerpc__) && !defined( __aarch64__) && !defined( __arm__) /* * powerpc's bus_dmamap_sync() already includes a heavyweight sync, but * no other archs do. From owner-svn-src-head@freebsd.org Wed Dec 2 17:09:37 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 99FF84A12DF; Wed, 2 Dec 2020 17:09:37 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CmQSK3mb2z3JXn; Wed, 2 Dec 2020 17:09:37 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro.local (ralph.baldwin.cx [66.234.199.215]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id D752226321; Wed, 2 Dec 2020 17:09:36 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: svn commit: r368263 - head/sys/cddl/dev/dtrace/amd64 To: Konstantin Belousov , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <202012012244.0B1MiOfU022498@repo.freebsd.org> From: John Baldwin Autocrypt: addr=jhb@FreeBSD.org; keydata= mQGiBETQ+XcRBADMFybiq69u+fJRy/0wzqTNS8jFfWaBTs5/OfcV7wWezVmf9sgwn8TW0Dk0 c9MBl0pz+H01dA2ZSGZ5fXlmFIsee1WEzqeJzpiwd/pejPgSzXB9ijbLHZ2/E0jhGBcVy5Yo /Tw5+U/+laeYKu2xb0XPvM0zMNls1ah5OnP9a6Ql6wCgupaoMySb7DXm2LHD1Z9jTsHcAQMD /1jzh2BoHriy/Q2s4KzzjVp/mQO5DSm2z14BvbQRcXU48oAosHA1u3Wrov6LfPY+0U1tG47X 1BGfnQH+rNAaH0livoSBQ0IPI/8WfIW7ub4qV6HYwWKVqkDkqwcpmGNDbz3gfaDht6nsie5Z pcuCcul4M9CW7Md6zzyvktjnbz61BADGDCopfZC4of0Z3Ka0u8Wik6UJOuqShBt1WcFS8ya1 oB4rc4tXfSHyMF63aPUBMxHR5DXeH+EO2edoSwViDMqWk1jTnYza51rbGY+pebLQOVOxAY7k do5Ordl3wklBPMVEPWoZ61SdbcjhHVwaC5zfiskcxj5wwXd2E9qYlBqRg7QeSm9obiBCYWxk d2luIDxqaGJARnJlZUJTRC5vcmc+iGAEExECACAFAkTQ+awCGwMGCwkIBwMCBBUCCAMEFgID AQIeAQIXgAAKCRBy3lIGd+N/BI6RAJ9S97fvbME+3hxzE3JUyUZ6vTewDACdE1stFuSfqMvM jomvZdYxIYyTUpC5Ag0ERND5ghAIAPwsO0B7BL+bz8sLlLoQktGxXwXQfS5cInvL17Dsgnr3 1AKa94j9EnXQyPEj7u0d+LmEe6CGEGDh1OcGFTMVrof2ZzkSy4+FkZwMKJpTiqeaShMh+Goj XlwIMDxyADYvBIg3eN5YdFKaPQpfgSqhT+7El7w+wSZZD8pPQuLAnie5iz9C8iKy4/cMSOrH YUK/tO+Nhw8Jjlw94Ik0T80iEhI2t+XBVjwdfjbq3HrJ0ehqdBwukyeJRYKmbn298KOFQVHO EVbHA4rF/37jzaMadK43FgJ0SAhPPF5l4l89z5oPu0b/+5e2inA3b8J3iGZxywjM+Csq1tqz hltEc7Q+E08AAwUIAL+15XH8bPbjNJdVyg2CMl10JNW2wWg2Q6qdljeaRqeR6zFus7EZTwtX sNzs5bP8y51PSUDJbeiy2RNCNKWFMndM22TZnk3GNG45nQd4OwYK0RZVrikalmJY5Q6m7Z16 4yrZgIXFdKj2t8F+x613/SJW1lIr9/bDp4U9tw0V1g3l2dFtD3p3ZrQ3hpoDtoK70ioIAjjH aIXIAcm3FGZFXy503DOA0KaTWwvOVdYCFLm3zWuSOmrX/GsEc7ovasOWwjPn878qVjbUKWwx Q4QkF4OhUV9zPtf9tDSAZ3x7QSwoKbCoRCZ/xbyTUPyQ1VvNy/mYrBcYlzHodsaqUDjHuW+I SQQYEQIACQUCRND5ggIbDAAKCRBy3lIGd+N/BCO8AJ9j1dWVQWxw/YdTbEyrRKOY8YZNwwCf afMAg8QvmOWnHx3wl8WslCaXaE8= Message-ID: <6c1aeae8-92e7-9e43-6635-65843389210b@FreeBSD.org> Date: Wed, 2 Dec 2020 09:09:35 -0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:68.0) Gecko/20100101 Thunderbird/68.6.0 MIME-Version: 1.0 In-Reply-To: <202012012244.0B1MiOfU022498@repo.freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Dec 2020 17:09:37 -0000 On 12/1/20 2:44 PM, Konstantin Belousov wrote: > Author: kib > Date: Tue Dec 1 22:44:23 2020 > New Revision: 368263 > URL: https://svnweb.freebsd.org/changeset/base/368263 > > Log: > Fix syntax Thanks, my apologies. :( I had the same bug originally on other architectures (arm64, riscv, mips) in the patch series that had functional changes and fixed those while testing the functional changes. -- John Baldwin From owner-svn-src-head@freebsd.org Wed Dec 2 17:22:30 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 885074A14F5; Wed, 2 Dec 2020 17:22:30 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CmQlB3WD7z3KFk; Wed, 2 Dec 2020 17:22:30 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 6B7FF2EC7; Wed, 2 Dec 2020 17:22:30 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B2HMUrI020438; Wed, 2 Dec 2020 17:22:30 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B2HMUOc020437; Wed, 2 Dec 2020 17:22:30 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <202012021722.0B2HMUOc020437@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 2 Dec 2020 17:22:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368280 - head/contrib/elftoolchain/addr2line X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/contrib/elftoolchain/addr2line X-SVN-Commit-Revision: 368280 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Dec 2020 17:22:30 -0000 Author: emaste Date: Wed Dec 2 17:22:29 2020 New Revision: 368280 URL: https://svnweb.freebsd.org/changeset/base/368280 Log: addr2line: rework check_range conditions Simplify logic and reduce indentation for DW_AT_low_pc case. Reviewed by: Tiger Gao, markj Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D27426 Modified: head/contrib/elftoolchain/addr2line/addr2line.c Modified: head/contrib/elftoolchain/addr2line/addr2line.c ============================================================================== --- head/contrib/elftoolchain/addr2line/addr2line.c Wed Dec 2 16:54:24 2020 (r368279) +++ head/contrib/elftoolchain/addr2line/addr2line.c Wed Dec 2 17:22:29 2020 (r368280) @@ -580,8 +580,8 @@ check_range(Dwarf_Debug dbg, Dwarf_Die die, Dwarf_Unsi ranges_cnt = 0; in_cu = false; - ret = dwarf_attrval_unsigned(die, DW_AT_ranges, &ranges_off, &de); - if (ret == DW_DLV_OK) { + if (dwarf_attrval_unsigned(die, DW_AT_ranges, &ranges_off, &de) == + DW_DLV_OK) { ret = dwarf_get_ranges(dbg, ranges_off, &ranges, &ranges_cnt, NULL, &de); if (ret != DW_DLV_OK) @@ -612,33 +612,30 @@ check_range(Dwarf_Debug dbg, Dwarf_Die die, Dwarf_Unsi break; } } - } else { - if (dwarf_attrval_unsigned(die, DW_AT_low_pc, &lopc, &de) == + } else if (dwarf_attrval_unsigned(die, DW_AT_low_pc, &lopc, &de) == + DW_DLV_OK) { + if (lopc == curlopc) + return (DW_DLV_ERROR); + if (dwarf_attrval_unsigned(die, DW_AT_high_pc, &hipc, &de) == DW_DLV_OK) { - if (lopc == curlopc) + /* + * Check if the address falls into the PC + * range of this CU. + */ + if (handle_high_pc(die, lopc, &hipc) != DW_DLV_OK) return (DW_DLV_ERROR); - if (dwarf_attrval_unsigned(die, DW_AT_high_pc, &hipc, - &de) == DW_DLV_OK) { - /* - * Check if the address falls into the PC - * range of this CU. - */ - if (handle_high_pc(die, lopc, &hipc) != - DW_DLV_OK) - return (DW_DLV_ERROR); - } else { - /* Assume ~0ULL if DW_AT_high_pc not present. */ - hipc = ~0ULL; - } - - if (addr >= lopc && addr < hipc) { - in_cu = true; - } } else { - /* Addr not in range die, try labels. */ - ret = check_labels(dbg, die, addr, range); - return ret; + /* Assume ~0ULL if DW_AT_high_pc not present. */ + hipc = ~0ULL; } + + if (addr >= lopc && addr < hipc) { + in_cu = true; + } + } else { + /* Addr not found above, try labels. */ + ret = check_labels(dbg, die, addr, range); + return ret; } if (in_cu) { From owner-svn-src-head@freebsd.org Wed Dec 2 17:37:32 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9B4514A189C; Wed, 2 Dec 2020 17:37:32 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CmR4X43vQz3LRH; Wed, 2 Dec 2020 17:37:32 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7E4FD32A8; Wed, 2 Dec 2020 17:37:32 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B2HbWYR027776; Wed, 2 Dec 2020 17:37:32 GMT (envelope-from mhorne@FreeBSD.org) Received: (from mhorne@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B2HbWJU027775; Wed, 2 Dec 2020 17:37:32 GMT (envelope-from mhorne@FreeBSD.org) Message-Id: <202012021737.0B2HbWJU027775@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mhorne set sender to mhorne@FreeBSD.org using -f From: Mitchell Horne Date: Wed, 2 Dec 2020 17:37:32 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368281 - head/sys/dev/e1000 X-SVN-Group: head X-SVN-Commit-Author: mhorne X-SVN-Commit-Paths: head/sys/dev/e1000 X-SVN-Commit-Revision: 368281 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Dec 2020 17:37:32 -0000 Author: mhorne Date: Wed Dec 2 17:37:32 2020 New Revision: 368281 URL: https://svnweb.freebsd.org/changeset/base/368281 Log: em: fix a null de-reference in em_free_pci_resources A failure in iflib_device_register() can result in em_free_pci_resources() being called after receive queues have already been freed. In particular, a failure to allocate IRQ resources will goto fail_queues, where IFDI_QUEUES_FREE() will be called via iflib_tx_structures_free(), preceding the call to IFDI_DETACH(). Cope with this by checking adapter->rx_queues before dereferencing it. A similar check is present in ixgbe(4) and ixl(4). MFC after: 1 week Sponsored by: NetApp, Inc. Sponsored by: Klara, Inc. Differential Revision: https://reviews.freebsd.org/D27260 Modified: head/sys/dev/e1000/if_em.c Modified: head/sys/dev/e1000/if_em.c ============================================================================== --- head/sys/dev/e1000/if_em.c Wed Dec 2 17:22:29 2020 (r368280) +++ head/sys/dev/e1000/if_em.c Wed Dec 2 17:37:32 2020 (r368281) @@ -2234,8 +2234,10 @@ em_free_pci_resources(if_ctx_t ctx) if (adapter->intr_type == IFLIB_INTR_MSIX) iflib_irq_free(ctx, &adapter->irq); - for (int i = 0; i < adapter->rx_num_queues; i++, que++) { - iflib_irq_free(ctx, &que->que_irq); + if (que != NULL) { + for (int i = 0; i < adapter->rx_num_queues; i++, que++) { + iflib_irq_free(ctx, &que->que_irq); + } } if (adapter->memory != NULL) { From owner-svn-src-head@freebsd.org Wed Dec 2 17:48:28 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A48294A2040; Wed, 2 Dec 2020 17:48:28 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4CmRK824LGz3M6S; Wed, 2 Dec 2020 17:48:27 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.16.1/8.16.1) with ESMTPS id 0B2HmKsi000870 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Wed, 2 Dec 2020 19:48:23 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 0B2HmKsi000870 Received: (from kostik@localhost) by tom.home (8.16.1/8.16.1/Submit) id 0B2HmK3d000869; Wed, 2 Dec 2020 19:48:20 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 2 Dec 2020 19:48:20 +0200 From: Konstantin Belousov To: Michal Meloun Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r368279 - head/sys/dev/nvme Message-ID: References: <202012021654.0B2GsOP8000763@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <202012021654.0B2GsOP8000763@repo.freebsd.org> X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on tom.home X-Rspamd-Queue-Id: 4CmRK824LGz3M6S X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Dec 2020 17:48:28 -0000 On Wed, Dec 02, 2020 at 04:54:24PM +0000, Michal Meloun wrote: > Author: mmel > Date: Wed Dec 2 16:54:24 2020 > New Revision: 368279 > URL: https://svnweb.freebsd.org/changeset/base/368279 > > Log: > NVME: Multiple busdma related fixes. ... > - in nvme_qpair_submit_tracker(), don't do explicit wmb() also for arm > and arm64. Bus_dmamap_sync() on these architectures is sufficient to ensure > that all CPU stores are visible to external (including DMA) observers. > @@ -982,7 +982,7 @@ nvme_qpair_submit_tracker(struct nvme_qpair *qpair, st > > bus_dmamap_sync(qpair->dma_tag, qpair->queuemem_map, > BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); > -#ifndef __powerpc__ > +#if !defined( __powerpc__) && !defined( __aarch64__) && !defined( __arm__) > /* > * powerpc's bus_dmamap_sync() already includes a heavyweight sync, but > * no other archs do. Does anybody have any evidence that the wmb() below is useful ? For instance, on x86, does nvme driver use any write-combining mappings ? From owner-svn-src-head@freebsd.org Wed Dec 2 18:02:07 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B5A644A283A; Wed, 2 Dec 2020 18:02:07 +0000 (UTC) (envelope-from glebius@freebsd.org) Received: from cell.glebi.us (glebi.us [162.251.186.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "cell.glebi.us", Issuer "cell.glebi.us" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CmRcv27nPz3NDT; Wed, 2 Dec 2020 18:02:06 +0000 (UTC) (envelope-from glebius@freebsd.org) Received: from cell.glebi.us (localhost [127.0.0.1]) by cell.glebi.us (8.16.1/8.16.1) with ESMTPS id 0B2I1xf2081878 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Wed, 2 Dec 2020 10:01:59 -0800 (PST) (envelope-from glebius@freebsd.org) Received: (from glebius@localhost) by cell.glebi.us (8.16.1/8.16.1/Submit) id 0B2I1xwJ081877; Wed, 2 Dec 2020 10:01:59 -0800 (PST) (envelope-from glebius@freebsd.org) X-Authentication-Warning: cell.glebi.us: glebius set sender to glebius@freebsd.org using -f Date: Wed, 2 Dec 2020 10:01:59 -0800 From: Gleb Smirnoff To: Kyle Evans Cc: src-committers , svn-src-all , svn-src-head Subject: Re: svn commit: r368197 - head/sbin/bectl Message-ID: <20201202180159.GC69850@FreeBSD.org> References: <202011302105.0AUL5VHd035423@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: 4CmRcv27nPz3NDT X-Spamd-Bar: / Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [0.00 / 15.00]; ASN(0.00)[asn:27348, ipnet:162.251.186.0/24, country:US]; local_wl_from(0.00)[freebsd.org] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Dec 2020 18:02:07 -0000 Kyle, On Mon, Nov 30, 2020 at 08:28:58PM -0600, Kyle Evans wrote: K> > Log: K> > Print at least something when failing. K> > K> > Modified: K> > head/sbin/bectl/bectl.c K> > K> > Modified: head/sbin/bectl/bectl.c K> > ============================================================================== K> > --- head/sbin/bectl/bectl.c Mon Nov 30 20:58:42 2020 (r368196) K> > +++ head/sbin/bectl/bectl.c Mon Nov 30 21:05:31 2020 (r368197) K> > @@ -584,8 +584,11 @@ main(int argc, char *argv[]) K> > return (usage(false)); K> > } K> > K> > - if ((be = libbe_init(root)) == NULL) K> > + if ((be = libbe_init(root)) == NULL) { K> > + fprintf(stderr, "libbe_init(\"%s\") failed.\n", K> > + root != NULL ? root : ""); K> > return (-1); K> > + } K> > K> > libbe_print_on_error(be, !cmd->silent); K> > K> K> This should be gated on !cmd->silent, because some paths have K> consumers that are specifically designed to not have to deal with K> redirecting stderr. It was quite intentional that this didn't K> previously print anything. AFAIK, the only command that has cmd->silent is "check". I can't agree that it should suppress stderr in case of libbe_init() failure. Failure of the library is something different to failed check of current system. It is permanent failure, meaning that command is being with incorrect root argument or ZFS is missing at all. Pretty much the same as using bectl with incorrect arguments or options. -- Gleb Smirnoff From owner-svn-src-head@freebsd.org Wed Dec 2 18:08:57 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E11214A285D; Wed, 2 Dec 2020 18:08:57 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CmRmn62mHz3Nd2; Wed, 2 Dec 2020 18:08:57 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from mail-qk1-f180.google.com (mail-qk1-f180.google.com [209.85.222.180]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) (Authenticated sender: kevans) by smtp.freebsd.org (Postfix) with ESMTPSA id BC9B826C77; Wed, 2 Dec 2020 18:08:57 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: by mail-qk1-f180.google.com with SMTP id h20so2123536qkk.4; Wed, 02 Dec 2020 10:08:57 -0800 (PST) X-Gm-Message-State: AOAM530bS91lHiMpvwcjVp5AWKN73SsWPWX3wF3Di8tbeopie70cclCE dDEh7xMYre8hcPhvhtxpzEm21h05wTU6770h8Qk= X-Google-Smtp-Source: ABdhPJw4O3kSHT5RqdjHQuaYDY41B2dI4jTP4W01UHf8WwoligPYE5LLP2yWWrUKTcW1+NjClso1sGmsXfKBjzU1ofw= X-Received: by 2002:a37:ef05:: with SMTP id j5mr3885128qkk.120.1606932537353; Wed, 02 Dec 2020 10:08:57 -0800 (PST) MIME-Version: 1.0 References: <202011302105.0AUL5VHd035423@repo.freebsd.org> <20201202180159.GC69850@FreeBSD.org> In-Reply-To: <20201202180159.GC69850@FreeBSD.org> From: Kyle Evans Date: Wed, 2 Dec 2020 12:08:43 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r368197 - head/sbin/bectl To: Gleb Smirnoff Cc: src-committers , svn-src-all , svn-src-head Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Dec 2020 18:08:57 -0000 On Wed, Dec 2, 2020 at 12:02 PM Gleb Smirnoff wrote: > > Kyle, > > On Mon, Nov 30, 2020 at 08:28:58PM -0600, Kyle Evans wrote: > K> > Log: > K> > Print at least something when failing. > K> > > K> > Modified: > K> > head/sbin/bectl/bectl.c > K> > > K> > Modified: head/sbin/bectl/bectl.c > K> > ============================================================================== > K> > --- head/sbin/bectl/bectl.c Mon Nov 30 20:58:42 2020 (r368196) > K> > +++ head/sbin/bectl/bectl.c Mon Nov 30 21:05:31 2020 (r368197) > K> > @@ -584,8 +584,11 @@ main(int argc, char *argv[]) > K> > return (usage(false)); > K> > } > K> > > K> > - if ((be = libbe_init(root)) == NULL) > K> > + if ((be = libbe_init(root)) == NULL) { > K> > + fprintf(stderr, "libbe_init(\"%s\") failed.\n", > K> > + root != NULL ? root : ""); > K> > return (-1); > K> > + } > K> > > K> > libbe_print_on_error(be, !cmd->silent); > K> > > K> > K> This should be gated on !cmd->silent, because some paths have > K> consumers that are specifically designed to not have to deal with > K> redirecting stderr. It was quite intentional that this didn't > K> previously print anything. > > AFAIK, the only command that has cmd->silent is "check". > > I can't agree that it should suppress stderr in case of libbe_init() > failure. Failure of the library is something different to failed > check of current system. It is permanent failure, meaning that command > is being with incorrect root argument or ZFS is missing at all. Pretty > much the same as using bectl with incorrect arguments or options. > Hi, The sole purpose of `bectl check` is to weed out if bectl will work (i.e. if libbe_init succeeds) so that scripts like freebsd-update can determine if they're running on a system or with a root (`bectl -r`) that can work with boot environments. It is not meant to give diagnostics like that upon failure, its sole purpose is to know if your script should proceed with doing bectl-y things safely or if it will just be fraught with peril. Thanks, Kyle Evans From owner-svn-src-head@freebsd.org Wed Dec 2 18:17:13 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EF8CA4A2F88 for ; Wed, 2 Dec 2020 18:17:13 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qt1-x82f.google.com (mail-qt1-x82f.google.com [IPv6:2607:f8b0:4864:20::82f]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CmRyK65LCz3Nyl for ; Wed, 2 Dec 2020 18:17:13 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qt1-x82f.google.com with SMTP id d5so1753167qtn.0 for ; Wed, 02 Dec 2020 10:17:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=84bjTcQi703HDGyahN5yQo/rZX9soJ6RN7KfYUc/KEs=; b=l1a0Oqw+tkP5D9IBr6Ec0Kle35AL8ZryGv+pZaxnZtnfoUaDt5X3FBN5hCQACXOL+H NR07wE0zbMHNg4xnJod8dcvizNWZBCppd2DMf1T6iYFs6EmXBUhjBNCsmllRJfsUdFTP 2g5zi4192bv3Hoct4ZrOVeqViGInZQGV4LapYu3u8sdG3H1cKchLKvyCBba5BAY5hEqj GILxQreZW/lOPicM/j1m1rumd98gUUyevdJ2ftsBzs5cPhTGu2QwHwPI4V+MSDbznwtL kg9ddkASDrFVRaMOMDjsRJdt1Vn16pinvtycl7EEZGEEzCHGpUfIeZgURrFSw0vhSxMR 5ocA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=84bjTcQi703HDGyahN5yQo/rZX9soJ6RN7KfYUc/KEs=; b=XGU9WBdTkt5Z/h5WpArm66+khWqPih+00Ho3cAD1CxmigiwOXpxGxlNcArcyMImjt1 VPQypUqt5M2v1K+Q+Mswt8n0+zToqy2rXzu357/MFee6uzUILKWObq9NUpO9BUNLFvAC n7pxRUuHxUvqaDT7Z3EMgywxXnH9V/yBPXIBmGFy1oQupGnlzc6H4EdQVQvAosUYBXb+ pmbCHJi1iECFRZqWUbNEVdHRMUtdzU4CqxVtg9tLCP5qpgbf1wRY23IQb+5EtMzCc58S NPhZJTW7DK8uWNa1Cyo2Q8I7Lu7HAKyqYcLYiwQ3Db5WhsLma3efYe6RS6Pe8aUMftO9 BNjA== X-Gm-Message-State: AOAM5334XHo9TNipk50bWhZEzcsj4nPZ/7oC7C8lxxOPBv+6se8ov7gE FQ7oMKgSonXxfHFdeeE4u6IiV9npIoezhhSmZfXdCQ== X-Google-Smtp-Source: ABdhPJy/z+MwVcCUALIkj55mGoUz8FpfvgaR3A0hopdcfI9HrjzUVIYFlfmshgDY1oJIeSJY3hFOtrM9aD3xE0RJUpw= X-Received: by 2002:ac8:4802:: with SMTP id g2mr3769071qtq.235.1606933032871; Wed, 02 Dec 2020 10:17:12 -0800 (PST) MIME-Version: 1.0 References: <202012021654.0B2GsOP8000763@repo.freebsd.org> In-Reply-To: From: Warner Losh Date: Wed, 2 Dec 2020 11:17:01 -0700 Message-ID: Subject: Re: svn commit: r368279 - head/sys/dev/nvme To: Konstantin Belousov Cc: Michal Meloun , src-committers , svn-src-all , svn-src-head X-Rspamd-Queue-Id: 4CmRyK65LCz3Nyl X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Dec 2020 18:17:14 -0000 On Wed, Dec 2, 2020 at 10:48 AM Konstantin Belousov wrote: > On Wed, Dec 02, 2020 at 04:54:24PM +0000, Michal Meloun wrote: > > Author: mmel > > Date: Wed Dec 2 16:54:24 2020 > > New Revision: 368279 > > URL: https://svnweb.freebsd.org/changeset/base/368279 > > > > Log: > > NVME: Multiple busdma related fixes. > ... > > > - in nvme_qpair_submit_tracker(), don't do explicit wmb() also for arm > > and arm64. Bus_dmamap_sync() on these architectures is sufficient to > ensure > > that all CPU stores are visible to external (including DMA) > observers. > > @@ -982,7 +982,7 @@ nvme_qpair_submit_tracker(struct nvme_qpair *qpair, > st > > > > bus_dmamap_sync(qpair->dma_tag, qpair->queuemem_map, > > BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); > > -#ifndef __powerpc__ > > +#if !defined( __powerpc__) && !defined( __aarch64__) && !defined( > __arm__) > > /* > > * powerpc's bus_dmamap_sync() already includes a heavyweight > sync, but > > * no other archs do. > Does anybody have any evidence that the wmb() below is useful ? > For instance, on x86, does nvme driver use any write-combining mappings ? > It translates to a sfence on x86. It is done just before the write that moves the tail pointer. sfence ensures that all writes are done before that write is done. I believe that the nvme spec requires that the entire submission queue entry be fully filled out before the write to the tailq pointer moving it.[*] I'm not enough of an expert on the exact details here to know if it's absolutely required or not, but given the ordering requirements in the spec, the intent appears to be related to enforcing that ordering. I don't know enough to know if it accomplishes this goal or not. Warner [*] I know I said in the review it may be due to getting lower latency to the device, but I now believe that to be mistaken after studying it further. From owner-svn-src-head@freebsd.org Wed Dec 2 19:12:46 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CE8F74A42BE; Wed, 2 Dec 2020 19:12:46 +0000 (UTC) (envelope-from glebius@freebsd.org) Received: from cell.glebi.us (glebi.us [162.251.186.162]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "cell.glebi.us", Issuer "cell.glebi.us" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CmTBQ3Vk1z3hXk; Wed, 2 Dec 2020 19:12:45 +0000 (UTC) (envelope-from glebius@freebsd.org) Received: from cell.glebi.us (localhost [127.0.0.1]) by cell.glebi.us (8.16.1/8.16.1) with ESMTPS id 0B2JChNa082225 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Wed, 2 Dec 2020 11:12:43 -0800 (PST) (envelope-from glebius@freebsd.org) Received: (from glebius@localhost) by cell.glebi.us (8.16.1/8.16.1/Submit) id 0B2JChlI082224; Wed, 2 Dec 2020 11:12:43 -0800 (PST) (envelope-from glebius@freebsd.org) X-Authentication-Warning: cell.glebi.us: glebius set sender to glebius@freebsd.org using -f Date: Wed, 2 Dec 2020 11:12:43 -0800 From: Gleb Smirnoff To: Kyle Evans Cc: src-committers , svn-src-all , svn-src-head Subject: Re: svn commit: r368197 - head/sbin/bectl Message-ID: <20201202191243.GF69850@FreeBSD.org> References: <202011302105.0AUL5VHd035423@repo.freebsd.org> <20201202180159.GC69850@FreeBSD.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Rspamd-Queue-Id: 4CmTBQ3Vk1z3hXk X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Dec 2020 19:12:46 -0000 Kyle, On Wed, Dec 02, 2020 at 12:08:43PM -0600, Kyle Evans wrote: K> > K> This should be gated on !cmd->silent, because some paths have K> > K> consumers that are specifically designed to not have to deal with K> > K> redirecting stderr. It was quite intentional that this didn't K> > K> previously print anything. K> > K> > AFAIK, the only command that has cmd->silent is "check". K> > K> > I can't agree that it should suppress stderr in case of libbe_init() K> > failure. Failure of the library is something different to failed K> > check of current system. It is permanent failure, meaning that command K> > is being with incorrect root argument or ZFS is missing at all. Pretty K> > much the same as using bectl with incorrect arguments or options. K> > K> K> The sole purpose of `bectl check` is to weed out if bectl will work K> (i.e. if libbe_init succeeds) so that scripts like freebsd-update can K> determine if they're running on a system or with a root (`bectl -r`) K> that can work with boot environments. It is not meant to give K> diagnostics like that upon failure, its sole purpose is to know if K> your script should proceed with doing bectl-y things safely or if it K> will just be fraught with peril. Understood. Sorry for my mistake. Is this patch a correct one? Index: bectl.c =================================================================== --- bectl.c (revision 368197) +++ bectl.c (working copy) @@ -585,8 +585,9 @@ main(int argc, char *argv[]) } if ((be = libbe_init(root)) == NULL) { - fprintf(stderr, "libbe_init(\"%s\") failed.\n", - root != NULL ? root : ""); + if (!cmd->silent) + fprintf(stderr, "libbe_init(\"%s\") failed.\n", + root != NULL ? root : ""); return (-1); } -- Gleb Smirnoff From owner-svn-src-head@freebsd.org Wed Dec 2 19:14:30 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 96AF04A4179; Wed, 2 Dec 2020 19:14:30 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CmTDQ3qCRz3hb1; Wed, 2 Dec 2020 19:14:30 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from mail-qk1-f175.google.com (mail-qk1-f175.google.com [209.85.222.175]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) (Authenticated sender: kevans) by smtp.freebsd.org (Postfix) with ESMTPSA id 7074E27122; Wed, 2 Dec 2020 19:14:30 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: by mail-qk1-f175.google.com with SMTP id i199so2339300qke.5; Wed, 02 Dec 2020 11:14:30 -0800 (PST) X-Gm-Message-State: AOAM5338Y0XdjlwCeic1p262qQsTE4rCfgGQHv0JNU5lS1C40UbkIvs2 9J0rXho1n+bL9bZq1qEy2ICkvYvjoqmMzZQ2BRk= X-Google-Smtp-Source: ABdhPJyxnfPV+aRPWfjrOlMAN1XlMF7PRy8G6GnpYkZl66FXe/NEK0YpIokCes0O0HqwEmstnSQyhZkEiQrSuyAODtI= X-Received: by 2002:a05:620a:12ea:: with SMTP id f10mr4254343qkl.430.1606936469530; Wed, 02 Dec 2020 11:14:29 -0800 (PST) MIME-Version: 1.0 References: <202011302105.0AUL5VHd035423@repo.freebsd.org> <20201202180159.GC69850@FreeBSD.org> <20201202191243.GF69850@FreeBSD.org> In-Reply-To: <20201202191243.GF69850@FreeBSD.org> From: Kyle Evans Date: Wed, 2 Dec 2020 13:14:16 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r368197 - head/sbin/bectl To: Gleb Smirnoff Cc: src-committers , svn-src-all , svn-src-head Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Dec 2020 19:14:30 -0000 On Wed, Dec 2, 2020 at 1:12 PM Gleb Smirnoff wrote: > > Kyle, > > On Wed, Dec 02, 2020 at 12:08:43PM -0600, Kyle Evans wrote: > K> > K> This should be gated on !cmd->silent, because some paths have > K> > K> consumers that are specifically designed to not have to deal with > K> > K> redirecting stderr. It was quite intentional that this didn't > K> > K> previously print anything. > K> > > K> > AFAIK, the only command that has cmd->silent is "check". > K> > > K> > I can't agree that it should suppress stderr in case of libbe_init() > K> > failure. Failure of the library is something different to failed > K> > check of current system. It is permanent failure, meaning that command > K> > is being with incorrect root argument or ZFS is missing at all. Pretty > K> > much the same as using bectl with incorrect arguments or options. > K> > > K> > K> The sole purpose of `bectl check` is to weed out if bectl will work > K> (i.e. if libbe_init succeeds) so that scripts like freebsd-update can > K> determine if they're running on a system or with a root (`bectl -r`) > K> that can work with boot environments. It is not meant to give > K> diagnostics like that upon failure, its sole purpose is to know if > K> your script should proceed with doing bectl-y things safely or if it > K> will just be fraught with peril. > > Understood. Sorry for my mistake. Is this patch a correct one? > > Index: bectl.c > =================================================================== > --- bectl.c (revision 368197) > +++ bectl.c (working copy) > @@ -585,8 +585,9 @@ main(int argc, char *argv[]) > } > > if ((be = libbe_init(root)) == NULL) { > - fprintf(stderr, "libbe_init(\"%s\") failed.\n", > - root != NULL ? root : ""); > + if (!cmd->silent) > + fprintf(stderr, "libbe_init(\"%s\") failed.\n", > + root != NULL ? root : ""); > return (-1); > } > Yup, looks good to me! Thanks! :-) From owner-svn-src-head@freebsd.org Wed Dec 2 19:21:39 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B53B14A455A; Wed, 2 Dec 2020 19:21:39 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4CmTNg3ZpBz3j5G; Wed, 2 Dec 2020 19:21:39 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.16.1/8.16.1) with ESMTPS id 0B2JLTvq023258 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Wed, 2 Dec 2020 21:21:33 +0200 (EET) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua 0B2JLTvq023258 Received: (from kostik@localhost) by tom.home (8.16.1/8.16.1/Submit) id 0B2JLTFN023257; Wed, 2 Dec 2020 21:21:29 +0200 (EET) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Wed, 2 Dec 2020 21:21:29 +0200 From: Konstantin Belousov To: Warner Losh Cc: Michal Meloun , src-committers , svn-src-all , svn-src-head Subject: Re: svn commit: r368279 - head/sys/dev/nvme Message-ID: References: <202012021654.0B2GsOP8000763@repo.freebsd.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FORGED_GMAIL_RCVD,FREEMAIL_FROM, NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.4 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on tom.home X-Rspamd-Queue-Id: 4CmTNg3ZpBz3j5G X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Dec 2020 19:21:39 -0000 On Wed, Dec 02, 2020 at 11:17:01AM -0700, Warner Losh wrote: > On Wed, Dec 2, 2020 at 10:48 AM Konstantin Belousov > wrote: > > > On Wed, Dec 02, 2020 at 04:54:24PM +0000, Michal Meloun wrote: > > > Author: mmel > > > Date: Wed Dec 2 16:54:24 2020 > > > New Revision: 368279 > > > URL: https://svnweb.freebsd.org/changeset/base/368279 > > > > > > Log: > > > NVME: Multiple busdma related fixes. > > ... > > > > > - in nvme_qpair_submit_tracker(), don't do explicit wmb() also for arm > > > and arm64. Bus_dmamap_sync() on these architectures is sufficient to > > ensure > > > that all CPU stores are visible to external (including DMA) > > observers. > > > @@ -982,7 +982,7 @@ nvme_qpair_submit_tracker(struct nvme_qpair *qpair, > > st > > > > > > bus_dmamap_sync(qpair->dma_tag, qpair->queuemem_map, > > > BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); > > > -#ifndef __powerpc__ > > > +#if !defined( __powerpc__) && !defined( __aarch64__) && !defined( > > __arm__) > > > /* > > > * powerpc's bus_dmamap_sync() already includes a heavyweight > > sync, but > > > * no other archs do. > > Does anybody have any evidence that the wmb() below is useful ? > > For instance, on x86, does nvme driver use any write-combining mappings ? > > > > It translates to a sfence on x86. It is done just before the write > that moves the tail pointer. sfence ensures that all writes are done before > that write is done. I believe that the nvme spec requires that the entire > submission queue entry be fully filled out before the write to the tailq > pointer moving it.[*] Right, and SFENCE is mostly a slow NOP, except situations where we deal with write-combining memory, or some specific instructions (CLFLUSHOPT etc). More, IN/OUT and uncached memory accesses, like BAR io, provide strongest serialization. > > I'm not enough of an expert on the exact details here to know if it's > absolutely required or not, but given the ordering requirements in the > spec, the intent appears to be related to enforcing that ordering. I don't > know enough to know if it accomplishes this goal or not. My point is that, unless there are some additional reasons, and not just the need to order writes, SFENCE is not needed and probably somewhat slows down the driver. It might be even measurable for NVMe that takes several millions of iops/sec. > > Warner > > [*] I know I said in the review it may be due to getting lower latency to > the device, but I now believe that to be mistaken after studying it further. From owner-svn-src-head@freebsd.org Wed Dec 2 19:58:51 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2DDF14A5382; Wed, 2 Dec 2020 19:58:51 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CmVCb0sPcz3knG; Wed, 2 Dec 2020 19:58:51 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1029050C1; Wed, 2 Dec 2020 19:58:51 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B2Jwo5Y015697; Wed, 2 Dec 2020 19:58:50 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B2JwoZx015695; Wed, 2 Dec 2020 19:58:50 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <202012021958.0B2JwoZx015695@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Wed, 2 Dec 2020 19:58:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368282 - head/usr.sbin/crashinfo X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/usr.sbin/crashinfo X-SVN-Commit-Revision: 368282 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Dec 2020 19:58:51 -0000 Author: emaste Date: Wed Dec 2 19:58:50 2020 New Revision: 368282 URL: https://svnweb.freebsd.org/changeset/base/368282 Log: crashinfo: Add references to the gdb port/package We intend to remove the obsolete GDB 6.1.1 from FreeBSD before FreeBSD 13. Reviewed by jhb Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D27447 Modified: head/usr.sbin/crashinfo/crashinfo.8 head/usr.sbin/crashinfo/crashinfo.sh Modified: head/usr.sbin/crashinfo/crashinfo.8 ============================================================================== --- head/usr.sbin/crashinfo/crashinfo.8 Wed Dec 2 17:37:32 2020 (r368281) +++ head/usr.sbin/crashinfo/crashinfo.8 Wed Dec 2 19:58:50 2020 (r368282) @@ -27,7 +27,7 @@ .\" .\" $FreeBSD$ .\" -.Dd April 19, 2017 +.Dd December 2, 2020 .Dt CRASHINFO 8 .Os .Sh NAME @@ -85,6 +85,7 @@ it uses several utilities to analyze the core includin .Xr pstat 8 , and .Xr vmstat 8 . +Note that kgdb must be installed from the devel/gdb port or gdb package. .Pp The options are as follows: .Bl -tag -width indent Modified: head/usr.sbin/crashinfo/crashinfo.sh ============================================================================== --- head/usr.sbin/crashinfo/crashinfo.sh Wed Dec 2 17:37:32 2020 (r368281) +++ head/usr.sbin/crashinfo/crashinfo.sh Wed Dec 2 19:58:50 2020 (r368282) @@ -177,6 +177,7 @@ fi find_gdb if [ -z "$GDB" ]; then echo "Unable to find a kernel debugger." + echo "Please install the devel/gdb port or gdb package." exit 1 fi From owner-svn-src-head@freebsd.org Wed Dec 2 20:54:03 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id ED17F4A6034; Wed, 2 Dec 2020 20:54:03 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CmWRH6PH7z3nFV; Wed, 2 Dec 2020 20:54:03 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CE8A85A48; Wed, 2 Dec 2020 20:54:03 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B2Ks31A056377; Wed, 2 Dec 2020 20:54:03 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B2Ks3Uj056375; Wed, 2 Dec 2020 20:54:03 GMT (envelope-from np@FreeBSD.org) Message-Id: <202012022054.0B2Ks3Uj056375@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Wed, 2 Dec 2020 20:54:03 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368283 - head/sys/dev/cxgbe X-SVN-Group: head X-SVN-Commit-Author: np X-SVN-Commit-Paths: head/sys/dev/cxgbe X-SVN-Commit-Revision: 368283 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Dec 2020 20:54:04 -0000 Author: np Date: Wed Dec 2 20:54:03 2020 New Revision: 368283 URL: https://svnweb.freebsd.org/changeset/base/368283 Log: cxgbe(4): Revert r367917. r367917 fixed the backpressure on the netmap rxq being stopped but that doesn't help if some other netmap rxq is starved (because it is stopping too although the driver doesn't know this yet) and blocks the pipeline. An alternate fix that works in all cases will be checked in instead. Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/adapter.h head/sys/dev/cxgbe/t4_netmap.c Modified: head/sys/dev/cxgbe/adapter.h ============================================================================== --- head/sys/dev/cxgbe/adapter.h Wed Dec 2 19:58:50 2020 (r368282) +++ head/sys/dev/cxgbe/adapter.h Wed Dec 2 20:54:03 2020 (r368283) @@ -749,9 +749,6 @@ struct sge_nm_rxq { bus_dma_tag_t fl_desc_tag; bus_dmamap_t fl_desc_map; bus_addr_t fl_ba; - - void *bb; /* bit bucket for packets with nowhere to go. */ - uma_zone_t bb_zone; }; #define INVALID_NM_TXQ_CNTXT_ID ((u_int)(-1)) Modified: head/sys/dev/cxgbe/t4_netmap.c ============================================================================== --- head/sys/dev/cxgbe/t4_netmap.c Wed Dec 2 19:58:50 2020 (r368282) +++ head/sys/dev/cxgbe/t4_netmap.c Wed Dec 2 20:54:03 2020 (r368283) @@ -42,8 +42,6 @@ __FBSDID("$FreeBSD$"); #include #include #include -#include -#include #include #include #include @@ -588,8 +586,6 @@ cxgbe_netmap_on(struct adapter *sc, struct vi_info *vi alloc_nm_rxq_hwq(vi, nm_rxq, tnl_cong(vi->pi, nm_cong_drop)); nm_rxq->fl_hwidx = hwidx; - nm_rxq->bb_zone = rxb->zone; - nm_rxq->bb = uma_zalloc(nm_rxq->bb_zone, M_WAITOK); slot = netmap_reset(na, NR_RX, i, 0); MPASS(slot != NULL); /* XXXNM: error check, not assert */ @@ -632,31 +628,6 @@ cxgbe_netmap_on(struct adapter *sc, struct vi_info *vi return (cxgbe_netmap_rss(sc, vi, ifp, na)); } -static void -flush_nm_rxq(struct adapter *sc, struct vi_info *vi, struct sge_nm_rxq *nm_rxq) -{ - int i, n; - u_int fl_pidx, fl_pidx_target, hw_cidx_desc; - const uint64_t ba = pmap_kextract((vm_offset_t)nm_rxq->bb); - - hw_cidx_desc = nm_rxq->fl_cidx / 8; - if (hw_cidx_desc == 0) - fl_pidx_target = nm_rxq->fl_sidx2 - 8; - else - fl_pidx_target = (hw_cidx_desc - 1) * 8; - MPASS((fl_pidx_target & 7) == 0); - - fl_pidx = nm_rxq->fl_pidx; - MPASS((fl_pidx & 7) == 0); - for (n = 0; fl_pidx != fl_pidx_target; n++) { - for (i = 0; i < 8; i++, fl_pidx++) - nm_rxq->fl_desc[fl_pidx] = htobe64(ba | nm_rxq->fl_hwidx); - if (__predict_false(fl_pidx == nm_rxq->fl_sidx2)) - fl_pidx = 0; - } - t4_write_reg(sc, sc->sge_kdoorbell_reg, nm_rxq->fl_db_val | V_PIDX(n)); -} - static int cxgbe_netmap_off(struct adapter *sc, struct vi_info *vi, struct ifnet *ifp, struct netmap_adapter *na) @@ -681,23 +652,6 @@ cxgbe_netmap_off(struct adapter *sc, struct vi_info *v if (rc != 0) return (rc); /* error message logged already. */ - /* - * First pass over the rx queues to make sure they're all caught up. - * - * The freelists could be out of buffers and we may need to arrange - * things so that any packets still in flight (after TP's cong_drop - * logic but not yet DMA'd) have somewhere to go and do not block the - * pipeline. Do this before trying to free any queue. - */ - for_each_nm_rxq(vi, i, nm_rxq) { - nm_state = atomic_load_int(&nm_rxq->nm_state); - kring = na->rx_rings[nm_rxq->nid]; - if (nm_state == NM_OFF || !nm_kring_pending_off(kring)) - continue; - MPASS(nm_rxq->iq_cntxt_id != INVALID_NM_RXQ_CNTXT_ID); - flush_nm_rxq(sc, vi, nm_rxq); - } - for_each_nm_txq(vi, i, nm_txq) { struct sge_qstat *spg = (void *)&nm_txq->desc[nm_txq->sidx]; @@ -734,8 +688,6 @@ cxgbe_netmap_off(struct adapter *sc, struct vi_info *v pause("nmst", 1); free_nm_rxq_hwq(vi, nm_rxq); - uma_zfree(nm_rxq->bb_zone, nm_rxq->bb); - nm_rxq->bb = NULL; /* XXX: netmap, not the driver, should do this. */ kring->rhead = kring->rcur = kring->nr_hwcur = 0; From owner-svn-src-head@freebsd.org Wed Dec 2 21:01:53 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BAEF84A60D3; Wed, 2 Dec 2020 21:01:53 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CmWcK4xsrz3nmL; Wed, 2 Dec 2020 21:01:53 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9CB235C6F; Wed, 2 Dec 2020 21:01:53 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B2L1rTM060918; Wed, 2 Dec 2020 21:01:53 GMT (envelope-from mhorne@FreeBSD.org) Received: (from mhorne@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B2L1q0a060914; Wed, 2 Dec 2020 21:01:52 GMT (envelope-from mhorne@FreeBSD.org) Message-Id: <202012022101.0B2L1q0a060914@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mhorne set sender to mhorne@FreeBSD.org using -f From: Mitchell Horne Date: Wed, 2 Dec 2020 21:01:52 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368284 - head/sys/dev/uart X-SVN-Group: head X-SVN-Commit-Author: mhorne X-SVN-Commit-Paths: head/sys/dev/uart X-SVN-Commit-Revision: 368284 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Dec 2020 21:01:53 -0000 Author: mhorne Date: Wed Dec 2 21:01:52 2020 New Revision: 368284 URL: https://svnweb.freebsd.org/changeset/base/368284 Log: uart: allow UART_DEV_DBGPORT for fdt consoles Allow fdt devices to be used as debug ports for gdb(4). A debug console can be specified with the "freebsd,debug-path" property in the device tree's /chosen node, or using the environment variable hw.fdt.dbgport. The device should be specified by its name in the device tree, for example hw.fdt.dbgport="serial2". PR: 251053 Submitted by: Dmitry Salychev Submitted by: stevek (original patch, D5986) Reviewed by: andrew, mhorne Differential Revision: https://reviews.freebsd.org/D27422 Modified: head/sys/dev/uart/uart_bus_fdt.c head/sys/dev/uart/uart_cpu_arm64.c head/sys/dev/uart/uart_cpu_fdt.c head/sys/dev/uart/uart_cpu_fdt.h Modified: head/sys/dev/uart/uart_bus_fdt.c ============================================================================== --- head/sys/dev/uart/uart_bus_fdt.c Wed Dec 2 20:54:03 2020 (r368283) +++ head/sys/dev/uart/uart_bus_fdt.c Wed Dec 2 21:01:52 2020 (r368284) @@ -175,26 +175,39 @@ uart_fdt_find_by_node(phandle_t node, int class_list) int uart_cpu_fdt_probe(struct uart_class **classp, bus_space_tag_t *bst, bus_space_handle_t *bsh, int *baud, u_int *rclk, u_int *shiftp, - u_int *iowidthp) + u_int *iowidthp, const int devtype) { const char *propnames[] = {"stdout-path", "linux,stdout-path", "stdout", "stdin-path", "stdin", NULL}; + const char *propnames_dbgport[] = {"freebsd,debug-path", NULL}; const char **name; struct uart_class *class; phandle_t node, chosen; pcell_t br, clk, shift, iowidth; - char *cp; + char *cp = NULL; int err; /* Has the user forced a specific device node? */ - cp = kern_getenv("hw.fdt.console"); + switch (devtype) { + case UART_DEV_DBGPORT: + cp = kern_getenv("hw.fdt.dbgport"); + name = propnames_dbgport; + break; + case UART_DEV_CONSOLE: + cp = kern_getenv("hw.fdt.console"); + name = propnames; + break; + default: + return (ENXIO); + } + if (cp == NULL) { /* - * Retrieve /chosen/std{in,out}. + * Retrieve a node from /chosen. */ node = -1; if ((chosen = OF_finddevice("/chosen")) != -1) { - for (name = propnames; *name != NULL; name++) { + for (; *name != NULL; name++) { if (phandle_chosen_propdev(chosen, *name, &node) == 0) break; Modified: head/sys/dev/uart/uart_cpu_arm64.c ============================================================================== --- head/sys/dev/uart/uart_cpu_arm64.c Wed Dec 2 20:54:03 2020 (r368283) +++ head/sys/dev/uart/uart_cpu_arm64.c Wed Dec 2 21:01:52 2020 (r368284) @@ -100,15 +100,11 @@ uart_cpu_getdev(int devtype, struct uart_devinfo *di) if (uart_cpu_acpi_spcr(devtype, di) == 0) return (0); #endif - - if (devtype != UART_DEV_CONSOLE) - return (ENXIO); - err = ENXIO; #ifdef FDT if (err != 0) { err = uart_cpu_fdt_probe(&class, &bst, &bsh, &br, &rclk, - &shift, &iowidth); + &shift, &iowidth, devtype); } #endif if (err != 0) Modified: head/sys/dev/uart/uart_cpu_fdt.c ============================================================================== --- head/sys/dev/uart/uart_cpu_fdt.c Wed Dec 2 20:54:03 2020 (r368283) +++ head/sys/dev/uart/uart_cpu_fdt.c Wed Dec 2 21:01:52 2020 (r368284) @@ -87,10 +87,8 @@ uart_cpu_getdev(int devtype, struct uart_devinfo *di) if (!err) return (0); - if (devtype != UART_DEV_CONSOLE) - return (ENXIO); - - err = uart_cpu_fdt_probe(&class, &bst, &bsh, &br, &rclk, &shift, &iowidth); + err = uart_cpu_fdt_probe(&class, &bst, &bsh, &br, &rclk, + &shift, &iowidth, devtype); if (err != 0) return (err); Modified: head/sys/dev/uart/uart_cpu_fdt.h ============================================================================== --- head/sys/dev/uart/uart_cpu_fdt.h Wed Dec 2 20:54:03 2020 (r368283) +++ head/sys/dev/uart/uart_cpu_fdt.h Wed Dec 2 21:01:52 2020 (r368284) @@ -51,7 +51,7 @@ SET_DECLARE(uart_fdt_class_set, struct ofw_compat_data DATA_SET(uart_fdt_class_set, data) int uart_cpu_fdt_probe(struct uart_class **, bus_space_tag_t *, - bus_space_handle_t *, int *, u_int *, u_int *, u_int *); + bus_space_handle_t *, int *, u_int *, u_int *, u_int *, const int); int uart_fdt_get_clock(phandle_t node, pcell_t *cell); int uart_fdt_get_shift(phandle_t node, pcell_t *cell); int uart_fdt_get_io_width(phandle_t node, pcell_t *cell); From owner-svn-src-head@freebsd.org Wed Dec 2 21:53:29 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5DCEF4A789E; Wed, 2 Dec 2020 21:53:29 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CmXls2CS9z3sD7; Wed, 2 Dec 2020 21:53:29 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 3EE57674A; Wed, 2 Dec 2020 21:53:29 +0000 (UTC) (envelope-from glebius@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B2LrTbD094684; Wed, 2 Dec 2020 21:53:29 GMT (envelope-from glebius@FreeBSD.org) Received: (from glebius@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B2LrT9M094683; Wed, 2 Dec 2020 21:53:29 GMT (envelope-from glebius@FreeBSD.org) Message-Id: <202012022153.0B2LrT9M094683@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: glebius set sender to glebius@FreeBSD.org using -f From: Gleb Smirnoff Date: Wed, 2 Dec 2020 21:53:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368287 - head/sbin/bectl X-SVN-Group: head X-SVN-Commit-Author: glebius X-SVN-Commit-Paths: head/sbin/bectl X-SVN-Commit-Revision: 368287 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 02 Dec 2020 21:53:29 -0000 Author: glebius Date: Wed Dec 2 21:53:28 2020 New Revision: 368287 URL: https://svnweb.freebsd.org/changeset/base/368287 Log: Fix r368197: suppress error printing for the "check" command. Reviewed by: kevans Modified: head/sbin/bectl/bectl.c Modified: head/sbin/bectl/bectl.c ============================================================================== --- head/sbin/bectl/bectl.c Wed Dec 2 21:44:41 2020 (r368286) +++ head/sbin/bectl/bectl.c Wed Dec 2 21:53:28 2020 (r368287) @@ -585,8 +585,9 @@ main(int argc, char *argv[]) } if ((be = libbe_init(root)) == NULL) { - fprintf(stderr, "libbe_init(\"%s\") failed.\n", - root != NULL ? root : ""); + if (!cmd->silent) + fprintf(stderr, "libbe_init(\"%s\") failed.\n", + root != NULL ? root : ""); return (-1); } From owner-svn-src-head@freebsd.org Thu Dec 3 01:12:35 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8EE214748B1; Thu, 3 Dec 2020 01:12:35 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Cmd9b3Hgcz4ZlF; Thu, 3 Dec 2020 01:12:35 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from John-Baldwins-MacBook-Pro.local (ralph.baldwin.cx [66.234.199.215]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id EB4D62A18B; Thu, 3 Dec 2020 01:12:34 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Subject: Re: svn commit: r366857 - head/libexec/rc/rc.d To: Cy Schubert , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <202010192037.09JKbcAY079308@repo.freebsd.org> From: John Baldwin Autocrypt: addr=jhb@FreeBSD.org; keydata= mQGiBETQ+XcRBADMFybiq69u+fJRy/0wzqTNS8jFfWaBTs5/OfcV7wWezVmf9sgwn8TW0Dk0 c9MBl0pz+H01dA2ZSGZ5fXlmFIsee1WEzqeJzpiwd/pejPgSzXB9ijbLHZ2/E0jhGBcVy5Yo /Tw5+U/+laeYKu2xb0XPvM0zMNls1ah5OnP9a6Ql6wCgupaoMySb7DXm2LHD1Z9jTsHcAQMD /1jzh2BoHriy/Q2s4KzzjVp/mQO5DSm2z14BvbQRcXU48oAosHA1u3Wrov6LfPY+0U1tG47X 1BGfnQH+rNAaH0livoSBQ0IPI/8WfIW7ub4qV6HYwWKVqkDkqwcpmGNDbz3gfaDht6nsie5Z pcuCcul4M9CW7Md6zzyvktjnbz61BADGDCopfZC4of0Z3Ka0u8Wik6UJOuqShBt1WcFS8ya1 oB4rc4tXfSHyMF63aPUBMxHR5DXeH+EO2edoSwViDMqWk1jTnYza51rbGY+pebLQOVOxAY7k do5Ordl3wklBPMVEPWoZ61SdbcjhHVwaC5zfiskcxj5wwXd2E9qYlBqRg7QeSm9obiBCYWxk d2luIDxqaGJARnJlZUJTRC5vcmc+iGAEExECACAFAkTQ+awCGwMGCwkIBwMCBBUCCAMEFgID AQIeAQIXgAAKCRBy3lIGd+N/BI6RAJ9S97fvbME+3hxzE3JUyUZ6vTewDACdE1stFuSfqMvM jomvZdYxIYyTUpC5Ag0ERND5ghAIAPwsO0B7BL+bz8sLlLoQktGxXwXQfS5cInvL17Dsgnr3 1AKa94j9EnXQyPEj7u0d+LmEe6CGEGDh1OcGFTMVrof2ZzkSy4+FkZwMKJpTiqeaShMh+Goj XlwIMDxyADYvBIg3eN5YdFKaPQpfgSqhT+7El7w+wSZZD8pPQuLAnie5iz9C8iKy4/cMSOrH YUK/tO+Nhw8Jjlw94Ik0T80iEhI2t+XBVjwdfjbq3HrJ0ehqdBwukyeJRYKmbn298KOFQVHO EVbHA4rF/37jzaMadK43FgJ0SAhPPF5l4l89z5oPu0b/+5e2inA3b8J3iGZxywjM+Csq1tqz hltEc7Q+E08AAwUIAL+15XH8bPbjNJdVyg2CMl10JNW2wWg2Q6qdljeaRqeR6zFus7EZTwtX sNzs5bP8y51PSUDJbeiy2RNCNKWFMndM22TZnk3GNG45nQd4OwYK0RZVrikalmJY5Q6m7Z16 4yrZgIXFdKj2t8F+x613/SJW1lIr9/bDp4U9tw0V1g3l2dFtD3p3ZrQ3hpoDtoK70ioIAjjH aIXIAcm3FGZFXy503DOA0KaTWwvOVdYCFLm3zWuSOmrX/GsEc7ovasOWwjPn878qVjbUKWwx Q4QkF4OhUV9zPtf9tDSAZ3x7QSwoKbCoRCZ/xbyTUPyQ1VvNy/mYrBcYlzHodsaqUDjHuW+I SQQYEQIACQUCRND5ggIbDAAKCRBy3lIGd+N/BCO8AJ9j1dWVQWxw/YdTbEyrRKOY8YZNwwCf afMAg8QvmOWnHx3wl8WslCaXaE8= Message-ID: Date: Wed, 2 Dec 2020 17:12:33 -0800 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.13; rv:68.0) Gecko/20100101 Thunderbird/68.6.0 MIME-Version: 1.0 In-Reply-To: <202010192037.09JKbcAY079308@repo.freebsd.org> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Dec 2020 01:12:35 -0000 On 10/19/20 1:37 PM, Cy Schubert wrote: > Author: cy > Date: Mon Oct 19 20:37:38 2020 > New Revision: 366857 > URL: https://svnweb.freebsd.org/changeset/base/366857 > > Log: > Destroy cloned interfaces at netif stop, netif restart and shutdown. > This is especially important during shutdown because a child interface > of lagg with WOL enabled will not enable WOL at interface shutdown and > thus no WOL to wake up the device (and machine). > > PR: 158734, 109980 > Reported by: Antonio Huete Jimenez > Marat N.Afanasyev > reviewed by: kp > MFC after: 1 week > Differential Revision: https://reviews.freebsd.org/D26797 This causes some rather weird breakage for me. Namely, after this change, if I'm logged into a host via ssh and reboot it (via shutdown -r now), I no longer get gracefully logged out by the shutdown process as the network connections are all killed before users are kicked off the system. Instead, my ssh connection hangs around forever until either it times out due to keep alives, or the host in question reboots and send back a RST. As I rather frequently use shutdown -r now or poweroff remotely via ssh, I've found this rather annoying as I have to use ~. to recover my shell again (and woe to me if it was a nested login and I forgot to add enough extra ~'s to escape the N levels). Probably if you only destroyed cloned interfaces during shutdown and not all interfaces that would be a happy-enough compromise that would still satisfy the original PR? -- John Baldwin From owner-svn-src-head@freebsd.org Thu Dec 3 01:40:00 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2DA774753DE; Thu, 3 Dec 2020 01:40:00 +0000 (UTC) (envelope-from bdragon@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CmdnD0kfkz4bqx; Thu, 3 Dec 2020 01:40:00 +0000 (UTC) (envelope-from bdragon@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F22C4114B2; Thu, 3 Dec 2020 01:39:59 +0000 (UTC) (envelope-from bdragon@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B31dxNk032957; Thu, 3 Dec 2020 01:39:59 GMT (envelope-from bdragon@FreeBSD.org) Received: (from bdragon@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B31dxJX032955; Thu, 3 Dec 2020 01:39:59 GMT (envelope-from bdragon@FreeBSD.org) Message-Id: <202012030139.0B31dxJX032955@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: bdragon set sender to bdragon@FreeBSD.org using -f From: Brandon Bergren Date: Thu, 3 Dec 2020 01:39:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368290 - in head/sys/powerpc: include powerpc X-SVN-Group: head X-SVN-Commit-Author: bdragon X-SVN-Commit-Paths: in head/sys/powerpc: include powerpc X-SVN-Commit-Revision: 368290 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Dec 2020 01:40:00 -0000 Author: bdragon Date: Thu Dec 3 01:39:59 2020 New Revision: 368290 URL: https://svnweb.freebsd.org/changeset/base/368290 Log: [PowerPC64LE] Fix LE VSX/fpr interop In the PCB struct, we need to match the VSX register file layout correctly, as the VSRs shadow the FPRs. In LE, we need to have a dword of padding before the fprs so they end up on the correct side, as the struct may be manipulated by either the FP routines or the VSX routines. Additionally, when saving and restoring fprs, we need to explicitly target the fpr union member so it gets offset correctly on LE. Fixes weirdness with FP registers in VSX-using programs (A FPR that was saved by the FP routines but restored by the VSX routines was becoming 0 due to being loaded to the wrong side of the VSR.) Original patch by jhibbits. Reviewed by: jhibbits Differential Revision: https://reviews.freebsd.org/D27431 Modified: head/sys/powerpc/include/pcb.h head/sys/powerpc/powerpc/fpu.c Modified: head/sys/powerpc/include/pcb.h ============================================================================== --- head/sys/powerpc/include/pcb.h Wed Dec 2 23:16:24 2020 (r368289) +++ head/sys/powerpc/include/pcb.h Thu Dec 3 01:39:59 2020 (r368290) @@ -37,6 +37,8 @@ #ifndef _MACHINE_PCB_H_ #define _MACHINE_PCB_H_ +#include + #include #ifndef _STANDALONE @@ -62,8 +64,16 @@ struct pcb { #define PCB_CFSCR 0x40 /* Process had FSCR updated */ struct fpu { union { +#if _BYTE_ORDER == _BIG_ENDIAN double fpr; uint32_t vsr[4]; +#else + uint32_t vsr[4]; + struct { + double padding; + double fpr; + }; +#endif } fpr[32]; double fpscr; /* FPSCR stored as double for easier access */ } pcb_fpu; /* Floating point processor */ Modified: head/sys/powerpc/powerpc/fpu.c ============================================================================== --- head/sys/powerpc/powerpc/fpu.c Wed Dec 2 23:16:24 2020 (r368289) +++ head/sys/powerpc/powerpc/fpu.c Thu Dec 3 01:39:59 2020 (r368290) @@ -79,7 +79,7 @@ save_fpu_int(struct thread *td) #undef SFP } else { #define SFP(n) __asm ("stfd " #n ", 0(%0)" \ - :: "b"(&pcb->pcb_fpu.fpr[n])); + :: "b"(&pcb->pcb_fpu.fpr[n].fpr)); SFP(0); SFP(1); SFP(2); SFP(3); SFP(4); SFP(5); SFP(6); SFP(7); SFP(8); SFP(9); SFP(10); SFP(11); @@ -164,7 +164,7 @@ enable_fpu(struct thread *td) #undef LFP } else { #define LFP(n) __asm ("lfd " #n ", 0(%0)" \ - :: "b"(&pcb->pcb_fpu.fpr[n])); + :: "b"(&pcb->pcb_fpu.fpr[n].fpr)); LFP(0); LFP(1); LFP(2); LFP(3); LFP(4); LFP(5); LFP(6); LFP(7); LFP(8); LFP(9); LFP(10); LFP(11); From owner-svn-src-head@freebsd.org Thu Dec 3 04:18:57 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 0525547934B; Thu, 3 Dec 2020 04:18:57 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from smtp-out-no.shaw.ca (smtp-out-no.shaw.ca [64.59.134.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CmjJc36WZz4l0N; Thu, 3 Dec 2020 04:18:56 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from spqr.komquats.com ([70.67.229.168]) by shaw.ca with ESMTPA id kg4ykUDwD34axkg50khQXb; Wed, 02 Dec 2020 21:18:54 -0700 X-Authority-Analysis: v=2.4 cv=LvQsdlRc c=1 sm=1 tr=0 ts=5fc8672e a=7AlCcx2GqMg+lh9P3BclKA==:117 a=7AlCcx2GqMg+lh9P3BclKA==:17 a=xqWC_Br6kY4A:10 a=kj9zAlcOel0A:10 a=zTNgK-yGK50A:10 a=6I5d2MoRAAAA:8 a=zfY9hoTtAAAA:8 a=FtSH8AnkAAAA:8 a=YxBL1-UpAAAA:8 a=EkcXrb_YAAAA:8 a=ZQhl43eJsd_oFGX8ndEA:9 a=CjuIK1q_8ugA:10 a=IjZwj45LgO3ly-622nXo:22 a=5hhNq975vnbPBhNyUpu_:22 a=Bk7rEp8Xs0BjyB-fwPJV:22 a=Ia-lj3WSrqcvXOmTRaiG:22 a=LK5xJRSDVpKd5WXXoEvA:22 Received: from slippy.cwsent.com (slippy [IPv6:fc00:1:1:1::5b]) by spqr.komquats.com (Postfix) with ESMTPS id 922E44C0; Wed, 2 Dec 2020 20:18:51 -0800 (PST) Received: from slippy (localhost [127.0.0.1]) by slippy.cwsent.com (8.16.1/8.16.1) with ESMTP id 0B34Ip8X002739; Wed, 2 Dec 2020 20:18:51 -0800 (PST) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <202012030418.0B34Ip8X002739@slippy.cwsent.com> X-Mailer: exmh version 2.9.0 11/07/2018 with nmh-1.7.1 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: John Baldwin cc: Cy Schubert , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r366857 - head/libexec/rc/rc.d In-reply-to: References: <202010192037.09JKbcAY079308@repo.freebsd.org> Comments: In-reply-to John Baldwin message dated "Wed, 02 Dec 2020 17:12:33 -0800." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Wed, 02 Dec 2020 20:18:51 -0800 X-CMAE-Envelope: MS4xfPrKtQmJJeRdrvWt9fdSx9M98a8wKzEKwBuRd2gRDUvNYlHmR7x7bbgEAK9XFoXa5BEUYN717eIDKJt00sC1W2KzMdvibvbPwbyrU1sQ9cdKnWyzYa4q Jt6LDLGFL5kn4urQrucp1jBhQ4zjK8QDORpuZQDKpz6k76LfqGm8V3TN85Q41mpQjHaIaSKmvQyEM/Ya9kJJ8IX0H0R4SPHGZccjIjDxRSgXC3jtaxvJna9f XB1U1hDYvYpnAc2x9kBKNC5HhM5iI7RKjqHedBkN85LVcrXzRkFXDzZIbl04kDp5H6ZsXSdcg5sX6Zbd2HnMEiTVp3y/RyrSuZxpv996AO8= X-Rspamd-Queue-Id: 4CmjJc36WZz4l0N X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Dec 2020 04:18:57 -0000 In message , John Baldwin wri tes: > On 10/19/20 1:37 PM, Cy Schubert wrote: > > Author: cy > > Date: Mon Oct 19 20:37:38 2020 > > New Revision: 366857 > > URL: https://svnweb.freebsd.org/changeset/base/366857 > > > > Log: > > Destroy cloned interfaces at netif stop, netif restart and shutdown. > > This is especially important during shutdown because a child interface > > of lagg with WOL enabled will not enable WOL at interface shutdown and > > thus no WOL to wake up the device (and machine). > > > > PR: 158734, 109980 > > Reported by: Antonio Huete Jimenez > > Marat N.Afanasyev > > reviewed by: kp > > MFC after: 1 week > > Differential Revision: https://reviews.freebsd.org/D26797 > > This causes some rather weird breakage for me. Namely, after this > change, if I'm logged into a host via ssh and reboot it (via > shutdown -r now), I no longer get gracefully logged out by the > shutdown process as the network connections are all killed before > users are kicked off the system. Instead, my ssh connection hangs > around forever until either it times out due to keep alives, or the > host in question reboots and send back a RST. > > As I rather frequently use shutdown -r now or poweroff remotely via > ssh, I've found this rather annoying as I have to use ~. to recover > my shell again (and woe to me if it was a nested login and I forgot > to add enough extra ~'s to escape the N levels). > > Probably if you only destroyed cloned interfaces during shutdown and > not all interfaces that would be a happy-enough compromise that > would still satisfy the original PR? I've been looking at this earlier today, a different issue. This reverts r366857 and adds netifdown to run almost prior to shutdown. diff --git a/libexec/rc/rc.d/netif b/libexec/rc/rc.d/netif index b4b8ccb1aede..eb1efc4d6274 100755 --- a/libexec/rc/rc.d/netif +++ b/libexec/rc/rc.d/netif @@ -28,7 +28,7 @@ # PROVIDE: netif # REQUIRE: FILESYSTEMS iovctl serial sppp sysctl # REQUIRE: hostid ipfs -# KEYWORD: nojailvnet shutdown +# KEYWORD: nojailvnet . /etc/rc.subr . /etc/network.subr diff --git a/libexec/rc/rc.d/netifdown b/libexec/rc/rc.d/netifdown new file mode 100755 index 000000000000..8d64a1db06a2 --- /dev/null +++ b/libexec/rc/rc.d/netifdown @@ -0,0 +1,34 @@ +#!/bin/sh +# +# Copyright (c) 2003 The FreeBSD Project. All rights reserved. +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE PROJECT ``AS IS'' AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +# IN NO EVENT SHALL THE PROJECT BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +# +# $FreeBSD$ +# + +# PROVIDE: netifdown +# REQUIRE: netwait +# KEYWORD: nojailvnet shutdown nostart + +. /etc/rc.subr +. /etc/network.subr +. /etc/rc.d/netif I tested it here. It works better than my original solution. -- Cheers, Cy Schubert FreeBSD UNIX: Web: https://FreeBSD.org NTP: Web: https://nwtime.org The need of the many outweighs the greed of the few. From owner-svn-src-head@freebsd.org Thu Dec 3 05:39:27 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C638347ADD7; Thu, 3 Dec 2020 05:39:27 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Cml5W5JTRz4p7V; Thu, 3 Dec 2020 05:39:27 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id A8FAB140D8; Thu, 3 Dec 2020 05:39:27 +0000 (UTC) (envelope-from gonzo@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B35dRWN081695; Thu, 3 Dec 2020 05:39:27 GMT (envelope-from gonzo@FreeBSD.org) Received: (from gonzo@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B35dRsY081694; Thu, 3 Dec 2020 05:39:27 GMT (envelope-from gonzo@FreeBSD.org) Message-Id: <202012030539.0B35dRsY081694@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gonzo set sender to gonzo@FreeBSD.org using -f From: Oleksandr Tymoshenko Date: Thu, 3 Dec 2020 05:39:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368293 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: gonzo X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 368293 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Dec 2020 05:39:27 -0000 Author: gonzo Date: Thu Dec 3 05:39:27 2020 New Revision: 368293 URL: https://svnweb.freebsd.org/changeset/base/368293 Log: Add support for hw.physmem tunable for ARM/ARM64/RISC-V platforms hw.physmem tunable allows to limit number of physical memory available to the system. It's handled in machdep files for x86 and PowerPC. This patch adds required logic to the consolidated physmem management interface that is used by ARM, ARM64, and RISC-V. Submitted by: Klara, Inc. Reviewed by: mhorne Sponsored by: Ampere Computing Differential Revision: https://reviews.freebsd.org/D27152 Modified: head/sys/kern/subr_physmem.c Modified: head/sys/kern/subr_physmem.c ============================================================================== --- head/sys/kern/subr_physmem.c Thu Dec 3 02:22:05 2020 (r368292) +++ head/sys/kern/subr_physmem.c Thu Dec 3 05:39:27 2020 (r368293) @@ -38,6 +38,7 @@ __FBSDID("$FreeBSD$"); #include #include +#include #include #include #include @@ -141,6 +142,10 @@ physmem_print_tables(void) /* * Walk the list of hardware regions, processing it against the list of * exclusions that contain the given exflags, and generating an "avail list". + * + * If maxphyssz is not zero it sets upper limit, in bytes, for the total + * "avail list" size. Walk stops once the limit is reached and the last region + * is cut short if necessary. * * Updates the value at *pavail with the sum of all pages in all hw regions. * @@ -148,15 +153,17 @@ physmem_print_tables(void) */ static size_t regions_to_avail(vm_paddr_t *avail, uint32_t exflags, size_t maxavail, - long *pavail, long *prealmem) + uint64_t maxphyssz, long *pavail, long *prealmem) { size_t acnt, exi, hwi; uint64_t end, start, xend, xstart; long availmem, totalmem; const struct region *exp, *hwp; + uint64_t availsz; totalmem = 0; availmem = 0; + availsz = 0; acnt = 0; for (hwi = 0, hwp = hwregions; hwi < hwcnt; ++hwi, ++hwp) { start = hwp->addr; @@ -202,6 +209,13 @@ regions_to_avail(vm_paddr_t *avail, uint32_t exflags, * could affect the remainder of this hw region. */ if ((xstart > start) && (xend < end)) { + + if ((maxphyssz != 0) && + (availsz + xstart - start > maxphyssz)) { + xstart = maxphyssz + start - availsz; + } + if (xstart <= start) + continue; if (acnt > 0 && avail[acnt - 1] == (vm_paddr_t)start) { avail[acnt - 1] = (vm_paddr_t)xstart; @@ -209,6 +223,7 @@ regions_to_avail(vm_paddr_t *avail, uint32_t exflags, avail[acnt++] = (vm_paddr_t)start; avail[acnt++] = (vm_paddr_t)xstart; } + availsz += (xstart - start); availmem += atop((vm_offset_t)(xstart - start)); start = xend; continue; @@ -228,12 +243,20 @@ regions_to_avail(vm_paddr_t *avail, uint32_t exflags, * available entry for it. */ if (end > start) { + if ((maxphyssz != 0) && + (availsz + end - start > maxphyssz)) { + end = maxphyssz + start - availsz; + } + if (end <= start) + break; + if (acnt > 0 && avail[acnt - 1] == (vm_paddr_t)start) { avail[acnt - 1] = (vm_paddr_t)end; } else { avail[acnt++] = (vm_paddr_t)start; avail[acnt++] = (vm_paddr_t)end; } + availsz += end - start; availmem += atop((vm_offset_t)(end - start)); } if (acnt >= maxavail) @@ -362,7 +385,7 @@ size_t physmem_avail(vm_paddr_t *avail, size_t maxavail) { - return (regions_to_avail(avail, EXFLAG_NOALLOC, maxavail, NULL, NULL)); + return (regions_to_avail(avail, EXFLAG_NOALLOC, maxavail, 0, NULL, NULL)); } /* @@ -378,11 +401,15 @@ void physmem_init_kernel_globals(void) { size_t nextidx; + u_long hwphyssz; - regions_to_avail(dump_avail, EXFLAG_NODUMP, PHYS_AVAIL_ENTRIES, NULL, - NULL); + hwphyssz = 0; + TUNABLE_ULONG_FETCH("hw.physmem", &hwphyssz); + + regions_to_avail(dump_avail, EXFLAG_NODUMP, PHYS_AVAIL_ENTRIES, + hwphyssz, NULL, NULL); nextidx = regions_to_avail(phys_avail, EXFLAG_NOALLOC, - PHYS_AVAIL_ENTRIES, &physmem, &realmem); + PHYS_AVAIL_ENTRIES, hwphyssz, &physmem, &realmem); if (nextidx == 0) panic("No memory entries in phys_avail"); Maxmem = atop(phys_avail[nextidx - 1]); From owner-svn-src-head@freebsd.org Thu Dec 3 05:50:00 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3114847B30A; Thu, 3 Dec 2020 05:50:00 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CmlKh0jNvz4q7H; Thu, 3 Dec 2020 05:50:00 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id F2394147FF; Thu, 3 Dec 2020 05:49:59 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B35nxR1088573; Thu, 3 Dec 2020 05:49:59 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B35nxRa088572; Thu, 3 Dec 2020 05:49:59 GMT (envelope-from cy@FreeBSD.org) Message-Id: <202012030549.0B35nxRa088572@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Thu, 3 Dec 2020 05:49:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368294 - head/lib/libc/gen X-SVN-Group: head X-SVN-Commit-Author: cy X-SVN-Commit-Paths: head/lib/libc/gen X-SVN-Commit-Revision: 368294 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Dec 2020 05:50:00 -0000 Author: cy Date: Thu Dec 3 05:49:59 2020 New Revision: 368294 URL: https://svnweb.freebsd.org/changeset/base/368294 Log: Remove trailing whitespace. MFC after: 1 week Modified: head/lib/libc/gen/glob-compat11.c Modified: head/lib/libc/gen/glob-compat11.c ============================================================================== --- head/lib/libc/gen/glob-compat11.c Thu Dec 3 05:39:27 2020 (r368293) +++ head/lib/libc/gen/glob-compat11.c Thu Dec 3 05:49:59 2020 (r368294) @@ -77,8 +77,8 @@ __FBSDID("$FreeBSD$"); struct glob_limit { size_t l_brace_cnt; size_t l_path_lim; - size_t l_readdir_cnt; - size_t l_stat_cnt; + size_t l_readdir_cnt; + size_t l_stat_cnt; size_t l_string_cnt; }; @@ -402,8 +402,8 @@ globtilde(const Char *pattern, Char *patbuf, size_t pa if (*pattern != TILDE || !(pglob->gl_flags & GLOB_TILDE)) return (pattern); - /* - * Copy up to the end of the string or / + /* + * Copy up to the end of the string or / */ eb = &patbuf[patbuf_len - 1]; for (p = pattern + 1, b = patbuf; From owner-svn-src-head@freebsd.org Thu Dec 3 08:30:31 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8C94A47EC68; Thu, 3 Dec 2020 08:30:31 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Cmptv3M9dz3F45; Thu, 3 Dec 2020 08:30:31 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 61B361652C; Thu, 3 Dec 2020 08:30:31 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B38UVth086665; Thu, 3 Dec 2020 08:30:31 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B38UUcX086660; Thu, 3 Dec 2020 08:30:30 GMT (envelope-from np@FreeBSD.org) Message-Id: <202012030830.0B38UUcX086660@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Thu, 3 Dec 2020 08:30:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368296 - in head/sys/dev/cxgbe: . common X-SVN-Group: head X-SVN-Commit-Author: np X-SVN-Commit-Paths: in head/sys/dev/cxgbe: . common X-SVN-Commit-Revision: 368296 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Dec 2020 08:30:31 -0000 Author: np Date: Thu Dec 3 08:30:29 2020 New Revision: 368296 URL: https://svnweb.freebsd.org/changeset/base/368296 Log: cxgbe(4): Stop but don't free netmap queues when netmap is switched off. It is common for freelists to be starving when a netmap application stops. Mailbox commands to free queues can hang in such a situation. Avoid that by not freeing the queues when netmap is switched off. Instead, use an alternate method to stop the queues without releasing the context ids. If netmap is enabled again later then the same queue is reinitialized for use. Move alloc_nm_rxq and txq to t4_netmap.c while here. MFC after: 1 week Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/adapter.h head/sys/dev/cxgbe/common/common.h head/sys/dev/cxgbe/common/t4_hw.c head/sys/dev/cxgbe/t4_netmap.c head/sys/dev/cxgbe/t4_sge.c Modified: head/sys/dev/cxgbe/adapter.h ============================================================================== --- head/sys/dev/cxgbe/adapter.h Thu Dec 3 05:56:42 2020 (r368295) +++ head/sys/dev/cxgbe/adapter.h Thu Dec 3 08:30:29 2020 (r368296) @@ -1247,6 +1247,12 @@ struct sge_nm_rxq; void cxgbe_nm_attach(struct vi_info *); void cxgbe_nm_detach(struct vi_info *); void service_nm_rxq(struct sge_nm_rxq *); +int alloc_nm_rxq(struct vi_info *, struct sge_nm_rxq *, int, int, + struct sysctl_oid *); +int free_nm_rxq(struct vi_info *, struct sge_nm_rxq *); +int alloc_nm_txq(struct vi_info *, struct sge_nm_txq *, int, int, + struct sysctl_oid *); +int free_nm_txq(struct vi_info *, struct sge_nm_txq *); #endif /* t4_sge.c */ @@ -1259,6 +1265,11 @@ int t4_create_dma_tag(struct adapter *); void t4_sge_sysctls(struct adapter *, struct sysctl_ctx_list *, struct sysctl_oid_list *); int t4_destroy_dma_tag(struct adapter *); +int alloc_ring(struct adapter *, size_t, bus_dma_tag_t *, bus_dmamap_t *, + bus_addr_t *, void **); +int free_ring(struct adapter *, bus_dma_tag_t, bus_dmamap_t, bus_addr_t, + void *); +int sysctl_uint16(SYSCTL_HANDLER_ARGS); int t4_setup_adapter_queues(struct adapter *); int t4_teardown_adapter_queues(struct adapter *); int t4_setup_vi_queues(struct vi_info *); Modified: head/sys/dev/cxgbe/common/common.h ============================================================================== --- head/sys/dev/cxgbe/common/common.h Thu Dec 3 05:56:42 2020 (r368295) +++ head/sys/dev/cxgbe/common/common.h Thu Dec 3 08:30:29 2020 (r368296) @@ -840,6 +840,8 @@ int t4_iq_stop(struct adapter *adap, unsigned int mbox int t4_iq_free(struct adapter *adap, unsigned int mbox, unsigned int pf, unsigned int vf, unsigned int iqtype, unsigned int iqid, unsigned int fl0id, unsigned int fl1id); +int t4_eth_eq_stop(struct adapter *adap, unsigned int mbox, unsigned int pf, + unsigned int vf, unsigned int eqid); int t4_eth_eq_free(struct adapter *adap, unsigned int mbox, unsigned int pf, unsigned int vf, unsigned int eqid); int t4_ctrl_eq_free(struct adapter *adap, unsigned int mbox, unsigned int pf, Modified: head/sys/dev/cxgbe/common/t4_hw.c ============================================================================== --- head/sys/dev/cxgbe/common/t4_hw.c Thu Dec 3 05:56:42 2020 (r368295) +++ head/sys/dev/cxgbe/common/t4_hw.c Thu Dec 3 08:30:29 2020 (r368296) @@ -8620,6 +8620,32 @@ int t4_iq_free(struct adapter *adap, unsigned int mbox } /** + * t4_eth_eq_stop - stop an Ethernet egress queue + * @adap: the adapter + * @mbox: mailbox to use for the FW command + * @pf: the PF owning the queues + * @vf: the VF owning the queues + * @eqid: egress queue id + * + * Stops an Ethernet egress queue. The queue can be reinitialized or + * freed but is not otherwise functional after this call. + */ +int t4_eth_eq_stop(struct adapter *adap, unsigned int mbox, unsigned int pf, + unsigned int vf, unsigned int eqid) +{ + struct fw_eq_eth_cmd c; + + memset(&c, 0, sizeof(c)); + c.op_to_vfn = cpu_to_be32(V_FW_CMD_OP(FW_EQ_ETH_CMD) | + F_FW_CMD_REQUEST | F_FW_CMD_EXEC | + V_FW_EQ_ETH_CMD_PFN(pf) | + V_FW_EQ_ETH_CMD_VFN(vf)); + c.alloc_to_len16 = cpu_to_be32(F_FW_EQ_ETH_CMD_EQSTOP | FW_LEN16(c)); + c.eqid_pkd = cpu_to_be32(V_FW_EQ_ETH_CMD_EQID(eqid)); + return t4_wr_mbox(adap, mbox, &c, sizeof(c), NULL); +} + +/** * t4_eth_eq_free - free an Ethernet egress queue * @adap: the adapter * @mbox: mailbox to use for the FW command Modified: head/sys/dev/cxgbe/t4_netmap.c ============================================================================== --- head/sys/dev/cxgbe/t4_netmap.c Thu Dec 3 05:56:42 2020 (r368295) +++ head/sys/dev/cxgbe/t4_netmap.c Thu Dec 3 08:30:29 2020 (r368296) @@ -120,6 +120,166 @@ static int nm_txcsum = 0; SYSCTL_INT(_hw_cxgbe, OID_AUTO, nm_txcsum, CTLFLAG_RWTUN, &nm_txcsum, 0, "Enable transmit checksum offloading."); +static int free_nm_rxq_hwq(struct vi_info *, struct sge_nm_rxq *); +static int free_nm_txq_hwq(struct vi_info *, struct sge_nm_txq *); + +int +alloc_nm_rxq(struct vi_info *vi, struct sge_nm_rxq *nm_rxq, int intr_idx, + int idx, struct sysctl_oid *oid) +{ + int rc; + struct sysctl_oid_list *children; + struct sysctl_ctx_list *ctx; + char name[16]; + size_t len; + struct adapter *sc = vi->adapter; + struct netmap_adapter *na = NA(vi->ifp); + + MPASS(na != NULL); + + len = vi->qsize_rxq * IQ_ESIZE; + rc = alloc_ring(sc, len, &nm_rxq->iq_desc_tag, &nm_rxq->iq_desc_map, + &nm_rxq->iq_ba, (void **)&nm_rxq->iq_desc); + if (rc != 0) + return (rc); + + len = na->num_rx_desc * EQ_ESIZE + sc->params.sge.spg_len; + rc = alloc_ring(sc, len, &nm_rxq->fl_desc_tag, &nm_rxq->fl_desc_map, + &nm_rxq->fl_ba, (void **)&nm_rxq->fl_desc); + if (rc != 0) + return (rc); + + nm_rxq->vi = vi; + nm_rxq->nid = idx; + nm_rxq->iq_cidx = 0; + nm_rxq->iq_sidx = vi->qsize_rxq - sc->params.sge.spg_len / IQ_ESIZE; + nm_rxq->iq_gen = F_RSPD_GEN; + nm_rxq->fl_pidx = nm_rxq->fl_cidx = 0; + nm_rxq->fl_sidx = na->num_rx_desc; + nm_rxq->fl_sidx2 = nm_rxq->fl_sidx; /* copy for rxsync cacheline */ + nm_rxq->intr_idx = intr_idx; + nm_rxq->iq_cntxt_id = INVALID_NM_RXQ_CNTXT_ID; + + ctx = &vi->ctx; + children = SYSCTL_CHILDREN(oid); + + snprintf(name, sizeof(name), "%d", idx); + oid = SYSCTL_ADD_NODE(ctx, children, OID_AUTO, name, + CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, "rx queue"); + children = SYSCTL_CHILDREN(oid); + + SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "abs_id", + CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE, &nm_rxq->iq_abs_id, + 0, sysctl_uint16, "I", "absolute id of the queue"); + SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "cntxt_id", + CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE, &nm_rxq->iq_cntxt_id, + 0, sysctl_uint16, "I", "SGE context id of the queue"); + SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "cidx", + CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE, &nm_rxq->iq_cidx, 0, + sysctl_uint16, "I", "consumer index"); + + children = SYSCTL_CHILDREN(oid); + oid = SYSCTL_ADD_NODE(ctx, children, OID_AUTO, "fl", + CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, "freelist"); + children = SYSCTL_CHILDREN(oid); + + SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "cntxt_id", + CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE, &nm_rxq->fl_cntxt_id, + 0, sysctl_uint16, "I", "SGE context id of the freelist"); + SYSCTL_ADD_UINT(ctx, children, OID_AUTO, "cidx", CTLFLAG_RD, + &nm_rxq->fl_cidx, 0, "consumer index"); + SYSCTL_ADD_UINT(ctx, children, OID_AUTO, "pidx", CTLFLAG_RD, + &nm_rxq->fl_pidx, 0, "producer index"); + + return (rc); +} + +int +free_nm_rxq(struct vi_info *vi, struct sge_nm_rxq *nm_rxq) +{ + struct adapter *sc = vi->adapter; + + if (!(vi->flags & VI_INIT_DONE)) + return (0); + + if (nm_rxq->iq_cntxt_id != INVALID_NM_RXQ_CNTXT_ID) + free_nm_rxq_hwq(vi, nm_rxq); + MPASS(nm_rxq->iq_cntxt_id == INVALID_NM_RXQ_CNTXT_ID); + + free_ring(sc, nm_rxq->iq_desc_tag, nm_rxq->iq_desc_map, nm_rxq->iq_ba, + nm_rxq->iq_desc); + free_ring(sc, nm_rxq->fl_desc_tag, nm_rxq->fl_desc_map, nm_rxq->fl_ba, + nm_rxq->fl_desc); + + return (0); +} + +int +alloc_nm_txq(struct vi_info *vi, struct sge_nm_txq *nm_txq, int iqidx, int idx, + struct sysctl_oid *oid) +{ + int rc; + size_t len; + struct port_info *pi = vi->pi; + struct adapter *sc = pi->adapter; + struct netmap_adapter *na = NA(vi->ifp); + char name[16]; + struct sysctl_oid_list *children = SYSCTL_CHILDREN(oid); + + len = na->num_tx_desc * EQ_ESIZE + sc->params.sge.spg_len; + rc = alloc_ring(sc, len, &nm_txq->desc_tag, &nm_txq->desc_map, + &nm_txq->ba, (void **)&nm_txq->desc); + if (rc) + return (rc); + + nm_txq->pidx = nm_txq->cidx = 0; + nm_txq->sidx = na->num_tx_desc; + nm_txq->nid = idx; + nm_txq->iqidx = iqidx; + nm_txq->cpl_ctrl0 = htobe32(V_TXPKT_OPCODE(CPL_TX_PKT) | + V_TXPKT_INTF(pi->tx_chan) | V_TXPKT_PF(sc->pf) | + V_TXPKT_VF(vi->vin) | V_TXPKT_VF_VLD(vi->vfvld)); + if (sc->params.fw_vers >= FW_VERSION32(1, 24, 11, 0)) + nm_txq->op_pkd = htobe32(V_FW_WR_OP(FW_ETH_TX_PKTS2_WR)); + else + nm_txq->op_pkd = htobe32(V_FW_WR_OP(FW_ETH_TX_PKTS_WR)); + nm_txq->cntxt_id = INVALID_NM_TXQ_CNTXT_ID; + + snprintf(name, sizeof(name), "%d", idx); + oid = SYSCTL_ADD_NODE(&vi->ctx, children, OID_AUTO, name, + CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, "netmap tx queue"); + children = SYSCTL_CHILDREN(oid); + + SYSCTL_ADD_UINT(&vi->ctx, children, OID_AUTO, "cntxt_id", CTLFLAG_RD, + &nm_txq->cntxt_id, 0, "SGE context id of the queue"); + SYSCTL_ADD_PROC(&vi->ctx, children, OID_AUTO, "cidx", + CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE, &nm_txq->cidx, 0, + sysctl_uint16, "I", "consumer index"); + SYSCTL_ADD_PROC(&vi->ctx, children, OID_AUTO, "pidx", + CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE, &nm_txq->pidx, 0, + sysctl_uint16, "I", "producer index"); + + return (rc); +} + +int +free_nm_txq(struct vi_info *vi, struct sge_nm_txq *nm_txq) +{ + struct adapter *sc = vi->adapter; + + if (!(vi->flags & VI_INIT_DONE)) + return (0); + + if (nm_txq->cntxt_id != INVALID_NM_TXQ_CNTXT_ID) + free_nm_txq_hwq(vi, nm_txq); + MPASS(nm_txq->cntxt_id == INVALID_NM_TXQ_CNTXT_ID); + + free_ring(sc, nm_txq->desc_tag, nm_txq->desc_map, nm_txq->ba, + nm_txq->desc); + + return (0); +} + static int alloc_nm_rxq_hwq(struct vi_info *vi, struct sge_nm_rxq *nm_rxq, int cong) { @@ -141,8 +301,15 @@ alloc_nm_rxq_hwq(struct vi_info *vi, struct sge_nm_rxq c.op_to_vfn = htobe32(V_FW_CMD_OP(FW_IQ_CMD) | F_FW_CMD_REQUEST | F_FW_CMD_WRITE | F_FW_CMD_EXEC | V_FW_IQ_CMD_PFN(sc->pf) | V_FW_IQ_CMD_VFN(0)); - c.alloc_to_len16 = htobe32(F_FW_IQ_CMD_ALLOC | F_FW_IQ_CMD_IQSTART | - FW_LEN16(c)); + c.alloc_to_len16 = htobe32(F_FW_IQ_CMD_IQSTART | FW_LEN16(c)); + if (nm_rxq->iq_cntxt_id == INVALID_NM_RXQ_CNTXT_ID) + c.alloc_to_len16 |= htobe32(F_FW_IQ_CMD_ALLOC); + else { + c.iqid = htobe16(nm_rxq->iq_cntxt_id); + c.fl0id = htobe16(nm_rxq->fl_cntxt_id); + c.fl1id = htobe16(0xffff); + c.physiqid = htobe16(nm_rxq->iq_abs_id); + } MPASS(!forwarding_intr_to_fwq(sc)); KASSERT(nm_rxq->intr_idx < sc->intr_count, ("%s: invalid direct intr_idx %d", __func__, nm_rxq->intr_idx)); @@ -276,8 +443,11 @@ alloc_nm_txq_hwq(struct vi_info *vi, struct sge_nm_txq c.op_to_vfn = htobe32(V_FW_CMD_OP(FW_EQ_ETH_CMD) | F_FW_CMD_REQUEST | F_FW_CMD_WRITE | F_FW_CMD_EXEC | V_FW_EQ_ETH_CMD_PFN(sc->pf) | V_FW_EQ_ETH_CMD_VFN(0)); - c.alloc_to_len16 = htobe32(F_FW_EQ_ETH_CMD_ALLOC | - F_FW_EQ_ETH_CMD_EQSTART | FW_LEN16(c)); + c.alloc_to_len16 = htobe32(F_FW_EQ_ETH_CMD_EQSTART | FW_LEN16(c)); + if (nm_txq->cntxt_id == INVALID_NM_TXQ_CNTXT_ID) + c.alloc_to_len16 |= htobe32(F_FW_EQ_ETH_CMD_ALLOC); + else + c.eqid_pkd = htobe32(V_FW_EQ_ETH_CMD_EQID(nm_txq->cntxt_id)); c.autoequiqe_to_viid = htobe32(F_FW_EQ_ETH_CMD_AUTOEQUIQE | F_FW_EQ_ETH_CMD_AUTOEQUEQE | V_FW_EQ_ETH_CMD_VIID(vi->viid)); c.fetchszm_to_iqid = @@ -580,8 +750,7 @@ cxgbe_netmap_on(struct adapter *sc, struct vi_info *vi for_each_nm_rxq(vi, i, nm_rxq) { kring = na->rx_rings[nm_rxq->nid]; - if (!nm_kring_pending_on(kring) || - nm_rxq->iq_cntxt_id != INVALID_NM_RXQ_CNTXT_ID) + if (!nm_kring_pending_on(kring)) continue; alloc_nm_rxq_hwq(vi, nm_rxq, tnl_cong(vi->pi, nm_cong_drop)); @@ -611,8 +780,7 @@ cxgbe_netmap_on(struct adapter *sc, struct vi_info *vi for_each_nm_txq(vi, i, nm_txq) { kring = na->tx_rings[nm_txq->nid]; - if (!nm_kring_pending_on(kring) || - nm_txq->cntxt_id != INVALID_NM_TXQ_CNTXT_ID) + if (!nm_kring_pending_on(kring)) continue; alloc_nm_txq_hwq(vi, nm_txq); @@ -653,23 +821,18 @@ cxgbe_netmap_off(struct adapter *sc, struct vi_info *v return (rc); /* error message logged already. */ for_each_nm_txq(vi, i, nm_txq) { - struct sge_qstat *spg = (void *)&nm_txq->desc[nm_txq->sidx]; - kring = na->tx_rings[nm_txq->nid]; - if (!nm_kring_pending_off(kring) || - nm_txq->cntxt_id == INVALID_NM_TXQ_CNTXT_ID) + if (!nm_kring_pending_off(kring)) continue; + MPASS(nm_txq->cntxt_id != INVALID_NM_TXQ_CNTXT_ID); - /* Wait for hw pidx to catch up ... */ - while (be16toh(nm_txq->pidx) != spg->pidx) - pause("nmpidx", 1); + rc = -t4_eth_eq_stop(sc, sc->mbox, sc->pf, 0, nm_txq->cntxt_id); + if (rc != 0) { + device_printf(vi->dev, + "failed to stop nm_txq[%d]: %d.\n", i, rc); + return (rc); + } - /* ... and then for the cidx. */ - while (spg->pidx != spg->cidx) - pause("nmcidx", 1); - - free_nm_txq_hwq(vi, nm_txq); - /* XXX: netmap, not the driver, should do this. */ kring->rhead = kring->rcur = kring->nr_hwcur = 0; kring->rtail = kring->nr_hwtail = kring->nkr_num_slots - 1; @@ -680,14 +843,21 @@ cxgbe_netmap_off(struct adapter *sc, struct vi_info *v kring = na->rx_rings[nm_rxq->nid]; if (nm_state != NM_OFF && !nm_kring_pending_off(kring)) nactive++; - if (nm_state == NM_OFF || !nm_kring_pending_off(kring)) + if (!nm_kring_pending_off(kring)) continue; - + MPASS(nm_state != NM_OFF); MPASS(nm_rxq->iq_cntxt_id != INVALID_NM_RXQ_CNTXT_ID); + + rc = -t4_iq_stop(sc, sc->mbox, sc->pf, 0, FW_IQ_TYPE_FL_INT_CAP, + nm_rxq->iq_cntxt_id, nm_rxq->fl_cntxt_id, 0xffff); + if (rc != 0) { + device_printf(vi->dev, + "failed to stop nm_rxq[%d]: %d.\n", i, rc); + return (rc); + } + while (!atomic_cmpset_int(&nm_rxq->nm_state, NM_ON, NM_OFF)) pause("nmst", 1); - - free_nm_rxq_hwq(vi, nm_rxq); /* XXX: netmap, not the driver, should do this. */ kring->rhead = kring->rcur = kring->nr_hwcur = 0; Modified: head/sys/dev/cxgbe/t4_sge.c ============================================================================== --- head/sys/dev/cxgbe/t4_sge.c Thu Dec 3 05:56:42 2020 (r368295) +++ head/sys/dev/cxgbe/t4_sge.c Thu Dec 3 08:30:29 2020 (r368296) @@ -222,10 +222,6 @@ static inline void init_iq(struct sge_iq *, struct ada static inline void init_fl(struct adapter *, struct sge_fl *, int, int, char *); static inline void init_eq(struct adapter *, struct sge_eq *, int, int, uint8_t, uint16_t, char *); -static int alloc_ring(struct adapter *, size_t, bus_dma_tag_t *, bus_dmamap_t *, - bus_addr_t *, void **); -static int free_ring(struct adapter *, bus_dma_tag_t, bus_dmamap_t, bus_addr_t, - void *); static int alloc_iq_fl(struct vi_info *, struct sge_iq *, struct sge_fl *, int, int); static int free_iq_fl(struct vi_info *, struct sge_iq *, struct sge_fl *); @@ -245,14 +241,6 @@ static int alloc_ofld_rxq(struct vi_info *, struct sge struct sysctl_oid *); static int free_ofld_rxq(struct vi_info *, struct sge_ofld_rxq *); #endif -#ifdef DEV_NETMAP -static int alloc_nm_rxq(struct vi_info *, struct sge_nm_rxq *, int, int, - struct sysctl_oid *); -static int free_nm_rxq(struct vi_info *, struct sge_nm_rxq *); -static int alloc_nm_txq(struct vi_info *, struct sge_nm_txq *, int, int, - struct sysctl_oid *); -static int free_nm_txq(struct vi_info *, struct sge_nm_txq *); -#endif static int ctrl_eq_alloc(struct adapter *, struct sge_eq *); static int eth_eq_alloc(struct adapter *, struct vi_info *, struct sge_eq *); #if defined(TCP_OFFLOAD) || defined(RATELIMIT) @@ -309,7 +297,6 @@ static int t4_handle_wrerr_rpl(struct adapter *, const static void wrq_tx_drain(void *, int); static void drain_wrq_wr_list(struct adapter *, struct sge_wrq *); -static int sysctl_uint16(SYSCTL_HANDLER_ARGS); static int sysctl_bufsizes(SYSCTL_HANDLER_ARGS); #ifdef RATELIMIT static inline u_int txpkt_eo_len16(u_int, u_int, u_int); @@ -3392,7 +3379,7 @@ init_eq(struct adapter *sc, struct sge_eq *eq, int eqt strlcpy(eq->lockname, name, sizeof(eq->lockname)); } -static int +int alloc_ring(struct adapter *sc, size_t len, bus_dma_tag_t *tag, bus_dmamap_t *map, bus_addr_t *pa, void **va) { @@ -3424,7 +3411,7 @@ done: return (rc); } -static int +int free_ring(struct adapter *sc, bus_dma_tag_t tag, bus_dmamap_t map, bus_addr_t pa, void *va) { @@ -3941,162 +3928,6 @@ free_ofld_rxq(struct vi_info *vi, struct sge_ofld_rxq } #endif -#ifdef DEV_NETMAP -static int -alloc_nm_rxq(struct vi_info *vi, struct sge_nm_rxq *nm_rxq, int intr_idx, - int idx, struct sysctl_oid *oid) -{ - int rc; - struct sysctl_oid_list *children; - struct sysctl_ctx_list *ctx; - char name[16]; - size_t len; - struct adapter *sc = vi->adapter; - struct netmap_adapter *na = NA(vi->ifp); - - MPASS(na != NULL); - - len = vi->qsize_rxq * IQ_ESIZE; - rc = alloc_ring(sc, len, &nm_rxq->iq_desc_tag, &nm_rxq->iq_desc_map, - &nm_rxq->iq_ba, (void **)&nm_rxq->iq_desc); - if (rc != 0) - return (rc); - - len = na->num_rx_desc * EQ_ESIZE + sc->params.sge.spg_len; - rc = alloc_ring(sc, len, &nm_rxq->fl_desc_tag, &nm_rxq->fl_desc_map, - &nm_rxq->fl_ba, (void **)&nm_rxq->fl_desc); - if (rc != 0) - return (rc); - - nm_rxq->vi = vi; - nm_rxq->nid = idx; - nm_rxq->iq_cidx = 0; - nm_rxq->iq_sidx = vi->qsize_rxq - sc->params.sge.spg_len / IQ_ESIZE; - nm_rxq->iq_gen = F_RSPD_GEN; - nm_rxq->fl_pidx = nm_rxq->fl_cidx = 0; - nm_rxq->fl_sidx = na->num_rx_desc; - nm_rxq->fl_sidx2 = nm_rxq->fl_sidx; /* copy for rxsync cacheline */ - nm_rxq->intr_idx = intr_idx; - nm_rxq->iq_cntxt_id = INVALID_NM_RXQ_CNTXT_ID; - - ctx = &vi->ctx; - children = SYSCTL_CHILDREN(oid); - - snprintf(name, sizeof(name), "%d", idx); - oid = SYSCTL_ADD_NODE(ctx, children, OID_AUTO, name, - CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, "rx queue"); - children = SYSCTL_CHILDREN(oid); - - SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "abs_id", - CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE, &nm_rxq->iq_abs_id, - 0, sysctl_uint16, "I", "absolute id of the queue"); - SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "cntxt_id", - CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE, &nm_rxq->iq_cntxt_id, - 0, sysctl_uint16, "I", "SGE context id of the queue"); - SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "cidx", - CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE, &nm_rxq->iq_cidx, 0, - sysctl_uint16, "I", "consumer index"); - - children = SYSCTL_CHILDREN(oid); - oid = SYSCTL_ADD_NODE(ctx, children, OID_AUTO, "fl", - CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, "freelist"); - children = SYSCTL_CHILDREN(oid); - - SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "cntxt_id", - CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE, &nm_rxq->fl_cntxt_id, - 0, sysctl_uint16, "I", "SGE context id of the freelist"); - SYSCTL_ADD_UINT(ctx, children, OID_AUTO, "cidx", CTLFLAG_RD, - &nm_rxq->fl_cidx, 0, "consumer index"); - SYSCTL_ADD_UINT(ctx, children, OID_AUTO, "pidx", CTLFLAG_RD, - &nm_rxq->fl_pidx, 0, "producer index"); - - return (rc); -} - - -static int -free_nm_rxq(struct vi_info *vi, struct sge_nm_rxq *nm_rxq) -{ - struct adapter *sc = vi->adapter; - - if (vi->flags & VI_INIT_DONE) - MPASS(nm_rxq->iq_cntxt_id == INVALID_NM_RXQ_CNTXT_ID); - else - MPASS(nm_rxq->iq_cntxt_id == 0); - - free_ring(sc, nm_rxq->iq_desc_tag, nm_rxq->iq_desc_map, nm_rxq->iq_ba, - nm_rxq->iq_desc); - free_ring(sc, nm_rxq->fl_desc_tag, nm_rxq->fl_desc_map, nm_rxq->fl_ba, - nm_rxq->fl_desc); - - return (0); -} - -static int -alloc_nm_txq(struct vi_info *vi, struct sge_nm_txq *nm_txq, int iqidx, int idx, - struct sysctl_oid *oid) -{ - int rc; - size_t len; - struct port_info *pi = vi->pi; - struct adapter *sc = pi->adapter; - struct netmap_adapter *na = NA(vi->ifp); - char name[16]; - struct sysctl_oid_list *children = SYSCTL_CHILDREN(oid); - - len = na->num_tx_desc * EQ_ESIZE + sc->params.sge.spg_len; - rc = alloc_ring(sc, len, &nm_txq->desc_tag, &nm_txq->desc_map, - &nm_txq->ba, (void **)&nm_txq->desc); - if (rc) - return (rc); - - nm_txq->pidx = nm_txq->cidx = 0; - nm_txq->sidx = na->num_tx_desc; - nm_txq->nid = idx; - nm_txq->iqidx = iqidx; - nm_txq->cpl_ctrl0 = htobe32(V_TXPKT_OPCODE(CPL_TX_PKT) | - V_TXPKT_INTF(pi->tx_chan) | V_TXPKT_PF(sc->pf) | - V_TXPKT_VF(vi->vin) | V_TXPKT_VF_VLD(vi->vfvld)); - if (sc->params.fw_vers >= FW_VERSION32(1, 24, 11, 0)) - nm_txq->op_pkd = htobe32(V_FW_WR_OP(FW_ETH_TX_PKTS2_WR)); - else - nm_txq->op_pkd = htobe32(V_FW_WR_OP(FW_ETH_TX_PKTS_WR)); - nm_txq->cntxt_id = INVALID_NM_TXQ_CNTXT_ID; - - snprintf(name, sizeof(name), "%d", idx); - oid = SYSCTL_ADD_NODE(&vi->ctx, children, OID_AUTO, name, - CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, "netmap tx queue"); - children = SYSCTL_CHILDREN(oid); - - SYSCTL_ADD_UINT(&vi->ctx, children, OID_AUTO, "cntxt_id", CTLFLAG_RD, - &nm_txq->cntxt_id, 0, "SGE context id of the queue"); - SYSCTL_ADD_PROC(&vi->ctx, children, OID_AUTO, "cidx", - CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE, &nm_txq->cidx, 0, - sysctl_uint16, "I", "consumer index"); - SYSCTL_ADD_PROC(&vi->ctx, children, OID_AUTO, "pidx", - CTLTYPE_INT | CTLFLAG_RD | CTLFLAG_MPSAFE, &nm_txq->pidx, 0, - sysctl_uint16, "I", "producer index"); - - return (rc); -} - -static int -free_nm_txq(struct vi_info *vi, struct sge_nm_txq *nm_txq) -{ - struct adapter *sc = vi->adapter; - - if (vi->flags & VI_INIT_DONE) - MPASS(nm_txq->cntxt_id == INVALID_NM_TXQ_CNTXT_ID); - else - MPASS(nm_txq->cntxt_id == 0); - - free_ring(sc, nm_txq->desc_tag, nm_txq->desc_map, nm_txq->ba, - nm_txq->desc); - - return (0); -} -#endif - /* * Returns a reasonable automatic cidx flush threshold for a given queue size. */ @@ -6146,7 +5977,7 @@ t4_handle_wrerr_rpl(struct adapter *adap, const __be64 return (0); } -static int +int sysctl_uint16(SYSCTL_HANDLER_ARGS) { uint16_t *id = arg1; From owner-svn-src-head@freebsd.org Thu Dec 3 11:15:50 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B5E6D4A3A32; Thu, 3 Dec 2020 11:15:50 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CmtYf4mr5z3QYH; Thu, 3 Dec 2020 11:15:50 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9282B18A84; Thu, 3 Dec 2020 11:15:50 +0000 (UTC) (envelope-from manu@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B3BFosa091954; Thu, 3 Dec 2020 11:15:50 GMT (envelope-from manu@FreeBSD.org) Received: (from manu@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B3BFon6091952; Thu, 3 Dec 2020 11:15:50 GMT (envelope-from manu@FreeBSD.org) Message-Id: <202012031115.0B3BFon6091952@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: manu set sender to manu@FreeBSD.org using -f From: Emmanuel Vadot Date: Thu, 3 Dec 2020 11:15:50 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368299 - head/sys/dev/dwc X-SVN-Group: head X-SVN-Commit-Author: manu X-SVN-Commit-Paths: head/sys/dev/dwc X-SVN-Commit-Revision: 368299 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Dec 2020 11:15:50 -0000 Author: manu Date: Thu Dec 3 11:15:49 2020 New Revision: 368299 URL: https://svnweb.freebsd.org/changeset/base/368299 Log: if_dwc: Honor snps,pbl property DTS node can have this property which configure the burst length for both TX and RX if it's the same. This unbreak if_dwc on Allwinner A20 and possibly other boards that uses this prop. Reported by: qroxana Modified: head/sys/dev/dwc/if_dwc.c head/sys/dev/dwc/if_dwc.h Modified: head/sys/dev/dwc/if_dwc.c ============================================================================== --- head/sys/dev/dwc/if_dwc.c Thu Dec 3 10:41:06 2020 (r368298) +++ head/sys/dev/dwc/if_dwc.c Thu Dec 3 11:15:49 2020 (r368299) @@ -1496,7 +1496,7 @@ dwc_attach(device_t dev) uint32_t reg; char *phy_mode; phandle_t node; - uint32_t txpbl, rxpbl; + uint32_t txpbl, rxpbl, pbl; bool nopblx8 = false; bool fixed_burst = false; @@ -1516,10 +1516,12 @@ dwc_attach(device_t dev) OF_prop_free(phy_mode); } + if (OF_getencprop(node, "snps,pbl", &pbl, sizeof(uint32_t)) <= 0) + pbl = BUS_MODE_DEFAULT_PBL; if (OF_getencprop(node, "snps,txpbl", &txpbl, sizeof(uint32_t)) <= 0) - txpbl = 8; + txpbl = pbl; if (OF_getencprop(node, "snps,rxpbl", &rxpbl, sizeof(uint32_t)) <= 0) - rxpbl = 8; + rxpbl = pbl; if (OF_hasprop(node, "snps,no-pbl-x8") == 1) nopblx8 = true; if (OF_hasprop(node, "snps,fixed-burst") == 1) @@ -1569,6 +1571,7 @@ dwc_attach(device_t dev) reg |= (rxpbl << BUS_MODE_RPBL_SHIFT); if (fixed_burst) reg |= BUS_MODE_FIXEDBURST; + WRITE4(sc, BUS_MODE, reg); /* Modified: head/sys/dev/dwc/if_dwc.h ============================================================================== --- head/sys/dev/dwc/if_dwc.h Thu Dec 3 10:41:06 2020 (r368298) +++ head/sys/dev/dwc/if_dwc.h Thu Dec 3 11:15:49 2020 (r368299) @@ -229,8 +229,8 @@ #define BUS_MODE_PRIORXTX_21 1 #define BUS_MODE_PRIORXTX_11 0 #define BUS_MODE_PBL_SHIFT 8 /* Single block transfer size */ -#define BUS_MODE_PBL_BEATS_8 8 #define BUS_MODE_SWR (1 << 0) /* Reset */ +#define BUS_MODE_DEFAULT_PBL 8 #define TRANSMIT_POLL_DEMAND 0x1004 #define RECEIVE_POLL_DEMAND 0x1008 #define RX_DESCR_LIST_ADDR 0x100C From owner-svn-src-head@freebsd.org Thu Dec 3 11:59:40 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B5BF04A43A2; Thu, 3 Dec 2020 11:59:40 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CmvXD4mQ8z3hmV; Thu, 3 Dec 2020 11:59:40 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 9250518C71; Thu, 3 Dec 2020 11:59:40 +0000 (UTC) (envelope-from avg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B3Bxef6017005; Thu, 3 Dec 2020 11:59:40 GMT (envelope-from avg@FreeBSD.org) Received: (from avg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B3Bxekh017004; Thu, 3 Dec 2020 11:59:40 GMT (envelope-from avg@FreeBSD.org) Message-Id: <202012031159.0B3Bxekh017004@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: avg set sender to avg@FreeBSD.org using -f From: Andriy Gapon Date: Thu, 3 Dec 2020 11:59:40 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368300 - head/cddl/contrib/opensolaris/cmd/dtrace X-SVN-Group: head X-SVN-Commit-Author: avg X-SVN-Commit-Paths: head/cddl/contrib/opensolaris/cmd/dtrace X-SVN-Commit-Revision: 368300 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Dec 2020 11:59:40 -0000 Author: avg Date: Thu Dec 3 11:59:40 2020 New Revision: 368300 URL: https://svnweb.freebsd.org/changeset/base/368300 Log: dtrace: honor LC_NUMERIC for %'d and alike, and LC_TIME for %T Note that the public documentation on dtrace.org fails to mention %T and incorrectly documents %Y. The latter actually uses format "%Y %b %e %T" where %b is always in C locale. Discussed with: markj MFC after: 1 month Sponsored by: Panzura Modified: head/cddl/contrib/opensolaris/cmd/dtrace/dtrace.c Modified: head/cddl/contrib/opensolaris/cmd/dtrace/dtrace.c ============================================================================== --- head/cddl/contrib/opensolaris/cmd/dtrace/dtrace.c Thu Dec 3 11:15:49 2020 (r368299) +++ head/cddl/contrib/opensolaris/cmd/dtrace/dtrace.c Thu Dec 3 11:59:40 2020 (r368300) @@ -51,6 +51,7 @@ #include #endif #ifdef __FreeBSD__ +#include #include #endif @@ -1315,6 +1316,14 @@ main(int argc, char *argv[]) char *p, **v; struct ps_prochandle *P; pid_t pid; + +#ifdef __FreeBSD__ + /* For %'d and the like. */ + (void) setlocale(LC_NUMERIC, ""); + + /* For %T. */ + (void) setlocale(LC_TIME, ""); +#endif g_pname = basename(argv[0]); From owner-svn-src-head@freebsd.org Thu Dec 3 14:41:12 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 488C84A7DE1; Thu, 3 Dec 2020 14:41:12 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Cmz6c1gldz3qts; Thu, 3 Dec 2020 14:41:12 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2C8F11B055; Thu, 3 Dec 2020 14:41:12 +0000 (UTC) (envelope-from emaste@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B3EfBIq015424; Thu, 3 Dec 2020 14:41:11 GMT (envelope-from emaste@FreeBSD.org) Received: (from emaste@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B3EfBkK015423; Thu, 3 Dec 2020 14:41:11 GMT (envelope-from emaste@FreeBSD.org) Message-Id: <202012031441.0B3EfBkK015423@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: emaste set sender to emaste@FreeBSD.org using -f From: Ed Maste Date: Thu, 3 Dec 2020 14:41:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368302 - head/contrib/elftoolchain/addr2line X-SVN-Group: head X-SVN-Commit-Author: emaste X-SVN-Commit-Paths: head/contrib/elftoolchain/addr2line X-SVN-Commit-Revision: 368302 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Dec 2020 14:41:12 -0000 Author: emaste Date: Thu Dec 3 14:41:11 2020 New Revision: 368302 URL: https://svnweb.freebsd.org/changeset/base/368302 Log: addr2line: fix allocation leak in error path CID: 1437677 Reported by: Coverity Scan Sponsored by: The FreeBSD Foundation Modified: head/contrib/elftoolchain/addr2line/addr2line.c Modified: head/contrib/elftoolchain/addr2line/addr2line.c ============================================================================== --- head/contrib/elftoolchain/addr2line/addr2line.c Thu Dec 3 14:04:42 2020 (r368301) +++ head/contrib/elftoolchain/addr2line/addr2line.c Thu Dec 3 14:41:11 2020 (r368302) @@ -491,6 +491,7 @@ check_labels(Dwarf_Debug dbg, Dwarf_Die die, Dwarf_Uns if (dwarf_tag(prev_die, &tag, &de) != DW_DLV_OK) { warnx("dwarf_tag failed: %s", dwarf_errmsg(de)); + free(labels); return DW_DLV_ERROR; } if (tag == DW_TAG_label) { From owner-svn-src-head@freebsd.org Thu Dec 3 15:05:23 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8FA7B4A84BA; Thu, 3 Dec 2020 15:05:23 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-il1-f180.google.com (mail-il1-f180.google.com [209.85.166.180]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CmzfV4tqWz3rxW; Thu, 3 Dec 2020 15:05:22 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: by mail-il1-f180.google.com with SMTP id y9so2213492ilb.0; Thu, 03 Dec 2020 07:05:22 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=QvH6oRf+cg9AApPejOQ9sZH6ioe1EYl2OzuUwN9FTko=; b=ZEEFpCsOGlolbKvduHk2BfSON6X3n+190aAHSDogkqGH8EhBfENCacxI5wOQq8EfRV WDYH17eOF+IocLE3ry1HxO6srWuO3SxzE0uWghifKIp/O/N3rrd92U3p6FQL0EuGwpoq By62TPNcUxEPdEBLLVnCozoH8IBUzB5n9bRignaUg0TrRE94uTBN5ABjfi75E3A92jXC d6efBSOCghEe5CCQLgQC9g1Q2BTjBVorO9vhbjTHDGXp1pY1NuDgdza8DGvIZixyXNVg kFOhBvMrLKRv894YDUChHh5i0XfXThky/yAK17uLdfyhpfYbpZr15d+7jeU5XWaV7T+N yvQg== X-Gm-Message-State: AOAM533Rk5OWukK3VNrUNrN8ACrzwjbIXjuFi/Skn/hIr5dl4SZj0VjX GD5Y/ybQYPOnAWVwbAFrLygCjbmQ5xcOY9FWiDrFCbh8k1aNeeIL X-Google-Smtp-Source: ABdhPJxWDXy14vut5NeS3Gr9WepMHse9ICeAyMm7+hmnQAA7oh3W9GI9qvDZH6+kXgVMaMGZD2532Kd3ZXYKjq5AY4Y= X-Received: by 2002:a92:cd51:: with SMTP id v17mr3386581ilq.98.1607007921793; Thu, 03 Dec 2020 07:05:21 -0800 (PST) MIME-Version: 1.0 References: <202010192037.09JKbcAY079308@repo.freebsd.org> <202012030418.0B34Ip8X002739@slippy.cwsent.com> In-Reply-To: <202012030418.0B34Ip8X002739@slippy.cwsent.com> From: Ed Maste Date: Thu, 3 Dec 2020 10:05:09 -0500 Message-ID: Subject: Re: svn commit: r366857 - head/libexec/rc/rc.d To: Cy Schubert Cc: John Baldwin , Cy Schubert , src-committers , svn-src-all , svn-src-head Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4CmzfV4tqWz3rxW X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=none; dmarc=none; spf=pass (mx1.freebsd.org: domain of carpeddiem@gmail.com designates 209.85.166.180 as permitted sender) smtp.mailfrom=carpeddiem@gmail.com X-Spamd-Result: default: False [-3.00 / 15.00]; RCVD_TLS_ALL(0.00)[]; FREEMAIL_ENVFROM(0.00)[gmail.com]; FREEFALL_USER(0.00)[carpeddiem]; FROM_HAS_DN(0.00)[]; RBL_DBL_DONT_QUERY_IPS(0.00)[209.85.166.180:from]; R_SPF_ALLOW(-0.20)[+ip4:209.85.128.0/17]; NEURAL_HAM_LONG(-1.00)[-1.000]; MIME_GOOD(-0.10)[text/plain]; DMARC_NA(0.00)[freebsd.org]; ARC_NA(0.00)[]; RCPT_COUNT_FIVE(0.00)[6]; SPAMHAUS_ZRD(0.00)[209.85.166.180:from:127.0.2.255]; TO_MATCH_ENVRCPT_SOME(0.00)[]; TO_DN_ALL(0.00)[]; NEURAL_HAM_SHORT(-1.00)[-1.000]; RCVD_IN_DNSWL_NONE(0.00)[209.85.166.180:from]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; FORGED_SENDER(0.30)[emaste@freebsd.org,carpeddiem@gmail.com]; RWL_MAILSPIKE_POSSIBLE(0.00)[209.85.166.180:from]; R_DKIM_NA(0.00)[]; MIME_TRACE(0.00)[0:+]; ASN(0.00)[asn:15169, ipnet:209.85.128.0/17, country:US]; FROM_NEQ_ENVFROM(0.00)[emaste@freebsd.org,carpeddiem@gmail.com]; MAILMAN_DEST(0.00)[svn-src-all,svn-src-head]; RCVD_COUNT_TWO(0.00)[2] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Dec 2020 15:05:23 -0000 On Wed, 2 Dec 2020 at 23:19, Cy Schubert wrote: > > I've been looking at this earlier today, a different issue. > > This reverts r366857 and adds netifdown to run almost prior to shutdown. The netbooted pine64 hwlab CI job has been mostly failing since the original change as well as it appears the root filesystem disappears before shutdown is complete: ``` root@pinea64-cidev:~ # poweroff poweroff Shutdown NOW! poweroff: [pid 796] root@pinea64-cidev:~ # System shutdown Stopping devd. Waiting for PIDS: 492. nfs server 10.0.0.1:/b/tftpboot/pinea64/install/: not responding ``` https://ci.freebsd.org/hwlab/job/FreeBSD-device-head-pinea64-test/ Once the potential fix makes it into the tree I'll check on this again. From owner-svn-src-head@freebsd.org Thu Dec 3 16:55:00 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 532294AA960; Thu, 3 Dec 2020 16:55:00 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Cn2501tKTz4Tcq; Thu, 3 Dec 2020 16:55:00 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 336501C762; Thu, 3 Dec 2020 16:55:00 +0000 (UTC) (envelope-from adrian@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B3Gt0Am002809; Thu, 3 Dec 2020 16:55:00 GMT (envelope-from adrian@FreeBSD.org) Received: (from adrian@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B3Gsx7j002768; Thu, 3 Dec 2020 16:54:59 GMT (envelope-from adrian@FreeBSD.org) Message-Id: <202012031654.0B3Gsx7j002768@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: adrian set sender to adrian@FreeBSD.org using -f From: Adrian Chadd Date: Thu, 3 Dec 2020 16:54:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368305 - head/sys/dev/axgbe X-SVN-Group: head X-SVN-Commit-Author: adrian X-SVN-Commit-Paths: head/sys/dev/axgbe X-SVN-Commit-Revision: 368305 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Dec 2020 16:55:00 -0000 Author: adrian Date: Thu Dec 3 16:54:59 2020 New Revision: 368305 URL: https://svnweb.freebsd.org/changeset/base/368305 Log: [axgbe] Fix compiler warnings in gcc-6.3; perhaps fix a PHY issue * uninitialised variable use * Using AXGBE_SET_ADV() where it was intended; using AXGBE_ADV() seems wrong and also causes a compiler warning. Reviewed by: rpokala Differential Revision: https://reviews.freebsd.org/D26839 Modified: head/sys/dev/axgbe/xgbe-dev.c head/sys/dev/axgbe/xgbe-mdio.c head/sys/dev/axgbe/xgbe-phy-v2.c Modified: head/sys/dev/axgbe/xgbe-dev.c ============================================================================== --- head/sys/dev/axgbe/xgbe-dev.c Thu Dec 3 15:55:07 2020 (r368304) +++ head/sys/dev/axgbe/xgbe-dev.c Thu Dec 3 16:54:59 2020 (r368305) @@ -1337,7 +1337,7 @@ xgbe_dev_read(struct xgbe_channel *channel) struct xgbe_ring_data *rdata; struct xgbe_ring_desc *rdesc; struct xgbe_packet_data *packet = &ring->packet_data; - unsigned int err, etlt, l34t; + unsigned int err, etlt, l34t = 0; axgbe_printf(1, "-->xgbe_dev_read: cur = %d\n", ring->cur); Modified: head/sys/dev/axgbe/xgbe-mdio.c ============================================================================== --- head/sys/dev/axgbe/xgbe-mdio.c Thu Dec 3 15:55:07 2020 (r368304) +++ head/sys/dev/axgbe/xgbe-mdio.c Thu Dec 3 16:54:59 2020 (r368305) @@ -1186,7 +1186,7 @@ static int __xgbe_phy_config_aneg(struct xgbe_prv_data *pdata, bool set_mode) { int ret; - unsigned int reg; + unsigned int reg = 0; sx_xlock(&pdata->an_mutex); Modified: head/sys/dev/axgbe/xgbe-phy-v2.c ============================================================================== --- head/sys/dev/axgbe/xgbe-phy-v2.c Thu Dec 3 15:55:07 2020 (r368304) +++ head/sys/dev/axgbe/xgbe-phy-v2.c Thu Dec 3 16:54:59 2020 (r368305) @@ -2706,7 +2706,7 @@ xgbe_upd_link(struct xgbe_prv_data *pdata) static int xgbe_phy_read_status(struct xgbe_prv_data *pdata) { - int common_adv_gb; + int common_adv_gb = 0; int common_adv; int lpagb = 0; int adv, lpa; @@ -2741,9 +2741,9 @@ xgbe_phy_read_status(struct xgbe_prv_data *pdata) } if (pdata->phy.supported == SUPPORTED_1000baseT_Half) - XGBE_ADV(&pdata->phy, 1000baseT_Half); + XGBE_SET_ADV(&pdata->phy, 1000baseT_Half); else if (pdata->phy.supported == SUPPORTED_1000baseT_Full) - XGBE_ADV(&pdata->phy, 1000baseT_Full); + XGBE_SET_ADV(&pdata->phy, 1000baseT_Full); common_adv_gb = lpagb & adv << 2; } @@ -2753,7 +2753,7 @@ xgbe_phy_read_status(struct xgbe_prv_data *pdata) return (lpa); if (pdata->phy.supported == SUPPORTED_Autoneg) - XGBE_ADV(&pdata->phy, Autoneg); + XGBE_SET_ADV(&pdata->phy, Autoneg); adv = xgbe_phy_mii_read(pdata, pdata->mdio_addr, MII_ANAR); if (adv < 0) From owner-svn-src-head@freebsd.org Thu Dec 3 17:10:00 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D4AC64AB13E; Thu, 3 Dec 2020 17:10:00 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Cn2QJ5kMRz4Vdw; Thu, 3 Dec 2020 17:10:00 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B76ED1CE96; Thu, 3 Dec 2020 17:10:00 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B3HA0I4009188; Thu, 3 Dec 2020 17:10:00 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B3HA0Ph009187; Thu, 3 Dec 2020 17:10:00 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202012031710.0B3HA0Ph009187@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 3 Dec 2020 17:10:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368306 - head/sys/cddl/dev/sdt X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: head/sys/cddl/dev/sdt X-SVN-Commit-Revision: 368306 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Dec 2020 17:10:00 -0000 Author: markj Date: Thu Dec 3 17:10:00 2020 New Revision: 368306 URL: https://svnweb.freebsd.org/changeset/base/368306 Log: sdt: Create providers and probes in separate passes when loading sdt.ko The sdt module's load handler iterates over SDT linker sets for the kernel and all loaded modules to create probes and providers defined by SDT(9). Probes in one module may belong to a provider in a different module, but when a probe is created we assume that the provider is already defined. To maintain this invariant, modify the load handler to perform two separate passes over loaded modules: one to define providers and the other to define probes. The problem manifests when loading linux.ko, which depends on linux_common.ko, which defines providers used by probes defined in linux.ko. Reported by: gallatin MFC after: 2 weeks Sponsored by: The FreeBSD Foundation Modified: head/sys/cddl/dev/sdt/sdt.c Modified: head/sys/cddl/dev/sdt/sdt.c ============================================================================== --- head/sys/cddl/dev/sdt/sdt.c Thu Dec 3 16:54:59 2020 (r368305) +++ head/sys/cddl/dev/sdt/sdt.c Thu Dec 3 17:10:00 2020 (r368306) @@ -272,26 +272,24 @@ sdt_destroy(void *arg, dtrace_id_t id, void *parg) { } -/* - * Called from the kernel linker when a module is loaded, before - * dtrace_module_loaded() is called. This is done so that it's possible to - * register new providers when modules are loaded. The DTrace framework - * explicitly disallows calling into the framework from the provide_module - * provider method, so we cannot do this there. - */ static void -sdt_kld_load(void *arg __unused, struct linker_file *lf) +sdt_kld_load_providers(struct linker_file *lf) { struct sdt_provider **prov, **begin, **end; - struct sdt_probe **probe, **p_begin, **p_end; - struct sdt_argtype **argtype, **a_begin, **a_end; if (linker_file_lookup_set(lf, "sdt_providers_set", &begin, &end, NULL) == 0) { for (prov = begin; prov < end; prov++) sdt_create_provider(*prov); } +} +static void +sdt_kld_load_probes(struct linker_file *lf) +{ + struct sdt_probe **probe, **p_begin, **p_end; + struct sdt_argtype **argtype, **a_begin, **a_end; + if (linker_file_lookup_set(lf, "sdt_probes_set", &p_begin, &p_end, NULL) == 0) { for (probe = p_begin; probe < p_end; probe++) { @@ -311,7 +309,21 @@ sdt_kld_load(void *arg __unused, struct linker_file *l } } +/* + * Called from the kernel linker when a module is loaded, before + * dtrace_module_loaded() is called. This is done so that it's possible to + * register new providers when modules are loaded. The DTrace framework + * explicitly disallows calling into the framework from the provide_module + * provider method, so we cannot do this there. + */ static void +sdt_kld_load(void *arg __unused, struct linker_file *lf) +{ + sdt_kld_load_providers(lf); + sdt_kld_load_probes(lf); +} + +static void sdt_kld_unload_try(void *arg __unused, struct linker_file *lf, int *error) { struct sdt_provider *prov, **curr, **begin, **end, *tmp; @@ -349,16 +361,21 @@ sdt_kld_unload_try(void *arg __unused, struct linker_f } static int -sdt_linker_file_cb(linker_file_t lf, void *arg __unused) +sdt_load_providers_cb(linker_file_t lf, void *arg __unused) { + sdt_kld_load_providers(lf); + return (0); +} - sdt_kld_load(NULL, lf); - +static int +sdt_load_probes_cb(linker_file_t lf, void *arg __unused) +{ + sdt_kld_load_probes(lf); return (0); } static void -sdt_load() +sdt_load(void) { TAILQ_INIT(&sdt_prov_list); @@ -370,12 +387,17 @@ sdt_load() sdt_kld_unload_try_tag = EVENTHANDLER_REGISTER(kld_unload_try, sdt_kld_unload_try, NULL, EVENTHANDLER_PRI_ANY); - /* Pick up probes from the kernel and already-loaded linker files. */ - linker_file_foreach(sdt_linker_file_cb, NULL); + /* + * Pick up probes from the kernel and already-loaded linker files. + * Define providers in a separate pass since a linker file may be using + * providers defined in a file that appears later in the list. + */ + linker_file_foreach(sdt_load_providers_cb, NULL); + linker_file_foreach(sdt_load_probes_cb, NULL); } static int -sdt_unload() +sdt_unload(void) { struct sdt_provider *prov, *tmp; int ret; From owner-svn-src-head@freebsd.org Thu Dec 3 17:12:33 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F31354AB2E3; Thu, 3 Dec 2020 17:12:33 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Cn2TF6bKnz4Vjv; Thu, 3 Dec 2020 17:12:33 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D52341CF2D; Thu, 3 Dec 2020 17:12:33 +0000 (UTC) (envelope-from markj@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B3HCXvL015030; Thu, 3 Dec 2020 17:12:33 GMT (envelope-from markj@FreeBSD.org) Received: (from markj@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B3HCVK6015019; Thu, 3 Dec 2020 17:12:31 GMT (envelope-from markj@FreeBSD.org) Message-Id: <202012031712.0B3HCVK6015019@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: markj set sender to markj@FreeBSD.org using -f From: Mark Johnston Date: Thu, 3 Dec 2020 17:12:31 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368307 - in head: lib/libkvm sys/arm/arm sys/kern sys/mips/mips X-SVN-Group: head X-SVN-Commit-Author: markj X-SVN-Commit-Paths: in head: lib/libkvm sys/arm/arm sys/kern sys/mips/mips X-SVN-Commit-Revision: 368307 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Dec 2020 17:12:34 -0000 Author: markj Date: Thu Dec 3 17:12:31 2020 New Revision: 368307 URL: https://svnweb.freebsd.org/changeset/base/368307 Log: Always use 64-bit physical addresses for dump_avail[] in minidumps As of r365978, minidumps include a copy of dump_avail[]. This is an array of vm_paddr_t ranges. libkvm walks the array assuming that sizeof(vm_paddr_t) is equal to the platform "word size", but that's not correct on some platforms. For instance, i386 uses a 64-bit vm_paddr_t. Fix the problem by always dumping 64-bit addresses. On platforms where vm_paddr_t is 32 bits wide, namely arm and mips (sometimes), translate dump_avail[] to an array of uint64_t ranges. With this change, libkvm no longer needs to maintain a notion of the target word size, so get rid of it. This is a no-op on platforms where sizeof(vm_paddr_t) == 8. Reviewed by: alc, kib Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D27082 Modified: head/lib/libkvm/kvm_minidump_aarch64.c head/lib/libkvm/kvm_minidump_amd64.c head/lib/libkvm/kvm_minidump_arm.c head/lib/libkvm/kvm_minidump_i386.c head/lib/libkvm/kvm_minidump_mips.c head/lib/libkvm/kvm_minidump_powerpc64.c head/lib/libkvm/kvm_minidump_riscv.c head/lib/libkvm/kvm_private.c head/lib/libkvm/kvm_private.h head/sys/arm/arm/minidump_machdep.c head/sys/kern/kern_dump.c head/sys/mips/mips/minidump_machdep.c Modified: head/lib/libkvm/kvm_minidump_aarch64.c ============================================================================== --- head/lib/libkvm/kvm_minidump_aarch64.c Thu Dec 3 17:10:00 2020 (r368306) +++ head/lib/libkvm/kvm_minidump_aarch64.c Thu Dec 3 17:12:31 2020 (r368307) @@ -127,8 +127,7 @@ _aarch64_minidump_initvtop(kvm_t *kd) sparse_off = off + aarch64_round_page(vmst->hdr.bitmapsize) + aarch64_round_page(vmst->hdr.pmapsize); if (_kvm_pt_init(kd, vmst->hdr.dumpavailsize, dump_avail_off, - vmst->hdr.bitmapsize, off, sparse_off, AARCH64_PAGE_SIZE, - sizeof(uint64_t)) == -1) { + vmst->hdr.bitmapsize, off, sparse_off, AARCH64_PAGE_SIZE) == -1) { return (-1); } off += aarch64_round_page(vmst->hdr.bitmapsize); Modified: head/lib/libkvm/kvm_minidump_amd64.c ============================================================================== --- head/lib/libkvm/kvm_minidump_amd64.c Thu Dec 3 17:10:00 2020 (r368306) +++ head/lib/libkvm/kvm_minidump_amd64.c Thu Dec 3 17:12:31 2020 (r368307) @@ -169,8 +169,7 @@ _amd64_minidump_initvtop(kvm_t *kd) sparse_off = off + amd64_round_page(vmst->hdr.bitmapsize) + amd64_round_page(vmst->hdr.pmapsize); if (_kvm_pt_init(kd, vmst->hdr.dumpavailsize, dump_avail_off, - vmst->hdr.bitmapsize, off, sparse_off, AMD64_PAGE_SIZE, - sizeof(uint64_t)) == -1) { + vmst->hdr.bitmapsize, off, sparse_off, AMD64_PAGE_SIZE) == -1) { return (-1); } off += amd64_round_page(vmst->hdr.bitmapsize); Modified: head/lib/libkvm/kvm_minidump_arm.c ============================================================================== --- head/lib/libkvm/kvm_minidump_arm.c Thu Dec 3 17:10:00 2020 (r368306) +++ head/lib/libkvm/kvm_minidump_arm.c Thu Dec 3 17:12:31 2020 (r368307) @@ -135,8 +135,7 @@ _arm_minidump_initvtop(kvm_t *kd) sparse_off = off + arm_round_page(vmst->hdr.bitmapsize) + arm_round_page(vmst->hdr.ptesize); if (_kvm_pt_init(kd, vmst->hdr.dumpavailsize, dump_avail_off, - vmst->hdr.bitmapsize, off, sparse_off, ARM_PAGE_SIZE, - sizeof(uint32_t)) == -1) { + vmst->hdr.bitmapsize, off, sparse_off, ARM_PAGE_SIZE) == -1) { return (-1); } off += arm_round_page(vmst->hdr.bitmapsize); Modified: head/lib/libkvm/kvm_minidump_i386.c ============================================================================== --- head/lib/libkvm/kvm_minidump_i386.c Thu Dec 3 17:10:00 2020 (r368306) +++ head/lib/libkvm/kvm_minidump_i386.c Thu Dec 3 17:12:31 2020 (r368307) @@ -131,8 +131,7 @@ _i386_minidump_initvtop(kvm_t *kd) sparse_off = off + i386_round_page(vmst->hdr.bitmapsize) + i386_round_page(vmst->hdr.ptesize); if (_kvm_pt_init(kd, vmst->hdr.dumpavailsize, dump_avail_off, - vmst->hdr.bitmapsize, off, sparse_off, I386_PAGE_SIZE, - sizeof(uint32_t)) == -1) { + vmst->hdr.bitmapsize, off, sparse_off, I386_PAGE_SIZE) == -1) { return (-1); } off += i386_round_page(vmst->hdr.bitmapsize); Modified: head/lib/libkvm/kvm_minidump_mips.c ============================================================================== --- head/lib/libkvm/kvm_minidump_mips.c Thu Dec 3 17:10:00 2020 (r368306) +++ head/lib/libkvm/kvm_minidump_mips.c Thu Dec 3 17:12:31 2020 (r368307) @@ -136,8 +136,7 @@ _mips_minidump_initvtop(kvm_t *kd) sparse_off = off + mips_round_page(vmst->hdr.bitmapsize) + mips_round_page(vmst->hdr.ptesize); if (_kvm_pt_init(kd, vmst->hdr.dumpavailsize, dump_avail_off, - vmst->hdr.bitmapsize, off, sparse_off, MIPS_PAGE_SIZE, - sizeof(uint32_t)) == -1) { + vmst->hdr.bitmapsize, off, sparse_off, MIPS_PAGE_SIZE) == -1) { return (-1); } off += mips_round_page(vmst->hdr.bitmapsize); Modified: head/lib/libkvm/kvm_minidump_powerpc64.c ============================================================================== --- head/lib/libkvm/kvm_minidump_powerpc64.c Thu Dec 3 17:10:00 2020 (r368306) +++ head/lib/libkvm/kvm_minidump_powerpc64.c Thu Dec 3 17:12:31 2020 (r368307) @@ -155,8 +155,7 @@ _powerpc64_minidump_initvtop(kvm_t *kd) /* build physical address lookup table for sparse pages */ if (_kvm_pt_init(kd, hdr->dumpavailsize, dump_avail_off, - hdr->bitmapsize, bitmap_off, sparse_off, PPC64_PAGE_SIZE, - sizeof(uint64_t)) == -1) + hdr->bitmapsize, bitmap_off, sparse_off, PPC64_PAGE_SIZE) == -1) goto failed; if (_kvm_pmap_init(kd, hdr->pmapsize, pmap_off) == -1) Modified: head/lib/libkvm/kvm_minidump_riscv.c ============================================================================== --- head/lib/libkvm/kvm_minidump_riscv.c Thu Dec 3 17:10:00 2020 (r368306) +++ head/lib/libkvm/kvm_minidump_riscv.c Thu Dec 3 17:12:31 2020 (r368307) @@ -128,8 +128,7 @@ _riscv_minidump_initvtop(kvm_t *kd) sparse_off = off + riscv_round_page(vmst->hdr.bitmapsize) + riscv_round_page(vmst->hdr.pmapsize); if (_kvm_pt_init(kd, vmst->hdr.dumpavailsize, dump_avail_off, - vmst->hdr.bitmapsize, off, sparse_off, RISCV_PAGE_SIZE, - sizeof(uint64_t)) == -1) { + vmst->hdr.bitmapsize, off, sparse_off, RISCV_PAGE_SIZE) == -1) { return (-1); } off += riscv_round_page(vmst->hdr.bitmapsize); Modified: head/lib/libkvm/kvm_private.c ============================================================================== --- head/lib/libkvm/kvm_private.c Thu Dec 3 17:10:00 2020 (r368306) +++ head/lib/libkvm/kvm_private.c Thu Dec 3 17:12:31 2020 (r368307) @@ -291,8 +291,7 @@ _kvm_map_get(kvm_t *kd, u_long pa, unsigned int page_s int _kvm_pt_init(kvm_t *kd, size_t dump_avail_size, off_t dump_avail_off, - size_t map_len, off_t map_off, off_t sparse_off, int page_size, - int word_size) + size_t map_len, off_t map_off, off_t sparse_off, int page_size) { uint64_t *addr; uint32_t *popcount_bin; @@ -311,14 +310,8 @@ _kvm_pt_init(kvm_t *kd, size_t dump_avail_size, off_t * last_pa. Create an implied dump_avail that * expresses this. */ - kd->dump_avail = calloc(4, word_size); - if (word_size == sizeof(uint32_t)) { - ((uint32_t *)kd->dump_avail)[1] = _kvm32toh(kd, - map_len * 8 * page_size); - } else { - kd->dump_avail[1] = _kvm64toh(kd, - map_len * 8 * page_size); - } + kd->dump_avail = calloc(4, sizeof(uint64_t)); + kd->dump_avail[1] = _kvm64toh(kd, map_len * 8 * page_size); } /* @@ -375,7 +368,6 @@ _kvm_pt_init(kvm_t *kd, size_t dump_avail_size, off_t kd->pt_sparse_off = sparse_off; kd->pt_sparse_size = (uint64_t)*popcount_bin * page_size; kd->pt_page_size = page_size; - kd->pt_word_size = word_size; /* * Map the sparse page array. This is useful for performing point @@ -419,13 +411,7 @@ _kvm_pmap_init(kvm_t *kd, uint32_t pmap_size, off_t pm static inline uint64_t dump_avail_n(kvm_t *kd, long i) { - uint32_t *d32; - - if (kd->pt_word_size == sizeof(uint32_t)) { - d32 = (uint32_t *)kd->dump_avail; - return (_kvm32toh(kd, d32[i])); - } else - return (_kvm64toh(kd, kd->dump_avail[i])); + return (_kvm64toh(kd, kd->dump_avail[i])); } uint64_t Modified: head/lib/libkvm/kvm_private.h ============================================================================== --- head/lib/libkvm/kvm_private.h Thu Dec 3 17:10:00 2020 (r368306) +++ head/lib/libkvm/kvm_private.h Thu Dec 3 17:12:31 2020 (r368307) @@ -112,7 +112,6 @@ struct __kvm { uint64_t pt_sparse_size; uint32_t *pt_popcounts; unsigned int pt_page_size; - unsigned int pt_word_size; /* Page & sparse map structures. */ void *page_map; @@ -190,7 +189,7 @@ kvaddr_t _kvm_dpcpu_validaddr(kvm_t *, kvaddr_t); int _kvm_probe_elf_kernel(kvm_t *, int, int); int _kvm_is_minidump(kvm_t *); int _kvm_read_core_phdrs(kvm_t *, size_t *, GElf_Phdr **); -int _kvm_pt_init(kvm_t *, size_t, off_t, size_t, off_t, off_t, int, int); +int _kvm_pt_init(kvm_t *, size_t, off_t, size_t, off_t, off_t, int); off_t _kvm_pt_find(kvm_t *, uint64_t, unsigned int); int _kvm_visit_cb(kvm_t *, kvm_walk_pages_cb_t *, void *, u_long, u_long, u_long, vm_prot_t, size_t, unsigned int); Modified: head/sys/arm/arm/minidump_machdep.c ============================================================================== --- head/sys/arm/arm/minidump_machdep.c Thu Dec 3 17:10:00 2020 (r368306) +++ head/sys/arm/arm/minidump_machdep.c Thu Dec 3 17:12:31 2020 (r368307) @@ -169,18 +169,18 @@ blk_write(struct dumperinfo *di, char *ptr, vm_paddr_t } /* A buffer for general use. Its size must be one page at least. */ -static char dumpbuf[PAGE_SIZE]; +static char dumpbuf[PAGE_SIZE] __aligned(sizeof(uint64_t)); CTASSERT(sizeof(dumpbuf) % sizeof(pt2_entry_t) == 0); int minidumpsys(struct dumperinfo *di) { struct minidumphdr mdhdr; - uint64_t dumpsize; + uint64_t dumpsize, *dump_avail_buf; uint32_t ptesize; uint32_t pa, prev_pa = 0, count = 0; vm_offset_t va; - int error; + int error, i; char *addr; /* @@ -207,7 +207,7 @@ minidumpsys(struct dumperinfo *di) /* Calculate dump size. */ dumpsize = ptesize; dumpsize += round_page(msgbufp->msg_size); - dumpsize += round_page(sizeof(dump_avail)); + dumpsize += round_page(nitems(dump_avail) * sizeof(uint64_t)); dumpsize += round_page(BITSET_SIZE(vm_page_dump_pages)); VM_PAGE_DUMP_FOREACH(pa) { /* Clear out undumpable pages now if needed */ @@ -230,7 +230,8 @@ minidumpsys(struct dumperinfo *di) mdhdr.kernbase = KERNBASE; mdhdr.arch = __ARM_ARCH; mdhdr.mmuformat = MINIDUMP_MMU_FORMAT_V6; - mdhdr.dumpavailsize = round_page(sizeof(dump_avail)); + mdhdr.dumpavailsize = round_page(nitems(dump_avail) * sizeof(uint64_t)); + dump_init_header(di, &kdh, KERNELDUMPMAGIC, KERNELDUMP_ARM_VERSION, dumpsize); @@ -254,11 +255,15 @@ minidumpsys(struct dumperinfo *di) if (error) goto fail; - /* Dump dump_avail */ - _Static_assert(sizeof(dump_avail) <= sizeof(dumpbuf), + /* Dump dump_avail. Make a copy using 64-bit physical addresses. */ + _Static_assert(nitems(dump_avail) * sizeof(uint64_t) <= sizeof(dumpbuf), "Large dump_avail not handled"); bzero(dumpbuf, sizeof(dumpbuf)); - memcpy(dumpbuf, dump_avail, sizeof(dump_avail)); + dump_avail_buf = (uint64_t *)dumpbuf; + for (i = 0; dump_avail[i] != 0 || dump_avail[i + 1] != 0; i += 2) { + dump_avail_buf[i] = dump_avail[i]; + dump_avail_buf[i + 1] = dump_avail[i + 1]; + } error = blk_write(di, dumpbuf, 0, PAGE_SIZE); if (error) goto fail; Modified: head/sys/kern/kern_dump.c ============================================================================== --- head/sys/kern/kern_dump.c Thu Dec 3 17:10:00 2020 (r368306) +++ head/sys/kern/kern_dump.c Thu Dec 3 17:12:31 2020 (r368307) @@ -290,7 +290,7 @@ dumpsys_generic(struct dumperinfo *di) size_t hdrsz; int error; -#if !defined(__powerpc__) || defined(__powerpc64__) +#if MINIDUMP_PAGE_TRACKING == 1 if (do_minidump) return (minidumpsys(di)); #endif Modified: head/sys/mips/mips/minidump_machdep.c ============================================================================== --- head/sys/mips/mips/minidump_machdep.c Thu Dec 3 17:10:00 2020 (r368306) +++ head/sys/mips/mips/minidump_machdep.c Thu Dec 3 17:12:31 2020 (r368307) @@ -60,7 +60,7 @@ static struct kerneldumpheader kdh; /* Handle chunked writes. */ static uint64_t counter, progress, dumpsize; /* Just auxiliary bufffer */ -static char tmpbuffer[PAGE_SIZE]; +static char tmpbuffer[PAGE_SIZE] __aligned(sizeof(uint64_t)); extern pd_entry_t *kernel_segmap; @@ -165,6 +165,7 @@ int minidumpsys(struct dumperinfo *di) { struct minidumphdr mdhdr; + uint64_t *dump_avail_buf; uint32_t ptesize; vm_paddr_t pa; vm_offset_t prev_pte = 0; @@ -206,7 +207,7 @@ minidumpsys(struct dumperinfo *di) /* Calculate dump size. */ dumpsize = ptesize; dumpsize += round_page(msgbufp->msg_size); - dumpsize += round_page(sizeof(dump_avail)); + dumpsize += round_page(nitems(dump_avail) * sizeof(uint64_t)); dumpsize += round_page(BITSET_SIZE(vm_page_dump_pages)); VM_PAGE_DUMP_FOREACH(pa) { /* Clear out undumpable pages now if needed */ @@ -227,7 +228,7 @@ minidumpsys(struct dumperinfo *di) mdhdr.bitmapsize = round_page(BITSET_SIZE(vm_page_dump_pages)); mdhdr.ptesize = ptesize; mdhdr.kernbase = VM_MIN_KERNEL_ADDRESS; - mdhdr.dumpavailsize = round_page(sizeof(dump_avail)); + mdhdr.dumpavailsize = round_page(nitems(dump_avail) * sizeof(uint64_t)); dump_init_header(di, &kdh, KERNELDUMPMAGIC, KERNELDUMP_MIPS_VERSION, dumpsize); @@ -252,11 +253,19 @@ minidumpsys(struct dumperinfo *di) if (error) goto fail; - /* Dump dump_avail */ - _Static_assert(sizeof(dump_avail) <= sizeof(tmpbuffer), - "Large dump_avail not handled"); + /* Dump dump_avail. Make a copy using 64-bit physical addresses. */ + _Static_assert(nitems(dump_avail) * sizeof(uint64_t) <= + sizeof(tmpbuffer), "Large dump_avail not handled"); bzero(tmpbuffer, sizeof(tmpbuffer)); - memcpy(tmpbuffer, dump_avail, sizeof(dump_avail)); + if (sizeof(dump_avail[0]) != sizeof(uint64_t)) { + dump_avail_buf = (uint64_t *)tmpbuffer; + for (i = 0; dump_avail[i] != 0 || dump_avail[i + 1] != 0; i++) { + dump_avail_buf[i] = dump_avail[i]; + dump_avail_buf[i + 1] = dump_avail[i + 1]; + } + } else { + memcpy(tmpbuffer, dump_avail, sizeof(dump_avail)); + } error = write_buffer(di, tmpbuffer, PAGE_SIZE); if (error) goto fail; From owner-svn-src-head@freebsd.org Thu Dec 3 19:26:22 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5587C4ADDEF; Thu, 3 Dec 2020 19:26:22 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Cn5Rf20Mlz4fK4; Thu, 3 Dec 2020 19:26:22 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 32FE21E839; Thu, 3 Dec 2020 19:26:22 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B3JQM84095727; Thu, 3 Dec 2020 19:26:22 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B3JQMlB095726; Thu, 3 Dec 2020 19:26:22 GMT (envelope-from dim@FreeBSD.org) Message-Id: <202012031926.0B3JQMlB095726@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Thu, 3 Dec 2020 19:26:22 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368308 - head/contrib/llvm-project/llvm/lib/Support/Unix X-SVN-Group: head X-SVN-Commit-Author: dim X-SVN-Commit-Paths: head/contrib/llvm-project/llvm/lib/Support/Unix X-SVN-Commit-Revision: 368308 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Dec 2020 19:26:22 -0000 Author: dim Date: Thu Dec 3 19:26:21 2020 New Revision: 368308 URL: https://svnweb.freebsd.org/changeset/base/368308 Log: Revert r367815, so we can apply the slightly different version that landed upstream: For llvm's internal function which retrieves the number of available "hardware threads", use cpuset_getaffinity(2) on FreeBSD, so it will honor processor sets configured by the cpuset(1) command. This should make it possible to avoid e.g. lld creating a huge number of threads on a machine with many cores, even for linking simple programs. This will also be submitted upstream. Submitted by: mjg Modified: head/contrib/llvm-project/llvm/lib/Support/Unix/Threading.inc Modified: head/contrib/llvm-project/llvm/lib/Support/Unix/Threading.inc ============================================================================== --- head/contrib/llvm-project/llvm/lib/Support/Unix/Threading.inc Thu Dec 3 17:12:31 2020 (r368307) +++ head/contrib/llvm-project/llvm/lib/Support/Unix/Threading.inc Thu Dec 3 19:26:21 2020 (r368308) @@ -26,10 +26,6 @@ #include // For pthread_getthreadid_np() / pthread_set_name_np() #endif -#if defined(__FreeBSD__) -#include -#endif - #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) #include #include @@ -286,13 +282,6 @@ SetThreadPriorityResult llvm::set_thread_priority(Thre #include int computeHostNumHardwareThreads() { -#ifdef __FreeBSD__ - cpuset_t mask; - CPU_ZERO(&mask); - if (cpuset_getaffinity(CPU_LEVEL_WHICH, CPU_WHICH_TID, -1, sizeof(mask), - &mask) == 0) - return CPU_COUNT(&mask); -#endif #ifdef __linux__ cpu_set_t Set; if (sched_getaffinity(0, sizeof(Set), &Set) == 0) From owner-svn-src-head@freebsd.org Thu Dec 3 19:29:19 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 66D774ADC56; Thu, 3 Dec 2020 19:29:19 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Cn5W32W44z4fSZ; Thu, 3 Dec 2020 19:29:19 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 44DAC1EAB0; Thu, 3 Dec 2020 19:29:19 +0000 (UTC) (envelope-from dim@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B3JTJvY095896; Thu, 3 Dec 2020 19:29:19 GMT (envelope-from dim@FreeBSD.org) Received: (from dim@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B3JTJjn095895; Thu, 3 Dec 2020 19:29:19 GMT (envelope-from dim@FreeBSD.org) Message-Id: <202012031929.0B3JTJjn095895@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: dim set sender to dim@FreeBSD.org using -f From: Dimitry Andric Date: Thu, 3 Dec 2020 19:29:19 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368309 - head/contrib/llvm-project/llvm/lib/Support/Unix X-SVN-Group: head X-SVN-Commit-Author: dim X-SVN-Commit-Paths: head/contrib/llvm-project/llvm/lib/Support/Unix X-SVN-Commit-Revision: 368309 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Dec 2020 19:29:19 -0000 Author: dim Date: Thu Dec 3 19:29:18 2020 New Revision: 368309 URL: https://svnweb.freebsd.org/changeset/base/368309 Log: Merge commit d989ffd10 from llvm git (by Dimitry Andric): Implement computeHostNumHardwareThreads() for FreeBSD This retrieves CPU affinity via FreeBSD's cpuset(2) API, and makes LLVM respect affinity settings configured by the user via the cpuset(1) command. In particular, this allows to reduce the number of threads used on machines with high core counts, which can interact badly with parallelized build systems. This is particularly noticable with lld, which spawns lots of threads even for linking e.g. hello_world! This fix is related to PR48193, but does not adress the more fundamental problem, which is that LLVM by default grabs as many CPUs and/or threads as possible. Reviewed By: MaskRay Differential Revision: https://reviews.llvm.org/D92271 Originally by: mjg MFC after: 1 week Modified: head/contrib/llvm-project/llvm/lib/Support/Unix/Threading.inc Modified: head/contrib/llvm-project/llvm/lib/Support/Unix/Threading.inc ============================================================================== --- head/contrib/llvm-project/llvm/lib/Support/Unix/Threading.inc Thu Dec 3 19:26:21 2020 (r368308) +++ head/contrib/llvm-project/llvm/lib/Support/Unix/Threading.inc Thu Dec 3 19:29:18 2020 (r368309) @@ -28,6 +28,7 @@ #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) #include +#include #include #include #include @@ -282,7 +283,13 @@ SetThreadPriorityResult llvm::set_thread_priority(Thre #include int computeHostNumHardwareThreads() { -#ifdef __linux__ +#if defined(__FreeBSD__) + cpuset_t mask; + CPU_ZERO(&mask); + if (cpuset_getaffinity(CPU_LEVEL_WHICH, CPU_WHICH_TID, -1, sizeof(mask), + &mask) == 0) + return CPU_COUNT(&mask); +#elif defined(__linux__) cpu_set_t Set; if (sched_getaffinity(0, sizeof(Set), &Set) == 0) return CPU_COUNT(&Set); From owner-svn-src-head@freebsd.org Thu Dec 3 21:38:00 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E36514B029E; Thu, 3 Dec 2020 21:38:00 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Cn8MX67Zwz4mvV; Thu, 3 Dec 2020 21:38:00 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C08A1203DE; Thu, 3 Dec 2020 21:38:00 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B3Lc0Nv078270; Thu, 3 Dec 2020 21:38:00 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B3Lc0q5078269; Thu, 3 Dec 2020 21:38:00 GMT (envelope-from np@FreeBSD.org) Message-Id: <202012032138.0B3Lc0q5078269@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Thu, 3 Dec 2020 21:38:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368310 - head/share/man/man9 X-SVN-Group: head X-SVN-Commit-Author: np X-SVN-Commit-Paths: head/share/man/man9 X-SVN-Commit-Revision: 368310 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Dec 2020 21:38:01 -0000 Author: np Date: Thu Dec 3 21:38:00 2020 New Revision: 368310 URL: https://svnweb.freebsd.org/changeset/base/368310 Log: Fix typo in kern_testfrwk.9. Modified: head/share/man/man9/kern_testfrwk.9 Modified: head/share/man/man9/kern_testfrwk.9 ============================================================================== --- head/share/man/man9/kern_testfrwk.9 Thu Dec 3 19:29:18 2020 (r368309) +++ head/share/man/man9/kern_testfrwk.9 Thu Dec 3 21:38:00 2020 (r368310) @@ -30,7 +30,7 @@ .Nm kern_testfrwk .Nd A kernel testing framework .Sh SYNOPSIS -kld_load kern_testfrwk +kldload kern_testfrwk .Sh DESCRIPTION .\" This whole section is not written in manual page style and should be ripped .\" out and replaced. -CEM From owner-svn-src-head@freebsd.org Thu Dec 3 21:49:21 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2DB3B4B066A; Thu, 3 Dec 2020 21:49:21 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Cn8cd0rYlz4nYk; Thu, 3 Dec 2020 21:49:21 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 0FD1220703; Thu, 3 Dec 2020 21:49:21 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B3LnKvE084390; Thu, 3 Dec 2020 21:49:20 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B3LnKs0084388; Thu, 3 Dec 2020 21:49:20 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <202012032149.0B3LnKs0084388@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 3 Dec 2020 21:49:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368311 - in head/sys/dev/cxgbe: . tom X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in head/sys/dev/cxgbe: . tom X-SVN-Commit-Revision: 368311 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Dec 2020 21:49:21 -0000 Author: jhb Date: Thu Dec 3 21:49:20 2020 New Revision: 368311 URL: https://svnweb.freebsd.org/changeset/base/368311 Log: Fix downgrading of TOE TLS sockets to plain TOE. If a TOE TLS socket ends up using an unsupported TLS version or ciphersuite, it must be downgraded to a "plain" TOE socket with TLS encryption/decryption performed on the host. The previous implementation of this fallback was incomplete and resulted in hung connections. Reviewed by: np MFC after: 2 weeks Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D27467 Modified: head/sys/dev/cxgbe/t4_main.c head/sys/dev/cxgbe/tom/t4_tls.c Modified: head/sys/dev/cxgbe/t4_main.c ============================================================================== --- head/sys/dev/cxgbe/t4_main.c Thu Dec 3 21:38:00 2020 (r368310) +++ head/sys/dev/cxgbe/t4_main.c Thu Dec 3 21:49:20 2020 (r368311) @@ -4917,9 +4917,22 @@ set_params__post_init(struct adapter *sc) #endif #ifdef KERN_TLS - if (t4_kern_tls != 0 && sc->cryptocaps & FW_CAPS_CONFIG_TLSKEYS && - sc->toecaps & FW_CAPS_CONFIG_TOE) - t4_enable_kern_tls(sc); + if (sc->cryptocaps & FW_CAPS_CONFIG_TLSKEYS && + sc->toecaps & FW_CAPS_CONFIG_TOE) { + if (t4_kern_tls != 0) + t4_enable_kern_tls(sc); + else { + /* + * Limit TOE connections to 2 reassembly + * "islands". This is required for TOE TLS + * connections to downgrade to plain TOE + * connections if an unsupported TLS version + * or ciphersuite is used. + */ + t4_tp_wr_bits_indirect(sc, A_TP_FRAG_CONFIG, + V_PASSMODE(M_PASSMODE), V_PASSMODE(2)); + } + } #endif return (0); } Modified: head/sys/dev/cxgbe/tom/t4_tls.c ============================================================================== --- head/sys/dev/cxgbe/tom/t4_tls.c Thu Dec 3 21:38:00 2020 (r368310) +++ head/sys/dev/cxgbe/tom/t4_tls.c Thu Dec 3 21:49:20 2020 (r368311) @@ -138,11 +138,19 @@ tls_clr_ofld_mode(struct toepcb *toep) tls_stop_handshake_timer(toep); - /* Operate in PDU extraction mode only. */ + KASSERT(toep->tls.rx_key_addr == -1, + ("%s: tid %d has RX key", __func__, toep->tid)); + + /* Switch to plain TOE mode. */ t4_set_tls_tcb_field(toep, W_TCB_ULP_RAW, - V_TCB_ULP_RAW(M_TCB_ULP_RAW), - V_TCB_ULP_RAW(V_TF_TLS_ENABLE(1))); + V_TCB_ULP_RAW(V_TF_TLS_ENABLE(1)), + V_TCB_ULP_RAW(V_TF_TLS_ENABLE(0))); + t4_set_tls_tcb_field(toep, W_TCB_ULP_TYPE, + V_TCB_ULP_TYPE(M_TCB_ULP_TYPE), V_TCB_ULP_TYPE(ULP_MODE_NONE)); t4_clear_rx_quiesce(toep); + + toep->flags &= ~TPF_FORCE_CREDITS; + toep->params.ulp_mode = ULP_MODE_NONE; } static void From owner-svn-src-head@freebsd.org Thu Dec 3 21:59:48 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7D5C64B08BC; Thu, 3 Dec 2020 21:59:48 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Cn8rh39kCz4p1x; Thu, 3 Dec 2020 21:59:48 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5F3D02098C; Thu, 3 Dec 2020 21:59:48 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B3Lxm1H090478; Thu, 3 Dec 2020 21:59:48 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B3LxmUv090477; Thu, 3 Dec 2020 21:59:48 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <202012032159.0B3LxmUv090477@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 3 Dec 2020 21:59:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368312 - head/sys/dev/cxgbe/tom X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/dev/cxgbe/tom X-SVN-Commit-Revision: 368312 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Dec 2020 21:59:48 -0000 Author: jhb Date: Thu Dec 3 21:59:47 2020 New Revision: 368312 URL: https://svnweb.freebsd.org/changeset/base/368312 Log: Clear TLS offload mode for unsupported cipher suites and versions. If TOE TLS is requested for an unsupported cipher suite or TLS version, disable TLS processing and fall back to plain TOE. In addition, if an error occurs when saving the decryption keys in the card's memory, disable TLS processing and fall back to plain TOE. Reviewed by: np Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D27468 Modified: head/sys/dev/cxgbe/tom/t4_tls.c Modified: head/sys/dev/cxgbe/tom/t4_tls.c ============================================================================== --- head/sys/dev/cxgbe/tom/t4_tls.c Thu Dec 3 21:49:20 2020 (r368311) +++ head/sys/dev/cxgbe/tom/t4_tls.c Thu Dec 3 21:59:47 2020 (r368312) @@ -986,7 +986,8 @@ tls_alloc_ktls(struct toepcb *toep, struct ktls_sessio case 256 / 8: break; default: - return (EINVAL); + error = EINVAL; + goto clr_ofld; } switch (tls->params.auth_algorithm) { case CRYPTO_SHA1_HMAC: @@ -994,30 +995,37 @@ tls_alloc_ktls(struct toepcb *toep, struct ktls_sessio case CRYPTO_SHA2_384_HMAC: break; default: - return (EPROTONOSUPPORT); + error = EPROTONOSUPPORT; + goto clr_ofld; } break; case CRYPTO_AES_NIST_GCM_16: - if (tls->params.iv_len != SALT_SIZE) - return (EINVAL); + if (tls->params.iv_len != SALT_SIZE) { + error = EINVAL; + goto clr_ofld; + } switch (tls->params.cipher_key_len) { case 128 / 8: case 192 / 8: case 256 / 8: break; default: - return (EINVAL); + error = EINVAL; + goto clr_ofld; } break; default: - return (EPROTONOSUPPORT); + error = EPROTONOSUPPORT; + goto clr_ofld; } /* Only TLS 1.1 and TLS 1.2 are currently supported. */ if (tls->params.tls_vmajor != TLS_MAJOR_VER_ONE || tls->params.tls_vminor < TLS_MINOR_VER_ONE || - tls->params.tls_vminor > TLS_MINOR_VER_TWO) - return (EPROTONOSUPPORT); + tls->params.tls_vminor > TLS_MINOR_VER_TWO) { + error = EPROTONOSUPPORT; + goto clr_ofld; + } /* Bail if we already have a key. */ if (direction == KTLS_TX) { @@ -1037,8 +1045,11 @@ tls_alloc_ktls(struct toepcb *toep, struct ktls_sessio init_ktls_key_context(tls, k_ctx, direction); error = tls_program_key_id(toep, k_ctx); - if (error) + if (error) { + if (direction == KTLS_RX) + goto clr_ofld; return (error); + } if (direction == KTLS_TX) { toep->tls.scmd0.seqno_numivs = @@ -1098,6 +1109,14 @@ tls_alloc_ktls(struct toepcb *toep, struct ktls_sessio toep->tls.mode = TLS_MODE_KTLS; return (0); + +clr_ofld: + if (ulp_mode(toep) == ULP_MODE_TLS) { + CTR2(KTR_CXGBE, "%s: tid %d clr_ofld_mode", __func__, + toep->tid); + tls_clr_ofld_mode(toep); + } + return (error); } #endif From owner-svn-src-head@freebsd.org Thu Dec 3 22:00:43 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 075774B0D02; Thu, 3 Dec 2020 22:00:43 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Cn8sk6bySz4pDX; Thu, 3 Dec 2020 22:00:42 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D58152095E; Thu, 3 Dec 2020 22:00:42 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B3M0gU3091338; Thu, 3 Dec 2020 22:00:42 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B3M0gPZ091335; Thu, 3 Dec 2020 22:00:42 GMT (envelope-from np@FreeBSD.org) Message-Id: <202012032200.0B3M0gPZ091335@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Thu, 3 Dec 2020 22:00:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368313 - in head/sys/dev/cxgbe: . common X-SVN-Group: head X-SVN-Commit-Author: np X-SVN-Commit-Paths: in head/sys/dev/cxgbe: . common X-SVN-Commit-Revision: 368313 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Dec 2020 22:00:43 -0000 Author: np Date: Thu Dec 3 22:00:41 2020 New Revision: 368313 URL: https://svnweb.freebsd.org/changeset/base/368313 Log: cxgbe(4): two new debug sysctls. dev...misc.tid_stats dev...misc.tnl_stats MFC after: 3 days Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/common/common.h head/sys/dev/cxgbe/common/t4_hw.c head/sys/dev/cxgbe/t4_main.c Modified: head/sys/dev/cxgbe/common/common.h ============================================================================== --- head/sys/dev/cxgbe/common/common.h Thu Dec 3 21:59:47 2020 (r368312) +++ head/sys/dev/cxgbe/common/common.h Thu Dec 3 22:00:41 2020 (r368313) @@ -189,6 +189,13 @@ struct tp_usm_stats { u64 octets; }; +struct tp_tid_stats { + u32 del; + u32 inv; + u32 act; + u32 pas; +}; + struct tp_fcoe_stats { u32 frames_ddp; u32 frames_drop; @@ -208,6 +215,11 @@ struct tp_err_stats { u32 ofld_cong_defer; }; +struct tp_tnl_stats { + u32 out_pkt[MAX_NCHAN]; + u32 in_pkt[MAX_NCHAN]; +}; + struct tp_proxy_stats { u32 proxy[MAX_NCHAN]; }; @@ -715,6 +727,8 @@ void t4_tp_wr_bits_indirect(struct adapter *adap, unsi void t4_tp_read_la(struct adapter *adap, u64 *la_buf, unsigned int *wrptr); void t4_tp_get_err_stats(struct adapter *adap, struct tp_err_stats *st, bool sleep_ok); +void t4_tp_get_tnl_stats(struct adapter *adap, struct tp_tnl_stats *st, + bool sleep_ok); void t4_tp_get_proxy_stats(struct adapter *adap, struct tp_proxy_stats *st, bool sleep_ok); void t4_tp_get_cpl_stats(struct adapter *adap, struct tp_cpl_stats *st, @@ -722,6 +736,8 @@ void t4_tp_get_cpl_stats(struct adapter *adap, struct void t4_tp_get_rdma_stats(struct adapter *adap, struct tp_rdma_stats *st, bool sleep_ok); void t4_get_usm_stats(struct adapter *adap, struct tp_usm_stats *st, + bool sleep_ok); +void t4_tp_get_tid_stats(struct adapter *adap, struct tp_tid_stats *st, bool sleep_ok); void t4_tp_get_tcp_stats(struct adapter *adap, struct tp_tcp_stats *v4, struct tp_tcp_stats *v6, bool sleep_ok); Modified: head/sys/dev/cxgbe/common/t4_hw.c ============================================================================== --- head/sys/dev/cxgbe/common/t4_hw.c Thu Dec 3 21:59:47 2020 (r368312) +++ head/sys/dev/cxgbe/common/t4_hw.c Thu Dec 3 22:00:41 2020 (r368313) @@ -6169,6 +6169,25 @@ void t4_tp_get_err_stats(struct adapter *adap, struct } /** + * t4_tp_get_err_stats - read TP's error MIB counters + * @adap: the adapter + * @st: holds the counter values + * @sleep_ok: if true we may sleep while awaiting command completion + * + * Returns the values of TP's error counters. + */ +void t4_tp_get_tnl_stats(struct adapter *adap, struct tp_tnl_stats *st, + bool sleep_ok) +{ + int nchan = adap->chip_params->nchan; + + t4_tp_mib_read(adap, st->out_pkt, nchan, A_TP_MIB_TNL_OUT_PKT_0, + sleep_ok); + t4_tp_mib_read(adap, st->in_pkt, nchan, A_TP_MIB_TNL_IN_PKT_0, + sleep_ok); +} + +/** * t4_tp_get_proxy_stats - read TP's proxy MIB counters * @adap: the adapter * @st: holds the counter values @@ -6259,6 +6278,21 @@ void t4_get_usm_stats(struct adapter *adap, struct tp_ st->frames = val[0]; st->drops = val[1]; st->octets = ((u64)val[2] << 32) | val[3]; +} + +/** + * t4_tp_get_tid_stats - read TP's tid MIB counters. + * @adap: the adapter + * @st: holds the counter values + * @sleep_ok: if true we may sleep while awaiting command completion + * + * Returns the values of TP's counters for tids. + */ +void t4_tp_get_tid_stats(struct adapter *adap, struct tp_tid_stats *st, + bool sleep_ok) +{ + + t4_tp_mib_read(adap, &st->del, 4, A_TP_MIB_TID_DEL, sleep_ok); } /** Modified: head/sys/dev/cxgbe/t4_main.c ============================================================================== --- head/sys/dev/cxgbe/t4_main.c Thu Dec 3 21:59:47 2020 (r368312) +++ head/sys/dev/cxgbe/t4_main.c Thu Dec 3 22:00:41 2020 (r368313) @@ -761,6 +761,7 @@ static int sysctl_cim_pif_la(SYSCTL_HANDLER_ARGS); static int sysctl_cim_qcfg(SYSCTL_HANDLER_ARGS); static int sysctl_cpl_stats(SYSCTL_HANDLER_ARGS); static int sysctl_ddp_stats(SYSCTL_HANDLER_ARGS); +static int sysctl_tid_stats(SYSCTL_HANDLER_ARGS); static int sysctl_devlog(SYSCTL_HANDLER_ARGS); static int sysctl_fcoe_stats(SYSCTL_HANDLER_ARGS); static int sysctl_hw_sched(SYSCTL_HANDLER_ARGS); @@ -775,6 +776,7 @@ static int sysctl_rdma_stats(SYSCTL_HANDLER_ARGS); static int sysctl_tcp_stats(SYSCTL_HANDLER_ARGS); static int sysctl_tids(SYSCTL_HANDLER_ARGS); static int sysctl_tp_err_stats(SYSCTL_HANDLER_ARGS); +static int sysctl_tnl_stats(SYSCTL_HANDLER_ARGS); static int sysctl_tp_la_mask(SYSCTL_HANDLER_ARGS); static int sysctl_tp_la(SYSCTL_HANDLER_ARGS); static int sysctl_tx_rate(SYSCTL_HANDLER_ARGS); @@ -6633,6 +6635,10 @@ t4_sysctls(struct adapter *sc) CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, sc, 0, sysctl_ddp_stats, "A", "non-TCP DDP statistics"); + SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "tid_stats", + CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, sc, 0, + sysctl_tid_stats, "A", "tid stats"); + SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "devlog", CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, sc, 0, sysctl_devlog, "A", "firmware's device log"); @@ -6696,6 +6702,10 @@ t4_sysctls(struct adapter *sc) CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, sc, 0, sysctl_tp_err_stats, "A", "TP error statistics"); + SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "tnl_stats", + CTLTYPE_STRING | CTLFLAG_RD | CTLFLAG_MPSAFE, sc, 0, + sysctl_tnl_stats, "A", "TP tunnel statistics"); + SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "tp_la_mask", CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE, sc, 0, sysctl_tp_la_mask, "I", "TP logic analyzer event capture mask"); @@ -8291,7 +8301,9 @@ sysctl_ddp_stats(SYSCTL_HANDLER_ARGS) if (sb == NULL) return (ENOMEM); + mtx_lock(&sc->reg_lock); t4_get_usm_stats(sc, &stats, 1); + mtx_unlock(&sc->reg_lock); sbuf_printf(sb, "Frames: %u\n", stats.frames); sbuf_printf(sb, "Octets: %ju\n", stats.octets); @@ -8303,6 +8315,37 @@ sysctl_ddp_stats(SYSCTL_HANDLER_ARGS) return (rc); } +static int +sysctl_tid_stats(SYSCTL_HANDLER_ARGS) +{ + struct adapter *sc = arg1; + struct sbuf *sb; + int rc; + struct tp_tid_stats stats; + + rc = sysctl_wire_old_buffer(req, 0); + if (rc != 0) + return(rc); + + sb = sbuf_new_for_sysctl(NULL, NULL, 256, req); + if (sb == NULL) + return (ENOMEM); + + mtx_lock(&sc->reg_lock); + t4_tp_get_tid_stats(sc, &stats, 1); + mtx_unlock(&sc->reg_lock); + + sbuf_printf(sb, "Delete: %u\n", stats.del); + sbuf_printf(sb, "Invalidate: %u\n", stats.inv); + sbuf_printf(sb, "Active: %u\n", stats.act); + sbuf_printf(sb, "Passive: %u", stats.pas); + + rc = sbuf_finish(sb); + sbuf_delete(sb); + + return (rc); +} + static const char * const devlog_level_strings[] = { [FW_DEVLOG_LEVEL_EMERG] = "EMERG", [FW_DEVLOG_LEVEL_CRIT] = "CRIT", @@ -8465,8 +8508,10 @@ sysctl_fcoe_stats(SYSCTL_HANDLER_ARGS) if (sb == NULL) return (ENOMEM); + mtx_lock(&sc->reg_lock); for (i = 0; i < nchan; i++) t4_get_fcoe_stats(sc, i, &stats[i], 1); + mtx_unlock(&sc->reg_lock); if (nchan > 2) { sbuf_printf(sb, " channel 0 channel 1" @@ -9455,6 +9500,49 @@ sysctl_tp_err_stats(SYSCTL_HANDLER_ARGS) sbuf_printf(sb, "ofldNoNeigh: %u\nofldCongDefer: %u", stats.ofld_no_neigh, stats.ofld_cong_defer); + + rc = sbuf_finish(sb); + sbuf_delete(sb); + + return (rc); +} + +static int +sysctl_tnl_stats(SYSCTL_HANDLER_ARGS) +{ + struct adapter *sc = arg1; + struct sbuf *sb; + int rc; + struct tp_tnl_stats stats; + + rc = sysctl_wire_old_buffer(req, 0); + if (rc != 0) + return(rc); + + sb = sbuf_new_for_sysctl(NULL, NULL, 256, req); + if (sb == NULL) + return (ENOMEM); + + mtx_lock(&sc->reg_lock); + t4_tp_get_tnl_stats(sc, &stats, 1); + mtx_unlock(&sc->reg_lock); + + if (sc->chip_params->nchan > 2) { + sbuf_printf(sb, " channel 0 channel 1" + " channel 2 channel 3\n"); + sbuf_printf(sb, "OutPkts: %10u %10u %10u %10u\n", + stats.out_pkt[0], stats.out_pkt[1], + stats.out_pkt[2], stats.out_pkt[3]); + sbuf_printf(sb, "InPkts: %10u %10u %10u %10u", + stats.in_pkt[0], stats.in_pkt[1], + stats.in_pkt[2], stats.in_pkt[3]); + } else { + sbuf_printf(sb, " channel 0 channel 1\n"); + sbuf_printf(sb, "OutPkts: %10u %10u\n", + stats.out_pkt[0], stats.out_pkt[1]); + sbuf_printf(sb, "InPkts: %10u %10u", + stats.in_pkt[0], stats.in_pkt[1]); + } rc = sbuf_finish(sb); sbuf_delete(sb); From owner-svn-src-head@freebsd.org Thu Dec 3 22:01:14 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B5FA94B08D9; Thu, 3 Dec 2020 22:01:14 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Cn8tL1F0pz4pHC; Thu, 3 Dec 2020 22:01:14 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id EE8A720A06; Thu, 3 Dec 2020 22:01:13 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B3M1Du2092160; Thu, 3 Dec 2020 22:01:13 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B3M1Dto092159; Thu, 3 Dec 2020 22:01:13 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <202012032201.0B3M1Dto092159@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 3 Dec 2020 22:01:13 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368314 - head/sys/dev/cxgbe/tom X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/dev/cxgbe/tom X-SVN-Commit-Revision: 368314 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Dec 2020 22:01:14 -0000 Author: jhb Date: Thu Dec 3 22:01:13 2020 New Revision: 368314 URL: https://svnweb.freebsd.org/changeset/base/368314 Log: Don't transmit mbufs that aren't yet ready on TOE sockets. This includes mbufs waiting for data from sendfile() I/O requests, or mbufs awaiting encryption for KTLS. Reviewed by: np MFC after: 2 weeks Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D27469 Modified: head/sys/dev/cxgbe/tom/t4_cpl_io.c Modified: head/sys/dev/cxgbe/tom/t4_cpl_io.c ============================================================================== --- head/sys/dev/cxgbe/tom/t4_cpl_io.c Thu Dec 3 22:00:41 2020 (r368313) +++ head/sys/dev/cxgbe/tom/t4_cpl_io.c Thu Dec 3 22:01:13 2020 (r368314) @@ -721,6 +721,8 @@ t4_push_frames(struct adapter *sc, struct toepcb *toep for (m = sndptr; m != NULL; m = m->m_next) { int n; + if ((m->m_flags & M_NOTAVAIL) != 0) + break; if (m->m_flags & M_EXTPG) { #ifdef KERN_TLS if (m->m_epg_tls != NULL) { @@ -803,8 +805,9 @@ t4_push_frames(struct adapter *sc, struct toepcb *toep /* nothing to send */ if (plen == 0) { - KASSERT(m == NULL, - ("%s: nothing to send, but m != NULL", __func__)); + KASSERT(m == NULL || (m->m_flags & M_NOTAVAIL) != 0, + ("%s: nothing to send, but m != NULL is ready", + __func__)); break; } @@ -892,7 +895,7 @@ t4_push_frames(struct adapter *sc, struct toepcb *toep toep->txsd_avail--; t4_l2t_send(sc, wr, toep->l2te); - } while (m != NULL); + } while (m != NULL && (m->m_flags & M_NOTAVAIL) == 0); /* Send a FIN if requested, but only if there's no more data to send */ if (m == NULL && toep->flags & TPF_SEND_FIN) From owner-svn-src-head@freebsd.org Thu Dec 3 22:04:23 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AED804B0D9E; Thu, 3 Dec 2020 22:04:23 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Cn8xz4bSzz4pq4; Thu, 3 Dec 2020 22:04:23 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 909C8209B1; Thu, 3 Dec 2020 22:04:23 +0000 (UTC) (envelope-from np@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B3M4N0Q096667; Thu, 3 Dec 2020 22:04:23 GMT (envelope-from np@FreeBSD.org) Received: (from np@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B3M4NTh096666; Thu, 3 Dec 2020 22:04:23 GMT (envelope-from np@FreeBSD.org) Message-Id: <202012032204.0B3M4NTh096666@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: np set sender to np@FreeBSD.org using -f From: Navdeep Parhar Date: Thu, 3 Dec 2020 22:04:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368315 - head/sys/dev/cxgbe X-SVN-Group: head X-SVN-Commit-Author: np X-SVN-Commit-Paths: head/sys/dev/cxgbe X-SVN-Commit-Revision: 368315 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Dec 2020 22:04:23 -0000 Author: np Date: Thu Dec 3 22:04:23 2020 New Revision: 368315 URL: https://svnweb.freebsd.org/changeset/base/368315 Log: cxgbe(4): Fix vertical alignment in sysctl_cpl_stats. MFC after: 3 days Sponsored by: Chelsio Communications Modified: head/sys/dev/cxgbe/t4_main.c Modified: head/sys/dev/cxgbe/t4_main.c ============================================================================== --- head/sys/dev/cxgbe/t4_main.c Thu Dec 3 22:01:13 2020 (r368314) +++ head/sys/dev/cxgbe/t4_main.c Thu Dec 3 22:04:23 2020 (r368315) @@ -8269,13 +8269,13 @@ sysctl_cpl_stats(SYSCTL_HANDLER_ARGS) " channel 2 channel 3"); sbuf_printf(sb, "\nCPL requests: %10u %10u %10u %10u", stats.req[0], stats.req[1], stats.req[2], stats.req[3]); - sbuf_printf(sb, "\nCPL responses: %10u %10u %10u %10u", + sbuf_printf(sb, "\nCPL responses: %10u %10u %10u %10u", stats.rsp[0], stats.rsp[1], stats.rsp[2], stats.rsp[3]); } else { sbuf_printf(sb, " channel 0 channel 1"); sbuf_printf(sb, "\nCPL requests: %10u %10u", stats.req[0], stats.req[1]); - sbuf_printf(sb, "\nCPL responses: %10u %10u", + sbuf_printf(sb, "\nCPL responses: %10u %10u", stats.rsp[0], stats.rsp[1]); } From owner-svn-src-head@freebsd.org Thu Dec 3 22:06:10 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A92A44B1018; Thu, 3 Dec 2020 22:06:10 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Cn9024Myzz4q22; Thu, 3 Dec 2020 22:06:10 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 88EDA20BC3; Thu, 3 Dec 2020 22:06:10 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B3M6AwM096823; Thu, 3 Dec 2020 22:06:10 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B3M68Yx096816; Thu, 3 Dec 2020 22:06:08 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <202012032206.0B3M68Yx096816@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Thu, 3 Dec 2020 22:06:08 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368316 - in head/sys/dev/cxgbe: . tom X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: in head/sys/dev/cxgbe: . tom X-SVN-Commit-Revision: 368316 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Dec 2020 22:06:10 -0000 Author: jhb Date: Thu Dec 3 22:06:08 2020 New Revision: 368316 URL: https://svnweb.freebsd.org/changeset/base/368316 Log: Clear TLS offload mode if a TLS socket hangs without receiving data. By default, if a TOE TLS socket stops receiving data for more than 5 seconds, revert the connection back to plain TOE mode. This provides a fallback if the userland SSL library does not support KTLS. In addition, for client TLS 1.3 sockets using connect(), the TOE socket blocks before the handshake has completed since the socket option is only invoked for the final handshake. The timeout defaults to 5 seconds, but can be changed at boot via the hw.cxgbe.toe.tls_rx_timeout tunable or for an individual interface via the dev..toe.tls_rx_timeout sysctl. Reviewed by: np MFC after: 2 weeks Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D27470 Modified: head/sys/dev/cxgbe/offload.h head/sys/dev/cxgbe/t4_main.c head/sys/dev/cxgbe/tom/t4_connect.c head/sys/dev/cxgbe/tom/t4_cpl_io.c head/sys/dev/cxgbe/tom/t4_tls.c head/sys/dev/cxgbe/tom/t4_tom.c head/sys/dev/cxgbe/tom/t4_tom.h Modified: head/sys/dev/cxgbe/offload.h ============================================================================== --- head/sys/dev/cxgbe/offload.h Thu Dec 3 22:04:23 2020 (r368315) +++ head/sys/dev/cxgbe/offload.h Thu Dec 3 22:06:08 2020 (r368316) @@ -225,6 +225,7 @@ struct tom_tunables { int ddp; int rx_coalesce; int tls; + int tls_rx_timeout; int *tls_rx_ports; int num_tls_rx_ports; int tx_align; Modified: head/sys/dev/cxgbe/t4_main.c ============================================================================== --- head/sys/dev/cxgbe/t4_main.c Thu Dec 3 22:04:23 2020 (r368315) +++ head/sys/dev/cxgbe/t4_main.c Thu Dec 3 22:06:08 2020 (r368316) @@ -403,6 +403,11 @@ SYSCTL_INT(_hw_cxgbe_toe_rexmt_backoff, OID_AUTO, 14, &t4_toe_rexmt_backoff[14], 0, ""); SYSCTL_INT(_hw_cxgbe_toe_rexmt_backoff, OID_AUTO, 15, CTLFLAG_RDTUN, &t4_toe_rexmt_backoff[15], 0, ""); + +static int t4_toe_tls_rx_timeout = 5; +SYSCTL_INT(_hw_cxgbe_toe, OID_AUTO, tls_rx_timeout, CTLFLAG_RDTUN, + &t4_toe_tls_rx_timeout, 0, + "Timeout in seconds to downgrade TLS sockets to plain TOE"); #endif #ifdef DEV_NETMAP @@ -786,6 +791,7 @@ static int sysctl_cpus(SYSCTL_HANDLER_ARGS); #ifdef TCP_OFFLOAD static int sysctl_tls(SYSCTL_HANDLER_ARGS); static int sysctl_tls_rx_ports(SYSCTL_HANDLER_ARGS); +static int sysctl_tls_rx_timeout(SYSCTL_HANDLER_ARGS); static int sysctl_tp_tick(SYSCTL_HANDLER_ARGS); static int sysctl_tp_dack_timer(SYSCTL_HANDLER_ARGS); static int sysctl_tp_timer(SYSCTL_HANDLER_ARGS); @@ -6789,6 +6795,12 @@ t4_sysctls(struct adapter *sc) sysctl_tls_rx_ports, "I", "TCP ports that use inline TLS+TOE RX"); + sc->tt.tls_rx_timeout = t4_toe_tls_rx_timeout; + SYSCTL_ADD_PROC(ctx, children, OID_AUTO, "tls_rx_timeout", + CTLTYPE_INT | CTLFLAG_RW | CTLFLAG_MPSAFE, sc, 0, + sysctl_tls_rx_timeout, "I", + "Timeout in seconds to downgrade TLS sockets to plain TOE"); + sc->tt.tx_align = -1; SYSCTL_ADD_INT(ctx, children, OID_AUTO, "tx_align", CTLFLAG_RW, &sc->tt.tx_align, 0, "chop and align payload"); @@ -10046,6 +10058,29 @@ sysctl_tls_rx_ports(SYSCTL_HANDLER_ARGS) return (rc); } +static int +sysctl_tls_rx_timeout(SYSCTL_HANDLER_ARGS) +{ + struct adapter *sc = arg1; + int v, rc; + + v = sc->tt.tls_rx_timeout; + rc = sysctl_handle_int(oidp, &v, 0, req); + if (rc != 0 || req->newptr == NULL) + return (rc); + + if (v < 0) + return (EINVAL); + + if (v != 0 && !(sc->cryptocaps & FW_CAPS_CONFIG_TLSKEYS)) + return (ENOTSUP); + + sc->tt.tls_rx_timeout = v; + + return (0); + +} + static void unit_conv(char *buf, size_t len, u_int val, u_int factor) { @@ -11287,6 +11322,9 @@ tweak_tunables(void) if (t4_pktc_idx_ofld < -1 || t4_pktc_idx_ofld >= SGE_NCOUNTERS) t4_pktc_idx_ofld = PKTC_IDX_OFLD; + + if (t4_toe_tls_rx_timeout < 0) + t4_toe_tls_rx_timeout = 0; #else if (t4_rdmacaps_allowed == -1) t4_rdmacaps_allowed = 0; Modified: head/sys/dev/cxgbe/tom/t4_connect.c ============================================================================== --- head/sys/dev/cxgbe/tom/t4_connect.c Thu Dec 3 22:04:23 2020 (r368315) +++ head/sys/dev/cxgbe/tom/t4_connect.c Thu Dec 3 22:06:08 2020 (r368316) @@ -105,9 +105,6 @@ do_act_establish(struct sge_iq *iq, const struct rss_h inp->inp_flowtype = M_HASHTYPE_OPAQUE; inp->inp_flowid = tid; - if (ulp_mode(toep) == ULP_MODE_TLS) - tls_establish(toep); - done: INP_WUNLOCK(inp); CURVNET_RESTORE(); Modified: head/sys/dev/cxgbe/tom/t4_cpl_io.c ============================================================================== --- head/sys/dev/cxgbe/tom/t4_cpl_io.c Thu Dec 3 22:04:23 2020 (r368315) +++ head/sys/dev/cxgbe/tom/t4_cpl_io.c Thu Dec 3 22:06:08 2020 (r368316) @@ -392,6 +392,9 @@ make_established(struct toepcb *toep, uint32_t iss, ui send_flowc_wr(toep, tp); soisconnected(so); + + if (ulp_mode(toep) == ULP_MODE_TLS) + tls_establish(toep); } int Modified: head/sys/dev/cxgbe/tom/t4_tls.c ============================================================================== --- head/sys/dev/cxgbe/tom/t4_tls.c Thu Dec 3 22:04:23 2020 (r368315) +++ head/sys/dev/cxgbe/tom/t4_tls.c Thu Dec 3 22:06:08 2020 (r368316) @@ -64,14 +64,6 @@ __FBSDID("$FreeBSD$"); */ #define tls_tcp_seq PH_loc.thirtytwo[0] -/* - * Handshake lock used for the handshake timer. Having a global lock - * is perhaps not ideal, but it avoids having to use callout_drain() - * in tls_uninit_toep() which can't block. Also, the timer shouldn't - * actually fire for most connections. - */ -static struct mtx tls_handshake_lock; - static void t4_set_tls_tcb_field(struct toepcb *toep, uint16_t word, uint64_t mask, uint64_t val) @@ -149,7 +141,7 @@ tls_clr_ofld_mode(struct toepcb *toep) V_TCB_ULP_TYPE(M_TCB_ULP_TYPE), V_TCB_ULP_TYPE(ULP_MODE_NONE)); t4_clear_rx_quiesce(toep); - toep->flags &= ~TPF_FORCE_CREDITS; + toep->flags &= ~(TPF_FORCE_CREDITS | TPF_TLS_ESTABLISHED); toep->params.ulp_mode = ULP_MODE_NONE; } @@ -748,6 +740,25 @@ tls_send_handshake_ack(void *arg) struct adapter *sc = td_adapter(toep->td); /* + * If this connection has timed out without receiving more + * data, downgrade to plain TOE mode and don't re-arm the + * timer. + */ + if (sc->tt.tls_rx_timeout != 0) { + struct inpcb *inp; + struct tcpcb *tp; + + inp = toep->inp; + tp = intotcpcb(inp); + if ((ticks - tp->t_rcvtime) >= sc->tt.tls_rx_timeout) { + CTR2(KTR_CXGBE, "%s: tid %d clr_ofld_mode", __func__, + toep->tid); + tls_clr_ofld_mode(toep); + return; + } + } + + /* * XXX: Does not have the t4_get_tcb() checks to refine the * workaround. */ @@ -762,10 +773,9 @@ tls_start_handshake_timer(struct toepcb *toep) { struct tls_ofld_info *tls_ofld = &toep->tls; - mtx_lock(&tls_handshake_lock); + INP_WLOCK_ASSERT(toep->inp); callout_reset(&tls_ofld->handshake_timer, TLS_SRV_HELLO_BKOFF_TM * hz, tls_send_handshake_ack, toep); - mtx_unlock(&tls_handshake_lock); } void @@ -773,9 +783,8 @@ tls_stop_handshake_timer(struct toepcb *toep) { struct tls_ofld_info *tls_ofld = &toep->tls; - mtx_lock(&tls_handshake_lock); + INP_WLOCK_ASSERT(toep->inp); callout_stop(&tls_ofld->handshake_timer); - mtx_unlock(&tls_handshake_lock); } int @@ -1129,9 +1138,6 @@ tls_init_toep(struct toepcb *toep) tls_ofld->key_location = TLS_SFO_WR_CONTEXTLOC_DDR; tls_ofld->rx_key_addr = -1; tls_ofld->tx_key_addr = -1; - if (ulp_mode(toep) == ULP_MODE_TLS) - callout_init_mtx(&tls_ofld->handshake_timer, - &tls_handshake_lock, 0); } void @@ -1149,17 +1155,27 @@ tls_establish(struct toepcb *toep) t4_set_tls_tcb_field(toep, W_TCB_ULP_RAW, V_TCB_ULP_RAW(M_TCB_ULP_RAW), V_TCB_ULP_RAW(V_TF_TLS_ENABLE(1))); - toep->flags |= TPF_FORCE_CREDITS; + toep->flags |= TPF_FORCE_CREDITS | TPF_TLS_ESTABLISHED; + callout_init_rw(&toep->tls.handshake_timer, &toep->inp->inp_lock, 0); tls_start_handshake_timer(toep); } void -tls_uninit_toep(struct toepcb *toep) +tls_detach(struct toepcb *toep) { - if (ulp_mode(toep) == ULP_MODE_TLS) + if (toep->flags & TPF_TLS_ESTABLISHED) { tls_stop_handshake_timer(toep); + toep->flags &= ~TPF_TLS_ESTABLISHED; + } +} + +void +tls_uninit_toep(struct toepcb *toep) +{ + + MPASS((toep->flags & TPF_TLS_ESTABLISHED) == 0); clear_tls_keyid(toep); } @@ -2383,7 +2399,6 @@ void t4_tls_mod_load(void) { - mtx_init(&tls_handshake_lock, "t4tls handshake", NULL, MTX_DEF); t4_register_cpl_handler(CPL_TLS_DATA, do_tls_data); t4_register_cpl_handler(CPL_RX_TLS_CMP, do_rx_tls_cmp); } @@ -2394,6 +2409,5 @@ t4_tls_mod_unload(void) t4_register_cpl_handler(CPL_TLS_DATA, NULL); t4_register_cpl_handler(CPL_RX_TLS_CMP, NULL); - mtx_destroy(&tls_handshake_lock); } #endif /* TCP_OFFLOAD */ Modified: head/sys/dev/cxgbe/tom/t4_tom.c ============================================================================== --- head/sys/dev/cxgbe/tom/t4_tom.c Thu Dec 3 22:04:23 2020 (r368315) +++ head/sys/dev/cxgbe/tom/t4_tom.c Thu Dec 3 22:06:08 2020 (r368316) @@ -382,6 +382,9 @@ t4_pcb_detach(struct toedev *tod __unused, struct tcpc } #endif + if (ulp_mode(toep) == ULP_MODE_TLS) + tls_detach(toep); + tp->tod = NULL; tp->t_toe = NULL; tp->t_flags &= ~TF_TOE; @@ -845,6 +848,8 @@ final_cpl_received(struct toepcb *toep) if (ulp_mode(toep) == ULP_MODE_TCPDDP) release_ddp_resources(toep); + else if (ulp_mode(toep) == ULP_MODE_TLS) + tls_detach(toep); toep->inp = NULL; toep->flags &= ~TPF_CPL_PENDING; mbufq_drain(&toep->ulp_pdu_reclaimq); Modified: head/sys/dev/cxgbe/tom/t4_tom.h ============================================================================== --- head/sys/dev/cxgbe/tom/t4_tom.h Thu Dec 3 22:04:23 2020 (r368315) +++ head/sys/dev/cxgbe/tom/t4_tom.h Thu Dec 3 22:06:08 2020 (r368316) @@ -75,6 +75,7 @@ enum { TPF_KTLS = (1 << 11), /* send TLS records from KTLS */ TPF_INITIALIZED = (1 << 12), /* init_toepcb has been called */ TPF_TLS_RECEIVE = (1 << 13), /* should receive TLS records */ + TPF_TLS_ESTABLISHED = (1 << 14), /* TLS handshake timer initialized */ }; enum { @@ -448,6 +449,7 @@ void t4_push_tls_records(struct adapter *, struct toep void t4_push_ktls(struct adapter *, struct toepcb *, int); void t4_tls_mod_load(void); void t4_tls_mod_unload(void); +void tls_detach(struct toepcb *); void tls_establish(struct toepcb *); void tls_init_toep(struct toepcb *); int tls_rx_key(struct toepcb *); From owner-svn-src-head@freebsd.org Thu Dec 3 22:23:58 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9DB824B169B; Thu, 3 Dec 2020 22:23:58 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Cn9NZ44ZYz4r5x; Thu, 3 Dec 2020 22:23:58 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7EC7120DCC; Thu, 3 Dec 2020 22:23:58 +0000 (UTC) (envelope-from melifaro@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B3MNwAh009444; Thu, 3 Dec 2020 22:23:58 GMT (envelope-from melifaro@FreeBSD.org) Received: (from melifaro@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B3MNvcc009440; Thu, 3 Dec 2020 22:23:57 GMT (envelope-from melifaro@FreeBSD.org) Message-Id: <202012032223.0B3MNvcc009440@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: melifaro set sender to melifaro@FreeBSD.org using -f From: "Alexander V. Chernikov" Date: Thu, 3 Dec 2020 22:23:57 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368317 - head/sys/net/route X-SVN-Group: head X-SVN-Commit-Author: melifaro X-SVN-Commit-Paths: head/sys/net/route X-SVN-Commit-Revision: 368317 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Thu, 03 Dec 2020 22:23:58 -0000 Author: melifaro Date: Thu Dec 3 22:23:57 2020 New Revision: 368317 URL: https://svnweb.freebsd.org/changeset/base/368317 Log: Add IPv4/IPv6 rtentry prefix accessors. Multiple consumers like ipfw, netflow or new route lookup algorithms need to get the prefix data out of struct rtentry. Instead of providing direct access to the rtentry, create IPv4/IPv6 accessors to abstract struct rtentry internals and avoid including internal routing headers for external consumers. While here, move struct route_nhop_data to the public header, so external customers can actually use lookup functions returning rt&nhop data. Differential Revision: https://reviews.freebsd.org/D27416 Modified: head/sys/net/route/route_ctl.c head/sys/net/route/route_ctl.h head/sys/net/route/route_var.h Modified: head/sys/net/route/route_ctl.c ============================================================================== --- head/sys/net/route/route_ctl.c Thu Dec 3 22:06:08 2020 (r368316) +++ head/sys/net/route/route_ctl.c Thu Dec 3 22:23:57 2020 (r368317) @@ -53,6 +53,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include @@ -235,6 +236,132 @@ get_info_weight(const struct rt_addrinfo *info, uint32 return (weight); } + +bool +rt_is_host(const struct rtentry *rt) +{ + + return (rt->rte_flags & RTF_HOST); +} + +/* + * Returns pointer to nexthop or nexthop group + * associated with @rt + */ +struct nhop_object * +rt_get_raw_nhop(const struct rtentry *rt) +{ + + return (rt->rt_nhop); +} + +#ifdef INET +/* + * Stores IPv4 address and prefix length of @rt inside + * @paddr and @plen. + * @pscopeid is currently always set to 0. + */ +void +rt_get_inet_prefix_plen(const struct rtentry *rt, struct in_addr *paddr, + int *plen, uint32_t *pscopeid) +{ + const struct sockaddr_in *dst; + + dst = (const struct sockaddr_in *)rt_key_const(rt); + KASSERT((dst->sin_family == AF_INET), + ("rt family is %d, not inet", dst->sin_family)); + *paddr = dst->sin_addr; + dst = (const struct sockaddr_in *)rt_mask_const(rt); + if (dst == NULL) + *plen = 32; + else + *plen = bitcount32(dst->sin_addr.s_addr); + *pscopeid = 0; +} + +/* + * Stores IPv4 address and prefix mask of @rt inside + * @paddr and @pmask. Sets mask to INADDR_ANY for host routes. + * @pscopeid is currently always set to 0. + */ +void +rt_get_inet_prefix_pmask(const struct rtentry *rt, struct in_addr *paddr, + struct in_addr *pmask, uint32_t *pscopeid) +{ + const struct sockaddr_in *dst; + + dst = (const struct sockaddr_in *)rt_key_const(rt); + KASSERT((dst->sin_family == AF_INET), + ("rt family is %d, not inet", dst->sin_family)); + *paddr = dst->sin_addr; + dst = (const struct sockaddr_in *)rt_mask_const(rt); + if (dst == NULL) + pmask->s_addr = INADDR_BROADCAST; + else + *pmask = dst->sin_addr; + *pscopeid = 0; +} +#endif + +#ifdef INET6 +static int +inet6_get_plen(const struct in6_addr *addr) +{ + + return (bitcount32(addr->s6_addr32[0]) + bitcount32(addr->s6_addr32[1]) + + bitcount32(addr->s6_addr32[2]) + bitcount32(addr->s6_addr32[3])); +} + +/* + * Stores IPv6 address and prefix length of @rt inside + * @paddr and @plen. Addresses are returned in de-embedded form. + * Scopeid is set to 0 for non-LL addresses. + */ +void +rt_get_inet6_prefix_plen(const struct rtentry *rt, struct in6_addr *paddr, + int *plen, uint32_t *pscopeid) +{ + const struct sockaddr_in6 *dst; + + dst = (const struct sockaddr_in6 *)rt_key_const(rt); + KASSERT((dst->sin6_family == AF_INET6), + ("rt family is %d, not inet6", dst->sin6_family)); + if (IN6_IS_SCOPE_LINKLOCAL(&dst->sin6_addr)) + in6_splitscope(&dst->sin6_addr, paddr, pscopeid); + else + *paddr = dst->sin6_addr; + dst = (const struct sockaddr_in6 *)rt_mask_const(rt); + if (dst == NULL) + *plen = 128; + else + *plen = inet6_get_plen(&dst->sin6_addr); +} + +/* + * Stores IPv6 address and prefix mask of @rt inside + * @paddr and @pmask. Addresses are returned in de-embedded form. + * Scopeid is set to 0 for non-LL addresses. + */ +void +rt_get_inet6_prefix_pmask(const struct rtentry *rt, struct in6_addr *paddr, + struct in6_addr *pmask, uint32_t *pscopeid) +{ + const struct sockaddr_in6 *dst; + + dst = (const struct sockaddr_in6 *)rt_key_const(rt); + KASSERT((dst->sin6_family == AF_INET6), + ("rt family is %d, not inet", dst->sin6_family)); + if (IN6_IS_SCOPE_LINKLOCAL(&dst->sin6_addr)) + in6_splitscope(&dst->sin6_addr, paddr, pscopeid); + else + *paddr = dst->sin6_addr; + dst = (const struct sockaddr_in6 *)rt_mask_const(rt); + if (dst == NULL) + memset(pmask, 0xFF, sizeof(struct in6_addr)); + else + *pmask = dst->sin6_addr; +} +#endif static void rt_set_expire_info(struct rtentry *rt, const struct rt_addrinfo *info) Modified: head/sys/net/route/route_ctl.h ============================================================================== --- head/sys/net/route/route_ctl.h Thu Dec 3 22:06:08 2020 (r368316) +++ head/sys/net/route/route_ctl.h Thu Dec 3 22:23:57 2020 (r368317) @@ -82,18 +82,44 @@ void rib_foreach_table_walk(int family, bool wlock, ri rib_walk_hook_f_t *hook_f, void *arg); void rib_foreach_table_walk_del(int family, rib_filter_f_t *filter_f, void *arg); -struct route_nhop_data; +struct nhop_object; +struct nhgrp_object; +struct route_nhop_data { + union { + struct nhop_object *rnd_nhop; + struct nhgrp_object *rnd_nhgrp; + }; + uint32_t rnd_weight; +}; + const struct rtentry *rib_lookup_prefix(uint32_t fibnum, int family, const struct sockaddr *dst, const struct sockaddr *netmask, struct route_nhop_data *rnd); const struct rtentry *rib_lookup_lpm(uint32_t fibnum, int family, const struct sockaddr *dst, struct route_nhop_data *rnd); +/* rtentry accessors */ +bool rt_is_host(const struct rtentry *rt); +struct nhop_object *rt_get_raw_nhop(const struct rtentry *rt); +#ifdef INET +struct in_addr; +void rt_get_inet_prefix_plen(const struct rtentry *rt, struct in_addr *paddr, + int *plen, uint32_t *pscopeid); +void rt_get_inet_prefix_pmask(const struct rtentry *rt, struct in_addr *paddr, + struct in_addr *pmask, uint32_t *pscopeid); +#endif +#ifdef INET6 +struct in6_addr; +void rt_get_inet6_prefix_plen(const struct rtentry *rt, struct in6_addr *paddr, + int *plen, uint32_t *pscopeid); +void rt_get_inet6_prefix_pmask(const struct rtentry *rt, struct in6_addr *paddr, + struct in6_addr *pmask, uint32_t *pscopeid); +#endif + /* Nexthops */ uint32_t nhops_get_count(struct rib_head *rh); /* Multipath */ -struct nhgrp_object; struct weightened_nhop; struct weightened_nhop *nhgrp_get_nhops(struct nhgrp_object *nhg, Modified: head/sys/net/route/route_var.h ============================================================================== --- head/sys/net/route/route_var.h Thu Dec 3 22:06:08 2020 (r368316) +++ head/sys/net/route/route_var.h Thu Dec 3 22:23:57 2020 (r368317) @@ -205,14 +205,7 @@ void tmproutes_init(struct rib_head *rh); void tmproutes_destroy(struct rib_head *rh); /* route_ctl.c */ -struct route_nhop_data { - union { - struct nhop_object *rnd_nhop; - struct nhgrp_object *rnd_nhgrp; - }; - uint32_t rnd_weight; -}; - +struct route_nhop_data; int change_route_nhop(struct rib_head *rnh, struct rtentry *rt, struct rt_addrinfo *info, struct route_nhop_data *rnd, struct rib_cmd_info *rc); From owner-svn-src-head@freebsd.org Fri Dec 4 04:39:48 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9C60E472C1E; Fri, 4 Dec 2020 04:39:48 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CnKkD42Wyz3lFt; Fri, 4 Dec 2020 04:39:48 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7D70225A86; Fri, 4 Dec 2020 04:39:48 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B44dmsF043740; Fri, 4 Dec 2020 04:39:48 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B44dmxp043739; Fri, 4 Dec 2020 04:39:48 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202012040439.0B44dmxp043739@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Fri, 4 Dec 2020 04:39:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368326 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 368326 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Dec 2020 04:39:48 -0000 Author: kevans Date: Fri Dec 4 04:39:48 2020 New Revision: 368326 URL: https://svnweb.freebsd.org/changeset/base/368326 Log: kern: soclose: don't sleep on SO_LINGER w/ timeout=0 This is a valid scenario that's handled in the various protocol layers where it makes sense (e.g., tcp_disconnect and sctp_disconnect). Given that it indicates we should immediately drop the connection, it makes little sense to sleep on it. This could lead to panics with INVARIANTS. On non-INVARIANTS kernels, this could result in the thread hanging until a signal interrupts it if the protocol does not mark the socket as disconnected for whatever reason. Reported by: syzbot+e625d92c1dd74e402c81@syzkaller.appspotmail.com Reviewed by: glebius, markj MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D27407 Modified: head/sys/kern/uipc_socket.c Modified: head/sys/kern/uipc_socket.c ============================================================================== --- head/sys/kern/uipc_socket.c Fri Dec 4 02:37:33 2020 (r368325) +++ head/sys/kern/uipc_socket.c Fri Dec 4 04:39:48 2020 (r368326) @@ -1192,7 +1192,8 @@ soclose(struct socket *so) goto drop; } } - if (so->so_options & SO_LINGER) { + + if ((so->so_options & SO_LINGER) != 0 && so->so_linger != 0) { if ((so->so_state & SS_ISDISCONNECTING) && (so->so_state & SS_NBIO)) goto drop; From owner-svn-src-head@freebsd.org Fri Dec 4 04:48:08 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C6706472F91 for ; Fri, 4 Dec 2020 04:48:08 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CnKvr3J1nz3lN4 for ; Fri, 4 Dec 2020 04:48:08 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from mail-qt1-f179.google.com (mail-qt1-f179.google.com [209.85.160.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) (Authenticated sender: kevans) by smtp.freebsd.org (Postfix) with ESMTPSA id 55E7D69D8 for ; Fri, 4 Dec 2020 04:48:08 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: by mail-qt1-f179.google.com with SMTP id d5so3185857qtn.0 for ; Thu, 03 Dec 2020 20:48:08 -0800 (PST) X-Gm-Message-State: AOAM53280FH3SbpTrjFAt7elWHJ8NAvEqocHQNCyxULZ6bS1SgICQtXc TJYBS/CV+CwpdE0Mq7W1sCQcz3vQDgVSRvW39XU= X-Received: by 2002:ac8:4897:: with SMTP id i23mt7394849qtq.211.1607057287856; Thu, 03 Dec 2020 20:48:07 -0800 (PST) MIME-Version: 1.0 References: <202012040439.0B44dmxp043739@repo.freebsd.org> In-Reply-To: <202012040439.0B44dmxp043739@repo.freebsd.org> From: Kyle Evans Date: Thu, 3 Dec 2020 22:47:56 -0600 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r368326 - head/sys/kern Cc: src-committers , svn-src-all , svn-src-head , Michael Tuexen Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Dec 2020 04:48:08 -0000 On Thu, Dec 3, 2020 at 10:40 PM Kyle Evans wrote: > > Author: kevans > Date: Fri Dec 4 04:39:48 2020 > New Revision: 368326 > URL: https://svnweb.freebsd.org/changeset/base/368326 > > Log: > kern: soclose: don't sleep on SO_LINGER w/ timeout=0 > > This is a valid scenario that's handled in the various protocol layers where > it makes sense (e.g., tcp_disconnect and sctp_disconnect). Given that it > indicates we should immediately drop the connection, it makes little sense > to sleep on it. > > This could lead to panics with INVARIANTS. On non-INVARIANTS kernels, this > could result in the thread hanging until a signal interrupts it if the > protocol does not mark the socket as disconnected for whatever reason. > > Reported by: syzbot+e625d92c1dd74e402c81@syzkaller.appspotmail.com > Reviewed by: glebius, markj > MFC after: 1 week > Differential Revision: https://reviews.freebsd.org/D27407 > It occurred to me as I was glancing over the diff one more time pre-commit that this panic must have been in SCTP, because TCP will always soisdisconnected() the socket in this case while SCTP will not. This is arguably a bug in SCTP that should also be fixed, but I consider the below to still be a valid and better behavior than wedging a userland process due to a minor oversight like this when the behavior of so_linger == 0 is pretty well understood. > Modified: > head/sys/kern/uipc_socket.c > > Modified: head/sys/kern/uipc_socket.c > ============================================================================== > --- head/sys/kern/uipc_socket.c Fri Dec 4 02:37:33 2020 (r368325) > +++ head/sys/kern/uipc_socket.c Fri Dec 4 04:39:48 2020 (r368326) > @@ -1192,7 +1192,8 @@ soclose(struct socket *so) > goto drop; > } > } > - if (so->so_options & SO_LINGER) { > + > + if ((so->so_options & SO_LINGER) != 0 && so->so_linger != 0) { > if ((so->so_state & SS_ISDISCONNECTING) && > (so->so_state & SS_NBIO)) > goto drop; From owner-svn-src-head@freebsd.org Fri Dec 4 11:29:27 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E8D5D47C076; Fri, 4 Dec 2020 11:29:27 +0000 (UTC) (envelope-from rscheff@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CnVpv6GwGz4bXP; Fri, 4 Dec 2020 11:29:27 +0000 (UTC) (envelope-from rscheff@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C609F2B8D; Fri, 4 Dec 2020 11:29:27 +0000 (UTC) (envelope-from rscheff@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B4BTRRe098804; Fri, 4 Dec 2020 11:29:27 GMT (envelope-from rscheff@FreeBSD.org) Received: (from rscheff@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B4BTRPF098802; Fri, 4 Dec 2020 11:29:27 GMT (envelope-from rscheff@FreeBSD.org) Message-Id: <202012041129.0B4BTRPF098802@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: rscheff set sender to rscheff@FreeBSD.org using -f From: Richard Scheffenegger Date: Fri, 4 Dec 2020 11:29:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368327 - head/sys/netinet X-SVN-Group: head X-SVN-Commit-Author: rscheff X-SVN-Commit-Paths: head/sys/netinet X-SVN-Commit-Revision: 368327 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Dec 2020 11:29:28 -0000 Author: rscheff Date: Fri Dec 4 11:29:27 2020 New Revision: 368327 URL: https://svnweb.freebsd.org/changeset/base/368327 Log: Add TCP feature Proportional Rate Reduction (PRR) - RFC6937 PRR improves loss recovery and avoids RTOs in a wide range of scenarios (ACK thinning) over regular SACK loss recovery. PRR is disabled by default, enable by net.inet.tcp.do_prr = 1. Performance may be impeded by token bucket rate policers at the bottleneck, where net.inet.tcp.do_prr_conservate = 1 should be enabled in addition. Submitted by: Aris Angelogiannopoulos Sponsored by: NetApp, Inc. Differential Revision: https://reviews.freebsd.org/D18892 Modified: head/sys/netinet/tcp_input.c head/sys/netinet/tcp_var.h Modified: head/sys/netinet/tcp_input.c ============================================================================== --- head/sys/netinet/tcp_input.c Fri Dec 4 04:39:48 2020 (r368326) +++ head/sys/netinet/tcp_input.c Fri Dec 4 11:29:27 2020 (r368327) @@ -153,6 +153,16 @@ SYSCTL_INT(_net_inet_tcp, OID_AUTO, drop_synfin, CTLFL &VNET_NAME(drop_synfin), 0, "Drop TCP packets with SYN+FIN set"); +VNET_DEFINE(int, tcp_do_prr_conservative) = 0; +SYSCTL_INT(_net_inet_tcp, OID_AUTO, do_prr_conservative, CTLFLAG_VNET | CTLFLAG_RW, + &VNET_NAME(tcp_do_prr_conservative), 0, + "Do conservative Proportional Rate Reduction"); + +VNET_DEFINE(int, tcp_do_prr) = 1; +SYSCTL_INT(_net_inet_tcp, OID_AUTO, do_prr, CTLFLAG_VNET | CTLFLAG_RW, + &VNET_NAME(tcp_do_prr), 1, + "Enable Proportional Rate Reduction per RFC 6937"); + VNET_DEFINE(int, tcp_do_newcwv) = 0; SYSCTL_INT(_net_inet_tcp, OID_AUTO, newcwv, CTLFLAG_VNET | CTLFLAG_RW, &VNET_NAME(tcp_do_newcwv), 0, @@ -2554,7 +2564,55 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, stru IN_FASTRECOVERY(tp->t_flags)) { cc_ack_received(tp, th, nsegs, CC_DUPACK); - if ((tp->t_flags & TF_SACK_PERMIT) && + if (V_tcp_do_prr && + IN_FASTRECOVERY(tp->t_flags) && + (tp->t_flags & TF_SACK_PERMIT)) { + long snd_cnt = 0, limit = 0; + long del_data = 0, pipe = 0; + /* + * In a duplicate ACK del_data is only the + * diff_in_sack. If no SACK is used del_data + * will be 0. Pipe is the amount of data we + * estimate to be in the network. + */ + del_data = tp->sackhint.delivered_data; + pipe = (tp->snd_nxt - tp->snd_fack) + + tp->sackhint.sack_bytes_rexmit; + tp->sackhint.prr_delivered += del_data; + if (pipe > tp->snd_ssthresh) { + snd_cnt = (tp->sackhint.prr_delivered * + tp->snd_ssthresh / + tp->sackhint.recover_fs) + + 1 - tp->sackhint.sack_bytes_rexmit; + } else { + if (V_tcp_do_prr_conservative) + limit = tp->sackhint.prr_delivered - + tp->sackhint.sack_bytes_rexmit; + else + if ((tp->sackhint.prr_delivered - + tp->sackhint.sack_bytes_rexmit) > + del_data) + limit = tp->sackhint.prr_delivered - + tp->sackhint.sack_bytes_rexmit + + maxseg; + else + limit = del_data + maxseg; + if ((tp->snd_ssthresh - pipe) < limit) + snd_cnt = tp->snd_ssthresh - pipe; + else + snd_cnt = limit; + } + snd_cnt = max((snd_cnt / maxseg), 0); + /* + * Send snd_cnt new data into the network in + * response to this ACK. If there is a going + * to be a SACK retransmission, adjust snd_cwnd + * accordingly. + */ + tp->snd_cwnd = tp->snd_nxt - tp->snd_recover + + tp->sackhint.sack_bytes_rexmit + + (snd_cnt * maxseg); + } else if ((tp->t_flags & TF_SACK_PERMIT) && IN_FASTRECOVERY(tp->t_flags)) { int awnd; @@ -2583,13 +2641,14 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, stru tcp_seq onxt = tp->snd_nxt; /* - * If we're doing sack, check to - * see if we're already in sack + * If we're doing sack, or prr, check + * to see if we're already in sack * recovery. If we're not doing sack, * check to see if we're in newreno * recovery. */ - if (tp->t_flags & TF_SACK_PERMIT) { + if (V_tcp_do_prr || + (tp->t_flags & TF_SACK_PERMIT)) { if (IN_FASTRECOVERY(tp->t_flags)) { tp->t_dupacks = 0; break; @@ -2607,6 +2666,16 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, stru CC_DUPACK); tcp_timer_activate(tp, TT_REXMT, 0); tp->t_rtttime = 0; + if (V_tcp_do_prr) { + /* + * snd_ssthresh is already updated by + * cc_cong_signal. + */ + tp->sackhint.prr_delivered = 0; + tp->sackhint.sack_bytes_rexmit = 0; + if (!(tp->sackhint.recover_fs = tp->snd_nxt - tp->snd_una)) + tp->sackhint.recover_fs = 1; + } if (tp->t_flags & TF_SACK_PERMIT) { TCPSTAT_INC( tcps_sack_recovery_episode); @@ -2713,7 +2782,10 @@ tcp_do_segment(struct mbuf *m, struct tcphdr *th, stru if (IN_FASTRECOVERY(tp->t_flags)) { if (SEQ_LT(th->th_ack, tp->snd_recover)) { if (tp->t_flags & TF_SACK_PERMIT) - tcp_sack_partialack(tp, th); + if (V_tcp_do_prr) + tcp_prr_partialack(tp, th); + else + tcp_sack_partialack(tp, th); else tcp_newreno_partial_ack(tp, th); } else @@ -3837,6 +3909,54 @@ tcp_mssopt(struct in_conninfo *inc) mss = max(maxmtu, thcmtu) - min_protoh; return (mss); +} + +void +tcp_prr_partialack(struct tcpcb *tp, struct tcphdr *th) +{ + long snd_cnt = 0, limit = 0, del_data = 0, pipe = 0; + int maxseg = tcp_maxseg(tp); + + INP_WLOCK_ASSERT(tp->t_inpcb); + + tcp_timer_activate(tp, TT_REXMT, 0); + tp->t_rtttime = 0; + /* + * Compute the amount of data that this ACK is indicating + * (del_data) and an estimate of how many bytes are in the + * network. + */ + if (SEQ_GEQ(th->th_ack, tp->snd_una)) + del_data = BYTES_THIS_ACK(tp, th); + del_data += tp->sackhint.delivered_data; + pipe = (tp->snd_nxt - tp->snd_fack) + tp->sackhint.sack_bytes_rexmit; + tp->sackhint.prr_delivered += del_data; + /* + * Proportional Rate Reduction + */ + if (pipe > tp->snd_ssthresh) + snd_cnt = (tp->sackhint.prr_delivered * tp->snd_ssthresh / tp->sackhint.recover_fs) - + tp->sackhint.sack_bytes_rexmit; + else { + if (V_tcp_do_prr_conservative) + limit = tp->sackhint.prr_delivered - tp->sackhint.sack_bytes_rexmit; + else + if ((tp->sackhint.prr_delivered - tp->sackhint.sack_bytes_rexmit) > del_data) + limit = tp->sackhint.prr_delivered - tp->sackhint.sack_bytes_rexmit + maxseg; + else + limit = del_data + maxseg; + snd_cnt = min((tp->snd_ssthresh - pipe), limit); + } + snd_cnt = max((snd_cnt / maxseg), 0); + /* + * Send snd_cnt new data into the network in response to this ack. + * If there is going to be a SACK retransmission, adjust snd_cwnd + * accordingly. + */ + tp->snd_cwnd = tp->snd_nxt - tp->snd_recover + + tp->sackhint.sack_bytes_rexmit + (snd_cnt * maxseg); + tp->t_flags |= TF_ACKNOW; + (void) tcp_output(tp); } /* Modified: head/sys/netinet/tcp_var.h ============================================================================== --- head/sys/netinet/tcp_var.h Fri Dec 4 04:39:48 2020 (r368326) +++ head/sys/netinet/tcp_var.h Fri Dec 4 11:29:27 2020 (r368327) @@ -113,8 +113,9 @@ struct sackhint { int32_t sacked_bytes; /* Total sacked bytes reported by the * receiver via sack option */ - uint32_t _pad1[1]; /* TBD */ - uint64_t _pad[1]; /* TBD */ + uint32_t recover_fs; /* Flight Size at the start of Loss recovery */ + uint32_t prr_delivered; /* Total bytes delivered using PRR */ + uint32_t _pad[1]; /* TBD */ }; #define SEGQ_EMPTY(tp) TAILQ_EMPTY(&(tp)->t_segq) @@ -866,6 +867,8 @@ VNET_DECLARE(int, tcp_sendspace); VNET_DECLARE(struct inpcbhead, tcb); VNET_DECLARE(struct inpcbinfo, tcbinfo); +#define V_tcp_do_prr VNET(tcp_do_prr) +#define V_tcp_do_prr_conservative VNET(tcp_do_prr_conservative) #define V_tcp_do_newcwv VNET(tcp_do_newcwv) #define V_drop_synfin VNET(drop_synfin) #define V_path_mtu_discovery VNET(path_mtu_discovery) @@ -1051,6 +1054,7 @@ void tcp_clean_dsack_blocks(struct tcpcb *tp); void tcp_clean_sackreport(struct tcpcb *tp); void tcp_sack_adjust(struct tcpcb *tp); struct sackhole *tcp_sack_output(struct tcpcb *tp, int *sack_bytes_rexmt); +void tcp_prr_partialack(struct tcpcb *, struct tcphdr *); void tcp_sack_partialack(struct tcpcb *, struct tcphdr *); void tcp_free_sackholes(struct tcpcb *tp); int tcp_newreno(struct tcpcb *, struct tcphdr *); From owner-svn-src-head@freebsd.org Fri Dec 4 14:50:56 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 78B7E4A2A3D; Fri, 4 Dec 2020 14:50:56 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CnbHN2yqCz4pV2; Fri, 4 Dec 2020 14:50:56 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 58D0A56EE; Fri, 4 Dec 2020 14:50:56 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B4Eougw024633; Fri, 4 Dec 2020 14:50:56 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B4EouQ2024632; Fri, 4 Dec 2020 14:50:56 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202012041450.0B4EouQ2024632@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 4 Dec 2020 14:50:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368329 - head/stand/kshim X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/stand/kshim X-SVN-Commit-Revision: 368329 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Dec 2020 14:50:56 -0000 Author: hselasky Date: Fri Dec 4 14:50:55 2020 New Revision: 368329 URL: https://svnweb.freebsd.org/changeset/base/368329 Log: Fix definition of int64_t and uint64_t when long is 64-bit. This gets the kernel shim code in line with the rest of the kernel, sys/x86/include/_types.h. MFC after: 1 week Sponsored by: Mellanox Technologies // NVIDIA Networking Modified: head/stand/kshim/bsd_kernel.h Modified: head/stand/kshim/bsd_kernel.h ============================================================================== --- head/stand/kshim/bsd_kernel.h Fri Dec 4 14:09:12 2020 (r368328) +++ head/stand/kshim/bsd_kernel.h Fri Dec 4 14:50:55 2020 (r368329) @@ -208,9 +208,17 @@ typedef unsigned int uint32_t; #define _INT32_T_DECLARED typedef signed int int32_t; #define _UINT64_T_DECLARED +#ifndef __LP64__ typedef unsigned long long uint64_t; +#else +typedef unsigned long uint64_t; +#endif #define _INT16_T_DECLARED +#ifndef __LP64__ typedef signed long long int64_t; +#else +typedef signed long int64_t; +#endif typedef uint16_t uid_t; typedef uint16_t gid_t; From owner-svn-src-head@freebsd.org Fri Dec 4 14:52:41 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E17934A2B55; Fri, 4 Dec 2020 14:52:41 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CnbKP5twkz4pc0; Fri, 4 Dec 2020 14:52:41 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BD07157D2; Fri, 4 Dec 2020 14:52:41 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B4Eqf93029138; Fri, 4 Dec 2020 14:52:41 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B4Eqfq8029137; Fri, 4 Dec 2020 14:52:41 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202012041452.0B4Eqfq8029137@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 4 Dec 2020 14:52:41 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368330 - head/stand/kshim X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/stand/kshim X-SVN-Commit-Revision: 368330 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Dec 2020 14:52:41 -0000 Author: hselasky Date: Fri Dec 4 14:52:41 2020 New Revision: 368330 URL: https://svnweb.freebsd.org/changeset/base/368330 Log: Add more macros, types and prototypes for building kernel code into bootloaders. MFC after: 1 week Sponsored by: Mellanox Technologies // NVIDIA Networking Modified: head/stand/kshim/bsd_kernel.h Modified: head/stand/kshim/bsd_kernel.h ============================================================================== --- head/stand/kshim/bsd_kernel.h Fri Dec 4 14:50:55 2020 (r368329) +++ head/stand/kshim/bsd_kernel.h Fri Dec 4 14:52:41 2020 (r368330) @@ -38,6 +38,7 @@ #include #include +#define offsetof(type, field) __builtin_offsetof(type, field) #define howmany(x, y) (((x)+((y)-1))/(y)) #define nitems(x) (sizeof((x)) / sizeof((x)[0])) #define isalpha(x) (((x) >= 'a' && (x) <= 'z') || ((x) >= 'A' && (x) <= 'Z')) @@ -77,6 +78,7 @@ struct sysctl_req { #define EVENTHANDLER_DECLARE(...) #define EVENTHANDLER_INVOKE(...) #define KASSERT(...) +#define CTASSERT(x) _Static_assert(x, "compile-time assertion failed") #define SCHEDULER_STOPPED(x) (0) #define PI_SWI(...) (0) #define UNIQ_NAME(x) x @@ -119,6 +121,8 @@ SYSINIT_ENTRY(uniq##_entry, "sysuninit", (subs), \ #define hz 1000 #undef PAGE_SIZE #define PAGE_SIZE 4096 +#undef PAGE_SHIFT +#define PAGE_SHIFT 12 #undef MIN #define MIN(a,b) (((a) < (b)) ? (a) : (b)) #undef MAX @@ -227,10 +231,21 @@ typedef uint16_t mode_t; typedef uint8_t *caddr_t; #define _UINTPTR_T_DECLARED typedef unsigned long uintptr_t; +#define _UINTMAX_T_DECLARED +typedef unsigned long uintmax_t; +typedef unsigned long vm_paddr_t; #define _SIZE_T_DECLARED typedef unsigned long size_t; -typedef unsigned long u_long; +#define _SSIZE_T_DECLARED +typedef signed long ssize_t; +#define _OFF_T_DECLARED +typedef unsigned long off_t; + +typedef unsigned char u_char; +typedef unsigned short u_short; +typedef unsigned int u_int; +typedef unsigned long u_long; #endif typedef unsigned long bus_addr_t; @@ -491,6 +506,7 @@ void module_register(void *); void *memset(void *, int, size_t len); void *memcpy(void *, const void *, size_t len); +int memcmp(const void *, const void *, size_t len); int printf(const char *,...) __printflike(1, 2); int snprintf(char *restrict str, size_t size, const char *restrict format,...) __printflike(3, 4); size_t strlen(const char *s); From owner-svn-src-head@freebsd.org Fri Dec 4 14:57:13 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 906E54A2EA7; Fri, 4 Dec 2020 14:57:13 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CnbQd3gHLz4pmT; Fri, 4 Dec 2020 14:57:13 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 705035893; Fri, 4 Dec 2020 14:57:13 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B4EvDaZ029436; Fri, 4 Dec 2020 14:57:13 GMT (envelope-from mmel@FreeBSD.org) Received: (from mmel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B4EvCxS029432; Fri, 4 Dec 2020 14:57:12 GMT (envelope-from mmel@FreeBSD.org) Message-Id: <202012041457.0B4EvCxS029432@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmel set sender to mmel@FreeBSD.org using -f From: Michal Meloun Date: Fri, 4 Dec 2020 14:57:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368331 - head/sys/dev/iicbus/pmic X-SVN-Group: head X-SVN-Commit-Author: mmel X-SVN-Commit-Paths: head/sys/dev/iicbus/pmic X-SVN-Commit-Revision: 368331 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Dec 2020 14:57:13 -0000 Author: mmel Date: Fri Dec 4 14:57:12 2020 New Revision: 368331 URL: https://svnweb.freebsd.org/changeset/base/368331 Log: Add a driver for ACT8846 used as PMIC for RK3288 SoC. Added: head/sys/dev/iicbus/pmic/ head/sys/dev/iicbus/pmic/act8846.c (contents, props changed) head/sys/dev/iicbus/pmic/act8846.h (contents, props changed) head/sys/dev/iicbus/pmic/act8846_reg.h (contents, props changed) head/sys/dev/iicbus/pmic/act8846_regulator.c (contents, props changed) Added: head/sys/dev/iicbus/pmic/act8846.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/iicbus/pmic/act8846.c Fri Dec 4 14:57:12 2020 (r368331) @@ -0,0 +1,258 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2019 Michal Meloun + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +/* + * ACT8846 PMIC driver + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include +#include + +#include + +#include "regdev_if.h" + +static struct ofw_compat_data compat_data[] = { + {"active-semi,act8846", 1}, + {NULL, 0} +}; + +#define LOCK(_sc) sx_xlock(&(_sc)->lock) +#define UNLOCK(_sc) sx_xunlock(&(_sc)->lock) +#define LOCK_INIT(_sc) sx_init(&(_sc)->lock, "act8846") +#define LOCK_DESTROY(_sc) sx_destroy(&(_sc)->lock); +#define ASSERT_LOCKED(_sc) sx_assert(&(_sc)->lock, SA_XLOCKED); +#define ASSERT_UNLOCKED(_sc) sx_assert(&(_sc)->lock, SA_UNLOCKED); + + +/* + * Raw register access function. + */ +int +act8846_read(struct act8846_softc *sc, uint8_t reg, uint8_t *val) +{ + uint8_t addr; + int rv; + struct iic_msg msgs[2] = { + {0, IIC_M_WR, 1, &addr}, + {0, IIC_M_RD, 1, val}, + }; + + msgs[0].slave = sc->bus_addr; + msgs[1].slave = sc->bus_addr; + addr = reg; + + rv = iicbus_transfer_excl(sc->dev, msgs, 2, IIC_INTRWAIT); + if (rv != 0) { + device_printf(sc->dev, + "Error when reading reg 0x%02X, rv: %d\n", reg, rv); + return (EIO); + } + + return (0); +} + +int act8846_read_buf(struct act8846_softc *sc, uint8_t reg, uint8_t *buf, + size_t size) +{ + uint8_t addr; + int rv; + struct iic_msg msgs[2] = { + {0, IIC_M_WR, 1, &addr}, + {0, IIC_M_RD, size, buf}, + }; + + msgs[0].slave = sc->bus_addr; + msgs[1].slave = sc->bus_addr; + addr = reg; + + rv = iicbus_transfer_excl(sc->dev, msgs, 2, IIC_INTRWAIT); + if (rv != 0) { + device_printf(sc->dev, + "Error when reading reg 0x%02X, rv: %d\n", reg, rv); + return (EIO); + } + + return (0); +} + +int +act8846_write(struct act8846_softc *sc, uint8_t reg, uint8_t val) +{ + uint8_t data[2]; + int rv; + + struct iic_msg msgs[1] = { + {0, IIC_M_WR, 2, data}, + }; + + msgs[0].slave = sc->bus_addr; + data[0] = reg; + data[1] = val; + + rv = iicbus_transfer_excl(sc->dev, msgs, 1, IIC_INTRWAIT); + if (rv != 0) { + device_printf(sc->dev, + "Error when writing reg 0x%02X, rv: %d\n", reg, rv); + return (EIO); + } + return (0); +} + +int act8846_write_buf(struct act8846_softc *sc, uint8_t reg, uint8_t *buf, + size_t size) +{ + uint8_t data[1]; + int rv; + struct iic_msg msgs[2] = { + {0, IIC_M_WR, 1, data}, + {0, IIC_M_WR | IIC_M_NOSTART, size, buf}, + }; + + msgs[0].slave = sc->bus_addr; + msgs[1].slave = sc->bus_addr; + data[0] = reg; + + rv = iicbus_transfer_excl(sc->dev, msgs, 2, IIC_INTRWAIT); + if (rv != 0) { + device_printf(sc->dev, + "Error when writing reg 0x%02X, rv: %d\n", reg, rv); + return (EIO); + } + return (0); +} + +int +act8846_modify(struct act8846_softc *sc, uint8_t reg, uint8_t clear, uint8_t set) +{ + uint8_t val; + int rv; + + rv = act8846_read(sc, reg, &val); + if (rv != 0) + return (rv); + + val &= ~clear; + val |= set; + + rv = act8846_write(sc, reg, val); + if (rv != 0) + return (rv); + + return (0); +} + +static int +act8846_probe(device_t dev) +{ + + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + + if (!ofw_bus_search_compatible(dev, compat_data)->ocd_data) + return (ENXIO); + + device_set_desc(dev, "ACT8846 PMIC"); + return (BUS_PROBE_DEFAULT); +} + +static int +act8846_attach(device_t dev) +{ + struct act8846_softc *sc; + int rv; + phandle_t node; + + sc = device_get_softc(dev); + sc->dev = dev; + sc->bus_addr = iicbus_get_addr(dev); + node = ofw_bus_get_node(sc->dev); + rv = 0; + LOCK_INIT(sc); + + + rv = act8846_regulator_attach(sc, node); + if (rv != 0) + goto fail; + + return (bus_generic_attach(dev)); + +fail: + LOCK_DESTROY(sc); + return (rv); +} + +static int +act8846_detach(device_t dev) +{ + struct act8846_softc *sc; + + sc = device_get_softc(dev); + LOCK_DESTROY(sc); + + return (bus_generic_detach(dev)); +} + +static device_method_t act8846_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, act8846_probe), + DEVMETHOD(device_attach, act8846_attach), + DEVMETHOD(device_detach, act8846_detach), + + /* Regdev interface */ + DEVMETHOD(regdev_map, act8846_regulator_map), + + DEVMETHOD_END +}; + +static devclass_t act8846_devclass; +static DEFINE_CLASS_0(act8846_pmu, act8846_driver, act8846_methods, + sizeof(struct act8846_softc)); +EARLY_DRIVER_MODULE(act8846_pmic, iicbus, act8846_driver, act8846_devclass, + NULL, NULL, BUS_PASS_INTERRUPT + BUS_PASS_ORDER_LAST); +MODULE_VERSION(act8846_pmic, 1); +MODULE_DEPEND(act8846_pmic, iicbus, IICBUS_MINVER, IICBUS_PREFVER, + IICBUS_MAXVER); +IICBUS_FDT_PNP_INFO(compat_data); \ No newline at end of file Added: head/sys/dev/iicbus/pmic/act8846.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/iicbus/pmic/act8846.h Fri Dec 4 14:57:12 2020 (r368331) @@ -0,0 +1,67 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2019 Michal Meloun + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _ACT8846_H_ +#define _ACT8846_H_ + +#include + +struct act8846_reg_sc; +struct act8846_gpio_pin; + +struct act8846_softc { + device_t dev; + struct sx lock; + int bus_addr; + + /* Regulators. */ + struct act8846_reg_sc **regs; + int nregs; +}; + +#define RD1(sc, reg, val) act8846_read(sc, reg, val) +#define WR1(sc, reg, val) act8846_write(sc, reg, val) +#define RM1(sc, reg, clr, set) act8846_modify(sc, reg, clr, set) + +int act8846_read(struct act8846_softc *sc, uint8_t reg, uint8_t *val); +int act8846_write(struct act8846_softc *sc, uint8_t reg, uint8_t val); +int act8846_modify(struct act8846_softc *sc, uint8_t reg, uint8_t clear, + uint8_t set); +int act8846_read_buf(struct act8846_softc *sc, uint8_t reg, uint8_t *buf, + size_t size); +int act8846_write_buf(struct act8846_softc *sc, uint8_t reg, uint8_t *buf, + size_t size); + +/* Regulators */ +int act8846_regulator_attach(struct act8846_softc *sc, phandle_t node); +int act8846_regulator_map(device_t dev, phandle_t xref, int ncells, + pcell_t *cells, int *num); + +#endif /* _ACT8846_H_ */ Added: head/sys/dev/iicbus/pmic/act8846_reg.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/iicbus/pmic/act8846_reg.h Fri Dec 4 14:57:12 2020 (r368331) @@ -0,0 +1,83 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2019 Michal Meloun + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + + +#ifndef _ACT8846_REG_H_ +#define _ACT8846_REG_H_ + + +/* ACT8846 registers. */ +#define ACT8846_SYS0 0x00 +#define ACT8846_SYS1 0x01 +#define ACT8846_REG1_CTRL 0x12 +#define ACT8846_REG2_VSET0 0x20 +#define ACT8846_REG2_VSET1 0x21 +#define ACT8846_REG2_CTRL 0x22 +#define ACT8846_REG3_VSET0 0x30 +#define ACT8846_REG3_VSET1 0x31 +#define ACT8846_REG3_CTRL 0x32 +#define ACT8846_REG4_VSET0 0x40 +#define ACT8846_REG4_VSET1 0x41 +#define ACT8846_REG4_CTRL 0x42 +#define ACT8846_REG5_VSET 0x50 +#define ACT8846_REG5_CTRL 0x51 +#define ACT8846_REG6_VSET 0x58 +#define ACT8846_REG6_CTRL 0x59 +#define ACT8846_REG7_VSET 0x60 +#define ACT8846_REG7_CTRL 0x61 +#define ACT8846_REG8_VSET 0x68 +#define ACT8846_REG8_CTRL 0x69 +#define ACT8846_REG9_VSET 0x70 +#define ACT8846_REG9_CTRL 0x71 +#define ACT8846_REG10_VSET 0x80 +#define ACT8846_REG10_CTRL 0x81 +#define ACT8846_REG11_VSET 0x90 +#define ACT8846_REG11_CTRL 0x91 +#define ACT8846_REG12_VSET 0xa0 +#define ACT8846_REG12_CTRL 0xa1 +#define ACT8846_REG13_CTRL 0xb1 +#define ACT8846_PB0 0xc0 +#define ACT8846_PB1 0xc1 +#define ACT8846_PB2 0xc2 +#define ACT8846_PB3 0xc3 +#define ACT8846_PB4 0xc4 +#define ACT8846_GPIO6 0xe3 +#define ACT8846_GPIO5 0xe4 +#define ACT8846_GPIO3 0xf4 +#define ACT8846_GPIO4 0xf5 + +/* Common REGxx_CTRL bits */ +#define ACT8846_CTRL_ENA 0x80 +#define ACT8846_CTRL_OK 0x01 + +/* Common REGxx_VSEL bits */ +#define ACT8846_VSEL_MASK 0x3f + + +#endif /* _ACT8846_REG_H_ */ Added: head/sys/dev/iicbus/pmic/act8846_regulator.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/iicbus/pmic/act8846_regulator.c Fri Dec 4 14:57:12 2020 (r368331) @@ -0,0 +1,506 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2019 Michal Meloun + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include + +#include + +#include + +#include "regdev_if.h" + +MALLOC_DEFINE(M_ACT8846_REG, "ACT8846 regulator", "ACT8846 power regulator"); + +#if 0 +#define dprintf(sc, format, arg...) + device_printf(sc->base_sc->dev, "%s: " format, __func__, arg) */ +#else +#define dprintf(sc, format, arg...) +#endif + +enum act8846_reg_id { + ACT8846_REG_ID_REG1, + ACT8846_REG_ID_REG2, + ACT8846_REG_ID_REG3, + ACT8846_REG_ID_REG4, + ACT8846_REG_ID_REG5, + ACT8846_REG_ID_REG6, + ACT8846_REG_ID_REG7, + ACT8846_REG_ID_REG8, + ACT8846_REG_ID_REG9, + ACT8846_REG_ID_REG10, + ACT8846_REG_ID_REG11, + ACT8846_REG_ID_REG12, + ACT8846_REG_ID_REG13, +}; + +struct act8846_regdef { + intptr_t id; /* ID */ + char *name; /* Regulator name */ + char *supply_name; /* Source property name */ + uint8_t enable_reg; + uint8_t enable_mask; + uint8_t voltage_reg; + uint8_t voltage_mask; + struct regulator_range *ranges; + int nranges; +}; +struct act8846_softc; + +struct act8846_reg_sc { + struct regnode *regnode; + struct act8846_softc *base_sc; + struct act8846_regdef *def; + phandle_t xref; + struct regnode_std_param *param; +}; + + +static struct regulator_range act8846_ranges[] = { + REG_RANGE_INIT( 0, 23, 600000, 25000), + REG_RANGE_INIT( 24, 47, 1200000, 50000), + REG_RANGE_INIT( 48, 64, 2400000, 100000), +}; + +static struct act8846_regdef act8846_regdefs[] = { + { + .id = ACT8846_REG_ID_REG1, + .name = "REG1", + .supply_name = "vp1", + .enable_reg = ACT8846_REG1_CTRL, + .enable_mask = ACT8846_CTRL_ENA, + }, + { + .id = ACT8846_REG_ID_REG2, + .name = "REG2", + .supply_name = "vp2", + .enable_reg = ACT8846_REG2_CTRL, + .enable_mask = ACT8846_CTRL_ENA, + .voltage_reg = ACT8846_REG2_VSET0, + .voltage_mask = ACT8846_VSEL_MASK, + .ranges = act8846_ranges, + .nranges = nitems(act8846_ranges), + }, + { + .id = ACT8846_REG_ID_REG3, + .name = "REG3", + .supply_name = "vp3", + .enable_reg = ACT8846_REG3_CTRL, + .enable_mask = ACT8846_CTRL_ENA, + .voltage_reg = ACT8846_REG3_VSET0, + .voltage_mask = ACT8846_VSEL_MASK, + .ranges = act8846_ranges, + .nranges = nitems(act8846_ranges), + }, + { + .id = ACT8846_REG_ID_REG4, + .name = "REG4", + .supply_name = "vp4", + .enable_reg = ACT8846_REG4_CTRL, + .enable_mask = ACT8846_CTRL_ENA, + .voltage_reg = ACT8846_REG4_VSET0, + .voltage_mask = ACT8846_VSEL_MASK, + .ranges = act8846_ranges, + .nranges = nitems(act8846_ranges), + }, + { + .id = ACT8846_REG_ID_REG5, + .name = "REG5", + .supply_name = "inl1", + .enable_reg = ACT8846_REG5_CTRL, + .enable_mask = ACT8846_CTRL_ENA, + .voltage_reg = ACT8846_REG5_VSET, + .voltage_mask = ACT8846_VSEL_MASK, + .ranges = act8846_ranges, + .nranges = nitems(act8846_ranges), + }, + { + .id = ACT8846_REG_ID_REG6, + .name = "REG6", + .supply_name = "inl1", + .enable_reg = ACT8846_REG6_CTRL, + .enable_mask = ACT8846_CTRL_ENA, + .voltage_reg = ACT8846_REG6_VSET, + .voltage_mask = ACT8846_VSEL_MASK, + .ranges = act8846_ranges, + .nranges = nitems(act8846_ranges), + }, + { + .id = ACT8846_REG_ID_REG7, + .name = "REG7", + .supply_name = "inl1", + .enable_reg = ACT8846_REG7_CTRL, + .enable_mask = ACT8846_CTRL_ENA, + .voltage_reg = ACT8846_REG7_VSET, + .voltage_mask = ACT8846_VSEL_MASK, + .ranges = act8846_ranges, + .nranges = nitems(act8846_ranges), + }, + { + .id = ACT8846_REG_ID_REG8, + .name = "REG8", + .supply_name = "inl2", + .enable_reg = ACT8846_REG8_CTRL, + .enable_mask = ACT8846_CTRL_ENA, + .voltage_reg = ACT8846_REG8_VSET, + .voltage_mask = ACT8846_VSEL_MASK, + .ranges = act8846_ranges, + .nranges = nitems(act8846_ranges), + }, + { + .id = ACT8846_REG_ID_REG9, + .name = "REG9", + .supply_name = "inl2", + .enable_reg = ACT8846_REG9_CTRL, + .enable_mask = ACT8846_CTRL_ENA, + .voltage_reg = ACT8846_REG9_VSET, + .voltage_mask = ACT8846_VSEL_MASK, + .ranges = act8846_ranges, + .nranges = nitems(act8846_ranges), + }, + { + .id = ACT8846_REG_ID_REG10, + .name = "REG10", + .supply_name = "inl3", + .enable_reg = ACT8846_REG10_CTRL, + .enable_mask = ACT8846_CTRL_ENA, + .voltage_reg = ACT8846_REG10_VSET, + .voltage_mask = ACT8846_VSEL_MASK, + .ranges = act8846_ranges, + .nranges = nitems(act8846_ranges), + }, + { + .id = ACT8846_REG_ID_REG11, + .name = "REG11", + .supply_name = "inl3", + .enable_reg = ACT8846_REG11_CTRL, + .enable_mask = ACT8846_CTRL_ENA, + .voltage_reg = ACT8846_REG11_VSET, + .voltage_mask = ACT8846_VSEL_MASK, + .ranges = act8846_ranges, + .nranges = nitems(act8846_ranges), + }, + { + .id = ACT8846_REG_ID_REG12, + .name = "REG12", + .supply_name = "inl3", + .enable_reg = ACT8846_REG12_CTRL, + .enable_mask = ACT8846_CTRL_ENA, + .voltage_reg = ACT8846_REG12_VSET, + .voltage_mask = ACT8846_VSEL_MASK, + .ranges = act8846_ranges, + .nranges = nitems(act8846_ranges), + }, + { + .id = ACT8846_REG_ID_REG13, + .name = "REG13", + .supply_name = "inl1", + .enable_reg = ACT8846_REG13_CTRL, + .enable_mask = ACT8846_CTRL_ENA, + }, +}; + +static int +act8846_read_sel(struct act8846_reg_sc *sc, uint8_t *sel) +{ + int rv; + + rv = RD1(sc->base_sc, sc->def->voltage_reg, sel); + if (rv != 0) + return (rv); + *sel &= sc->def->voltage_mask; + *sel >>= ffs(sc->def->voltage_mask) - 1; + return (0); +} + +static int +act8846_write_sel(struct act8846_reg_sc *sc, uint8_t sel) +{ + int rv; + + sel <<= ffs(sc->def->voltage_mask) - 1; + sel &= sc->def->voltage_mask; + + rv = RM1(sc->base_sc, sc->def->voltage_reg, + sc->def->voltage_mask, sel); + if (rv != 0) + return (rv); + return (rv); +} + +static int +act8846_regnode_init(struct regnode *regnode) +{ + return (0); +} + +static int +act8846_regnode_enable(struct regnode *regnode, bool enable, int *udelay) +{ + struct act8846_reg_sc *sc; + int rv; + + sc = regnode_get_softc(regnode); + + dprintf(sc, "%sabling regulator %s\n", + enable ? "En" : "Dis", + sc->def->name); + rv = RM1(sc->base_sc, sc->def->enable_reg, + sc->def->enable_mask, enable ? sc->def->enable_mask: 0); + *udelay = sc->param->enable_delay; + + return (rv); +} + +static int +act8846_regnode_set_voltage(struct regnode *regnode, int min_uvolt, + int max_uvolt, int *udelay) +{ + struct act8846_reg_sc *sc; + uint8_t sel; + int uvolt, rv; + + sc = regnode_get_softc(regnode); + + if (sc->def->ranges == NULL) + return (ENXIO); + + dprintf(sc, "Setting %s to %d<->%d uvolts\n", + sc->def->name, + min_uvolt, + max_uvolt); + rv = regulator_range_volt_to_sel8(sc->def->ranges, sc->def->nranges, + min_uvolt, max_uvolt, &sel); + if (rv != 0) + return (rv); + *udelay = sc->param->ramp_delay; + rv = act8846_write_sel(sc, sel); + + act8846_read_sel(sc, &sel); + regulator_range_sel8_to_volt(sc->def->ranges, sc->def->nranges, + sel, &uvolt); + dprintf(sc, "Regulator %s set to %d uvolt\n", sc->def->name, + uvolt); + + return (rv); +} + +static int +act8846_regnode_get_voltage(struct regnode *regnode, int *uvolt) +{ + struct act8846_reg_sc *sc; + uint8_t sel; + int rv; + + sc = regnode_get_softc(regnode); + + if (sc->def->ranges == NULL) { + if (sc->def->id == ACT8846_REG_ID_REG13) { + *uvolt = 1800000; + return (0); + } + return (ENXIO); + } + + rv = act8846_read_sel(sc, &sel); + if (rv != 0) + return (rv); + rv = regulator_range_sel8_to_volt(sc->def->ranges, sc->def->nranges, + sel, uvolt); + dprintf(sc, "Regulator %s is at %d uvolt\n", sc->def->name, + *uvolt); + + return (rv); +} + +static regnode_method_t act8846_regnode_methods[] = { + /* Regulator interface */ + REGNODEMETHOD(regnode_init, act8846_regnode_init), + REGNODEMETHOD(regnode_enable, act8846_regnode_enable), + REGNODEMETHOD(regnode_set_voltage, act8846_regnode_set_voltage), + REGNODEMETHOD(regnode_get_voltage, act8846_regnode_get_voltage), + REGNODEMETHOD_END +}; +DEFINE_CLASS_1(act8846_regnode, act8846_regnode_class, act8846_regnode_methods, + sizeof(struct act8846_reg_sc), regnode_class); + +static int +act8846_fdt_parse(struct act8846_softc *sc, phandle_t pnode, phandle_t node, + struct act8846_regdef *def, struct regnode_init_def *init_def) +{ + int rv; + phandle_t supply_node; + char prop_name[64]; /* Maximum OFW property name length. */ + + rv = regulator_parse_ofw_stdparam(sc->dev, node, init_def); + + /* Get parent supply. */ + if (def->supply_name == NULL) + return (0); + + snprintf(prop_name, sizeof(prop_name), "%s-supply", + def->supply_name); + rv = OF_getencprop(pnode, prop_name, &supply_node, + sizeof(supply_node)); + if (rv <= 0) + return (rv); + supply_node = OF_node_from_xref(supply_node); + rv = OF_getprop_alloc(supply_node, "regulator-name", + (void **)&init_def->parent_name); + if (rv <= 0) + init_def->parent_name = NULL; + return (0); +} + +static struct act8846_reg_sc * +act8846_attach(struct act8846_softc *sc, phandle_t pnode, phandle_t node, + struct act8846_regdef *def) +{ + struct act8846_reg_sc *reg_sc; + struct regnode_init_def initdef; + struct regnode *regnode; + + memset(&initdef, 0, sizeof(initdef)); + if (act8846_fdt_parse(sc, pnode, node, def, &initdef) != 0) { + device_printf(sc->dev, "cannot parse FDT data for regulator\n"); + return (NULL); + } + initdef.id = def->id; + initdef.ofw_node = node; + + regnode = regnode_create(sc->dev, &act8846_regnode_class, &initdef); + if (regnode == NULL) { + device_printf(sc->dev, "cannot create regulator\n"); + return (NULL); + } + + reg_sc = regnode_get_softc(regnode); + reg_sc->base_sc = sc; + reg_sc->def = def; + reg_sc->xref = OF_xref_from_node(node); + reg_sc->param = regnode_get_stdparam(regnode); + + regnode_register(regnode); + + if (bootverbose) { + int volt, rv; + regnode_topo_slock(); + rv = regnode_get_voltage(regnode, &volt); + if (rv == ENODEV) { + device_printf(sc->dev, + " Regulator %s: parent doesn't exist yet.\n", + regnode_get_name(regnode)); + } else if (rv != 0) { + device_printf(sc->dev, + " Regulator %s: voltage: INVALID!!!\n", + regnode_get_name(regnode)); + } else { + device_printf(sc->dev, + " Regulator %s: voltage: %d uV\n", + regnode_get_name(regnode), volt); + } + regnode_topo_unlock(); + } + + return (reg_sc); +} + + +int +act8846_regulator_attach(struct act8846_softc *sc, phandle_t node) +{ + struct act8846_reg_sc *reg; + phandle_t child, rnode; + int i; + + rnode = ofw_bus_find_child(node, "regulators"); + if (rnode <= 0) { + device_printf(sc->dev, " Cannot find regulators subnode\n"); + return (ENXIO); + } + + /* ACT8846 specific definitio. */ + sc->nregs = nitems(act8846_regdefs); + sc->regs = malloc(sizeof(struct act8846_reg_sc *) * sc->nregs, + M_ACT8846_REG, M_WAITOK | M_ZERO); + + + /* Attach all known regulators if exist in DT. */ + for (i = 0; i < sc->nregs; i++) { + child = ofw_bus_find_child(rnode, act8846_regdefs[i].name); + if (child == 0) { + if (bootverbose) + device_printf(sc->dev, + "Regulator %s missing in DT\n", + act8846_regdefs[i].name); + continue; + } + reg = act8846_attach(sc, node, child, act8846_regdefs + i); + if (reg == NULL) { + device_printf(sc->dev, "Cannot attach regulator: %s\n", + act8846_regdefs[i].name); + return (ENXIO); + } + sc->regs[i] = reg; + } + return (0); +} + +int +act8846_regulator_map(device_t dev, phandle_t xref, int ncells, + pcell_t *cells, int *num) +{ + struct act8846_softc *sc; + int i; + + sc = device_get_softc(dev); + for (i = 0; i < sc->nregs; i++) { + if (sc->regs[i] == NULL) + continue; + if (sc->regs[i]->xref == xref) { + *num = sc->regs[i]->def->id; + return (0); + } + } + return (ENXIO); +} From owner-svn-src-head@freebsd.org Fri Dec 4 15:09:43 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 1B48E4A2E57; Fri, 4 Dec 2020 15:09:43 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Cnbj26FzTz4qct; Fri, 4 Dec 2020 15:09:42 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C4BD557FD; Fri, 4 Dec 2020 15:09:42 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B4F9glf035950; Fri, 4 Dec 2020 15:09:42 GMT (envelope-from mmel@FreeBSD.org) Received: (from mmel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B4F9gjg035949; Fri, 4 Dec 2020 15:09:42 GMT (envelope-from mmel@FreeBSD.org) Message-Id: <202012041509.0B4F9gjg035949@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmel set sender to mmel@FreeBSD.org using -f From: Michal Meloun Date: Fri, 4 Dec 2020 15:09:42 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368332 - head/sys/dev/iicbus/rtc X-SVN-Group: head X-SVN-Commit-Author: mmel X-SVN-Commit-Paths: head/sys/dev/iicbus/rtc X-SVN-Commit-Revision: 368332 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Dec 2020 15:09:43 -0000 Author: mmel Date: Fri Dec 4 15:09:42 2020 New Revision: 368332 URL: https://svnweb.freebsd.org/changeset/base/368332 Log: Add a driver for HYM8563 based RTC. Added: head/sys/dev/iicbus/rtc/hym8563.c (contents, props changed) Added: head/sys/dev/iicbus/rtc/hym8563.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/iicbus/rtc/hym8563.c Fri Dec 4 15:09:42 2020 (r368332) @@ -0,0 +1,314 @@ +/*- + * Copyright (c) 2017 Hiroki Mori. All rights reserved. + * Copyright (c) 2017 Ian Lepore. All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT + * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, + * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY + * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT + * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF + * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. + * + * This code base on isl12xx.c + */ + +#include +__FBSDID("$FreeBSD$"); + +/* + * Driver for realtime clock HAOYU HYM8563 + */ + +#include "opt_platform.h" + +#include +#include +#include +#include +#include +#include +#include + +#ifdef FDT +#include +#include +#endif + +#include +#include + +#include "clock_if.h" +#include "iicbus_if.h" + +/* Registers */ +#define HYM8563_CTRL1 0x00 +#define HYM8563_CTRL1_TEST (1 << 7) +#define HYM8563_CTRL1_STOP (1 << 5) +#define HYM8563_CTRL1_TESTC (1 << 3) + +#define HYM8563_CTRL2 0x01 +#define HYM8563_CTRL2_TI_TP (1 << 4) +#define HYM8563_CTRL2_AF (1 << 3) +#define HYM8563_CTRL2_TF (1 << 2) +#define HYM8563_CTRL2_AIE (1 << 1) +#define HYM8563_CTRL2_TIE (1 << 0) + +#define HYM8563_SEC 0x02 /* plus battery low bit */ +#define HYM8563_SEC_VL (1 << 7) + +#define HYM8563_MIN 0x03 +#define HYM8563_HOUR 0x04 +#define HYM8563_DAY 0x05 +#define HYM8563_WEEKDAY 0x06 +#define HYM8563_MONTH 0x07 /* plus 1 bit for century */ +#define HYM8563_MONTH_CENTURY (1 << 7) +#define HYM8563_YEAR 0x08 + +struct hym8563_softc { + device_t dev; + struct intr_config_hook init_hook; +}; + +#ifdef FDT +static struct ofw_compat_data compat_data[] = { + {"haoyu,hym8563", 1}, + {NULL, 0}, +}; +#endif + + +static inline int +hym8563_read_buf(struct hym8563_softc *sc, uint8_t reg, uint8_t *buf, + uint16_t buflen) +{ + + return (iicdev_readfrom(sc->dev, reg, buf, buflen, IIC_WAIT)); +} + +static inline int +hym8563_write_buf(struct hym8563_softc *sc, uint8_t reg, uint8_t *buf, + uint16_t buflen) +{ + + return (iicdev_writeto(sc->dev, reg, buf, buflen, IIC_WAIT)); +} + +static inline int +hym8563_read_1(struct hym8563_softc *sc, uint8_t reg, uint8_t *data) +{ + + return (iicdev_readfrom(sc->dev, reg, data, 1, IIC_WAIT)); +} + +static inline int +hym8563_write_1(struct hym8563_softc *sc, uint8_t reg, uint8_t val) +{ + + return (iicdev_writeto(sc->dev, reg, &val, 1, IIC_WAIT)); +} + +static int +hym8563_gettime(device_t dev, struct timespec *ts) +{ + struct hym8563_softc *sc; + struct bcd_clocktime bct; + uint8_t buf[7]; + int rv; + + sc = device_get_softc(dev); + + /* Read all RTC data */ + rv = hym8563_read_buf(sc, HYM8563_SEC, buf, sizeof(buf)); + if (rv != 0) { + device_printf(sc->dev, "Cannot read time registers: %d\n", rv); + return (rv); + } + + /* Check for low voltage flag */ + if (buf[0] & HYM8563_SEC_VL) + { + device_printf(sc->dev, + "WARNING: RTC battery failed; time is invalid\n"); + return (EINVAL); + } + + bzero(&bct, sizeof(bct)); + bct.sec = buf[0] & 0x7F; + bct.min = buf[1] & 0x7F; + bct.hour = buf[2] & 0x3f; + bct.day = buf[3] & 0x3f; + /* buf[4] is weekday */ + bct.mon = buf[5] & 0x1f; + bct.year = buf[6] & 0xff; + if (buf[5] & HYM8563_MONTH_CENTURY) + bct.year += 0x100; + + clock_dbgprint_bcd(sc->dev, CLOCK_DBG_READ, &bct); + return (clock_bcd_to_ts(&bct, ts, false)); +} + +static int +hym8563_settime(device_t dev, struct timespec *ts) +{ + struct hym8563_softc *sc; + struct bcd_clocktime bct; + uint8_t buf[7]; + int rv; + + sc = device_get_softc(dev); + ts->tv_sec -= utc_offset(); + clock_ts_to_bcd(ts, &bct, false); + clock_dbgprint_bcd(sc->dev, CLOCK_DBG_WRITE, &bct); + + buf[0] = bct.sec; /* Also clear VL flag */ + buf[1] = bct.min; + buf[2] = bct.hour; + buf[3] = bct.day; + buf[4] = bct.dow; + buf[5] = bct.mon; + buf[6] = bct.year & 0xFF; + if (bct.year > 0x99) + buf[5] |= HYM8563_MONTH_CENTURY; + + /* Stop RTC */ + rv = hym8563_write_1(sc, HYM8563_CTRL1, HYM8563_CTRL1_STOP); + if (rv != 0) { + device_printf(sc->dev, "Cannot write CTRL1 register: %d\n", rv); + return (rv); + } + + /* Write all RTC data */ + rv = hym8563_write_buf(sc, HYM8563_SEC, buf, sizeof(buf)); + if (rv != 0) { + device_printf(sc->dev, "Cannot write time registers: %d\n", rv); + return (rv); + } + return (rv); + + /* Start RTC again */ + rv = hym8563_write_1(sc, HYM8563_CTRL1, 0); + if (rv != 0) { + device_printf(sc->dev, "Cannot write CTRL1 register: %d\n", rv); + return (rv); + } + + return (0); +} + +static void +hym8563_init(void *arg) +{ + struct hym8563_softc *sc; + uint8_t reg; + int rv; + + sc = (struct hym8563_softc*)arg; + config_intrhook_disestablish(&sc->init_hook); + + /* Clear CTL1 register (stop and test bits) */ + rv = hym8563_write_1(sc, HYM8563_CTRL1, 0); + if (rv != 0) { + device_printf(sc->dev, "Cannot init CTRL1 register: %d\n", rv); + return; + } + + /* Disable interrupts and alarms */ + rv = hym8563_read_1(sc, HYM8563_CTRL2, ®); + if (rv != 0) { + device_printf(sc->dev, "Cannot read CTRL2 register: %d\n", rv); + return; + } + rv &= ~HYM8563_CTRL2_TI_TP; + rv &= ~HYM8563_CTRL2_AF; + rv &= ~HYM8563_CTRL2_TF; + rv = hym8563_write_1(sc, HYM8563_CTRL2, 0); + if (rv != 0) { + device_printf(sc->dev, "Cannot write CTRL2 register: %d\n", rv); + return; + } + + /* + * Register as a system realtime clock. + */ + clock_register_flags(sc->dev, 1000000, 0); + clock_schedule(sc->dev, 1); + return; +} + +static int +hym8563_probe(device_t dev) +{ + +#ifdef FDT + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + + if (ofw_bus_search_compatible(dev, compat_data)->ocd_data != 0) { + device_set_desc(dev, "HYM8694 RTC"); + return (BUS_PROBE_DEFAULT); + } +#endif + return (ENXIO); +} + +static int +hym8563_attach(device_t dev) +{ + struct hym8563_softc *sc; + + sc = device_get_softc(dev); + sc->dev = dev; + + /* + * Chip init must wait until interrupts are enabled. Often i2c access + * works only when the interrupts are available. + */ + sc->init_hook.ich_func = hym8563_init; + sc->init_hook.ich_arg = sc; + if (config_intrhook_establish(&sc->init_hook) != 0) + return (ENOMEM); + + return (0); +} + +static int +hym8563_detach(device_t dev) +{ + + clock_unregister(dev); + return (0); +} + +static device_method_t hym8563_methods[] = { + /* device_if methods */ + DEVMETHOD(device_probe, hym8563_probe), + DEVMETHOD(device_attach, hym8563_attach), + DEVMETHOD(device_detach, hym8563_detach), + + /* clock_if methods */ + DEVMETHOD(clock_gettime, hym8563_gettime), + DEVMETHOD(clock_settime, hym8563_settime), + + DEVMETHOD_END, +}; + +static devclass_t hym8563_devclass; +static DEFINE_CLASS_0(hym8563_rtc, hym8563_driver, hym8563_methods, + sizeof(struct hym8563_softc)); +DRIVER_MODULE(hym8563, iicbus, hym8563_driver, hym8563_devclass, NULL, NULL); +MODULE_VERSION(hym8563, 1); +MODULE_DEPEND(hym8563, iicbus, IICBUS_MINVER, IICBUS_PREFVER, IICBUS_MAXVER); +IICBUS_FDT_PNP_INFO(compat_data); \ No newline at end of file From owner-svn-src-head@freebsd.org Fri Dec 4 15:21:12 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D49774A339B; Fri, 4 Dec 2020 15:21:12 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CnbyJ5fWhz4r73; Fri, 4 Dec 2020 15:21:12 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B4E585C8B; Fri, 4 Dec 2020 15:21:12 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B4FLCKj044104; Fri, 4 Dec 2020 15:21:12 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B4FLC8A044078; Fri, 4 Dec 2020 15:21:12 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202012041521.0B4FLC8A044078@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Fri, 4 Dec 2020 15:21:12 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368333 - head/gnu/lib X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/gnu/lib X-SVN-Commit-Revision: 368333 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Dec 2020 15:21:12 -0000 Author: kevans Date: Fri Dec 4 15:21:12 2020 New Revision: 368333 URL: https://svnweb.freebsd.org/changeset/base/368333 Log: gnu: don't build libgnuregex for WITH_GNU_GREP_COMPAT bsdgrep switched over to libregex back in r363823 to fill WITH_GNU_GREP_COMPAT, since libgnuregex in base is quite buggy and libregex is somewhat functional. Don't build libgnuregex on our account, please. Modified: head/gnu/lib/Makefile Modified: head/gnu/lib/Makefile ============================================================================== --- head/gnu/lib/Makefile Fri Dec 4 15:09:42 2020 (r368332) +++ head/gnu/lib/Makefile Fri Dec 4 15:21:12 2020 (r368333) @@ -6,8 +6,7 @@ SUBDIR= SUBDIR.${MK_DIALOG}+= libdialog SUBDIR.${MK_TESTS}+= tests -.if ${MK_GNU_GREP} != "no" || ${MK_GNU_GREP_COMPAT} != "no" || \ - ${MK_GDB} != "no" +.if ${MK_GNU_GREP} != "no" || ${MK_GDB} != "no" SUBDIR+= libregex .endif From owner-svn-src-head@freebsd.org Fri Dec 4 15:23:43 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AA9944A3168; Fri, 4 Dec 2020 15:23:43 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Cnc1C4R89z4rKp; Fri, 4 Dec 2020 15:23:43 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8AECB5AE6; Fri, 4 Dec 2020 15:23:43 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B4FNhln047791; Fri, 4 Dec 2020 15:23:43 GMT (envelope-from mmel@FreeBSD.org) Received: (from mmel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B4FNhiC047790; Fri, 4 Dec 2020 15:23:43 GMT (envelope-from mmel@FreeBSD.org) Message-Id: <202012041523.0B4FNhiC047790@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmel set sender to mmel@FreeBSD.org using -f From: Michal Meloun Date: Fri, 4 Dec 2020 15:23:43 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368334 - head/sys/dev/iicbus/pmic X-SVN-Group: head X-SVN-Commit-Author: mmel X-SVN-Commit-Paths: head/sys/dev/iicbus/pmic X-SVN-Commit-Revision: 368334 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Dec 2020 15:23:43 -0000 Author: mmel Date: Fri Dec 4 15:23:43 2020 New Revision: 368334 URL: https://svnweb.freebsd.org/changeset/base/368334 Log: Add a driver for FAN53555 based PMIC. Added: head/sys/dev/iicbus/pmic/fan53555.c (contents, props changed) Added: head/sys/dev/iicbus/pmic/fan53555.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/dev/iicbus/pmic/fan53555.c Fri Dec 4 15:23:43 2020 (r368334) @@ -0,0 +1,477 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2016 Jared McNeill + * Copyright (c) 2018 Emmanuel Vadot + * Copyright (c) 2019 Michal Meloun + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include + +#include + +#include "regdev_if.h" + +/* Registers */ +#define FAN53555_VSEL0 0x00 +#define FAN53555_VSEL1 0x01 +#define FAN53555_VSEL_ENA (1 << 7) +#define FAN53555_VSEL_MODE (1 << 6) +#define FAN53555_VSEL_MASK 0x3f +#define FAN53555_CTRL 0x02 +#define FAN53555_ID1 0x03 +#define FAN53555_ID1_DIE_ID(x) (((x) >> 4) & 0x0F) +#define FAN53555_ID2 0x04 +#define FAN53555_ID2_DIE_REV(x) (((x) >> 4) & 0x0F) +#define FAN53555_MON 0x05 + + +#if 0 +#define dprintf(sc, format, arg...) \ + device_printf(sc->base_dev, "%s: " format, __func__, arg) +#else +#define dprintf(sc, format, arg...) +#endif + +enum fan53555_pmic_type { + FAN53555 = 1, + SYR827, + SYR828, +}; + +static struct ofw_compat_data compat_data[] = { + {"fcs,fan53555", FAN53555}, + {"silergy,syr827", SYR827}, + {"silergy,syr828", SYR828}, + {NULL, 0} +}; + +struct fan53555_reg_sc { + struct regnode *regnode; + char *name; + device_t base_dev; + uint8_t live_reg; + uint8_t sleep_reg; + struct regulator_range *range; + struct regnode_std_param *param; +}; + +struct fan53555_softc { + device_t dev; + uint8_t live_reg; + uint8_t sleep_reg; +}; + +static struct regulator_range syr_8_range = + REG_RANGE_INIT( 0, 0x3F, 712500, 12500); + +static struct regulator_range fan_0_0_range = + REG_RANGE_INIT( 0, 0x3F, 600000, 10000); +static struct regulator_range fan_0_13_range = + REG_RANGE_INIT( 0, 0x3F, 800000, 10000); +static struct regulator_range fan_1_range = + REG_RANGE_INIT( 0, 0x3F, 600000, 10000); +static struct regulator_range fan_4_range = + REG_RANGE_INIT( 0, 0x3F, 603000, 12826); + + +static int +fan53555_read(device_t dev, uint8_t reg, uint8_t *val) +{ + uint8_t addr; + int rv; + struct iic_msg msgs[2] = { + {0, IIC_M_WR | IIC_M_NOSTOP, 1, &addr}, + {0, IIC_M_RD, 1, val}, + }; + + msgs[0].slave = iicbus_get_addr(dev); + msgs[1].slave = iicbus_get_addr(dev); + addr = reg; + + rv = iicbus_transfer_excl(dev, msgs, 2, IIC_INTRWAIT); + if (rv != 0) { + device_printf(dev, "Error when reading reg 0x%02X, rv: %d\n", + reg, rv); + return (EIO); + } + + return (0); +} + +static int +fan53555_write(device_t dev, uint8_t reg, uint8_t val) +{ + uint8_t data[2]; + int rv; + + struct iic_msg msgs[1] = { + {0, IIC_M_WR, 2, data}, + }; + + msgs[0].slave = iicbus_get_addr(dev); + data[0] = reg; + data[1] = val; + + rv = iicbus_transfer_excl(dev, msgs, 1, IIC_INTRWAIT); + if (rv != 0) { + device_printf(dev, + "Error when writing reg 0x%02X, rv: %d\n", reg, rv); + return (EIO); + } + return (0); +} + +static int +fan53555_read_sel(struct fan53555_reg_sc *sc, uint8_t *sel) +{ + int rv; + + rv = fan53555_read(sc->base_dev, sc->live_reg, sel); + if (rv != 0) + return (rv); + *sel &= FAN53555_VSEL_MASK; + return (0); +} + +static int +fan53555_write_sel(struct fan53555_reg_sc *sc, uint8_t sel) +{ + int rv; + uint8_t reg; + + rv = fan53555_read(sc->base_dev, sc->live_reg, ®); + if (rv != 0) + return (rv); + reg &= ~FAN53555_VSEL_MASK; + reg |= sel; + + rv = fan53555_write(sc->base_dev, sc->live_reg, reg); + if (rv != 0) + return (rv); + return (rv); +} + +static int +fan53555_regnode_init(struct regnode *regnode) +{ + return (0); +} + +static int +fan53555_regnode_enable(struct regnode *regnode, bool enable, int *udelay) +{ + struct fan53555_reg_sc *sc; + uint8_t val; + + sc = regnode_get_softc(regnode); + + dprintf(sc, "%sabling regulator %s\n", enable ? "En" : "Dis", + sc->name); + fan53555_read(sc->base_dev, sc->live_reg, &val); + if (enable) + val |=FAN53555_VSEL_ENA; + else + val &= ~FAN53555_VSEL_ENA; + fan53555_write(sc->base_dev, sc->live_reg, val); + + *udelay = sc->param->enable_delay; + return (0); +} + + +static int +fan53555_regnode_set_voltage(struct regnode *regnode, int min_uvolt, + int max_uvolt, int *udelay) +{ + struct fan53555_reg_sc *sc; + uint8_t sel; + int uvolt, rv; + + sc = regnode_get_softc(regnode); + + dprintf(sc, "Setting %s to %d<->%d uvolts\n", sc->name, min_uvolt, + max_uvolt); + rv = regulator_range_volt_to_sel8(sc->range, 1, min_uvolt, max_uvolt, + &sel); + if (rv != 0) + return (rv); + *udelay = sc->param->ramp_delay; + rv = fan53555_write_sel(sc, sel); + dprintf(sc, "Regulator %s writing sel: 0x%02X\n", sc->name, sel); + + fan53555_read_sel(sc, &sel); + regulator_range_sel8_to_volt(sc->range, 1, sel, &uvolt); + dprintf(sc, "Regulator %s set to %d uvolt (sel: 0x%02X)\n", sc->name, + uvolt, sel); + + return (rv); +} + +static int +fan53555_regnode_get_voltage(struct regnode *regnode, int *uvolt) +{ + struct fan53555_reg_sc *sc; + uint8_t sel; + int rv; + + sc = regnode_get_softc(regnode); + + rv = fan53555_read_sel(sc, &sel); + if (rv != 0) + return (rv); + rv = regulator_range_sel8_to_volt(sc->range, 1, sel, uvolt); + dprintf(sc, "Regulator %s is at %d uvolt ((sel: 0x%02X)\n", sc->name, + *uvolt, sel); + + return (rv); +} + +static regnode_method_t fan53555_regnode_methods[] = { + /* Regulator interface */ + REGNODEMETHOD(regnode_init, fan53555_regnode_init), + REGNODEMETHOD(regnode_enable, fan53555_regnode_enable), + REGNODEMETHOD(regnode_set_voltage, fan53555_regnode_set_voltage), + REGNODEMETHOD(regnode_get_voltage, fan53555_regnode_get_voltage), + REGNODEMETHOD_END +}; +DEFINE_CLASS_1(fan53555_regnode, fan53555_regnode_class, + fan53555_regnode_methods, sizeof(struct fan53555_reg_sc), regnode_class); + +static struct regulator_range * +fan53555_get_range(struct fan53555_softc *sc, int type, uint8_t id, + uint8_t rev) +{ + if (type == SYR827 || type == SYR828) { + switch (id) { + case 8: + return (&syr_8_range); + default: + return (NULL); + } + } + + if (type == FAN53555) { + switch (id) { + case 0: + if (rev == 0) + return (&fan_0_0_range); + else if (rev == 13) + return (&fan_0_13_range); + else + return (NULL); + case 1: + case 3: + case 5: + case 8: + return (&fan_1_range); + case 4: + return (&fan_4_range); + default: + return (NULL); + } + } + + return (NULL); +} + +static struct fan53555_reg_sc * +fan53555_reg_attach(struct fan53555_softc *sc, phandle_t node, int type) +{ + struct fan53555_reg_sc *reg_sc; + struct regnode_init_def initdef; + struct regnode *regnode; + static struct regulator_range *range; + uint8_t id1, id2; + + memset(&initdef, 0, sizeof(initdef)); + if (regulator_parse_ofw_stdparam(sc->dev, node, &initdef) != 0) { + device_printf(sc->dev, "cannot parse regulator FDT data\n"); + return (NULL); + } + + if (fan53555_read(sc->dev, FAN53555_ID1, &id1) != 0) { + device_printf(sc->dev, "cannot read ID1\n"); + return (NULL); + } + + if (fan53555_read(sc->dev, FAN53555_ID2, &id2) != 0) { + device_printf(sc->dev, "cannot read ID2\n"); + return (NULL); + } + dprintf(sc, "Device ID1: 0x%02X, ID2: 0x%02X\n", id1, id2); + + range = fan53555_get_range(sc, type, FAN53555_ID1_DIE_ID(id1), + FAN53555_ID2_DIE_REV(id2)); + if (range == NULL) { + device_printf(sc->dev, + "cannot determine chip type (ID1: 0x%02X, ID2: 0x%02X)\n", + id1, id2); + return (NULL); + } + + initdef.id = 1; + initdef.ofw_node = node; + + regnode = regnode_create(sc->dev, &fan53555_regnode_class, &initdef); + if (regnode == NULL) { + device_printf(sc->dev, "cannot create regulator\n"); + return (NULL); + } + + reg_sc = regnode_get_softc(regnode); + reg_sc->name = "fan53555"; + reg_sc->regnode = regnode; + reg_sc->base_dev = sc->dev; + reg_sc->param = regnode_get_stdparam(regnode); + reg_sc->range = range; + reg_sc->live_reg = sc->live_reg; + reg_sc->sleep_reg = sc->sleep_reg; + + dprintf(sc->dev, "live_reg: %d, sleep_reg: %d\n", reg_sc->live_reg, + reg_sc->sleep_reg); + + regnode_register(regnode); + + if (bootverbose) { + int volt, rv; + regnode_topo_slock(); + rv = regnode_get_voltage(regnode, &volt); + if (rv == ENODEV) { + device_printf(sc->dev, + " Regulator %s: parent doesn't exist yet.\n", + regnode_get_name(regnode)); + } else if (rv != 0) { + device_printf(sc->dev, + " Regulator %s: voltage: INVALID!!!\n", + regnode_get_name(regnode)); + } else { + device_printf(sc->dev, + " Regulator %s: voltage: %d uV\n", + regnode_get_name(regnode), volt); + } + regnode_topo_unlock(); + } + + return (reg_sc); +} + +static int +fan53555_probe(device_t dev) +{ + int type; + + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + + type = ofw_bus_search_compatible(dev, compat_data)->ocd_data; + switch (type) { + case FAN53555: + device_set_desc(dev, "FAN53555 PMIC"); + break; + case SYR827: + device_set_desc(dev, "SYR827 PMIC"); + break; + case SYR828: + device_set_desc(dev, "SYR828 PMIC"); + break; + default: + return (ENXIO); + } + + return (BUS_PROBE_DEFAULT); +} + +static int +fan53555_attach(device_t dev) +{ + struct fan53555_softc *sc; + phandle_t node; + int type, susp_sel, rv; + + sc = device_get_softc(dev); + sc->dev = dev; + node = ofw_bus_get_node(dev); + type = ofw_bus_search_compatible(dev, compat_data)->ocd_data; + + rv = OF_getencprop(node, "fcs,suspend-voltage-selector", &susp_sel, + sizeof(susp_sel)); + if (rv <= 0) + susp_sel = 1; + if (susp_sel == 1) { + sc->live_reg = FAN53555_VSEL0; + sc->sleep_reg = FAN53555_VSEL1; + } else { + sc->live_reg = FAN53555_VSEL1; + sc->sleep_reg = FAN53555_VSEL0; + } + if (fan53555_reg_attach(sc, node, type) == NULL) + device_printf(dev, "cannot attach regulator.\n"); + + return (0); +} + +static int +fan53555_detach(device_t dev) +{ + + /* We cannot detach regulators */ + return (EBUSY); +} + +static device_method_t fan53555_methods[] = { + DEVMETHOD(device_probe, fan53555_probe), + DEVMETHOD(device_attach, fan53555_attach), + DEVMETHOD(device_detach, fan53555_detach), + + /* Regdev interface */ + DEVMETHOD(regdev_map, regdev_default_ofw_map), + + DEVMETHOD_END +}; + +static devclass_t fan53555_devclass; +static DEFINE_CLASS_0(fan53555_pmic, fan53555_driver, fan53555_methods, + sizeof(struct fan53555_softc)); + +EARLY_DRIVER_MODULE(fan53555, iicbus, fan53555_driver, fan53555_devclass, 0, 0, + BUS_PASS_RESOURCE); +MODULE_VERSION(fan53555, 1); +MODULE_DEPEND(fan53555, iicbus, IICBUS_MINVER, IICBUS_PREFVER, IICBUS_MAXVER); +IICBUS_FDT_PNP_INFO(compat_data); From owner-svn-src-head@freebsd.org Fri Dec 4 15:46:49 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6BBBE4A38AF; Fri, 4 Dec 2020 15:46:49 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CncWs2cLGz4sBB; Fri, 4 Dec 2020 15:46:49 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4AB2C5DE6; Fri, 4 Dec 2020 15:46:49 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B4FknBl060355; Fri, 4 Dec 2020 15:46:49 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B4Fknma060354; Fri, 4 Dec 2020 15:46:49 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202012041546.0B4Fknma060354@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 4 Dec 2020 15:46:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368335 - head/sys/compat/linuxkpi/common/include/linux X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/compat/linuxkpi/common/include/linux X-SVN-Commit-Revision: 368335 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Dec 2020 15:46:49 -0000 Author: hselasky Date: Fri Dec 4 15:46:48 2020 New Revision: 368335 URL: https://svnweb.freebsd.org/changeset/base/368335 Log: Allow the list header file in the LinuxKPI to be used in standalone code. Some style and spelling nits while at it. MFC after: 1 week Sponsored by: Mellanox Technologies // NVIDIA Networking Modified: head/sys/compat/linuxkpi/common/include/linux/list.h Modified: head/sys/compat/linuxkpi/common/include/linux/list.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/list.h Fri Dec 4 15:23:43 2020 (r368334) +++ head/sys/compat/linuxkpi/common/include/linux/list.h Fri Dec 4 15:46:48 2020 (r368335) @@ -31,8 +31,9 @@ #ifndef _LINUX_LIST_H_ #define _LINUX_LIST_H_ +#ifndef _STANDALONE /* - * Since LIST_HEAD conflicts with the linux definition we must include any + * Since LIST_HEAD conflicts with the Linux definition we must include any * FreeBSD header which requires it here so it is resolved with the correct * definition prior to the undef. */ @@ -69,10 +70,12 @@ #include #include #include +#endif #ifndef prefetch #define prefetch(x) #endif + #define LINUX_LIST_HEAD_INIT(name) { &(name), &(name) } #define LINUX_LIST_HEAD(name) \ From owner-svn-src-head@freebsd.org Fri Dec 4 15:50:45 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A18474A3EE7; Fri, 4 Dec 2020 15:50:45 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CnccP2RbZz4sTH; Fri, 4 Dec 2020 15:50:45 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 46C6660AC; Fri, 4 Dec 2020 15:50:45 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B4FojjS061482; Fri, 4 Dec 2020 15:50:45 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B4Foj28061481; Fri, 4 Dec 2020 15:50:45 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202012041550.0B4Foj28061481@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 4 Dec 2020 15:50:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368336 - head/sys/compat/linuxkpi/common/include/linux X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/compat/linuxkpi/common/include/linux X-SVN-Commit-Revision: 368336 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Dec 2020 15:50:45 -0000 Author: hselasky Date: Fri Dec 4 15:50:44 2020 New Revision: 368336 URL: https://svnweb.freebsd.org/changeset/base/368336 Log: Allow the rbtree header file in the LinuxKPI to be used in standalone code. MFC after: 1 week Sponsored by: Mellanox Technologies // NVIDIA Networking Modified: head/sys/compat/linuxkpi/common/include/linux/rbtree.h Modified: head/sys/compat/linuxkpi/common/include/linux/rbtree.h ============================================================================== --- head/sys/compat/linuxkpi/common/include/linux/rbtree.h Fri Dec 4 15:46:48 2020 (r368335) +++ head/sys/compat/linuxkpi/common/include/linux/rbtree.h Fri Dec 4 15:50:44 2020 (r368336) @@ -31,7 +31,10 @@ #ifndef _LINUX_RBTREE_H_ #define _LINUX_RBTREE_H_ +#ifndef _STANDALONE #include +#endif + #include struct rb_node { From owner-svn-src-head@freebsd.org Fri Dec 4 15:53:38 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9711E4A435C; Fri, 4 Dec 2020 15:53:38 +0000 (UTC) (envelope-from arichardson@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Cncgk3m16z4tHR; Fri, 4 Dec 2020 15:53:38 +0000 (UTC) (envelope-from arichardson@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 73B3662BA; Fri, 4 Dec 2020 15:53:38 +0000 (UTC) (envelope-from arichardson@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B4FrcJs066370; Fri, 4 Dec 2020 15:53:38 GMT (envelope-from arichardson@FreeBSD.org) Received: (from arichardson@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B4Frcou066369; Fri, 4 Dec 2020 15:53:38 GMT (envelope-from arichardson@FreeBSD.org) Message-Id: <202012041553.0B4Frcou066369@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arichardson set sender to arichardson@FreeBSD.org using -f From: Alex Richardson Date: Fri, 4 Dec 2020 15:53:38 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368337 - in head: . usr.sbin/crunch/crunchgen X-SVN-Group: head X-SVN-Commit-Author: arichardson X-SVN-Commit-Paths: in head: . usr.sbin/crunch/crunchgen X-SVN-Commit-Revision: 368337 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Dec 2020 15:53:38 -0000 Author: arichardson Date: Fri Dec 4 15:53:37 2020 New Revision: 368337 URL: https://svnweb.freebsd.org/changeset/base/368337 Log: crunchgen: fix NULL-deref bug introduced in r364647 While porting over the local changes from CheriBSD for upstreaming, I accidentally committed a broken version of find_entry_point(): we have to return NULL if the value is not found instead of a value with ep->name == NULL, since the checks in main were changed to check ep instead of ep->name for NULL. This only matters if the crunched tool cannot be found using normal lookup and one of the fallback paths is used, so it's unlikely to be triggered in rescue. However, I noticed that one of our CheriBSD test scripts was failing to run commands under `su` on minimal disk images where all binaries are hardlinks to a `cheribsdbox` tool generated with crunchgen. This also updates the bootstrapping check in Makefile.inc1 to bootstrap crunchgen up to the next version bump. Reviewed By: kevans Differential Revision: https://reviews.freebsd.org/D27474 Modified: head/Makefile.inc1 head/usr.sbin/crunch/crunchgen/crunched_main.c Modified: head/Makefile.inc1 ============================================================================== --- head/Makefile.inc1 Fri Dec 4 15:50:44 2020 (r368336) +++ head/Makefile.inc1 Fri Dec 4 15:53:37 2020 (r368337) @@ -2270,7 +2270,7 @@ _bootstrap_tools_links+=crunchide # 1300115: Higher WARNS fixes .if ${BOOTSTRAPPING} < 1202502 || \ - (${BOOTSTRAPPING} > 1300000 && ${BOOTSTRAPPING} < 1300115) + (${BOOTSTRAPPING} > 1300000 && ${BOOTSTRAPPING} < 1300131) _crunchgen= usr.sbin/crunch/crunchgen .else _bootstrap_tools_links+=crunchgen Modified: head/usr.sbin/crunch/crunchgen/crunched_main.c ============================================================================== --- head/usr.sbin/crunch/crunchgen/crunched_main.c Fri Dec 4 15:50:44 2020 (r368336) +++ head/usr.sbin/crunch/crunchgen/crunched_main.c Fri Dec 4 15:53:37 2020 (r368337) @@ -97,9 +97,9 @@ find_entry_point(const char *basename) for (ep = entry_points; ep->name != NULL; ep++) if (!strcmp(basename, ep->name)) - break; + return (ep); - return (ep); + return (NULL); } static const char * From owner-svn-src-head@freebsd.org Fri Dec 4 15:53:47 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 818884A4692; Fri, 4 Dec 2020 15:53:47 +0000 (UTC) (envelope-from arichardson@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Cncgs2R3Fz4tQg; Fri, 4 Dec 2020 15:53:45 +0000 (UTC) (envelope-from arichardson@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C9ABD6066; Fri, 4 Dec 2020 15:53:44 +0000 (UTC) (envelope-from arichardson@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B4FriRF066426; Fri, 4 Dec 2020 15:53:44 GMT (envelope-from arichardson@FreeBSD.org) Received: (from arichardson@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B4FriEk066425; Fri, 4 Dec 2020 15:53:44 GMT (envelope-from arichardson@FreeBSD.org) Message-Id: <202012041553.0B4FriEk066425@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: arichardson set sender to arichardson@FreeBSD.org using -f From: Alex Richardson Date: Fri, 4 Dec 2020 15:53:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368338 - head/tools/build X-SVN-Group: head X-SVN-Commit-Author: arichardson X-SVN-Commit-Paths: head/tools/build X-SVN-Commit-Revision: 368338 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Dec 2020 15:53:47 -0000 Author: arichardson Date: Fri Dec 4 15:53:44 2020 New Revision: 368338 URL: https://svnweb.freebsd.org/changeset/base/368338 Log: make.py: Also pass STRIPBIN This is required for cross-building to allow stripping the installed binaries. Submitted By: Henry Vogt Modified: head/tools/build/make.py Modified: head/tools/build/make.py ============================================================================== --- head/tools/build/make.py Fri Dec 4 15:53:37 2020 (r368337) +++ head/tools/build/make.py Fri Dec 4 15:53:44 2020 (r368338) @@ -219,6 +219,9 @@ if __name__ == "__main__": parsed_args.cross_bindir) check_required_make_env_var("XLD", "ld" if use_cross_gcc else "ld.lld", parsed_args.cross_bindir) + check_required_make_env_var("STRIPBIN", + "strip" if use_cross_gcc else "llvm-strip", + parsed_args.cross_bindir) bmake_binary = bootstrap_bmake(source_root, objdir_prefix) # at -j1 cleandir+obj is unbearably slow. AUTO_OBJ helps a lot From owner-svn-src-head@freebsd.org Fri Dec 4 15:59:23 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 2DB964A4734; Fri, 4 Dec 2020 15:59:23 +0000 (UTC) (envelope-from arichardson.kde@gmail.com) Received: from mail-ej1-f48.google.com (mail-ej1-f48.google.com [209.85.218.48]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CncpM0h3Nz4tMj; Fri, 4 Dec 2020 15:59:22 +0000 (UTC) (envelope-from arichardson.kde@gmail.com) Received: by mail-ej1-f48.google.com with SMTP id m19so9338772ejj.11; Fri, 04 Dec 2020 07:59:22 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=Ca0LI/K9DiJARSfwWI44t0TJIQcAFphjh5HxYzdyG/k=; b=BuFVHxkdso5tPmNqJUD2AKuyMcHbzjtjIDDKZywLGXSCjT5rW/5fJmbsvLSnNnZow1 3j09KFJ9xs8cz0YpRsTpB+U+zLhGH5gUzqfhQpjK4N2sGOA6eQtHKrzdByDBa+AiXFau baWEPw/gxQruA3CiIdP+2oWAqRCZ/9Upauq98TfbDzG+a2lAFtTAhoF0t4m29aqSA4Yp wpzQL1EK8NLDq1mfAu47ULj4PU1kpanXiGd0YuTcEqYEwdZscpERy+Gq10or3FdpZk8W c6AYHRmS33gWhiShJy4QOzHQkYAIQInbydIe9mGj1EUUy0DA6L2g0AgcKNvznle/p5i7 SFhA== X-Gm-Message-State: AOAM532cuzYzXk3+HAcVdGzRZanHymG1VGv4J7HETTBCcH87TOFt85Xz is51aAV7UDYIrxDqBohBX9EpRIrSpF3pmw== X-Google-Smtp-Source: ABdhPJx/AufaG/lgVxZcBsEHvutrg4F78eOrr+RVklVo3HeX3HftmVnlJK1zZCl4aV3kPxEzX6oeaQ== X-Received: by 2002:a17:906:c83b:: with SMTP id dd27mr7830182ejb.356.1607097561729; Fri, 04 Dec 2020 07:59:21 -0800 (PST) Received: from mail-wm1-f50.google.com (mail-wm1-f50.google.com. [209.85.128.50]) by smtp.gmail.com with ESMTPSA id ck27sm2622663edb.13.2020.12.04.07.59.21 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 04 Dec 2020 07:59:21 -0800 (PST) Received: by mail-wm1-f50.google.com with SMTP id v14so5930129wml.1; Fri, 04 Dec 2020 07:59:21 -0800 (PST) X-Received: by 2002:a1c:67c5:: with SMTP id b188mr5086016wmc.147.1607097561127; Fri, 04 Dec 2020 07:59:21 -0800 (PST) MIME-Version: 1.0 References: <202012041450.0B4EouQ2024632@repo.freebsd.org> In-Reply-To: <202012041450.0B4EouQ2024632@repo.freebsd.org> From: Alexander Richardson Date: Fri, 4 Dec 2020 15:59:10 +0000 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r368329 - head/stand/kshim To: Hans Petter Selasky Cc: src-committers , svn-src-all , svn-src-head Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4CncpM0h3Nz4tMj X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; TAGGED_FROM(0.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Dec 2020 15:59:23 -0000 On Fri, 4 Dec 2020 at 14:51, Hans Petter Selasky wrote: > > Author: hselasky > Date: Fri Dec 4 14:50:55 2020 > New Revision: 368329 > URL: https://svnweb.freebsd.org/changeset/base/368329 > > Log: > Fix definition of int64_t and uint64_t when long is 64-bit. This gets the kernel > shim code in line with the rest of the kernel, sys/x86/include/_types.h. > > MFC after: 1 week > Sponsored by: Mellanox Technologies // NVIDIA Networking > > Modified: > head/stand/kshim/bsd_kernel.h > > Modified: head/stand/kshim/bsd_kernel.h > ============================================================================== > --- head/stand/kshim/bsd_kernel.h Fri Dec 4 14:09:12 2020 (r368328) > +++ head/stand/kshim/bsd_kernel.h Fri Dec 4 14:50:55 2020 (r368329) > @@ -208,9 +208,17 @@ typedef unsigned int uint32_t; > #define _INT32_T_DECLARED > typedef signed int int32_t; > #define _UINT64_T_DECLARED > +#ifndef __LP64__ > typedef unsigned long long uint64_t; > +#else > +typedef unsigned long uint64_t; > +#endif > #define _INT16_T_DECLARED > +#ifndef __LP64__ > typedef signed long long int64_t; > +#else > +typedef signed long int64_t; > +#endif > > typedef uint16_t uid_t; > typedef uint16_t gid_t; Since we no longer support ancient compilers, could we simplify this and just use typedef __UINT64_TYPE__ uint64_t; typedef __INT64_TYPE__ int64_t; ? This will work across all architectures and ABIs, and appears to work starting with GCC 4.5.3 and Clang 3.5: https://godbolt.org/z/TWavfb Alex From owner-svn-src-head@freebsd.org Fri Dec 4 16:06:26 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 60DF64A45CE; Fri, 4 Dec 2020 16:06:26 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [IPv6:2a01:4f8:c17:6c4b::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4CncyV1kxPz4vCj; Fri, 4 Dec 2020 16:06:26 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2020.home.selasky.org (unknown [178.17.145.105]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id AA7D02602AA; Fri, 4 Dec 2020 17:06:23 +0100 (CET) Subject: Re: svn commit: r368329 - head/stand/kshim To: Alexander Richardson Cc: src-committers , svn-src-all , svn-src-head , Konstantin Belousov References: <202012041450.0B4EouQ2024632@repo.freebsd.org> From: Hans Petter Selasky Message-ID: <6f9541e4-b216-8a93-881e-e3859bff84fa@selasky.org> Date: Fri, 4 Dec 2020 17:06:13 +0100 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:78.0) Gecko/20100101 Thunderbird/78.5.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4CncyV1kxPz4vCj X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Dec 2020 16:06:26 -0000 On 12/4/20 4:59 PM, Alexander Richardson wrote: > On Fri, 4 Dec 2020 at 14:51, Hans Petter Selasky wrote: >> >> Author: hselasky >> Date: Fri Dec 4 14:50:55 2020 >> New Revision: 368329 >> URL: https://svnweb.freebsd.org/changeset/base/368329 >> >> Log: >> Fix definition of int64_t and uint64_t when long is 64-bit. This gets the kernel >> shim code in line with the rest of the kernel, sys/x86/include/_types.h. >> >> MFC after: 1 week >> Sponsored by: Mellanox Technologies // NVIDIA Networking >> >> Modified: >> head/stand/kshim/bsd_kernel.h >> >> Modified: head/stand/kshim/bsd_kernel.h >> ============================================================================== >> --- head/stand/kshim/bsd_kernel.h Fri Dec 4 14:09:12 2020 (r368328) >> +++ head/stand/kshim/bsd_kernel.h Fri Dec 4 14:50:55 2020 (r368329) >> @@ -208,9 +208,17 @@ typedef unsigned int uint32_t; >> #define _INT32_T_DECLARED >> typedef signed int int32_t; >> #define _UINT64_T_DECLARED >> +#ifndef __LP64__ >> typedef unsigned long long uint64_t; >> +#else >> +typedef unsigned long uint64_t; >> +#endif >> #define _INT16_T_DECLARED >> +#ifndef __LP64__ >> typedef signed long long int64_t; >> +#else >> +typedef signed long int64_t; >> +#endif >> >> typedef uint16_t uid_t; >> typedef uint16_t gid_t; > > Since we no longer support ancient compilers, could we simplify this > and just use > typedef __UINT64_TYPE__ uint64_t; > typedef __INT64_TYPE__ int64_t; > ? > > This will work across all architectures and ABIs, and appears to work > starting with GCC 4.5.3 and Clang 3.5: > https://godbolt.org/z/TWavfb Hi Alexander, I'm not sure how that definition will work together with existing code, mixing uint64_t, unsigned long, and unsigned long long. Will this cause more compiler warnings? This also will affect user-space and ports. Maybe Konstantin, CC'ed, has some input on this? --HPS From owner-svn-src-head@freebsd.org Fri Dec 4 16:24:46 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 911334A4CCE; Fri, 4 Dec 2020 16:24:46 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CndMf3c9Bz3BsW; Fri, 4 Dec 2020 16:24:46 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 697346A04; Fri, 4 Dec 2020 16:24:46 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B4GOkFj084984; Fri, 4 Dec 2020 16:24:46 GMT (envelope-from mmel@FreeBSD.org) Received: (from mmel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B4GOjYt084977; Fri, 4 Dec 2020 16:24:45 GMT (envelope-from mmel@FreeBSD.org) Message-Id: <202012041624.0B4GOjYt084977@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmel set sender to mmel@FreeBSD.org using -f From: Michal Meloun Date: Fri, 4 Dec 2020 16:24:45 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368340 - in head/sys: arm/rockchip arm64/rockchip arm64/rockchip/clk X-SVN-Group: head X-SVN-Commit-Author: mmel X-SVN-Commit-Paths: in head/sys: arm/rockchip arm64/rockchip arm64/rockchip/clk X-SVN-Commit-Revision: 368340 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Dec 2020 16:24:46 -0000 Author: mmel Date: Fri Dec 4 16:24:44 2020 New Revision: 368340 URL: https://svnweb.freebsd.org/changeset/base/368340 Log: Add support for RK3288 SoC. Added: head/sys/arm/rockchip/files.rk32xx (contents, props changed) head/sys/arm/rockchip/rk32xx_machdep.c (contents, props changed) head/sys/arm/rockchip/rk32xx_mp.c (contents, props changed) head/sys/arm/rockchip/rk32xx_mp.h (contents, props changed) head/sys/arm/rockchip/std.rk32xx (contents, props changed) head/sys/arm64/rockchip/clk/rk3288_cru.c (contents, props changed) head/sys/arm64/rockchip/rk_pmu.c (contents, props changed) head/sys/arm64/rockchip/rk_usbphy.c (contents, props changed) Modified: head/sys/arm64/rockchip/clk/rk_clk_pll.c head/sys/arm64/rockchip/clk/rk_clk_pll.h head/sys/arm64/rockchip/clk/rk_cru.c head/sys/arm64/rockchip/clk/rk_cru.h head/sys/arm64/rockchip/rk_pwm.c head/sys/arm64/rockchip/rk_tsadc.c Added: head/sys/arm/rockchip/files.rk32xx ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/rockchip/files.rk32xx Fri Dec 4 16:24:44 2020 (r368340) @@ -0,0 +1,31 @@ +# $FreeBSD$ +kern/kern_clocksource.c standard + +arm/rockchip/rk32xx_machdep.c standard +arm/rockchip/rk32xx_mp.c optional smp +arm64/rockchip/if_dwc_rk.c standard +arm64/rockchip/rk_i2c.c standard +arm64/rockchip/rk_iodomain.c standard +arm64/rockchip/rk_gpio.c standard +arm64/rockchip/rk_grf.c standard +arm64/rockchip/rk_pinctrl.c standard +arm64/rockchip/rk_pmu.c standard +arm64/rockchip/rk_pwm.c standard +arm64/rockchip/rk_tsadc.c standard +arm64/rockchip/rk_tsadc_if.m standard +arm64/rockchip/rk_usbphy.c standard +arm64/rockchip/clk/rk_clk_armclk.c standard +arm64/rockchip/clk/rk_clk_composite.c standard +arm64/rockchip/clk/rk_clk_fract.c standard +arm64/rockchip/clk/rk_clk_gate.c standard +arm64/rockchip/clk/rk_clk_mux.c standard +arm64/rockchip/clk/rk_clk_pll.c standard +arm64/rockchip/clk/rk_cru.c standard +arm64/rockchip/clk/rk3288_cru.c standard + +dev/iicbus/pmic/act8846.c standard +dev/iicbus/pmic/act8846_regulator.c standard +dev/iicbus/pmic/fan53555.c standard +dev/iicbus/rtc/hym8563.c standard +dev/mmc/host/dwmmc.c optional dwmmc +dev/mmc/host/dwmmc_rockchip.c optional dwmmc Added: head/sys/arm/rockchip/rk32xx_machdep.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/rockchip/rk32xx_machdep.c Fri Dec 4 16:24:44 2020 (r368340) @@ -0,0 +1,126 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2019 Michal Meloun + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include "opt_platform.h" + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include + +#include + +#include + +#include "platform_if.h" +#define CRU_PHYSBASE 0xFF760000 +#define CRU_SIZE 0x00010000 +#define CRU_GLB_SRST_FST_VALUE 0x1B0 + +static platform_def_t rk3288w_platform; + +static void +rk32xx_late_init(platform_t plat) +{ + +} + +/* + * Set up static device mappings. + */ +static int +rk32xx_devmap_init(platform_t plat) +{ + + devmap_add_entry(0xFF000000, 0x00E00000); + return (0); +} + +static void +rk32xx_cpu_reset(platform_t plat) +{ + bus_space_handle_t cru; + + printf("Resetting...\n"); + bus_space_map(fdtbus_bs_tag, CRU_PHYSBASE, CRU_SIZE, 0, &cru); + + spinlock_enter(); + dsb(); + /* Generate 'first global software reset' */ + bus_space_write_4(fdtbus_bs_tag, cru, CRU_GLB_SRST_FST_VALUE, 0xfdb9); + while(1) + ; +} + +/* + * Early putc routine for EARLY_PRINTF support. To use, add to kernel config: + * option SOCDEV_PA=0xFF600000 + * option SOCDEV_VA=0x70000000 + * option EARLY_PRINTF + */ +#if 0 +#ifdef EARLY_PRINTF +static void +rk32xx_early_putc(int c) +{ + + volatile uint32_t * UART_STAT_REG = (uint32_t *)(0x7009007C); + volatile uint32_t * UART_TX_REG = (uint32_t *)(0x70090000); + const uint32_t UART_TXRDY = (1 << 2); + while ((*UART_STAT_REG & UART_TXRDY) == 0) + continue; + *UART_TX_REG = c; +} +early_putc_t *early_putc = rk32xx_early_putc; +#endif +#endif +static platform_method_t rk32xx_methods[] = { + PLATFORMMETHOD(platform_devmap_init, rk32xx_devmap_init), + PLATFORMMETHOD(platform_late_init, rk32xx_late_init), + PLATFORMMETHOD(platform_cpu_reset, rk32xx_cpu_reset), + +#ifdef SMP + PLATFORMMETHOD(platform_mp_start_ap, rk32xx_mp_start_ap), + PLATFORMMETHOD(platform_mp_setmaxid, rk32xx_mp_setmaxid), +#endif + PLATFORMMETHOD_END, +}; +FDT_PLATFORM_DEF2(rk32xx, rk3288, "RK3288", 0, "rockchip,rk3288", 200); +FDT_PLATFORM_DEF2(rk32xx, rk3288w, "RK3288W", 0, "rockchip,rk3288w", 200); Added: head/sys/arm/rockchip/rk32xx_mp.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/rockchip/rk32xx_mp.c Fri Dec 4 16:24:44 2020 (r368340) @@ -0,0 +1,174 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2019 Michal Meloun + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +#include +#include +#include +#include + +#include +#include +#include +#include + +#include + +#define IMEM_PHYSBASE 0xFF700000 +#define IMEM_SIZE 0x00018000 + +#define PMU_PHYSBASE 0xFF730000 +#define PMU_SIZE 0x00010000 +#define PMU_PWRDN_CON 0x08 + +static int running_cpus; +static uint32_t psci_mask, pmu_mask; +void +rk32xx_mp_setmaxid(platform_t plat) +{ + int ncpu; + + /* If we've already set the global vars don't bother to do it again. */ + if (mp_ncpus != 0) + return; + + /* Read current CP15 Cache Size ID Register */ + ncpu = cp15_l2ctlr_get(); + ncpu = CPUV7_L2CTLR_NPROC(ncpu); + + mp_ncpus = ncpu; + mp_maxid = ncpu - 1; +} + +static void +rk32xx_mp_start_pmu(uint32_t mask) +{ + bus_space_handle_t imem; + bus_space_handle_t pmu; + uint32_t val; + int i, rv; + + rv = bus_space_map(fdtbus_bs_tag, IMEM_PHYSBASE, IMEM_SIZE, 0, &imem); + if (rv != 0) + panic("Couldn't map the IMEM\n"); + rv = bus_space_map(fdtbus_bs_tag, PMU_PHYSBASE, PMU_SIZE, 0, &pmu); + if (rv != 0) + panic("Couldn't map the PMU\n"); + + /* Power off all secondary cores first */ + val = bus_space_read_4(fdtbus_bs_tag, pmu, PMU_PWRDN_CON); + for (i = 1; i < mp_ncpus; i++) + val |= 1 << i; + bus_space_write_4(fdtbus_bs_tag, pmu, PMU_PWRDN_CON, val); + DELAY(5000); + + /* Power up all secondary cores */ + val = bus_space_read_4(fdtbus_bs_tag, pmu, PMU_PWRDN_CON); + for (i = 1; i < mp_ncpus; i++) + val &= ~(1 << i); + bus_space_write_4(fdtbus_bs_tag, pmu, PMU_PWRDN_CON, val); + DELAY(5000); + + /* Copy mpentry address then magic to sram */ + val = pmap_kextract((vm_offset_t)mpentry); + bus_space_write_4(fdtbus_bs_tag, imem, 8, val); + dsb(); + bus_space_write_4(fdtbus_bs_tag, imem, 4, 0xDEADBEAF); + dsb(); + + sev(); + + bus_space_unmap(fdtbus_bs_tag, imem, IMEM_SIZE); + bus_space_unmap(fdtbus_bs_tag, pmu, PMU_SIZE); +} + +static boolean_t +rk32xx_start_ap(u_int id, phandle_t node, u_int addr_cells, pcell_t *reg) +{ + int rv; + char method[16]; + uint32_t mask; + + if (!ofw_bus_node_status_okay(node)) + return(false); + + /* Skip boot CPU. */ + if (id == 0) + return (true); + + if (running_cpus >= mp_ncpus) + return (false); + running_cpus++; + + mask = 1 << (*reg & 0x0f); + +#ifdef INVARIANTS + if ((mask & pmu_mask) || (mask & psci_mask)) + printf("CPU: Duplicated register value: 0x%X for CPU(%d)\n", + *reg, id); +#endif + rv = OF_getprop(node, "enable-method", method, sizeof(method)); + if (rv > 0 && strcmp(method, "psci") == 0) { + psci_mask |= mask; + rv = psci_cpu_on(*reg, pmap_kextract((vm_offset_t)mpentry), id); + if (rv != PSCI_RETVAL_SUCCESS) { + printf("Failed to start CPU(%d)\n", id); + return (false); + } + return (true); + } + + pmu_mask |= mask; + return (true); +} + +void +rk32xx_mp_start_ap(platform_t plat) +{ + + ofw_cpu_early_foreach(rk32xx_start_ap, true); + if (pmu_mask != 0 && psci_mask != 0) { + printf("Inconsistent CPUs startup methods detected.\n"); + printf("Only PSCI enabled cores will be started.\n"); + return; + } + if (pmu_mask != 0) + rk32xx_mp_start_pmu(pmu_mask); +} Added: head/sys/arm/rockchip/rk32xx_mp.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/rockchip/rk32xx_mp.h Fri Dec 4 16:24:44 2020 (r368340) @@ -0,0 +1,36 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2019 Michal Meloun + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#ifndef _RK32XX_MP_H_ +#define _RK32XX_MP_H_ + +void rk32xx_mp_setmaxid(platform_t plat); +void rk32xx_mp_start_ap(platform_t plat); + +#endif /* _RK32XX_MP_H_ */ Added: head/sys/arm/rockchip/std.rk32xx ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm/rockchip/std.rk32xx Fri Dec 4 16:24:44 2020 (r368340) @@ -0,0 +1,8 @@ +# Rockchip rk32xx common options +#$FreeBSD$ + +cpu CPU_CORTEXA +machine arm armv7 +makeoptions CONF_CFLAGS="-mcpu=cortex-a17" + +files "../rockchip/files.rk32xx" Added: head/sys/arm64/rockchip/clk/rk3288_cru.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm64/rockchip/clk/rk3288_cru.c Fri Dec 4 16:24:44 2020 (r368340) @@ -0,0 +1,1026 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2018 Emmanuel Vadot + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR + * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES + * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. + * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, + * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, + * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; + * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED + * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, + * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include + +#include +#include +#include +#include + +#include + +#include + +#define CRU_SOFTRST_SIZE 12 + +#define CRU_APLL_CON(x) (0x000 + (x) * 0x4) +#define CRU_DPLL_CON(x) (0x010 + (x) * 0x4) +#define CRU_CPLL_CON(x) (0x020 + (x) * 0x4) +#define CRU_GPLL_CON(x) (0x030 + (x) * 0x4) +#define CRU_NPLL_CON(x) (0x040 + (x) * 0x4) +#define CRU_MODE_CON 0x050 +#define CRU_CLKSEL_CON(x) (0x060 + (x) * 0x4) +#define CRU_CLKGATE_CON(x) (0x160 + (x) * 0x4) +#define CRU_GLB_SRST_FST_VALUE 0x1b0 +#define CRU_GLB_SRST_SND_VALUE 0x1b4 +#define CRU_SOFTRST_CON(x) (0x1b8 + (x) * 0x4) +#define CRU_MISC_CON 0x1e8 +#define CRU_GLB_CNT_TH 0x1ec +#define CRU_GLB_RST_CON 0x1f0 +#define CRU_GLB_RST_ST 0x1f8 +#define CRU_SDMMC_CON0 0x200 +#define CRU_SDMMC_CON1 0x204 +#define CRU_SDIO0_CON0 0x208 +#define CRU_SDIO0_CON1 0x20c +#define CRU_SDIO1_CON0 0x210 +#define CRU_SDIO1_CON1 0x214 +#define CRU_EMMC_CON0 0x218 +#define CRU_EMMC_CON1 0x21c + +/* GATES */ +#define GATE(_idx, _clkname, _pname, _o, _s) \ +{ \ + .id = _idx, \ + .name = _clkname, \ + .parent_name = _pname, \ + .offset = CRU_CLKGATE_CON(_o), \ + .shift = _s, \ +} + +static struct rk_cru_gate rk3288_gates[] = { + /* CRU_CLKGATE_CON0 */ + GATE(0, "sclk_acc_efuse", "xin24m", 0, 12), + GATE(0, "cpll_aclk_cpu", "cpll", 0, 11), + GATE(0, "gpll_aclk_cpu", "gpll", 0, 10), + GATE(0, "gpll_ddr", "gpll", 0, 9), + GATE(0, "dpll_ddr", "dpll", 0, 8), + GATE(0, "aclk_bus_2pmu", "aclk_cpu_pre", 0, 7), + GATE(PCLK_CPU, "pclk_cpu", "pclk_cpu_s", 0, 5), + GATE(HCLK_CPU, "hclk_cpu", "hclk_cpu_s", 0, 4), + GATE(ACLK_CPU, "aclk_cpu", "aclk_cpu_pre", 0, 3), + GATE(0, "gpll_core", "gpll", 0, 2), + GATE(0, "apll_core", "apll", 0, 1), + + + /* CRU_CLKGATE_CON1 */ + GATE(0, "uart3_frac", "uart3_frac_s", 1, 15), + GATE(0, "uart3_src", "uart3_src_s", 1, 14), + GATE(0, "uart2_frac", "uart2_frac_s", 1, 13), + GATE(0, "uart2_src", "uart2_src_s", 1, 12), + GATE(0, "uart1_frac", "uart1_frac_s", 1, 11), + GATE(0, "uart1_src", "uart1_src_s", 1, 10), + GATE(0, "uart0_frac", "uart0_frac_s", 1, 9), + GATE(0, "uart0_src", "uart0_src_s", 1, 8), + GATE(SCLK_TIMER5, "sclk_timer5", "xin24m", 1, 5), + GATE(SCLK_TIMER4, "sclk_timer4", "xin24m", 1, 4), + GATE(SCLK_TIMER3, "sclk_timer3", "xin24m", 1, 3), + GATE(SCLK_TIMER2, "sclk_timer2", "xin24m", 1, 2), + GATE(SCLK_TIMER1, "sclk_timer1", "xin24m", 1, 1), + GATE(SCLK_TIMER0, "sclk_timer0", "xin24m", 1, 0), + + /* CRU_CLKGATE_CON2 */ + GATE(0, "uart4_frac", "uart4_frac_s", 2, 13), + GATE(0, "uart4_src", "uart4_src_s", 2, 12), + GATE(SCLK_SPI2, "sclk_spi2", "sclk_spi2_s", 2, 11), + GATE(SCLK_SPI1, "sclk_spi1", "sclk_spi1_s", 2, 10), + GATE(SCLK_SPI0, "sclk_spi0", "sclk_spi0_s", 2, 9), + GATE(SCLK_SARADC, "sclk_saradc", "sclk_saradc_s", 2, 8), + GATE(SCLK_TSADC, "sclk_tsadc", "sclk_tsadc_s", 2, 7), + GATE(0, "hsadc_src", "hsadc_src_s", 2, 6), + GATE(0, "mac_pll_src", "mac_pll_src_s", 2, 5), + GATE(PCLK_PERI, "pclk_peri", "pclk_peri_s", 2, 3), + GATE(HCLK_PERI, "hclk_peri", "hclk_peri_s", 2, 2), + GATE(ACLK_PERI, "aclk_peri", "aclk_peri_src", 2, 1), + GATE(0, "aclk_peri_src", "aclk_peri_src_s", 2, 0), + + /* CRU_CLKGATE_CON3 */ + GATE(SCLK_ISP_JPE, "sclk_isp_jpe", "sclk_isp_jpe_s", 3, 15), + GATE(SCLK_ISP, "sclk_isp", "sclk_isp_s", 3, 14), + GATE(SCLK_EDP, "sclk_edp", "sclk_edp_s", 3, 13), + GATE(SCLK_EDP_24M, "sclk_edp_24m", "sclk_edp_24m_s", 3, 12), + GATE(0, "aclk_vdpu", "aclk_vdpu_s", 3, 11), + GATE(0, "hclk_vcodec_pre", "hclk_vcodec_pre_s", 3, 10), + GATE(0, "aclk_vepu", "aclk_vepu_s", 3, 9), + GATE(0, "vip_src", "vip_src_s", 3, 7), +/* 6 - Not in TRM, sclk_hsicphy480m in Linux */ + GATE(0, "aclk_rga_pre", "aclk_rga_pre_s", 3, 5), + GATE(SCLK_RGA, "sclk_rga", "sclk_rga_s", 3, 4), + GATE(DCLK_VOP1, "dclk_vop1", "dclk_vop1_s", 3, 3), + GATE(0, "aclk_vio1", "aclk_vio1_s", 3, 2), + GATE(DCLK_VOP0, "dclk_vop0", "dclk_vop0_s", 3, 1), + GATE(0, "aclk_vio0", "aclk_vio0_s", 3, 0), + + /* CRU_CLKGATE_CON4 */ +/* 15 - Test clock generator */ + GATE(0, "jtag", "ext_jtag", 4, 14), + GATE(0, "sclk_ddrphy1", "ddrphy", 4, 13), + GATE(0, "sclk_ddrphy0", "ddrphy", 4, 12), + GATE(0, "sclk_tspout", "sclk_tspout_s", 4, 11), + GATE(0, "sclk_tsp", "sclk_tsp_s", 4, 10), + GATE(SCLK_SPDIF8CH, "sclk_spdif_8ch", "spdif_8ch_mux", 4, 9), + GATE(0, "spdif_8ch_frac", "spdif_8ch_frac_s", 4, 8), + GATE(0, "spdif_8ch_pre", "spdif_8ch_pre_s", 4, 7), + GATE(SCLK_SPDIF, "sclk_spdif", "spdif_mux", 4, 6), + GATE(0, "spdif_frac", "spdif_frac_s", 4, 5), + GATE(0, "spdif_pre", "spdif_pre_s", 4, 4), + GATE(SCLK_I2S0, "sclk_i2s0", "i2s_pre", 4, 3), + GATE(0, "i2s_frac", "i2s_frac_s", 4, 2), + GATE(0, "i2s_src", "i2s_src_s", 4, 1), + GATE(SCLK_I2S0_OUT, "i2s0_clkout", "i2s0_clkout_s", 4, 1), + + /* CRU_CLKGATE_CON5 */ + GATE(SCLK_MIPIDSI_24M, "sclk_mipidsi_24m", "xin24m", 5, 15), + GATE(SCLK_USBPHY480M_SRC, "usbphy480m_src", "usbphy480m_src_s", 5, 14), + GATE(SCLK_PS2C, "sclk_ps2c", "xin24m", 5, 13), + GATE(SCLK_HDMI_HDCP, "sclk_hdmi_hdcp", "xin24m", 5, 12), + GATE(SCLK_HDMI_CEC, "sclk_hdmi_cec", "xin32k", 5, 11), + GATE(SCLK_PVTM_GPU, "sclk_pvtm_gpu", "xin24m", 5, 10), + GATE(SCLK_PVTM_CORE, "sclk_pvtm_core", "xin24m", 5, 9), + GATE(0, "pclk_pd_pmu", "pclk_pd_pmu_s", 5, 8), + GATE(SCLK_GPU, "sclk_gpu", "sclk_gpu_s", 5, 7), + GATE(SCLK_NANDC1, "sclk_nandc1", "sclk_nandc1_s", 5, 6), + GATE(SCLK_NANDC0, "sclk_nandc0", "sclk_nandc0_s", 5, 5), + GATE(SCLK_CRYPTO, "crypto", "crypto_s", 5, 4), + GATE(SCLK_MACREF_OUT, "sclk_macref_out", "mac_clk", 5, 3), + GATE(SCLK_MACREF, "sclk_macref", "mac_clk", 5, 2), + GATE(SCLK_MAC_TX, "sclk_mac_tx", "mac_clk", 5, 1), + GATE(SCLK_MAC_RX, "sclk_mac_rx", "mac_clk", 5, 0), + + + /* CRU_CLKGATE_CON6 */ + GATE(PCLK_I2C4, "pclk_i2c4", "pclk_peri", 6, 15), + GATE(PCLK_I2C3, "pclk_i2c3", "pclk_peri", 6, 14), + GATE(PCLK_I2C1, "pclk_i2c1", "pclk_peri", 6, 13), + GATE(PCLK_UART4, "pclk_uart4", "pclk_peri", 6, 12), + GATE(PCLK_UART3, "pclk_uart3", "pclk_peri", 6, 11), + GATE(PCLK_UART1, "pclk_uart1", "pclk_peri", 6, 9), + GATE(PCLK_UART0, "pclk_uart0", "pclk_peri", 6, 8), + GATE(PCLK_PS2C, "pclk_ps2c", "pclk_peri", 6, 7), + GATE(PCLK_SPI2, "pclk_spi2", "pclk_peri", 6, 6), + GATE(PCLK_SPI1, "pclk_spi1", "pclk_peri", 6, 5), + GATE(PCLK_SPI0, "pclk_spi0", "pclk_peri", 6, 4), + GATE(ACLK_DMAC2, "aclk_dmac2", "aclk_peri", 6, 3), + GATE(0, "aclk_peri_axi_matrix", "aclk_peri", 6, 2), + GATE(0, "pclk_peri_matrix", "pclk_peri", 6, 1), + GATE(0, "hclk_peri_matrix", "hclk_peri", 6, 0), + + + /* CRU_CLKGATE_CON7 */ + GATE(HCLK_NANDC1, "hclk_nandc1", "hclk_peri", 7, 15), + GATE(HCLK_NANDC0, "hclk_nandc0", "hclk_peri", 7, 14), + GATE(0, "hclk_mem", "hclk_peri", 7, 13), + GATE(0, "hclk_emem", "hclk_peri", 7, 12), + GATE(0, "aclk_peri_niu", "aclk_peri", 7, 11), + GATE(0, "hclk_peri_ahb_arbi", "hclk_peri", 7, 10), + GATE(0, "hclk_usb_peri", "hclk_peri", 7, 9), +/* 8 - Not in TRM - hclk_hsic in Linux */ + GATE(HCLK_USBHOST1, "hclk_host1", "hclk_peri", 7, 7), + GATE(HCLK_USBHOST0, "hclk_host0", "hclk_peri", 7, 6), + GATE(0, "pmu_hclk_otg0", "hclk_peri", 7, 5), + GATE(HCLK_OTG0, "hclk_otg0", "hclk_peri", 7, 4), + GATE(PCLK_SIM, "pclk_sim", "pclk_peri", 7, 3), + GATE(PCLK_TSADC, "pclk_tsadc", "pclk_peri", 7, 2), + GATE(PCLK_SARADC, "pclk_saradc", "pclk_peri", 7, 1), + GATE(PCLK_I2C5, "pclk_i2c5", "pclk_peri", 7, 0), + + /* CRU_CLKGATE_CON8 */ + GATE(ACLK_MMU, "aclk_mmu", "aclk_peri", 8, 12), +/* 11 - 9 27m_tsp, hsadc_1_tsp, hsadc_1_tsp */ + GATE(HCLK_TSP, "hclk_tsp", "hclk_peri", 8, 8), + GATE(HCLK_HSADC, "hclk_hsadc", "hclk_peri", 8, 7), + GATE(HCLK_EMMC, "hclk_emmc", "hclk_peri", 8, 6), + GATE(HCLK_SDIO1, "hclk_sdio1", "hclk_peri", 8, 5), + GATE(HCLK_SDIO0, "hclk_sdio0", "hclk_peri", 8, 4), + GATE(HCLK_SDMMC, "hclk_sdmmc", "hclk_peri", 8, 3), + GATE(HCLK_GPS, "hclk_gps", "aclk_peri", 8, 2), + GATE(PCLK_GMAC, "pclk_gmac", "pclk_peri", 8, 1), + GATE(ACLK_GMAC, "aclk_gmac", "aclk_peri", 8, 0), + + /* CRU_CLKGATE_CON9 */ + GATE(HCLK_VCODEC, "hclk_vcodec", "hclk_vcodec_pre", 9, 1), + GATE(ACLK_VCODEC, "aclk_vcodec", "aclk_vcodec_pre", 9, 0), + + /* CRU_CLKGATE_CON10 */ + GATE(PCLK_PUBL0, "pclk_publ0", "pclk_cpu", 10, 15), + GATE(PCLK_DDRUPCTL0, "pclk_ddrupctl0", "pclk_cpu", 10, 14), + GATE(0, "aclk_strc_sys", "aclk_cpu", 10, 13), + GATE(ACLK_DMAC1, "aclk_dmac1", "aclk_cpu", 10, 12), + GATE(HCLK_SPDIF8CH, "hclk_spdif_8ch", "hclk_cpu", 10, 11), + GATE(HCLK_SPDIF, "hclk_spdif", "hclk_cpu", 10, 10), + GATE(HCLK_ROM, "hclk_rom", "hclk_cpu", 10, 9), + GATE(HCLK_I2S0, "hclk_i2s0", "hclk_cpu", 10, 8), + GATE(0, "sclk_intmem2", "aclk_cpu", 10, 7), + GATE(0, "sclk_intmem1", "aclk_cpu", 10, 6), + GATE(0, "sclk_intmem0", "aclk_cpu", 10, 5), + GATE(0, "aclk_intmem", "aclk_cpu", 10, 4), + GATE(PCLK_I2C2, "pclk_i2c2", "pclk_cpu", 10, 3), + GATE(PCLK_I2C0, "pclk_i2c0", "pclk_cpu", 10, 2), + GATE(PCLK_TIMER, "pclk_timer", "pclk_cpu", 10, 1), + GATE(PCLK_PWM, "pclk_pwm", "pclk_cpu", 10, 0), + + /* CRU_CLKGATE_CON11 */ + GATE(PCLK_RKPWM, "pclk_rkpwm", "pclk_cpu", 11, 11), + GATE(PCLK_EFUSE256, "pclk_efuse_256", "pclk_cpu", 11, 10), + GATE(PCLK_UART2, "pclk_uart2", "pclk_cpu", 11, 9), + GATE(0, "aclk_ccp", "aclk_cpu", 11, 8), + GATE(HCLK_CRYPTO, "hclk_crypto", "hclk_cpu", 11, 7), + GATE(ACLK_CRYPTO, "aclk_crypto", "aclk_cpu", 11, 6), + GATE(0, "nclk_ddrupctl1", "ddrphy", 11, 5), + GATE(0, "nclk_ddrupctl0", "ddrphy", 11, 4), + GATE(PCLK_TZPC, "pclk_tzpc", "pclk_cpu", 11, 3), + GATE(PCLK_EFUSE1024, "pclk_efuse_1024", "pclk_cpu", 11, 2), + GATE(PCLK_PUBL1, "pclk_publ1", "pclk_cpu", 11, 1), + GATE(PCLK_DDRUPCTL1, "pclk_ddrupctl1", "pclk_cpu", 11, 0), + + /* CRU_CLKGATE_CON12 */ + GATE(0, "pclk_core_niu", "pclk_dbg_pre", 12, 11), + GATE(0, "cs_dbg", "pclk_dbg_pre", 12, 10), + GATE(0, "pclk_dbg", "pclk_dbg_pre", 12, 9), + GATE(0, "armcore0", "armcore0_s", 12, 8), + GATE(0, "armcore1", "armcore1_s", 12, 7), + GATE(0, "armcore2", "armcore2_s", 12, 6), + GATE(0, "armcore3", "armcore3_s", 12, 5), + GATE(0, "l2ram", "l2ram_s", 12, 4), + GATE(0, "aclk_core_m0", "aclk_core_m0_s", 12, 3), + GATE(0, "aclk_core_mp", "aclk_core_mp_s", 12, 2), + GATE(0, "atclk", "atclk_s", 12, 1), + GATE(0, "pclk_dbg_pre", "pclk_dbg_pre_s", 12, 0), + + /* CRU_CLKGATE_CON13 */ + GATE(SCLK_HEVC_CORE, "sclk_hevc_core", "sclk_hevc_core_s", 13, 15), + GATE(SCLK_HEVC_CABAC, "sclk_hevc_cabac", "sclk_hevc_cabac_s", 13, 14), + GATE(ACLK_HEVC, "aclk_hevc", "aclk_hevc_s", 13, 13), + GATE(0, "wii", "wifi_frac_s", 13, 12), + GATE(SCLK_LCDC_PWM1, "sclk_lcdc_pwm1", "xin24m", 13, 11), + GATE(SCLK_LCDC_PWM0, "sclk_lcdc_pwm0", "xin24m", 13, 10), +/* 9 - Not in TRM - hsicphy12m_xin12m in Linux */ + GATE(0, "c2c_host", "aclk_cpu_src", 13, 8), + GATE(SCLK_OTG_ADP, "sclk_otg_adp", "xin32k", 13, 7), + GATE(SCLK_OTGPHY2, "sclk_otgphy2", "xin24m", 13, 6), + GATE(SCLK_OTGPHY1, "sclk_otgphy1", "xin24m", 13, 5), + GATE(SCLK_OTGPHY0, "sclk_otgphy0", "xin24m", 13, 4), + GATE(SCLK_EMMC, "sclk_emmc", "sclk_emmc_s", 13, 3), + GATE(SCLK_SDIO1, "sclk_sdio1", "sclk_sdio1_s", 13, 2), + GATE(SCLK_SDIO0, "sclk_sdio0", "sclk_sdio0_s", 13, 1), + GATE(SCLK_SDMMC, "sclk_sdmmc", "sclk_sdmmc_s", 13, 0), + + /* CRU_CLKGATE_CON14 */ + GATE(0, "pclk_alive_niu", "pclk_pd_alive", 14, 12), + GATE(PCLK_GRF, "pclk_grf", "pclk_pd_alive", 14, 11), + GATE(PCLK_GPIO8, "pclk_gpio8", "pclk_pd_alive", 14, 8), + GATE(PCLK_GPIO7, "pclk_gpio7", "pclk_pd_alive", 14, 7), + GATE(PCLK_GPIO6, "pclk_gpio6", "pclk_pd_alive", 14, 6), + GATE(PCLK_GPIO5, "pclk_gpio5", "pclk_pd_alive", 14, 5), + GATE(PCLK_GPIO4, "pclk_gpio4", "pclk_pd_alive", 14, 4), + GATE(PCLK_GPIO3, "pclk_gpio3", "pclk_pd_alive", 14, 3), + GATE(PCLK_GPIO2, "pclk_gpio2", "pclk_pd_alive", 14, 2), + GATE(PCLK_GPIO1, "pclk_gpio1", "pclk_pd_alive", 14, 1), + + /* CRU_CLKGATE_CON15*/ + GATE(HCLK_VIP, "hclk_vip", "hclk_vio", 15, 15), + GATE(ACLK_VIP, "aclk_vip", "aclk_vio0", 15, 14), + GATE(ACLK_RGA_NIU, "aclk_rga_niu", "aclk_rga_pre", 15, 13), + GATE(ACLK_VIO1_NIU, "aclk_vio1_niu", "aclk_vio1", 15, 12), + GATE(ACLK_VIO0_NIU, "aclk_vio0_niu", "aclk_vio0", 15, 11), + GATE(HCLK_VIO_NIU, "hclk_vio_niu", "hclk_vio", 15, 10), + GATE(HCLK_VIO_AHB_ARBI, "hclk_vio_ahb_arbi", "hclk_vio",15, 9), + GATE(HCLK_VOP1, "hclk_vop1", "hclk_vio", 15, 8), + GATE(ACLK_VOP1, "aclk_vop1", "aclk_vio1", 15, 7), + GATE(HCLK_VOP0, "hclk_vop0", "hclk_vio", 15, 6), + GATE(ACLK_VOP0, "aclk_vop0", "aclk_vio0", 15, 5), +/* 4 - aclk_lcdc_iep */ + GATE(HCLK_IEP, "hclk_iep", "hclk_vio", 15, 3), + GATE(ACLK_IEP, "aclk_iep", "aclk_vio0", 15, 2), + GATE(HCLK_RGA, "hclk_rga", "hclk_vio", 15, 1), + GATE(ACLK_RGA, "aclk_rga", "aclk_rga_pre", 15, 0), + + /* CRU_CLKGATE_CON16 */ + GATE(PCLK_VIO2_H2P, "pclk_vio2_h2p", "hclk_vio", 16, 11), + GATE(HCLK_VIO2_H2P, "hclk_vio2_h2p", "hclk_vio", 16, 10), + GATE(PCLK_HDMI_CTRL, "pclk_hdmi_ctrl", "hclk_vio", 16, 9), + GATE(PCLK_EDP_CTRL, "pclk_edp_ctrl", "hclk_vio", 16, 8), + GATE(PCLK_LVDS_PHY, "pclk_lvds_phy", "hclk_vio", 16, 7), + GATE(PCLK_MIPI_CSI, "pclk_mipi_csi", "hclk_vio", 16, 6), + GATE(PCLK_MIPI_DSI1, "pclk_mipi_dsi1", "hclk_vio", 16, 5), + GATE(PCLK_MIPI_DSI0, "pclk_mipi_dsi0", "hclk_vio", 16, 4), + GATE(PCLK_ISP_IN, "pclk_isp_in", "ext_isp", 16, 3), + GATE(ACLK_ISP, "aclk_isp", "aclk_vio1", 16, 2), + GATE(HCLK_ISP, "hclk_isp", "hclk_vio", 16, 1), + GATE(0, "pclk_vip_in", "ext_vip", 16, 0), + + /* CRU_CLKGATE_CON17 */ + GATE(PCLK_GPIO0, "pclk_gpio0", "pclk_pd_pmu", 17, 4), + GATE(PCLK_SGRF, "pclk_sgrf", "pclk_pd_pmu", 17, 3), + GATE(0, "pclk_pmu_niu", "pclk_pd_pmu", 17, 2), + GATE(0, "pclk_intmem1", "pclk_pd_pmu", 17, 1), + GATE(PCLK_PMU, "pclk_pmu", "pclk_pd_pmu", 17, 0), + + /* CRU_CLKGATE_CON18 */ + GATE(ACLK_GPU, "aclk_gpu", "sclk_gpu", 18, 0), +}; + +/* + * PLLs + */ +#define PLL_RATE_BA(_hz, _ref, _fb, _post, _ba) \ +{ \ + .freq = _hz, \ + .refdiv = _ref, \ + .fbdiv = _fb, \ + .postdiv1 = _post, \ + .bwadj = _ba, \ +} + +#define PLL_RATE(_mhz, _ref, _fb, _post) \ + PLL_RATE_BA(_mhz, _ref, _fb, _post, ((_fb < 2) ? 1 : _fb >> 1)) + +static struct rk_clk_pll_rate rk3288_pll_rates[] = { + PLL_RATE( 2208000000, 1, 92, 1), + PLL_RATE( 2184000000, 1, 91, 1), + PLL_RATE( 2160000000, 1, 90, 1), + PLL_RATE( 2136000000, 1, 89, 1), + PLL_RATE( 2112000000, 1, 88, 1), + PLL_RATE( 2088000000, 1, 87, 1), + PLL_RATE( 2064000000, 1, 86, 1), + PLL_RATE( 2040000000, 1, 85, 1), + PLL_RATE( 2016000000, 1, 84, 1), + PLL_RATE( 1992000000, 1, 83, 1), + PLL_RATE( 1968000000, 1, 82, 1), + PLL_RATE( 1944000000, 1, 81, 1), + PLL_RATE( 1920000000, 1, 80, 1), + PLL_RATE( 1896000000, 1, 79, 1), + PLL_RATE( 1872000000, 1, 78, 1), + PLL_RATE( 1848000000, 1, 77, 1), + PLL_RATE( 1824000000, 1, 76, 1), + PLL_RATE( 1800000000, 1, 75, 1), + PLL_RATE( 1776000000, 1, 74, 1), + PLL_RATE( 1752000000, 1, 73, 1), + PLL_RATE( 1728000000, 1, 72, 1), + PLL_RATE( 1704000000, 1, 71, 1), + PLL_RATE( 1680000000, 1, 70, 1), + PLL_RATE( 1656000000, 1, 69, 1), + PLL_RATE( 1632000000, 1, 68, 1), + PLL_RATE( 1608000000, 1, 67, 1), + PLL_RATE( 1560000000, 1, 65, 1), + PLL_RATE( 1512000000, 1, 63, 1), + PLL_RATE( 1488000000, 1, 62, 1), + PLL_RATE( 1464000000, 1, 61, 1), + PLL_RATE( 1440000000, 1, 60, 1), + PLL_RATE( 1416000000, 1, 59, 1), + PLL_RATE( 1392000000, 1, 58, 1), + PLL_RATE( 1368000000, 1, 57, 1), + PLL_RATE( 1344000000, 1, 56, 1), + PLL_RATE( 1320000000, 1, 55, 1), + PLL_RATE( 1296000000, 1, 54, 1), + PLL_RATE( 1272000000, 1, 53, 1), + PLL_RATE( 1248000000, 1, 52, 1), + PLL_RATE( 1224000000, 1, 51, 1), + PLL_RATE( 1200000000, 1, 50, 1), + PLL_RATE( 1188000000, 2, 99, 1), + PLL_RATE( 1176000000, 1, 49, 1), + PLL_RATE( 1128000000, 1, 47, 1), + PLL_RATE( 1104000000, 1, 46, 1), + PLL_RATE( 1008000000, 1, 84, 2), + PLL_RATE( 912000000, 1, 76, 2), + PLL_RATE( 891000000, 8, 594, 2), + PLL_RATE( 888000000, 1, 74, 2), + PLL_RATE( 816000000, 1, 68, 2), + PLL_RATE( 798000000, 2, 133, 2), + PLL_RATE( 792000000, 1, 66, 2), + PLL_RATE( 768000000, 1, 64, 2), + PLL_RATE( 742500000, 8, 495, 2), + PLL_RATE( 696000000, 1, 58, 2), + PLL_RATE_BA( 621000000, 1, 207, 8, 1), + PLL_RATE( 600000000, 1, 50, 2), + PLL_RATE_BA( 594000000, 1, 198, 8, 1), + PLL_RATE( 552000000, 1, 46, 2), + PLL_RATE( 504000000, 1, 84, 4), + PLL_RATE( 500000000, 3, 125, 2), + PLL_RATE( 456000000, 1, 76, 4), + PLL_RATE( 428000000, 1, 107, 6), + PLL_RATE( 408000000, 1, 68, 4), + PLL_RATE( 400000000, 3, 100, 2), + PLL_RATE_BA( 394000000, 1, 197, 12, 1), + PLL_RATE( 384000000, 2, 128, 4), + PLL_RATE( 360000000, 1, 60, 4), + PLL_RATE_BA( 356000000, 1, 178, 12, 1), + PLL_RATE_BA( 324000000, 1, 189, 14, 1), + PLL_RATE( 312000000, 1, 52, 4), + PLL_RATE_BA( 308000000, 1, 154, 12, 1), + PLL_RATE_BA( 303000000, 1, 202, 16, 1), + PLL_RATE( 300000000, 1, 75, 6), + PLL_RATE_BA( 297750000, 2, 397, 16, 1), + PLL_RATE_BA( 293250000, 2, 391, 16, 1), + PLL_RATE_BA( 292500000, 1, 195, 16, 1), + PLL_RATE( 273600000, 1, 114, 10), + PLL_RATE_BA( 273000000, 1, 182, 16, 1), + PLL_RATE_BA( 270000000, 1, 180, 16, 1), + PLL_RATE_BA( 266250000, 2, 355, 16, 1), + PLL_RATE_BA( 256500000, 1, 171, 16, 1), + PLL_RATE( 252000000, 1, 84, 8), + PLL_RATE_BA( 250500000, 1, 167, 16, 1), + PLL_RATE_BA( 243428571, 1, 142, 14, 1), + PLL_RATE( 238000000, 1, 119, 12), + PLL_RATE_BA( 219750000, 2, 293, 16, 1), + PLL_RATE_BA( 216000000, 1, 144, 16, 1), + PLL_RATE_BA( 213000000, 1, 142, 16, 1), + PLL_RATE( 195428571, 1, 114, 14), + PLL_RATE( 160000000, 1, 80, 12), + PLL_RATE( 157500000, 1, 105, 16), + PLL_RATE( 126000000, 1, 84, 16), + PLL_RATE( 48000000, 1, 64, 32), + {}, +}; + +static struct rk_clk_armclk_rates rk3288_armclk_rates[] = { + { 1800000000, 1}, + { 1704000000, 1}, + { 1608000000, 1}, + { 1512000000, 1}, + { 1416000000, 1}, + { 1200000000, 1}, + { 1008000000, 1}, + { 816000000, 1}, + { 696000000, 1}, + { 600000000, 1}, + { 408000000, 1}, + { 312000000, 1}, + { 216000000, 1}, + { 126000000, 1}, +}; + + +/* Fixed rate clock. */ +#define FRATE(_id, _name, _freq) \ +{ \ + .type = RK_CLK_FIXED, \ + .clk.fixed = &(struct clk_fixed_def) { \ + .clkdef.id = _id, \ + .clkdef.name = _name, \ + .clkdef.parent_names = NULL, \ + .clkdef.parent_cnt = 0, \ + .clkdef.flags = CLK_NODE_STATIC_STRINGS, \ + .freq = _freq, \ + }, \ +} + +/* Fixed rate multipier/divider. */ +#define FACT(_id, _name, _pname, _mult, _div) \ +{ \ + .type = RK_CLK_FIXED, \ + .clk.fixed = &(struct clk_fixed_def) { \ + .clkdef.id = _id, \ + .clkdef.name = _name, \ + .clkdef.parent_names = (const char *[]){_pname}, \ + .clkdef.parent_cnt = 1, \ + .clkdef.flags = CLK_NODE_STATIC_STRINGS, \ + .mult = _mult, \ + .div = _div, \ + }, \ +} + +/* Standard PLL. */ +#define PLL(_id, _name, _base, _shift) \ +{ \ + .type = RK3066_CLK_PLL, \ + .clk.pll = &(struct rk_clk_pll_def) { \ + .clkdef.id = _id, \ + .clkdef.name = _name, \ + .clkdef.parent_names = pll_src_p, \ + .clkdef.parent_cnt = nitems(pll_src_p), \ + .clkdef.flags = CLK_NODE_STATIC_STRINGS, \ + .base_offset = _base, \ + .mode_reg = CRU_MODE_CON, \ + .mode_shift = _shift, \ + .rates = rk3288_pll_rates, \ + }, \ +} + +/* Multiplexer. */ +#define MUX(_id, _name, _pn, _f, _mo, _ms, _mw) \ +{ \ + .type = RK_CLK_MUX, \ + .clk.mux = &(struct rk_clk_mux_def) { \ + .clkdef.id = _id, \ + .clkdef.name = _name, \ + .clkdef.parent_names = _pn, \ + .clkdef.parent_cnt = nitems(_pn), \ + .clkdef.flags = CLK_NODE_STATIC_STRINGS, \ + .offset = CRU_CLKSEL_CON(_mo), \ + .shift = _ms, \ + .width = _mw, \ + .mux_flags = _f, \ + }, \ +} + +#define ARMDIV(_id, _name, _pn, _r, _o, _ds, _dw, _ms, _mw, _mp, _ap) \ +{ \ + .type = RK_CLK_ARMCLK, \ + .clk.armclk = &(struct rk_clk_armclk_def) { \ + .clkdef.id = _id, \ + .clkdef.name = _name, \ + .clkdef.parent_names = _pn, \ + .clkdef.parent_cnt = nitems(_pn), \ + .clkdef.flags = CLK_NODE_STATIC_STRINGS, \ + .muxdiv_offset = CRU_CLKSEL_CON(_o), \ + .mux_shift = _ms, \ + .mux_width = _mw, \ + .div_shift = _ds, \ + .div_width = _dw, \ + .main_parent = _mp, \ + .alt_parent = _ap, \ + .rates = _r, \ + .nrates = nitems(_r), \ + }, \ +} + +/* Fixed rate multipier/divider. */ +#define FRACT(_id, _name, _pname, _f, _o) \ +{ \ + .type = RK_CLK_FRACT, \ + .clk.fract = &(struct rk_clk_fract_def) { \ + .clkdef.id = _id, \ + .clkdef.name = _name, \ + .clkdef.parent_names = (const char *[]){_pname}, \ + .clkdef.parent_cnt = 1, \ + .clkdef.flags = CLK_NODE_STATIC_STRINGS, \ + .offset = CRU_CLKSEL_CON(_o), \ + .flags = _f, \ + }, \ +} + +/* Full composite clock. */ +#define COMP(_id, _name, _pnames, _f, _o, _ds, _dw, _ms, _mw) \ +{ \ + .type = RK_CLK_COMPOSITE, \ + .clk.composite = &(struct rk_clk_composite_def) { \ + .clkdef.id = _id, \ + .clkdef.name = _name, \ + .clkdef.parent_names = _pnames, \ + .clkdef.parent_cnt = nitems(_pnames), \ + .clkdef.flags = CLK_NODE_STATIC_STRINGS, \ + .muxdiv_offset = CRU_CLKSEL_CON(_o), \ + .mux_shift = _ms, \ + .mux_width = _mw, \ + .div_shift = _ds, \ *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Fri Dec 4 16:26:10 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D571A4A4DBF; Fri, 4 Dec 2020 16:26:10 +0000 (UTC) (envelope-from arichardson.kde@gmail.com) Received: from mail-ej1-f67.google.com (mail-ej1-f67.google.com [209.85.218.67]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CndPG5Xgyz4vqv; Fri, 4 Dec 2020 16:26:10 +0000 (UTC) (envelope-from arichardson.kde@gmail.com) Received: by mail-ej1-f67.google.com with SMTP id g20so9539451ejb.1; Fri, 04 Dec 2020 08:26:10 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=IJuXNpH2QgYOV4QEtSoAAazLm9ShUo1vknUiR7h0sB4=; b=kX7XdZV+6z6EVXGM4dayoLc9mVdwb3xUyjWTPnvB9Q7V9rODUBlm9m2X28/3VFVzi0 1aY7WZP/ktWnomvy6fTP/IsmCYrfmi0oghQvTJgGV0rfOh1npHWVM4MSrcDYwUzpDeZK iIONa3whE2BqdJBVhvBTkPacwJZjiJkT0woTKe8V25fzLmAXGFEobHrtlCPJbCJxfyvJ 1pax8fWqyWH+BxXLqulygcUpevFztQ4ck/nDaQH2WtSR8sd0y3dKl2rKJwdaYDe6WUBN zU9uEqvvPqoeF8FvCTotQqMoyHZyFlsDxB9Ifju9Bg4DxV7YFwVZlgcLS4NgXnGA+di8 6htg== X-Gm-Message-State: AOAM5334++bc75vvESW4GS9XTtAZbDzG3+tQE3OW/HrHicdoIH/Z7x+8 17f+UEZgk/OBbQIjKIz0/vh8/95wJNK+hpJ9 X-Google-Smtp-Source: ABdhPJyylA/Kc3mB7vqNiCCKoaOe9e28rSQjyNclrvByy5hRkHjKJA9xuwuFW1ddqE/mE0SVhsIFlg== X-Received: by 2002:a17:907:414c:: with SMTP id od20mr7817989ejb.75.1607099169078; Fri, 04 Dec 2020 08:26:09 -0800 (PST) Received: from mail-wr1-f46.google.com (mail-wr1-f46.google.com. [209.85.221.46]) by smtp.gmail.com with ESMTPSA id 91sm4250160edy.45.2020.12.04.08.26.08 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Fri, 04 Dec 2020 08:26:08 -0800 (PST) Received: by mail-wr1-f46.google.com with SMTP id z7so5895486wrn.3; Fri, 04 Dec 2020 08:26:08 -0800 (PST) X-Received: by 2002:a05:6000:112:: with SMTP id o18mr5803623wrx.7.1607099168451; Fri, 04 Dec 2020 08:26:08 -0800 (PST) MIME-Version: 1.0 References: <202012041450.0B4EouQ2024632@repo.freebsd.org> <6f9541e4-b216-8a93-881e-e3859bff84fa@selasky.org> In-Reply-To: <6f9541e4-b216-8a93-881e-e3859bff84fa@selasky.org> From: Alexander Richardson Date: Fri, 4 Dec 2020 16:25:57 +0000 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r368329 - head/stand/kshim To: Hans Petter Selasky Cc: src-committers , svn-src-all , svn-src-head , Konstantin Belousov Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4CndPG5Xgyz4vqv X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; TAGGED_FROM(0.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Dec 2020 16:26:10 -0000 On Fri, 4 Dec 2020 at 16:06, Hans Petter Selasky wrote: > > On 12/4/20 4:59 PM, Alexander Richardson wrote: > > On Fri, 4 Dec 2020 at 14:51, Hans Petter Selasky wrote: > >> > >> Author: hselasky > >> Date: Fri Dec 4 14:50:55 2020 > >> New Revision: 368329 > >> URL: https://svnweb.freebsd.org/changeset/base/368329 > >> > >> Log: > >> Fix definition of int64_t and uint64_t when long is 64-bit. This gets the kernel > >> shim code in line with the rest of the kernel, sys/x86/include/_types.h. > >> > >> MFC after: 1 week > >> Sponsored by: Mellanox Technologies // NVIDIA Networking > >> > >> Modified: > >> head/stand/kshim/bsd_kernel.h > >> > >> Modified: head/stand/kshim/bsd_kernel.h > >> ============================================================================== > >> --- head/stand/kshim/bsd_kernel.h Fri Dec 4 14:09:12 2020 (r368328) > >> +++ head/stand/kshim/bsd_kernel.h Fri Dec 4 14:50:55 2020 (r368329) > >> @@ -208,9 +208,17 @@ typedef unsigned int uint32_t; > >> #define _INT32_T_DECLARED > >> typedef signed int int32_t; > >> #define _UINT64_T_DECLARED > >> +#ifndef __LP64__ > >> typedef unsigned long long uint64_t; > >> +#else > >> +typedef unsigned long uint64_t; > >> +#endif > >> #define _INT16_T_DECLARED > >> +#ifndef __LP64__ > >> typedef signed long long int64_t; > >> +#else > >> +typedef signed long int64_t; > >> +#endif > >> > >> typedef uint16_t uid_t; > >> typedef uint16_t gid_t; > > > > Since we no longer support ancient compilers, could we simplify this > > and just use > > typedef __UINT64_TYPE__ uint64_t; > > typedef __INT64_TYPE__ int64_t; > > ? > > > > This will work across all architectures and ABIs, and appears to work > > starting with GCC 4.5.3 and Clang 3.5: > > https://godbolt.org/z/TWavfb > > Hi Alexander, > > I'm not sure how that definition will work together with existing code, > mixing uint64_t, unsigned long, and unsigned long long. Will this cause > more compiler warnings? This also will affect user-space and ports. > > Maybe Konstantin, CC'ed, has some input on this? > > --HPS > I haven't looked at GCC's source code, but clang tries to make __UINT64_TYPE__ expand to what the target expects: it picks unsigned long/unsigned long long depending on the target OS and architecture. E.g. if I look at clang/Basic/Targets/AArch64.cpp, I can see that clang uses unsigned long for uint64_t everywhere except OpenBSD/Windows/Darwin where it uses unsigned long long. Alex From owner-svn-src-head@freebsd.org Fri Dec 4 16:31:48 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 306BB4A5317 for ; Fri, 4 Dec 2020 16:31:48 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: from mail-qv1-xf2f.google.com (mail-qv1-xf2f.google.com [IPv6:2607:f8b0:4864:20::f2f]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CndWm0kLdz3C8L for ; Fri, 4 Dec 2020 16:31:47 +0000 (UTC) (envelope-from wlosh@bsdimp.com) Received: by mail-qv1-xf2f.google.com with SMTP id g19so3035830qvy.2 for ; Fri, 04 Dec 2020 08:31:47 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bsdimp-com.20150623.gappssmtp.com; s=20150623; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=RcAwfRICuocvaqbZOph2T2EZiVhXwzctvypRzVN3IXo=; b=Jk+Q1/1b4R9aLF5jy3P7sjeVsh1HRGK2Ia+fmJX8IAOnzKL+XTKawvk0r1m5QF4hFQ uMpgJv4rPenVZbJbpk51PFuYr1Emnz6UHVi3T6c5nXn2X4S/6Hp++6SEjC2L9jJlO+MG X5scJsxv6/KD6wjspp1eAlvKQk2dyIjLBfoeIdn8jYuaihU6Q7upmx/fj1+8EicdkJT+ pSU07RMIJ8pQ6vrFb5iEkXu4EF8ZdEBR8cIwVOnmJ0f3uPFrkuH2ghcQX1WFf2xBLcN6 qyjflyImA+xKnlnzp4tIViF1osdGAAqK8Slpre89v6gkD3Bt/nKkISfP+QVGoMDkwGF2 LoXg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=RcAwfRICuocvaqbZOph2T2EZiVhXwzctvypRzVN3IXo=; b=fVAYe1menH87UnW+t3SbFHqIlM6LXCS5S7UCikSRTuDJBEcM8MFVlpaF51fVChXWvN 9HLvAU5tpewlWb23u/jPxY3PoTzWMUwbBMeuATnVAFHY0i5iVTaaM0JaO4uhtonpfT/H n9o+t8QrvjogU0Iz4ajEXlNp/PYLsQAuF7jhZbHq50wJs08rBnWra6OJAwBM4Ngc0BYg +FiDQvnULZNDpJRYwUZPSERDfQ+xiqjfJ4RS4zi8pSh5YIrrP/b/OzI4hU99HaERVGg4 fgEXGEWN86VyrzPEG7LMze2WDSp4BK4Qa+5fOjtz7vQYD03r+mmDwO6F/JGwV8bU2oMh ACbQ== X-Gm-Message-State: AOAM532+BeQ859AYORPYLc7l/JUDDqcri7DTEo52tnOhiXMmfi2Ho+wD 6otgqD+H1Xa81KZuVNVtJk2CvzSBbz08YKl1YCAmXw== X-Google-Smtp-Source: ABdhPJwAUgFs5YWeNSDwNb0Ubh8PXGnkE2kBKAO1IQxnCaauVOR0BhjR3rg0tDmH1mzC3+sge44sp4TmEVsCOvpFx8k= X-Received: by 2002:ad4:4743:: with SMTP id c3mr6165432qvx.62.1607099506574; Fri, 04 Dec 2020 08:31:46 -0800 (PST) MIME-Version: 1.0 References: <202012041450.0B4EouQ2024632@repo.freebsd.org> <6f9541e4-b216-8a93-881e-e3859bff84fa@selasky.org> In-Reply-To: <6f9541e4-b216-8a93-881e-e3859bff84fa@selasky.org> From: Warner Losh Date: Fri, 4 Dec 2020 09:31:35 -0700 Message-ID: Subject: Re: svn commit: r368329 - head/stand/kshim To: Hans Petter Selasky Cc: Alexander Richardson , src-committers , svn-src-all , svn-src-head , Konstantin Belousov X-Rspamd-Queue-Id: 4CndWm0kLdz3C8L X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] Content-Type: text/plain; charset="UTF-8" X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Dec 2020 16:31:48 -0000 On Fri, Dec 4, 2020 at 9:06 AM Hans Petter Selasky wrote: > On 12/4/20 4:59 PM, Alexander Richardson wrote: > > On Fri, 4 Dec 2020 at 14:51, Hans Petter Selasky > wrote: > >> > >> Author: hselasky > >> Date: Fri Dec 4 14:50:55 2020 > >> New Revision: 368329 > >> URL: https://svnweb.freebsd.org/changeset/base/368329 > >> > >> Log: > >> Fix definition of int64_t and uint64_t when long is 64-bit. This > gets the kernel > >> shim code in line with the rest of the kernel, > sys/x86/include/_types.h. > >> > >> MFC after: 1 week > >> Sponsored by: Mellanox Technologies // NVIDIA Networking > >> > >> Modified: > >> head/stand/kshim/bsd_kernel.h > >> > >> Modified: head/stand/kshim/bsd_kernel.h > >> > ============================================================================== > >> --- head/stand/kshim/bsd_kernel.h Fri Dec 4 14:09:12 2020 > (r368328) > >> +++ head/stand/kshim/bsd_kernel.h Fri Dec 4 14:50:55 2020 > (r368329) > >> @@ -208,9 +208,17 @@ typedef unsigned int uint32_t; > >> #define _INT32_T_DECLARED > >> typedef signed int int32_t; > >> #define _UINT64_T_DECLARED > >> +#ifndef __LP64__ > >> typedef unsigned long long uint64_t; > >> +#else > >> +typedef unsigned long uint64_t; > >> +#endif > >> #define _INT16_T_DECLARED > >> +#ifndef __LP64__ > >> typedef signed long long int64_t; > >> +#else > >> +typedef signed long int64_t; > >> +#endif > >> > >> typedef uint16_t uid_t; > >> typedef uint16_t gid_t; > > > > Since we no longer support ancient compilers, could we simplify this > > and just use > > typedef __UINT64_TYPE__ uint64_t; > > typedef __INT64_TYPE__ int64_t; > > ? > > > > This will work across all architectures and ABIs, and appears to work > > starting with GCC 4.5.3 and Clang 3.5: > > https://godbolt.org/z/TWavfb > > Hi Alexander, > > I'm not sure how that definition will work together with existing code, > mixing uint64_t, unsigned long, and unsigned long long. Will this cause > more compiler warnings? This also will affect user-space and ports. > I think for the boot loader context, this suggestion will be completely fine. Since this file is only used there, it should be identical to your changes in that context. Warner > Maybe Konstantin, CC'ed, has some input on this? > > --HPS > > From owner-svn-src-head@freebsd.org Fri Dec 4 16:47:34 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 5AC144A4D76; Fri, 4 Dec 2020 16:47:34 +0000 (UTC) (envelope-from hps@selasky.org) Received: from mail.turbocat.net (turbocat.net [IPv6:2a01:4f8:c17:6c4b::2]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4Cndsy1Whhz3CxP; Fri, 4 Dec 2020 16:47:33 +0000 (UTC) (envelope-from hps@selasky.org) Received: from hps2020.home.selasky.org (unknown [178.17.145.105]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by mail.turbocat.net (Postfix) with ESMTPSA id 61D0A260726; Fri, 4 Dec 2020 17:47:32 +0100 (CET) Subject: Re: svn commit: r368329 - head/stand/kshim To: Warner Losh Cc: Alexander Richardson , src-committers , svn-src-all , svn-src-head , Konstantin Belousov References: <202012041450.0B4EouQ2024632@repo.freebsd.org> <6f9541e4-b216-8a93-881e-e3859bff84fa@selasky.org> From: Hans Petter Selasky Message-ID: <920898b7-fdae-bfbf-96a1-5988fdebd422@selasky.org> Date: Fri, 4 Dec 2020 17:47:22 +0100 User-Agent: Mozilla/5.0 (X11; FreeBSD amd64; rv:78.0) Gecko/20100101 Thunderbird/78.5.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4Cndsy1Whhz3CxP X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Dec 2020 16:47:34 -0000 On 12/4/20 5:31 PM, Warner Losh wrote: >> Hi Alexander, >> >> I'm not sure how that definition will work together with existing code, >> mixing uint64_t, unsigned long, and unsigned long long. Will this cause >> more compiler warnings? This also will affect user-space and ports. >> > I think for the boot loader context, this suggestion will be completely > fine. Since this file is only used there, it should be identical to your > changes in that context. Hi, Does this mean that all uintXX_t types should go this way? I like symmetry. Or only uint64_t? The reason for changing this the way I did are expectations in the current code. Right now, uint64_t _must_ be defined exactly like unsigned long for amd64, else I get silly warnings like this: sys/compat/linuxkpi/common/include/asm/atomic64.h:140:38: error: incompatible pointer types passing 'int64_t *' (aka 'long long *') to parameter of type 'u_long *' (aka 'unsigned long *') [-Werror,-Wincompatible-pointer-types] if (atomic_fcmpset_64(&v->counter, &ret, new)) --HPS From owner-svn-src-head@freebsd.org Fri Dec 4 16:51:59 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A938D4A59E3; Fri, 4 Dec 2020 16:51:59 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Cndz34Shfz3D4n; Fri, 4 Dec 2020 16:51:59 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8C9386CED; Fri, 4 Dec 2020 16:51:59 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B4GpxXo003433; Fri, 4 Dec 2020 16:51:59 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B4Gpx1Y003432; Fri, 4 Dec 2020 16:51:59 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202012041651.0B4Gpx1Y003432@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 4 Dec 2020 16:51:59 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368341 - head/stand/kshim X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/stand/kshim X-SVN-Commit-Revision: 368341 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Dec 2020 16:51:59 -0000 Author: hselasky Date: Fri Dec 4 16:51:59 2020 New Revision: 368341 URL: https://svnweb.freebsd.org/changeset/base/368341 Log: Fix mis-spelled macro in the kernel shim. MFC after: 1 week Sponsored by: Mellanox Technologies // NVIDIA Networking Modified: head/stand/kshim/bsd_kernel.h Modified: head/stand/kshim/bsd_kernel.h ============================================================================== --- head/stand/kshim/bsd_kernel.h Fri Dec 4 16:24:44 2020 (r368340) +++ head/stand/kshim/bsd_kernel.h Fri Dec 4 16:51:59 2020 (r368341) @@ -217,7 +217,7 @@ typedef unsigned long long uint64_t; #else typedef unsigned long uint64_t; #endif -#define _INT16_T_DECLARED +#define _INT64_T_DECLARED #ifndef __LP64__ typedef signed long long int64_t; #else From owner-svn-src-head@freebsd.org Fri Dec 4 18:56:45 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 01B564A869B; Fri, 4 Dec 2020 18:56:45 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Cnhl06dmqz3MPL; Fri, 4 Dec 2020 18:56:44 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id D6B53107D7; Fri, 4 Dec 2020 18:56:44 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B4IuiXW079858; Fri, 4 Dec 2020 18:56:44 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B4Iuide079856; Fri, 4 Dec 2020 18:56:44 GMT (envelope-from kib@FreeBSD.org) Message-Id: <202012041856.0B4Iuide079856@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 4 Dec 2020 18:56:44 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368342 - in head/sys: kern sys X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: in head/sys: kern sys X-SVN-Commit-Revision: 368342 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Dec 2020 18:56:45 -0000 Author: kib Date: Fri Dec 4 18:56:44 2020 New Revision: 368342 URL: https://svnweb.freebsd.org/changeset/base/368342 Log: Add kern_ntp_adjtime(9). Reviewed by: brooks, cy Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D27471 Modified: head/sys/kern/kern_ntptime.c head/sys/sys/syscallsubr.h Modified: head/sys/kern/kern_ntptime.c ============================================================================== --- head/sys/kern/kern_ntptime.c Fri Dec 4 16:51:59 2020 (r368341) +++ head/sys/kern/kern_ntptime.c Fri Dec 4 18:56:44 2020 (r368342) @@ -338,24 +338,13 @@ SYSCTL_S64(_kern_ntp_pll, OID_AUTO, time_freq, CTLFLAG * the timex.constant structure member has a dual purpose to set the time * constant and to set the TAI offset. */ -#ifndef _SYS_SYSPROTO_H_ -struct ntp_adjtime_args { - struct timex *tp; -}; -#endif - int -sys_ntp_adjtime(struct thread *td, struct ntp_adjtime_args *uap) +kern_ntp_adjtime(struct thread *td, struct timex *ntv, int *retvalp) { - struct timex ntv; /* temporary structure */ long freq; /* frequency ns/s) */ int modes; /* mode bits from structure */ int error, retval; - error = copyin((caddr_t)uap->tp, (caddr_t)&ntv, sizeof(ntv)); - if (error) - return (error); - /* * Update selected clock variables - only the superuser can * change anything. Note that there is no error checking here on @@ -365,18 +354,19 @@ sys_ntp_adjtime(struct thread *td, struct ntp_adjtime_ * the STA_PLL bit in the status word is cleared, the state and * status words are reset to the initial values at boot. */ - modes = ntv.modes; + modes = ntv->modes; + error = 0; if (modes) error = priv_check(td, PRIV_NTP_ADJTIME); if (error != 0) return (error); NTP_LOCK(); if (modes & MOD_MAXERROR) - time_maxerror = ntv.maxerror; + time_maxerror = ntv->maxerror; if (modes & MOD_ESTERROR) - time_esterror = ntv.esterror; + time_esterror = ntv->esterror; if (modes & MOD_STATUS) { - if (time_status & STA_PLL && !(ntv.status & STA_PLL)) { + if (time_status & STA_PLL && !(ntv->status & STA_PLL)) { time_state = TIME_OK; time_status = STA_UNSYNC; #ifdef PPS_SYNC @@ -384,28 +374,28 @@ sys_ntp_adjtime(struct thread *td, struct ntp_adjtime_ #endif /* PPS_SYNC */ } time_status &= STA_RONLY; - time_status |= ntv.status & ~STA_RONLY; + time_status |= ntv->status & ~STA_RONLY; } if (modes & MOD_TIMECONST) { - if (ntv.constant < 0) + if (ntv->constant < 0) time_constant = 0; - else if (ntv.constant > MAXTC) + else if (ntv->constant > MAXTC) time_constant = MAXTC; else - time_constant = ntv.constant; + time_constant = ntv->constant; } if (modes & MOD_TAI) { - if (ntv.constant > 0) /* XXX zero & negative numbers ? */ - time_tai = ntv.constant; + if (ntv->constant > 0) /* XXX zero & negative numbers ? */ + time_tai = ntv->constant; } #ifdef PPS_SYNC if (modes & MOD_PPSMAX) { - if (ntv.shift < PPS_FAVG) + if (ntv->shift < PPS_FAVG) pps_shiftmax = PPS_FAVG; - else if (ntv.shift > PPS_FAVGMAX) + else if (ntv->shift > PPS_FAVGMAX) pps_shiftmax = PPS_FAVGMAX; else - pps_shiftmax = ntv.shift; + pps_shiftmax = ntv->shift; } #endif /* PPS_SYNC */ if (modes & MOD_NANO) @@ -417,17 +407,17 @@ sys_ntp_adjtime(struct thread *td, struct ntp_adjtime_ if (modes & MOD_CLKA) time_status &= ~STA_CLK; if (modes & MOD_FREQUENCY) { - freq = (ntv.freq * 1000LL) >> 16; + freq = (ntv->freq * 1000LL) >> 16; if (freq > MAXFREQ) L_LINT(time_freq, MAXFREQ); else if (freq < -MAXFREQ) L_LINT(time_freq, -MAXFREQ); else { /* - * ntv.freq is [PPM * 2^16] = [us/s * 2^16] + * ntv->freq is [PPM * 2^16] = [us/s * 2^16] * time_freq is [ns/s * 2^32] */ - time_freq = ntv.freq * 1000LL * 65536LL; + time_freq = ntv->freq * 1000LL * 65536LL; } #ifdef PPS_SYNC pps_freq = time_freq; @@ -435,9 +425,9 @@ sys_ntp_adjtime(struct thread *td, struct ntp_adjtime_ } if (modes & MOD_OFFSET) { if (time_status & STA_NANO) - hardupdate(ntv.offset); + hardupdate(ntv->offset); else - hardupdate(ntv.offset * 1000); + hardupdate(ntv->offset * 1000); } /* @@ -445,38 +435,60 @@ sys_ntp_adjtime(struct thread *td, struct ntp_adjtime_ * returned only by ntp_gettime(); */ if (time_status & STA_NANO) - ntv.offset = L_GINT(time_offset); + ntv->offset = L_GINT(time_offset); else - ntv.offset = L_GINT(time_offset) / 1000; /* XXX rounding ? */ - ntv.freq = L_GINT((time_freq / 1000LL) << 16); - ntv.maxerror = time_maxerror; - ntv.esterror = time_esterror; - ntv.status = time_status; - ntv.constant = time_constant; + ntv->offset = L_GINT(time_offset) / 1000; /* XXX rounding ? */ + ntv->freq = L_GINT((time_freq / 1000LL) << 16); + ntv->maxerror = time_maxerror; + ntv->esterror = time_esterror; + ntv->status = time_status; + ntv->constant = time_constant; if (time_status & STA_NANO) - ntv.precision = time_precision; + ntv->precision = time_precision; else - ntv.precision = time_precision / 1000; - ntv.tolerance = MAXFREQ * SCALE_PPM; + ntv->precision = time_precision / 1000; + ntv->tolerance = MAXFREQ * SCALE_PPM; #ifdef PPS_SYNC - ntv.shift = pps_shift; - ntv.ppsfreq = L_GINT((pps_freq / 1000LL) << 16); + ntv->shift = pps_shift; + ntv->ppsfreq = L_GINT((pps_freq / 1000LL) << 16); if (time_status & STA_NANO) - ntv.jitter = pps_jitter; + ntv->jitter = pps_jitter; else - ntv.jitter = pps_jitter / 1000; - ntv.stabil = pps_stabil; - ntv.calcnt = pps_calcnt; - ntv.errcnt = pps_errcnt; - ntv.jitcnt = pps_jitcnt; - ntv.stbcnt = pps_stbcnt; + ntv->jitter = pps_jitter / 1000; + ntv->stabil = pps_stabil; + ntv->calcnt = pps_calcnt; + ntv->errcnt = pps_errcnt; + ntv->jitcnt = pps_jitcnt; + ntv->stbcnt = pps_stbcnt; #endif /* PPS_SYNC */ retval = ntp_is_time_error(time_status) ? TIME_ERROR : time_state; NTP_UNLOCK(); - error = copyout((caddr_t)&ntv, (caddr_t)uap->tp, sizeof(ntv)); - if (error == 0) - td->td_retval[0] = retval; + *retvalp = retval; + return (0); +} + +#ifndef _SYS_SYSPROTO_H_ +struct ntp_adjtime_args { + struct timex *tp; +}; +#endif + +int +sys_ntp_adjtime(struct thread *td, struct ntp_adjtime_args *uap) +{ + struct timex ntv; + int error, retval; + + error = copyin(uap->tp, &ntv, sizeof(ntv)); + if (error == 0) { + error = kern_ntp_adjtime(td, &ntv, &retval); + if (error == 0) { + error = copyout(&ntv, uap->tp, sizeof(ntv)); + if (error == 0) + td->td_retval[0] = retval; + } + } return (error); } Modified: head/sys/sys/syscallsubr.h ============================================================================== --- head/sys/sys/syscallsubr.h Fri Dec 4 16:51:59 2020 (r368341) +++ head/sys/sys/syscallsubr.h Fri Dec 4 18:56:44 2020 (r368342) @@ -61,6 +61,7 @@ union semun; struct sockaddr; struct stat; struct thr_param; +struct timex; struct uio; struct vm_map; struct vmspace; @@ -215,6 +216,7 @@ int kern_munlock(struct thread *td, uintptr_t addr, si int kern_munmap(struct thread *td, uintptr_t addr, size_t size); int kern_nanosleep(struct thread *td, struct timespec *rqt, struct timespec *rmt); +int kern_ntp_adjtime(struct thread *td, struct timex *ntv, int *retvalp); int kern_ogetdirentries(struct thread *td, struct ogetdirentries_args *uap, long *ploff); int kern_openat(struct thread *td, int fd, const char *path, From owner-svn-src-head@freebsd.org Fri Dec 4 18:57:59 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 99B854A895E; Fri, 4 Dec 2020 18:57:59 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CnhmR429Yz3Mvw; Fri, 4 Dec 2020 18:57:59 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 72A3B107DB; Fri, 4 Dec 2020 18:57:59 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B4Ivx0m080205; Fri, 4 Dec 2020 18:57:59 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B4IvweG080202; Fri, 4 Dec 2020 18:57:58 GMT (envelope-from kib@FreeBSD.org) Message-Id: <202012041857.0B4IvweG080202@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 4 Dec 2020 18:57:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368343 - head/sys/compat/freebsd32 X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/compat/freebsd32 X-SVN-Commit-Revision: 368343 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Dec 2020 18:57:59 -0000 Author: kib Date: Fri Dec 4 18:57:58 2020 New Revision: 368343 URL: https://svnweb.freebsd.org/changeset/base/368343 Log: Fix compat32 for ntp_adjtime(2). struct timex is not 32-bit safe, it uses longs for members. Provide translation. Reviewed by: brooks, cy Sponsored by: The FreeBSD Foundation MFC after: 1 week Differential revision: https://reviews.freebsd.org/D27471 Modified: head/sys/compat/freebsd32/freebsd32.h head/sys/compat/freebsd32/freebsd32_misc.c head/sys/compat/freebsd32/syscalls.master Modified: head/sys/compat/freebsd32/freebsd32.h ============================================================================== --- head/sys/compat/freebsd32/freebsd32.h Fri Dec 4 18:56:44 2020 (r368342) +++ head/sys/compat/freebsd32/freebsd32.h Fri Dec 4 18:57:58 2020 (r368343) @@ -409,4 +409,24 @@ struct procctl_reaper_pids32 { uint32_t rp_pids; }; +struct timex32 { + unsigned int modes; + int32_t offset; + int32_t freq; + int32_t maxerror; + int32_t esterror; + int status; + int32_t constant; + int32_t precision; + int32_t tolerance; + int32_t ppsfreq; + int32_t jitter; + int shift; + int32_t stabil; + int32_t jitcnt; + int32_t calcnt; + int32_t errcnt; + int32_t stbcnt; +}; + #endif /* !_COMPAT_FREEBSD32_FREEBSD32_H_ */ Modified: head/sys/compat/freebsd32/freebsd32_misc.c ============================================================================== --- head/sys/compat/freebsd32/freebsd32_misc.c Fri Dec 4 18:56:44 2020 (r368342) +++ head/sys/compat/freebsd32/freebsd32_misc.c Fri Dec 4 18:57:58 2020 (r368343) @@ -82,6 +82,7 @@ __FBSDID("$FreeBSD$"); #include #include #include +#include #include #include #include @@ -3763,6 +3764,71 @@ freebsd32_sched_rr_get_interval(struct thread *td, CP(ts, ts32, tv_sec); CP(ts, ts32, tv_nsec); error = copyout(&ts32, uap->interval, sizeof(ts32)); + } + return (error); +} + +static void +timex_to_32(struct timex32 *dst, struct timex *src) +{ + CP(*src, *dst, modes); + CP(*src, *dst, offset); + CP(*src, *dst, freq); + CP(*src, *dst, maxerror); + CP(*src, *dst, esterror); + CP(*src, *dst, status); + CP(*src, *dst, constant); + CP(*src, *dst, precision); + CP(*src, *dst, tolerance); + CP(*src, *dst, ppsfreq); + CP(*src, *dst, jitter); + CP(*src, *dst, shift); + CP(*src, *dst, stabil); + CP(*src, *dst, jitcnt); + CP(*src, *dst, calcnt); + CP(*src, *dst, errcnt); + CP(*src, *dst, stbcnt); +} + +static void +timex_from_32(struct timex *dst, struct timex32 *src) +{ + CP(*src, *dst, modes); + CP(*src, *dst, offset); + CP(*src, *dst, freq); + CP(*src, *dst, maxerror); + CP(*src, *dst, esterror); + CP(*src, *dst, status); + CP(*src, *dst, constant); + CP(*src, *dst, precision); + CP(*src, *dst, tolerance); + CP(*src, *dst, ppsfreq); + CP(*src, *dst, jitter); + CP(*src, *dst, shift); + CP(*src, *dst, stabil); + CP(*src, *dst, jitcnt); + CP(*src, *dst, calcnt); + CP(*src, *dst, errcnt); + CP(*src, *dst, stbcnt); +} + +int +freebsd32_ntp_adjtime(struct thread *td, struct freebsd32_ntp_adjtime_args *uap) +{ + struct timex tx; + struct timex32 tx32; + int error, retval; + + error = copyin(uap->tp, &tx32, sizeof(tx32)); + if (error == 0) { + timex_from_32(&tx, &tx32); + error = kern_ntp_adjtime(td, &tx, &retval); + if (error == 0) { + timex_to_32(&tx32, &tx); + error = copyout(&tx32, uap->tp, sizeof(tx32)); + if (error == 0) + td->td_retval[0] = retval; + } } return (error); } Modified: head/sys/compat/freebsd32/syscalls.master ============================================================================== --- head/sys/compat/freebsd32/syscalls.master Fri Dec 4 18:56:44 2020 (r368342) +++ head/sys/compat/freebsd32/syscalls.master Fri Dec 4 18:57:58 2020 (r368343) @@ -343,7 +343,8 @@ const void *buf, size_t nbyte, int pad, \ uint32_t offset1, uint32_t offset2); } 175 AUE_NULL UNIMPL nosys -176 AUE_NTP_ADJTIME NOPROTO { int ntp_adjtime(struct timex *tp); } +176 AUE_NTP_ADJTIME STD { int freebsd32_ntp_adjtime( \ + struct timex32 *tp); } 177 AUE_NULL UNIMPL sfork (BSD/OS 2.x) 178 AUE_NULL UNIMPL getdescriptor (BSD/OS 2.x) 179 AUE_NULL UNIMPL setdescriptor (BSD/OS 2.x) From owner-svn-src-head@freebsd.org Fri Dec 4 18:58:28 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DFF514A896D; Fri, 4 Dec 2020 18:58:28 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Cnhn063B0z3MtD; Fri, 4 Dec 2020 18:58:28 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C2E63108B5; Fri, 4 Dec 2020 18:58:28 +0000 (UTC) (envelope-from kib@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B4IwS7A080277; Fri, 4 Dec 2020 18:58:28 GMT (envelope-from kib@FreeBSD.org) Received: (from kib@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B4IwRLx080271; Fri, 4 Dec 2020 18:58:27 GMT (envelope-from kib@FreeBSD.org) Message-Id: <202012041858.0B4IwRLx080271@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kib set sender to kib@FreeBSD.org using -f From: Konstantin Belousov Date: Fri, 4 Dec 2020 18:58:27 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368344 - head/sys/compat/freebsd32 X-SVN-Group: head X-SVN-Commit-Author: kib X-SVN-Commit-Paths: head/sys/compat/freebsd32 X-SVN-Commit-Revision: 368344 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Dec 2020 18:58:28 -0000 Author: kib Date: Fri Dec 4 18:58:27 2020 New Revision: 368344 URL: https://svnweb.freebsd.org/changeset/base/368344 Log: Regen Modified: head/sys/compat/freebsd32/freebsd32_proto.h head/sys/compat/freebsd32/freebsd32_syscall.h head/sys/compat/freebsd32/freebsd32_syscalls.c head/sys/compat/freebsd32/freebsd32_sysent.c head/sys/compat/freebsd32/freebsd32_systrace_args.c Modified: head/sys/compat/freebsd32/freebsd32_proto.h ============================================================================== --- head/sys/compat/freebsd32/freebsd32_proto.h Fri Dec 4 18:57:58 2020 (r368343) +++ head/sys/compat/freebsd32/freebsd32_proto.h Fri Dec 4 18:58:27 2020 (r368344) @@ -168,6 +168,9 @@ struct freebsd32_shmsys_args { char a3_l_[PADL_(uint32_t)]; uint32_t a3; char a3_r_[PADR_(uint32_t)]; char a4_l_[PADL_(uint32_t)]; uint32_t a4; char a4_r_[PADR_(uint32_t)]; }; +struct freebsd32_ntp_adjtime_args { + char tp_l_[PADL_(struct timex32 *)]; struct timex32 * tp; char tp_r_[PADR_(struct timex32 *)]; +}; struct freebsd32___sysctl_args { char name_l_[PADL_(int *)]; int * name; char name_r_[PADR_(int *)]; char namelen_l_[PADL_(u_int)]; u_int namelen; char namelen_r_[PADR_(u_int)]; @@ -769,6 +772,7 @@ int freebsd32_sysarch(struct thread *, struct freebsd3 int freebsd32_semsys(struct thread *, struct freebsd32_semsys_args *); int freebsd32_msgsys(struct thread *, struct freebsd32_msgsys_args *); int freebsd32_shmsys(struct thread *, struct freebsd32_shmsys_args *); +int freebsd32_ntp_adjtime(struct thread *, struct freebsd32_ntp_adjtime_args *); int freebsd32___sysctl(struct thread *, struct freebsd32___sysctl_args *); int freebsd32_futimes(struct thread *, struct freebsd32_futimes_args *); int freebsd32_msgsnd(struct thread *, struct freebsd32_msgsnd_args *); @@ -1342,6 +1346,7 @@ int freebsd11_freebsd32_fstatat(struct thread *, struc #define FREEBSD32_SYS_AUE_freebsd32_shmsys AUE_SHMSYS #define FREEBSD32_SYS_AUE_freebsd6_freebsd32_pread AUE_PREAD #define FREEBSD32_SYS_AUE_freebsd6_freebsd32_pwrite AUE_PWRITE +#define FREEBSD32_SYS_AUE_freebsd32_ntp_adjtime AUE_NTP_ADJTIME #define FREEBSD32_SYS_AUE_freebsd11_freebsd32_stat AUE_STAT #define FREEBSD32_SYS_AUE_freebsd11_freebsd32_fstat AUE_FSTAT #define FREEBSD32_SYS_AUE_freebsd11_freebsd32_lstat AUE_LSTAT Modified: head/sys/compat/freebsd32/freebsd32_syscall.h ============================================================================== --- head/sys/compat/freebsd32/freebsd32_syscall.h Fri Dec 4 18:57:58 2020 (r368343) +++ head/sys/compat/freebsd32/freebsd32_syscall.h Fri Dec 4 18:58:27 2020 (r368344) @@ -167,7 +167,7 @@ #define FREEBSD32_SYS_freebsd32_shmsys 171 /* 173 is freebsd6 freebsd32_pread */ /* 174 is freebsd6 freebsd32_pwrite */ -#define FREEBSD32_SYS_ntp_adjtime 176 +#define FREEBSD32_SYS_freebsd32_ntp_adjtime 176 #define FREEBSD32_SYS_setgid 181 #define FREEBSD32_SYS_setegid 182 #define FREEBSD32_SYS_seteuid 183 Modified: head/sys/compat/freebsd32/freebsd32_syscalls.c ============================================================================== --- head/sys/compat/freebsd32/freebsd32_syscalls.c Fri Dec 4 18:57:58 2020 (r368343) +++ head/sys/compat/freebsd32/freebsd32_syscalls.c Fri Dec 4 18:58:27 2020 (r368344) @@ -185,7 +185,7 @@ const char *freebsd32_syscallnames[] = { "compat6.freebsd32_pread", /* 173 = freebsd6 freebsd32_pread */ "compat6.freebsd32_pwrite", /* 174 = freebsd6 freebsd32_pwrite */ "#175", /* 175 = nosys */ - "ntp_adjtime", /* 176 = ntp_adjtime */ + "freebsd32_ntp_adjtime", /* 176 = freebsd32_ntp_adjtime */ "#177", /* 177 = sfork */ "#178", /* 178 = getdescriptor */ "#179", /* 179 = setdescriptor */ Modified: head/sys/compat/freebsd32/freebsd32_sysent.c ============================================================================== --- head/sys/compat/freebsd32/freebsd32_sysent.c Fri Dec 4 18:57:58 2020 (r368343) +++ head/sys/compat/freebsd32/freebsd32_sysent.c Fri Dec 4 18:58:27 2020 (r368344) @@ -238,7 +238,7 @@ struct sysent freebsd32_sysent[] = { { compat6(AS(freebsd6_freebsd32_pread_args),freebsd32_pread), .sy_auevent = AUE_PREAD, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC }, /* 173 = freebsd6 freebsd32_pread */ { compat6(AS(freebsd6_freebsd32_pwrite_args),freebsd32_pwrite), .sy_auevent = AUE_PWRITE, .sy_flags = SYF_CAPENABLED, .sy_thrcnt = SY_THR_STATIC }, /* 174 = freebsd6 freebsd32_pwrite */ { .sy_narg = 0, .sy_call = (sy_call_t *)nosys, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_ABSENT }, /* 175 = nosys */ - { .sy_narg = AS(ntp_adjtime_args), .sy_call = (sy_call_t *)sys_ntp_adjtime, .sy_auevent = AUE_NTP_ADJTIME, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 176 = ntp_adjtime */ + { .sy_narg = AS(freebsd32_ntp_adjtime_args), .sy_call = (sy_call_t *)freebsd32_ntp_adjtime, .sy_auevent = AUE_NTP_ADJTIME, .sy_flags = 0, .sy_thrcnt = SY_THR_STATIC }, /* 176 = freebsd32_ntp_adjtime */ { .sy_narg = 0, .sy_call = (sy_call_t *)nosys, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_ABSENT }, /* 177 = sfork */ { .sy_narg = 0, .sy_call = (sy_call_t *)nosys, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_ABSENT }, /* 178 = getdescriptor */ { .sy_narg = 0, .sy_call = (sy_call_t *)nosys, .sy_auevent = AUE_NULL, .sy_flags = 0, .sy_thrcnt = SY_THR_ABSENT }, /* 179 = setdescriptor */ Modified: head/sys/compat/freebsd32/freebsd32_systrace_args.c ============================================================================== --- head/sys/compat/freebsd32/freebsd32_systrace_args.c Fri Dec 4 18:57:58 2020 (r368343) +++ head/sys/compat/freebsd32/freebsd32_systrace_args.c Fri Dec 4 18:58:27 2020 (r368344) @@ -870,10 +870,10 @@ systrace_args(int sysnum, void *params, uint64_t *uarg *n_args = 4; break; } - /* ntp_adjtime */ + /* freebsd32_ntp_adjtime */ case 176: { - struct ntp_adjtime_args *p = params; - uarg[0] = (intptr_t) p->tp; /* struct timex * */ + struct freebsd32_ntp_adjtime_args *p = params; + uarg[0] = (intptr_t) p->tp; /* struct timex32 * */ *n_args = 1; break; } @@ -4786,11 +4786,11 @@ systrace_entry_setargdesc(int sysnum, int ndx, char *d break; }; break; - /* ntp_adjtime */ + /* freebsd32_ntp_adjtime */ case 176: switch(ndx) { case 0: - p = "userland struct timex *"; + p = "userland struct timex32 *"; break; default: break; @@ -9629,7 +9629,7 @@ systrace_return_setargdesc(int sysnum, int ndx, char * if (ndx == 0 || ndx == 1) p = "int"; break; - /* ntp_adjtime */ + /* freebsd32_ntp_adjtime */ case 176: if (ndx == 0 || ndx == 1) p = "int"; From owner-svn-src-head@freebsd.org Fri Dec 4 19:31:16 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B00814A9BDF; Fri, 4 Dec 2020 19:31:16 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CnjVr4gyYz3Qrr; Fri, 4 Dec 2020 19:31:16 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 936BD1112E; Fri, 4 Dec 2020 19:31:16 +0000 (UTC) (envelope-from cy@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B4JVGPo001860; Fri, 4 Dec 2020 19:31:16 GMT (envelope-from cy@FreeBSD.org) Received: (from cy@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B4JVGlI001859; Fri, 4 Dec 2020 19:31:16 GMT (envelope-from cy@FreeBSD.org) Message-Id: <202012041931.0B4JVGlI001859@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cy set sender to cy@FreeBSD.org using -f From: Cy Schubert Date: Fri, 4 Dec 2020 19:31:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368345 - head/libexec/rc/rc.d X-SVN-Group: head X-SVN-Commit-Author: cy X-SVN-Commit-Paths: head/libexec/rc/rc.d X-SVN-Commit-Revision: 368345 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Dec 2020 19:31:16 -0000 Author: cy Date: Fri Dec 4 19:31:16 2020 New Revision: 368345 URL: https://svnweb.freebsd.org/changeset/base/368345 Log: Revert r366857. r366857 created a number of problems, tearing down interfaces too early in shutdown. This resulted in: - hung ssh sessions when shutting down or rebooting remotely using shutdown (I've used exec shutdown, for years, as apposed to simply shutdown). - NFS mounted filesystems "disappear" prior to unmount. - dhclient attached to a VLAN on an interface who's parent interface has already shut down prints errors. The path forward is to teach lagg(4) and vlan(4) about WOL. PR: 251531, 251540 PR: 158734, 109980 are broken again Reported by: jhb, emaste, jtl, Helge Oldach Martin Birgmeier MFC after: Immediately Discussion at: https://reviews.freebsd.org/D27459 Modified: head/libexec/rc/rc.d/netif Modified: head/libexec/rc/rc.d/netif ============================================================================== --- head/libexec/rc/rc.d/netif Fri Dec 4 18:58:27 2020 (r368344) +++ head/libexec/rc/rc.d/netif Fri Dec 4 19:31:16 2020 (r368345) @@ -28,7 +28,7 @@ # PROVIDE: netif # REQUIRE: FILESYSTEMS iovctl serial sppp sysctl # REQUIRE: hostid ipfs -# KEYWORD: nojailvnet shutdown +# KEYWORD: nojailvnet . /etc/rc.subr . /etc/network.subr From owner-svn-src-head@freebsd.org Fri Dec 4 20:14:26 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7D1184AAAE7; Fri, 4 Dec 2020 20:14:26 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CnkSf2vw0z3k3g; Fri, 4 Dec 2020 20:14:26 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 56B7211C83; Fri, 4 Dec 2020 20:14:26 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B4KEQ1M030827; Fri, 4 Dec 2020 20:14:26 GMT (envelope-from jhb@FreeBSD.org) Received: (from jhb@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B4KEQjY030826; Fri, 4 Dec 2020 20:14:26 GMT (envelope-from jhb@FreeBSD.org) Message-Id: <202012042014.0B4KEQjY030826@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: jhb set sender to jhb@FreeBSD.org using -f From: John Baldwin Date: Fri, 4 Dec 2020 20:14:26 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368347 - head/sys/mips/mips X-SVN-Group: head X-SVN-Commit-Author: jhb X-SVN-Commit-Paths: head/sys/mips/mips X-SVN-Commit-Revision: 368347 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Dec 2020 20:14:26 -0000 Author: jhb Date: Fri Dec 4 20:14:25 2020 New Revision: 368347 URL: https://svnweb.freebsd.org/changeset/base/368347 Log: Various fixes for the MIPS DDB stack unwinder. - Fix kernel stack unwinding end-of-function false-positive The kernel stack unwinder assumes that any jr $ra indicates the end of the current function. However, modern compilers generate code that contains jr $ra at various places inside the function. - Handle LLD inter-function padding when looking for the start of a function. - Use call site for symbol name/offset when unwinding Currently we use the return address, which will normally just give an output that's off by 8 from the actual call site. However, for tail calls, this is particularly bad, as we end up printing the symbol name for the function that comes after the one that made the call. Instead we should go back two instructions from the return address for the unwound program counter. Submitted by: arichardson (1, 2), jrtc27 (3) Reviewed by: arichardson Obtained from: CheriBSD Sponsored by: DARPA Differential Revision: https://reviews.freebsd.org/D27363 Modified: head/sys/mips/mips/db_trace.c Modified: head/sys/mips/mips/db_trace.c ============================================================================== --- head/sys/mips/mips/db_trace.c Fri Dec 4 19:35:43 2020 (r368346) +++ head/sys/mips/mips/db_trace.c Fri Dec 4 20:14:25 2020 (r368347) @@ -67,11 +67,10 @@ extern char edata[]; || (((ins) & 0xffff8000) == 0x67bd8000)) /* - * MIPS ABI 3.0 requires that all functions return using the 'j ra' instruction - * - * XXX gcc doesn't do this for functions with __noreturn__ attribute. + * LLD will insert invalid instruction traps between functions. + * Currently this is 0xefefefef but it may change in the future. */ -#define MIPS_END_OF_FUNCTION(ins) ((ins) == 0x03e00008) +#define MIPS_LLD_PADDING_BETWEEN_FUNCTIONS(ins) ((ins) == 0xefefefef) #if defined(__mips_n64) # define MIPS_IS_VALID_KERNELADDR(reg) ((((reg) & 3) == 0) && \ @@ -183,27 +182,32 @@ loop: * subroutine. */ if (!subr) { - va = pc - sizeof(int); + va = pc; while (1) { instr = kdbpeek((int *)va); - if (MIPS_START_OF_FUNCTION(instr)) + /* LLD fills padding between functions with 0xefefefef */ + if (MIPS_LLD_PADDING_BETWEEN_FUNCTIONS(instr)) break; - if (MIPS_END_OF_FUNCTION(instr)) { - /* skip over branch-delay slot instruction */ - va += 2 * sizeof(int); + if (MIPS_START_OF_FUNCTION(instr)) break; - } va -= sizeof(int); } - /* skip over nulls which might separate .o files */ - while ((instr = kdbpeek((int *)va)) == 0) + /* + * Skip over nulls/trap padding which might separate + * object files or functions. + */ + instr = kdbpeek((int *)va); + while (instr == 0 || MIPS_LLD_PADDING_BETWEEN_FUNCTIONS(instr)) { va += sizeof(int); + instr = kdbpeek((int *)va); + } subr = va; } + /* scan forwards to find stack size and any saved registers */ stksize = 0; more = 3; @@ -374,10 +378,16 @@ done: (uintmax_t)cause, (uintmax_t)badvaddr); goto loop; } else if (ra) { - if (pc == ra && stksize == 0) + /* + * We subtract two instructions from ra to convert it + * from a return address to a calling address, + * accounting for the delay slot. + */ + register_t next_pc = ra - 2 * sizeof(int); + if (pc == next_pc && stksize == 0) db_printf("stacktrace: loop!\n"); else { - pc = ra; + pc = next_pc; sp += stksize; ra = next_ra; goto loop; From owner-svn-src-head@freebsd.org Fri Dec 4 20:47:56 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D9F204ABC0F; Fri, 4 Dec 2020 20:47:56 +0000 (UTC) (envelope-from gbe@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CnlCJ5sMXz3mLx; Fri, 4 Dec 2020 20:47:56 +0000 (UTC) (envelope-from gbe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id BBE9211D79; Fri, 4 Dec 2020 20:47:56 +0000 (UTC) (envelope-from gbe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B4Klue1050719; Fri, 4 Dec 2020 20:47:56 GMT (envelope-from gbe@FreeBSD.org) Received: (from gbe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B4Klu31050718; Fri, 4 Dec 2020 20:47:56 GMT (envelope-from gbe@FreeBSD.org) Message-Id: <202012042047.0B4Klu31050718@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gbe set sender to gbe@FreeBSD.org using -f From: Gordon Bergling Date: Fri, 4 Dec 2020 20:47:56 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368348 - head/sbin/ping X-SVN-Group: head X-SVN-Commit-Author: gbe X-SVN-Commit-Paths: head/sbin/ping X-SVN-Commit-Revision: 368348 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Dec 2020 20:47:56 -0000 Author: gbe (doc committer) Date: Fri Dec 4 20:47:56 2020 New Revision: 368348 URL: https://svnweb.freebsd.org/changeset/base/368348 Log: ping(8): Fix a few mandoc related issues - new sentence, new line Modified: head/sbin/ping/ping.8 Modified: head/sbin/ping/ping.8 ============================================================================== --- head/sbin/ping/ping.8 Fri Dec 4 20:14:25 2020 (r368347) +++ head/sbin/ping/ping.8 Fri Dec 4 20:47:56 2020 (r368348) @@ -131,12 +131,11 @@ datagrams have an IPv6 header and .Tn ICMPv6 header formatted as documented in RFC 2463. .Pp -When invoked with a hostname, the version to which the target is -resolved first is used. In that case, the options and arguments used -must be valid for the specific IP version, otherwise +When invoked with a hostname, the version to which the target is resolved first is used. +In that case, the options and arguments used must be valid for the specific IP version, otherwise .Nm -exits with an error. If the target is resolved to both IPv4 and IPv6, -the specific IP version can be requested by +exits with an error. +If the target is resolved to both IPv4 and IPv6, the specific IP version can be requested by .Fl 4 or .Fl 6 @@ -210,15 +209,14 @@ option. .It Fl I Ar iface For an IPv4 target, .Ar iface -is an IP address indentifying an interface from which the packets will -be sent. This flag applies only if the ping target is a multicast -address. +is an IP address indentifying an interface from which the packets will be sent. +This flag applies only if the ping target is a multicast address. .Pp For an IPv6 target, .Ar iface -is a name of an interface (e.g. `em0') from which the packets will be -sent. This flag applies if the ping target is a multicast address, or -link-local/site-local unicast address. +is a name of an interface (e.g. `em0') from which the packets will be sent. +This flag applies if the ping target is a multicast address, or link-local/site-local +unicast address. .It Fl i Ar wait Wait .Ar wait From owner-svn-src-head@freebsd.org Fri Dec 4 20:54:21 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B53FF4AB9D8; Fri, 4 Dec 2020 20:54:21 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CnlLj4pZrz3mgQ; Fri, 4 Dec 2020 20:54:21 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 97F9E11F67; Fri, 4 Dec 2020 20:54:21 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B4KsL0l056733; Fri, 4 Dec 2020 20:54:21 GMT (envelope-from mhorne@FreeBSD.org) Received: (from mhorne@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B4KsKJO056727; Fri, 4 Dec 2020 20:54:20 GMT (envelope-from mhorne@FreeBSD.org) Message-Id: <202012042054.0B4KsKJO056727@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mhorne set sender to mhorne@FreeBSD.org using -f From: Mitchell Horne Date: Fri, 4 Dec 2020 20:54:20 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368349 - in head/sys: conf crypto/openssl modules/ossl X-SVN-Group: head X-SVN-Commit-Author: mhorne X-SVN-Commit-Paths: in head/sys: conf crypto/openssl modules/ossl X-SVN-Commit-Revision: 368349 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Dec 2020 20:54:21 -0000 Author: mhorne Date: Fri Dec 4 20:54:20 2020 New Revision: 368349 URL: https://svnweb.freebsd.org/changeset/base/368349 Log: ossl: split out x86 bits to x86/ossl_cpuid.c Make room for adding arm64 support to this driver by moving the x86-specific feature parsing to a separate file. Reviewed by: jhb Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D27388 Added: head/sys/crypto/openssl/ossl_x86.c (contents, props changed) Modified: head/sys/conf/files head/sys/conf/files.x86 head/sys/crypto/openssl/ossl.c head/sys/crypto/openssl/ossl.h head/sys/modules/ossl/Makefile Modified: head/sys/conf/files ============================================================================== --- head/sys/conf/files Fri Dec 4 20:47:56 2020 (r368348) +++ head/sys/conf/files Fri Dec 4 20:54:20 2020 (r368349) @@ -734,6 +734,10 @@ crypto/chacha20/chacha.c standard crypto/chacha20/chacha-sw.c optional crypto | ipsec | ipsec_support crypto/des/des_ecb.c optional netsmb crypto/des/des_setkey.c optional netsmb +crypto/openssl/ossl.c optional ossl +crypto/openssl/ossl_sha1.c optional ossl +crypto/openssl/ossl_sha256.c optional ossl +crypto/openssl/ossl_sha512.c optional ossl crypto/rc4/rc4.c optional netgraph_mppc_encryption crypto/rijndael/rijndael-alg-fst.c optional crypto | ekcd | geom_bde | \ ipsec | ipsec_support | !random_loadable | wlan_ccmp Modified: head/sys/conf/files.x86 ============================================================================== --- head/sys/conf/files.x86 Fri Dec 4 20:47:56 2020 (r368348) +++ head/sys/conf/files.x86 Fri Dec 4 20:54:20 2020 (r368349) @@ -53,10 +53,7 @@ intel_sha256.o optional aesni \ compile-with "${CC} -c ${CFLAGS:C/^-O2$/-O3/:N-nostdinc} ${WERROR} ${PROF} -mmmx -msse -msse4 -msha ${.IMPSRC}" \ no-implicit-rule \ clean "intel_sha256.o" -crypto/openssl/ossl.c optional ossl -crypto/openssl/ossl_sha1.c optional ossl -crypto/openssl/ossl_sha256.c optional ossl -crypto/openssl/ossl_sha512.c optional ossl +crypto/openssl/ossl_x86.c optional ossl crypto/via/padlock.c optional padlock crypto/via/padlock_cipher.c optional padlock crypto/via/padlock_hash.c optional padlock Modified: head/sys/crypto/openssl/ossl.c ============================================================================== --- head/sys/crypto/openssl/ossl.c Fri Dec 4 20:47:56 2020 (r368348) +++ head/sys/crypto/openssl/ossl.c Fri Dec 4 20:54:20 2020 (r368349) @@ -1,4 +1,6 @@ -/* +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * * Copyright (c) 2020 Netflix, Inc * * Redistribution and use in source and binary forms, with or without @@ -39,10 +41,8 @@ __FBSDID("$FreeBSD$"); #include #include #include + #include -#include -#include -#include #include #include @@ -66,81 +66,7 @@ struct ossl_session { struct ossl_session_hash hash; }; -/* - * See OPENSSL_ia32cap(3). - * - * [0] = cpu_feature but with a few custom bits - * [1] = cpu_feature2 but with AMD XOP in bit 11 - * [2] = cpu_stdext_feature - * [3] = 0 - */ -unsigned int OPENSSL_ia32cap_P[4]; - static MALLOC_DEFINE(M_OSSL, "ossl", "OpenSSL crypto"); - -static void -ossl_cpuid(void) -{ - uint64_t xcr0; - u_int regs[4]; - u_int max_cores; - - /* Derived from OpenSSL_ia32_cpuid. */ - - OPENSSL_ia32cap_P[0] = cpu_feature & ~(CPUID_B20 | CPUID_IA64); - if (cpu_vendor_id == CPU_VENDOR_INTEL) { - OPENSSL_ia32cap_P[0] |= CPUID_IA64; - if ((cpu_id & 0xf00) != 0xf00) - OPENSSL_ia32cap_P[0] |= CPUID_B20; - } - - /* Only leave CPUID_HTT on if HTT is present. */ - if (cpu_vendor_id == CPU_VENDOR_AMD && cpu_exthigh >= 0x80000008) { - max_cores = (cpu_procinfo2 & AMDID_CMP_CORES) + 1; - if (cpu_feature & CPUID_HTT) { - if ((cpu_procinfo & CPUID_HTT_CORES) >> 16 <= max_cores) - OPENSSL_ia32cap_P[0] &= ~CPUID_HTT; - } - } else { - if (cpu_high >= 4) { - cpuid_count(4, 0, regs); - max_cores = (regs[0] >> 26) & 0xfff; - } else - max_cores = -1; - } - if (max_cores == 0) - OPENSSL_ia32cap_P[0] &= ~CPUID_HTT; - else if ((cpu_procinfo & CPUID_HTT_CORES) >> 16 == 0) - OPENSSL_ia32cap_P[0] &= ~CPUID_HTT; - - OPENSSL_ia32cap_P[1] = cpu_feature2 & ~AMDID2_XOP; - if (cpu_vendor_id == CPU_VENDOR_AMD) - OPENSSL_ia32cap_P[1] |= amd_feature2 & AMDID2_XOP; - - OPENSSL_ia32cap_P[2] = cpu_stdext_feature; - if ((OPENSSL_ia32cap_P[1] & CPUID2_XSAVE) == 0) - OPENSSL_ia32cap_P[2] &= ~(CPUID_STDEXT_AVX512F | - CPUID_STDEXT_AVX512DQ); - - /* Disable AVX512F on Skylake-X. */ - if ((cpu_id & 0x0fff0ff0) == 0x00050650) - OPENSSL_ia32cap_P[2] &= ~(CPUID_STDEXT_AVX512F); - - if (cpu_feature2 & CPUID2_OSXSAVE) - xcr0 = rxcr(0); - else - xcr0 = 0; - - if ((xcr0 & (XFEATURE_AVX512 | XFEATURE_AVX)) != - (XFEATURE_AVX512 | XFEATURE_AVX)) - OPENSSL_ia32cap_P[2] &= ~(CPUID_STDEXT_AVX512VL | - CPUID_STDEXT_AVX512BW | CPUID_STDEXT_AVX512IFMA | - CPUID_STDEXT_AVX512F); - if ((xcr0 & XFEATURE_AVX) != XFEATURE_AVX) { - OPENSSL_ia32cap_P[1] &= ~(CPUID2_AVX | AMDID2_XOP | CPUID2_FMA); - OPENSSL_ia32cap_P[2] &= ~CPUID_STDEXT_AVX2; - } -} static void ossl_identify(driver_t *driver, device_t parent) Modified: head/sys/crypto/openssl/ossl.h ============================================================================== --- head/sys/crypto/openssl/ossl.h Fri Dec 4 20:47:56 2020 (r368348) +++ head/sys/crypto/openssl/ossl.h Fri Dec 4 20:54:20 2020 (r368349) @@ -34,8 +34,7 @@ /* Compatibility shims. */ #define OPENSSL_cleanse explicit_bzero -/* Used by assembly routines to select CPU-specific variants. */ -extern unsigned int OPENSSL_ia32cap_P[4]; +void ossl_cpuid(void); /* Needs to be big enough to hold any hash context. */ struct ossl_hash_context { Added: head/sys/crypto/openssl/ossl_x86.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/crypto/openssl/ossl_x86.c Fri Dec 4 20:54:20 2020 (r368349) @@ -0,0 +1,115 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2020 Netflix, Inc + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer, + * without modification. + * 2. Redistributions in binary form must reproduce at minimum a disclaimer + * similar to the "NO WARRANTY" disclaimer below ("Disclaimer") and any + * redistribution must be conditioned upon including a substantially + * similar Disclaimer requirement for further binary redistribution. + * + * NO WARRANTY + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS + * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT + * LIMITED TO, THE IMPLIED WARRANTIES OF NONINFRINGEMENT, MERCHANTIBILITY + * AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL + * THE COPYRIGHT HOLDERS OR CONTRIBUTORS BE LIABLE FOR SPECIAL, EXEMPLARY, + * OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER + * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF + * THE POSSIBILITY OF SUCH DAMAGES. + * + * $FreeBSD$ + */ + +#include +#include + +#include +#include +#include +#include + +#include + +/* + * See OPENSSL_ia32cap(3). + * + * [0] = cpu_feature but with a few custom bits + * [1] = cpu_feature2 but with AMD XOP in bit 11 + * [2] = cpu_stdext_feature + * [3] = 0 + */ +unsigned int OPENSSL_ia32cap_P[4]; + +void +ossl_cpuid(void) +{ + uint64_t xcr0; + u_int regs[4]; + u_int max_cores; + + /* Derived from OpenSSL_ia32_cpuid. */ + + OPENSSL_ia32cap_P[0] = cpu_feature & ~(CPUID_B20 | CPUID_IA64); + if (cpu_vendor_id == CPU_VENDOR_INTEL) { + OPENSSL_ia32cap_P[0] |= CPUID_IA64; + if ((cpu_id & 0xf00) != 0xf00) + OPENSSL_ia32cap_P[0] |= CPUID_B20; + } + + /* Only leave CPUID_HTT on if HTT is present. */ + if (cpu_vendor_id == CPU_VENDOR_AMD && cpu_exthigh >= 0x80000008) { + max_cores = (cpu_procinfo2 & AMDID_CMP_CORES) + 1; + if (cpu_feature & CPUID_HTT) { + if ((cpu_procinfo & CPUID_HTT_CORES) >> 16 <= max_cores) + OPENSSL_ia32cap_P[0] &= ~CPUID_HTT; + } + } else { + if (cpu_high >= 4) { + cpuid_count(4, 0, regs); + max_cores = (regs[0] >> 26) & 0xfff; + } else + max_cores = -1; + } + if (max_cores == 0) + OPENSSL_ia32cap_P[0] &= ~CPUID_HTT; + else if ((cpu_procinfo & CPUID_HTT_CORES) >> 16 == 0) + OPENSSL_ia32cap_P[0] &= ~CPUID_HTT; + + OPENSSL_ia32cap_P[1] = cpu_feature2 & ~AMDID2_XOP; + if (cpu_vendor_id == CPU_VENDOR_AMD) + OPENSSL_ia32cap_P[1] |= amd_feature2 & AMDID2_XOP; + + OPENSSL_ia32cap_P[2] = cpu_stdext_feature; + if ((OPENSSL_ia32cap_P[1] & CPUID2_XSAVE) == 0) + OPENSSL_ia32cap_P[2] &= ~(CPUID_STDEXT_AVX512F | + CPUID_STDEXT_AVX512DQ); + + /* Disable AVX512F on Skylake-X. */ + if ((cpu_id & 0x0fff0ff0) == 0x00050650) + OPENSSL_ia32cap_P[2] &= ~(CPUID_STDEXT_AVX512F); + + if (cpu_feature2 & CPUID2_OSXSAVE) + xcr0 = rxcr(0); + else + xcr0 = 0; + + if ((xcr0 & (XFEATURE_AVX512 | XFEATURE_AVX)) != + (XFEATURE_AVX512 | XFEATURE_AVX)) + OPENSSL_ia32cap_P[2] &= ~(CPUID_STDEXT_AVX512VL | + CPUID_STDEXT_AVX512BW | CPUID_STDEXT_AVX512IFMA | + CPUID_STDEXT_AVX512F); + if ((xcr0 & XFEATURE_AVX) != XFEATURE_AVX) { + OPENSSL_ia32cap_P[1] &= ~(CPUID2_AVX | AMDID2_XOP | CPUID2_FMA); + OPENSSL_ia32cap_P[2] &= ~CPUID_STDEXT_AVX2; + } +} Modified: head/sys/modules/ossl/Makefile ============================================================================== --- head/sys/modules/ossl/Makefile Fri Dec 4 20:47:56 2020 (r368348) +++ head/sys/modules/ossl/Makefile Fri Dec 4 20:54:20 2020 (r368349) @@ -16,11 +16,13 @@ SRCS= bus_if.h \ SRCS.amd64= \ sha1-x86_64.S \ sha256-x86_64.S \ - sha512-x86_64.S + sha512-x86_64.S \ + ossl_x86.c SRCS.i386= \ sha1-586.S \ sha256-586.S \ - sha512-586.S + sha512-586.S \ + ossl_x86.c .include From owner-svn-src-head@freebsd.org Fri Dec 4 21:12:19 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 6C77A4AC50B; Fri, 4 Dec 2020 21:12:19 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CnllR2f5Wz3np7; Fri, 4 Dec 2020 21:12:19 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4DAC21225E; Fri, 4 Dec 2020 21:12:19 +0000 (UTC) (envelope-from mhorne@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B4LCJvg069311; Fri, 4 Dec 2020 21:12:19 GMT (envelope-from mhorne@FreeBSD.org) Received: (from mhorne@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B4LCInO069246; Fri, 4 Dec 2020 21:12:18 GMT (envelope-from mhorne@FreeBSD.org) Message-Id: <202012042112.0B4LCInO069246@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mhorne set sender to mhorne@FreeBSD.org using -f From: Mitchell Horne Date: Fri, 4 Dec 2020 21:12:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368350 - in head: share/man/man4 sys/conf sys/crypto/openssl sys/crypto/openssl/aarch64 sys/modules sys/modules/ossl tests/sys/opencrypto X-SVN-Group: head X-SVN-Commit-Author: mhorne X-SVN-Commit-Paths: in head: share/man/man4 sys/conf sys/crypto/openssl sys/crypto/openssl/aarch64 sys/modules sys/modules/ossl tests/sys/opencrypto X-SVN-Commit-Revision: 368350 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Dec 2020 21:12:19 -0000 Author: mhorne Date: Fri Dec 4 21:12:17 2020 New Revision: 368350 URL: https://svnweb.freebsd.org/changeset/base/368350 Log: ossl: port to arm64 Enable in-kernel acceleration of SHA1 and SHA2 operations on arm64 by adding support for the ossl(4) crypto driver. This uses OpenSSL's assembly routines under the hood, which will detect and use SHA intrinsics if they are supported by the CPU. Reviewed by: jhb Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D27390 Added: head/sys/crypto/openssl/aarch64/arm_arch.h (contents, props changed) head/sys/crypto/openssl/ossl_aarch64.c (contents, props changed) Modified: head/share/man/man4/ossl.4 head/sys/conf/files.arm64 head/sys/modules/Makefile head/sys/modules/ossl/Makefile head/tests/sys/opencrypto/runtests.sh Modified: head/share/man/man4/ossl.4 ============================================================================== --- head/share/man/man4/ossl.4 Fri Dec 4 20:54:20 2020 (r368349) +++ head/share/man/man4/ossl.4 Fri Dec 4 21:12:17 2020 (r368350) @@ -26,12 +26,12 @@ .\" .\" $FreeBSD$ .\" -.Dd October 19, 2020 +.Dd December 4, 2020 .Dt OSSL 4 .Os .Sh NAME .Nm ossl -.Nd "driver using OpenSSL assembly routines on x86 CPUs" +.Nd "driver using OpenSSL assembly routines" .Sh SYNOPSIS To compile this driver into the kernel, place the following lines in your @@ -60,6 +60,8 @@ driver includes architecture-specific implementations architectures: .Pp .Bl -bullet -compact +.It +arm64 .It amd64 .It Modified: head/sys/conf/files.arm64 ============================================================================== --- head/sys/conf/files.arm64 Fri Dec 4 20:54:20 2020 (r368349) +++ head/sys/conf/files.arm64 Fri Dec 4 21:12:17 2020 (r368350) @@ -246,6 +246,13 @@ armv8_crypto_wrap.o optional armv8crypto \ no-implicit-rule \ clean "armv8_crypto_wrap.o" crypto/des/des_enc.c optional netsmb +crypto/openssl/ossl_aarch64.c optional ossl +crypto/openssl/aarch64/sha1-armv8.S optional ossl \ + compile-with "${CC} -c ${CFLAGS:N-mgeneral-regs-only} ${WERROR} ${PROF} ${.IMPSRC}" +crypto/openssl/aarch64/sha256-armv8.S optional ossl \ + compile-with "${CC} -c ${CFLAGS:N-mgeneral-regs-only} ${WERROR} ${PROF} ${.IMPSRC}" +crypto/openssl/aarch64/sha512-armv8.S optional ossl \ + compile-with "${CC} -c ${CFLAGS:N-mgeneral-regs-only} ${WERROR} ${PROF} ${.IMPSRC}" dev/acpica/acpi_bus_if.m optional acpi dev/acpica/acpi_if.m optional acpi dev/acpica/acpi_pci_link.c optional acpi pci Added: head/sys/crypto/openssl/aarch64/arm_arch.h ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/crypto/openssl/aarch64/arm_arch.h Fri Dec 4 21:12:17 2020 (r368350) @@ -0,0 +1,84 @@ +/* + * Copyright 2011-2018 The OpenSSL Project Authors. All Rights Reserved. + * + * Licensed under the OpenSSL license (the "License"). You may not use + * this file except in compliance with the License. You can obtain a copy + * in the file LICENSE in the source distribution or at + * https://www.openssl.org/source/license.html + */ + +#ifndef OSSL_CRYPTO_ARM_ARCH_H +# define OSSL_CRYPTO_ARM_ARCH_H + +# if !defined(__ARM_ARCH__) +# if defined(__CC_ARM) +# define __ARM_ARCH__ __TARGET_ARCH_ARM +# if defined(__BIG_ENDIAN) +# define __ARMEB__ +# else +# define __ARMEL__ +# endif +# elif defined(__GNUC__) +# if defined(__aarch64__) +# define __ARM_ARCH__ 8 +# if __BYTE_ORDER__==__ORDER_BIG_ENDIAN__ +# define __ARMEB__ +# else +# define __ARMEL__ +# endif + /* + * Why doesn't gcc define __ARM_ARCH__? Instead it defines + * bunch of below macros. See all_architectures[] table in + * gcc/config/arm/arm.c. On a side note it defines + * __ARMEL__/__ARMEB__ for little-/big-endian. + */ +# elif defined(__ARM_ARCH) +# define __ARM_ARCH__ __ARM_ARCH +# elif defined(__ARM_ARCH_8A__) +# define __ARM_ARCH__ 8 +# elif defined(__ARM_ARCH_7__) || defined(__ARM_ARCH_7A__) || \ + defined(__ARM_ARCH_7R__)|| defined(__ARM_ARCH_7M__) || \ + defined(__ARM_ARCH_7EM__) +# define __ARM_ARCH__ 7 +# elif defined(__ARM_ARCH_6__) || defined(__ARM_ARCH_6J__) || \ + defined(__ARM_ARCH_6K__)|| defined(__ARM_ARCH_6M__) || \ + defined(__ARM_ARCH_6Z__)|| defined(__ARM_ARCH_6ZK__) || \ + defined(__ARM_ARCH_6T2__) +# define __ARM_ARCH__ 6 +# elif defined(__ARM_ARCH_5__) || defined(__ARM_ARCH_5T__) || \ + defined(__ARM_ARCH_5E__)|| defined(__ARM_ARCH_5TE__) || \ + defined(__ARM_ARCH_5TEJ__) +# define __ARM_ARCH__ 5 +# elif defined(__ARM_ARCH_4__) || defined(__ARM_ARCH_4T__) +# define __ARM_ARCH__ 4 +# else +# error "unsupported ARM architecture" +# endif +# endif +# endif + +# if !defined(__ARM_MAX_ARCH__) +# define __ARM_MAX_ARCH__ __ARM_ARCH__ +# endif + +# if __ARM_MAX_ARCH__<__ARM_ARCH__ +# error "__ARM_MAX_ARCH__ can't be less than __ARM_ARCH__" +# elif __ARM_MAX_ARCH__!=__ARM_ARCH__ +# if __ARM_ARCH__<7 && __ARM_MAX_ARCH__>=7 && defined(__ARMEB__) +# error "can't build universal big-endian binary" +# endif +# endif + +# ifndef __ASSEMBLER__ +extern unsigned int OPENSSL_armcap_P; +# endif + +# define ARMV7_NEON (1<<0) +# define ARMV7_TICK (1<<1) +# define ARMV8_AES (1<<2) +# define ARMV8_SHA1 (1<<3) +# define ARMV8_SHA256 (1<<4) +# define ARMV8_PMULL (1<<5) +# define ARMV8_SHA512 (1<<6) + +#endif Added: head/sys/crypto/openssl/ossl_aarch64.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/crypto/openssl/ossl_aarch64.c Fri Dec 4 21:12:17 2020 (r368350) @@ -0,0 +1,62 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 2020 The FreeBSD Foundation + * + * This software was developed by Mitchell Horne + * under sponsorship from the FreeBSD Foundation. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + * $FreeBSD$ + */ + +#include + +#include +#include + +#include +#include + +/* + * Feature bits defined in arm_arch.h + */ +unsigned int OPENSSL_armcap_P; + +void +ossl_cpuid(void) +{ + /* SHA features */ + if ((elf_hwcap & HWCAP_SHA1) != 0) + OPENSSL_armcap_P |= ARMV8_SHA1; + if ((elf_hwcap & HWCAP_SHA2) != 0) + OPENSSL_armcap_P |= ARMV8_SHA256; + if ((elf_hwcap & HWCAP_SHA512) != 0) + OPENSSL_armcap_P |= ARMV8_SHA512; + + /* AES features */ + if ((elf_hwcap & HWCAP_AES) != 0) + OPENSSL_armcap_P |= ARMV8_AES; + if ((elf_hwcap & HWCAP_PMULL) != 0) + OPENSSL_armcap_P |= ARMV8_PMULL; +} Modified: head/sys/modules/Makefile ============================================================================== --- head/sys/modules/Makefile Fri Dec 4 20:54:20 2020 (r368349) +++ head/sys/modules/Makefile Fri Dec 4 21:12:17 2020 (r368350) @@ -518,6 +518,7 @@ _mthca= mthca _mlx4ib= mlx4ib _mlx5ib= mlx5ib .endif +_ossl= ossl _vmware= vmware .endif @@ -634,7 +635,6 @@ _nctgpio= nctgpio _ndis= ndis _ntb= ntb _ocs_fc= ocs_fc -_ossl= ossl _pccard= pccard _qat= qat _qatfw= qatfw Modified: head/sys/modules/ossl/Makefile ============================================================================== --- head/sys/modules/ossl/Makefile Fri Dec 4 20:54:20 2020 (r368349) +++ head/sys/modules/ossl/Makefile Fri Dec 4 21:12:17 2020 (r368350) @@ -13,6 +13,12 @@ SRCS= bus_if.h \ ossl_sha512.c \ ${SRCS.${MACHINE_CPUARCH}} +SRCS.aarch64= \ + sha1-armv8.S \ + sha256-armv8.S \ + sha512-armv8.S \ + ossl_aarch64.c + SRCS.amd64= \ sha1-x86_64.S \ sha256-x86_64.S \ @@ -24,5 +30,11 @@ SRCS.i386= \ sha256-586.S \ sha512-586.S \ ossl_x86.c + +# For arm64, we are forced to rewrite the compiler invocation for the assembly +# files, to remove -mgeneral-regs-only. +${SRCS.aarch64:M*.S:S/S/o/}: ${.TARGET:R}.S + ${CC} -c ${CFLAGS:N-mgeneral-regs-only} ${WERROR} ${PROF} ${.IMPSRC} + ${CTFCONVERT_CMD} .include Modified: head/tests/sys/opencrypto/runtests.sh ============================================================================== --- head/tests/sys/opencrypto/runtests.sh Fri Dec 4 20:54:20 2020 (r368349) +++ head/tests/sys/opencrypto/runtests.sh Fri Dec 4 21:12:17 2020 (r368350) @@ -65,7 +65,7 @@ cpu_module= case ${cpu_type} in aarch64) - cpu_module=nexus/armv8crypto + cpu_module="nexus/armv8crypto nexus/ossl" ;; amd64|i386) cpu_module="nexus/aesni nexus/ossl" From owner-svn-src-head@freebsd.org Fri Dec 4 21:34:04 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id EC2ED4ACBF7; Fri, 4 Dec 2020 21:34:04 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CnmDX6MSMz3q6X; Fri, 4 Dec 2020 21:34:04 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CD12B1286D; Fri, 4 Dec 2020 21:34:04 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B4LY43Z081697; Fri, 4 Dec 2020 21:34:04 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B4LY48a081696; Fri, 4 Dec 2020 21:34:04 GMT (envelope-from imp@FreeBSD.org) Message-Id: <202012042134.0B4LY48a081696@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 4 Dec 2020 21:34:04 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368351 - head/sys/x86/x86 X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/x86/x86 X-SVN-Commit-Revision: 368351 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Dec 2020 21:34:05 -0000 Author: imp Date: Fri Dec 4 21:34:04 2020 New Revision: 368351 URL: https://svnweb.freebsd.org/changeset/base/368351 Log: busdma: Annotate bus_dmamap_sync() with fence Add an explicit thread fence release before returning from bus_dmamap_sync. This should be a no-op in practice, but makes explicit that all ordinary stores will be completed before subsequent reads/writes to ordinary device memory. On x86, normal memory ordering is strong enough to generally guarantee this. The fence keeps the optimizer (likely LTO) from reordering other calls around this. The other architectures already have calls, as appropriate, that are equivalent. Note: On x86, there is one exception to this rule. If you've mapped memory as write combining, then you will need to add a sfence or similar. Normally, though, busdma doesn't operate on such memory, and drivers that do already cope appropriately. Reviewed by: kib@, gallatin@, chuck@, mav@ Differential Revision: https://reviews.freebsd.org/D27448 Modified: head/sys/x86/x86/busdma_bounce.c Modified: head/sys/x86/x86/busdma_bounce.c ============================================================================== --- head/sys/x86/x86/busdma_bounce.c Fri Dec 4 21:12:17 2020 (r368350) +++ head/sys/x86/x86/busdma_bounce.c Fri Dec 4 21:34:04 2020 (r368351) @@ -969,7 +969,7 @@ bounce_bus_dmamap_sync(bus_dma_tag_t dmat, bus_dmamap_ bus_size_t datacount1, datacount2; if (map == NULL || (bpage = STAILQ_FIRST(&map->bpages)) == NULL) - return; + goto out; /* * Handle data bouncing. We might also want to add support for @@ -1059,6 +1059,8 @@ next_r: } dmat->bounce_zone->total_bounced++; } +out: + atomic_thread_fence_rel(); } static void From owner-svn-src-head@freebsd.org Fri Dec 4 21:34:49 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3F4324ACA6E; Fri, 4 Dec 2020 21:34:49 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CnmFP1M9gz3qM1; Fri, 4 Dec 2020 21:34:49 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 2161412C0B; Fri, 4 Dec 2020 21:34:49 +0000 (UTC) (envelope-from imp@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B4LYnef081778; Fri, 4 Dec 2020 21:34:49 GMT (envelope-from imp@FreeBSD.org) Received: (from imp@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B4LYnH7081777; Fri, 4 Dec 2020 21:34:49 GMT (envelope-from imp@FreeBSD.org) Message-Id: <202012042134.0B4LYnH7081777@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: imp set sender to imp@FreeBSD.org using -f From: Warner Losh Date: Fri, 4 Dec 2020 21:34:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368352 - head/sys/dev/nvme X-SVN-Group: head X-SVN-Commit-Author: imp X-SVN-Commit-Paths: head/sys/dev/nvme X-SVN-Commit-Revision: 368352 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Dec 2020 21:34:49 -0000 Author: imp Date: Fri Dec 4 21:34:48 2020 New Revision: 368352 URL: https://svnweb.freebsd.org/changeset/base/368352 Log: nvme: Remove a wmb() that's not necessary. bus_dmamap_sync() ensures that memory that's prepared for PREWRITE can be DMA'd immediately after it returns. The details differ, but this mirrors atomic thread release semantics, at least for the buffers synced. For non-x86 platforms, bus_dmamap_sync() has the right syncing and fences. So in the past, wmb() had been omitted for them. For x86 platforms, the memory ordering is already strong enough to ensure DMA to the device sees the current contents. As such, we don't need the wmb() here. It translates to an sfence which is only needed for writes to regions that have the write combining attribute set or when some exotic opcodes are used. The nvme driver does neither of these. Since bus_dmamap_sync() includes atomic_thread_fence_rel, we can be assured any optimizer won't reorder the bus_dmamap_sync and the bus_space_write operations. The wmb() was a vestiage of the pre-busdma version initially committed to the tree. Reviewed by: kib@, gallatin@, chuck@, mav@ Differential Revision: https://reviews.freebsd.org/D27448 Modified: head/sys/dev/nvme/nvme_qpair.c Modified: head/sys/dev/nvme/nvme_qpair.c ============================================================================== --- head/sys/dev/nvme/nvme_qpair.c Fri Dec 4 21:34:04 2020 (r368351) +++ head/sys/dev/nvme/nvme_qpair.c Fri Dec 4 21:34:48 2020 (r368352) @@ -982,14 +982,6 @@ nvme_qpair_submit_tracker(struct nvme_qpair *qpair, st bus_dmamap_sync(qpair->dma_tag, qpair->queuemem_map, BUS_DMASYNC_PREREAD | BUS_DMASYNC_PREWRITE); -#if !defined( __powerpc__) && !defined( __aarch64__) && !defined( __arm__) - /* - * powerpc's bus_dmamap_sync() already includes a heavyweight sync, but - * no other archs do. - */ - wmb(); -#endif - bus_space_write_4(qpair->ctrlr->bus_tag, qpair->ctrlr->bus_handle, qpair->sq_tdbl_off, qpair->sq_tail); qpair->num_cmds++; From owner-svn-src-head@freebsd.org Fri Dec 4 21:51:48 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7CAB54AD375; Fri, 4 Dec 2020 21:51:48 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Cnmd01r8rz3rVb; Fri, 4 Dec 2020 21:51:48 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 321DF12C3F; Fri, 4 Dec 2020 21:51:48 +0000 (UTC) (envelope-from hselasky@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B4Lpmg4089410; Fri, 4 Dec 2020 21:51:48 GMT (envelope-from hselasky@FreeBSD.org) Received: (from hselasky@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B4Lpm6G089409; Fri, 4 Dec 2020 21:51:48 GMT (envelope-from hselasky@FreeBSD.org) Message-Id: <202012042151.0B4Lpm6G089409@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: hselasky set sender to hselasky@FreeBSD.org using -f From: Hans Petter Selasky Date: Fri, 4 Dec 2020 21:51:48 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368353 - head/sys/netinet6 X-SVN-Group: head X-SVN-Commit-Author: hselasky X-SVN-Commit-Paths: head/sys/netinet6 X-SVN-Commit-Revision: 368353 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 04 Dec 2020 21:51:48 -0000 Author: hselasky Date: Fri Dec 4 21:51:47 2020 New Revision: 368353 URL: https://svnweb.freebsd.org/changeset/base/368353 Log: Expose nonstandard IPv6 kernel definitions to standalone builds. No functional change. Reviewed by: bz@ MFC after: 1 week Sponsored by: Mellanox Technologies // NVIDIA Networking Modified: head/sys/netinet6/in6.h Modified: head/sys/netinet6/in6.h ============================================================================== --- head/sys/netinet6/in6.h Fri Dec 4 21:34:48 2020 (r368352) +++ head/sys/netinet6/in6.h Fri Dec 4 21:51:47 2020 (r368353) @@ -103,7 +103,7 @@ struct in6_addr { }; #define s6_addr __u6_addr.__u6_addr8 -#ifdef _KERNEL /* XXX nonstandard */ +#if defined(_KERNEL) || defined(_STANDALONE) /* XXX nonstandard */ #define s6_addr8 __u6_addr.__u6_addr8 #define s6_addr16 __u6_addr.__u6_addr16 #define s6_addr32 __u6_addr.__u6_addr32 From owner-svn-src-head@freebsd.org Sat Dec 5 00:33:36 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A75F74B0694; Sat, 5 Dec 2020 00:33:36 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CnrCh4JJcz4V2l; Sat, 5 Dec 2020 00:33:36 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8661714C3B; Sat, 5 Dec 2020 00:33:36 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B50XaAR093851; Sat, 5 Dec 2020 00:33:36 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B50XTEW093812; Sat, 5 Dec 2020 00:33:29 GMT (envelope-from cem@FreeBSD.org) Message-Id: <202012050033.0B50XTEW093812@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Sat, 5 Dec 2020 00:33:29 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368354 - in head: lib/libc/powerpc lib/libc/powerpc64 lib/libc/powerpc64/sys lib/libthr/arch/i386/i386 lib/msun/i387 libexec/rtld-elf/aarch64 libexec/rtld-elf/powerpc libexec/rtld-elf/... X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: in head: lib/libc/powerpc lib/libc/powerpc64 lib/libc/powerpc64/sys lib/libthr/arch/i386/i386 lib/msun/i387 libexec/rtld-elf/aarch64 libexec/rtld-elf/powerpc libexec/rtld-elf/powerpc64 stand/libsa/pow... X-SVN-Commit-Revision: 368354 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Dec 2020 00:33:36 -0000 Author: cem Date: Sat Dec 5 00:33:28 2020 New Revision: 368354 URL: https://svnweb.freebsd.org/changeset/base/368354 Log: Add CFI start/end proc directives to arm64, i386, and ppc Follow-up to r353959 and r368070: do the same for other architectures. arm32 already seems to use its own .fnstart/.fnend directives, which appear to be ARM-specific variants of the same thing. Likewise, MIPS uses .frame directives. Reviewed by: arichardson Differential Revision: https://reviews.freebsd.org/D27387 Modified: head/lib/libc/powerpc/SYS.h head/lib/libc/powerpc64/SYS.h head/lib/libc/powerpc64/sys/cerror.S head/lib/libthr/arch/i386/i386/_umtx_op_err.S head/lib/msun/i387/e_logf.S head/lib/msun/i387/e_remainderl.S head/lib/msun/i387/e_sqrtl.S head/lib/msun/i387/s_llrintl.S head/lib/msun/i387/s_logbl.S head/lib/msun/i387/s_lrintl.S head/lib/msun/i387/s_remquol.S head/lib/msun/i387/s_rintl.S head/libexec/rtld-elf/aarch64/rtld_start.S head/libexec/rtld-elf/powerpc/rtld_start.S head/libexec/rtld-elf/powerpc64/rtld_start.S head/stand/libsa/powerpc/_setjmp.S head/stand/powerpc/kboot/host_syscall.S head/stand/powerpc/uboot/start.S head/sys/arm64/include/asm.h head/sys/arm64/linux/linux_locore.asm head/sys/arm64/linux/linux_support.s head/sys/crypto/des/arch/i386/des_enc.S head/sys/i386/bios/smapi_bios.S head/sys/i386/include/asm.h head/sys/powerpc/aim/locore.S head/sys/powerpc/aim/locore64.S head/sys/powerpc/aim/trap_subr64.S head/sys/powerpc/booke/locore.S head/sys/powerpc/booke/trap_subr.S head/sys/powerpc/include/asm.h head/sys/powerpc/mambo/mambocall.S head/sys/powerpc/ofw/ofwcall32.S head/sys/powerpc/ofw/ofwcall64.S head/sys/powerpc/powernv/opalcall.S head/sys/powerpc/powerpc/cpu_subr64.S head/sys/powerpc/powerpc/setjmp.S head/sys/powerpc/powerpc/support.S head/sys/powerpc/powerpc/swtch32.S head/sys/powerpc/powerpc/swtch64.S head/sys/powerpc/ps3/ps3-hvcall.S head/sys/powerpc/pseries/phyp-hvcall.S Modified: head/lib/libc/powerpc/SYS.h ============================================================================== --- head/lib/libc/powerpc/SYS.h Fri Dec 4 21:51:47 2020 (r368353) +++ head/lib/libc/powerpc/SYS.h Sat Dec 5 00:33:28 2020 (r368354) @@ -58,7 +58,8 @@ ENTRY(__sys_##name); \ WEAK_REFERENCE(__sys_##name, _##name); \ _SYSCALL(name); \ bnslr; \ - b CNAME(HIDENAME(cerror)) + b CNAME(HIDENAME(cerror)); \ +END(__sys_##name) #define RSYSCALL(name) \ .text; \ @@ -68,4 +69,5 @@ ENTRY(__sys_##name); \ WEAK_REFERENCE(__sys_##name, _##name); \ _SYSCALL(name); \ bnslr; \ - b CNAME(HIDENAME(cerror)) + b CNAME(HIDENAME(cerror)); \ +END(__sys_##name) Modified: head/lib/libc/powerpc64/SYS.h ============================================================================== --- head/lib/libc/powerpc64/SYS.h Fri Dec 4 21:51:47 2020 (r368353) +++ head/lib/libc/powerpc64/SYS.h Sat Dec 5 00:33:28 2020 (r368354) @@ -74,7 +74,8 @@ ENTRY(__sys_##name); \ addi %r1,%r1,48; \ ld %r0,16(%r1); \ mtlr %r0; \ - blr; + blr; \ +END(__sys_##name) #define RSYSCALL(name) \ .text; \ @@ -93,4 +94,5 @@ ENTRY(__sys_##name); \ addi %r1,%r1,48; \ ld %r0,16(%r1); \ mtlr %r0; \ - blr; + blr; \ +END(__sys_##name) Modified: head/lib/libc/powerpc64/sys/cerror.S ============================================================================== --- head/lib/libc/powerpc64/sys/cerror.S Fri Dec 4 21:51:47 2020 (r368353) +++ head/lib/libc/powerpc64/sys/cerror.S Sat Dec 5 00:33:28 2020 (r368354) @@ -56,5 +56,6 @@ ENTRY_NOPROF(HIDENAME(cerror)) li %r3,-1 li %r4,-1 blr +END(HIDENAME(cerror)) .section .note.GNU-stack,"",%progbits Modified: head/lib/libthr/arch/i386/i386/_umtx_op_err.S ============================================================================== --- head/lib/libthr/arch/i386/i386/_umtx_op_err.S Fri Dec 4 21:51:47 2020 (r368353) +++ head/lib/libthr/arch/i386/i386/_umtx_op_err.S Sat Dec 5 00:33:28 2020 (r368354) @@ -31,7 +31,10 @@ #define SYSCALL_ERR(x) \ ENTRY(__CONCAT(x, _err)); \ - mov __CONCAT($SYS_,x),%eax; int $0x80; ret + mov __CONCAT($SYS_,x),%eax; \ + int $0x80; \ + ret; \ + END(__CONCAT(x, _err)) SYSCALL_ERR(_umtx_op) Modified: head/lib/msun/i387/e_logf.S ============================================================================== --- head/lib/msun/i387/e_logf.S Fri Dec 4 21:51:47 2020 (r368353) +++ head/lib/msun/i387/e_logf.S Sat Dec 5 00:33:28 2020 (r368354) @@ -13,5 +13,6 @@ ENTRY(logf) flds 4(%esp) fyl2x ret +END(logf) .section .note.GNU-stack,"",%progbits Modified: head/lib/msun/i387/e_remainderl.S ============================================================================== --- head/lib/msun/i387/e_remainderl.S Fri Dec 4 21:51:47 2020 (r368353) +++ head/lib/msun/i387/e_remainderl.S Sat Dec 5 00:33:28 2020 (r368354) @@ -46,5 +46,6 @@ ENTRY(remainderl) jp 1b fstp %st(1) ret +END(remainderl) .section .note.GNU-stack,"",%progbits Modified: head/lib/msun/i387/e_sqrtl.S ============================================================================== --- head/lib/msun/i387/e_sqrtl.S Fri Dec 4 21:51:47 2020 (r368353) +++ head/lib/msun/i387/e_sqrtl.S Sat Dec 5 00:33:28 2020 (r368354) @@ -40,5 +40,6 @@ ENTRY(sqrtl) fldt 4(%esp) fsqrt ret +END(sqrtl) .section .note.GNU-stack,"",%progbits Modified: head/lib/msun/i387/s_llrintl.S ============================================================================== --- head/lib/msun/i387/s_llrintl.S Fri Dec 4 21:51:47 2020 (r368353) +++ head/lib/msun/i387/s_llrintl.S Sat Dec 5 00:33:28 2020 (r368354) @@ -34,5 +34,6 @@ ENTRY(llrintl) popl %eax popl %edx ret +END(llrintl) .section .note.GNU-stack,"",%progbits Modified: head/lib/msun/i387/s_logbl.S ============================================================================== --- head/lib/msun/i387/s_logbl.S Fri Dec 4 21:51:47 2020 (r368353) +++ head/lib/msun/i387/s_logbl.S Sat Dec 5 00:33:28 2020 (r368354) @@ -41,5 +41,6 @@ ENTRY(logbl) fxtract fstp %st ret +END(logbl) .section .note.GNU-stack,"",%progbits Modified: head/lib/msun/i387/s_lrintl.S ============================================================================== --- head/lib/msun/i387/s_lrintl.S Fri Dec 4 21:51:47 2020 (r368353) +++ head/lib/msun/i387/s_lrintl.S Sat Dec 5 00:33:28 2020 (r368354) @@ -33,5 +33,6 @@ ENTRY(lrintl) fistpl (%esp) popl %eax ret +END(lrintl) .section .note.GNU-stack,"",%progbits Modified: head/lib/msun/i387/s_remquol.S ============================================================================== --- head/lib/msun/i387/s_remquol.S Fri Dec 4 21:51:47 2020 (r368353) +++ head/lib/msun/i387/s_remquol.S Sat Dec 5 00:33:28 2020 (r368354) @@ -61,5 +61,6 @@ ENTRY(remquol) movl 28(%esp),%ecx movl %eax,(%ecx) ret +END(remquol) .section .note.GNU-stack,"",%progbits Modified: head/lib/msun/i387/s_rintl.S ============================================================================== --- head/lib/msun/i387/s_rintl.S Fri Dec 4 21:51:47 2020 (r368353) +++ head/lib/msun/i387/s_rintl.S Sat Dec 5 00:33:28 2020 (r368354) @@ -40,5 +40,6 @@ ENTRY(rintl) fldt 4(%esp) frndint ret +END(rintl) .section .note.GNU-stack,"",%progbits Modified: head/libexec/rtld-elf/aarch64/rtld_start.S ============================================================================== --- head/libexec/rtld-elf/aarch64/rtld_start.S Fri Dec 4 21:51:47 2020 (r368353) +++ head/libexec/rtld-elf/aarch64/rtld_start.S Sat Dec 5 00:33:28 2020 (r368354) @@ -55,7 +55,6 @@ END(.rtld_start) * x17 = &_rtld_bind_start */ ENTRY(_rtld_bind_start) - .cfi_startproc mov x17, sp /* Save frame pointer and SP */ @@ -114,7 +113,6 @@ ENTRY(_rtld_bind_start) /* Call into the correct function */ br x16 - .cfi_endproc END(_rtld_bind_start) /* @@ -128,10 +126,8 @@ END(_rtld_bind_start) * Resolver function for TLS symbols resolved at load time */ ENTRY(_rtld_tlsdesc_static) - .cfi_startproc ldr x0, [x0, #8] ret - .cfi_endproc END(_rtld_tlsdesc_static) /* @@ -140,7 +136,6 @@ END(_rtld_tlsdesc_static) * Resolver function for weak and undefined TLS symbols */ ENTRY(_rtld_tlsdesc_undef) - .cfi_startproc str x1, [sp, #-16]! .cfi_adjust_cfa_offset 16 @@ -150,7 +145,6 @@ ENTRY(_rtld_tlsdesc_undef) ldr x1, [sp], #16 .cfi_adjust_cfa_offset -16 - .cfi_endproc ret END(_rtld_tlsdesc_undef) @@ -160,8 +154,6 @@ END(_rtld_tlsdesc_undef) * Resolver function for TLS symbols from dlopen() */ ENTRY(_rtld_tlsdesc_dynamic) - .cfi_startproc - /* Save registers used in fast path */ stp x1, x2, [sp, #(-2 * 16)]! stp x3, x4, [sp, #(1 * 16)] @@ -257,6 +249,5 @@ ENTRY(_rtld_tlsdesc_dynamic) ldp x3, x4, [sp, #16] ldp x1, x2, [sp], #(2 * 16) .cfi_adjust_cfa_offset -2 * 16 - .cfi_endproc ret END(_rtld_tlsdesc_dynamic) Modified: head/libexec/rtld-elf/powerpc/rtld_start.S ============================================================================== --- head/libexec/rtld-elf/powerpc/rtld_start.S Fri Dec 4 21:51:47 2020 (r368353) +++ head/libexec/rtld-elf/powerpc/rtld_start.S Sat Dec 5 00:33:28 2020 (r368354) @@ -101,6 +101,7 @@ _ENTRY(.rtld_start) li %r0,1 /* _exit() */ sc +_END(.rtld_start) #ifdef __SPE__ /* stack space for 30 GPRs + SPEFSCR/ACC/lr/cr */ @@ -142,6 +143,7 @@ _ENTRY(_rtld_bind_secureplt_start) ori %r11,%r11,0x15555556@l mulhwu %r11,%r11,%r0 # get high half of multiplication b 1f +_END(_rtld_bind_secureplt_start) /* * _rtld_bind_start() @@ -264,6 +266,7 @@ _ENTRY(_rtld_bind_start) addi %r1,%r1,STACK_SIZE # restore stack bctr # jump to target +_END(_rtld_bind_start) /* @@ -284,6 +287,7 @@ _ENTRY(_rtld_powerpc_pltlongresolve) subf %r11,%r12,%r11 # reloff li %r12,2 srw %r11,%r11,%r12 # index = reloff/sizeof(Elf_Addr) +_END(_rtld_powerpc_pltlongresolve) _ENTRY(_rtld_powerpc_pltresolve) lis %r12,0 # lis 12,_rtld_bind_start@ha addi %r12,%r12,0 # addi 12,12,_rtld_bind_start@l @@ -291,6 +295,7 @@ _ENTRY(_rtld_powerpc_pltresolve) lis %r12,0 # lis 12,obj@ha addi %r12,%r12,0 # addi 12,12,obj@l bctr +_END(_rtld_powerpc_pltresolve) /* * _rtld_powerpc_pltcall() @@ -311,5 +316,6 @@ _ENTRY(_rtld_powerpc_pltcall) lwz %r11,0(%r11) # lwz 11,jmptab@l(11) mtctr %r11 bctr # (*jmptab[index])() +_END(_rtld_powerpc_pltcall) .section .note.GNU-stack,"",%progbits Modified: head/libexec/rtld-elf/powerpc64/rtld_start.S ============================================================================== --- head/libexec/rtld-elf/powerpc64/rtld_start.S Fri Dec 4 21:51:47 2020 (r368353) +++ head/libexec/rtld-elf/powerpc64/rtld_start.S Sat Dec 5 00:33:28 2020 (r368354) @@ -113,6 +113,7 @@ _ENTRY(_rtld_start) li %r0,1 /* _exit() */ sc +_END(_rtld_start) /* * _rtld_bind_start() @@ -175,5 +176,6 @@ _ENTRY(_rtld_bind_start) mtlr %r0 bctr # jump to target +_END(_rtld_bind_start) .section .note.GNU-stack,"",%progbits Modified: head/stand/libsa/powerpc/_setjmp.S ============================================================================== --- head/stand/libsa/powerpc/_setjmp.S Fri Dec 4 21:51:47 2020 (r368353) +++ head/stand/libsa/powerpc/_setjmp.S Sat Dec 5 00:33:28 2020 (r368354) @@ -76,6 +76,7 @@ ASENTRY_NOPROF(_setjmp) /* f14-f31, fpscr */ li 3, 0 blr +ASEND(_setjmp) .extern sigsetmask @@ -113,3 +114,4 @@ ASENTRY_NOPROF(_longjmp) /* f14-f31, fpscr */ mr 3, 4 blr +ASEND(_longjmp) Modified: head/stand/powerpc/kboot/host_syscall.S ============================================================================== --- head/stand/powerpc/kboot/host_syscall.S Fri Dec 4 21:51:47 2020 (r368353) +++ head/stand/powerpc/kboot/host_syscall.S Sat Dec 5 00:33:28 2020 (r368354) @@ -13,11 +13,13 @@ ENTRY(host_read) 1: li %r3, 0 blr +END(host_read) ENTRY(host_write) li %r0, 4 # SYS_write sc blr +END(host_write) ENTRY(host_seek) mr %r4,%r5 @@ -26,11 +28,13 @@ ENTRY(host_seek) li %r0, 140 # SYS_llseek sc blr +END(host_seek) ENTRY(host_llseek) li %r0, 140 # SYS_llseek sc blr +END(host_llseek) ENTRY(host_open) li %r0, 5 # SYS_open @@ -40,45 +44,54 @@ ENTRY(host_open) 1: li %r3, 0 blr +END(host_open) ENTRY(host_close) li %r0, 6 # SYS_close sc blr +END(host_close) ENTRY(host_mmap) li %r0, 90 # SYS_mmap sc blr +END(host_mmap) ENTRY(host_uname) li %r0, 122 # SYS_uname sc blr +END(host_uname) ENTRY(host_gettimeofday) li %r0, 78 # SYS_gettimeofday sc blr +END(host_gettimeofday) ENTRY(host_select) li %r0, 142 # SYS_select sc blr +END(host_select) ENTRY(kexec_load) lis %r6,21 # KEXEC_ARCH_PPC64 li %r0,268 # __NR_kexec_load sc blr +END(kexec_load) ENTRY(host_reboot) li %r0,88 # SYS_reboot sc blr +END(host_reboot) ENTRY(host_getdents) li %r0,141 # SYS_getdents sc blr +END(host_getdents) Modified: head/stand/powerpc/uboot/start.S ============================================================================== --- head/stand/powerpc/uboot/start.S Fri Dec 4 21:51:47 2020 (r368353) +++ head/stand/powerpc/uboot/start.S Sat Dec 5 00:33:28 2020 (r368354) @@ -85,6 +85,7 @@ ENTRY(syscall) lwz %r30, 12(%r1) mr %r1, %r11 blr +END(syscall) /* * Data section Modified: head/sys/arm64/include/asm.h ============================================================================== --- head/sys/arm64/include/asm.h Fri Dec 4 21:51:47 2020 (r368353) +++ head/sys/arm64/include/asm.h Sat Dec 5 00:33:28 2020 (r368354) @@ -39,10 +39,11 @@ #define _C_LABEL(x) x #define ENTRY(sym) \ - .text; .globl sym; .align 2; .type sym,#function; sym: + .text; .globl sym; .align 2; .type sym,#function; sym: \ + .cfi_startproc #define EENTRY(sym) \ .globl sym; sym: -#define END(sym) .size sym, . - sym +#define END(sym) .cfi_endproc; .size sym, . - sym #define EEND(sym) #define WEAK_REFERENCE(sym, alias) \ Modified: head/sys/arm64/linux/linux_locore.asm ============================================================================== --- head/sys/arm64/linux/linux_locore.asm Fri Dec 4 21:51:47 2020 (r368353) +++ head/sys/arm64/linux/linux_locore.asm Sat Dec 5 00:33:28 2020 (r368354) @@ -47,17 +47,21 @@ linux_platform: ENTRY(__kernel_rt_sigreturn) brk #0 /* LINUXTODO: implement __kernel_rt_sigreturn */ ret +END(__kernel_rt_sigreturn) ENTRY(__kernel_gettimeofday) ldr x8, =LINUX_SYS_gettimeofday svc #0 ret +END(__kernel_gettimeofday) ENTRY(__kernel_clock_gettime) ldr x8, =LINUX_SYS_linux_clock_gettime svc #0 ret +END(__kernel_clock_gettime) ENTRY(__kernel_clock_getres) brk #0 /* LINUXTODO: implement __kernel_clock_getres */ ret +END(__kernel_clock_getres) Modified: head/sys/arm64/linux/linux_support.s ============================================================================== --- head/sys/arm64/linux/linux_support.s Fri Dec 4 21:51:47 2020 (r368353) +++ head/sys/arm64/linux/linux_support.s Sat Dec 5 00:33:28 2020 (r368354) @@ -39,19 +39,24 @@ ENTRY(futex_xchgl) brk #0 ret +END(futex_xchgl) ENTRY(futex_addl) brk #0 ret +END(futex_addl) ENTRY(futex_orl) brk #0 ret +END(futex_orl) ENTRY(futex_andl) brk #0 ret +END(futex_andl) ENTRY(futex_xorl) brk #0 ret +END(futex_xorl) Modified: head/sys/crypto/des/arch/i386/des_enc.S ============================================================================== --- head/sys/crypto/des/arch/i386/des_enc.S Fri Dec 4 21:51:47 2020 (r368353) +++ head/sys/crypto/des/arch/i386/des_enc.S Sat Dec 5 00:33:28 2020 (r368354) @@ -1354,8 +1354,7 @@ ENTRY(des_encrypt1) popl %edi popl %esi ret -.L_des_encrypt1_end: - .size _C_LABEL(des_encrypt1),.L_des_encrypt1_end-_C_LABEL(des_encrypt1) +END(des_encrypt1) ENTRY(des_encrypt2) pushl %esi @@ -2573,8 +2572,7 @@ ENTRY(des_encrypt2) popl %edi popl %esi ret -.L_des_encrypt2_end: - .size _C_LABEL(des_encrypt2),.L_des_encrypt2_end-_C_LABEL(des_encrypt2) +END(des_encrypt2) ENTRY(des_encrypt3) pushl %ebx @@ -2692,8 +2690,7 @@ ENTRY(des_encrypt3) popl %ebp popl %ebx ret -.L_des_encrypt3_end: - .size _C_LABEL(des_encrypt3),.L_des_encrypt3_end-_C_LABEL(des_encrypt3) +END(des_encrypt3) ENTRY(des_decrypt3) pushl %ebx @@ -2811,5 +2808,4 @@ ENTRY(des_decrypt3) popl %ebp popl %ebx ret -.L_des_decrypt3_end: - .size _C_LABEL(des_decrypt3),.L_des_decrypt3_end-_C_LABEL(des_decrypt3) +END(des_decrypt3) Modified: head/sys/i386/bios/smapi_bios.S ============================================================================== --- head/sys/i386/bios/smapi_bios.S Fri Dec 4 21:51:47 2020 (r368353) +++ head/sys/i386/bios/smapi_bios.S Sat Dec 5 00:33:28 2020 (r368354) @@ -38,3 +38,4 @@ ENTRY(smapi32) leave ret +END(smapi32) Modified: head/sys/i386/include/asm.h ============================================================================== --- head/sys/i386/include/asm.h Fri Dec 4 21:51:47 2020 (r368353) +++ head/sys/i386/include/asm.h Sat Dec 5 00:33:28 2020 (r368354) @@ -73,19 +73,30 @@ #define _START_ENTRY .text; .p2align 2,0x90 #define _ENTRY(x) _START_ENTRY; \ - .globl CNAME(x); .type CNAME(x),@function; CNAME(x): -#define END(x) .size x, . - x + .globl CNAME(x); .type CNAME(x),@function; CNAME(x): \ + .cfi_startproc +#define END(x) .cfi_endproc; .size x, . - x #ifdef PROF #define ALTENTRY(x) _ENTRY(x); \ - pushl %ebp; movl %esp,%ebp; \ + pushl %ebp; \ + .cfi_def_cfa_offset 8; \ + .cfi_offset %ebp, -8; \ + movl %esp,%ebp; \ call PIC_PLT(HIDENAME(mcount)); \ popl %ebp; \ + .cfi_restore %ebp; \ + .cfi_def_cfa_offset 4; \ jmp 9f #define ENTRY(x) _ENTRY(x); \ - pushl %ebp; movl %esp,%ebp; \ + pushl %ebp; \ + .cfi_def_cfa_offset 8; \ + .cfi_offset %ebp, -8; \ + movl %esp,%ebp; \ call PIC_PLT(HIDENAME(mcount)); \ popl %ebp; \ + .cfi_restore %ebp; \ + .cfi_def_cfa_offset 4; \ 9: #else #define ALTENTRY(x) _ENTRY(x) Modified: head/sys/powerpc/aim/locore.S ============================================================================== --- head/sys/powerpc/aim/locore.S Fri Dec 4 21:51:47 2020 (r368353) +++ head/sys/powerpc/aim/locore.S Sat Dec 5 00:33:28 2020 (r368354) @@ -13,3 +13,4 @@ ENTRY(get_spr) mfspr %r3, 0 blr +END(get_spr) Modified: head/sys/powerpc/aim/locore64.S ============================================================================== --- head/sys/powerpc/aim/locore64.S Fri Dec 4 21:51:47 2020 (r368353) +++ head/sys/powerpc/aim/locore64.S Sat Dec 5 00:33:28 2020 (r368354) @@ -203,6 +203,7 @@ _NAKED_ENTRY(__start) /* Unreachable */ b . +_END(__start) ASENTRY_NOPROF(__restartkernel_virtual) /* @@ -254,6 +255,7 @@ ASENTRY_NOPROF(__restartkernel_virtual) addi %r14, %r14, 1 cmpdi %r14, 16 blt 1b +ASEND(__restartkernel_virtual) ASENTRY_NOPROF(__restartkernel) /* @@ -270,5 +272,6 @@ ASENTRY_NOPROF(__restartkernel) rfid 2: bl __start nop +ASEND(__restartkernel) #include Modified: head/sys/powerpc/aim/trap_subr64.S ============================================================================== --- head/sys/powerpc/aim/trap_subr64.S Fri Dec 4 21:51:47 2020 (r368353) +++ head/sys/powerpc/aim/trap_subr64.S Sat Dec 5 00:33:28 2020 (r368354) @@ -957,6 +957,7 @@ dbtrap: dbleave: FRAME_LEAVE(PC_DBSAVE) rfid +ASEND(breakpoint) /* * In case of KDB we want a separate trap catcher for it Modified: head/sys/powerpc/booke/locore.S ============================================================================== --- head/sys/powerpc/booke/locore.S Fri Dec 4 21:51:47 2020 (r368353) +++ head/sys/powerpc/booke/locore.S Sat Dec 5 00:33:28 2020 (r368354) @@ -834,6 +834,7 @@ ENTRY(dcache_inval) andi. %r3, %r3, L1CSR0_DCFI bne 1b blr +END(dcache_inval) ENTRY(dcache_disable) /* Disable d-cache */ @@ -846,6 +847,7 @@ ENTRY(dcache_disable) mtspr SPR_L1CSR0, %r3 isync blr +END(dcache_disable) ENTRY(dcache_enable) /* Enable d-cache */ @@ -857,6 +859,7 @@ ENTRY(dcache_enable) mtspr SPR_L1CSR0, %r3 isync blr +END(dcache_enable) ENTRY(icache_inval) /* Invalidate i-cache */ @@ -869,6 +872,7 @@ ENTRY(icache_inval) andi. %r3, %r3, L1CSR1_ICFI bne 1b blr +END(icache_inval) ENTRY(icache_disable) /* Disable i-cache */ @@ -880,6 +884,7 @@ ENTRY(icache_disable) mtspr SPR_L1CSR1, %r3 isync blr +END(icache_disable) ENTRY(icache_enable) /* Enable i-cache */ @@ -890,6 +895,7 @@ ENTRY(icache_enable) mtspr SPR_L1CSR1, %r3 isync blr +END(icache_enable) /* * L2 cache disable/enable/inval sequences for E500mc. @@ -906,6 +912,7 @@ ENTRY(l2cache_inval) andis. %r3, %r3, L2CSR0_L2FI@h bne 1b blr +END(l2cache_inval) ENTRY(l2cache_enable) mfspr %r3, SPR_L2CSR0 @@ -914,6 +921,7 @@ ENTRY(l2cache_enable) mtspr SPR_L2CSR0, %r3 isync blr +END(l2cache_enable) /* * Branch predictor setup. @@ -929,6 +937,7 @@ ENTRY(bpred_enable) mtspr SPR_BUCSR, %r3 isync blr +END(bpred_enable) /* * XXX: This should be moved to a shared AIM/booke asm file, if one ever is @@ -938,6 +947,7 @@ ENTRY(get_spr) /* Note: The spr number is patched at runtime */ mfspr %r3, 0 blr +END(get_spr) /************************************************************************/ /* Data section */ Modified: head/sys/powerpc/booke/trap_subr.S ============================================================================== --- head/sys/powerpc/booke/trap_subr.S Fri Dec 4 21:51:47 2020 (r368353) +++ head/sys/powerpc/booke/trap_subr.S Sat Dec 5 00:33:28 2020 (r368354) @@ -1097,6 +1097,7 @@ dbtrap: dbleave: FRAME_LEAVE(SPR_SRR0, SPR_SRR1) rfi +ASEND(breakpoint) #endif /* KDB */ #ifdef SMP @@ -1111,6 +1112,7 @@ ENTRY(tlb_lock) isync msync blr +END(tlb_lock) ENTRY(tlb_unlock) isync @@ -1120,6 +1122,7 @@ ENTRY(tlb_unlock) isync msync blr +END(tlb_unlock) /* * TLB miss spin locks. For each CPU we have a reservation granule (32 bytes); Modified: head/sys/powerpc/include/asm.h ============================================================================== --- head/sys/powerpc/include/asm.h Fri Dec 4 21:51:47 2020 (r368353) +++ head/sys/powerpc/include/asm.h Sat Dec 5 00:33:28 2020 (r368354) @@ -108,12 +108,13 @@ .globl name; \ .section ".opd","aw"; \ .p2align 3; \ - name: \ +name: \ .quad DOT_LABEL(name),.TOC.@tocbase,0; \ .previous; \ .p2align 4; \ TYPE_ENTRY(name) \ -DOT_LABEL(name): +DOT_LABEL(name): \ + .cfi_startproc #define _NAKED_ENTRY(name) _ENTRY(name) #else #define _ENTRY(name) \ @@ -122,6 +123,7 @@ DOT_LABEL(name): .globl name; \ .type name,@function; \ name: \ + .cfi_startproc; \ addis %r2, %r12, (.TOC.-name)@ha; \ addi %r2, %r2, (.TOC.-name)@l; \ .localentry name, .-name; @@ -133,10 +135,12 @@ name: \ .globl name; \ .type name,@function; \ name: \ + .cfi_startproc; \ .localentry name, .-name; #endif #define _END(name) \ + .cfi_endproc; \ .long 0; \ .byte 0,0,0,0,0,0,0,0; \ END_SIZE(name) @@ -153,8 +157,11 @@ name: \ .p2align 4; \ .globl name; \ .type name,@function; \ - name: -#define _END(name) +name: \ + .cfi_startproc +#define _END(name) \ + .cfi_endproc; \ + .size name, . - name #define _NAKED_ENTRY(name) _ENTRY(name) @@ -186,6 +193,7 @@ name: \ # define _PROF_PROLOGUE #endif +#define ASEND(y) _END(ASMNAME(y)) #define ASENTRY(y) _ENTRY(ASMNAME(y)); _PROF_PROLOGUE #define END(y) _END(CNAME(y)) #define ENTRY(y) _ENTRY(CNAME(y)); _PROF_PROLOGUE Modified: head/sys/powerpc/mambo/mambocall.S ============================================================================== --- head/sys/powerpc/mambo/mambocall.S Fri Dec 4 21:51:47 2020 (r368353) +++ head/sys/powerpc/mambo/mambocall.S Sat Dec 5 00:33:28 2020 (r368354) @@ -36,4 +36,4 @@ ASENTRY(mambocall) */ .long 0x000EAEB0 blr - +ASEND(mambocall) Modified: head/sys/powerpc/ofw/ofwcall32.S ============================================================================== --- head/sys/powerpc/ofw/ofwcall32.S Fri Dec 4 21:51:47 2020 (r368353) +++ head/sys/powerpc/ofw/ofwcall32.S Sat Dec 5 00:33:28 2020 (r368354) @@ -120,6 +120,7 @@ ASENTRY(ofwcall) lwz %r0,4(%r1) mtlr %r0 blr +ASEND(ofwcall) /* * RTAS Entry Point. Similar to the OF one, but simpler (no separate stack) @@ -174,4 +175,4 @@ ASENTRY(rtascall) lwz %r0,4(%r1) mtlr %r0 blr - +ASEND(rtascall) Modified: head/sys/powerpc/ofw/ofwcall64.S ============================================================================== --- head/sys/powerpc/ofw/ofwcall64.S Fri Dec 4 21:51:47 2020 (r368353) +++ head/sys/powerpc/ofw/ofwcall64.S Sat Dec 5 00:33:28 2020 (r368354) @@ -216,6 +216,7 @@ ASENTRY_NOPROF(ofwcall) ld %r0,16(%r1) mtlr %r0 blr +ASEND(ofwcall) /* * RTAS 32-bit Entry Point. Similar to the OF one, but simpler (no separate @@ -380,4 +381,4 @@ ASENTRY_NOPROF(rtascall) ld %r0,16(%r1) mtlr %r0 blr - +ASEND(rtascall) Modified: head/sys/powerpc/powernv/opalcall.S ============================================================================== --- head/sys/powerpc/powernv/opalcall.S Fri Dec 4 21:51:47 2020 (r368353) +++ head/sys/powerpc/powernv/opalcall.S Sat Dec 5 00:33:28 2020 (r368354) @@ -129,4 +129,4 @@ ASENTRY(opal_call) /* And return */ blr - +ASEND(opal_call) Modified: head/sys/powerpc/powerpc/cpu_subr64.S ============================================================================== --- head/sys/powerpc/powerpc/cpu_subr64.S Fri Dec 4 21:51:47 2020 (r368353) +++ head/sys/powerpc/powerpc/cpu_subr64.S Sat Dec 5 00:33:28 2020 (r368354) @@ -96,3 +96,4 @@ power_save_sequence: bne 2b nap b . +END(enter_idle_powerx) Modified: head/sys/powerpc/powerpc/setjmp.S ============================================================================== --- head/sys/powerpc/powerpc/setjmp.S Fri Dec 4 21:51:47 2020 (r368353) +++ head/sys/powerpc/powerpc/setjmp.S Sat Dec 5 00:33:28 2020 (r368354) @@ -75,6 +75,7 @@ ASENTRY_NOPROF(setjmp) /* f14-f31, fpscr */ li 3, 0 blr +ASEND(setjmp) .extern sigsetmask @@ -112,3 +113,4 @@ ASENTRY_NOPROF(longjmp) /* f14-f31, fpscr */ mr 3, 4 blr +ASEND(longjmp) Modified: head/sys/powerpc/powerpc/support.S ============================================================================== --- head/sys/powerpc/powerpc/support.S Fri Dec 4 21:51:47 2020 (r368353) +++ head/sys/powerpc/powerpc/support.S Sat Dec 5 00:33:28 2020 (r368354) @@ -73,9 +73,11 @@ #endif #ifdef AIM -#define ENTRY_DIRECT(x) ENTRY(x ## _direct) +#define ENTRY_DIRECT(x) ENTRY(x ## _direct) +#define END_DIRECT(x) END(x ## _direct) #else #define ENTRY_DIRECT(x) ENTRY(x) +#define END_DIRECT(x) END(x) #endif #ifdef __powerpc64__ @@ -320,6 +322,7 @@ ENTRY(bcopy_generic) /* done */ .Lend: blr +END(bcopy_generic) /* * copyout(from_kernel, to_user, len) @@ -332,6 +335,7 @@ ENTRY_DIRECT(copyout) nop CLEAR_FAULT(%r7) EPILOGUE +END_DIRECT(copyout) /* * copyin(from_user, to_kernel, len) @@ -344,6 +348,8 @@ ENTRY_DIRECT(copyin) nop CLEAR_FAULT(%r7) EPILOGUE +END_DIRECT(copyin) + /* * copyinstr(const void *udaddr, void *kaddr, size_t len, size_t *done) * %r3 %r4 %r5 %r6 @@ -379,6 +385,7 @@ ENTRY_DIRECT(copyinstr) 3: CLEAR_FAULT_NO_CLOBBER(%r7) EPILOGUE +END_DIRECT(copyinstr) ENTRY_DIRECT(subyte) PROLOGUE @@ -386,6 +393,7 @@ ENTRY_DIRECT(subyte) stb %r4, 0(%r3) CLEAR_FAULT(%r7) EPILOGUE +END_DIRECT(subyte) #ifndef __powerpc64__ ENTRY_DIRECT(suword) @@ -394,6 +402,7 @@ ENTRY_DIRECT(suword) stw %r4, 0(%r3) CLEAR_FAULT(%r7) EPILOGUE +END_DIRECT(suword) #endif ENTRY_DIRECT(suword32) @@ -402,6 +411,7 @@ ENTRY_DIRECT(suword32) stw %r4, 0(%r3) CLEAR_FAULT(%r7) EPILOGUE +END_DIRECT(suword32) #ifdef __powerpc64__ ENTRY_DIRECT(suword64) @@ -410,12 +420,15 @@ ENTRY_DIRECT(suword64) std %r4, 0(%r3) CLEAR_FAULT(%r7) EPILOGUE +END_DIRECT(suword64) + ENTRY_DIRECT(suword) PROLOGUE SET_FUSUFAULT(%r3, %r7) std %r4, 0(%r3) CLEAR_FAULT(%r7) EPILOGUE +END_DIRECT(suword) #endif ENTRY_DIRECT(fubyte) @@ -424,6 +437,7 @@ ENTRY_DIRECT(fubyte) lbz %r3, 0(%r3) CLEAR_FAULT_NO_CLOBBER(%r7) EPILOGUE +END_DIRECT(fubyte) ENTRY_DIRECT(fuword16) PROLOGUE @@ -431,6 +445,7 @@ ENTRY_DIRECT(fuword16) lhz %r3, 0(%r3) CLEAR_FAULT_NO_CLOBBER(%r7) EPILOGUE +END_DIRECT(fuword16) #ifndef __powerpc64__ ENTRY_DIRECT(fueword) @@ -440,6 +455,7 @@ ENTRY_DIRECT(fueword) stw %r0, 0(%r4) CLEAR_FAULT(%r7) EPILOGUE +END_DIRECT(fueword) #endif ENTRY_DIRECT(fueword32) PROLOGUE @@ -448,6 +464,7 @@ ENTRY_DIRECT(fueword32) stw %r0, 0(%r4) CLEAR_FAULT(%r7) EPILOGUE +END_DIRECT(fueword32) #ifdef __powerpc64__ ENTRY_DIRECT(fueword) @@ -457,6 +474,7 @@ ENTRY_DIRECT(fueword) std %r0, 0(%r4) CLEAR_FAULT(%r7) EPILOGUE +END_DIRECT(fueword) ENTRY_DIRECT(fueword64) PROLOGUE @@ -465,6 +483,7 @@ ENTRY_DIRECT(fueword64) std %r0, 0(%r4) CLEAR_FAULT(%r7) EPILOGUE +END_DIRECT(fueword64) #endif /* @@ -495,6 +514,7 @@ ENTRY_DIRECT(fueword64) ENTRY_DIRECT(casueword32) CASUEWORD32(%r3, %r7) +END_DIRECT(casueword32) #ifdef __powerpc64__ #define CASUEWORD64(raddr, rpcb) ;\ @@ -520,20 +540,25 @@ ENTRY_DIRECT(casueword32) ENTRY_DIRECT(casueword) CASUEWORD64(%r3, %r7) +END_DIRECT(casueword) ENTRY_DIRECT(casueword64) CASUEWORD64(%r3, %r7) +END_DIRECT(casueword64) #else ENTRY_DIRECT(casueword) CASUEWORD32(%r3, %r7) +END_DIRECT(casueword) #endif _NAKED_ENTRY(fusufault) CLEAR_FAULT_NO_CLOBBER(%r7) li %r3, -1 EPILOGUE +_END(fusufault) _NAKED_ENTRY(copy_fault) CLEAR_FAULT_NO_CLOBBER(%r7) li %r3, EFAULT EPILOGUE +_END(copy_fault) Modified: head/sys/powerpc/powerpc/swtch32.S ============================================================================== --- head/sys/powerpc/powerpc/swtch32.S Fri Dec 4 21:51:47 2020 (r368353) +++ head/sys/powerpc/powerpc/swtch32.S Sat Dec 5 00:33:28 2020 (r368354) @@ -74,6 +74,7 @@ ENTRY(cpu_throw) li %r14,0 /* Tell cpu_switchin not to release a thread */ b cpu_switchin +END(cpu_throw) /* * void cpu_switch(struct thread *old, @@ -193,6 +194,7 @@ blocked_loop: */ stwcx. %r1, 0, %r3 blr +END(cpu_switch) /* * savectx(pcb) @@ -206,6 +208,7 @@ ENTRY(savectx) mflr %r4 /* Save the link register */ stw %r4,PCB_LR(%r3) blr +END(savectx) /* * fork_trampoline() @@ -225,3 +228,4 @@ ENTRY(fork_trampoline) mtspr SPR_SPEFSCR, %r3 #endif *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Sat Dec 5 02:21:59 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 3A4B94B23F8; Sat, 5 Dec 2020 02:21:59 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Cntcl1Dj4z4Zsd; Sat, 5 Dec 2020 02:21:59 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1D3D616702; Sat, 5 Dec 2020 02:21:59 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B52LwZx058203; Sat, 5 Dec 2020 02:21:58 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B52Lw3M058201; Sat, 5 Dec 2020 02:21:58 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202012050221.0B52Lw3M058201@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sat, 5 Dec 2020 02:21:58 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368355 - in head: share/mk tools/build/options usr.bin/grep X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in head: share/mk tools/build/options usr.bin/grep X-SVN-Commit-Revision: 368355 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Dec 2020 02:21:59 -0000 Author: kevans Date: Sat Dec 5 02:21:58 2020 New Revision: 368355 URL: https://svnweb.freebsd.org/changeset/base/368355 Log: Retire GNU_GREP_COMPAT knob This was introduced and then disabled by default primarily to avoid dealing with bugs in libgnuregex. rS363823 switched to using libregex for it, so let's just rip the option out now so we can make sure we're getting tested with libregex via bsdgrep. Reviewed by: emaste Differential Revision: https://reviews.freebsd.org/D27476 Deleted: head/tools/build/options/WITHOUT_GNU_GREP_COMPAT head/tools/build/options/WITH_GNU_GREP_COMPAT Modified: head/share/mk/src.opts.mk head/usr.bin/grep/Makefile head/usr.bin/grep/grep.c Modified: head/share/mk/src.opts.mk ============================================================================== --- head/share/mk/src.opts.mk Sat Dec 5 00:33:28 2020 (r368354) +++ head/share/mk/src.opts.mk Sat Dec 5 02:21:58 2020 (r368355) @@ -208,7 +208,6 @@ __DEFAULT_NO_OPTIONS = \ CLANG_FORMAT \ DTRACE_TESTS \ EXPERIMENTAL \ - GNU_GREP_COMPAT \ HESIOD \ LIBSOFT \ LOADER_FIREWIRE \ Modified: head/usr.bin/grep/Makefile ============================================================================== --- head/usr.bin/grep/Makefile Sat Dec 5 00:33:28 2020 (r368354) +++ head/usr.bin/grep/Makefile Sat Dec 5 02:21:58 2020 (r368355) @@ -60,10 +60,7 @@ MLINKS+= grep.1 egrep.1 \ grep.1 rgrep.1 .endif -.if ${MK_GNU_GREP_COMPAT} != "no" -CFLAGS+= -DWITH_GNU_COMPAT LIBADD+= regex -.endif HAS_TESTS= SUBDIR.${MK_TESTS}+= tests Modified: head/usr.bin/grep/grep.c ============================================================================== --- head/usr.bin/grep/grep.c Sat Dec 5 00:33:28 2020 (r368354) +++ head/usr.bin/grep/grep.c Sat Dec 5 02:21:58 2020 (r368355) @@ -62,8 +62,7 @@ const char *errstr[] = { /* 5*/ "\t[--context[=num]] [--directories=action] [--label] [--line-buffered]\n", /* 6*/ "\t[--null] [pattern] [file ...]\n", /* 7*/ "Binary file %s matches\n", -/* 8*/ "%s (BSD grep) %s\n", -/* 9*/ "%s (BSD grep, GNU compatible) %s\n", +/* 8*/ "%s (BSD grep, GNU compatible) %s\n", }; /* Flags passed to regcomp() and regexec() */ @@ -555,11 +554,7 @@ main(int argc, char *argv[]) filebehave = FILE_MMAP; break; case 'V': -#ifdef WITH_GNU_COMPAT - printf(errstr[9], getprogname(), VERSION); -#else printf(errstr[8], getprogname(), VERSION); -#endif exit(0); case 'v': vflag = true; From owner-svn-src-head@freebsd.org Sat Dec 5 02:23:11 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E2EC24B273F; Sat, 5 Dec 2020 02:23:11 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Cntf763lYz4Zpb; Sat, 5 Dec 2020 02:23:11 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C2CDE16698; Sat, 5 Dec 2020 02:23:11 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B52NBKf062393; Sat, 5 Dec 2020 02:23:11 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B52NBpi062392; Sat, 5 Dec 2020 02:23:11 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202012050223.0B52NBpi062392@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sat, 5 Dec 2020 02:23:11 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368356 - head/lib/libc/regex X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/lib/libc/regex X-SVN-Commit-Revision: 368356 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Dec 2020 02:23:11 -0000 Author: kevans Date: Sat Dec 5 02:23:11 2020 New Revision: 368356 URL: https://svnweb.freebsd.org/changeset/base/368356 Log: libc: regex: factor out ISBOW/ISEOW macros These will be reused for \b (word boundary, which matches both sides). No functional change. Modified: head/lib/libc/regex/engine.c Modified: head/lib/libc/regex/engine.c ============================================================================== --- head/lib/libc/regex/engine.c Sat Dec 5 02:21:58 2020 (r368355) +++ head/lib/libc/regex/engine.c Sat Dec 5 02:23:11 2020 (r368356) @@ -589,6 +589,17 @@ dissect(struct match *m, return(sp); } +#define ISBOW(m, sp) \ + (sp < m->endp && ISWORD(*sp) && \ + ((sp == m->beginp && !(m->eflags®_NOTBOL)) || \ + (sp > m->offp && !ISWORD(*(sp-1))))) +#define ISEOW(m, sp) \ + (((sp == m->endp && !(m->eflags®_NOTEOL)) || \ + (sp < m->endp && *sp == '\n' && \ + (m->g->cflags®_NEWLINE)) || \ + (sp < m->endp && !ISWORD(*sp)) ) && \ + (sp > m->beginp && ISWORD(*(sp-1)))) \ + /* - backref - figure out what matched what, figuring in back references == static const char *backref(struct match *m, const char *start, \ @@ -663,19 +674,13 @@ backref(struct match *m, return(NULL); break; case OBOW: - if (sp < m->endp && ISWORD(*sp) && - ((sp == m->beginp && !(m->eflags®_NOTBOL)) || - (sp > m->offp && !ISWORD(*(sp-1))))) + if (ISBOW(m, sp)) { /* yes */ } else return(NULL); break; case OEOW: - if (( (sp == m->endp && !(m->eflags®_NOTEOL)) || - (sp < m->endp && *sp == '\n' && - (m->g->cflags®_NEWLINE)) || - (sp < m->endp && !ISWORD(*sp)) ) && - (sp > m->beginp && ISWORD(*(sp-1))) ) + if (ISEOW(m, sp)) { /* yes */ } else return(NULL); From owner-svn-src-head@freebsd.org Sat Dec 5 03:13:48 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D1E1D4B32DA; Sat, 5 Dec 2020 03:13:48 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CnvmX5f32z4cqZ; Sat, 5 Dec 2020 03:13:48 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B4C4716F8C; Sat, 5 Dec 2020 03:13:48 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B53Dm1s094536; Sat, 5 Dec 2020 03:13:48 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B53DlOM094532; Sat, 5 Dec 2020 03:13:47 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202012050313.0B53DlOM094532@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sat, 5 Dec 2020 03:13:47 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368357 - in head/lib: libc/regex libregex/tests X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in head/lib: libc/regex libregex/tests X-SVN-Commit-Revision: 368357 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Dec 2020 03:13:48 -0000 Author: kevans Date: Sat Dec 5 03:13:47 2020 New Revision: 368357 URL: https://svnweb.freebsd.org/changeset/base/368357 Log: libregex: implement \` and \' (begin-of-subj, end-of-subj) These are GNU extensions, generally equivalent to ^ and $ except that the new syntax will not match beginning of line after the first in a multi-line expression or the end of line before absolute last in a multi-line expression. Modified: head/lib/libc/regex/engine.c head/lib/libc/regex/regcomp.c head/lib/libc/regex/regex2.h head/lib/libregex/tests/gnuext.in Modified: head/lib/libc/regex/engine.c ============================================================================== --- head/lib/libc/regex/engine.c Sat Dec 5 02:23:11 2020 (r368356) +++ head/lib/libc/regex/engine.c Sat Dec 5 03:13:47 2020 (r368357) @@ -109,7 +109,7 @@ static int matcher(struct re_guts *g, const char *stri static const char *dissect(struct match *m, const char *start, const char *stop, sopno startst, sopno stopst); static const char *backref(struct match *m, const char *start, const char *stop, sopno startst, sopno stopst, sopno lev, int); static const char *walk(struct match *m, const char *start, const char *stop, sopno startst, sopno stopst, bool fast); -static states step(struct re_guts *g, sopno start, sopno stop, states bef, wint_t ch, states aft); +static states step(struct re_guts *g, sopno start, sopno stop, states bef, wint_t ch, states aft, int sflags); #define MAX_RECURSION 100 #define BOL (OUT-1) #define EOL (BOL-1) @@ -119,6 +119,10 @@ static states step(struct re_guts *g, sopno start, sop #define EOW (BOL-5) #define BADCHAR (BOL-6) #define NONCHAR(c) ((c) <= OUT) +/* sflags */ +#define SBOS 0x0001 +#define SEOS 0x0002 + #ifdef REDEBUG static void print(struct match *m, const char *caption, states st, int ch, FILE *d); #endif @@ -457,6 +461,8 @@ dissect(struct match *m, case OEOL: case OBOW: case OEOW: + case OBOS: + case OEOS: break; case OANY: case OANYOF: @@ -657,6 +663,18 @@ backref(struct match *m, if (wc == BADCHAR || !CHIN(cs, wc)) return(NULL); break; + case OBOS: + if (sp == m->beginp && (m->eflags & REG_NOTBOL) == 0) + { /* yes */ } + else + return(NULL); + break; + case OEOS: + if (sp == m->endp && (m->eflags & REG_NOTEOL) == 0) + { /* yes */ } + else + return(NULL); + break; case OBOL: if ((sp == m->beginp && !(m->eflags®_NOTBOL)) || (sp > m->offp && sp < m->endp && @@ -819,15 +837,16 @@ walk(struct match *m, const char *start, const char *s wint_t c; wint_t lastc; /* previous c */ wint_t flagch; - int i; + int i, sflags; const char *matchp; /* last p at which a match ended */ size_t clen; + sflags = 0; AT("slow", start, stop, startst, stopst); CLEAR(st); SET1(st, startst); SP("sstart", st, *p); - st = step(m->g, startst, stopst, st, NOTHING, st); + st = step(m->g, startst, stopst, st, NOTHING, st, sflags); if (fast) ASSIGN(fresh, st); matchp = NULL; @@ -844,6 +863,7 @@ walk(struct match *m, const char *start, const char *s for (;;) { /* next character */ lastc = c; + sflags = 0; if (p == m->endp) { c = OUT; clen = 0; @@ -866,9 +886,20 @@ walk(struct match *m, const char *start, const char *s flagch = (flagch == BOL) ? BOLEOL : EOL; i += m->g->neol; } + if (lastc == OUT && (m->eflags & REG_NOTBOL) == 0) { + sflags |= SBOS; + /* Step one more for BOS. */ + i++; + } + if (c == OUT && (m->eflags & REG_NOTEOL) == 0) { + sflags |= SEOS; + /* Step one more for EOS. */ + i++; + } if (i != 0) { for (; i > 0; i--) - st = step(m->g, startst, stopst, st, flagch, st); + st = step(m->g, startst, stopst, st, flagch, st, + sflags); SP("sboleol", st, c); } @@ -882,7 +913,7 @@ walk(struct match *m, const char *start, const char *s flagch = EOW; } if (flagch == BOW || flagch == EOW) { - st = step(m->g, startst, stopst, st, flagch, st); + st = step(m->g, startst, stopst, st, flagch, st, sflags); SP("sboweow", st, c); } @@ -903,9 +934,10 @@ walk(struct match *m, const char *start, const char *s else ASSIGN(st, empty); assert(c != OUT); - st = step(m->g, startst, stopst, tmp, c, st); + st = step(m->g, startst, stopst, tmp, c, st, sflags); SP("saft", st, c); - assert(EQ(step(m->g, startst, stopst, st, NOTHING, st), st)); + assert(EQ(step(m->g, startst, stopst, st, NOTHING, st, sflags), + st)); p += clen; } @@ -939,7 +971,8 @@ step(struct re_guts *g, sopno stop, /* state after stop state within strip */ states bef, /* states reachable before */ wint_t ch, /* character or NONCHAR code */ - states aft) /* states already known reachable after */ + states aft, /* states already known reachable after */ + int sflags) /* state flags */ { cset *cs; sop s; @@ -958,6 +991,14 @@ step(struct re_guts *g, /* only characters can match */ assert(!NONCHAR(ch) || ch != OPND(s)); if (ch == OPND(s)) + FWD(aft, bef, 1); + break; + case OBOS: + if ((ch == BOL || ch == BOLEOL) && (sflags & SBOS) != 0) + FWD(aft, bef, 1); + break; + case OEOS: + if ((ch == EOL || ch == BOLEOL) && (sflags & SEOS) != 0) FWD(aft, bef, 1); break; case OBOL: Modified: head/lib/libc/regex/regcomp.c ============================================================================== --- head/lib/libc/regex/regcomp.c Sat Dec 5 02:23:11 2020 (r368356) +++ head/lib/libc/regex/regcomp.c Sat Dec 5 03:13:47 2020 (r368357) @@ -480,6 +480,12 @@ p_ere_exp(struct parse *p, struct branchc *bc) if (p->gnuext) { handled = 1; switch (wc) { + case '`': + EMIT(OBOS, 0); + break; + case '\'': + EMIT(OEOS, 0); + break; case 'W': case 'w': case 'S': @@ -833,6 +839,12 @@ p_simp_re(struct parse *p, struct branchc *bc) if (p->gnuext) { handled = true; switch (c) { + case BACKSL|'`': + EMIT(OBOS, 0); + break; + case BACKSL|'\'': + EMIT(OEOS, 0); + break; case BACKSL|'W': case BACKSL|'w': case BACKSL|'S': @@ -1878,6 +1890,8 @@ findmust(struct parse *p, struct re_guts *g) case OEOW: case OBOL: case OEOL: + case OBOS: + case OEOS: case O_QUEST: case O_CH: case OEND: Modified: head/lib/libc/regex/regex2.h ============================================================================== --- head/lib/libc/regex/regex2.h Sat Dec 5 02:23:11 2020 (r368356) +++ head/lib/libc/regex/regex2.h Sat Dec 5 03:13:47 2020 (r368357) @@ -104,6 +104,8 @@ typedef unsigned long sopno; #define O_CH (18L< b #\B[abc]+ - bc #\B[abc]\+ b bc -#\`abc\' & abc abc -#\`.+\' - abNc abNc -#\`.\+\' b abNc abNc -#(\`a) - Na -#(a\') - aN +\`abc & abc abc +abc\' & abc abc +\`abc\' & abc abc +\`.+\' - abNc abNc +\`.\+\' b abNc abNc +(\`a) - Na +(a\`) - aN +(a\') - aN +(\'a) - Na From owner-svn-src-head@freebsd.org Sat Dec 5 03:16:07 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 037024B380C; Sat, 5 Dec 2020 03:16:07 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CnvqB6WRwz4dVF; Sat, 5 Dec 2020 03:16:06 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id C802F16F90; Sat, 5 Dec 2020 03:16:06 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B53G6bS094792; Sat, 5 Dec 2020 03:16:06 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B53G5KF094788; Sat, 5 Dec 2020 03:16:05 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202012050316.0B53G5KF094788@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sat, 5 Dec 2020 03:16:05 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368358 - in head: contrib/netbsd-tests/lib/libc/regex/data lib/libc/regex lib/libregex/tests X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in head: contrib/netbsd-tests/lib/libc/regex/data lib/libc/regex lib/libregex/tests X-SVN-Commit-Revision: 368358 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Dec 2020 03:16:07 -0000 Author: kevans Date: Sat Dec 5 03:16:05 2020 New Revision: 368358 URL: https://svnweb.freebsd.org/changeset/base/368358 Log: libregex: implement \b and \B (word boundary, not word boundary) This is the last of the needed GNU expressions before we can unleash bsdgrep by default. \b is effectively an agnostic equivalent of \< and \>, while \B will match every space that isn't making a transition from nonchar -> char or char -> nonchar. Modified: head/contrib/netbsd-tests/lib/libc/regex/data/meta.in head/lib/libc/regex/engine.c head/lib/libc/regex/regcomp.c head/lib/libc/regex/regex2.h head/lib/libregex/tests/gnuext.in Modified: head/contrib/netbsd-tests/lib/libc/regex/data/meta.in ============================================================================== --- head/contrib/netbsd-tests/lib/libc/regex/data/meta.in Sat Dec 5 03:13:47 2020 (r368357) +++ head/contrib/netbsd-tests/lib/libc/regex/data/meta.in Sat Dec 5 03:16:05 2020 (r368358) @@ -5,7 +5,7 @@ a\*c & a*c a*c a\\b & a\b a\b a\\\*b & a\*b a\*b # Begin FreeBSD -a\bc &C EESCAPE +a\bc & abc # End FreeBSD a\ &C EESCAPE a\\bc & a\bc a\bc Modified: head/lib/libc/regex/engine.c ============================================================================== --- head/lib/libc/regex/engine.c Sat Dec 5 03:13:47 2020 (r368357) +++ head/lib/libc/regex/engine.c Sat Dec 5 03:16:05 2020 (r368358) @@ -118,6 +118,7 @@ static states step(struct re_guts *g, sopno start, sop #define BOW (BOL-4) #define EOW (BOL-5) #define BADCHAR (BOL-6) +#define NWBND (BOL-7) #define NONCHAR(c) ((c) <= OUT) /* sflags */ #define SBOS 0x0001 @@ -463,6 +464,8 @@ dissect(struct match *m, case OEOW: case OBOS: case OEOS: + case OWBND: + case ONWBND: break; case OANY: case OANYOF: @@ -691,6 +694,21 @@ backref(struct match *m, else return(NULL); break; + case OWBND: + if (ISBOW(m, sp) || ISEOW(m, sp)) + { /* yes */ } + else + return(NULL); + break; + case ONWBND: + if (((sp == m->beginp) && !ISWORD(*sp)) || + (sp == m->endp && !ISWORD(*(sp - 1)))) + { /* yes, beginning/end of subject */ } + else if (ISWORD(*(sp - 1)) == ISWORD(*sp)) + { /* yes, beginning/end of subject */ } + else + return(NULL); + break; case OBOW: if (ISBOW(m, sp)) { /* yes */ } @@ -916,6 +934,17 @@ walk(struct match *m, const char *start, const char *s st = step(m->g, startst, stopst, st, flagch, st, sflags); SP("sboweow", st, c); } + if (lastc != OUT && c != OUT && + ISWORD(lastc) == ISWORD(c)) { + flagch = NWBND; + } else if ((lastc == OUT && !ISWORD(c)) || + (c == OUT && !ISWORD(lastc))) { + flagch = NWBND; + } + if (flagch == NWBND) { + st = step(m->g, startst, stopst, st, flagch, st, sflags); + SP("snwbnd", st, c); + } /* are we done? */ if (ISSET(st, stopst)) { @@ -1016,6 +1045,14 @@ step(struct re_guts *g, case OEOW: if (ch == EOW) FWD(aft, bef, 1); + break; + case OWBND: + if (ch == BOW || ch == EOW) + FWD(aft, bef, 1); + break; + case ONWBND: + if (ch == NWBND) + FWD(aft, aft, 1); break; case OANY: if (!NONCHAR(ch)) Modified: head/lib/libc/regex/regcomp.c ============================================================================== --- head/lib/libc/regex/regcomp.c Sat Dec 5 03:13:47 2020 (r368357) +++ head/lib/libc/regex/regcomp.c Sat Dec 5 03:16:05 2020 (r368358) @@ -486,6 +486,12 @@ p_ere_exp(struct parse *p, struct branchc *bc) case '\'': EMIT(OEOS, 0); break; + case 'B': + EMIT(ONWBND, 0); + break; + case 'b': + EMIT(OWBND, 0); + break; case 'W': case 'w': case 'S': @@ -845,6 +851,12 @@ p_simp_re(struct parse *p, struct branchc *bc) case BACKSL|'\'': EMIT(OEOS, 0); break; + case BACKSL|'B': + EMIT(ONWBND, 0); + break; + case BACKSL|'b': + EMIT(OWBND, 0); + break; case BACKSL|'W': case BACKSL|'w': case BACKSL|'S': @@ -1892,6 +1904,8 @@ findmust(struct parse *p, struct re_guts *g) case OEOL: case OBOS: case OEOS: + case OWBND: + case ONWBND: case O_QUEST: case O_CH: case OEND: @@ -2043,6 +2057,8 @@ altoffset(sop *scan, int offset) try++; case OBOW: case OEOW: + case OWBND: + case ONWBND: case OLPAREN: case ORPAREN: case OOR2: Modified: head/lib/libc/regex/regex2.h ============================================================================== --- head/lib/libc/regex/regex2.h Sat Dec 5 03:13:47 2020 (r368357) +++ head/lib/libc/regex/regex2.h Sat Dec 5 03:16:05 2020 (r368358) @@ -106,6 +106,8 @@ typedef unsigned long sopno; #define OEOW (20L<, \`, \') # (is/not boundary, start/end word, start/end subject string) -# Most of these are disabled for the moment, and will be re-enabled as -# we become feature complete. -#\babc\b & abc +\babc\b & abc \ & abc -#\Babc\B & abc -#\B[abc]\B & b -#\B[abc]+ - bc -#\B[abc]\+ b bc +\Babc\B & abc +\B[abc]\B & b +\B[abc]+ - bc +\B[abc]\+ b bc \`abc & abc abc abc\' & abc abc \`abc\' & abc abc From owner-svn-src-head@freebsd.org Sat Dec 5 03:18:49 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id AD1754B37A9; Sat, 5 Dec 2020 03:18:49 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CnvtK4Y7Yz4dKJ; Sat, 5 Dec 2020 03:18:49 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8E61B16F92; Sat, 5 Dec 2020 03:18:49 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B53InwD094942; Sat, 5 Dec 2020 03:18:49 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B53InNv094940; Sat, 5 Dec 2020 03:18:49 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202012050318.0B53InNv094940@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sat, 5 Dec 2020 03:18:49 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368359 - head/lib/libc/regex X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: head/lib/libc/regex X-SVN-Commit-Revision: 368359 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Dec 2020 03:18:49 -0000 Author: kevans Date: Sat Dec 5 03:18:48 2020 New Revision: 368359 URL: https://svnweb.freebsd.org/changeset/base/368359 Log: libc: regex: retire internal EMPTBR ("Empty branch present") It was realized just a little too late that this was a hack that belonged in individual regex(3)-using applications. It was surrounded in NOTYET and not implemented in the engine, so remove it. Modified: head/lib/libc/regex/regcomp.c head/lib/libc/regex/regex2.h Modified: head/lib/libc/regex/regcomp.c ============================================================================== --- head/lib/libc/regex/regcomp.c Sat Dec 5 03:16:05 2020 (r368358) +++ head/lib/libc/regex/regcomp.c Sat Dec 5 03:18:48 2020 (r368359) @@ -691,15 +691,9 @@ static bool p_branch_empty(struct parse *p, struct branchc *bc) { -#if defined(LIBREGEX) && defined(NOTYET) - if (bc->outer) - p->g->iflags |= EMPTBR; - return (true); -#else (void)bc; SETERROR(REG_EMPTY); return (false); -#endif } /* Modified: head/lib/libc/regex/regex2.h ============================================================================== --- head/lib/libc/regex/regex2.h Sat Dec 5 03:16:05 2020 (r368358) +++ head/lib/libc/regex/regex2.h Sat Dec 5 03:18:48 2020 (r368359) @@ -186,7 +186,6 @@ struct re_guts { # define USEBOL 01 /* used ^ */ # define USEEOL 02 /* used $ */ # define BAD 04 /* something wrong */ -# define EMPTBR 010 /* empty branch present */ int nbol; /* number of ^ used */ int neol; /* number of $ used */ char *must; /* match must contain this string */ From owner-svn-src-head@freebsd.org Sat Dec 5 03:19:36 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D93AB4B36D2; Sat, 5 Dec 2020 03:19:36 +0000 (UTC) (envelope-from mmacy@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CnvvD5f7Nz4dZ0; Sat, 5 Dec 2020 03:19:36 +0000 (UTC) (envelope-from mmacy@freebsd.org) Received: from mail-lj1-f176.google.com (mail-lj1-f176.google.com [209.85.208.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) (Authenticated sender: mmacy) by smtp.freebsd.org (Postfix) with ESMTPSA id AE69B21058; Sat, 5 Dec 2020 03:19:36 +0000 (UTC) (envelope-from mmacy@freebsd.org) Received: by mail-lj1-f176.google.com with SMTP id y7so8803722lji.8; Fri, 04 Dec 2020 19:19:36 -0800 (PST) X-Gm-Message-State: AOAM532EiTmILKOslqb22WsbuZU9ionWqqWPMgQpxV+e5ywbhlzIEJ6S eqSs8Wby/MIskXYMZQCjNBjre9qGWeObXoB5Hk4= X-Google-Smtp-Source: ABdhPJzDtDRyYvmcO9b25zv6be4MoGL/q5DaE9mgqNYbRxOQgaiTJyBoj9Ov12bGQSozTVaxVTb45CqH3UfP1MR+0dg= X-Received: by 2002:a2e:9810:: with SMTP id a16mr796842ljj.297.1607138375325; Fri, 04 Dec 2020 19:19:35 -0800 (PST) MIME-Version: 1.0 References: <202011291938.0ATJc4Z3081193@repo.freebsd.org> In-Reply-To: From: Matthew Macy Date: Fri, 4 Dec 2020 19:19:24 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r368163 - in head: sbin/ifconfig sys/dev/if_wg sys/dev/if_wg/include sys/dev/if_wg/include/crypto sys/dev/if_wg/include/sys sys/dev/if_wg/include/zinc sys/dev/if_wg/module sys/dev/if_wg... To: Michael Tuexen Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Dec 2020 03:19:36 -0000 Just what I put on the review. I=E2=80=99ll put together a man page the wee= k after next. Sorry for the delay. -M On Mon, Nov 30, 2020 at 10:16 Michael Tuexen wrote: > > > > On 29. Nov 2020, at 20:38, Matt Macy wrote: > > > > Author: mmacy > > Date: Sun Nov 29 19:38:03 2020 > > New Revision: 368163 > > URL: https://svnweb.freebsd.org/changeset/base/368163 > > > > Log: > > Import kernel WireGuard support > > > > Data path largely shared with the OpenBSD implementation by > > Matt Dunwoodie > > > > Reviewed by: grehan@freebsd.org > > MFC after: 1 month > > Sponsored by: Rubicon LLC, (Netgate) > > Differential Revision: https://reviews.freebsd.org/D26137 > > > Is there some documentation available somewhere how to setup a tunnel? > > Best regards > Michael > > From owner-svn-src-head@freebsd.org Sat Dec 5 03:22:39 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id E4B6E4B3944; Sat, 5 Dec 2020 03:22:39 +0000 (UTC) (envelope-from mmacy@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Cnvyl60Qmz4fDH; Sat, 5 Dec 2020 03:22:39 +0000 (UTC) (envelope-from mmacy@freebsd.org) Received: from mail-lf1-f43.google.com (mail-lf1-f43.google.com [209.85.167.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) (Authenticated sender: mmacy) by smtp.freebsd.org (Postfix) with ESMTPSA id BEE492123E; Sat, 5 Dec 2020 03:22:39 +0000 (UTC) (envelope-from mmacy@freebsd.org) Received: by mail-lf1-f43.google.com with SMTP id s30so10422205lfc.4; Fri, 04 Dec 2020 19:22:39 -0800 (PST) X-Gm-Message-State: AOAM533nMBiiXTyMxIjGIBvWLt1dCugAUcKkmL/owaHX+RFJSyYsJPBD KOrZ8yc3pP6SDuV9p18zttka2NjXpFV1vbDIZio= X-Google-Smtp-Source: ABdhPJyngDalJ+Cu4BLS/I7FeWLWkMNZ3mFL4yk8msKW/2RuozhN9694beg9H35KrcDBNJi3unOAplmDbWTGv/8sHQQ= X-Received: by 2002:a19:e8a:: with SMTP id 132mr1410759lfo.108.1607138558273; Fri, 04 Dec 2020 19:22:38 -0800 (PST) MIME-Version: 1.0 References: <202011291938.0ATJc4Z3081193@repo.freebsd.org> <20201130102758.c600f147a801933bb66529c7@bidouilliste.com> <01F4B070-2CBE-4662-ACDC-20F5E87B751A@lists.zabbadoz.net> <-0GA0tF-2zZxdb99WE9WoUnv9YVf9efjJnMin4IL0bctNp-Bab2Qw2RbUuZTa6y9hP7r0UEUUXGkRSz-OF4k5yR5YmUgU-JJxNWcl48tVSQ=@protonmail.com> <6C2E5C72-BBB7-42D1-9615-07EC536F07ED@lists.zabbadoz.net> In-Reply-To: <6C2E5C72-BBB7-42D1-9615-07EC536F07ED@lists.zabbadoz.net> From: Matthew Macy Date: Fri, 4 Dec 2020 19:22:26 -0800 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r368163 - in head: sbin/ifconfig sys/dev/if_wg sys/dev/if_wg/include sys/dev/if_wg/include/crypto sys/dev/if_wg/include/sys sys/dev/if_wg/include/zinc sys/dev/if_wg/module sys/dev/if_wg... To: "Bjoern A. Zeeb" Cc: cglogic , src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Content-Filtered-By: Mailman/MimeDel 2.1.34 X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Dec 2020 03:22:40 -0000 I worry about the incredible mess of header dependencies that the linuxkpi is prone to introducing. I=E2=80=99m happy to review any proposed changes t= o that effect, but do not feel like it=E2=80=99s important enough to make a priori= ty. Thanks. -M On Mon, Nov 30, 2020 at 08:33 Bjoern A. Zeeb wrote: > On 30 Nov 2020, at 14:53, cglogic wrote: > > > So you propose to make it dependent on linuxkpi? What have to do a > > user who does not compile linuxkpi, but wants to use if_wg? > > If we=E2=80=99d move the implementations into linuxkpi you=E2=80=99d have= to compile > it to use if_wg. > So that this however is only a question. > > Effectively you are using parts of linuxkpi now already, just > copy&pasted (duplicated) into local files under if_wg; for as much as I > can see for most of that would however not require linuxkpi to be > loaded, just present at compile time like any other kernel headers. > > /bz > From owner-svn-src-head@freebsd.org Sat Dec 5 05:56:23 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D627D4B64A9; Sat, 5 Dec 2020 05:56:23 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CnzN75jNJz4mBQ; Sat, 5 Dec 2020 05:56:23 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B728018F30; Sat, 5 Dec 2020 05:56:23 +0000 (UTC) (envelope-from mjg@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B55uN3F093745; Sat, 5 Dec 2020 05:56:23 GMT (envelope-from mjg@FreeBSD.org) Received: (from mjg@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B55uNEo093744; Sat, 5 Dec 2020 05:56:23 GMT (envelope-from mjg@FreeBSD.org) Message-Id: <202012050556.0B55uNEo093744@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mjg set sender to mjg@FreeBSD.org using -f From: Mateusz Guzik Date: Sat, 5 Dec 2020 05:56:23 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368360 - head/sys/kern X-SVN-Group: head X-SVN-Commit-Author: mjg X-SVN-Commit-Paths: head/sys/kern X-SVN-Commit-Revision: 368360 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Dec 2020 05:56:23 -0000 Author: mjg Date: Sat Dec 5 05:56:23 2020 New Revision: 368360 URL: https://svnweb.freebsd.org/changeset/base/368360 Log: vfs: keep bad ops on vnode reclaim They were only modified to accomodate a redundant assertion. This runs into problems as lockless lookup can still try to use the vnode and crash instead of getting an error. The bug was only present in kernels with INVARIANTS. Reported by: kevans Modified: head/sys/kern/vfs_subr.c Modified: head/sys/kern/vfs_subr.c ============================================================================== --- head/sys/kern/vfs_subr.c Sat Dec 5 03:18:48 2020 (r368359) +++ head/sys/kern/vfs_subr.c Sat Dec 5 05:56:23 2020 (r368360) @@ -1816,10 +1816,6 @@ freevnode(struct vnode *vp) destroy_vpollinfo(vp->v_pollinfo); vp->v_pollinfo = NULL; } -#ifdef INVARIANTS - /* XXX Elsewhere we detect an already freed vnode via NULL v_op. */ - vp->v_op = NULL; -#endif vp->v_mountedhere = NULL; vp->v_unpcb = NULL; vp->v_rdev = NULL; @@ -3458,8 +3454,6 @@ vdrop_deactivate(struct vnode *vp) */ VNASSERT(!VN_IS_DOOMED(vp), vp, ("vdrop: returning doomed vnode")); - VNASSERT(vp->v_op != NULL, vp, - ("vdrop: vnode already reclaimed.")); VNASSERT((vp->v_iflag & VI_OWEINACT) == 0, vp, ("vnode with VI_OWEINACT set")); VNASSERT((vp->v_iflag & VI_DEFINACT) == 0, vp, From owner-svn-src-head@freebsd.org Sat Dec 5 10:00:40 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 50CFF47529E; Sat, 5 Dec 2020 10:00:40 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Cp4p01Cj7z3GMN; Sat, 5 Dec 2020 10:00:40 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 186F11BF98; Sat, 5 Dec 2020 10:00:40 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B5A0dkc041431; Sat, 5 Dec 2020 10:00:39 GMT (envelope-from mmel@FreeBSD.org) Received: (from mmel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B5A0d52041430; Sat, 5 Dec 2020 10:00:39 GMT (envelope-from mmel@FreeBSD.org) Message-Id: <202012051000.0B5A0d52041430@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmel set sender to mmel@FreeBSD.org using -f From: Michal Meloun Date: Sat, 5 Dec 2020 10:00:39 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368362 - head/sys/modules/dtb/rockchip X-SVN-Group: head X-SVN-Commit-Author: mmel X-SVN-Commit-Paths: head/sys/modules/dtb/rockchip X-SVN-Commit-Revision: 368362 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Dec 2020 10:00:40 -0000 Author: mmel Date: Sat Dec 5 10:00:39 2020 New Revision: 368362 URL: https://svnweb.freebsd.org/changeset/base/368362 Log: Also build DTB files for Asus Tinker board (RK3288 based). Modified: head/sys/modules/dtb/rockchip/Makefile Modified: head/sys/modules/dtb/rockchip/Makefile ============================================================================== --- head/sys/modules/dtb/rockchip/Makefile Sat Dec 5 09:08:26 2020 (r368361) +++ head/sys/modules/dtb/rockchip/Makefile Sat Dec 5 10:00:39 2020 (r368362) @@ -1,6 +1,12 @@ # $FreeBSD$ +# All the dts files for rockchip systems we support. +.if ${MACHINE_ARCH} == "armv7" DTS= \ + rk3288-tinker.dts \ + rk3288-tinker-s.dts +.elif ${MACHINE_ARCH} == "aarch64" +DTS= \ rockchip/rk3399-khadas-edge-captain.dts \ rockchip/rk3399-khadas-edge.dts \ rockchip/rk3399-khadas-edge-v.dts \ @@ -10,5 +16,6 @@ DTS= \ rockchip/rk3399-rockpro64.dts DTSO= rk3328-dwc3.dtso +.endif .include From owner-svn-src-head@freebsd.org Sat Dec 5 10:10:26 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 08CEF475514; Sat, 5 Dec 2020 10:10:26 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Cp51F6ny1z3GRk; Sat, 5 Dec 2020 10:10:25 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id DBB661C0C2; Sat, 5 Dec 2020 10:10:25 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B5AAP6d048105; Sat, 5 Dec 2020 10:10:25 GMT (envelope-from mmel@FreeBSD.org) Received: (from mmel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B5AAPJI048104; Sat, 5 Dec 2020 10:10:25 GMT (envelope-from mmel@FreeBSD.org) Message-Id: <202012051010.0B5AAPJI048104@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmel set sender to mmel@FreeBSD.org using -f From: Michal Meloun Date: Sat, 5 Dec 2020 10:10:25 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368363 - head/sys/arm/conf X-SVN-Group: head X-SVN-Commit-Author: mmel X-SVN-Commit-Paths: head/sys/arm/conf X-SVN-Commit-Revision: 368363 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Dec 2020 10:10:26 -0000 Author: mmel Date: Sat Dec 5 10:10:25 2020 New Revision: 368363 URL: https://svnweb.freebsd.org/changeset/base/368363 Log: Connect RK3288 to GENERIC kernel. Modified: head/sys/arm/conf/GENERIC Modified: head/sys/arm/conf/GENERIC ============================================================================== --- head/sys/arm/conf/GENERIC Sat Dec 5 10:00:39 2020 (r368362) +++ head/sys/arm/conf/GENERIC Sat Dec 5 10:10:25 2020 (r368363) @@ -42,6 +42,7 @@ files "../freescale/imx/files.imx6" files "../mv/files.arm7" files "../nvidia/tegra124/files.tegra124" files "../qemu/files.qemu" +files "../rockchip/files.rk32xx" files "../ti/files.ti" files "../ti/am335x/files.am335x" files "../ti/omap4/files.omap4" @@ -91,6 +92,7 @@ device generic_timer device mpcore_timer # MMC/SD/SDIO Card slot support +device dwmmc device sdhci # SD controller device mmc # mmc/sd bus device mmcsd # mmc/sd flash cards @@ -285,6 +287,7 @@ makeoptions MODULES_EXTRA+="dtb/am335x" makeoptions MODULES_EXTRA+="dtb/imx6" makeoptions MODULES_EXTRA+="dtb/nvidia" makeoptions MODULES_EXTRA+="dtb/omap4" +makeoptions MODULES_EXTRA+="dtb/rockchip" makeoptions MODULES_EXTRA+="dtb/rpi" makeoptions MODULES_EXTRA+="dtb/zynq" From owner-svn-src-head@freebsd.org Sat Dec 5 10:55:09 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id BF5E747653F; Sat, 5 Dec 2020 10:55:09 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Cp60s3jS5z3K1Q; Sat, 5 Dec 2020 10:55:09 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 723BD1CB26; Sat, 5 Dec 2020 10:55:09 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B5At9Za078371; Sat, 5 Dec 2020 10:55:09 GMT (envelope-from mmel@FreeBSD.org) Received: (from mmel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B5At9cN078370; Sat, 5 Dec 2020 10:55:09 GMT (envelope-from mmel@FreeBSD.org) Message-Id: <202012051055.0B5At9cN078370@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmel set sender to mmel@FreeBSD.org using -f From: Michal Meloun Date: Sat, 5 Dec 2020 10:55:09 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368364 - head/sys/dev/pci X-SVN-Group: head X-SVN-Commit-Author: mmel X-SVN-Commit-Paths: head/sys/dev/pci X-SVN-Commit-Revision: 368364 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Dec 2020 10:55:09 -0000 Author: mmel Date: Sat Dec 5 10:55:09 2020 New Revision: 368364 URL: https://svnweb.freebsd.org/changeset/base/368364 Log: DesignWare PCIe driver: Don't call bus_generic_attach() twice. bus_generic_attach() should be called from the attach function of the real implementation, not from the common init function. MFC after: 1 week Modified: head/sys/dev/pci/pci_dw.c Modified: head/sys/dev/pci/pci_dw.c ============================================================================== --- head/sys/dev/pci/pci_dw.c Sat Dec 5 10:10:25 2020 (r368363) +++ head/sys/dev/pci/pci_dw.c Sat Dec 5 10:55:09 2020 (r368364) @@ -640,7 +640,7 @@ pci_dw_init(device_t dev) device_add_child(dev, "pci", -1); - return (bus_generic_attach(dev)); + return (0); out: /* XXX Cleanup */ return (rv); From owner-svn-src-head@freebsd.org Sat Dec 5 10:55:18 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id A6F10476681; Sat, 5 Dec 2020 10:55:18 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Cp60z1Ydhz3K1p; Sat, 5 Dec 2020 10:55:14 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 8DFF11C93B; Sat, 5 Dec 2020 10:55:14 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B5AtE4T078418; Sat, 5 Dec 2020 10:55:14 GMT (envelope-from wulf@FreeBSD.org) Received: (from wulf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B5AtEZQ078417; Sat, 5 Dec 2020 10:55:14 GMT (envelope-from wulf@FreeBSD.org) Message-Id: <202012051055.0B5AtEZQ078417@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wulf set sender to wulf@FreeBSD.org using -f From: Vladimir Kondratyev Date: Sat, 5 Dec 2020 10:55:14 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368365 - head/sys/dev/atkbdc X-SVN-Group: head X-SVN-Commit-Author: wulf X-SVN-Commit-Paths: head/sys/dev/atkbdc X-SVN-Commit-Revision: 368365 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Dec 2020 10:55:18 -0000 Author: wulf Date: Sat Dec 5 10:55:14 2020 New Revision: 368365 URL: https://svnweb.freebsd.org/changeset/base/368365 Log: atkbd(4): Change quirk table end-of-list marker to NULL vendor/maker/product This fixes regression introduced in r367349 which effectively resulted in truncation of quirk table. PR: 250711 Submitted by: grembo Reported by: Matthias Apitz X-MFC with: r367349 Modified: head/sys/dev/atkbdc/atkbdc.c Modified: head/sys/dev/atkbdc/atkbdc.c ============================================================================== --- head/sys/dev/atkbdc/atkbdc.c Sat Dec 5 10:55:09 2020 (r368364) +++ head/sys/dev/atkbdc/atkbdc.c Sat Dec 5 10:55:14 2020 (r368365) @@ -133,7 +133,8 @@ atkbdc_getquirks(void) char* maker = kern_getenv("smbios.system.maker"); char* product = kern_getenv("smbios.system.product"); - for (i=0; quirks[i].quirk != 0; ++i) + for (i=0; quirks[i].bios_vendor != NULL || quirks[i].maker != NULL || + quirks[i].product != NULL; ++i) if (QUIRK_STR_MATCH(quirks[i].bios_vendor, bios_vendor) && QUIRK_STR_MATCH(quirks[i].maker, maker) && QUIRK_STR_MATCH(quirks[i].product, product)) From owner-svn-src-head@freebsd.org Sat Dec 5 10:57:16 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CC2264761F7; Sat, 5 Dec 2020 10:57:16 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Cp63J5RNPz3K9k; Sat, 5 Dec 2020 10:57:16 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id AD9E91CB27; Sat, 5 Dec 2020 10:57:16 +0000 (UTC) (envelope-from wulf@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B5AvG5A078575; Sat, 5 Dec 2020 10:57:16 GMT (envelope-from wulf@FreeBSD.org) Received: (from wulf@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B5AvGlV078572; Sat, 5 Dec 2020 10:57:16 GMT (envelope-from wulf@FreeBSD.org) Message-Id: <202012051057.0B5AvGlV078572@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: wulf set sender to wulf@FreeBSD.org using -f From: Vladimir Kondratyev Date: Sat, 5 Dec 2020 10:57:16 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368366 - head/sys/dev/ichiic X-SVN-Group: head X-SVN-Commit-Author: wulf X-SVN-Commit-Paths: head/sys/dev/ichiic X-SVN-Commit-Revision: 368366 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Dec 2020 10:57:16 -0000 Author: wulf Date: Sat Dec 5 10:57:15 2020 New Revision: 368366 URL: https://svnweb.freebsd.org/changeset/base/368366 Log: ig4(4): Add PCI IDs for Intel Tiger Lake Submitted by: Neel Chauhan Differential Revision: https://reviews.freebsd.org/D27483 Modified: head/sys/dev/ichiic/ig4_iic.c head/sys/dev/ichiic/ig4_pci.c head/sys/dev/ichiic/ig4_var.h Modified: head/sys/dev/ichiic/ig4_iic.c ============================================================================== --- head/sys/dev/ichiic/ig4_iic.c Sat Dec 5 10:55:14 2020 (r368365) +++ head/sys/dev/ichiic/ig4_iic.c Sat Dec 5 10:57:15 2020 (r368366) @@ -119,6 +119,12 @@ static const struct ig4_hw ig4iic_hw[] = { .ic_clock_rate = 216, .sda_hold_time = 230, }, + [IG4_TIGERLAKE] = { + .ic_clock_rate = 133, + .sda_fall_time = 171, + .scl_fall_time = 208, + .sda_hold_time = 42, + }, }; static int ig4iic_set_config(ig4iic_softc_t *sc, bool reset); Modified: head/sys/dev/ichiic/ig4_pci.c ============================================================================== --- head/sys/dev/ichiic/ig4_pci.c Sat Dec 5 10:55:14 2020 (r368365) +++ head/sys/dev/ichiic/ig4_pci.c Sat Dec 5 10:57:15 2020 (r368366) @@ -121,6 +121,21 @@ static int ig4iic_pci_detach(device_t dev); #define PCI_CHIP_COMETLAKE_V_I2C_1 0xa3e18086 #define PCI_CHIP_COMETLAKE_V_I2C_2 0xa3e28086 #define PCI_CHIP_COMETLAKE_V_I2C_3 0xa3e38086 +#define PCI_CHIP_TIGERLAKE_H_I2C_0 0x43d88086 +#define PCI_CHIP_TIGERLAKE_H_I2C_1 0x43e88086 +#define PCI_CHIP_TIGERLAKE_H_I2C_2 0x43e98086 +#define PCI_CHIP_TIGERLAKE_H_I2C_3 0x43ea8086 +#define PCI_CHIP_TIGERLAKE_H_I2C_4 0x43eb8086 +#define PCI_CHIP_TIGERLAKE_H_I2C_5 0x43ad8086 +#define PCI_CHIP_TIGERLAKE_H_I2C_6 0x43ae8086 +#define PCI_CHIP_TIGERLAKE_LP_I2C_0 0xa0c58086 +#define PCI_CHIP_TIGERLAKE_LP_I2C_1 0xa0c68086 +#define PCI_CHIP_TIGERLAKE_LP_I2C_2 0xa0d88086 +#define PCI_CHIP_TIGERLAKE_LP_I2C_3 0xa0d98086 +#define PCI_CHIP_TIGERLAKE_LP_I2C_4 0xa0e88086 +#define PCI_CHIP_TIGERLAKE_LP_I2C_5 0xa0e98086 +#define PCI_CHIP_TIGERLAKE_LP_I2C_6 0xa0ea8086 +#define PCI_CHIP_TIGERLAKE_LP_I2C_7 0xa0eb8086 struct ig4iic_pci_device { uint32_t devid; @@ -184,6 +199,21 @@ static struct ig4iic_pci_device ig4iic_pci_devices[] = { PCI_CHIP_COMETLAKE_V_I2C_1, "Intel Comet Lake-V I2C Controller-1", IG4_CANNONLAKE}, { PCI_CHIP_COMETLAKE_V_I2C_2, "Intel Comet Lake-V I2C Controller-2", IG4_CANNONLAKE}, { PCI_CHIP_COMETLAKE_V_I2C_3, "Intel Comet Lake-V I2C Controller-3", IG4_CANNONLAKE}, + { PCI_CHIP_TIGERLAKE_H_I2C_0, "Intel Tiger Lake-H I2C Controller-0", IG4_TIGERLAKE}, + { PCI_CHIP_TIGERLAKE_H_I2C_1, "Intel Tiger Lake-H I2C Controller-1", IG4_TIGERLAKE}, + { PCI_CHIP_TIGERLAKE_H_I2C_2, "Intel Tiger Lake-H I2C Controller-2", IG4_TIGERLAKE}, + { PCI_CHIP_TIGERLAKE_H_I2C_3, "Intel Tiger Lake-H I2C Controller-3", IG4_TIGERLAKE}, + { PCI_CHIP_TIGERLAKE_H_I2C_4, "Intel Tiger Lake-H I2C Controller-4", IG4_TIGERLAKE}, + { PCI_CHIP_TIGERLAKE_H_I2C_5, "Intel Tiger Lake-H I2C Controller-5", IG4_TIGERLAKE}, + { PCI_CHIP_TIGERLAKE_H_I2C_6, "Intel Tiger Lake-H I2C Controller-6", IG4_TIGERLAKE}, + { PCI_CHIP_TIGERLAKE_LP_I2C_0, "Intel Tiger Lake-LP I2C Controller-0", IG4_SKYLAKE}, + { PCI_CHIP_TIGERLAKE_LP_I2C_1, "Intel Tiger Lake-LP I2C Controller-1", IG4_SKYLAKE}, + { PCI_CHIP_TIGERLAKE_LP_I2C_2, "Intel Tiger Lake-LP I2C Controller-2", IG4_SKYLAKE}, + { PCI_CHIP_TIGERLAKE_LP_I2C_3, "Intel Tiger Lake-LP I2C Controller-3", IG4_SKYLAKE}, + { PCI_CHIP_TIGERLAKE_LP_I2C_4, "Intel Tiger Lake-LP I2C Controller-4", IG4_SKYLAKE}, + { PCI_CHIP_TIGERLAKE_LP_I2C_5, "Intel Tiger Lake-LP I2C Controller-5", IG4_SKYLAKE}, + { PCI_CHIP_TIGERLAKE_LP_I2C_6, "Intel Tiger Lake-LP I2C Controller-6", IG4_SKYLAKE}, + { PCI_CHIP_TIGERLAKE_LP_I2C_7, "Intel Tiger Lake-LP I2C Controller-7", IG4_SKYLAKE}, }; static int Modified: head/sys/dev/ichiic/ig4_var.h ============================================================================== --- head/sys/dev/ichiic/ig4_var.h Sat Dec 5 10:55:14 2020 (r368365) +++ head/sys/dev/ichiic/ig4_var.h Sat Dec 5 10:57:15 2020 (r368366) @@ -43,10 +43,17 @@ #include "pci_if.h" #include "iicbus_if.h" -enum ig4_vers { IG4_HASWELL, IG4_ATOM, IG4_SKYLAKE, IG4_APL, IG4_CANNONLAKE }; +enum ig4_vers { + IG4_HASWELL, + IG4_ATOM, + IG4_SKYLAKE, + IG4_APL, + IG4_CANNONLAKE, + IG4_TIGERLAKE +}; + /* Controller has additional registers */ -#define IG4_HAS_ADDREGS(vers) ((vers) == IG4_SKYLAKE || \ - (vers) == IG4_APL || (vers) == IG4_CANNONLAKE) +#define IG4_HAS_ADDREGS(vers) ((vers) >= IG4_SKYLAKE) struct ig4_hw { uint32_t ic_clock_rate; /* MHz */ From owner-svn-src-head@freebsd.org Sat Dec 5 11:17:54 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id D6531476EAB; Sat, 5 Dec 2020 11:17:54 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Cp6W65lY9z3Kyc; Sat, 5 Dec 2020 11:17:54 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id B80C91CDCD; Sat, 5 Dec 2020 11:17:54 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B5BHs6H091220; Sat, 5 Dec 2020 11:17:54 GMT (envelope-from mmel@FreeBSD.org) Received: (from mmel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B5BHsXu091218; Sat, 5 Dec 2020 11:17:54 GMT (envelope-from mmel@FreeBSD.org) Message-Id: <202012051117.0B5BHsXu091218@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmel set sender to mmel@FreeBSD.org using -f From: Michal Meloun Date: Sat, 5 Dec 2020 11:17:54 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368367 - in head/sys: arm64/conf modules/dtb/freescale X-SVN-Group: head X-SVN-Commit-Author: mmel X-SVN-Commit-Paths: in head/sys: arm64/conf modules/dtb/freescale X-SVN-Commit-Revision: 368367 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Dec 2020 11:17:54 -0000 Author: mmel Date: Sat Dec 5 11:17:54 2020 New Revision: 368367 URL: https://svnweb.freebsd.org/changeset/base/368367 Log: Connect DTB files based on LX2160A SoC to build. Mainly LX2K Honeycomb and ClearFog-CX boards. Added: head/sys/modules/dtb/freescale/ head/sys/modules/dtb/freescale/Makefile (contents, props changed) Modified: head/sys/arm64/conf/GENERIC Modified: head/sys/arm64/conf/GENERIC ============================================================================== --- head/sys/arm64/conf/GENERIC Sat Dec 5 10:57:15 2020 (r368366) +++ head/sys/arm64/conf/GENERIC Sat Dec 5 11:17:54 2020 (r368367) @@ -367,4 +367,4 @@ options FDT device acpi # DTBs -makeoptions MODULES_EXTRA="dtb/allwinner dtb/imx8 dtb/mv dtb/rockchip dtb/rpi" +makeoptions MODULES_EXTRA="dtb/allwinner dtb/freescale dtb/imx8 dtb/mv dtb/rockchip dtb/rpi" Added: head/sys/modules/dtb/freescale/Makefile ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/modules/dtb/freescale/Makefile Sat Dec 5 11:17:54 2020 (r368367) @@ -0,0 +1,8 @@ +# $FreeBSD$ +# All the dts files for Freescale (now NXP) systems we support. +DTS= freescale/fsl-lx2160a-clearfog-cx.dts \ + freescale/fsl-lx2160a-honeycomb.dts \ + freescale/fsl-lx2160a-qds.dts \ + freescale/fsl-lx2160a-rdb.dts + +.include From owner-svn-src-head@freebsd.org Sat Dec 5 11:18:37 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id ECFF6476F8B; Sat, 5 Dec 2020 11:18:37 +0000 (UTC) (envelope-from gbe@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Cp6Wx6RCnz3LNn; Sat, 5 Dec 2020 11:18:37 +0000 (UTC) (envelope-from gbe@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id CF6591D07E; Sat, 5 Dec 2020 11:18:37 +0000 (UTC) (envelope-from gbe@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B5BIbGC091306; Sat, 5 Dec 2020 11:18:37 GMT (envelope-from gbe@FreeBSD.org) Received: (from gbe@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B5BIbJm091305; Sat, 5 Dec 2020 11:18:37 GMT (envelope-from gbe@FreeBSD.org) Message-Id: <202012051118.0B5BIbJm091305@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: gbe set sender to gbe@FreeBSD.org using -f From: Gordon Bergling Date: Sat, 5 Dec 2020 11:18:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368368 - head/share/man/man9 X-SVN-Group: head X-SVN-Commit-Author: gbe X-SVN-Commit-Paths: head/share/man/man9 X-SVN-Commit-Revision: 368368 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Dec 2020 11:18:38 -0000 Author: gbe (doc committer) Date: Sat Dec 5 11:18:37 2020 New Revision: 368368 URL: https://svnweb.freebsd.org/changeset/base/368368 Log: epoch(9): Fix a few mandoc related issues - sections out of conventional order: Sh EXAMPLES - sections out of conventional order: Sh SEE ALSO - skipping end of block that is not open: El Modified: head/share/man/man9/epoch.9 Modified: head/share/man/man9/epoch.9 ============================================================================== --- head/share/man/man9/epoch.9 Sat Dec 5 11:17:54 2020 (r368367) +++ head/share/man/man9/epoch.9 Sat Dec 5 11:18:37 2020 (r368368) @@ -210,20 +210,6 @@ This function can sleep and is not optimized for perfo .Sh RETURN VALUES .Fn in_epoch curepoch will return 1 if curthread is in curepoch, 0 otherwise. -.Sh CAVEATS -One must be cautious when using -.Fn epoch_wait_preempt . -Threads are pinned during epoch sections, so if a thread in a section is then -preempted by a higher priority compute bound thread on that CPU, it can be -prevented from leaving the section indefinitely. -.Pp -Epochs are not a straight replacement for read locks. -Callers must use safe list and tailq traversal routines in an epoch (see ck_queue). -When modifying a list referenced from an epoch section safe removal -routines must be used and the caller can no longer modify a list entry -in place. -An item to be modified must be handled with copy on write -and frees must be deferred until after a grace period has elapsed. .Sh EXAMPLES Async free example: Thread 1: @@ -280,12 +266,6 @@ free would have to follow a call to The .Nm kernel programming interface is under development and is subject to change. -.El -.Sh HISTORY -The -.Nm -framework first appeared in -.Fx 11.0 . .Sh SEE ALSO .Xr locking 9 , .Xr mtx_pool 9 , @@ -295,3 +275,22 @@ framework first appeared in .Xr sleep 9 , .Xr sx 9 , .Xr timeout 9 +.Sh HISTORY +The +.Nm +framework first appeared in +.Fx 11.0 . +.Sh CAVEATS +One must be cautious when using +.Fn epoch_wait_preempt . +Threads are pinned during epoch sections, so if a thread in a section is then +preempted by a higher priority compute bound thread on that CPU, it can be +prevented from leaving the section indefinitely. +.Pp +Epochs are not a straight replacement for read locks. +Callers must use safe list and tailq traversal routines in an epoch (see ck_queue). +When modifying a list referenced from an epoch section safe removal +routines must be used and the caller can no longer modify a list entry +in place. +An item to be modified must be handled with copy on write +and frees must be deferred until after a grace period has elapsed. From owner-svn-src-head@freebsd.org Sat Dec 5 12:08:38 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7BD61479458; Sat, 5 Dec 2020 12:08:38 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4Cp7df35vpz3PL8; Sat, 5 Dec 2020 12:08:38 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 5D3671D93A; Sat, 5 Dec 2020 12:08:38 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B5C8ct9022773; Sat, 5 Dec 2020 12:08:38 GMT (envelope-from mmel@FreeBSD.org) Received: (from mmel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B5C8b1h022767; Sat, 5 Dec 2020 12:08:37 GMT (envelope-from mmel@FreeBSD.org) Message-Id: <202012051208.0B5C8b1h022767@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmel set sender to mmel@FreeBSD.org using -f From: Michal Meloun Date: Sat, 5 Dec 2020 12:08:37 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368369 - in head/sys: arm/freescale/vybrid arm64/qoriq arm64/qoriq/clk conf dev/ahci dev/iicbus/mux X-SVN-Group: head X-SVN-Commit-Author: mmel X-SVN-Commit-Paths: in head/sys: arm/freescale/vybrid arm64/qoriq arm64/qoriq/clk conf dev/ahci dev/iicbus/mux X-SVN-Commit-Revision: 368369 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Dec 2020 12:08:38 -0000 Author: mmel Date: Sat Dec 5 12:08:37 2020 New Revision: 368369 URL: https://svnweb.freebsd.org/changeset/base/368369 Log: Add basic support for Freescale LX2160A SoC. All peripherals but the network processor are supported. Added: head/sys/arm64/qoriq/clk/lx2160a_clkgen.c (contents, props changed) head/sys/arm64/qoriq/qoriq_dw_pci.c (contents, props changed) head/sys/arm64/qoriq/qoriq_therm.c (contents, props changed) head/sys/arm64/qoriq/qoriq_therm_if.m (contents, props changed) head/sys/dev/iicbus/mux/pca9547.c (contents, props changed) Modified: head/sys/arm/freescale/vybrid/vf_i2c.c head/sys/conf/files head/sys/conf/files.arm64 head/sys/dev/ahci/ahci_fsl_fdt.c Modified: head/sys/arm/freescale/vybrid/vf_i2c.c ============================================================================== --- head/sys/arm/freescale/vybrid/vf_i2c.c Sat Dec 5 11:18:37 2020 (r368368) +++ head/sys/arm/freescale/vybrid/vf_i2c.c Sat Dec 5 12:08:37 2020 (r368369) @@ -147,7 +147,8 @@ static struct i2c_div_type vf610_div_table[] = { { 0x2C, 576 }, { 0x2D, 640 }, { 0x2E, 768 }, { 0x32, 896 }, { 0x2F, 960 }, { 0x33, 1024 }, { 0x34, 1152 }, { 0x35, 1280 }, { 0x36, 1536 }, { 0x3A, 1792 }, { 0x37, 1920 }, { 0x3B, 2048 }, - { 0x3C, 2304 }, { 0x3D, 2560 }, { 0x3E, 3072 }, { 0x3F, 3840 } + { 0x3C, 2304 }, { 0x3D, 2560 }, { 0x3E, 3072 }, { 0x3F, 3840 }, + { 0x3F, 3840 }, { 0x7B, 4096 }, { 0x7D, 5120 }, { 0x7E, 6144 }, }; #endif @@ -307,7 +308,15 @@ wait_for_icf(struct i2c_softc *sc) return (IIC_ETIMEOUT); } +/* Get ACK bit from last write */ +static bool +tx_acked(struct i2c_softc *sc) +{ + return (READ1(sc, I2C_IBSR) & IBSR_RXAK) ? false : true; + +} + static int i2c_repeated_start(device_t dev, u_char slave, int timeout) { @@ -342,6 +351,12 @@ i2c_repeated_start(device_t dev, u_char slave, int tim error = wait_for_iif(sc); + if (!tx_acked(sc)) { + vf_i2c_dbg(sc, + "cant i2c start: missing ACK after slave addres\n"); + return (IIC_ENOACK); + } + mtx_unlock(&sc->mutex); if (error != 0) @@ -384,13 +399,19 @@ i2c_start(device_t dev, u_char slave, int timeout) WRITE1(sc, I2C_IBDR, slave); error = wait_for_iif(sc); - - mtx_unlock(&sc->mutex); if (error != 0) { + mtx_unlock(&sc->mutex); vf_i2c_dbg(sc, "cant i2c start: iif error\n"); return (error); } + mtx_unlock(&sc->mutex); + if (!tx_acked(sc)) { + vf_i2c_dbg(sc, + "cant i2c start: missing QACK after slave addres\n"); + return (IIC_ENOACK); + } + return (IIC_NOERR); } @@ -568,10 +589,15 @@ i2c_write(device_t dev, const char *buf, int len, int return (error); } + if (!tx_acked(sc) && (*sent = (len - 2)) ){ + mtx_unlock(&sc->mutex); + vf_i2c_dbg(sc, "no ACK on %d write\n", *sent); + return (IIC_ENOACK); + } + (*sent)++; } mtx_unlock(&sc->mutex); - return (IIC_NOERR); } @@ -600,14 +626,8 @@ static device_method_t i2c_methods[] = { { 0, 0 } }; -static driver_t i2c_driver = { - "i2c", - i2c_methods, - sizeof(struct i2c_softc), -}; - static devclass_t i2c_devclass; - -DRIVER_MODULE(i2c, simplebus, i2c_driver, i2c_devclass, 0, 0); +static DEFINE_CLASS_0(i2c, i2c_driver, i2c_methods, sizeof(struct i2c_softc)); +DRIVER_MODULE(vybrid_i2c, simplebus, i2c_driver, i2c_devclass, 0, 0); DRIVER_MODULE(iicbus, i2c, iicbus_driver, iicbus_devclass, 0, 0); DRIVER_MODULE(ofw_iicbus, i2c, ofw_iicbus_driver, ofw_iicbus_devclass, 0, 0); Added: head/sys/arm64/qoriq/clk/lx2160a_clkgen.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm64/qoriq/clk/lx2160a_clkgen.c Sat Dec 5 12:08:37 2020 (r368369) @@ -0,0 +1,211 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright 2020 Michal Meloun + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +/* + * Clock driver for LX2160A SoC. + */ +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include + +#include + +#include + +#define PLL(_id1, _id2, cname, o, d) \ +{ \ + .clkdef.id = QORIQ_CLK_ID(_id1, _id2), \ + .clkdef.name = cname, \ + .clkdef.flags = 0, \ + .offset = o, \ + .shift = 1, \ + .mask = 0xFE, \ + .dividers = d, \ + .flags = QORIQ_CLK_PLL_HAS_KILL_BIT, \ +} + +static const uint8_t plt_divs[] = + {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 0}; +static const uint8_t cga_divs[] = {2, 4, 0}; +static const uint8_t cgb_divs[] = {2, 3, 4, 0}; + +static struct qoriq_clk_pll_def pltfrm_pll = + PLL(QORIQ_TYPE_PLATFORM_PLL, 0, "platform_pll", 0x60080, plt_divs); +static struct qoriq_clk_pll_def cga_pll1 = + PLL(QORIQ_TYPE_INTERNAL, 0, "cga_pll1", 0x80, cga_divs); +static struct qoriq_clk_pll_def cga_pll2 = + PLL(QORIQ_TYPE_INTERNAL, 0, "cga_pll2", 0xA0, cga_divs); +static struct qoriq_clk_pll_def cgb_pll1 = + PLL(QORIQ_TYPE_INTERNAL, 0, "cgb_pll1", 0x10080, cgb_divs); +static struct qoriq_clk_pll_def cgb_pll2 = + PLL(QORIQ_TYPE_INTERNAL, 0, "cgb_pll2", 0x100A0, cgb_divs); + +static struct qoriq_clk_pll_def *cg_plls[] = { + &cga_pll1, + &cga_pll2, + &cgb_pll1, + &cgb_pll2, +}; + +#if 0 +static struct qoriq_clk_pll_def *cg_plls[] = { + &(struct qoriq_clk_pll_def) + {PLL(QORIQ_TYPE_INTERNAL, 0, "cga_pll1", 0x80, cg_divs)}, + &(struct qoriq_clk_pll_def) + {PLL(QORIQ_TYPE_INTERNAL, 0, "cga_pll2", 0xA0, cg_divs)}, + &(struct qoriq_clk_pll_def) + {PLL(QORIQ_TYPE_INTERNAL, 0, "cgb_pll1", 0x10080, cg_divs)}, + &(struct qoriq_clk_pll_def) + {PLL(QORIQ_TYPE_INTERNAL, 0, "cgb_pll2", 0x100A0, cg_divs)}, +}; +#endif + +static const char *cmuxa_plist[] = { + "cga_pll1", + "cga_pll1_div2", + "cga_pll1_div4", + NULL, + "cga_pll2", + "cga_pll2_div2", + "cga_pll2_div4", +}; + +static const char *cmuxb_plist[] = { + "cgb_pll1", + "cgb_pll1_div2", + "cgb_pll1_div4", + NULL, + "cgb_pll2", + "cgb_pll2_div2", + "cgb_pll2_div4", +}; + +#define MUX(_id1, _id2, cname, plist, o) \ +{ \ + .clkdef.id = QORIQ_CLK_ID(_id1, _id2), \ + .clkdef.name = cname, \ + .clkdef.parent_names = plist, \ + .clkdef.parent_cnt = nitems(plist), \ + .clkdef.flags = 0, \ + .offset = o, \ + .width = 4, \ + .shift = 27, \ + .mux_flags = 0, \ +} +static struct clk_mux_def cmux0 = + MUX(QORIQ_TYPE_CMUX, 0, "cg-cmux0", cmuxa_plist, 0x70000); +static struct clk_mux_def cmux1 = + MUX(QORIQ_TYPE_CMUX, 1, "cg-cmux1", cmuxa_plist, 0x70020); +static struct clk_mux_def cmux2 = + MUX(QORIQ_TYPE_CMUX, 2, "cg-cmux2", cmuxa_plist, 0x70040); +static struct clk_mux_def cmux3 = + MUX(QORIQ_TYPE_CMUX, 3, "cg-cmux3", cmuxa_plist, 0x70060); +static struct clk_mux_def cmux4 = + MUX(QORIQ_TYPE_CMUX, 4, "cg-cmux4", cmuxb_plist, 0x70080); +static struct clk_mux_def cmux5 = + MUX(QORIQ_TYPE_CMUX, 5, "cg-cmux5", cmuxb_plist, 0x700A0); +static struct clk_mux_def cmux6 = + MUX(QORIQ_TYPE_CMUX, 6, "cg-cmux6", cmuxb_plist, 0x700C0); +static struct clk_mux_def cmux7 = + MUX(QORIQ_TYPE_CMUX, 7, "cg-cmux7", cmuxb_plist, 0x700E0); + +static struct clk_mux_def *mux_nodes[] = { + &cmux0, + &cmux1, + &cmux2, + &cmux3, + &cmux4, + &cmux5, + &cmux6, + &cmux7, +}; + +static int +lx2160a_clkgen_probe(device_t dev) +{ + + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + + if(!ofw_bus_is_compatible(dev, "fsl,lx2160a-clockgen")) + return (ENXIO); + + device_set_desc(dev, "LX2160A clockgen"); + return (BUS_PROBE_DEFAULT); +} + +static int +lx2160a_clkgen_attach(device_t dev) +{ + struct qoriq_clkgen_softc *sc; + int rv; + + sc = device_get_softc(dev); + + sc->pltfrm_pll_def = &pltfrm_pll; + sc->cga_pll = cg_plls; + sc->cga_pll_num = nitems(cg_plls); + sc->mux = mux_nodes; + sc->mux_num = nitems(mux_nodes); + sc->flags = QORIQ_LITTLE_ENDIAN; + + rv = qoriq_clkgen_attach(dev); + + printf(" %s: offset: 0x%08X, val: 0x%08X\n", __func__, 0x00080, bus_read_4(sc->res, 0x00080)); + printf(" %s: offset: 0x%08X, val: 0x%08X\n", __func__, 0x000A0, bus_read_4(sc->res, 0x000A0)); + printf(" %s: offset: 0x%08X, val: 0x%08X\n", __func__, 0x10080, bus_read_4(sc->res, 0x10080)); + printf(" %s: offset: 0x%08X, val: 0x%08X\n", __func__, 0x100A0, bus_read_4(sc->res, 0x100A0)); + printf(" %s: offset: 0x%08X, val: 0x%08X\n", __func__, 0x60080, bus_read_4(sc->res, 0x60080)); + printf(" %s: offset: 0x%08X, val: 0x%08X\n", __func__, 0x600A0, bus_read_4(sc->res, 0x600A0)); + return (rv); +} + +static device_method_t lx2160a_clkgen_methods[] = { + DEVMETHOD(device_probe, lx2160a_clkgen_probe), + DEVMETHOD(device_attach, lx2160a_clkgen_attach), + + DEVMETHOD_END +}; + +static devclass_t lx2160a_clkgen_devclass; + +DEFINE_CLASS_1(lx2160a_clkgen, lx2160a_clkgen_driver, lx2160a_clkgen_methods, + sizeof(struct qoriq_clkgen_softc), qoriq_clkgen_driver); +EARLY_DRIVER_MODULE(lx2160a_clkgen, simplebus, lx2160a_clkgen_driver, + lx2160a_clkgen_devclass, 0, 0, BUS_PASS_BUS + BUS_PASS_ORDER_MIDDLE); Added: head/sys/arm64/qoriq/qoriq_dw_pci.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm64/qoriq/qoriq_dw_pci.c Sat Dec 5 12:08:37 2020 (r368369) @@ -0,0 +1,256 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright 2020 Michal Meloun + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + * + */ + +/* Layerscape DesignWare PCIe driver */ + +#include +__FBSDID("$FreeBSD$"); + + +#include +#include +#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 "pci_dw_if.h" + +#define PCIE_ABSERR 0x8D0 + +struct qoriq_dw_pci_cfg { + uint32_t pex_pf0_dgb; /* offset of PEX_PF0_DBG register */ + uint32_t ltssm_bit; /* LSB bit of of LTSSM state field */ +}; + +struct qorif_dw_pci_softc { + struct pci_dw_softc dw_sc; + device_t dev; + phandle_t node; + struct resource *irq_res; + void *intr_cookie; + struct qoriq_dw_pci_cfg *soc_cfg; + +}; + +static struct qoriq_dw_pci_cfg ls1043_cfg = { + .pex_pf0_dgb = 0x10000 + 0x7FC, + .ltssm_bit = 24, +}; + +static struct qoriq_dw_pci_cfg ls1012_cfg = { + .pex_pf0_dgb = 0x80000 + 0x407FC, + .ltssm_bit = 24, +}; + +static struct qoriq_dw_pci_cfg ls2080_cfg = { + .pex_pf0_dgb = 0x80000 + 0x7FC, + .ltssm_bit = 0, +}; + +static struct qoriq_dw_pci_cfg ls2028_cfg = { + .pex_pf0_dgb = 0x80000 + 0x407FC, + .ltssm_bit = 0, +}; + + +/* Compatible devices. */ +static struct ofw_compat_data compat_data[] = { + {"fsl,ls1012a-pcie", (uintptr_t)&ls1012_cfg}, + {"fsl,ls1028a-pcie", (uintptr_t)&ls2028_cfg}, + {"fsl,ls1043a-pcie", (uintptr_t)&ls1043_cfg}, + {"fsl,ls1046a-pcie", (uintptr_t)&ls1012_cfg}, + {"fsl,ls2080a-pcie", (uintptr_t)&ls2080_cfg}, + {"fsl,ls2085a-pcie", (uintptr_t)&ls2080_cfg}, + {"fsl,ls2088a-pcie", (uintptr_t)&ls2028_cfg}, + {"fsl,ls1088a-pcie", (uintptr_t)&ls2028_cfg}, + {NULL, 0}, +}; + +static void +qorif_dw_pci_dbi_protect(struct qorif_dw_pci_softc *sc, bool protect) +{ + uint32_t reg; + + reg = pci_dw_dbi_rd4(sc->dev, DW_MISC_CONTROL_1); + if (protect) + reg &= ~DBI_RO_WR_EN; + else + reg |= DBI_RO_WR_EN; + pci_dw_dbi_wr4(sc->dev, DW_MISC_CONTROL_1, reg); +} + +static int qorif_dw_pci_intr(void *arg) +{ +#if 0 + struct qorif_dw_pci_softc *sc = arg; + uint32_t cause1, cause2; + + /* Ack all interrups */ + cause1 = pci_dw_dbi_rd4(sc->dev, MV_INT_CAUSE1); + cause2 = pci_dw_dbi_rd4(sc->dev, MV_INT_CAUSE2); + + pci_dw_dbi_wr4(sc->dev, MV_INT_CAUSE1, cause1); + pci_dw_dbi_wr4(sc->dev, MV_INT_CAUSE2, cause2); +#endif + return (FILTER_HANDLED); +} + +static int +qorif_dw_pci_get_link(device_t dev, bool *status) +{ + struct qorif_dw_pci_softc *sc; + uint32_t reg; + + sc = device_get_softc(dev); + reg = pci_dw_dbi_rd4(sc->dev, sc->soc_cfg->pex_pf0_dgb); + reg >>= sc->soc_cfg->ltssm_bit; + reg &= 0x3F; + *status = (reg = 0x11) ? true: false; + return (0); +} + +static void +qorif_dw_pci_init(struct qorif_dw_pci_softc *sc) +{ + +// ls_pcie_disable_outbound_atus(pcie); + + /* Forward error response */ + pci_dw_dbi_wr4(sc->dev, PCIE_ABSERR, 0x9401); + + qorif_dw_pci_dbi_protect(sc, true); + pci_dw_dbi_wr1(sc->dev, PCIR_HDRTYPE, 1); + qorif_dw_pci_dbi_protect(sc, false); + +// ls_pcie_drop_msg_tlp(pcie); + +} + +static int +qorif_dw_pci_probe(device_t dev) +{ + + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + + if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0) + return (ENXIO); + + device_set_desc(dev, "NPX Layaerscape PCI-E Controller"); + return (BUS_PROBE_DEFAULT); +} + +static int +qorif_dw_pci_attach(device_t dev) +{ + struct qorif_dw_pci_softc *sc; + phandle_t node; + int rv; + int rid; + + sc = device_get_softc(dev); + node = ofw_bus_get_node(dev); + sc->dev = dev; + sc->node = node; + sc->soc_cfg = (struct qoriq_dw_pci_cfg *) + ofw_bus_search_compatible(dev, compat_data)->ocd_data; + + rid = 0; + sc->dw_sc.dbi_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, + RF_ACTIVE); + if (sc->dw_sc.dbi_res == NULL) { + device_printf(dev, "Cannot allocate DBI memory\n"); + rv = ENXIO; + goto out; + } + + /* PCI interrupt */ + rid = 0; + sc->irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, + RF_ACTIVE | RF_SHAREABLE); + if (sc->irq_res == NULL) { + device_printf(dev, "Cannot allocate IRQ resources\n"); + rv = ENXIO; + goto out; + } + + rv = pci_dw_init(dev); + if (rv != 0) + goto out; + + qorif_dw_pci_init(sc); + + /* Setup interrupt */ + if (bus_setup_intr(dev, sc->irq_res, INTR_TYPE_MISC | INTR_MPSAFE, + qorif_dw_pci_intr, NULL, sc, &sc->intr_cookie)) { + device_printf(dev, "cannot setup interrupt handler\n"); + rv = ENXIO; + goto out; + } + + return (bus_generic_attach(dev)); +out: + /* XXX Cleanup */ + return (rv); +} + +static device_method_t qorif_dw_pci_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, qorif_dw_pci_probe), + DEVMETHOD(device_attach, qorif_dw_pci_attach), + + DEVMETHOD(pci_dw_get_link, qorif_dw_pci_get_link), + + DEVMETHOD_END +}; + +DEFINE_CLASS_1(pcib, qorif_dw_pci_driver, qorif_dw_pci_methods, + sizeof(struct qorif_dw_pci_softc), pci_dw_driver); +static devclass_t qorif_dw_pci_devclass; +DRIVER_MODULE( qorif_dw_pci, simplebus, qorif_dw_pci_driver, qorif_dw_pci_devclass, + NULL, NULL); Added: head/sys/arm64/qoriq/qoriq_therm.c ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm64/qoriq/qoriq_therm.c Sat Dec 5 12:08:37 2020 (r368369) @@ -0,0 +1,406 @@ +/*- + * + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright 2020 Michal Meloun + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +/* + * Thermometer driver for QorIQ SoCs. + */ +#include +#include +#include +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include + +#include "qoriq_therm_if.h" + +#define TMU_TMR 0x00 +#define TMU_TSR 0x04 +#define TMUV1_TMTMIR 0x08 +#define TMUV2_TMSR 0x08 +#define TMUV2_TMTMIR 0x0C +#define TMU_TIER 0x20 +#define TMU_TTCFGR 0x80 +#define TMU_TSCFGR 0x84 +#define TMU_TRITSR(x) (0x100 + (16 * (x))) +#define TMU_TRITSR_VALID (1U << 31) +#define TMUV2_TMSAR(x) (0x304 + (16 * (x))) +#define TMU_VERSION 0xBF8 /* not in TRM */ +#define TMUV2_TEUMR(x) (0xF00 + (4 * (x))) +#define TMU_TTRCR(x) (0xF10 + (4 * (x))) + + +struct tsensor { + int site_id; + char *name; + int id; +}; + +struct qoriq_therm_softc { + device_t dev; + struct resource *mem_res; + struct resource *irq_res; + void *irq_ih; + int ntsensors; + struct tsensor *tsensors; + bool little_endian; + clk_t clk; + int ver; +}; + +static struct sysctl_ctx_list qoriq_therm_sysctl_ctx; + +struct tsensor default_sensors[] = +{ + { 0, "site0", 0}, + { 1, "site1", 1}, + { 2, "site2", 2}, + { 3, "site3", 3}, + { 4, "site4", 4}, + { 5, "site5", 5}, + { 6, "site6", 6}, +}; + +static struct ofw_compat_data compat_data[] = { + {"fsl,qoriq-tmu", 1}, + {"fsl,imx8mq-tmu", 1}, + {NULL, 0}, +}; + +static inline void +WR4(struct qoriq_therm_softc *sc, bus_size_t addr, uint32_t val) +{ + + val = sc->little_endian ? htole32(val): htobe32(val); + bus_write_4(sc->mem_res, addr, val); +} + +static inline uint32_t +RD4(struct qoriq_therm_softc *sc, bus_size_t addr) +{ + uint32_t val; + + val = bus_read_4(sc->mem_res, addr); + return (sc->little_endian ? le32toh(val): be32toh(val)); +} + +static int +qoriq_therm_read_temp(struct qoriq_therm_softc *sc, struct tsensor *sensor, + int *temp) +{ + int timeout; + uint32_t val; + + /* wait for valid sample */ + for (timeout = 1000; timeout > 0; timeout--) { + val = RD4(sc, TMU_TRITSR(sensor->site_id)); + if (val & TMU_TRITSR_VALID) + break; + DELAY(100); + } + if (timeout <= 0) + device_printf(sc->dev, "Sensor %s timeouted\n", sensor->name); + + *temp = (int)(val & 0x1FF) * 1000; + if (sc->ver == 1) + *temp = (int)(val & 0xFF) * 1000; + else + *temp = (int)(val & 0x1FF) * 1000 - 273100; + + return (0); +} + +static int +qoriq_therm_get_temp(device_t dev, device_t cdev, uintptr_t id, int *val) +{ + struct qoriq_therm_softc *sc; + + sc = device_get_softc(dev); + if (id >= sc->ntsensors) + return (ERANGE); + return(qoriq_therm_read_temp(sc, sc->tsensors + id, val)); +} + +static int +qoriq_therm_sysctl_temperature(SYSCTL_HANDLER_ARGS) +{ + struct qoriq_therm_softc *sc; + int val; + int rv; + int id; + + /* Write request */ + if (req->newptr != NULL) + return (EINVAL); + + sc = arg1; + id = arg2; + + if (id >= sc->ntsensors) + return (ERANGE); + rv = qoriq_therm_read_temp(sc, sc->tsensors + id, &val); + if (rv != 0) + return (rv); + + val = val / 100; + val += 2731; + rv = sysctl_handle_int(oidp, &val, 0, req); + return (rv); +} + +static int +qoriq_therm_init_sysctl(struct qoriq_therm_softc *sc) +{ + int i; + struct sysctl_oid *oid, *tmp; + + sysctl_ctx_init(&qoriq_therm_sysctl_ctx); + /* create node for hw.temp */ + oid = SYSCTL_ADD_NODE(&qoriq_therm_sysctl_ctx, + SYSCTL_STATIC_CHILDREN(_hw), OID_AUTO, "temperature", + CTLFLAG_RD | CTLFLAG_MPSAFE, NULL, ""); + if (oid == NULL) + return (ENXIO); + + /* add sensors */ + for (i = sc->ntsensors - 1; i >= 0; i--) { + tmp = SYSCTL_ADD_PROC(&qoriq_therm_sysctl_ctx, + SYSCTL_CHILDREN(oid), OID_AUTO, sc->tsensors[i].name, + CTLTYPE_INT | CTLFLAG_RD , sc, i, + qoriq_therm_sysctl_temperature, "IK", "SoC Temperature"); + if (tmp == NULL) + return (ENXIO); + } + return (0); +} + +static int +qoriq_therm_fdt_calib(struct qoriq_therm_softc *sc, phandle_t node) +{ + int nranges, ncalibs, i; + int *ranges, *calibs; + + /* initialize temperature range control registes */ + nranges = OF_getencprop_alloc_multi(node, "fsl,tmu-range", + sizeof(*ranges), (void **)&ranges); + if (nranges < 2 || nranges > 4) { + device_printf(sc->dev, "Invalid 'tmu-range' property\n"); + return (ERANGE); + } + for (i = 0; i < nranges; i++) { + WR4(sc, TMU_TTRCR(i), ranges[i]); + } + + /* initialize calibration data for above ranges */ + ncalibs = OF_getencprop_alloc_multi(node, "fsl,tmu-calibration", + sizeof(*calibs),(void **)&calibs); + if (ncalibs <= 0 || (ncalibs % 2) != 0) { + device_printf(sc->dev, "Invalid 'tmu-calibration' property\n"); + return (ERANGE); + } + for (i = 0; i < ncalibs; i +=2) { + WR4(sc, TMU_TTCFGR, calibs[i]); + WR4(sc, TMU_TSCFGR, calibs[i + 1]); + } + + return (0); +} + +static int +qoriq_therm_probe(device_t dev) +{ + + if (!ofw_bus_status_okay(dev)) + return (ENXIO); + + if (ofw_bus_search_compatible(dev, compat_data)->ocd_data == 0) + return (ENXIO); + + device_set_desc(dev, "QorIQ temperature sensors"); + return (BUS_PROBE_DEFAULT); +} + +static int +qoriq_therm_attach(device_t dev) +{ + struct qoriq_therm_softc *sc; + phandle_t node; + uint32_t sites; + int rid, rv; + + sc = device_get_softc(dev); + sc->dev = dev; + node = ofw_bus_get_node(sc->dev); + sc->little_endian = OF_hasprop(node, "little-endian"); + + rid = 0; + sc->mem_res = bus_alloc_resource_any(dev, SYS_RES_MEMORY, &rid, + RF_ACTIVE); + if (sc->mem_res == NULL) { + device_printf(dev, "Cannot allocate memory resources\n"); + goto fail; + } + + rid = 0; + sc->irq_res = bus_alloc_resource_any(dev, SYS_RES_IRQ, &rid, RF_ACTIVE); + if (sc->irq_res == NULL) { + device_printf(dev, "Cannot allocate IRQ resources\n"); + goto fail; + } + +/* + if ((bus_setup_intr(dev, sc->irq_res, INTR_TYPE_MISC | INTR_MPSAFE, + qoriq_therm_intr, NULL, sc, &sc->irq_ih))) { + device_printf(dev, + "WARNING: unable to register interrupt handler\n"); + goto fail; + } +*/ + rv = clk_get_by_ofw_index(dev, 0, 0, &sc->clk); + if (rv != 0 && rv != ENOENT) { + device_printf(dev, "Cannot get clock: %d %d\n", rv, ENOENT); + goto fail; + } + if (sc->clk != NULL) { + rv = clk_enable(sc->clk); + if (rv != 0) { + device_printf(dev, "Cannot enable clock: %d\n", rv); + goto fail; + } + } + + sc->ver = (RD4(sc, TMU_VERSION) >> 8) & 0xFF; + + /* XXX add per SoC customization */ + sc->ntsensors = nitems(default_sensors); + sc->tsensors = default_sensors; + + /* stop monitoring */ + WR4(sc, TMU_TMR, 0); + RD4(sc, TMU_TMR); + + /* disable all interrupts */ + WR4(sc, TMU_TIER, 0); + + /* setup measurement interval */ + if (sc->ver == 1) { + WR4(sc, TMUV1_TMTMIR, 0x0F); + } else { + WR4(sc, TMUV2_TMTMIR, 0x0F); /* disable */ + /* these registers are not of settings is not in TRM */ + WR4(sc, TMUV2_TEUMR(0), 0x51009c00); + for (int i = 0; i < 7; i++) + WR4(sc, TMUV2_TMSAR(0), 0xE); + } + + /* prepare calibration tables */ + rv = qoriq_therm_fdt_calib(sc, node); + if (rv != 0) { + device_printf(sc->dev, + "Cannot initialize calibration tables\n"); + goto fail; + } + /* start monitoring */ + sites = (1U << sc->ntsensors) - 1; + if (sc->ver == 1) { + WR4(sc, TMU_TMR, 0x8C000000 | sites); + } else { + WR4(sc, TMUV2_TMSR, sites); + WR4(sc, TMU_TMR, 0x83000000); + } + + rv = qoriq_therm_init_sysctl(sc); + if (rv != 0) { + device_printf(sc->dev, "Cannot initialize sysctls\n"); + goto fail; + } + + OF_device_register_xref(OF_xref_from_node(node), dev); + return (bus_generic_attach(dev)); + +fail: + if (sc->irq_ih != NULL) + bus_teardown_intr(dev, sc->irq_res, sc->irq_ih); + sysctl_ctx_free(&qoriq_therm_sysctl_ctx); + if (sc->clk != NULL) + clk_release(sc->clk); + if (sc->irq_res != NULL) + bus_release_resource(dev, SYS_RES_IRQ, 0, sc->irq_res); + if (sc->mem_res != NULL) + bus_release_resource(dev, SYS_RES_MEMORY, 0, sc->mem_res); + + return (ENXIO); +} + +static int +qoriq_therm_detach(device_t dev) +{ + struct qoriq_therm_softc *sc; + sc = device_get_softc(dev); + + if (sc->irq_ih != NULL) + bus_teardown_intr(dev, sc->irq_res, sc->irq_ih); + sysctl_ctx_free(&qoriq_therm_sysctl_ctx); + if (sc->clk != NULL) + clk_release(sc->clk); + if (sc->irq_res != NULL) + bus_release_resource(dev, SYS_RES_IRQ, 0, sc->irq_res); + if (sc->mem_res != NULL) + bus_release_resource(dev, SYS_RES_MEMORY, 0, sc->mem_res); + + return (0); +} + +static device_method_t qoriq_qoriq_therm_methods[] = { + /* Device interface */ + DEVMETHOD(device_probe, qoriq_therm_probe), + DEVMETHOD(device_attach, qoriq_therm_attach), + DEVMETHOD(device_detach, qoriq_therm_detach), + + /* SOCTHERM interface */ + DEVMETHOD(qoriq_therm_get_temperature, qoriq_therm_get_temp), + + DEVMETHOD_END +}; + +static devclass_t qoriq_qoriq_therm_devclass; +static DEFINE_CLASS_0(soctherm, qoriq_qoriq_therm_driver, qoriq_qoriq_therm_methods, + sizeof(struct qoriq_therm_softc)); +DRIVER_MODULE(qoriq_soctherm, simplebus, qoriq_qoriq_therm_driver, + qoriq_qoriq_therm_devclass, NULL, NULL); Added: head/sys/arm64/qoriq/qoriq_therm_if.m ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/arm64/qoriq/qoriq_therm_if.m Sat Dec 5 12:08:37 2020 (r368369) @@ -0,0 +1,44 @@ +#- +# +# SPDX-License-Identifier: BSD-2-Clause-FreeBSD +# +# Copyright 2020 Michal Meloun +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# 1. Redistributions of source code must retain the above copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the above copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND +# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE +# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE *** DIFF OUTPUT TRUNCATED AT 1000 LINES *** From owner-svn-src-head@freebsd.org Sat Dec 5 14:06:02 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id B3F6947C8AB; Sat, 5 Dec 2020 14:06:02 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CpBF64gm8z3mgJ; Sat, 5 Dec 2020 14:06:02 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 934E81F301; Sat, 5 Dec 2020 14:06:02 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B5E62so008711; Sat, 5 Dec 2020 14:06:02 GMT (envelope-from mmel@FreeBSD.org) Received: (from mmel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B5E62TM008708; Sat, 5 Dec 2020 14:06:02 GMT (envelope-from mmel@FreeBSD.org) Message-Id: <202012051406.0B5E62TM008708@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmel set sender to mmel@FreeBSD.org using -f From: Michal Meloun Date: Sat, 5 Dec 2020 14:06:01 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368370 - in head/sys/arm64: arm64 include X-SVN-Group: head X-SVN-Commit-Author: mmel X-SVN-Commit-Paths: in head/sys/arm64: arm64 include X-SVN-Commit-Revision: 368370 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Dec 2020 14:06:02 -0000 Author: mmel Date: Sat Dec 5 14:06:01 2020 New Revision: 368370 URL: https://svnweb.freebsd.org/changeset/base/368370 Log: Simplify startup of secondary cores and store MPIDR register to pcpu. - record MPIDR for all started cores in pcpu, they will be used as link between physical locality of given core, ID in external description (FDT or ACPI) and cupid. - because of above, cpuid can (and should) be freely assigned, only boot CPU must have cpuid 0. Simplify startup code according this. Please note that pure cpuid is not sufficient instrument to hold any information about core or cluster topology, nor to determistically iterate over subpart of cores in CPU (iterate over all cores in single cluster for example). Situation is more complicated by fact that PSCI can reject start of core without reporting error (because power budget for example), or by fact that is possible that we booted on non-first core in cluster (thus with cpuid 0 assigned to random core). Given cores topology should be exhibited to other parts of system (for example to scheduler for big.little or multicluster systems) by using smp_topo interface. Differential Revision: https://reviews.freebsd.org/D13863 Modified: head/sys/arm64/arm64/machdep.c head/sys/arm64/arm64/mp_machdep.c head/sys/arm64/include/pcpu.h Modified: head/sys/arm64/arm64/machdep.c ============================================================================== --- head/sys/arm64/arm64/machdep.c Sat Dec 5 12:08:37 2020 (r368369) +++ head/sys/arm64/arm64/machdep.c Sat Dec 5 14:06:01 2020 (r368370) @@ -661,6 +661,7 @@ cpu_pcpu_init(struct pcpu *pcpu, int cpuid, size_t siz { pcpu->pc_acpi_id = 0xffffffff; + pcpu->pc_mpidr = 0xffffffff; } void Modified: head/sys/arm64/arm64/mp_machdep.c ============================================================================== --- head/sys/arm64/arm64/mp_machdep.c Sat Dec 5 12:08:37 2020 (r368369) +++ head/sys/arm64/arm64/mp_machdep.c Sat Dec 5 14:06:01 2020 (r368370) @@ -125,12 +125,9 @@ static void ipi_stop(void *); struct pcb stoppcbs[MAXCPU]; -/* - * Not all systems boot from the first CPU in the device tree. To work around - * this we need to find which CPU we have booted from so when we later - * enable the secondary CPUs we skip this one. - */ -static int cpu0 = -1; +#ifdef FDT +static u_int fdt_cpuid; +#endif void mpentry(unsigned long cpuid); void init_secondary(uint64_t); @@ -432,36 +429,23 @@ cpu_mp_probe(void) } static bool -start_cpu(u_int id, uint64_t target_cpu) +start_cpu(u_int cpuid, uint64_t target_cpu) { struct pcpu *pcpup; vm_paddr_t pa; - u_int cpuid; int err, naps; /* Check we are able to start this cpu */ - if (id > mp_maxid) + if (cpuid > mp_maxid) return (false); - KASSERT(id < MAXCPU, ("Too many CPUs")); + KASSERT(cpuid < MAXCPU, ("Too many CPUs")); + KASSERT(__pcpu[0].pc_mpidr != (target_cpu & CPU_AFF_MASK), + ("Start_cpu() was called on the boot CPU")); - /* We are already running on cpu 0 */ - if (id == cpu0) - return (true); - - /* - * Rotate the CPU IDs to put the boot CPU as CPU 0. We keep the other - * CPUs ordered as they are likely grouped into clusters so it can be - * useful to keep that property, e.g. for the GICv3 driver to send - * an IPI to all CPUs in the cluster. - */ - cpuid = id; - if (cpuid < cpu0) - cpuid += mp_maxid + 1; - cpuid -= cpu0; - pcpup = &__pcpu[cpuid]; pcpu_init(pcpup, cpuid, sizeof(struct pcpu)); + pcpup->pc_mpidr = target_cpu & CPU_AFF_MASK; dpcpu[cpuid - 1] = (void *)kmem_malloc(DPCPU_SIZE, M_WAITOK | M_ZERO); dpcpu_init(dpcpu[cpuid - 1], cpuid); @@ -483,7 +467,7 @@ start_cpu(u_int id, uint64_t target_cpu) KASSERT(err == PSCI_MISSING || (mp_quirks & MP_QUIRK_CPULIST) == MP_QUIRK_CPULIST, ("Failed to start CPU %u (%lx), error %d\n", - id, target_cpu, err)); + cpuid, target_cpu, err)); pcpu_destroy(pcpup); kmem_free((vm_offset_t)dpcpu[cpuid - 1], DPCPU_SIZE); @@ -492,9 +476,6 @@ start_cpu(u_int id, uint64_t target_cpu) bootstacks[cpuid] = NULL; mp_ncpus--; - /* Notify the user that the CPU failed to start */ - printf("Failed to start CPU %u (%lx), error %d\n", - id, target_cpu, err); } else { /* Wait for the AP to switch to its boot stack. */ while (atomic_load_int(&aps_started) < naps + 1) @@ -518,6 +499,13 @@ madt_handler(ACPI_SUBTABLE_HEADER *entry, void *arg) intr = (ACPI_MADT_GENERIC_INTERRUPT *)entry; cpuid = arg; id = *cpuid; + + /* Skip the boot CPU, but save its ACPI id. */ + if (__pcpu[0].pc_mpidr == (intr->ArmMpidr & CPU_AFF_MASK)) { + __pcpu[0].pc_acpi_id = intr->Uid; + break; + } + start_cpu(id, intr->ArmMpidr); __pcpu[id].pc_acpi_id = intr->Uid; (*cpuid)++; @@ -543,8 +531,8 @@ cpu_init_acpi(void) printf("Unable to map the MADT, not starting APs\n"); return; } - - cpuid = 0; + /* Boot CPU is always 0 */ + cpuid = 1; acpi_walk_subtables(madt + 1, (char *)madt + madt->Header.Length, madt_handler, &cpuid); @@ -569,16 +557,21 @@ cpu_init_fdt(u_int id, phandle_t node, u_int addr_size target_cpu |= reg[1]; } - if (!start_cpu(id, target_cpu)) + /* Skip boot CPU */ + if (__pcpu[0].pc_mpidr == (target_cpu & CPU_AFF_MASK)) + return (TRUE); + + if (!start_cpu(fdt_cpuid, target_cpu)) return (FALSE); + fdt_cpuid++; /* Try to read the numa node of this cpu */ if (vm_ndomains == 1 || OF_getencprop(node, "numa-node-id", &domain, sizeof(domain)) <= 0) domain = 0; - __pcpu[id].pc_domain = domain; + __pcpu[fdt_cpuid].pc_domain = domain; if (domain < MAXMEMDOM) - CPU_SET(id, &cpuset_domain[domain]); + CPU_SET(fdt_cpuid, &cpuset_domain[domain]); return (TRUE); } @@ -590,18 +583,19 @@ cpu_mp_start(void) { #ifdef FDT phandle_t node; - int i; #endif + int i; mtx_init(&ap_boot_mtx, "ap boot", NULL, MTX_SPIN); + /* CPU 0 is always boot CPU. */ CPU_SET(0, &all_cpus); + __pcpu[0].pc_mpidr = READ_SPECIALREG(mpidr_el1) & CPU_AFF_MASK; switch(arm64_bus_method) { #ifdef DEV_ACPI case ARM64_BUS_ACPI: mp_quirks = MP_QUIRK_CPULIST; - KASSERT(cpu0 >= 0, ("Current CPU was not found")); cpu_init_acpi(); break; #endif @@ -614,7 +608,7 @@ cpu_mp_start(void) mp_quirks = fdt_quirks[i].quirks; } } - KASSERT(cpu0 >= 0, ("Current CPU was not found")); + fdt_cpuid = 1; ofw_cpu_early_foreach(cpu_init_fdt, true); break; #endif @@ -635,16 +629,10 @@ cpu_count_acpi_handler(ACPI_SUBTABLE_HEADER *entry, vo { ACPI_MADT_GENERIC_INTERRUPT *intr; u_int *cores = arg; - uint64_t mpidr_reg; switch(entry->Type) { case ACPI_MADT_TYPE_GENERIC_INTERRUPT: intr = (ACPI_MADT_GENERIC_INTERRUPT *)entry; - if (cpu0 < 0) { - mpidr_reg = READ_SPECIALREG(mpidr_el1); - if ((mpidr_reg & 0xff00fffffful) == intr->ArmMpidr) - cpu0 = *cores; - } (*cores)++; break; default: @@ -679,29 +667,6 @@ cpu_count_acpi(void) } #endif -#ifdef FDT -static boolean_t -cpu_find_cpu0_fdt(u_int id, phandle_t node, u_int addr_size, pcell_t *reg) -{ - uint64_t mpidr_fdt, mpidr_reg; - - if (cpu0 < 0) { - mpidr_fdt = reg[0]; - if (addr_size == 2) { - mpidr_fdt <<= 32; - mpidr_fdt |= reg[1]; - } - - mpidr_reg = READ_SPECIALREG(mpidr_el1); - - if ((mpidr_reg & 0xff00fffffful) == mpidr_fdt) - cpu0 = id; - } - - return (TRUE); -} -#endif - void cpu_mp_setmaxid(void) { @@ -726,7 +691,7 @@ cpu_mp_setmaxid(void) #endif #ifdef FDT case ARM64_BUS_FDT: - cores = ofw_cpu_early_foreach(cpu_find_cpu0_fdt, false); + cores = ofw_cpu_early_foreach(NULL, false); if (cores > 0) { cores = MIN(cores, MAXCPU); if (bootverbose) Modified: head/sys/arm64/include/pcpu.h ============================================================================== --- head/sys/arm64/include/pcpu.h Sat Dec 5 12:08:37 2020 (r368369) +++ head/sys/arm64/include/pcpu.h Sat Dec 5 14:06:01 2020 (r368370) @@ -48,7 +48,8 @@ struct debug_monitor_state; struct pmap *pc_curpmap; \ struct pmap *pc_curvmpmap; \ u_int pc_bcast_tlbi_workaround; \ - char __pad[205] + u_int pc_mpidr; /* stored MPIDR value */ \ + char __pad[201] #ifdef _KERNEL From owner-svn-src-head@freebsd.org Sat Dec 5 14:38:47 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 7493B47D6BB; Sat, 5 Dec 2020 14:38:47 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CpByv2rjgz3pTr; Sat, 5 Dec 2020 14:38:47 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 54A471F5C0; Sat, 5 Dec 2020 14:38:47 +0000 (UTC) (envelope-from kevans@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B5EclwN027618; Sat, 5 Dec 2020 14:38:47 GMT (envelope-from kevans@FreeBSD.org) Received: (from kevans@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B5Eckwq027615; Sat, 5 Dec 2020 14:38:46 GMT (envelope-from kevans@FreeBSD.org) Message-Id: <202012051438.0B5Eckwq027615@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: kevans set sender to kevans@FreeBSD.org using -f From: Kyle Evans Date: Sat, 5 Dec 2020 14:38:46 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368371 - in head/contrib/netbsd-tests/lib/libc/regex: . data X-SVN-Group: head X-SVN-Commit-Author: kevans X-SVN-Commit-Paths: in head/contrib/netbsd-tests/lib/libc/regex: . data X-SVN-Commit-Revision: 368371 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Dec 2020 14:38:47 -0000 Author: kevans Date: Sat Dec 5 14:38:46 2020 New Revision: 368371 URL: https://svnweb.freebsd.org/changeset/base/368371 Log: libc: regex: partial revert of r368358 Part of the libregex functionality leaked into the tests it shares with the standard regex(3). Introduce a P flag to set the REG_POSIX cflag to indicate that libc regex should effectively do nothing while libregex should specifically run it in non-extended mode. This unbreaks the libc/regex test run. Reported by: Jenkins Modified: head/contrib/netbsd-tests/lib/libc/regex/README head/contrib/netbsd-tests/lib/libc/regex/data/meta.in head/contrib/netbsd-tests/lib/libc/regex/main.c Modified: head/contrib/netbsd-tests/lib/libc/regex/README ============================================================================== --- head/contrib/netbsd-tests/lib/libc/regex/README Sat Dec 5 14:06:01 2020 (r368370) +++ head/contrib/netbsd-tests/lib/libc/regex/README Sat Dec 5 14:38:46 2020 (r368371) @@ -28,6 +28,7 @@ The full list of flags: $ REG_NOTEOL # REG_STARTEND (see below) p REG_PEND + P REG_POSIX For REG_STARTEND, the start/end offsets are those of the substring enclosed in (). Modified: head/contrib/netbsd-tests/lib/libc/regex/data/meta.in ============================================================================== --- head/contrib/netbsd-tests/lib/libc/regex/data/meta.in Sat Dec 5 14:06:01 2020 (r368370) +++ head/contrib/netbsd-tests/lib/libc/regex/data/meta.in Sat Dec 5 14:38:46 2020 (r368371) @@ -5,7 +5,7 @@ a\*c & a*c a*c a\\b & a\b a\b a\\\*b & a\*b a\*b # Begin FreeBSD -a\bc & abc +a\bc &CP EESCAPE # End FreeBSD a\ &C EESCAPE a\\bc & a\bc a\bc Modified: head/contrib/netbsd-tests/lib/libc/regex/main.c ============================================================================== --- head/contrib/netbsd-tests/lib/libc/regex/main.c Sat Dec 5 14:06:01 2020 (r368370) +++ head/contrib/netbsd-tests/lib/libc/regex/main.c Sat Dec 5 14:38:46 2020 (r368371) @@ -338,7 +338,7 @@ options(int type, char *s) { char *p; int o = (type == 'c') ? copts : eopts; - const char *legal = (type == 'c') ? "bisnmp" : "^$#tl"; + const char *legal = (type == 'c') ? "bisnmpP" : "^$#tl"; for (p = s; *p != '\0'; p++) if (strchr(legal, *p) != NULL) @@ -361,6 +361,9 @@ options(int type, char *s) break; case 'p': o |= REG_PEND; + break; + case 'P': + o |= REG_POSIX; break; case '^': o |= REG_NOTBOL; From owner-svn-src-head@freebsd.org Sat Dec 5 14:53:25 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 9CB0247E0A0; Sat, 5 Dec 2020 14:53:25 +0000 (UTC) (envelope-from tijl@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CpCHn43FGz3qfv; Sat, 5 Dec 2020 14:53:25 +0000 (UTC) (envelope-from tijl@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 7DD6C1F863; Sat, 5 Dec 2020 14:53:25 +0000 (UTC) (envelope-from tijl@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B5ErP3H039878; Sat, 5 Dec 2020 14:53:25 GMT (envelope-from tijl@FreeBSD.org) Received: (from tijl@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B5ErO5A039875; Sat, 5 Dec 2020 14:53:24 GMT (envelope-from tijl@FreeBSD.org) Message-Id: <202012051453.0B5ErO5A039875@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: tijl set sender to tijl@FreeBSD.org using -f From: Tijl Coosemans Date: Sat, 5 Dec 2020 14:53:24 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368372 - in head/sys: amd64/linux32 conf modules/linux X-SVN-Group: head X-SVN-Commit-Author: tijl X-SVN-Commit-Paths: in head/sys: amd64/linux32 conf modules/linux X-SVN-Commit-Revision: 368372 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Dec 2020 14:53:25 -0000 Author: tijl Date: Sat Dec 5 14:53:24 2020 New Revision: 368372 URL: https://svnweb.freebsd.org/changeset/base/368372 Log: Fix i386 linux module after r367395. In r367395 parts of machine dependent linux_dummy.c were moved to a new machine independent file sys/compat/linux/linux_dummy.c and the existing linux_dummy.c was renamed to linux_dummy_machdep.c. Add linux_dummy_machdep.c to the linux module for i386. Rename sys/amd64/linux32/linux_dummy.c for consistency. Add the new linux_dummy.c to the linux module for i386. Added: head/sys/amd64/linux32/linux32_dummy_machdep.c - copied unchanged from r368371, head/sys/amd64/linux32/linux32_dummy.c Deleted: head/sys/amd64/linux32/linux32_dummy.c Modified: head/sys/conf/files.amd64 head/sys/modules/linux/Makefile Copied: head/sys/amd64/linux32/linux32_dummy_machdep.c (from r368371, head/sys/amd64/linux32/linux32_dummy.c) ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sys/amd64/linux32/linux32_dummy_machdep.c Sat Dec 5 14:53:24 2020 (r368372, copy of r368371, head/sys/amd64/linux32/linux32_dummy.c) @@ -0,0 +1,89 @@ +/*- + * SPDX-License-Identifier: BSD-2-Clause-FreeBSD + * + * Copyright (c) 1994-1995 Søren Schmidt + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * + * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. + */ + +#include +__FBSDID("$FreeBSD$"); + +#include +#include +#include +#include +#include + +#include +#include +#include +#include + +/* DTrace init */ +LIN_SDT_PROVIDER_DECLARE(LINUX_DTRACE); + +UNIMPLEMENTED(break); +UNIMPLEMENTED(ftime); +UNIMPLEMENTED(gtty); +UNIMPLEMENTED(stty); +UNIMPLEMENTED(lock); +UNIMPLEMENTED(mpx); +UNIMPLEMENTED(prof); +UNIMPLEMENTED(profil); +UNIMPLEMENTED(ulimit); + +DUMMY(stime); +DUMMY(olduname); +DUMMY(uname); +DUMMY(bdflush); +DUMMY(ptrace); +DUMMY(mq_open); +DUMMY(mq_unlink); +DUMMY(mq_timedsend); +DUMMY(mq_timedreceive); +DUMMY(mq_notify); +DUMMY(mq_getsetattr); +/* Linux 4.11: */ +DUMMY(arch_prctl); +/* Linux 5.0: */ +DUMMY(clock_gettime64); +DUMMY(clock_settime64); +DUMMY(clock_adjtime64); +DUMMY(clock_getres_time64); +DUMMY(clock_nanosleep_time64); +DUMMY(timer_gettime64); +DUMMY(timer_settime64); +DUMMY(timerfd_gettime64); +DUMMY(timerfd_settime64); +DUMMY(utimensat_time64); +DUMMY(pselect6_time64); +DUMMY(ppoll_time64); +DUMMY(io_pgetevents_time64); +DUMMY(recvmmsg_time64); +DUMMY(mq_timedsend_time64); +DUMMY(mq_timedreceive_time64); +DUMMY(semtimedop_time64); +DUMMY(rt_sigtimedwait_time64); +DUMMY(futex_time64); +DUMMY(sched_rr_get_interval_time64); Modified: head/sys/conf/files.amd64 ============================================================================== --- head/sys/conf/files.amd64 Sat Dec 5 14:38:46 2020 (r368371) +++ head/sys/conf/files.amd64 Sat Dec 5 14:53:24 2020 (r368372) @@ -405,7 +405,7 @@ compat/linsysfs/linsysfs.c optional linsysfs # # Linux/i386 binary support # -amd64/linux32/linux32_dummy.c optional compat_linux32 +amd64/linux32/linux32_dummy_machdep.c optional compat_linux32 amd64/linux32/linux32_machdep.c optional compat_linux32 amd64/linux32/linux32_support.s optional compat_linux32 \ dependency "linux32_assym.h" Modified: head/sys/modules/linux/Makefile ============================================================================== --- head/sys/modules/linux/Makefile Sat Dec 5 14:38:46 2020 (r368371) +++ head/sys/modules/linux/Makefile Sat Dec 5 14:53:24 2020 (r368372) @@ -13,7 +13,7 @@ CFLAGS+=-DCOMPAT_FREEBSD32 -DCOMPAT_LINUX32 VDSO= linux${SFX}_vdso KMOD= linux -SRCS= linux_fork.c linux${SFX}_dummy.c linux_file.c linux_event.c \ +SRCS= linux_fork.c linux${SFX}_dummy_machdep.c linux_file.c linux_event.c \ linux_futex.c linux_getcwd.c linux_ioctl.c linux_ipc.c \ linux${SFX}_machdep.c linux_misc.c linux_signal.c \ linux_socket.c linux_stats.c linux_sysctl.c linux${SFX}_sysent.c \ @@ -41,7 +41,7 @@ OBJS= ${VDSO}.so .if ${MACHINE_CPUARCH} == "i386" SRCS+= linux_ptrace.c imgact_linux.c linux_util.c linux_mib.c linux_mmap.c \ - linux_emul.c linux_errno.c opt_cpu.h linux.c + linux_dummy.c linux_emul.c linux_errno.c opt_cpu.h linux.c .endif .if ${MACHINE_CPUARCH} == "i386" From owner-svn-src-head@freebsd.org Sat Dec 5 16:11:22 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 8191247FB79; Sat, 5 Dec 2020 16:11:22 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: from mail-io1-f53.google.com (mail-io1-f53.google.com [209.85.166.53]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CpF1k3FYjz3vH0; Sat, 5 Dec 2020 16:11:22 +0000 (UTC) (envelope-from carpeddiem@gmail.com) Received: by mail-io1-f53.google.com with SMTP id p187so9042658iod.4; Sat, 05 Dec 2020 08:11:22 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=8KJssmncI2x1OZn7f287XjCVjsgxXkI5VP3ZYT5rdoI=; b=M5MQz/HGXWD6Ll3t8yUPaPhr5jctWIOLRkkcaM71wvSCSjPbf9MOYooAYy/C7rfluX 7vW6c9CRdFvC79u0TqYlGilkS2jo7ZqK5+k/YA1OMkvCtu0FQStwGTHAAzCIc6kRsNb2 8mYsGv3MHEVC2E7ByUFKsnJlSMCHk6gB7CRb59uZVEFwVK/PH/3yX/fq/+JcjgdC9EIB WEAmwFQgUgFkV6YOL91/8pFRCePkZhVssjY0jg+M3yCnu1Fi+NzpvORrxQgY+1BbqBdM xFnNhbkc3uUUkwFWasgApR2u4WkrBEas5DLXTJQGFpDIEaTEW1/GhgueF3ePu60G0tNq A/Sw== X-Gm-Message-State: AOAM533vWnjBrneiK0ho3H5/eEV2xtuRSbvoJTMKVfB2I8XuaoEIPqlw kG3RMRB0BDnY1jkWzDUciz2ffX0Om69viR9rT1QVUuDWPoq5Kg== X-Google-Smtp-Source: ABdhPJx9nDnjNuvzYWOZ2CsrN5Dx9u2GgB42kGFLGMxzU4M9LMYYBA7kJARjcQpvVHORvuHV6pBKci+DuxcEhLnHins= X-Received: by 2002:a02:cc54:: with SMTP id i20mr12115772jaq.136.1607184681013; Sat, 05 Dec 2020 08:11:21 -0800 (PST) MIME-Version: 1.0 References: <202012041931.0B4JVGlI001859@repo.freebsd.org> In-Reply-To: <202012041931.0B4JVGlI001859@repo.freebsd.org> From: Ed Maste Date: Sat, 5 Dec 2020 11:11:09 -0500 Message-ID: Subject: Re: svn commit: r368345 - head/libexec/rc/rc.d To: Cy Schubert Cc: src-committers , svn-src-all , svn-src-head Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4CpF1k3FYjz3vH0 X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Dec 2020 16:11:22 -0000 On Fri, 4 Dec 2020 at 14:31, Cy Schubert wrote: > > Author: cy > Date: Fri Dec 4 19:31:16 2020 > New Revision: 368345 > URL: https://svnweb.freebsd.org/changeset/base/368345 > > Log: > Revert r366857. HW lab CI is green again with this change: https://ci.freebsd.org/hwlab/job/FreeBSD-device-head-pinea64-test/8044/ (2 of 18 tests after r368345 failed; they timed out waiting for the login prompt. Perhaps the timeout is just not long enough.) From owner-svn-src-head@freebsd.org Sat Dec 5 16:19:01 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id DB4FA47FFF7; Sat, 5 Dec 2020 16:19:01 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: from mail-wr1-x435.google.com (mail-wr1-x435.google.com [IPv6:2a00:1450:4864:20::435]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CpFBX5zWpz3vcp; Sat, 5 Dec 2020 16:19:00 +0000 (UTC) (envelope-from mjguzik@gmail.com) Received: by mail-wr1-x435.google.com with SMTP id e7so8314723wrv.6; Sat, 05 Dec 2020 08:19:00 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=KPqMFH4OPJnKRf3iXDagWGcvYOEbvZkVgSM0rdmvJUQ=; b=J8JGxffmdaHHjwVpSSvzyJkU/HM06JQUgXcR1fTzNapPIWGfOlJ67x5m3wlv/+nK06 3LRqgczJdfKDl/lj66c14zkgxTz7VsqXDdSVlICtfsVEgmkEoI2tmi4muztOZ1KQpngi FJwjPCgMCocXxqjLWT7i+8fquYjpc8Oce7l8RsDWQH2MnMhh/3j/zSRoXqVhgNfbR/Tf PezMjj2rEQs9D/wwWPu6AmMGNV7jCT9iPcbUt7yyoyHtylT7ZO7vrsIBraxul94E7p2Q pBLiDizW4R1ZsXbsN30fKAJ/IbFKnTRjWMmX2t/7m8S1C+ytmGZLXT3tt0aeZqBWCUD1 tmKw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=KPqMFH4OPJnKRf3iXDagWGcvYOEbvZkVgSM0rdmvJUQ=; b=a4cYSl41uN05llXjT0a3zCnGwdPhG58aqOzciwOT5v/oZ0t6+Dyr3t1ZA7+S+U8rAT +22nTlT7ooePOnkZwdwhNBQfyKb4TzR/COlL0T0RfPxa/O3rkXRn4bdXiJwL71X943J4 xTN+e3zEQa3lJJTZymPmJPyeK9QZ5NeLNo9rbV3lUEFKqC41P44OmiDofy3nsYhKtZwZ lkW8ebXBqDao4fRqg1Wy1hmGoIwXqKa1K8TinV+ZWSeTqMADzuWKKVJ+bDxUGWT0kFZV ubDdJyQbGocAHRh40sJmqKhXCry/Al9ZpliOAqzloRoNF7Vu3F7xo4wu8J4bXBsClbzI keew== X-Gm-Message-State: AOAM531J7JXOK0S2FSWuPk9xr4Z32ePfSR44e5Snnbltw282rItMdQxa t95VplsONqO4ldH5exKMyAcyzjYzV3yeJquvGdHT/RjgamE= X-Google-Smtp-Source: ABdhPJxo0vIRa28s6bKOAEYbKhk4C2kKEUGApxca8BQ8KBQBvNOPheRPU3qPmGqqZRlRaKfn/1G1rAoE6qzizs7fZuU= X-Received: by 2002:a5d:4ccf:: with SMTP id c15mr10992780wrt.237.1607185138226; Sat, 05 Dec 2020 08:18:58 -0800 (PST) MIME-Version: 1.0 Received: by 2002:a5d:4d47:0:0:0:0:0 with HTTP; Sat, 5 Dec 2020 08:18:56 -0800 (PST) In-Reply-To: <202011291742.0ATHgXcF011823@repo.freebsd.org> References: <202011291742.0ATHgXcF011823@repo.freebsd.org> From: Mateusz Guzik Date: Sat, 5 Dec 2020 17:18:56 +0100 Message-ID: Subject: Re: svn commit: r368159 - in head/sys: arm/conf conf To: Michal Meloun Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Content-Type: text/plain; charset="UTF-8" X-Rspamd-Queue-Id: 4CpFBX5zWpz3vcp X-Spamd-Bar: --- Authentication-Results: mx1.freebsd.org; dkim=pass header.d=gmail.com header.s=20161025 header.b=J8JGxffm; dmarc=pass (policy=none) header.from=gmail.com; spf=pass (mx1.freebsd.org: domain of mjguzik@gmail.com designates 2a00:1450:4864:20::435 as permitted sender) smtp.mailfrom=mjguzik@gmail.com X-Spamd-Result: default: False [-3.63 / 15.00]; ARC_NA(0.00)[]; RBL_DBL_DONT_QUERY_IPS(0.00)[2a00:1450:4864:20::435:from]; R_DKIM_ALLOW(-0.20)[gmail.com:s=20161025]; RCVD_TLS_ALL(0.00)[]; FROM_HAS_DN(0.00)[]; RCPT_COUNT_THREE(0.00)[4]; R_SPF_ALLOW(-0.20)[+ip6:2a00:1450:4000::/36:c]; FREEMAIL_FROM(0.00)[gmail.com]; MIME_GOOD(-0.10)[text/plain]; TO_MATCH_ENVRCPT_ALL(0.00)[]; NEURAL_HAM_LONG(-1.00)[-1.000]; TO_DN_SOME(0.00)[]; SPAMHAUS_ZRD(0.00)[2a00:1450:4864:20::435:from:127.0.2.255]; NEURAL_HAM_MEDIUM(-1.00)[-1.000]; DKIM_TRACE(0.00)[gmail.com:+]; DMARC_POLICY_ALLOW(-0.50)[gmail.com,none]; RCVD_IN_DNSWL_NONE(0.00)[2a00:1450:4864:20::435:from]; NEURAL_HAM_SHORT(-0.63)[-0.632]; FROM_EQ_ENVFROM(0.00)[]; MIME_TRACE(0.00)[0:+]; FREEMAIL_ENVFROM(0.00)[gmail.com]; ASN(0.00)[asn:15169, ipnet:2a00:1450::/32, country:US]; RCVD_COUNT_TWO(0.00)[2]; MAILMAN_DEST(0.00)[svn-src-all,svn-src-head]; DWL_DNSWL_NONE(0.00)[gmail.com:dkim] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Dec 2020 16:19:01 -0000 On 11/29/20, Michal Meloun wrote: > Author: mmel > Date: Sun Nov 29 17:42:32 2020 > New Revision: 368159 > URL: https://svnweb.freebsd.org/changeset/base/368159 > > Log: > Remove unused options. > > Marvell files and their related SOC_MV_ options should be cleaned up > in another pass. > Since this change tinderbox fails to build VERSATILEPB and EFIKA_MX: /usr/src/sys/dev/syscons/scgfbrndr.c:35:10: fatal error: 'opt_gfb.h' file not found #include "opt_gfb.h" ^~~~~~~~~~~ > Modified: > head/sys/arm/conf/NOTES > head/sys/arm/conf/std.armv6 > head/sys/arm/conf/std.armv7 > head/sys/conf/options.arm > > Modified: head/sys/arm/conf/NOTES > ============================================================================== > --- head/sys/arm/conf/NOTES Sun Nov 29 16:44:22 2020 (r368158) > +++ head/sys/arm/conf/NOTES Sun Nov 29 17:42:32 2020 (r368159) > @@ -9,7 +9,6 @@ makeoptions CONF_CFLAGS+="-march=armv7a" > > # Add options for armv7 that are not in sys/conf/NOTES... > > -options ARM_L2_PIPT # Only L2 PIPT is supported > options FDT # Flattened device tree support > options FREEBSD_BOOT_LOADER # Process metadata passed from loader(8) > options INTRNG # Include INTRNG framework > > Modified: head/sys/arm/conf/std.armv6 > ============================================================================== > --- head/sys/arm/conf/std.armv6 Sun Nov 29 16:44:22 2020 (r368158) > +++ head/sys/arm/conf/std.armv6 Sun Nov 29 17:42:32 2020 (r368159) > @@ -3,7 +3,6 @@ > # $FreeBSD$ > > options HZ=1000 > -options ARM_L2_PIPT # Only L2 PIPT is supported > options INTRNG # All arm systems use INTRNG these days > options PREEMPTION # Enable kernel thread preemption > options VIMAGE # Subsystem virtualization, e.g. VNET > > Modified: head/sys/arm/conf/std.armv7 > ============================================================================== > --- head/sys/arm/conf/std.armv7 Sun Nov 29 16:44:22 2020 (r368158) > +++ head/sys/arm/conf/std.armv7 Sun Nov 29 17:42:32 2020 (r368159) > @@ -3,7 +3,6 @@ > # $FreeBSD$ > > options HZ=1000 > -options ARM_L2_PIPT # Only L2 PIPT is supported > options INTRNG # All arm systems use INTRNG these days > options PREEMPTION # Enable kernel thread preemption > options VIMAGE # Subsystem virtualization, e.g. VNET > > Modified: head/sys/conf/options.arm > ============================================================================== > --- head/sys/conf/options.arm Sun Nov 29 16:44:22 2020 (r368158) > +++ head/sys/conf/options.arm Sun Nov 29 17:42:32 2020 (r368159) > @@ -1,13 +1,7 @@ > #$FreeBSD$ > ARMV6 opt_global.h > ARMV7 opt_global.h > -ARM_CACHE_LOCK_ENABLE opt_global.h > -ARM_KERN_DIRECTMAP opt_vm.h > -ARM_L2_PIPT opt_global.h > -ARM_MANY_BOARD opt_global.h > -ARM_WANT_TP_ADDRESS opt_global.h > CPSW_ETHERSWITCH opt_cpsw.h > -CPU_ARM9E opt_global.h > CPU_ARM1176 opt_global.h > CPU_CORTEXA opt_global.h > CPU_KRAIT opt_global.h > @@ -23,7 +17,6 @@ FREEBSD_BOOT_LOADER opt_global.h > KERNBASE opt_global.h > KERNVIRTADDR opt_global.h > LINUX_BOOT_ABI opt_global.h > -LOADERRAMADDR opt_global.h > LOCORE_MAP_MB opt_locore.h > NKPT2PG opt_pmap.h > PHYSADDR opt_global.h > @@ -31,7 +24,6 @@ PLATFORM opt_global.h > SOCDEV_PA opt_global.h > SOCDEV_VA opt_global.h > PV_STATS opt_pmap.h > -QEMU_WORKAROUNDS opt_global.h > SOC_ALLWINNER_A10 opt_global.h > SOC_ALLWINNER_A13 opt_global.h > SOC_ALLWINNER_A20 opt_global.h > @@ -56,13 +48,6 @@ SOC_MV_KIRKWOOD opt_global.h > SOC_MV_ORION opt_global.h > SOC_OMAP3 opt_global.h > SOC_OMAP4 opt_global.h > -SOC_ROCKCHIP_RK3188 opt_global.h > SOC_TI_AM335X opt_global.h > -SOC_TEGRA2 opt_global.h > -XSCALE_CACHE_READ_WRITE_ALLOCATE opt_global.h > -VERBOSE_INIT_ARM opt_global.h > VM_MAXUSER_ADDRESS opt_global.h > -GFB_DEBUG opt_gfb.h > -GFB_NO_FONT_LOADING opt_gfb.h > -GFB_NO_MODE_CHANGE opt_gfb.h > VFP opt_global.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-unsubscribe@freebsd.org" > -- Mateusz Guzik From owner-svn-src-head@freebsd.org Sat Dec 5 16:19:22 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id F1D6C47FE67; Sat, 5 Dec 2020 16:19:22 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from smtp-out-no.shaw.ca (smtp-out-no.shaw.ca [64.59.134.13]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "Client", Issuer "CA" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CpFBy3YrYz3vmJ; Sat, 5 Dec 2020 16:19:22 +0000 (UTC) (envelope-from cy.schubert@cschubert.com) Received: from spqr.komquats.com ([70.67.229.168]) by shaw.ca with ESMTPA id laHGkoVc134axlaHHkrJhQ; Sat, 05 Dec 2020 09:19:20 -0700 X-Authority-Analysis: v=2.4 cv=LvQsdlRc c=1 sm=1 tr=0 ts=5fcbb308 a=7AlCcx2GqMg+lh9P3BclKA==:117 a=7AlCcx2GqMg+lh9P3BclKA==:17 a=xqWC_Br6kY4A:10 a=kj9zAlcOel0A:10 a=zTNgK-yGK50A:10 a=6I5d2MoRAAAA:8 a=YxBL1-UpAAAA:8 a=EkcXrb_YAAAA:8 a=PMr7E5LAPZrm6phHjKoA:9 a=CjuIK1q_8ugA:10 a=vRcdKC0ogzYA:10 a=IjZwj45LgO3ly-622nXo:22 a=Ia-lj3WSrqcvXOmTRaiG:22 a=LK5xJRSDVpKd5WXXoEvA:22 Received: from slippy.cwsent.com (slippy [IPv6:fc00:1:1:1::5b]) by spqr.komquats.com (Postfix) with ESMTPS id 940C912B2; Sat, 5 Dec 2020 08:19:17 -0800 (PST) Received: from slippy (localhost [127.0.0.1]) by slippy.cwsent.com (8.16.1/8.16.1) with ESMTP id 0B5GJHHR015389; Sat, 5 Dec 2020 08:19:17 -0800 (PST) (envelope-from Cy.Schubert@cschubert.com) Message-Id: <202012051619.0B5GJHHR015389@slippy.cwsent.com> X-Mailer: exmh version 2.9.0 11/07/2018 with nmh-1.7.1 Reply-to: Cy Schubert From: Cy Schubert X-os: FreeBSD X-Sender: cy@cwsent.com X-URL: http://www.cschubert.com/ To: Ed Maste cc: Cy Schubert , src-committers , svn-src-all , svn-src-head Subject: Re: svn commit: r368345 - head/libexec/rc/rc.d In-reply-to: References: <202012041931.0B4JVGlI001859@repo.freebsd.org> Comments: In-reply-to Ed Maste message dated "Sat, 05 Dec 2020 11:11:09 -0500." Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Sat, 05 Dec 2020 08:19:17 -0800 X-CMAE-Envelope: MS4xfKGSVRE9Z9V2Xd3g6NM04V24AYhb9OdZneuCXwad0kPnwiUF/3hnmRINB/XGmmwKlhYihu3rwv0JwDRKncfAjdfbCU1IPa22h8Uvo3aWflf4LFaleRz7 vTlhNHI8avwBXFUiyRGX6dMKP9qQg9Z5pP/CW3Vt57G/C9RcD+C8HUG+k7CxPovSYFaXDMZa1aqCEMRSK5+OBFPEbqVraZn2bP19Zji2xiSvra/gZaugLLzS +arPSBOvamq/GyjIRjS8sWFr2HLgDRct/DaKJ4y/5eplbKywkoBbQocFhgx2jCkPDRaLXLTNCv6aalrEBKuhHdGleScMAZ5IASBsuRdUsNY= X-Rspamd-Queue-Id: 4CpFBy3YrYz3vmJ X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Dec 2020 16:19:23 -0000 In message , Ed Maste writes: > On Fri, 4 Dec 2020 at 14:31, Cy Schubert wrote: > > > > Author: cy > > Date: Fri Dec 4 19:31:16 2020 > > New Revision: 368345 > > URL: https://svnweb.freebsd.org/changeset/base/368345 > > > > Log: > > Revert r366857. > > HW lab CI is green again with this change: > https://ci.freebsd.org/hwlab/job/FreeBSD-device-head-pinea64-test/8044/ > > (2 of 18 tests after r368345 failed; they timed out waiting for the > login prompt. Perhaps the timeout is just not long enough.) Unfortunately WOL is broken here. A patch to teach lagg(4) about WOL is #2 on my todo list. -- Cheers, Cy Schubert FreeBSD UNIX: Web: https://FreeBSD.org NTP: Web: https://nwtime.org The need of the many outweighs the greed of the few. From owner-svn-src-head@freebsd.org Sat Dec 5 19:44:01 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 42E594A6120; Sat, 5 Dec 2020 19:44:01 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CpKl519sHz4cG6; Sat, 5 Dec 2020 19:44:01 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 1B2412353B; Sat, 5 Dec 2020 19:44:01 +0000 (UTC) (envelope-from mmel@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B5Ji0TF020866; Sat, 5 Dec 2020 19:44:00 GMT (envelope-from mmel@FreeBSD.org) Received: (from mmel@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B5Ji0QE020864; Sat, 5 Dec 2020 19:44:00 GMT (envelope-from mmel@FreeBSD.org) Message-Id: <202012051944.0B5Ji0QE020864@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: mmel set sender to mmel@FreeBSD.org using -f From: Michal Meloun Date: Sat, 5 Dec 2020 19:44:00 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368373 - in head/sys: conf dev/syscons X-SVN-Group: head X-SVN-Commit-Author: mmel X-SVN-Commit-Paths: in head/sys: conf dev/syscons X-SVN-Commit-Revision: 368373 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Dec 2020 19:44:01 -0000 Author: mmel Date: Sat Dec 5 19:44:00 2020 New Revision: 368373 URL: https://svnweb.freebsd.org/changeset/base/368373 Log: Remove remaning definition of GFB_ options. They are not used in source files. This fixes build of some arm boards after r368159. Reported by: mjg Modified: head/sys/conf/options.mips head/sys/conf/options.powerpc head/sys/dev/syscons/scgfbrndr.c Modified: head/sys/conf/options.mips ============================================================================== --- head/sys/conf/options.mips Sat Dec 5 14:53:24 2020 (r368372) +++ head/sys/conf/options.mips Sat Dec 5 19:44:00 2020 (r368373) @@ -66,10 +66,6 @@ CFE_CONSOLE opt_global.h CFE_ENV opt_global.h CFE_ENV_SIZE opt_global.h -GFB_DEBUG opt_gfb.h -GFB_NO_FONT_LOADING opt_gfb.h -GFB_NO_MODE_CHANGE opt_gfb.h - NOFPU opt_global.h TICK_USE_YAMON_FREQ opt_global.h Modified: head/sys/conf/options.powerpc ============================================================================== --- head/sys/conf/options.powerpc Sat Dec 5 14:53:24 2020 (r368372) +++ head/sys/conf/options.powerpc Sat Dec 5 19:44:00 2020 (r368373) @@ -15,10 +15,6 @@ FPU_EMU COMPAT_FREEBSD32 opt_global.h -GFB_DEBUG opt_gfb.h -GFB_NO_FONT_LOADING opt_gfb.h -GFB_NO_MODE_CHANGE opt_gfb.h - MOEA64_STATS opt_pmap.h AMIGAONE opt_platform.h MIKROTIK opt_platform.h Modified: head/sys/dev/syscons/scgfbrndr.c ============================================================================== --- head/sys/dev/syscons/scgfbrndr.c Sat Dec 5 14:53:24 2020 (r368372) +++ head/sys/dev/syscons/scgfbrndr.c Sat Dec 5 19:44:00 2020 (r368373) @@ -32,7 +32,6 @@ __FBSDID("$FreeBSD$"); #include "opt_syscons.h" -#include "opt_gfb.h" #ifdef __powerpc__ #include "opt_ofwfb.h" #endif From owner-svn-src-head@freebsd.org Sat Dec 5 19:45:13 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id C20E84A6049; Sat, 5 Dec 2020 19:45:13 +0000 (UTC) (envelope-from melounmichal@gmail.com) Received: from mail-ej1-x633.google.com (mail-ej1-x633.google.com [IPv6:2a00:1450:4864:20::633]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CpKmT4QKdz4cMM; Sat, 5 Dec 2020 19:45:13 +0000 (UTC) (envelope-from melounmichal@gmail.com) Received: by mail-ej1-x633.google.com with SMTP id d17so13668438ejy.9; Sat, 05 Dec 2020 11:45:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=sender:from:reply-to:subject:to:cc:references:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=VBcOlX6XcpHMNlQ6KUMp8h+4CT58Wa96O9VYo2DYn1M=; b=cnzcZD4KphGudXURefv8mu5wyDKTBc8PPz+gG6ss7+AH9Q/Z1DQq2NdC3z/e4qn4a5 OiLRpd0bjwl8P2n9Ee6ekQgRp5Bd/TMnqwulEWr81IGzvuHqFFwQlLsbe8Df062j7aIV gT3Mg7M3xo+FZSTqOJz2j1Xh5rYeiTH75TpYogWuAh+GcJ5pG8Prrezzpu/Rn4lcJNAN +LJAsOtLA1AaBdXkCX37ASGXpE+pdJm57vpKLif1vbwwIIazLciIG9LnWO7zZAO1ihlq CzGU/qIQcx18yy6JpJ0ouJMP0QBUdJslHuX1thsooWkLl3KIkBqLrpiFjtNqovNt/SDW //ZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:sender:from:reply-to:subject:to:cc:references :message-id:date:user-agent:mime-version:in-reply-to :content-language:content-transfer-encoding; bh=VBcOlX6XcpHMNlQ6KUMp8h+4CT58Wa96O9VYo2DYn1M=; b=O5KVgiiCJ/+FpUtggr9Cn7OSpPit3nBcSYO5A3fZekVKWTs/Noh+e8TtMM6yy37Z2t bl8gS3EII7HTsP6PNWMQHn4/IM42HmkdkkD/cpgPLD/rvp4fbKhWugAeDJT/ui3V5T7+ k0tR3GPKlAbcLZzGEpgonJnE4JcJ9rSeiiBkGw2M/2E3Vn5qP4DStztkE91TFimc6j+D N8GWDkXGyJNBqV7Ettq6y2KOboi6o6fce8KqnVV/nFQDmLbjToSeZOb3mkx/QIz9t9P8 pB55xwI+owK2pOCzRkit2wDL1C3di2ziKuBZGX2hK77/7ocDS7HUsPnMxrh4ZLcW3GNf eGpw== X-Gm-Message-State: AOAM533LBn44rFVMiLpYI809LXLlnj5Ml/HAPBOBzV6I60WpB8RjynJK 5R39h7TKwAUni0T8FPGIeHt7XiYduUw= X-Google-Smtp-Source: ABdhPJy3peqdK+C6Lej3MNe5BLJ1YVYOmBtTnAtz6xK0uIw6y7nj1ENSIcC0LkvNwP2IU3RTS/PWiw== X-Received: by 2002:a17:907:373:: with SMTP id rs19mr10629418ejb.298.1607197511495; Sat, 05 Dec 2020 11:45:11 -0800 (PST) Received: from [88.208.79.100] (halouny.humusoft.cz. [88.208.79.100]) by smtp.gmail.com with ESMTPSA id a13sm6225025edb.76.2020.12.05.11.45.10 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Sat, 05 Dec 2020 11:45:10 -0800 (PST) Sender: Michal Meloun From: Michal Meloun X-Google-Original-From: Michal Meloun Reply-To: mmel@freebsd.org Subject: Re: svn commit: r368159 - in head/sys: arm/conf conf To: Mateusz Guzik Cc: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org References: <202011291742.0ATHgXcF011823@repo.freebsd.org> Message-ID: <611d27ec-a5c1-256b-255f-febb1f7b72c8@freebsd.org> Date: Sat, 5 Dec 2020 20:45:11 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:78.0) Gecko/20100101 Thunderbird/78.5.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit X-Rspamd-Queue-Id: 4CpKmT4QKdz4cMM X-Spamd-Bar: ---- Authentication-Results: mx1.freebsd.org; none X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; TAGGED_FROM(0.00)[] X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Dec 2020 19:45:13 -0000 On 05.12.2020 17:18, Mateusz Guzik wrote: > On 11/29/20, Michal Meloun wrote: >> Author: mmel >> Date: Sun Nov 29 17:42:32 2020 >> New Revision: 368159 >> URL: https://svnweb.freebsd.org/changeset/base/368159 >> >> Log: >> Remove unused options. >> >> Marvell files and their related SOC_MV_ options should be cleaned up >> in another pass. >> > > Since this change tinderbox fails to build VERSATILEPB and EFIKA_MX: > /usr/src/sys/dev/syscons/scgfbrndr.c:35:10: fatal error: 'opt_gfb.h' > file not found > #include "opt_gfb.h" > ^~~~~~~~~~~ Fixed in r368373. thanks for report. Michal From owner-svn-src-head@freebsd.org Sat Dec 5 22:04:31 2020 Return-Path: Delivered-To: svn-src-head@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id 10B1D4A9CF7; Sat, 5 Dec 2020 22:04:31 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4CpNsB73MVz4lB0; Sat, 5 Dec 2020 22:04:30 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org (repo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id E518B25220; Sat, 5 Dec 2020 22:04:30 +0000 (UTC) (envelope-from cem@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id 0B5M4Uxq008054; Sat, 5 Dec 2020 22:04:30 GMT (envelope-from cem@FreeBSD.org) Received: (from cem@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id 0B5M4U71008053; Sat, 5 Dec 2020 22:04:30 GMT (envelope-from cem@FreeBSD.org) Message-Id: <202012052204.0B5M4U71008053@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: cem set sender to cem@FreeBSD.org using -f From: Conrad Meyer Date: Sat, 5 Dec 2020 22:04:30 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r368374 - head/sys/dev/atkbdc X-SVN-Group: head X-SVN-Commit-Author: cem X-SVN-Commit-Paths: head/sys/dev/atkbdc X-SVN-Commit-Revision: 368374 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-src-head@freebsd.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: SVN commit messages for the src tree for head/-current List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sat, 05 Dec 2020 22:04:31 -0000 Author: cem Date: Sat Dec 5 22:04:30 2020 New Revision: 368374 URL: https://svnweb.freebsd.org/changeset/base/368374 Log: atkbd(4): Just use nitems() for quirk enumeration Reviewed by: imp, wulf X-MFC-With: r368365 Differential Revision: https://reviews.freebsd.org/D27489 Modified: head/sys/dev/atkbdc/atkbdc.c Modified: head/sys/dev/atkbdc/atkbdc.c ============================================================================== --- head/sys/dev/atkbdc/atkbdc.c Sat Dec 5 19:44:00 2020 (r368373) +++ head/sys/dev/atkbdc/atkbdc.c Sat Dec 5 22:04:30 2020 (r368374) @@ -119,7 +119,6 @@ static struct atkbdc_quirks quirks[] = { KBDC_QUIRK_RESET_AFTER_PROBE | KBDC_QUIRK_SETLEDS_ON_INIT}, /* KBDC hangs on Lenovo X120e and X121e after disabling AUX MUX */ {NULL, "LENOVO", NULL, KBDC_QUIRK_DISABLE_MUX_PROBE}, - {NULL, NULL, NULL, 0} }; #define QUIRK_STR_MATCH(s1, s2) (s1 == NULL || \ @@ -133,8 +132,7 @@ atkbdc_getquirks(void) char* maker = kern_getenv("smbios.system.maker"); char* product = kern_getenv("smbios.system.product"); - for (i=0; quirks[i].bios_vendor != NULL || quirks[i].maker != NULL || - quirks[i].product != NULL; ++i) + for (i = 0; i < nitems(quirks); i++) if (QUIRK_STR_MATCH(quirks[i].bios_vendor, bios_vendor) && QUIRK_STR_MATCH(quirks[i].maker, maker) && QUIRK_STR_MATCH(quirks[i].product, product))