From nobody Wed Sep 11 08:44:23 2024 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 4X3Yyw1k8Lz5W7WP; Wed, 11 Sep 2024 08:44:24 +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 4X3Yyv5WqCz41nf; Wed, 11 Sep 2024 08:44:23 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1726044263; 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=0Cdh6Ni68Uf15vQfeNL5kAXoi4Pdi31//poXwex4Kw8=; b=BQhz1DPzdk/q3G/NOOxAxvECMakf2pFSJpayDM490U5F6e7cf65CrsKsYBgCr56Yae8nJ/ AMTteZduW5ukDR4u0p5atMU6lagoE/AXpVxdrsXekMA+1Ocd4IHts5QilcDb1j7mFrcLSB ZFJJhqHvJ49mhjTnEDGoKEGEo8ESPZcl2QL5A+120a17mOUaUiD0wNan/q2QrU395uiCiD 4yDyGq2YwIx5zTqv4mQFCZrHc0T5wU1/BBPwYnXYI9dQ727IXMOCh6iG635BVGPNjZp3nj f7DSfuRBjYiueGEx9K/33FXh7Bs1y4EbHJ2du/coRWLFnP01uD1VdGof8/5vLQ== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1726044263; a=rsa-sha256; cv=none; b=S8P9kEeJZUy0fHvgnjRddPR2uJmVdTtoTrhsbW1WtnDzVr3vbpcTxrgSwJDHnusAkuyGnR e0h0XOFyTcf0A5Wj9jibtdt7SDdUldNJ5W9w9BslH08JfGHFA8UDGULPyJl+D3G0l1QC8t X/3f+LYP8edvCj4vNjk2huF3cRaGeYN1ogp9wH3lM+fVXosy+s03p+Nm51o5wvHK/b0Zyi LFfpMjHM5SkChTClib+MpCVdhNPvmiTCt6Tb9hBTTwnRtse7qemwgZvIBh3FXT3aWkz/4+ l3Id8PhAQyyKErmDUXaK6OWnScJjthYWPlwhHXSSn80btaz1RwlzAKVjKDXrOQ== 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=1726044263; 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=0Cdh6Ni68Uf15vQfeNL5kAXoi4Pdi31//poXwex4Kw8=; b=h1flJRlZ6KexD5uyw6MjFmf+gFVQVg28NconxXDVgJuLpXwr+IkVIVx5wlk6phTbyK4rO9 v4wVF1ZFtW/4QF8H1f8gZWJkNp1NeHB7ki760NFVDuGLAnWr8mkIQDajlKdl3hjOemIoZ+ eOtQ/RI9pWfRq5+pNgvNv8SK3quZh6OmkYjESu6EZcs4xRZkRdzN9+/p2DAt6EqeI5fMrJ cuWKuQAlizhjq9F43kDHVUe+UXYR8ysmgLxbqp8kNU5IPDRhvNdUc3WvZAx8YCpKyFt/24 YllsJGZGMmPS1PcUMdd1kLw8v4HbZ4zM6y8pzmvKpZipYma5rVorIor/567yjg== 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 4X3Yyv53fjzP5K; Wed, 11 Sep 2024 08:44:23 +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 48B8iNVK007453; Wed, 11 Sep 2024 08:44:23 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 48B8iNP9007450; Wed, 11 Sep 2024 08:44:23 GMT (envelope-from git) Date: Wed, 11 Sep 2024 08:44:23 GMT Message-Id: <202409110844.48B8iNP9007450@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org From: Konstantin Belousov Subject: git: 3a00c673465f - stable/14 - dmar_qi_XXX_invalidate_glob(): reduce code duplication 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: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@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/stable/14 X-Git-Reftype: branch X-Git-Commit: 3a00c673465f347b2bd07d445c6f8108ff2b7ef0 Auto-Submitted: auto-generated The branch stable/14 has been updated by kib: URL: https://cgit.FreeBSD.org/src/commit/?id=3a00c673465f347b2bd07d445c6f8108ff2b7ef0 commit 3a00c673465f347b2bd07d445c6f8108ff2b7ef0 Author: Konstantin Belousov AuthorDate: 2024-06-09 17:24:31 +0000 Commit: Konstantin Belousov CommitDate: 2024-09-11 08:43:59 +0000 dmar_qi_XXX_invalidate_glob(): reduce code duplication (cherry picked from commit f776a2b849726e7b86735b2930be64f5a2edf731) --- sys/x86/iommu/intel_qi.c | 38 ++++++++++++++------------------------ 1 file changed, 14 insertions(+), 24 deletions(-) diff --git a/sys/x86/iommu/intel_qi.c b/sys/x86/iommu/intel_qi.c index 3b7f64285c90..9c7cd1e99c86 100644 --- a/sys/x86/iommu/intel_qi.c +++ b/sys/x86/iommu/intel_qi.c @@ -195,14 +195,14 @@ dmar_qi_invalidate_emit(struct iommu_domain *idomain, iommu_gaddr_t base, iommu_qi_emit_wait_seq(DMAR2IOMMU(unit), pseq, emit_wait); } -void -dmar_qi_invalidate_ctx_glob_locked(struct dmar_unit *unit) +static void +dmar_qi_invalidate_glob_impl(struct dmar_unit *unit, uint64_t data1) { struct iommu_qi_genseq gseq; DMAR_ASSERT_LOCKED(unit); dmar_qi_ensure(DMAR2IOMMU(unit), 2); - dmar_qi_emit(unit, DMAR_IQ_DESCR_CTX_INV | DMAR_IQ_DESCR_CTX_GLOB, 0); + dmar_qi_emit(unit, data1, 0); iommu_qi_emit_wait_seq(DMAR2IOMMU(unit), &gseq, true); /* See dmar_qi_invalidate_sync(). */ unit->x86c.inv_seq_waiters++; @@ -211,34 +211,24 @@ dmar_qi_invalidate_ctx_glob_locked(struct dmar_unit *unit) } void -dmar_qi_invalidate_iotlb_glob_locked(struct dmar_unit *unit) +dmar_qi_invalidate_ctx_glob_locked(struct dmar_unit *unit) { - struct iommu_qi_genseq gseq; + dmar_qi_invalidate_glob_impl(unit, DMAR_IQ_DESCR_CTX_INV | + DMAR_IQ_DESCR_CTX_GLOB); +} - DMAR_ASSERT_LOCKED(unit); - dmar_qi_ensure(DMAR2IOMMU(unit), 2); - dmar_qi_emit(unit, DMAR_IQ_DESCR_IOTLB_INV | DMAR_IQ_DESCR_IOTLB_GLOB | - DMAR_IQ_DESCR_IOTLB_DW | DMAR_IQ_DESCR_IOTLB_DR, 0); - iommu_qi_emit_wait_seq(DMAR2IOMMU(unit), &gseq, true); - /* See dmar_qi_invalidate_sync(). */ - unit->x86c.inv_seq_waiters++; - dmar_qi_advance_tail(DMAR2IOMMU(unit)); - iommu_qi_wait_for_seq(DMAR2IOMMU(unit), &gseq, false); +void +dmar_qi_invalidate_iotlb_glob_locked(struct dmar_unit *unit) +{ + dmar_qi_invalidate_glob_impl(unit, DMAR_IQ_DESCR_IOTLB_INV | + DMAR_IQ_DESCR_IOTLB_GLOB | DMAR_IQ_DESCR_IOTLB_DW | + DMAR_IQ_DESCR_IOTLB_DR); } void dmar_qi_invalidate_iec_glob(struct dmar_unit *unit) { - struct iommu_qi_genseq gseq; - - DMAR_ASSERT_LOCKED(unit); - dmar_qi_ensure(DMAR2IOMMU(unit), 2); - dmar_qi_emit(unit, DMAR_IQ_DESCR_IEC_INV, 0); - iommu_qi_emit_wait_seq(DMAR2IOMMU(unit), &gseq, true); - /* See dmar_qi_invalidate_sync(). */ - unit->x86c.inv_seq_waiters++; - dmar_qi_advance_tail(DMAR2IOMMU(unit)); - iommu_qi_wait_for_seq(DMAR2IOMMU(unit), &gseq, false); + dmar_qi_invalidate_glob_impl(unit, DMAR_IQ_DESCR_IEC_INV); } void