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 X-Spam-Level: X-Spam-Status: No, score=-5.6 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, NICE_REPLY_A,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no 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 60493C433B4 for ; Wed, 19 May 2021 11:50:38 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 D94ED610CB for ; Wed, 19 May 2021 11:50:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D94ED610CB Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.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=desiato.20200630; h=Sender:Content-Type: Content-Transfer-Encoding:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:Date:Message-ID:From: References:Cc:To:Subject:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=ROsjtaoX4ZFKjt5Qdmr28Og1Hgm/7W/ey5v61VvcIsM=; b=P6YAmG9smTq0BbHoV7dEZ06Z8 AA6VPZ97pdU4rwzvCbY/6fq986XYOTGujaCsfXY2SSuylrGPq6iRidqG4PKo5oHf/c0Pif5efBgIQ ofSJSD0EynMChnlhaEQChydrRfhsphfXrhs/FLZ0biVSH895BVDCOuel/b3L05f1IXxOWxCKp/NG0 Qyi7pj8CMJzV7CqPZSHmvpGJ4Eg4tFFE2TAykA+tPcpelFz3gqCkZKM5BGyCEyz/K0pha3tfKguTB ay/3FVS/7fmsRsJxtVmlER7MBYom+3Iev2TYnRJMh1LfYD84VSp4nye6EV0Sr1PnKVAfRNnWDWgSo QU9b7LIvw==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1ljKgh-003pj3-3Y; Wed, 19 May 2021 11:48:32 +0000 Received: from bombadil.infradead.org ([2607:7c80:54:e::133]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1ljKgb-003phk-SG for linux-arm-kernel@desiato.infradead.org; Wed, 19 May 2021 11:48:26 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=bombadil.20210309; h=Content-Transfer-Encoding: Content-Type:In-Reply-To:MIME-Version:Date:Message-ID:From:References:Cc:To: Subject:Sender:Reply-To:Content-ID:Content-Description; bh=sZBXk+GWEeJUxJjksG8krKKrg7jwr8zpPcCv4gdBkXI=; b=BBtsryiNn768nwNg/vQt6RSnJO ZJGcxtzxw0vpMuzRlmlwSJc+OO9P3l7WzmA/oB+Nn7poXv6DmoLueBH5LEGuQYGQWSwtUNH2ifyG7 Z1zMHQTdW6kBYndoR94FEkjgmTE2A+ZT9Gc3s5BLXml75PP27ZY/qR33HIv+zLFrZkRHRuMhsp3iE aRyOamLpjHEadAUSy/zHOyAT+caZT0TxnjsWncdbwqtIDnVkKnorqbNwpmMTBLjAYwtSwxjFQU722 irGdM5cYXfwvd41Z/1jhSe6yIPbV0OnauqzfIPMh0dtkZv7C6KU46wD/xJ+rpjmxkEhhNsmmtgBJ6 cI+Dqeqg==; Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1ljKgZ-00FQUQ-64 for linux-arm-kernel@lists.infradead.org; Wed, 19 May 2021 11:48:24 +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 09267101E; Wed, 19 May 2021 04:48:19 -0700 (PDT) Received: from [10.57.66.179] (unknown [10.57.66.179]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 077393F719; Wed, 19 May 2021 04:48:16 -0700 (PDT) Subject: Re: [PATCH v4 2/8] iommu/dma: Introduce generic helper to retrieve RMR info To: Shameerali Kolothum Thodi , Joerg Roedel Cc: "linux-arm-kernel@lists.infradead.org" , "linux-acpi@vger.kernel.org" , "iommu@lists.linux-foundation.org" , Linuxarm , "lorenzo.pieralisi@arm.com" , wanghuiqiang , "Guohanjun (Hanjun Guo)" , "steven.price@arm.com" , "Sami.Mujawar@arm.com" , "jon@solid-run.com" , "eric.auger@redhat.com" , yangyicong References: <20210513134550.2117-1-shameerali.kolothum.thodi@huawei.com> <20210513134550.2117-3-shameerali.kolothum.thodi@huawei.com> <503068eb5f184639a75d7d1ef929b4c6@huawei.com> From: Robin Murphy Message-ID: <4047b1ef-5f6e-c3b8-e701-1cfa68acfd69@arm.com> Date: Wed, 19 May 2021 12:48:11 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:78.0) Gecko/20100101 Thunderbird/78.10.1 MIME-Version: 1.0 In-Reply-To: <503068eb5f184639a75d7d1ef929b4c6@huawei.com> Content-Language: en-GB X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210519_044823_351131_84F99C34 X-CRM114-Status: GOOD ( 21.47 ) 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 2021-05-19 10:30, Shameerali Kolothum Thodi wrote: > > >> -----Original Message----- >> From: Joerg Roedel [mailto:joro@8bytes.org] >> Sent: 18 May 2021 09:50 >> To: Shameerali Kolothum Thodi >> Cc: linux-arm-kernel@lists.infradead.org; linux-acpi@vger.kernel.org; >> iommu@lists.linux-foundation.org; Linuxarm ; >> lorenzo.pieralisi@arm.com; robin.murphy@arm.com; wanghuiqiang >> ; Guohanjun (Hanjun Guo) >> ; steven.price@arm.com; Sami.Mujawar@arm.com; >> jon@solid-run.com; eric.auger@redhat.com; yangyicong >> >> Subject: Re: [PATCH v4 2/8] iommu/dma: Introduce generic helper to retrieve >> RMR info >> >> On Thu, May 13, 2021 at 02:45:44PM +0100, Shameer Kolothum wrote: >>> +/** >>> + * struct iommu_rmr - Reserved Memory Region details per IOMMU >>> + * @list: Linked list pointers to hold RMR region info >>> + * @base_address: base address of Reserved Memory Region >>> + * @length: length of memory region >>> + * @sid: associated stream id >>> + * @flags: flags that apply to the RMR node >>> + */ >>> +struct iommu_rmr { >>> + struct list_head list; >>> + phys_addr_t base_address; >>> + u64 length; >>> + u32 sid; >>> + u32 flags; >>> +}; >>> + >>> +/* RMR Remap permitted */ >>> +#define IOMMU_RMR_REMAP_PERMITTED (1 << 0) >>> + >> >> This struct has lots of overlap with 'struct iommu_resv_region'. Any >> reason the existing struct can't be used here? >> > > Hmm..main reason is "sid". RMRs are associated with stream ids and > that is used to install bypass STEs/SMRs in SMMU drivers and also to check > whether a dev has any RMR regions associated with it. > > I think we could add sid/dev_id to 'struct iommu_resv_region', and modify > iommu_alloc_resv_region() accordingly. That can get rid of the above struct > and iommu_dma_alloc_rmr() fn. Not sure this will complicate things as > the dev_id is only valid for RMR reservation region cases. > > Please let me know your thoughts. Maybe add a union for FW-specific data to struct resv_region, so that it could eventually subsume AMD's struct unity_map_entry and Intel's struct dmar_rmrr_unit as well? They're essentially doing the same dance. We might still have to create copies of the firmware-allocated entries to actually assign to domains (certainly where one entry covers multiple devices), but kmemdup() is still a lot neater than various translations from private formats. Robin. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel