Received: by 2002:a89:2c3:0:b0:1ed:23cc:44d1 with SMTP id d3csp137205lqs; Mon, 4 Mar 2024 18:42:15 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCW55GS8+Hq9KOadh2/5GxUPEyZ6yh0oyMGmsQdkx7Jy9xvCpeErsaL29T0SHM+5vmMrohFR018n69umhJx+dhgJhSUG+AbXJ8slwSVRTA== X-Google-Smtp-Source: AGHT+IGswe8cPd4JY5xwQmjWfxXjsAPNd+0dFlwHYIQpAdeWEkQfTLp0TU32xLXpDZXhHcAxuc1C X-Received: by 2002:a05:6a00:b41:b0:6e5:78bf:d40d with SMTP id p1-20020a056a000b4100b006e578bfd40dmr11757263pfo.18.1709606534722; Mon, 04 Mar 2024 18:42:14 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709606534; cv=pass; d=google.com; s=arc-20160816; b=0H59YMnwMtsj1Fx+8x/n0dWmvQveHsrXxd0S0os/Y2xqe+I/J5+dche3bIQWIylorn cYDNmpu6rqwzPx7DUvcPZweTRNf6c4JRGpEiemM9VlkIXOoxo+4txoZER9sgZyruVwlp bwZM+v+fjr8hIJRu6dcd24g88vUoqGhP+46P79ITv+uYVkrxrDGNuS2z0bPpjPRNt8Ag vIAiJS5IGPpTH0eZZuMFJFURXln0sKyAazLUJdMUbtuVFmcp3DMuRmJry3Hb1FKRBmyR zVveQiNdNo4l+mP43L0MIE15pDYJ2gEV0UJb478gEtnEGAK3epxhkGizwV8B5+0ptD8l hGfg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=9iWyZf0xI/n7HijBvsKlhYoz8fImeeCp04MPECpM+ZU=; fh=q/aNRRwbk+AHb42I2d6wYfBCRE+T0txaX+dEwQcyGW0=; b=hzIlz1GmHIg1HaRroJfCwHClDzAijy/3rlUh0nLG8bUkrTtCTJGi9RFmH+FVUmdTgP CVkcpnmIriRBQcnzwg6tlxhBeUgtZmBRuSiNui6GcFrihk9WdnvHX0c3BF+ztoQRTCrO wiLrVmX6dUCb77c74cLst+61FCuUt8rdh4fbTFb0gaIJPtzWrBl8WgJouGK+mQGLEX2V 2aXD5mxE4IMskqB0iguIDGPNvU1+OSFRigmTx54rt9Z6vbdGaGnkV9tnqmI1NxnYhGBz Ucu642U8P+GtEw47YaZZhR/KUWyfxKniOBqd2jEGlq086dGOKc94/44YT6sv5GpPNp4/ 9Zqw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=NcDLW+5W; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-91505-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-91505-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id fm23-20020a056a002f9700b006e488edb5e2si8784920pfb.78.2024.03.04.18.42.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Mar 2024 18:42:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-91505-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=NcDLW+5W; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-91505-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-91505-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id C0CC7B23E55 for ; Tue, 5 Mar 2024 01:40:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 69B971B81E; Tue, 5 Mar 2024 01:39:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="NcDLW+5W" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 40CD41AAD3 for ; Tue, 5 Mar 2024 01:39:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.17 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709602771; cv=none; b=Wd4HPP8tviMsFuK+bslc2GwIssJqPetVhAOYGQh4lmYkXY/CWpcZN89tgLLBFgkniJMXvxIlt1OEdnVzKdI9CBWaDf1DVn6l8NT9q8yMrg9SyhPe07OZg6K4l+0ObHiVcBkQ2loheeVDc9ir1TEdgReOu////ATeOP21zch35V8= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709602771; c=relaxed/simple; bh=qIJJGnwDPVDv4F7r6y/s39ika2Bz0nOGa718N4ZxZGg=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=bqi8KqBWfFzCrM3BisbriAXjTzlZKnuZjRtayJd28lvAXefc+3wN8a5PjUMvVcOcWtyG7X/hndzwPAtvo1EldjIbB1ZoCBDRGiEW6mSsuRGyjEFTERBL0sZv777VI4IcxwCAsHT+cbF3xayGKdcJSKpCbsLxY0J98Zl6diOTwGU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=NcDLW+5W; arc=none smtp.client-ip=198.175.65.17 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1709602770; x=1741138770; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=qIJJGnwDPVDv4F7r6y/s39ika2Bz0nOGa718N4ZxZGg=; b=NcDLW+5Wch8F6MgI2ncxdbWutcwKXgY+8YoZq0DSDeOoKY8YUkXiKrbF 0jcmlLo395FI+tRkvjB3fsdUeTaRgbp0plt4lIus/Iv/gSrppXJgOs6Lp y9CauQkUVHvxlqUvs4vgZcXJ9L5kZ3X2YCVStQ3d4Usrr5FgtMM+zYcW0 MFT+/4sEUPvnKyRdmxDcKQILuCrYtHhyid+r/TvlMgV9oW3VbCSSFNpk2 KfEiB9NQn5MA8n+Iap36iFpauqvrBPxO+Hrnm3E8AzPhO/wKRbbwq3wTl gLi9yuj0T5QmDxf8EPdI5eDoC48vDrWkvHGfOSlBu7pzojbf0+pONkykZ g==; X-IronPort-AV: E=McAfee;i="6600,9927,11003"; a="4286734" X-IronPort-AV: E=Sophos;i="6.06,205,1705392000"; d="scan'208";a="4286734" Received: from orviesa004.jf.intel.com ([10.64.159.144]) by orvoesa109.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 04 Mar 2024 17:39:30 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.06,205,1705392000"; d="scan'208";a="13865517" Received: from allen-box.sh.intel.com ([10.239.159.127]) by orviesa004.jf.intel.com with ESMTP; 04 Mar 2024 17:39:28 -0800 From: Lu Baolu To: Joerg Roedel , Will Deacon , Robin Murphy , Jason Gunthorpe , Kevin Tian , Eric Badger Cc: iommu@lists.linux.dev, linux-kernel@vger.kernel.org, Lu Baolu Subject: [PATCH v3 5/5] iommu/vt-d: Remove scalabe mode in domain_context_clear_one() Date: Tue, 5 Mar 2024 09:33:05 +0800 Message-Id: <20240305013305.204605-6-baolu.lu@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20240305013305.204605-1-baolu.lu@linux.intel.com> References: <20240305013305.204605-1-baolu.lu@linux.intel.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit domain_context_clear_one() only handles the context entry teardown in legacy mode. Remove the scalable mode check in it to avoid dead code. Remove an unnecessary check in the code as well. Signed-off-by: Lu Baolu Reviewed-by: Kevin Tian --- drivers/iommu/intel/iommu.c | 15 +-------------- 1 file changed, 1 insertion(+), 14 deletions(-) diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c index d682eb6ad4d2..50eb9aed47cc 100644 --- a/drivers/iommu/intel/iommu.c +++ b/drivers/iommu/intel/iommu.c @@ -2175,9 +2175,6 @@ static void domain_context_clear_one(struct device_domain_info *info, u8 bus, u8 struct context_entry *context; u16 did_old; - if (!iommu) - return; - spin_lock(&iommu->lock); context = iommu_context_addr(iommu, bus, devfn, 0); if (!context) { @@ -2185,14 +2182,7 @@ static void domain_context_clear_one(struct device_domain_info *info, u8 bus, u8 return; } - if (sm_supported(iommu)) { - if (hw_pass_through && domain_type_is_si(info->domain)) - did_old = FLPT_DEFAULT_DID; - else - did_old = domain_id_iommu(info->domain, iommu); - } else { - did_old = context_domain_id(context); - } + did_old = context_domain_id(context); context_clear_entry(context); __iommu_flush_cache(iommu, context, sizeof(*context)); @@ -2203,9 +2193,6 @@ static void domain_context_clear_one(struct device_domain_info *info, u8 bus, u8 DMA_CCMD_MASK_NOBIT, DMA_CCMD_DEVICE_INVL); - if (sm_supported(iommu)) - qi_flush_pasid_cache(iommu, did_old, QI_PC_ALL_PASIDS, 0); - iommu->flush.flush_iotlb(iommu, did_old, 0, -- 2.34.1