From nobody Wed Sep 4 21:50:45 2024 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 4WzblV20R1z5VRth; Wed, 04 Sep 2024 21:50:46 +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 "R11" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WzblT6yghz4gwF; Wed, 4 Sep 2024 21:50:45 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1725486646; 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=MzT9JLiWgwVVlERcOtrJ40uZAUX2Nm5vz86Eu35pbuQ=; b=QXTY10KuZaUZAsp3eQ5mQnf0LLPmT32Rvf61zPiLhZlaRZh2iV+Yl2ptNwJxoo1ezOl9KL ft2rVqdnybKGUr7eFLInoaCKNJGD/vZe/tiCCcy8jN4DOhie6f3nFbyiTcylOu/AAdJlJL MqDoIdb/v5D2Nl5bHX+F8X7nhytugvDFElJCGnuQ2MXrDZdIHYu/EUcVWDaDRA6b+vbt1Z VSqkN8vuvexu6tlgmz6ujYa4W1IVKev2WNsxHeoB1wEeuRuLeO7RECysBwkkazyKU/jUFK wQEFndXmpvkLt9hJxhC0FnoOZI6NeMgkk60dzLtl1uZWov+VJ/N2EKQ6J4lsiQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1725486646; a=rsa-sha256; cv=none; b=IoEj1r/WNxbdhMtF+hs5qkGV06pQSfI7ehtjtvP6JpMaUNd1M3NeT3i7r+sKODULUhbAsG UE8odMS0iqPUjdwPnVbl++Qd8YrK0P5zk6FxTqTJmcnmLq7E6jPvxlsOagI/jvy0dnUrXZ twNneHaqNrPSciDw7B871lVGkKPZslFmo0KHNKFze6qJP5huZx5ScatU8np2+wgQIYO8W4 4mJcLtDqKTOECv0z0IRdA++jC10C2AkCoHpYtLQifSCfZogm2yHFEXsTf1F9tOgDr7ml5D dCXbcSULAA2pBVNUndNs9/c3S4yEZXZT0tyqY2o10ZuCcKHmybtYy9yE4i+Yxg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1725486646; 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=MzT9JLiWgwVVlERcOtrJ40uZAUX2Nm5vz86Eu35pbuQ=; b=uaL2GP3NjbyE2gONYDYPzR7tbHNPoTK/WEivBVWTWQtQ5GGFzguS7gIY8RU4wKeGZLdC0b 2B3t9hIDQiwgmtZ95nPZVvBE7BarsF2o8FHAOaI+MB5Wh35WT1YVjHiaAvnrOH7wR8Gf6T C36OFei5OH8BFgWvVxfl9ExzJ8K9r6SPgLhhqeBwsjHixHa53It/Ta9zL+sLx7Qezb1v2V dqeRblQOuyskWn8uJA0jh16jhcSwfkN+lDbN3LdjVmguvLPXSP7A9CLH4vGwaQVPvoxOMW L4GYHmQ+z7WJfWu+nRVVDWOxQUe7Tw9/pJaQLr0TiuaGNa7Pk2HBKUQd+jjucQ== 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 4WzblT6Yz5zh2r; Wed, 4 Sep 2024 21:50:45 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 484Loj5a031749; Wed, 4 Sep 2024 21:50:45 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 484LojXZ031746; Wed, 4 Sep 2024 21:50:45 GMT (envelope-from git) Date: Wed, 4 Sep 2024 21:50:45 GMT Message-Id: <202409042150.484LojXZ031746@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Konstantin Belousov Subject: git: fc8da73b93be - main - x86 iommu x86_unit_common: expand hw completion write-out area to 8 bytes 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: X-BeenThere: dev-commits-src-main@freebsd.org Sender: owner-dev-commits-src-main@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: kib X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: fc8da73b93be3f5cc50f7607dbcfc1edb911de65 Auto-Submitted: auto-generated The branch main has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=fc8da73b93be3f5cc50f7607dbcfc1edb911de65 commit fc8da73b93be3f5cc50f7607dbcfc1edb911de65 Author: Konstantin Belousov AuthorDate: 2024-06-09 14:08:28 +0000 Commit: Konstantin Belousov CommitDate: 2024-09-04 21:50:18 +0000 x86 iommu x86_unit_common: expand hw completion write-out area to 8 bytes in preparation to share it with AMD IOMMU. AMD writes out 8 bytes. We use 32-bit completion sequence numbers, and CPUs are little-endian. So the expansion is acceptable on Intel. Sponsored by: Advanced Micro Devices (AMD) Sponsored by: The FreeBSD Foundation MFC after: 1 week --- sys/x86/iommu/intel_drv.c | 4 ++-- sys/x86/iommu/x86_iommu.h | 10 ++++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/sys/x86/iommu/intel_drv.c b/sys/x86/iommu/intel_drv.c index 9fa1b3f98dc6..66d99748888f 100644 --- a/sys/x86/iommu/intel_drv.c +++ b/sys/x86/iommu/intel_drv.c @@ -1302,7 +1302,7 @@ dmar_print_one(int idx, bool show_domains, bool show_mappings) db_printf("qi is enabled: queue @0x%jx (IQA 0x%jx) " "size 0x%jx\n" " head 0x%x tail 0x%x avail 0x%x status 0x%x ctrl 0x%x\n" - " hw compl 0x%x@%p/phys@%jx next seq 0x%x gen 0x%x\n", + " hw compl 0x%jx@%p/phys@%jx next seq 0x%x gen 0x%x\n", (uintmax_t)unit->x86c.inv_queue, (uintmax_t)dmar_read8(unit, DMAR_IQA_REG), (uintmax_t)unit->x86c.inv_queue_size, @@ -1311,7 +1311,7 @@ dmar_print_one(int idx, bool show_domains, bool show_mappings) unit->x86c.inv_queue_avail, dmar_read4(unit, DMAR_ICS_REG), dmar_read4(unit, DMAR_IECTL_REG), - unit->x86c.inv_waitd_seq_hw, + (uintmax_t)unit->x86c.inv_waitd_seq_hw, &unit->x86c.inv_waitd_seq_hw, (uintmax_t)unit->x86c.inv_waitd_seq_hw_phys, unit->x86c.inv_waitd_seq, diff --git a/sys/x86/iommu/x86_iommu.h b/sys/x86/iommu/x86_iommu.h index eb1bbafbeb77..966a13c19b6e 100644 --- a/sys/x86/iommu/x86_iommu.h +++ b/sys/x86/iommu/x86_iommu.h @@ -101,8 +101,14 @@ struct x86_unit_common { vm_size_t inv_queue_size; uint32_t inv_queue_avail; uint32_t inv_queue_tail; - volatile uint32_t inv_waitd_seq_hw; /* hw writes there on wait - descr completion */ + + /* + * Hw writes there on completion of wait descriptor + * processing. Intel writes 4 bytes, while AMD does the + * 8-bytes write. Due to little-endian, and use of 4-byte + * sequence numbers, the difference does not matter for us. + */ + volatile uint64_t inv_waitd_seq_hw; uint64_t inv_waitd_seq_hw_phys; uint32_t inv_waitd_seq; /* next sequence number to use for wait descr */