From nobody Fri Jul 14 18:41:05 2023 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4R2gKZ0crVz4mphC; Fri, 14 Jul 2023 18:41:06 +0000 (UTC) (envelope-from git@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 "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4R2gKY6v0bz4K4Q; Fri, 14 Jul 2023 18:41:05 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1689360066; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=W3yNRxaafOP+uvTuWSj1uKDajWw1mnh1TmRy2pkcfMM=; b=nuzM8H/cgW3yJKveSVdV4HxIMSin4SIv7EZ7+ycK7c8gkNnMCkbi3An36q0nayyT6eC0Pu KWheMSWey5u4IT01A3p1lRcviww6a5Rh5YSlj8c2kNYxib3LxFLVBoK0jsjGpDeEfQcvnY vpaw2t2FHmUidyDysXTicgs5OknFzhBbSy0b68rqPyBIcJ8jLQYrRzeoFW52cyy3wylT4u RbJbQiOC6SFUcBpwTzW3bbSqHAoGVt2y1cXZjnWxNwsFHoWzsRn/wPqeOZSr9VqJSmIWD4 Bug1Ncv/7dRknSchQ3xJ3RexSGL0+M/NsmUlMqEUbOh7QxZdN4GRGiJRQjtD9Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1689360066; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=W3yNRxaafOP+uvTuWSj1uKDajWw1mnh1TmRy2pkcfMM=; b=ZgdS82y8k+m9mSb6usAKcpWePL9H6jlVx9U/7DA/q0k26evizSl/+wQoAth0uRzzP2y9GL tUT9qt5WCtVP0dIIViWK+FiQP2qN9dr+JmkyTlDq6RFq7I5y5BztG0lwBLkcEElGC+3WEP ttReY+dTg6TLVq/3BFJw0ekh7+660/2gbgnjF1M9j2L2lvlg5nKAK/eseqfG2ECTlYnwAI m9mVEp20dwuEolTDx6wGcvhCg862c9qmQ+yqxBbf/z4xBzYlHCGXeSCVqFciqDy6FtYcVc +QPuO8EpXQxHo1M7i56SORy0xZ3E9Az72BQfrpM3diiMJRyLpd1mEgdMxSQ2gg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1689360066; a=rsa-sha256; cv=none; b=w19Z6FUME42hmEXEsvRhs4fkRdIDTYPqr978siW3YLSirQCkoQOaHGmDJMfTgVlHErnE81 swY50TJL93Qtha64D5I8NE0Tkrlo6IDewlXFBIyq1GnsLklMDqHbhexR9IMpuowdEwlCr0 bA1kpuv9KKQj/fxTd165yQb0/m78V7qp1z8Z7LbnSHQMGjuAhp3WlMCzz9Pyf4Q6zkvbzy PbAduXkZzZQhYJijf8xKo2WFBbf1POaFzgM8o2mFrUOi1nkhHB7TIh69I09Rc5WJDHjtzb DRyduEsGBqdEuf4wl1XcexqxhJLxYx9f62QeBBDRYMhiIXmCCp1vz++bmbxtxg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4R2gKY5zwGzTNX; Fri, 14 Jul 2023 18:41:05 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 36EIf5r0019443; Fri, 14 Jul 2023 18:41:05 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 36EIf5dS019442; Fri, 14 Jul 2023 18:41:05 GMT (envelope-from git) Date: Fri, 14 Jul 2023 18:41:05 GMT Message-Id: <202307141841.36EIf5dS019442@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: John Baldwin Subject: git: bab38b44dd11 - main - memdesc: Add a MEMDESC_VMPAGES descriptor type. List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-all@freebsd.org X-BeenThere: dev-commits-src-all@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: jhb X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: bab38b44dd119fc9e8773b68e888cdcbc9564c55 Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=bab38b44dd119fc9e8773b68e888cdcbc9564c55 commit bab38b44dd119fc9e8773b68e888cdcbc9564c55 Author: John Baldwin AuthorDate: 2023-07-14 18:31:42 +0000 Commit: John Baldwin CommitDate: 2023-07-14 18:32:24 +0000 memdesc: Add a MEMDESC_VMPAGES descriptor type. This memory descriptor is backed by an array of VM pages. This type requires adding a new field to 'struct memdesc' to hold the offset within the first page. For LP64 systems, this new field is added in an existing padding hole so does not increase the size. For ILP32 systems, this grows 'struct memdesc' from 12 to 16 bytes. Reviewed by: imp, markj Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D41028 --- sys/kern/subr_bus_dma.c | 4 ++++ sys/sys/memdesc.h | 21 ++++++++++++++++++++- 2 files changed, 24 insertions(+), 1 deletion(-) diff --git a/sys/kern/subr_bus_dma.c b/sys/kern/subr_bus_dma.c index 329887affc99..0ff57c389fb1 100644 --- a/sys/kern/subr_bus_dma.c +++ b/sys/kern/subr_bus_dma.c @@ -583,6 +583,10 @@ bus_dmamap_load_mem(bus_dma_tag_t dmat, bus_dmamap_t map, error = _bus_dmamap_load_mbuf_sg(dmat, map, mem->u.md_mbuf, NULL, &nsegs, flags); break; + case MEMDESC_VMPAGES: + error = _bus_dmamap_load_ma(dmat, map, mem->u.md_ma, + mem->md_len, mem->md_offset, flags, NULL, &nsegs); + break; } nsegs++; diff --git a/sys/sys/memdesc.h b/sys/sys/memdesc.h index 58aafb2a1f1b..d31b04f32393 100644 --- a/sys/sys/memdesc.h +++ b/sys/sys/memdesc.h @@ -35,6 +35,7 @@ struct bio; struct bus_dma_segment; struct uio; struct mbuf; +struct vm_page; union ccb; /* @@ -49,11 +50,15 @@ struct memdesc { struct bio *md_bio; struct uio *md_uio; struct mbuf *md_mbuf; + struct vm_page **md_ma; } u; union { /* type specific data. */ - size_t md_len; /* VADDR, PADDR */ + size_t md_len; /* VADDR, PADDR, VMPAGES */ int md_nseg; /* VLIST, PLIST */ }; + union { + uint32_t md_offset; /* VMPAGES */ + }; uint32_t md_type; /* Type of memory. */ }; @@ -64,6 +69,7 @@ struct memdesc { #define MEMDESC_BIO 5 /* Pointer to a bio (block io). */ #define MEMDESC_UIO 6 /* Pointer to a uio (any io). */ #define MEMDESC_MBUF 7 /* Pointer to a mbuf (network io). */ +#define MEMDESC_VMPAGES 8 /* Pointer to array of VM pages. */ static inline struct memdesc memdesc_vaddr(void *vaddr, size_t len) @@ -146,6 +152,19 @@ memdesc_mbuf(struct mbuf *mbuf) return (mem); } +static inline struct memdesc +memdesc_vmpages(struct vm_page **ma, size_t len, u_int ma_offset) +{ + struct memdesc mem; + + mem.u.md_ma = ma; + mem.md_len = len; + mem.md_type = MEMDESC_VMPAGES; + mem.md_offset = ma_offset; + + return (mem); +} + struct memdesc memdesc_ccb(union ccb *ccb); #endif /* _SYS_MEMDESC_H_ */