From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4C7CEC433F5 for ; Tue, 22 Mar 2022 19:14:20 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:Content-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:From:References:Cc:To:Subject: MIME-Version:Date:Message-ID:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=kfzMCl8bpUWmKX5cHS8kficVKarCk6AoQAYnt8ImelQ=; b=N3w7zOh2TYoO9X Xu+wf/eewdqr3YgcV/pDlK+0Beea6ryfD3za2wIfp8dHn5unmPB9ijTCjRFcP0uc5XEmvFlYFbaJ/ q/AIaSniMoMPSe16V6fQfoUtec200+T2YI59jMJxlP3eY/iZd0yIfbT8QHyo88tzcrG4GcFPzsckm le/gm0COqR0VWTDMV+IPKdU06t5G/T+fyzpEttWzVqZIKr0V+sX4GNDWzI5kp3PpTp71WTmK+GUK1 FnuPZvy0G1xuAwMpOyf1YFprJxwRUGOSvkdOYHsOZZvqN/C1Vonka0EObVVae0yTn621VxfNM4Cpx uj5UrYpbpwoMEsHe5DKA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nWjwL-00C0mC-BV; Tue, 22 Mar 2022 19:13:09 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nWjwI-00C0le-0G for linux-arm-kernel@lists.infradead.org; Tue, 22 Mar 2022 19:13:07 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 2582A152B; Tue, 22 Mar 2022 12:13:05 -0700 (PDT) Received: from [10.57.43.230] (unknown [10.57.43.230]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id A77613F66F; Tue, 22 Mar 2022 12:13:02 -0700 (PDT) Message-ID: <485b20e0-595c-bc8c-8fbe-119f19e1a8e0@arm.com> Date: Tue, 22 Mar 2022 19:12:58 +0000 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:91.0) Gecko/20100101 Thunderbird/91.7.0 Subject: Re: [PATCH v8 10/11] iommu/arm-smmu-v3: Reserve any RMR regions associated with a dev Content-Language: en-GB To: Shameer Kolothum , linux-arm-kernel@lists.infradead.org, linux-acpi@vger.kernel.org, iommu@lists.linux-foundation.org Cc: linuxarm@huawei.com, lorenzo.pieralisi@arm.com, joro@8bytes.org, will@kernel.org, wanghuiqiang@huawei.com, guohanjun@huawei.com, steven.price@arm.com, Sami.Mujawar@arm.com, jon@solid-run.com, eric.auger@redhat.com, yangyicong@huawei.com References: <20220221154344.2126-1-shameerali.kolothum.thodi@huawei.com> <20220221154344.2126-11-shameerali.kolothum.thodi@huawei.com> From: Robin Murphy In-Reply-To: <20220221154344.2126-11-shameerali.kolothum.thodi@huawei.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220322_121306_133150_3A4441B0 X-CRM114-Status: GOOD ( 16.45 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="us-ascii"; Format="flowed" Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On 2022-02-21 15:43, Shameer Kolothum wrote: > Get ACPI IORT 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/arm/arm-smmu-v3/arm-smmu-v3.c | 13 ++++++++++++- > 1 file changed, 12 insertions(+), 1 deletion(-) > > diff --git a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c > index dee3197474b7..ef2972483fd7 100644 > --- a/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c > +++ b/drivers/iommu/arm/arm-smmu-v3/arm-smmu-v3.c > @@ -2759,6 +2759,7 @@ static void arm_smmu_get_resv_regions(struct device *dev, > { > struct iommu_resv_region *region; > int prot = IOMMU_WRITE | IOMMU_NOEXEC | IOMMU_MMIO; > + struct iommu_fwspec *fwspec = dev_iommu_fwspec_get(dev); > > region = iommu_alloc_resv_region(MSI_IOVA_BASE, MSI_IOVA_LENGTH, > prot, IOMMU_RESV_SW_MSI); > @@ -2768,6 +2769,16 @@ static void arm_smmu_get_resv_regions(struct device *dev, > list_add_tail(®ion->list, head); > > iommu_dma_get_resv_regions(dev, head); > + iommu_dma_get_rmrs(fwspec->iommu_fwnode, dev, head); > +} > + > +static void arm_smmu_put_resv_regions(struct device *dev, > + struct list_head *head) > +{ > + struct iommu_fwspec *fwspec = dev_iommu_fwspec_get(dev); > + > + iommu_dma_put_rmrs(fwspec->iommu_fwnode, head); > + generic_iommu_put_resv_regions(dev, head); > } Tying in with my comment on patch #5, this should be a common iommu_dma_put_resv_regions() helper. Thanks, Robin. > static bool arm_smmu_dev_has_feature(struct device *dev, > @@ -2865,7 +2876,7 @@ static struct iommu_ops arm_smmu_ops = { > .enable_nesting = arm_smmu_enable_nesting, > .of_xlate = arm_smmu_of_xlate, > .get_resv_regions = arm_smmu_get_resv_regions, > - .put_resv_regions = generic_iommu_put_resv_regions, > + .put_resv_regions = arm_smmu_put_resv_regions, > .dev_has_feat = arm_smmu_dev_has_feature, > .dev_feat_enabled = arm_smmu_dev_feature_enabled, > .dev_enable_feat = arm_smmu_dev_enable_feature, _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel