From patchwork Tue Jun 2 07:48:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: You-Sheng Yang X-Patchwork-Id: 1302235 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: ozlabs.org; dmarc=fail (p=none dis=none) header.from=canonical.com Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 49bkk74hk7z9sSn; Tue, 2 Jun 2020 17:50:55 +1000 (AEST) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1jg1hC-0006ep-Ps; Tue, 02 Jun 2020 07:50:50 +0000 Received: from mail-pj1-f67.google.com ([209.85.216.67]) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1jg1gx-0006P2-KU for kernel-team@lists.ubuntu.com; Tue, 02 Jun 2020 07:50:35 +0000 Received: by mail-pj1-f67.google.com with SMTP id k2so990221pjs.2 for ; Tue, 02 Jun 2020 00:50:35 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=xOn6df/hyY0n9QuyTU7+KsKkmsPuumwdkCUonc2sBxc=; b=auOnaOxHRi0eeKemryrYnztL6IiLW9M6o2Y0GFpwtjfsv6zrn2PlEeLoIerwZ/3iet t+bhxjgUy93hMo3hOD+gNqpFSqEphYhLtc0KyUSNxpHQZ9orvcHuPRmFIlEBZeLpVefd XQIm8J1nRDiZKwOHmdCgvNuK44LGcxBEhaq2fnitWJM7q2HtH0DEg0r81AqCzGQj/nc6 pLOnFRNgqpIgcbMjGNMz9itiJg2OSAk+A437JKmNL07AcqGxAJyZpQrZnQ8DZk8lCUQt 6bFtsAshL7zUUx49pBSQye2Kt/tb3peE4JPzLHB3Q9w8kVV4IVgr27PhJC2+wqspzCqR szPA== X-Gm-Message-State: AOAM531AHrYSEiA7w3kdz6bbuYmLJs87IGWdDV0kKTkQmRaZuYQJAivw yq3SFyyjvZ57At7WieW2k68gf9v9HJE= X-Google-Smtp-Source: ABdhPJxuX3F1kYWS4K2l+b6k6T2kiGtVonmFQxEMv46yk70/GJ8qMyZpg+5sv0TGK8EniTdVOlpBtw== X-Received: by 2002:a17:90b:e0c:: with SMTP id ge12mr4130641pjb.3.1591084231707; Tue, 02 Jun 2020 00:50:31 -0700 (PDT) Received: from localhost (61-220-137-37.HINET-IP.hinet.net. [61.220.137.37]) by smtp.gmail.com with ESMTPSA id d15sm2054085pjc.0.2020.06.02.00.50.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 02 Jun 2020 00:50:30 -0700 (PDT) From: You-Sheng Yang To: kernel-team@lists.ubuntu.com Subject: [PATCH v2 40/42][SRU][U] iommu/vt-d: Allow PCI sub-hierarchy to use DMA domain Date: Tue, 2 Jun 2020 15:48:41 +0800 Message-Id: <20200602074843.1743493-41-vicamo.yang@canonical.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200602074843.1743493-1-vicamo.yang@canonical.com> References: <20200602074843.1743493-1-vicamo.yang@canonical.com> MIME-Version: 1.0 X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Lu Baolu BugLink: https://bugs.launchpad.net/bugs/1876707 Before commit fa954e6831789 ("iommu/vt-d: Delegate the dma domain to upper layer"), Intel IOMMU started off with all devices in the identity domain, and took them out later if it found they couldn't access all of memory. This required devices behind a PCI bridge to use a DMA domain at the beginning because all PCI devices behind the bridge use the same source-id in their transactions and the domain couldn't be changed at run-time. Intel IOMMU driver is now aligned with the default domain framework, there's no need to keep this requirement anymore. Signed-off-by: Lu Baolu Tested-by: Daniel Drake Reviewed-by: Jon Derrick Reviewed-by: Jerry Snitselaar Link: https://lore.kernel.org/r/20200506015947.28662-3-baolu.lu@linux.intel.com Signed-off-by: Joerg Roedel (cherry picked from commit 14b3526d5909f01e1d1baa05f50952788bb7418e linux-next) Signed-off-by: You-Sheng Yang --- drivers/iommu/intel-iommu.c | 25 ------------------------- 1 file changed, 25 deletions(-) diff --git a/drivers/iommu/intel-iommu.c b/drivers/iommu/intel-iommu.c index 16ba7add0f72..af309e8fa6f5 100644 --- a/drivers/iommu/intel-iommu.c +++ b/drivers/iommu/intel-iommu.c @@ -2857,31 +2857,6 @@ static int device_def_domain_type(struct device *dev) if ((iommu_identity_mapping & IDENTMAP_GFX) && IS_GFX_DEVICE(pdev)) return IOMMU_DOMAIN_IDENTITY; - - /* - * We want to start off with all devices in the 1:1 domain, and - * take them out later if we find they can't access all of memory. - * - * However, we can't do this for PCI devices behind bridges, - * because all PCI devices behind the same bridge will end up - * with the same source-id on their transactions. - * - * Practically speaking, we can't change things around for these - * devices at run-time, because we can't be sure there'll be no - * DMA transactions in flight for any of their siblings. - * - * So PCI devices (unless they're on the root bus) as well as - * their parent PCI-PCI or PCIe-PCI bridges must be left _out_ of - * the 1:1 domain, just in _case_ one of their siblings turns out - * not to be able to map all of memory. - */ - if (!pci_is_pcie(pdev)) { - if (!pci_is_root_bus(pdev->bus)) - return IOMMU_DOMAIN_DMA; - if (pdev->class >> 8 == PCI_CLASS_BRIDGE_PCI) - return IOMMU_DOMAIN_DMA; - } else if (pci_pcie_type(pdev) == PCI_EXP_TYPE_PCI_BRIDGE) - return IOMMU_DOMAIN_DMA; } return 0;