From patchwork Tue May 26 13:01:25 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: 1298035 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 49WZ126xkQz9sSs; Tue, 26 May 2020 23:04:22 +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 1jdZFf-0006Zs-LL; Tue, 26 May 2020 13:04:15 +0000 Received: from mail-pl1-f195.google.com ([209.85.214.195]) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1jdZEY-0005i4-V2 for kernel-team@lists.ubuntu.com; Tue, 26 May 2020 13:03:07 +0000 Received: by mail-pl1-f195.google.com with SMTP id bh7so1751618plb.11 for ; Tue, 26 May 2020 06:03:06 -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=QHz0zZYlSvntzPopUoMOk6RI671z0nWJyRnkEQprQtI=; b=Tigl0vf9/8rNta61NaaREC2dDkiEtQbdd5CMWaosSDsALEpXOkyUHjt+dJtQ9v6yvO hqA9MKUWwX+rOnNmHeaBMW9lvjGmcUS0L7hd5B5gCFgtW4O5b6QhUBkuW1u3Q1XfjZzM 3sYjrAD1sQc1DEUUIE92YCSwiI2ilnbzWl9hXkczc2Mze+BCvOSWHIw85EOp5YQluke9 vdfdz+0K9tCHmE+0p3wzMnhG8bjkGX57T+6Wx/VTXnhWVyEKqUbB94UgHiIXvgJT+Ild Qg2nAh4wBbEyXC3NHQHPLt59Q2eVhlbaxsIj7RH8vchn0h4GWJWe9gGTGm1hK14sY8Rk vHfA== X-Gm-Message-State: AOAM530OinxB4o7J2o9P+m8lnXfQcNGuZ0HKW/fXe2XfwVFDgJBSnLMx P8p8ZObUhCXwRJYjdFzpTyqBQNn8TEw= X-Google-Smtp-Source: ABdhPJy/acegk2ZXRmfmmxMbUM2GEPPC1OJkTSyo+CBu/A1i44rWpS3OjBJB+nk9pdxANHsk3nznQA== X-Received: by 2002:a17:90a:32a8:: with SMTP id l37mr27172232pjb.13.1590498181818; Tue, 26 May 2020 06:03:01 -0700 (PDT) Received: from localhost (61-220-137-37.HINET-IP.hinet.net. [61.220.137.37]) by smtp.gmail.com with ESMTPSA id u5sm6495328pjv.54.2020.05.26.06.03.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 May 2020 06:03:00 -0700 (PDT) From: You-Sheng Yang To: kernel-team@lists.ubuntu.com Subject: [PATCH 21/60][SRU][OEM-5.6] UBUNTU: SAUCE: iommu/amd: Implement iommu_ops->def_domain_type call-back Date: Tue, 26 May 2020 21:01:25 +0800 Message-Id: <20200526130204.238445-22-vicamo.yang@canonical.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200526130204.238445-1-vicamo.yang@canonical.com> References: <20200526130204.238445-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: Joerg Roedel BugLink: https://bugs.launchpad.net/bugs/1876707 Implement the new def_domain_type call-back for the AMD IOMMU driver. Signed-off-by: Joerg Roedel Link: https://lore.kernel.org/r/20200429133712.31431-4-joro@8bytes.org Signed-off-by: Joerg Roedel (cherry picked from commit bdf4a7c4c77dcb91bd64b53b70d9faf3184e88d8 iommu/next) Signed-off-by: You-Sheng Yang --- drivers/iommu/amd_iommu.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/drivers/iommu/amd_iommu.c b/drivers/iommu/amd_iommu.c index 500d0a8c966f..76d349cc11ed 100644 --- a/drivers/iommu/amd_iommu.c +++ b/drivers/iommu/amd_iommu.c @@ -2740,6 +2740,20 @@ static void amd_iommu_iotlb_sync(struct iommu_domain *domain, amd_iommu_flush_iotlb_all(domain); } +static int amd_iommu_def_domain_type(struct device *dev) +{ + struct iommu_dev_data *dev_data; + + dev_data = get_dev_data(dev); + if (!dev_data) + return 0; + + if (dev_data->iommu_v2) + return IOMMU_DOMAIN_IDENTITY; + + return 0; +} + const struct iommu_ops amd_iommu_ops = { .capable = amd_iommu_capable, .domain_alloc = amd_iommu_domain_alloc, @@ -2759,6 +2773,7 @@ const struct iommu_ops amd_iommu_ops = { .pgsize_bitmap = AMD_IOMMU_PGSIZES, .flush_iotlb_all = amd_iommu_flush_iotlb_all, .iotlb_sync = amd_iommu_iotlb_sync, + .def_domain_type = amd_iommu_def_domain_type, }; /*****************************************************************************