Date: Fri, 28 Jun 2019 03:37:56 +1000 (EST) From: Bruce Evans <brde@optusnet.com.au> To: Andriy Gapon <avg@freebsd.org> Cc: Bruce Evans <brde@optusnet.com.au>, src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: Re: svn commit: r349459 - head/sys/sys Message-ID: <20190628032225.T2863@besplex.bde.org> In-Reply-To: <dec79f80-3b00-15ad-cd63-6e6ecb83e176@FreeBSD.org> References: <201906271507.x5RF775Q070616@repo.freebsd.org> <20190628012059.D2091@besplex.bde.org> <dec79f80-3b00-15ad-cd63-6e6ecb83e176@FreeBSD.org>
next in thread | previous in thread | raw e-mail | index | archive | help
On Thu, 27 Jun 2019, Andriy Gapon wrote: > On 27/06/2019 18:47, Bruce Evans wrote: >> On Thu, 27 Jun 2019, Andriy Gapon wrote: >> >>> Log: >>> =C2=A0upgrade the warning printf-s in bus accessors to KASSERT-s >>> >>> =C2=A0After this change sys/bus.h includes sys/systm.h. >> >> This is further namespace pollution.=C2=A0 sys/systm.h is a prerequiste = for >> all kernel headers except sys/param.h and the headers that that includes= , >> since any kernel header (except sys/param.hm etc.) may have inlines whic= h >> use features in systm.h, e.g., KASSERT() or an inline function. > > what do you think about amending style(9) to require that if sys/systm.h = is to > be included, then it must be included before any other header except for > sys/param.h (and possibly sys/cdefs.h) ? It is not a style matter. sys/systm.h is just a prerequisite for almost all kernel code. Perhaps this can be enforced using #ifdef magic even for headers that don't currently use it. If it is to be included nested, then sys/param.h is the place to include it, but I don't like that since it is even less related to parameters than sys/param.h, and this would be a regression from minor depollution of sys/param.h. sys/systm.h is also kernel-only, and as you found, including it nested tends to break applications, so other headers that have the bug of including it tend to have _KERNEL ifdefs to avoid including it in applications. This is so fundamental that it doesn't have a "No user-serviceable parts inside" ifdef. Bruce From owner-svn-src-all@freebsd.org Thu Jun 27 18:08:20 2019 Return-Path: <owner-svn-src-all@freebsd.org> Delivered-To: svn-src-all@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 0AFB615C918D; Thu, 27 Jun 2019 18:08:20 +0000 (UTC) (envelope-from br@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) server-signature RSA-PSS (4096 bits) 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 A5DB669A36; Thu, 27 Jun 2019 18:08:19 +0000 (UTC) (envelope-from br@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 62B451ADD3; Thu, 27 Jun 2019 18:08:19 +0000 (UTC) (envelope-from br@FreeBSD.org) Received: from repo.freebsd.org ([127.0.1.37]) by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id x5RI8JGl064724; Thu, 27 Jun 2019 18:08:19 GMT (envelope-from br@FreeBSD.org) Received: (from br@localhost) by repo.freebsd.org (8.15.2/8.15.2/Submit) id x5RI8IuQ064721; Thu, 27 Jun 2019 18:08:18 GMT (envelope-from br@FreeBSD.org) Message-Id: <201906271808.x5RI8IuQ064721@repo.freebsd.org> X-Authentication-Warning: repo.freebsd.org: br set sender to br@FreeBSD.org using -f From: Ruslan Bukin <br@FreeBSD.org> Date: Thu, 27 Jun 2019 18:08:18 +0000 (UTC) To: src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-head@freebsd.org Subject: svn commit: r349466 - in head/sys: conf dev/altera/msgdma mips/conf X-SVN-Group: head X-SVN-Commit-Author: br X-SVN-Commit-Paths: in head/sys: conf dev/altera/msgdma mips/conf X-SVN-Commit-Revision: 349466 X-SVN-Commit-Repository: base MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Rspamd-Queue-Id: A5DB669A36 X-Spamd-Bar: -- Authentication-Results: mx1.freebsd.org X-Spamd-Result: default: False [-2.96 / 15.00]; local_wl_from(0.00)[FreeBSD.org]; NEURAL_HAM_MEDIUM(-1.00)[-0.999,0]; NEURAL_HAM_SHORT(-0.96)[-0.965,0]; ASN(0.00)[asn:11403, ipnet:2610:1c1:1::/48, country:US]; NEURAL_HAM_LONG(-1.00)[-1.000,0] X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" <svn-src-all.freebsd.org> List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-all>, <mailto:svn-src-all-request@freebsd.org?subject=unsubscribe> List-Archive: <http://lists.freebsd.org/pipermail/svn-src-all/> List-Post: <mailto:svn-src-all@freebsd.org> List-Help: <mailto:svn-src-all-request@freebsd.org?subject=help> List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-all>, <mailto:svn-src-all-request@freebsd.org?subject=subscribe> X-List-Received-Date: Thu, 27 Jun 2019 18:08:20 -0000 Author: br Date: Thu Jun 27 18:08:18 2019 New Revision: 349466 URL: https://svnweb.freebsd.org/changeset/base/349466 Log: Add support for extended descriptor format to Altera mSGDMA driver. The format to use depends on hardware configuration (synthesis-time), so make it compile-time kernel option. Extended format allows DMA engine to operate with 64-bit memory addresses. Sponsored by: DARPA, AFRL Modified: head/sys/conf/options head/sys/dev/altera/msgdma/msgdma.c head/sys/dev/altera/msgdma/msgdma.h head/sys/mips/conf/BERI_DE4_BASE Modified: head/sys/conf/options ============================================================================== --- head/sys/conf/options Thu Jun 27 17:59:15 2019 (r349465) +++ head/sys/conf/options Thu Jun 27 18:08:18 2019 (r349466) @@ -861,6 +861,12 @@ AH_INTERRUPT_DEBUGGING opt_ah.h # XXX do not use this for AR9130 AH_AR5416_INTERRUPT_MITIGATION opt_ah.h +# options for the Altera mSGDMA driver (altera_msgdma) +ALTERA_MSGDMA_DESC_STD opt_altera_msgdma.h +ALTERA_MSGDMA_DESC_EXT opt_altera_msgdma.h +ALTERA_MSGDMA_DESC_PF_STD opt_altera_msgdma.h +ALTERA_MSGDMA_DESC_PF_EXT opt_altera_msgdma.h + # options for the Broadcom BCM43xx driver (bwi) BWI_DEBUG opt_bwi.h BWI_DEBUG_VERBOSE opt_bwi.h Modified: head/sys/dev/altera/msgdma/msgdma.c ============================================================================== --- head/sys/dev/altera/msgdma/msgdma.c Thu Jun 27 17:59:15 2019 (r349465) +++ head/sys/dev/altera/msgdma/msgdma.c Thu Jun 27 18:08:18 2019 (r349466) @@ -60,6 +60,7 @@ __FBSDID("$FreeBSD$"); #include <dev/xdma/xdma.h> #include "xdma_if.h" +#include "opt_altera_msgdma.h" #include <dev/altera/msgdma/msgdma.h> @@ -470,8 +471,8 @@ msgdma_channel_submit_sg(device_t dev, struct xdma_cha struct msgdma_channel *chan; struct msgdma_desc *desc; struct msgdma_softc *sc; - uint32_t src_addr_lo; - uint32_t dst_addr_lo; + bus_addr_t src_addr_lo; + bus_addr_t dst_addr_lo; uint32_t len; uint32_t tmp; int i; @@ -481,14 +482,18 @@ msgdma_channel_submit_sg(device_t dev, struct xdma_cha chan = (struct msgdma_channel *)xchan->chan; for (i = 0; i < sg_n; i++) { - src_addr_lo = (uint32_t)sg[i].src_addr; - dst_addr_lo = (uint32_t)sg[i].dst_addr; + src_addr_lo = sg[i].src_addr; + dst_addr_lo = sg[i].dst_addr; len = (uint32_t)sg[i].len; dprintf("%s: src %x dst %x len %d\n", __func__, src_addr_lo, dst_addr_lo, len); desc = chan->descs[chan->idx_head]; +#if defined(ALTERA_MSGDMA_DESC_EXT) || defined(ALTERA_MSGDMA_DESC_PF_EXT) + desc->read_hi = htole32(src_addr_lo >> 32); + desc->write_hi = htole32(dst_addr_lo >> 32); +#endif desc->read_lo = htole32(src_addr_lo); desc->write_lo = htole32(dst_addr_lo); desc->length = htole32(len); Modified: head/sys/dev/altera/msgdma/msgdma.h ============================================================================== --- head/sys/dev/altera/msgdma/msgdma.h Thu Jun 27 17:59:15 2019 (r349465) +++ head/sys/dev/altera/msgdma/msgdma.h Thu Jun 27 18:08:18 2019 (r349466) @@ -30,6 +30,8 @@ * $FreeBSD$ */ +#include "opt_altera_msgdma.h" + /* Altera mSGDMA registers. */ #define DMA_STATUS 0x00 #define STATUS_RESETTING (1 << 6) @@ -75,22 +77,74 @@ #define WRITE4_DESC(_sc, _reg, _val) \ bus_space_write_4(_sc->bst_d, _sc->bsh_d, _reg, htole32(_val)) -/* Prefetcher-disabled descriptor format. */ -struct msgdma_desc_nonpf { - uint32_t src_addr; - uint32_t dst_addr; +#if defined(ALTERA_MSGDMA_DESC_STD) + +/* Standard descriptor format with prefetcher disabled. */ +struct msgdma_desc { + uint32_t read_lo; + uint32_t write_lo; uint32_t length; uint32_t control; }; -/* Prefetcher-enabled descriptor format. */ +#elif defined(ALTERA_MSGDMA_DESC_EXT) + +/* Extended descriptor format with prefetcher disabled. */ struct msgdma_desc { uint32_t read_lo; uint32_t write_lo; uint32_t length; + uint8_t write_burst; + uint8_t read_burst; + uint16_t seq_num; + uint16_t write_stride; + uint16_t read_stride; + uint32_t read_hi; + uint32_t write_hi; + uint32_t control; +}; + +#elif defined(ALTERA_MSGDMA_DESC_PF_STD) + +/* Standard descriptor format with prefetcher enabled. */ +struct msgdma_desc { + uint32_t read_lo; + uint32_t write_lo; + uint32_t length; uint32_t next; uint32_t transferred; uint32_t status; uint32_t reserved; uint32_t control; }; + +#elif defined(ALTERA_MSGDMA_DESC_PF_EXT) + +/* Extended descriptor format with prefetcher enabled. */ +struct msgdma_desc { + uint32_t read_lo; + uint32_t write_lo; + uint32_t length; + uint32_t next; + uint32_t transferred; + uint32_t status; + uint32_t reserved; + uint8_t write_burst; + uint8_t read_burst; + uint16_t seq_num; + uint16_t write_stride; + uint16_t read_stride; + uint32_t read_hi; + uint32_t write_hi; + uint32_t next_hi; + uint32_t reserved1; + uint32_t reserved2; + uint32_t reserved3; + uint32_t control; +}; + +#else + +#error "mSGDMA descriptor format (kernel option) is not set." + +#endif Modified: head/sys/mips/conf/BERI_DE4_BASE ============================================================================== --- head/sys/mips/conf/BERI_DE4_BASE Thu Jun 27 17:59:15 2019 (r349465) +++ head/sys/mips/conf/BERI_DE4_BASE Thu Jun 27 18:08:18 2019 (r349466) @@ -44,6 +44,7 @@ options DEVICE_POLLING # # DMA support # +options ALTERA_MSGDMA_DESC_PF_STD device xdma device altera_softdma device altera_msgdma
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?20190628032225.T2863>