From nobody Sat Apr 11 20:07:57 2026 Delivered-To: importer@patchew.org Authentication-Results: mx.zohomail.com; dkim=pass header.i=@intel.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass(p=none dis=none) header.from=intel.com ARC-Seal: i=1; a=rsa-sha256; t=1775188684; cv=none; d=zohomail.com; s=zohoarc; b=k6nzzOPWd1TNuGN1NTEMTEczYImh03ky0hRT3j1n0HU4cACbHGJ+8MSghw7oJiDxaa83L3vh6orjYf5IqShFREiycMqOGSkGFh3ascZiz1nQAy3mIQU0bEs+hzHvHG60dr82MbmHj6esCqYn/rzCKsQx37C3+NNsbe2k+CtHUL4= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1775188684; h=Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=CTPDQE5nwDeItQE+vuvFjZLq3KOfr1DmNADnSn3o+68=; b=R1xPwgHdx6oMiTSmlltsgPQIptAgK3nHw46Am5cjDcYLuYIUJ/R+rn6te3OW2a79lvOqRGWjcYnekgwjyJ6/RtSkorilvKNTBM8Bi8bWVgLh2r9ow80NgIX4ksJMwyAZO7F/vKhrlr2J3wVOGOBYD/518AVd4P5YPqhIMdwuFcA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass header.i=@intel.com; spf=pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom=qemu-devel-bounces+importer=patchew.org@nongnu.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) by mx.zohomail.com with SMTPS id 1775188684431762.0511732009974; Thu, 2 Apr 2026 20:58:04 -0700 (PDT) Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1w8Ve8-0001MM-4M; Thu, 02 Apr 2026 23:56:36 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1w8Ve0-0001L6-QE for qemu-devel@nongnu.org; Thu, 02 Apr 2026 23:56:30 -0400 Received: from mgamail.intel.com ([198.175.65.19]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1w8Vdy-0004N9-Us for qemu-devel@nongnu.org; Thu, 02 Apr 2026 23:56:28 -0400 Received: from fmviesa007.fm.intel.com ([10.60.135.147]) by orvoesa111.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Apr 2026 20:56:26 -0700 Received: from unknown (HELO gnr-sp-2s-612.sh.intel.com) ([10.112.230.229]) by fmviesa007-auth.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Apr 2026 20:56:23 -0700 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1775188587; x=1806724587; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=mfXdfQl9POujA0hQEorAHvjyvPh51rTk6rz0RNAFMBU=; b=KlCrfclvCivFL4c6VctewMpjn8TSTrwnFCiB8CcLqb0adMoWdPsfwOvC g4h56mSmbo/CK9pMA8YDK/bUnmXPLbL2ZbYmA9nbF5ZjFSbL3EHxjwsxw cijYn8zI0WVDORYe1HBHxgTCT2xFAF09geF8R7o++94bX2kTGM/WA9jgh dv24tv3CaZZtD9oz4xWj1G/lpinr5ePwl/WAx875WI3aJQWW574RaB5v1 csXuvsm5BCZUdswacjk3ZO/rhIXI7fo0iBBxxN028yuIxJnZTsd9S6DCK mDibmjElErLcGeFDM64GsHNdY/DuO5ck9ShgMfBdubd9T20zXoCvgu8ID A==; X-CSE-ConnectionGUID: kRUrvwVYSEuHzDsZzRcDrg== X-CSE-MsgGUID: EXRz7F7zQS+LD3JX6/pW6A== X-IronPort-AV: E=McAfee;i="6800,10657,11747"; a="76140666" X-IronPort-AV: E=Sophos;i="6.23,157,1770624000"; d="scan'208";a="76140666" X-CSE-ConnectionGUID: dmytq7ywRkuErKUxuHYG2g== X-CSE-MsgGUID: MXyG1X11RqizFhwtkTjPNA== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.23,157,1770624000"; d="scan'208";a="223884918" From: Zhenzhong Duan To: qemu-devel@nongnu.org Cc: alex@shazbot.org, clg@redhat.com, eric.auger@redhat.com, mst@redhat.com, jasowang@redhat.com, jgg@nvidia.com, nicolinc@nvidia.com, skolothumtho@nvidia.com, joao.m.martins@oracle.com, clement.mathieu--drif@bull.com, kevin.tian@intel.com, yi.l.liu@intel.com, xudong.hao@intel.com, Zhenzhong Duan Subject: [PATCH v3 10/14] intel_iommu_accel: Bypass PASID entry addition for just deleted entry Date: Thu, 2 Apr 2026 23:55:34 -0400 Message-ID: <20260403035541.18355-11-zhenzhong.duan@intel.com> X-Mailer: git-send-email 2.47.3 In-Reply-To: <20260403035541.18355-1-zhenzhong.duan@intel.com> References: <20260403035541.18355-1-zhenzhong.duan@intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Received-SPF: pass (zohomail.com: domain of gnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; envelope-from=qemu-devel-bounces+importer=patchew.org@nongnu.org; helo=lists.gnu.org; Received-SPF: pass client-ip=198.175.65.19; envelope-from=zhenzhong.duan@intel.com; helo=mgamail.intel.com X-Spam_score_int: -48 X-Spam_score: -4.9 X-Spam_bar: ---- X-Spam_report: (-4.9 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.542, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_MED=-2.3, RCVD_IN_VALIDITY_CERTIFIED_BLOCKED=0.001, RCVD_IN_VALIDITY_RPBL_BLOCKED=0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: qemu development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+importer=patchew.org@nongnu.org Sender: qemu-devel-bounces+importer=patchew.org@nongnu.org X-ZohoMail-DKIM: pass (identity @intel.com) X-ZM-MESSAGEID: 1775188687018154100 Content-Type: text/plain; charset="utf-8" For VTD_INV_DESC_PASIDC_G_PASID_SI typed pc_inv_dsc invalidation, if an pasid entry is just removed, it can never be a new entry to add. So calling vtd_replay_pasid_bind_for_dev() is unnecessary. Introduce a new field accel_pce_deleted in VTDPASIDCacheInfo to mark this case and to do the bypassing. Suggested-by: Yi Liu Signed-off-by: Zhenzhong Duan Tested-by: Xudong Hao --- hw/i386/intel_iommu_internal.h | 1 + hw/i386/intel_iommu_accel.c | 16 +++++++++++++--- 2 files changed, 14 insertions(+), 3 deletions(-) diff --git a/hw/i386/intel_iommu_internal.h b/hw/i386/intel_iommu_internal.h index 623dc24760..2c716c5297 100644 --- a/hw/i386/intel_iommu_internal.h +++ b/hw/i386/intel_iommu_internal.h @@ -630,6 +630,7 @@ typedef struct VTDPASIDCacheInfo { uint8_t type; uint16_t did; uint32_t pasid; + bool accel_pce_deleted; } VTDPASIDCacheInfo; =20 typedef struct VTDPIOTLBInvInfo { diff --git a/hw/i386/intel_iommu_accel.c b/hw/i386/intel_iommu_accel.c index b951d90135..457fdcba62 100644 --- a/hw/i386/intel_iommu_accel.c +++ b/hw/i386/intel_iommu_accel.c @@ -302,10 +302,15 @@ static void vtd_accel_fill_pc(VTDHostIOMMUDevice *vtd= _hiod, uint32_t pasid, QLIST_INSERT_HEAD(&vtd_hiod->pasid_cache_list, vtd_pce, next); } =20 -static void vtd_accel_delete_pc(VTDAccelPASIDCacheEntry *vtd_pce) +static void vtd_accel_delete_pc(VTDAccelPASIDCacheEntry *vtd_pce, + VTDPASIDCacheInfo *pc_info) { QLIST_REMOVE(vtd_pce, next); g_free(vtd_pce); + + if (pc_info->type =3D=3D VTD_INV_DESC_PASIDC_G_PASID_SI) { + pc_info->accel_pce_deleted =3D true; + } } =20 static void @@ -339,7 +344,7 @@ vtd_accel_pasid_cache_invalidate_one(VTDAccelPASIDCache= Entry *vtd_pce, * to be either all-zero or non-present. Either case means existing * pasid cache should be invalidated. */ - vtd_accel_delete_pc(vtd_pce); + vtd_accel_delete_pc(vtd_pce, pc_info); } } =20 @@ -502,7 +507,12 @@ void vtd_accel_pasid_cache_sync(IntelIOMMUState *s, VT= DPASIDCacheInfo *pc_info) * removed. */ vtd_accel_pasid_cache_invalidate(vtd_hiod, pc_info); - vtd_accel_replay_pasid_bind_for_dev(vtd_hiod, start, end, pc_info); + + if (pc_info->accel_pce_deleted) { + pc_info->accel_pce_deleted =3D false; + } else { + vtd_accel_replay_pasid_bind_for_dev(vtd_hiod, start, end, pc_i= nfo); + } } } =20 --=20 2.47.3