From patchwork Wed Apr 20 16:48:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Shameerali Kolothum Thodi X-Patchwork-Id: 565360 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 4C22CC433F5 for ; Wed, 20 Apr 2022 16:49:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1380687AbiDTQwS (ORCPT ); Wed, 20 Apr 2022 12:52:18 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35474 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1380773AbiDTQwS (ORCPT ); Wed, 20 Apr 2022 12:52:18 -0400 Received: from frasgout.his.huawei.com (frasgout.his.huawei.com [185.176.79.56]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 92F8F45ACD for ; Wed, 20 Apr 2022 09:49:31 -0700 (PDT) Received: from fraeml712-chm.china.huawei.com (unknown [172.18.147.201]) by frasgout.his.huawei.com (SkyGuard) with ESMTP id 4Kk65f4Ygtz67L71; Thu, 21 Apr 2022 00:47:02 +0800 (CST) Received: from lhreml710-chm.china.huawei.com (10.201.108.61) by fraeml712-chm.china.huawei.com (10.206.15.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Wed, 20 Apr 2022 18:49:29 +0200 Received: from A2006125610.china.huawei.com (10.47.81.194) by lhreml710-chm.china.huawei.com (10.201.108.61) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2375.24; Wed, 20 Apr 2022 17:49:20 +0100 From: Shameer Kolothum To: , , CC: , , , , , , , , , , , , Subject: [PATCH v10 1/9] iommu: Introduce a union to struct iommu_resv_region Date: Wed, 20 Apr 2022 17:48:28 +0100 Message-ID: <20220420164836.1181-2-shameerali.kolothum.thodi@huawei.com> X-Mailer: git-send-email 2.12.0.windows.1 In-Reply-To: <20220420164836.1181-1-shameerali.kolothum.thodi@huawei.com> References: <20220420164836.1181-1-shameerali.kolothum.thodi@huawei.com> MIME-Version: 1.0 X-Originating-IP: [10.47.81.194] X-ClientProxiedBy: dggems703-chm.china.huawei.com (10.3.19.180) To lhreml710-chm.china.huawei.com (10.201.108.61) X-CFilter-Loop: Reflected Precedence: bulk List-ID: X-Mailing-List: linux-acpi@vger.kernel.org A union is introduced to struct iommu_resv_region to hold any firmware specific data. Also, provided a callback to free up any firmware specific memory allocations. This is in preparation to add support for IORT RMR reserve regions and the union now holds the RMR specific information. Tested-by: Steven Price Tested-by: Laurentiu Tudor Signed-off-by: Shameer Kolothum --- include/linux/iommu.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/include/linux/iommu.h b/include/linux/iommu.h index 9208eca4b0d1..38f1e043dfaa 100644 --- a/include/linux/iommu.h +++ b/include/linux/iommu.h @@ -127,6 +127,11 @@ enum iommu_resv_type { IOMMU_RESV_SW_MSI, }; +struct iommu_iort_rmr_data { + const u32 *sids; /* Stream IDs associated with IORT RMR entry */ + u32 num_sids; +}; + /** * struct iommu_resv_region - descriptor for a reserved memory region * @list: Linked list pointers @@ -134,6 +139,9 @@ enum iommu_resv_type { * @length: Length of the region in bytes * @prot: IOMMU Protection flags (READ/WRITE/...) * @type: Type of the reserved region + * @fw_data: Firmware-specific data + * @resv_region_free_fw_data: Callback to free any firmware specific + * memory allocation */ struct iommu_resv_region { struct list_head list; @@ -141,6 +149,11 @@ struct iommu_resv_region { size_t length; int prot; enum iommu_resv_type type; + union { + struct iommu_iort_rmr_data rmr; + } fw_data; + void (*resv_region_free_fw_data)(struct device *dev, + struct iommu_resv_region *region); }; /**