From patchwork Sat Dec 2 09:24:52 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Yan Zhao X-Patchwork-Id: 172777 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:bcd1:0:b0:403:3b70:6f57 with SMTP id r17csp1675472vqy; Sat, 2 Dec 2023 01:53:56 -0800 (PST) X-Google-Smtp-Source: AGHT+IFdga+Z1Z0y2L1OF7CF6pI7VMJEqJuoSBnEIS2r05OhQEikPS1s3vclYScI7SLlbxZlq074 X-Received: by 2002:a05:6358:7e4f:b0:16f:f2e5:a76a with SMTP id p15-20020a0563587e4f00b0016ff2e5a76amr1243295rwm.16.1701510836268; Sat, 02 Dec 2023 01:53:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1701510836; cv=none; d=google.com; s=arc-20160816; b=Iq0dE1qTP4K/1w9HJo6pA0Dh5WEzCARpqZJlUaOnEmSDsrKnS/8QryEudg863AbJjf 4RMJ4+utRHegoW8M+qMhtebaa2xphn9iWXG9yZh0Q+/F/6zB4b3R8qsspp80Yoksv5/a 6/sPO6fNeXgQ+f+PqH4StvrZn4dQskvO1qmtR5OLhPdOFP+E3Q9YxNoXmkz4IO/LuTqq /Tm6ttojEKMc7e0VqeAPrmoDvHWSWktgfDD/iKZlpCs6awiRbHx3Uztlw52vbLnrUOOK PwHtNC0+ZFvRuA6xYAWvyfhszK+UcL5YbQGAS2vVDNeWSPbohX6e1x8JOfSKP1Vg6pS3 oQ1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from:dkim-signature; bh=Hc37WAeXE2nmHgxQVmlACx7psJkmF3l2t/V/V15VypA=; fh=+WI4m5k3dRLR+dR3neThuZkNBTzIm/a8HgtddERL9fA=; b=Jk3OXDu/M2J/XQSLGKMs7OUujQqjt+/0w6YhA31f1didg8Wr90S73cABFEyK3iqcLe CW/SYQlqtTJzEQ+b5Oeni3Q6xCU6Jj4H0BLC7X1roCWH4MSdShWJbFc5BIO4qca5Ef+k u4LX0Gb/Cq43A1dKOWkNB8oMRH9vGVIcVjv6Wv41OFTxsdOvsD0+6RylgCxmtmQIdL7o 7eqhmymca6Go/a7zfz697ah9AqL4szF2twx8Jljj3c04UESmNddttdl3qQL4wyrGgHiC 9TH5aATnGE/Os/oYvmrjBhkU4kOOgwyJR3fxPw1Vl/+AaZo2T9QW3dBHGp16wtJMoUbG KSQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=eWHszJLN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id c8-20020a17090a1d0800b0028658c54f6bsi2754848pjd.11.2023.12.02.01.53.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 02 Dec 2023 01:53:56 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=eWHszJLN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 495A8806083C; Sat, 2 Dec 2023 01:53:55 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229472AbjLBJxq (ORCPT + 99 others); Sat, 2 Dec 2023 04:53:46 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50754 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232345AbjLBJxp (ORCPT ); Sat, 2 Dec 2023 04:53:45 -0500 Received: from mgamail.intel.com (mgamail.intel.com [192.198.163.10]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A5F7AD50; Sat, 2 Dec 2023 01:53:51 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1701510832; x=1733046832; h=from:to:cc:subject:date:message-id:in-reply-to: references; bh=DNvEQ5Df+enLLKlvPpgNl8iSMA8LDSmYdeB3/CStJvw=; b=eWHszJLNQJpKxhmd4cOBWfgH2FcceSsLHm0/+Eaq7DmcxmUaU6zWQ2q5 TLTcyJ7S6IfQBGW7ZtE0dyHDUES+kgi6i7EJIEpB9zQCqz/yUIyjkWWzz 6hh/V8edrecTCYxVNMcCUs9yFJz/ha51H6ZmgRVbVOEuAYkPXeP/lfFYt QUTOQIMyaynYXcfJ5pY3Eouv4Y7AOD1WTlQX55Pq7DqZ5ydrnF1vfnKl6 PkZhw6+Qg9ZHBBb37EbYvdxo9iqKZLHfcbBeU9j7OuT40g8KyWXEkWokb OLVjRywITAeACNkHF06HGplHt263b+U5MPggfldLqw1osDXEW/YZxCoke g==; X-IronPort-AV: E=McAfee;i="6600,9927,10911"; a="625567" X-IronPort-AV: E=Sophos;i="6.04,245,1695711600"; d="scan'208";a="625567" Received: from orsmga003.jf.intel.com ([10.7.209.27]) by fmvoesa104.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Dec 2023 01:53:51 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10911"; a="719780723" X-IronPort-AV: E=Sophos;i="6.04,245,1695711600"; d="scan'208";a="719780723" Received: from yzhao56-desk.sh.intel.com ([10.239.159.62]) by orsmga003-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 02 Dec 2023 01:53:47 -0800 From: Yan Zhao To: iommu@lists.linux.dev, kvm@vger.kernel.org, linux-kernel@vger.kernel.org Cc: alex.williamson@redhat.com, jgg@nvidia.com, pbonzini@redhat.com, seanjc@google.com, joro@8bytes.org, will@kernel.org, robin.murphy@arm.com, kevin.tian@intel.com, baolu.lu@linux.intel.com, dwmw2@infradead.org, yi.l.liu@intel.com, Yan Zhao Subject: [RFC PATCH 19/42] iommu/vt-d: Set bit PGSNP in PASIDTE if domain cache coherency is enforced Date: Sat, 2 Dec 2023 17:24:52 +0800 Message-Id: <20231202092452.14581-1-yan.y.zhao@intel.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20231202091211.13376-1-yan.y.zhao@intel.com> References: <20231202091211.13376-1-yan.y.zhao@intel.com> X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, RCVD_IN_DNSWL_BLOCKED,SPF_HELO_NONE,SPF_NONE,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Sat, 02 Dec 2023 01:53:55 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1784163426799993679 X-GMAIL-MSGID: 1784163426799993679 Set bit PGSNP (Page Snoop, bit 88) in PASIDTE when attaching device to a domain whose cache coherency is enforced. Signed-off-by: Yan Zhao --- drivers/iommu/intel/pasid.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/drivers/iommu/intel/pasid.c b/drivers/iommu/intel/pasid.c index 74e8e4c17e814..a42955b5e666f 100644 --- a/drivers/iommu/intel/pasid.c +++ b/drivers/iommu/intel/pasid.c @@ -679,10 +679,11 @@ int intel_pasid_setup_second_level(struct intel_iommu *iommu, pasid_set_address_width(pte, agaw); pasid_set_translation_type(pte, PASID_ENTRY_PGTT_SL_ONLY); pasid_set_fault_enable(pte); + if (domain->force_snooping) + pasid_set_pgsnp(pte); pasid_set_page_snoop(pte, !!ecap_smpwc(iommu->ecap)); if (domain->dirty_tracking) pasid_set_ssade(pte); - pasid_set_present(pte); spin_unlock(&iommu->lock);