Message ID | 20230411064815.31456-3-baolu.lu@linux.intel.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2371984vqo; Mon, 10 Apr 2023 23:51:29 -0700 (PDT) X-Google-Smtp-Source: AKy350YpeXJq1iephIogHh0IRXg3KWs7xtYv7dkR0Rzq43KWptnK0YKBUXksnXLCJAiSLGKH92q/ X-Received: by 2002:aa7:d697:0:b0:504:852a:6856 with SMTP id d23-20020aa7d697000000b00504852a6856mr9955753edr.16.1681195889087; Mon, 10 Apr 2023 23:51:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681195889; cv=none; d=google.com; s=arc-20160816; b=ZOQ/bpYO3KLxDQShY/aaE/XzSlsEYk7JzefTEEqI+KcjEGSQ50OcZCZQ+RyQzfRlob fKS27cLgDAYSvhXIRQR2JGSIfRcCjwb/xtMjmb9nVDgYShLmucGhaa77zPNNV5FPmUFb ra8vG9qHtZb9gtA1+kwd8hKKbDXpWQkKkTeVjc4M48Xj4ON+eHEDgTW2uFD3LiFdK16B vF9dpOg1SKsUAitDP2XcRKHA5Hac++MvJuNcyik2GmLo2UkV1Ty2C2ZF/+UiNA+l9NiI ag41Oz3zCRahkYEyv4LMJttw1gZSCI8BNEgRQaMbEm62nMTSLDuEfLPPz9bs6sBuiYGa YpLQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=HzKsz7jNlWnzWgPd2vx0mLE6A+aXguSuShUgDyco2Cg=; b=0oNVRnf2lEiSSJLwZQbrI2EzobrqACRfIvdeTULXQoQt5bpEeFlkHhXjy5fqcYXB8G 9AaCV0TnctitcaWwWfPGXWMNp/C0v4Afuc6UUvw03HhLw6/mXGqDYk8fJq18uAxEQ+e7 zcS72V4+loTkOj+PnSQt9mrjZ650gI3goMBbA8ipLydi7xS2kt6cPsHlJP1Ud7RmEv3e Gkj2HTQzlBbR9RWgg6RP5nLeDrfxNlsptmoOKujBU9hsNcCxWeZxpK+O8iLFsJAv6TX+ RpLDhTdUUGe0JHv7+uQQ+VS2Fy5ODwpUqhr/MY0WY13sb7NzYTxPEItVqEtJGm9pXf6T w9cA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=TANIm8Aa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x25-20020aa7d6d9000000b0050499e7643asi5487101edr.154.2023.04.10.23.51.04; Mon, 10 Apr 2023 23:51:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=TANIm8Aa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230409AbjDKGtT (ORCPT <rfc822;yuanzuo1009@gmail.com> + 99 others); Tue, 11 Apr 2023 02:49:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60732 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230430AbjDKGsy (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Tue, 11 Apr 2023 02:48:54 -0400 Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0E45744AE for <linux-kernel@vger.kernel.org>; Mon, 10 Apr 2023 23:48:37 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1681195717; x=1712731717; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=rMHo8yYSBVXvdzGdpugvYObeZKKcdE/cMZKOA3T4vNU=; b=TANIm8Aa2l+BxJt/94b5Eh4ELo/utgeM/03osoMLzbwrw0jZMk94pXq3 +xmoSgFB54tjLoppcGuDsckqwyB6/ZUiyd4ltn42ZGcLySdy4zWpGw97D HM4fDVxcQNAiwkh8gQ3UAHgEPy6C/Us2XhwQRr5z1eVQzSZFRAZVNQ363 v0n7bRimIMSTwZk4mHk5jbGctNyg0yr+ih3xkwIsENFrGuLSl+XWI9KjC 3O41Sl/F8o3QW7SFkHPFa2fZmVbDeM9S9NmjubhZ0hjKGmPQALtcNHbfZ 8OZSLMXNEbzUNElQeDpx/EJ/YOwPootmR8LZTFrsNn5fIT7rSqiSYtm9b A==; X-IronPort-AV: E=McAfee;i="6600,9927,10676"; a="341028504" X-IronPort-AV: E=Sophos;i="5.98,336,1673942400"; d="scan'208";a="341028504" Received: from fmsmga005.fm.intel.com ([10.253.24.32]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 10 Apr 2023 23:48:15 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10676"; a="1018256541" X-IronPort-AV: E=Sophos;i="5.98,336,1673942400"; d="scan'208";a="1018256541" Received: from allen-box.sh.intel.com ([10.239.159.127]) by fmsmga005.fm.intel.com with ESMTP; 10 Apr 2023 23:48:13 -0700 From: Lu Baolu <baolu.lu@linux.intel.com> To: Joerg Roedel <joro@8bytes.org> Cc: Vinod Koul <vkoul@kernel.org>, Tina Zhang <tina.zhang@intel.com>, Jacob Pan <jacob.jun.pan@linux.intel.com>, Christophe JAILLET <christophe.jaillet@wanadoo.fr>, iommu@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH 02/17] iommu/vt-d: Allow SVA with device-specific IOPF Date: Tue, 11 Apr 2023 14:48:00 +0800 Message-Id: <20230411064815.31456-3-baolu.lu@linux.intel.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230411064815.31456-1-baolu.lu@linux.intel.com> References: <20230411064815.31456-1-baolu.lu@linux.intel.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.4 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE,SPF_NONE autolearn=unavailable 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1762861660404452574?= X-GMAIL-MSGID: =?utf-8?q?1762861660404452574?= |
Series |
Intel IOMMU updates for Linux v6.4
|
|
Commit Message
Baolu Lu
April 11, 2023, 6:48 a.m. UTC
Currently enabling SVA requires IOPF support from the IOMMU and device PCI PRI. However, some devices can handle IOPF by itself without ever sending PCI page requests nor advertising PRI capability. Allow SVA support with IOPF handled either by IOMMU (PCI PRI) or device driver (device-specific IOPF). As long as IOPF could be handled, SVA should continue to work. Reviewed-by: Kevin Tian <kevin.tian@intel.com> Signed-off-by: Lu Baolu <baolu.lu@linux.intel.com> Link: https://lore.kernel.org/r/20230324120234.313643-3-baolu.lu@linux.intel.com --- drivers/iommu/intel/iommu.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-)
diff --git a/drivers/iommu/intel/iommu.c b/drivers/iommu/intel/iommu.c index 7c2f4bd33582..caf664448ee9 100644 --- a/drivers/iommu/intel/iommu.c +++ b/drivers/iommu/intel/iommu.c @@ -4650,7 +4650,21 @@ static int intel_iommu_enable_sva(struct device *dev) if (!(iommu->flags & VTD_FLAG_SVM_CAPABLE)) return -ENODEV; - if (!info->pasid_enabled || !info->pri_enabled || !info->ats_enabled) + if (!info->pasid_enabled || !info->ats_enabled) + return -EINVAL; + + /* + * Devices having device-specific I/O fault handling should not + * support PCI/PRI. The IOMMU side has no means to check the + * capability of device-specific IOPF. Therefore, IOMMU can only + * default that if the device driver enables SVA on a non-PRI + * device, it will handle IOPF in its own way. + */ + if (!info->pri_supported) + return 0; + + /* Devices supporting PRI should have it enabled. */ + if (!info->pri_enabled) return -EINVAL; ret = iopf_queue_add_device(iommu->iopf_queue, dev);