From nobody Fri Jul 14 18:41:04 2023 X-Original-To: dev-commits-src-main@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 4R2gKY1FXBz4mpps; Fri, 14 Jul 2023 18:41:05 +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 4R2gKX6NkKz4K48; Fri, 14 Jul 2023 18:41:04 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1689360064; 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=L4rqVRR/4NaResodZnvPZZ1voCskfKMiSFaANncZ678=; b=M+YvuylZM06L4yUBvkE8HNR7VSk/49qDhsoYcMQmUC68nJ8WKRDUEqyWhVUVEqLV6wySiW MKQtny6Np4nS6Nx3ip0W/ThqHZy9qHhEom2lW3T9zclTH9LQmGM8wzAOcyxNEQRnU3IUaG 7RWEh2PU6sflJanVwdyLMzsLbfnMeBXtmbF4btvIKSzK/DfMd9WZRN0Id9rKE1iKLWHFab DlvxBEBVR0tCKAjoGSvuKdlyvhIj43PG3hd38dFy6oasFbWKRfNwHQhfjvku2tPesUjGDx tVNg0eyW/TZeggtZ9eVxwTvfCi8C3IMsuVnLNfQnUa83JKH5kZX9kyCGae2evw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1689360064; 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=L4rqVRR/4NaResodZnvPZZ1voCskfKMiSFaANncZ678=; b=kYnHlkc33qdKgfVH8zMjg22IQQgJcfRu7ZILG3YTf7UqJ+Nan7oDeNoFDhUOUclKp1nprf RUr2qWxkBo+dxE6ccfDPQasty+E9DuCU3Wk0287KDP2WRMsN7bk8diuyxBJLyPdpRiBiQW JCOYryeArCOswhZcQ1aH3Uy1kLTs8nC6GAqugYTxEspztS9wsJDp5QP/U3TVH2qekT9YMK uV4FI/sHZ6J3LjOZGAvxjZ0MQAOs2HWLMnQ+hDANGsEDvE5oe8rWU9WWxxzWc8t+6ErP7V NZTn2Ygkc20vE+cAM7NoZVmIIixB4JN4dhpjK/xjj0qBTFPvPSvHDQhXBRNrBQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1689360064; a=rsa-sha256; cv=none; b=TfwC4cisUPtYu8xiKxda4dsfCPDzjPHdtJdNEka5jxziFKYiRwRX8O76I7rsaqL4UKsQVM QjP7hG6lVEWCuQoQInQlXF2v1bUy7WRoQrtctch5eYSsqNO4jBBsffnGDEQQYIXuq6/Kh2 z8okOdHm7licX4+PGe9kHsM2TGDC349jiRjNglPAx0LvxHDlRnDg7RVlERPSkOamrJ1WkS vyo4tNhbqXYwrD4yTsUGZL2+ouR/sNTsQ78q4jUwte1qaT5toRl0uCUHegfx42/K9LVOPR a3ptGra0w3as4kJEylzk6liDxYuyl2y0+4qXj4qHpD0YssEk/deXYs20m4IgOw== 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 4R2gKX5JdHzTQb; Fri, 14 Jul 2023 18:41:04 +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 36EIf4xh019424; Fri, 14 Jul 2023 18:41:04 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 36EIf4Pn019423; Fri, 14 Jul 2023 18:41:04 GMT (envelope-from git) Date: Fri, 14 Jul 2023 18:41:04 GMT Message-Id: <202307141841.36EIf4Pn019423@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: 3dba010e4902 - main - memdesc: Replace md_opaque with a union of type-specific fields. List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@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: 3dba010e4902b2e9106f1cc52967c5c71fcc25ab Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by jhb: URL: https://cgit.FreeBSD.org/src/commit/?id=3dba010e4902b2e9106f1cc52967c5c71fcc25ab commit 3dba010e4902b2e9106f1cc52967c5c71fcc25ab Author: John Baldwin AuthorDate: 2023-07-14 18:30:57 +0000 Commit: John Baldwin CommitDate: 2023-07-14 18:32:21 +0000 memdesc: Replace md_opaque with a union of type-specific fields. Reviewed by: imp, markj Sponsored by: Chelsio Communications Differential Revision: https://reviews.freebsd.org/D41027 --- sys/kern/subr_bus_dma.c | 8 ++++---- sys/kern/subr_msan.c | 4 ++-- sys/sys/memdesc.h | 13 ++++++++----- 3 files changed, 14 insertions(+), 11 deletions(-) diff --git a/sys/kern/subr_bus_dma.c b/sys/kern/subr_bus_dma.c index bfaad30b37d3..329887affc99 100644 --- a/sys/kern/subr_bus_dma.c +++ b/sys/kern/subr_bus_dma.c @@ -557,19 +557,19 @@ bus_dmamap_load_mem(bus_dma_tag_t dmat, bus_dmamap_t map, switch (mem->md_type) { case MEMDESC_VADDR: error = _bus_dmamap_load_buffer(dmat, map, mem->u.md_vaddr, - mem->md_opaque, kernel_pmap, flags, NULL, &nsegs); + mem->md_len, kernel_pmap, flags, NULL, &nsegs); break; case MEMDESC_PADDR: error = _bus_dmamap_load_phys(dmat, map, mem->u.md_paddr, - mem->md_opaque, flags, NULL, &nsegs); + mem->md_len, flags, NULL, &nsegs); break; case MEMDESC_VLIST: error = _bus_dmamap_load_vlist(dmat, map, mem->u.md_list, - mem->md_opaque, kernel_pmap, &nsegs, flags, 0, SIZE_T_MAX); + mem->md_nseg, kernel_pmap, &nsegs, flags, 0, SIZE_T_MAX); break; case MEMDESC_PLIST: error = _bus_dmamap_load_plist(dmat, map, mem->u.md_list, - mem->md_opaque, &nsegs, flags); + mem->md_nseg, &nsegs, flags); break; case MEMDESC_BIO: error = _bus_dmamap_load_bio(dmat, map, mem->u.md_bio, diff --git a/sys/kern/subr_msan.c b/sys/kern/subr_msan.c index 756d1fca4910..ec2492773243 100644 --- a/sys/kern/subr_msan.c +++ b/sys/kern/subr_msan.c @@ -1505,7 +1505,7 @@ kmsan_bus_dmamap_sync(struct memdesc *desc, bus_dmasync_op_t op) BUS_DMASYNC_PREWRITE) { switch (desc->md_type) { case MEMDESC_VADDR: - kmsan_check(desc->u.md_vaddr, desc->md_opaque, + kmsan_check(desc->u.md_vaddr, desc->md_len, "dmasync"); break; case MEMDESC_BIO: @@ -1524,7 +1524,7 @@ kmsan_bus_dmamap_sync(struct memdesc *desc, bus_dmasync_op_t op) if ((op & BUS_DMASYNC_POSTREAD) != 0) { switch (desc->md_type) { case MEMDESC_VADDR: - kmsan_mark(desc->u.md_vaddr, desc->md_opaque, + kmsan_mark(desc->u.md_vaddr, desc->md_len, KMSAN_STATE_INITED); break; case MEMDESC_BIO: diff --git a/sys/sys/memdesc.h b/sys/sys/memdesc.h index 1c92ae5b1eb5..58aafb2a1f1b 100644 --- a/sys/sys/memdesc.h +++ b/sys/sys/memdesc.h @@ -50,7 +50,10 @@ struct memdesc { struct uio *md_uio; struct mbuf *md_mbuf; } u; - size_t md_opaque; /* type specific data. */ + union { /* type specific data. */ + size_t md_len; /* VADDR, PADDR */ + int md_nseg; /* VLIST, PLIST */ + }; uint32_t md_type; /* Type of memory. */ }; @@ -68,7 +71,7 @@ memdesc_vaddr(void *vaddr, size_t len) struct memdesc mem; mem.u.md_vaddr = vaddr; - mem.md_opaque = len; + mem.md_len = len; mem.md_type = MEMDESC_VADDR; return (mem); @@ -80,7 +83,7 @@ memdesc_paddr(vm_paddr_t paddr, size_t len) struct memdesc mem; mem.u.md_paddr = paddr; - mem.md_opaque = len; + mem.md_len = len; mem.md_type = MEMDESC_PADDR; return (mem); @@ -92,7 +95,7 @@ memdesc_vlist(struct bus_dma_segment *vlist, int sglist_cnt) struct memdesc mem; mem.u.md_list = vlist; - mem.md_opaque = sglist_cnt; + mem.md_nseg = sglist_cnt; mem.md_type = MEMDESC_VLIST; return (mem); @@ -104,7 +107,7 @@ memdesc_plist(struct bus_dma_segment *plist, int sglist_cnt) struct memdesc mem; mem.u.md_list = plist; - mem.md_opaque = sglist_cnt; + mem.md_nseg = sglist_cnt; mem.md_type = MEMDESC_PLIST; return (mem);