From patchwork Tue Oct 27 11:26:46 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shameerali Kolothum Thodi X-Patchwork-Id: 11860025 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8A662C55179 for ; Tue, 27 Oct 2020 11:31:04 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 1BBC722284 for ; Tue, 27 Oct 2020 11:31:04 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="cp+nhiGK" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 1BBC722284 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=huawei.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-ID:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=SRsxBTpXXLv+IiKwrfTCiNuYqK3Sa/DLtFeNT7W9fCk=; b=cp+nhiGKw/evKaU/5e6/ghRK3 64Qo+PsVqB4IUMklNBeq3Vz0cQssTWlBHRUwRyDrAO6AnSltbcXywtt3bOTs4shVlFg+yKxlBh3iT KS17HLgxLc+IbR97321EmJM7+C6rLkpyXIHyoP/jFf58TyYXhq/RNs1HMjOcEPcnsyNSbyYgjru3o 0+wtcgGuPX21yK7KwCziNX+SqjoYJmYlb89dsEXTnx0CFNgZH63ueEwMjy7BpJbndoyql4qo4ZUuG 0eUFYNBIUCRACf5Wp2lneVsMR47zdRTtx+EIZoGm/6iupUNMSS3CoYaU26h5MYJcW35WBNlLaBZcV 0HaGwiRqw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kXNAB-000208-JW; Tue, 27 Oct 2020 11:29:15 +0000 Received: from szxga07-in.huawei.com ([45.249.212.35]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kXN9H-0001fk-3f for linux-arm-kernel@lists.infradead.org; Tue, 27 Oct 2020 11:28:21 +0000 Received: from DGGEMS403-HUB.china.huawei.com (unknown [172.30.72.60]) by szxga07-in.huawei.com (SkyGuard) with ESMTP id 4CL8b93CqPz6wlp; Tue, 27 Oct 2020 19:28:21 +0800 (CST) Received: from S00345302A-PC.china.huawei.com (10.47.24.15) by DGGEMS403-HUB.china.huawei.com (10.3.19.203) with Microsoft SMTP Server id 14.3.487.0; Tue, 27 Oct 2020 19:28:10 +0800 From: Shameer Kolothum To: , , , Subject: [RFC PATCH 4/4] iommu/dma: Reserve any RMR regions associated with a dev Date: Tue, 27 Oct 2020 11:26:46 +0000 Message-ID: <20201027112646.44680-5-shameerali.kolothum.thodi@huawei.com> X-Mailer: git-send-email 2.12.0.windows.1 In-Reply-To: <20201027112646.44680-1-shameerali.kolothum.thodi@huawei.com> References: <20201027112646.44680-1-shameerali.kolothum.thodi@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.47.24.15] X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201027_072819_484671_3A01BB3F X-CRM114-Status: GOOD ( 10.46 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: lorenzo.pieralisi@arm.com, joro@8bytes.org, jonathan.cameron@huawei.com, linuxarm@huawei.com, guohanjun@huawei.com, robin.murphy@arm.com, wanghuiqiang@huawei.com Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Added support to get RMR regions associated with a dev reserved so that there is a unity mapping for them in SMMU. Signed-off-by: Shameer Kolothum --- drivers/iommu/dma-iommu.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/iommu/dma-iommu.c b/drivers/iommu/dma-iommu.c index 0cbcd3fc3e7e..31eec16f2af8 100644 --- a/drivers/iommu/dma-iommu.c +++ b/drivers/iommu/dma-iommu.c @@ -153,15 +153,19 @@ EXPORT_SYMBOL(iommu_put_dma_cookie); * @list: Reserved region list from iommu_get_resv_regions() * * IOMMU drivers can use this to implement their .get_resv_regions callback - * for general non-IOMMU-specific reservations. Currently, this covers GICv3 - * ITS region reservation on ACPI based ARM platforms that may require HW MSI - * reservation. + * for general non-IOMMU-specific reservations. Currently this covers, + * - GICv3 ITS region reservation on ACPI based ARM platforms that may + * require HW MSI reservation. + * - ACPI IORT RMR memory range reservations that require a unity mapping + * in the SMMU for a given endpoint device. */ void iommu_dma_get_resv_regions(struct device *dev, struct list_head *list) { - if (!is_of_node(dev_iommu_fwspec_get(dev)->iommu_fwnode)) + if (!is_of_node(dev_iommu_fwspec_get(dev)->iommu_fwnode)) { iort_iommu_msi_get_resv_regions(dev, list); + iort_dev_rmr_get_resv_regions(dev, list); + } } EXPORT_SYMBOL(iommu_dma_get_resv_regions);