From patchwork Mon May 10 14:17:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: John Garry X-Patchwork-Id: 433144 Delivered-To: patch@linaro.org Received: by 2002:a02:c901:0:0:0:0:0 with SMTP id t1csp2895204jao; Mon, 10 May 2021 07:25:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxE4dCr7CLK+6CDQJyruK1no1RrV0va2dDHsQOjGrJSsyLx9V/zN68+0rKBTVL+EOSjiW8W X-Received: by 2002:a92:c8c6:: with SMTP id c6mr22483618ilq.109.1620656745076; Mon, 10 May 2021 07:25:45 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620656745; cv=none; d=google.com; s=arc-20160816; b=xlSYWQl9ByBNPO7fJcuup5BT5ZETupw4nEZRxWUc2AyFR1irjgtv52MLlixupQiSgq ZwXi63/0rd/lUo2ftmtjgDMUPNUMz9o6Ep/W6RD2M8cIOSeSin1g1swXUvg5pawlA/J6 jOPZCWN/Oy/jhi+Hsad2IaTKdJLNg05rgXb7XjtKz/g1QgbKTYbuZG81/t7Vl8AhRjqi 3uXVgvJsKvlIe0HVOk6HXx2K4ru6r6ZeCCYD2vv9Re9wVsM5oO2iqZ3zEz7icAMfRc1u p2lvWj9adekT0ubcP1GG3gHhxozDRaCaWfTNP8QimcsWSdPOpSZ9CMB4tDdMPRlezK1/ /dNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from; bh=SBE+paazxh0MQ/q+C0ZEfZA0pyppjs4z3+gh9TFRPm4=; b=NY7p5eyMfZozl7346SYWLOgAAD6+VQCSbpWzw8w6ZzBQqIiNV9YDFWw8m1y4aM832A uivmBRTBv6XEdXrQbT40FfOzQCw8pIht/1WV+DaT46A35YLrFAkBCuueNnXGyWkSDJcB mmXeDHva+MqotXikzsQV6NC/zQupoitcQNJuB064MGfiGRMxECR795qjk7J8QKpVUze2 swX79dzg0U+DPAYJG68eJfJn+dugXW6nusAtgbD3b6aOVV8pEhPzhulAimXzXQjsbeEd 2dH2TCTOnYd92R8zZ//LD77dJpriD/75N4ILpQv5yes0FpQsbFUPzi4XoYwuILYsLTtb lCwA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-scsi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-scsi-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id k8si18487873jav.68.2021.05.10.07.25.45 for ; Mon, 10 May 2021 07:25:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-scsi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-scsi-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-scsi-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=huawei.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232846AbhEJO0q (ORCPT ); Mon, 10 May 2021 10:26:46 -0400 Received: from szxga04-in.huawei.com ([45.249.212.190]:2756 "EHLO szxga04-in.huawei.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235161AbhEJOXq (ORCPT ); Mon, 10 May 2021 10:23:46 -0400 Received: from DGGEMS413-HUB.china.huawei.com (unknown [172.30.72.58]) by szxga04-in.huawei.com (SkyGuard) with ESMTP id 4Ff38H6410zqTrx; Mon, 10 May 2021 22:19:11 +0800 (CST) Received: from localhost.localdomain (10.69.192.58) by DGGEMS413-HUB.china.huawei.com (10.3.19.213) with Microsoft SMTP Server id 14.3.498.0; Mon, 10 May 2021 22:22:25 +0800 From: John Garry To: , , , , CC: , , , , , , John Garry Subject: [PATCH v2 04/15] iommu: Add iommu_group_get_max_opt_dma_size() Date: Mon, 10 May 2021 22:17:18 +0800 Message-ID: <1620656249-68890-5-git-send-email-john.garry@huawei.com> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1620656249-68890-1-git-send-email-john.garry@huawei.com> References: <1620656249-68890-1-git-send-email-john.garry@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.69.192.58] X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org Add a function to return the max optimised DMA size for an IOMMU group. Signed-off-by: John Garry --- drivers/iommu/iommu.c | 5 +++++ include/linux/iommu.h | 6 ++++++ 2 files changed, 11 insertions(+) -- 2.26.2 diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c index 63cdfb11ebed..62e4491f32e0 100644 --- a/drivers/iommu/iommu.c +++ b/drivers/iommu/iommu.c @@ -2296,6 +2296,11 @@ struct iommu_domain *iommu_get_dma_domain(struct device *dev) return dev->iommu_group->default_domain; } +size_t iommu_group_get_max_opt_dma_size(struct iommu_group *group) +{ + return group->max_opt_dma_size; +} + /* * IOMMU groups are really the natural working unit of the IOMMU, but * the IOMMU API works on domains and devices. Bridge that gap by diff --git a/include/linux/iommu.h b/include/linux/iommu.h index 32d448050bf7..e26abda94792 100644 --- a/include/linux/iommu.h +++ b/include/linux/iommu.h @@ -405,6 +405,7 @@ extern int iommu_sva_unbind_gpasid(struct iommu_domain *domain, struct device *dev, ioasid_t pasid); extern struct iommu_domain *iommu_get_domain_for_dev(struct device *dev); extern struct iommu_domain *iommu_get_dma_domain(struct device *dev); +extern size_t iommu_group_get_max_opt_dma_size(struct iommu_group *group); extern int iommu_map(struct iommu_domain *domain, unsigned long iova, phys_addr_t paddr, size_t size, int prot); extern int iommu_map_atomic(struct iommu_domain *domain, unsigned long iova, @@ -653,6 +654,11 @@ static inline struct iommu_domain *iommu_get_domain_for_dev(struct device *dev) return NULL; } +static inline size_t iommu_group_get_max_opt_dma_size(struct iommu_group *group) +{ + return 0; +} + static inline int iommu_map(struct iommu_domain *domain, unsigned long iova, phys_addr_t paddr, size_t size, int prot) {