From nobody Fri Nov 11 15:04:08 2022 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 4N826J2fdKz4dtd2; Fri, 11 Nov 2022 15:04:08 +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 4N826J2B0nz4Grw; Fri, 11 Nov 2022 15:04:08 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1668179048; 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=pykQ3didJXuBiN6lnlWvmlnJ1CHEab8DcEFKaz2wU8U=; b=SCUB+cocE/dJn3wzhgh8lT4yqIegyDV4PZKH7Krb3QjkDfE+Cw07BfZXhSgtLUhI2kOwit WgGgu2YV+LFWRGJRHSG9VM0SvYcs8lJ1YNxa18Z3nbiTvGPw+wZMInUUnqgfDakdYZs3xM X0O5jQDmoiFUBPqLP0wBvFCeyH6909tcAk9XowOvgFzL2ufbmuRphbywYy1OtCMhfPX7xm QONpxy6zkLmqMkVkJ5cIQewwJN3HpuTQ+ZbVVxYLfd22QRMBXFoJBOvhv0RfZUeTyZKEY5 WxxQGfVHyFEk57b/FR6UN3AIsQAKsvwJozzboaZGe9XVh4ueRqS3i/3jKu8W7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1668179048; 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=pykQ3didJXuBiN6lnlWvmlnJ1CHEab8DcEFKaz2wU8U=; b=HRY7lO88pnKVb2x+2uGKyHN+7fuVzsAyRNVwbCPVJ/veCnD2F+ovWhUd24xl7E5HRwf2QE ACme+V58Z5mZxBuZUEVoU1Dvt3J6OcYZOOqE/wE3RJ2YyZGdjChenYx6yoOpzUDPCOa7IO TLKG5+KIVT5y3H7U4w7Q/YjCOVCtHBljQGP1yZYTKhrZCeCOcZYmhsAH7A+WoCB1mD6MZp yF++N2qKQGlLvWRyn8IQb8qMSqjPkO08QGbPZR1mQVoNeBcLCL/nS0+NAUlETFZ85XBqKp RLZIsKGwfPt+6MUwaw+S2h/gWwv7pbJG+8g9kAwx3PwY30z0Li2X9UjAY3igjw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1668179048; a=rsa-sha256; cv=none; b=UOx8yjg4CQGYSf7LzqULOAgOM0zs1wQIdaeW6j7GV3q5kncS6/EhnhkHMSSf7pMxZVwT7H tW7HWBs3RodV/KvV5XrCmLJ9N5b0s2wbNjLRVG81KxoF/CXcmWRarzkhJbq8jIi/1Tqku5 0c2TvdYyvvzA4ZUejuN/8vvpo0ZYV+MVXweCYiQh/Aoe881QlIeWeqi6ah66XrJjgb1h27 2Q5OaTv4SdJPNhMjDF7x11kPFZrJnLZihQK0mBnKf1ypEaHeOOqSymqlpQ+ms0woB8ED61 mhQpvodgUya0HBJ9fzWBtPcQkfKNsVbotjMOeBTEFuIzfVkMKKX7OhIYDlMzbA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none 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 4N826J11nrzmDw; Fri, 11 Nov 2022 15:04:08 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.16.1/8.16.1) with ESMTP id 2ABF48Zf094164; Fri, 11 Nov 2022 15:04:08 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.16.1/8.16.1/Submit) id 2ABF48BR094163; Fri, 11 Nov 2022 15:04:08 GMT (envelope-from git) Date: Fri, 11 Nov 2022 15:04:08 GMT Message-Id: <202211111504.2ABF48BR094163@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Mark Johnston Subject: git: 691e23e6c5d9 - main - bhyve: Drop volatile qualifiers from xhci hw struct 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: markj X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 691e23e6c5d9f46828cafbce156909d14bce635c Auto-Submitted: auto-generated X-ThisMailContainsUnwantedMimeParts: N The branch main has been updated by markj: URL: https://cgit.FreeBSD.org/src/commit/?id=691e23e6c5d9f46828cafbce156909d14bce635c commit 691e23e6c5d9f46828cafbce156909d14bce635c Author: Mark Johnston AuthorDate: 2022-11-11 15:01:52 +0000 Commit: Mark Johnston CommitDate: 2022-11-11 15:01:52 +0000 bhyve: Drop volatile qualifiers from xhci hw struct fields This fixes a warning raised by the removal of the volatile qualifier from &trb->qwTrb0 in the following snippet: xfer_block = usb_data_xfer_append(xfer, (void *)(trbflags & XHCI_TRB_3_IDT_BIT ? &trb->qwTrb0 : XHCI_GADDR(sc, trb->qwTrb0)), trb->dwTrb2 & 0x1FFFF, (void *)addr, ccs); The use of volatile appears to be inherited from the kernel driver's definitions of the same structures. It makes some sense, since USB TRBs and related structures live in guest memory, but bhyve device models generally don't volatile-qualify accesses to guest memory and I can't see how they are required for correctness here. Moreover, XHCI_GADDR does not return volatile pointers so we're already being inconsistent. Just drop the qualifiers to address the warning. MFC after: 2 weeks Reviewed by: corvink, jhb Differential Revision: https://reviews.freebsd.org/D37290 --- usr.sbin/bhyve/pci_xhci.h | 64 +++++++++++++++++++++++------------------------ 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/usr.sbin/bhyve/pci_xhci.h b/usr.sbin/bhyve/pci_xhci.h index 7502f9396abb..9112b5b30c74 100644 --- a/usr.sbin/bhyve/pci_xhci.h +++ b/usr.sbin/bhyve/pci_xhci.h @@ -90,7 +90,7 @@ enum { #define XHCI_PAGE_SIZE 4096 /* bytes */ struct xhci_slot_ctx { - volatile uint32_t dwSctx0; + uint32_t dwSctx0; #define XHCI_SCTX_0_ROUTE_SET(x) ((x) & 0xFFFFF) #define XHCI_SCTX_0_ROUTE_GET(x) ((x) & 0xFFFFF) #define XHCI_SCTX_0_SPEED_SET(x) (((x) & 0xF) << 20) @@ -101,14 +101,14 @@ struct xhci_slot_ctx { #define XHCI_SCTX_0_HUB_GET(x) (((x) >> 26) & 0x1) #define XHCI_SCTX_0_CTX_NUM_SET(x) (((x) & 0x1F) << 27) #define XHCI_SCTX_0_CTX_NUM_GET(x) (((x) >> 27) & 0x1F) - volatile uint32_t dwSctx1; + uint32_t dwSctx1; #define XHCI_SCTX_1_MAX_EL_SET(x) ((x) & 0xFFFF) #define XHCI_SCTX_1_MAX_EL_GET(x) ((x) & 0xFFFF) #define XHCI_SCTX_1_RH_PORT_SET(x) (((x) & 0xFF) << 16) #define XHCI_SCTX_1_RH_PORT_GET(x) (((x) >> 16) & 0xFF) #define XHCI_SCTX_1_NUM_PORTS_SET(x) (((x) & 0xFF) << 24) #define XHCI_SCTX_1_NUM_PORTS_GET(x) (((x) >> 24) & 0xFF) - volatile uint32_t dwSctx2; + uint32_t dwSctx2; #define XHCI_SCTX_2_TT_HUB_SID_SET(x) ((x) & 0xFF) #define XHCI_SCTX_2_TT_HUB_SID_GET(x) ((x) & 0xFF) #define XHCI_SCTX_2_TT_PORT_NUM_SET(x) (((x) & 0xFF) << 8) @@ -117,19 +117,19 @@ struct xhci_slot_ctx { #define XHCI_SCTX_2_TT_THINK_TIME_GET(x) (((x) >> 16) & 0x3) #define XHCI_SCTX_2_IRQ_TARGET_SET(x) (((x) & 0x3FF) << 22) #define XHCI_SCTX_2_IRQ_TARGET_GET(x) (((x) >> 22) & 0x3FF) - volatile uint32_t dwSctx3; + uint32_t dwSctx3; #define XHCI_SCTX_3_DEV_ADDR_SET(x) ((x) & 0xFF) #define XHCI_SCTX_3_DEV_ADDR_GET(x) ((x) & 0xFF) #define XHCI_SCTX_3_SLOT_STATE_SET(x) (((x) & 0x1F) << 27) #define XHCI_SCTX_3_SLOT_STATE_GET(x) (((x) >> 27) & 0x1F) - volatile uint32_t dwSctx4; - volatile uint32_t dwSctx5; - volatile uint32_t dwSctx6; - volatile uint32_t dwSctx7; + uint32_t dwSctx4; + uint32_t dwSctx5; + uint32_t dwSctx6; + uint32_t dwSctx7; }; struct xhci_endp_ctx { - volatile uint32_t dwEpCtx0; + uint32_t dwEpCtx0; #define XHCI_EPCTX_0_EPSTATE_SET(x) ((x) & 0x7) #define XHCI_EPCTX_0_EPSTATE_GET(x) ((x) & 0x7) #define XHCI_EPCTX_0_MULT_SET(x) (((x) & 0x3) << 8) @@ -140,7 +140,7 @@ struct xhci_endp_ctx { #define XHCI_EPCTX_0_LSA_GET(x) (((x) >> 15) & 0x1) #define XHCI_EPCTX_0_IVAL_SET(x) (((x) & 0xFF) << 16) #define XHCI_EPCTX_0_IVAL_GET(x) (((x) >> 16) & 0xFF) - volatile uint32_t dwEpCtx1; + uint32_t dwEpCtx1; #define XHCI_EPCTX_1_CERR_SET(x) (((x) & 0x3) << 1) #define XHCI_EPCTX_1_CERR_GET(x) (((x) >> 1) & 0x3) #define XHCI_EPCTX_1_EPTYPE_SET(x) (((x) & 0x7) << 3) @@ -151,32 +151,32 @@ struct xhci_endp_ctx { #define XHCI_EPCTX_1_MAXB_GET(x) (((x) >> 8) & 0xFF) #define XHCI_EPCTX_1_MAXP_SIZE_SET(x) (((x) & 0xFFFF) << 16) #define XHCI_EPCTX_1_MAXP_SIZE_GET(x) (((x) >> 16) & 0xFFFF) - volatile uint64_t qwEpCtx2; + uint64_t qwEpCtx2; #define XHCI_EPCTX_2_DCS_SET(x) ((x) & 0x1) #define XHCI_EPCTX_2_DCS_GET(x) ((x) & 0x1) #define XHCI_EPCTX_2_TR_DQ_PTR_MASK 0xFFFFFFFFFFFFFFF0U - volatile uint32_t dwEpCtx4; + uint32_t dwEpCtx4; #define XHCI_EPCTX_4_AVG_TRB_LEN_SET(x) ((x) & 0xFFFF) #define XHCI_EPCTX_4_AVG_TRB_LEN_GET(x) ((x) & 0xFFFF) #define XHCI_EPCTX_4_MAX_ESIT_PAYLOAD_SET(x) (((x) & 0xFFFF) << 16) #define XHCI_EPCTX_4_MAX_ESIT_PAYLOAD_GET(x) (((x) >> 16) & 0xFFFF) - volatile uint32_t dwEpCtx5; - volatile uint32_t dwEpCtx6; - volatile uint32_t dwEpCtx7; + uint32_t dwEpCtx5; + uint32_t dwEpCtx6; + uint32_t dwEpCtx7; }; struct xhci_input_ctx { #define XHCI_INCTX_NON_CTRL_MASK 0xFFFFFFFCU - volatile uint32_t dwInCtx0; + uint32_t dwInCtx0; #define XHCI_INCTX_0_DROP_MASK(n) (1U << (n)) - volatile uint32_t dwInCtx1; + uint32_t dwInCtx1; #define XHCI_INCTX_1_ADD_MASK(n) (1U << (n)) - volatile uint32_t dwInCtx2; - volatile uint32_t dwInCtx3; - volatile uint32_t dwInCtx4; - volatile uint32_t dwInCtx5; - volatile uint32_t dwInCtx6; - volatile uint32_t dwInCtx7; + uint32_t dwInCtx2; + uint32_t dwInCtx3; + uint32_t dwInCtx4; + uint32_t dwInCtx5; + uint32_t dwInCtx6; + uint32_t dwInCtx7; }; struct xhci_input_dev_ctx { @@ -197,7 +197,7 @@ struct xhci_dev_ctx { #define ctx_ep ctx_dev_slep.u_ep struct xhci_stream_ctx { - volatile uint64_t qwSctx0; + uint64_t qwSctx0; #define XHCI_SCTX_0_DCS_GET(x) ((x) & 0x1) #define XHCI_SCTX_0_DCS_SET(x) ((x) & 0x1) #define XHCI_SCTX_0_SCT_SET(x) (((x) & 0x7) << 1) @@ -211,15 +211,15 @@ struct xhci_stream_ctx { #define XHCI_SCTX_0_SCT_PRIM_SSA_128 0x6 #define XHCI_SCTX_0_SCT_PRIM_SSA_256 0x7 #define XHCI_SCTX_0_TR_DQ_PTR_MASK 0xFFFFFFFFFFFFFFF0U - volatile uint32_t dwSctx2; - volatile uint32_t dwSctx3; + uint32_t dwSctx2; + uint32_t dwSctx3; }; struct xhci_trb { - volatile uint64_t qwTrb0; + uint64_t qwTrb0; #define XHCI_TRB_0_DIR_IN_MASK (0x80ULL << 0) #define XHCI_TRB_0_WLENGTH_MASK (0xFFFFULL << 48) - volatile uint32_t dwTrb2; + uint32_t dwTrb2; #define XHCI_TRB_2_ERROR_GET(x) (((x) >> 24) & 0xFF) #define XHCI_TRB_2_ERROR_SET(x) (((x) & 0xFF) << 24) #define XHCI_TRB_2_TDSZ_GET(x) (((x) >> 17) & 0x1F) @@ -233,7 +233,7 @@ struct xhci_trb { #define XHCI_TRB_2_STREAM_GET(x) (((x) >> 16) & 0xFFFF) #define XHCI_TRB_2_STREAM_SET(x) (((x) & 0xFFFF) << 16) - volatile uint32_t dwTrb3; + uint32_t dwTrb3; #define XHCI_TRB_3_TYPE_GET(x) (((x) >> 10) & 0x3F) #define XHCI_TRB_3_TYPE_SET(x) (((x) & 0x3F) << 10) #define XHCI_TRB_3_CYCLE_BIT (1U << 0) @@ -347,9 +347,9 @@ struct xhci_dev_endpoint_trbs { }; struct xhci_event_ring_seg { - volatile uint64_t qwEvrsTablePtr; - volatile uint32_t dwEvrsTableSize; - volatile uint32_t dwEvrsReserved; + uint64_t qwEvrsTablePtr; + uint32_t dwEvrsTableSize; + uint32_t dwEvrsReserved; }; #endif /* _PCI_XHCI_H_ */