From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751124AbdAQOOS (ORCPT ); Tue, 17 Jan 2017 09:14:18 -0500 Received: from mail-by2nam01on0041.outbound.protection.outlook.com ([104.47.34.41]:50898 "EHLO NAM01-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751035AbdAQOOO (ORCPT ); Tue, 17 Jan 2017 09:14:14 -0500 Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=Tomasz.Nowicki@caviumnetworks.com; Subject: Re: [PATCH v8 11/18] iommu/arm-smmu-v3: Implement reserved region get/put callbacks To: Eric Auger , , , , , , , , , , References: <1484127714-3263-1-git-send-email-eric.auger@redhat.com> <1484127714-3263-12-git-send-email-eric.auger@redhat.com> CC: , , , , , , , , , , From: Tomasz Nowicki Message-ID: Date: Tue, 17 Jan 2017 15:13:41 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Firefox/45.0 Thunderbird/45.5.1 MIME-Version: 1.0 In-Reply-To: <1484127714-3263-12-git-send-email-eric.auger@redhat.com> Content-Type: text/plain; charset="windows-1252"; format=flowed Content-Transfer-Encoding: 7bit X-Originating-IP: [31.172.191.173] X-ClientProxiedBy: DB6PR0601CA0018.eurprd06.prod.outlook.com (10.168.88.156) To CY1PR07MB2166.namprd07.prod.outlook.com (10.164.112.20) X-MS-Office365-Filtering-Correlation-Id: 75e7369a-0c3d-469f-2b07-08d43ee3171f X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(22001);SRVR:CY1PR07MB2166; X-Microsoft-Exchange-Diagnostics: 1;CY1PR07MB2166;3:zsCCY3DvQVWo49gTL6Eb/PiqNiNhSAt9sB1dQlnPQTrFawu7kwlR2t6DoOJKz2bAXQ+I0GrVFUYcXw17KRka6lwsasyzQHJxYxLVAwLNT8cB8t58o1Fh5ihlXLU8TBFZgaBi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0uxalrtHrWECdjB58M3XTzK46wUYKOLL/EuF/qPbPy2XX+OJ+efInTcplgzQ4bYUjFdbW2yOiK/zbq2ERrtSSFJxasjhCzuvtALennTrFb+deIEZdORRkFvSDYLYb3a6GPC/xJ20uKhG1Hz/KL12BO6xDg9+78vU5N6W1l04Wxu/lttLStY7mBtQCFvWmoe2ONRV+eknj6HyThm33lVsWmqfkcXUMLdDTugSAWVWrzZS+A1JhtsuuXohzvH3WpO5g==;20:tyKkYeYkc+zl1wpGrIS0SHogQYFa91vI2UIuYCNSsJHeDY+zd6WQeN+ztV3sosh3TpcsnOLsd9hJkcSji28+fB7phjpEG4ehK+2+xvXU4CUFTrmH3n4qN4S/LbuP4Rf5Nz8zVmIMJBbAfZUjjzKb2XnZVA8H7VyEQeQvZuWCaB1vloROt684GaIshCyvjocX72ThNcGc1ja6dGaQuiY2rWIG3jaczR/juPnIfHUxypQrw0DyynK7wsLbNrq0weC+QLY7Oq6MHX7WWzfOe56a00E5dD4FcMKBWMN4LlrbBhEO6KFhw3jlcENDJbLTpTlO99GY82JuHD43lehJ91ZUf/CUYX7GYmuWHKYrSokHBo6N/lJYq1zbb1YjEYR5HE854PC0GaQgc673FTiCz3cHSEGs+I9TIFMG3lfZVgDHq2qUFSczGME76jERuzDpXbev5dZyMstGjZ3gzOodIbtR2Gyafg8ReSJwN+HxZ53cbUY7ztpvR0tP4d6HGVV7QnvisMifHD7rLRak+MzETczac0E0Gb3RT8lDTDzv9jFT8srzCviNS+U0MI0Cx5t0W+6zz0CvBMr5OjXb/Av1Un4VysXgZv5NYISQRUcmMOkQrpw= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(180628864354917); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6040375)(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046)(6041248)(20161123560025)(20161123558021)(20161123555025)(20161123562025)(20161123564025)(6072148);SRVR:CY1PR07MB2166;BCL:0;PCL:0;RULEID:;SRVR:CY1PR07MB2166; X-Microsoft-Exchange-Diagnostics: 1;CY1PR07MB2166;4:Dl2t+iA1D+TLQm6S3nV8ryXQW25nq57oA+bWoRkdT2VYDu91HL7EHB3dIVRYp8xhUy6PjhaDfjL5uUSRxQ4jbmq04zvfuYhyWoXJLejqn3ARSI05W1piw8NHVKEeeDIIZwPluIXF7T8TpO0urD9hCnMIYcvC8MFh03YPZC6bymp5Ws8ru/qeE+VQJ2lQGD/RXfcz+sHVWdwPM+MPBbm98HaMnk24OBn56UZ/eYgBkq1CTkbb/ybYF9Wy1DUjqEQHk/mg4dRiQXQBzZRXPbuzN7ttmrnd6tL+j/icR/YS82XDcwi79KNG0nM/eBJZUbmuaoz165kmh8jf39fEL7r6mkUqw8z5V+SgHTht/dpZ354yccPFdmjfwlPjo2SwicFiEh7eFwJbPqYJUhlNm36GPec39fSBlmLtUy7mbvZvez/8xyyGsok7bs3dVR+Jy3O36r0tlw/QDsNyWkKAQvHq8iHpNoGtRCogCa0suMjmVI5UhOEminRQ+e1A6Em0NdTofpIESOsaJYGkIoJX5xRMAOCgL7zHtrsTCOyVDx8Z6DZvoaeWUBJ2yP5LCkGy3RHCR+82fT6P0A1jFMncGkWawicScrRQ6F9IFGrkPA5mJ96sjh7zcnApsCrqmWei1DjdVizlUurbFmbcnYPA9v20Zw== X-Forefront-PRVS: 01901B3451 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(4630300001)(6049001)(6009001)(7916002)(39450400003)(189002)(199003)(24454002)(77096006)(229853002)(50986999)(2950100002)(6666003)(230700001)(39060400001)(38730400001)(90366009)(2201001)(92566002)(5660300001)(83506001)(7416002)(33646002)(65956001)(47776003)(66066001)(106356001)(36756003)(230783001)(30001)(105586002)(31686004)(42186005)(31696002)(4001350100001)(5001770100001)(101416001)(6486002)(189998001)(97736004)(54356999)(8656002)(5890100001)(81166006)(68736007)(3846002)(8676002)(6116002)(64126003)(305945005)(23746002)(54906002)(50466002)(4326007)(81156014)(76176999)(2906002)(25786008)(7736002)(921003)(2101003)(83996005)(1121003);DIR:OUT;SFP:1101;SCL:1;SRVR:CY1PR07MB2166;H:[10.0.0.85];FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; X-Microsoft-Exchange-Diagnostics: =?Windows-1252?Q?1;CY1PR07MB2166;23:eCr03uVNDPk/mQiIBMnoAzcsyih2E7iotQz6D?= =?Windows-1252?Q?NTmNyTlivIQrFA8/krc0j8ojgYYsIXLeVdRYlT7TZW03ivS2RbdZKbga?= =?Windows-1252?Q?urkhsUIVm1QXlwrKmXwXSc7VOWIfypi4rVwCYfJLwsUw68v3ehleb3ak?= =?Windows-1252?Q?yty4GTrr3RJnT5HwfGdVXIaws6qDyPrSOSygDy+bq6h4jEFeJq3MQc9I?= =?Windows-1252?Q?ta7Fnffwtpu3NMNd+5rOyi/qCQusbg79XJufmwC39E5RgudiHSzSsU4E?= =?Windows-1252?Q?JUOyFnq8xXAwN/EmMplBAHd2xOdq2PxrQZJN4kbfSW3QIDjeDDHvEAWd?= =?Windows-1252?Q?JCbrkURTpkA+uy3C8eHwK9oFq92GTVGCFN+RTlbuep+ZABHhBi5bqQhr?= =?Windows-1252?Q?vZ0XdLdY9GCuf47wJDONb4UP9f3uM8xu68hUXv8I/UkLOuqi3+5i0YP8?= =?Windows-1252?Q?sFaqqBusVuQqRQsr9gaqPh2z3iNVSYxglkd9BUZDXoZeDsjxsExtk2M6?= =?Windows-1252?Q?ahp5Y7G5IAvpAnMPN+Q6VTN4laBUut5SBQmzz37a6o0bneOFvzrEDhc+?= =?Windows-1252?Q?nE3CI10vWDswvO3tpYwaFaoN5VTvOZKwm5Tn+cmub08hAkWaNphKvcUU?= =?Windows-1252?Q?3ZNAi+axJ8S4Cdb3cbjocLIS7oLDq5Y/3LtVS+8LwMgT6YT2gekbud0F?= =?Windows-1252?Q?a7BViEVQN0xnFnHsuVmfvbYgjhZwYLqFnpUVT3nzN26upvFdMfvaLHE4?= =?Windows-1252?Q?yqS4aovp+slnYj2KxOPfTFiNZDwDeX5DCbQKfKmDEU4Ul9pMxFimhTL1?= =?Windows-1252?Q?VkaFczoWKxVdhK84mllkh05kSPeBuoN4CTOTldYRoiPf99xXXeaQrxc4?= =?Windows-1252?Q?wO3I1X58pXMV7KyNLIqVHEfeaCfLQ5Riiyv5nny5qCPnolaQ6djIZ5gi?= =?Windows-1252?Q?SkiSAIoEXqkA8nu55mpLIyqFvO227NdC3tlAhLaBUJN5JGHRwFPkaTyK?= =?Windows-1252?Q?P/+Kq4ZSUV8bVb/zhdT6fbo1XX25WTLQaMRuzeiZhT/srxAKDwFoio8Z?= =?Windows-1252?Q?iu2+AFjuFUiyC9k7o7jPVfiyswN97CRtwRPIhHa8NdeKaFRm6hVZyf7c?= =?Windows-1252?Q?u9f7vd7U4YS2siDi/jPNpTSvm3bX+8e3IcHUkrdgDlhaulcfaE/1YWHB?= =?Windows-1252?Q?qzWwi3rc0exbYlbEpNdKQmcFk/rk5cYr83L2NWBZ0ADR4HFdyt9zCX8c?= =?Windows-1252?Q?tc+UmXz1rRP7tE0GyBlNeNB4RRY5GGD6ASvLklBXGg+zyXnMMtv7iYzk?= =?Windows-1252?Q?iWlrvBOQw/6SMwaalUU+Rv+6lF8BF9rhZG5Qmq8vHz2ZxDe2/putIOg9?= =?Windows-1252?Q?OwnwgFhuh7CtQNwqfKrGwFyFEi8AYvu/J2wwdjlfoIFSFn1zlj+Tla8g?= =?Windows-1252?Q?MHwIvMbncxMnscxl8q7MPuSwQLP1LWhQZi3O8sb7WGkhEDoE2DL734LX?= =?Windows-1252?Q?gr/lqU7DY8CT7eIuAYTpKX5b1Bs09WzA6DYXyCBvAk087+rsIGezN6pI?= =?Windows-1252?Q?McKtMtzUu7g4b+YFex1aF4WvFRdqWTsitsvBFiL7bUGX6wZs+S8uqHED?= =?Windows-1252?B?Zz09?= X-Microsoft-Exchange-Diagnostics: 1;CY1PR07MB2166;6:RyTcXVR+d3c87KwOGnKoKIsBCwvEzvUzw1daPQe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V11kn9kilRC7lGju3jTKhQMtMfOiKcqiFmb9nuGc09qmp/gxkR/n/p4etHB09KHUDOPa2mreOpogn5WY7w/CSliKDhTeKXb26wUJZrVlOsB2fC6G7mK5qw== X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 17 Jan 2017 14:13:57.2660 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY1PR07MB2166 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11.01.2017 10:41, Eric Auger wrote: > iommu/arm-smmu: Implement reserved region get/put callbacks > > The get() populates the list with the MSI IOVA reserved window. > > At the moment an arbitray MSI IOVA window is set at 0x8000000 > of size 1MB. This will allow to report those info in iommu-group > sysfs. > > Signed-off-by: Eric Auger > Acked-by: Will Deacon Reviewed-by: Tomasz Nowicki Thanks, Tomasz > > --- > > v7 -> v8: > - added Will's A-b > > v4: creation > --- > drivers/iommu/arm-smmu-v3.c | 28 ++++++++++++++++++++++++++++ > 1 file changed, 28 insertions(+) > > diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c > index 4d6ec44..6c4111c 100644 > --- a/drivers/iommu/arm-smmu-v3.c > +++ b/drivers/iommu/arm-smmu-v3.c > @@ -412,6 +412,9 @@ > /* High-level queue structures */ > #define ARM_SMMU_POLL_TIMEOUT_US 100 > > +#define MSI_IOVA_BASE 0x8000000 > +#define MSI_IOVA_LENGTH 0x100000 > + > static bool disable_bypass; > module_param_named(disable_bypass, disable_bypass, bool, S_IRUGO); > MODULE_PARM_DESC(disable_bypass, > @@ -1883,6 +1886,29 @@ static int arm_smmu_of_xlate(struct device *dev, struct of_phandle_args *args) > return iommu_fwspec_add_ids(dev, args->args, 1); > } > > +static void arm_smmu_get_resv_regions(struct device *dev, > + struct list_head *head) > +{ > + struct iommu_resv_region *region; > + int prot = IOMMU_WRITE | IOMMU_NOEXEC | IOMMU_MMIO; > + > + region = iommu_alloc_resv_region(MSI_IOVA_BASE, MSI_IOVA_LENGTH, > + prot, IOMMU_RESV_MSI); > + if (!region) > + return; > + > + list_add_tail(®ion->list, head); > +} > + > +static void arm_smmu_put_resv_regions(struct device *dev, > + struct list_head *head) > +{ > + struct iommu_resv_region *entry, *next; > + > + list_for_each_entry_safe(entry, next, head, list) > + kfree(entry); > +} > + > static struct iommu_ops arm_smmu_ops = { > .capable = arm_smmu_capable, > .domain_alloc = arm_smmu_domain_alloc, > @@ -1898,6 +1924,8 @@ static int arm_smmu_of_xlate(struct device *dev, struct of_phandle_args *args) > .domain_get_attr = arm_smmu_domain_get_attr, > .domain_set_attr = arm_smmu_domain_set_attr, > .of_xlate = arm_smmu_of_xlate, > + .get_resv_regions = arm_smmu_get_resv_regions, > + .put_resv_regions = arm_smmu_put_resv_regions, > .pgsize_bitmap = -1UL, /* Restricted during device attach */ > }; > > From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tomasz Nowicki Subject: Re: [PATCH v8 11/18] iommu/arm-smmu-v3: Implement reserved region get/put callbacks Date: Tue, 17 Jan 2017 15:13:41 +0100 Message-ID: References: <1484127714-3263-1-git-send-email-eric.auger@redhat.com> <1484127714-3263-12-git-send-email-eric.auger@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Cc: drjones-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org, kvm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, punit.agrawal-5wv7dgnIgG8@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, geethasowjanya.akula-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org, iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org, pranav.sawargaonkar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org, shankerd-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org, gpkulkarni-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org To: Eric Auger , , , , , , , , , , Return-path: In-Reply-To: <1484127714-3263-12-git-send-email-eric.auger-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: iommu-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org Errors-To: iommu-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org List-Id: kvm.vger.kernel.org On 11.01.2017 10:41, Eric Auger wrote: > iommu/arm-smmu: Implement reserved region get/put callbacks > > The get() populates the list with the MSI IOVA reserved window. > > At the moment an arbitray MSI IOVA window is set at 0x8000000 > of size 1MB. This will allow to report those info in iommu-group > sysfs. > > Signed-off-by: Eric Auger > Acked-by: Will Deacon Reviewed-by: Tomasz Nowicki Thanks, Tomasz > > --- > > v7 -> v8: > - added Will's A-b > > v4: creation > --- > drivers/iommu/arm-smmu-v3.c | 28 ++++++++++++++++++++++++++++ > 1 file changed, 28 insertions(+) > > diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c > index 4d6ec44..6c4111c 100644 > --- a/drivers/iommu/arm-smmu-v3.c > +++ b/drivers/iommu/arm-smmu-v3.c > @@ -412,6 +412,9 @@ > /* High-level queue structures */ > #define ARM_SMMU_POLL_TIMEOUT_US 100 > > +#define MSI_IOVA_BASE 0x8000000 > +#define MSI_IOVA_LENGTH 0x100000 > + > static bool disable_bypass; > module_param_named(disable_bypass, disable_bypass, bool, S_IRUGO); > MODULE_PARM_DESC(disable_bypass, > @@ -1883,6 +1886,29 @@ static int arm_smmu_of_xlate(struct device *dev, struct of_phandle_args *args) > return iommu_fwspec_add_ids(dev, args->args, 1); > } > > +static void arm_smmu_get_resv_regions(struct device *dev, > + struct list_head *head) > +{ > + struct iommu_resv_region *region; > + int prot = IOMMU_WRITE | IOMMU_NOEXEC | IOMMU_MMIO; > + > + region = iommu_alloc_resv_region(MSI_IOVA_BASE, MSI_IOVA_LENGTH, > + prot, IOMMU_RESV_MSI); > + if (!region) > + return; > + > + list_add_tail(®ion->list, head); > +} > + > +static void arm_smmu_put_resv_regions(struct device *dev, > + struct list_head *head) > +{ > + struct iommu_resv_region *entry, *next; > + > + list_for_each_entry_safe(entry, next, head, list) > + kfree(entry); > +} > + > static struct iommu_ops arm_smmu_ops = { > .capable = arm_smmu_capable, > .domain_alloc = arm_smmu_domain_alloc, > @@ -1898,6 +1924,8 @@ static int arm_smmu_of_xlate(struct device *dev, struct of_phandle_args *args) > .domain_get_attr = arm_smmu_domain_get_attr, > .domain_set_attr = arm_smmu_domain_set_attr, > .of_xlate = arm_smmu_of_xlate, > + .get_resv_regions = arm_smmu_get_resv_regions, > + .put_resv_regions = arm_smmu_put_resv_regions, > .pgsize_bitmap = -1UL, /* Restricted during device attach */ > }; > > From mboxrd@z Thu Jan 1 00:00:00 1970 From: Tomasz Nowicki Subject: Re: [PATCH v8 11/18] iommu/arm-smmu-v3: Implement reserved region get/put callbacks Date: Tue, 17 Jan 2017 15:13:41 +0100 Message-ID: References: <1484127714-3263-1-git-send-email-eric.auger@redhat.com> <1484127714-3263-12-git-send-email-eric.auger@redhat.com> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; Format="flowed" Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: <1484127714-3263-12-git-send-email-eric.auger-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: iommu-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org Errors-To: iommu-bounces-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org To: Eric Auger , eric.auger.pro-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org, christoffer.dall-QSEj5FYQhm4dnm+yROfE0A@public.gmane.org, marc.zyngier-5wv7dgnIgG8@public.gmane.org, robin.murphy-5wv7dgnIgG8@public.gmane.org, alex.williamson-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org, will.deacon-5wv7dgnIgG8@public.gmane.org, joro-zLv9SwRftAIdnm+yROfE0A@public.gmane.org, tglx-hfZtesqFncYOwBW4kG4KsQ@public.gmane.org, jason-NLaQJdtUoK4Be96aLqz0jA@public.gmane.org, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org Cc: drjones-H+wXaHxf7aLQT0dZR+AlfA@public.gmane.org, kvm-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, punit.agrawal-5wv7dgnIgG8@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, geethasowjanya.akula-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org, iommu-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org, pranav.sawargaonkar-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org, shankerd-sgV2jX0FEOL9JmXXK+q4OQ@public.gmane.org, gpkulkarni-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org List-Id: iommu@lists.linux-foundation.org On 11.01.2017 10:41, Eric Auger wrote: > iommu/arm-smmu: Implement reserved region get/put callbacks > > The get() populates the list with the MSI IOVA reserved window. > > At the moment an arbitray MSI IOVA window is set at 0x8000000 > of size 1MB. This will allow to report those info in iommu-group > sysfs. > > Signed-off-by: Eric Auger > Acked-by: Will Deacon Reviewed-by: Tomasz Nowicki Thanks, Tomasz > > --- > > v7 -> v8: > - added Will's A-b > > v4: creation > --- > drivers/iommu/arm-smmu-v3.c | 28 ++++++++++++++++++++++++++++ > 1 file changed, 28 insertions(+) > > diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c > index 4d6ec44..6c4111c 100644 > --- a/drivers/iommu/arm-smmu-v3.c > +++ b/drivers/iommu/arm-smmu-v3.c > @@ -412,6 +412,9 @@ > /* High-level queue structures */ > #define ARM_SMMU_POLL_TIMEOUT_US 100 > > +#define MSI_IOVA_BASE 0x8000000 > +#define MSI_IOVA_LENGTH 0x100000 > + > static bool disable_bypass; > module_param_named(disable_bypass, disable_bypass, bool, S_IRUGO); > MODULE_PARM_DESC(disable_bypass, > @@ -1883,6 +1886,29 @@ static int arm_smmu_of_xlate(struct device *dev, struct of_phandle_args *args) > return iommu_fwspec_add_ids(dev, args->args, 1); > } > > +static void arm_smmu_get_resv_regions(struct device *dev, > + struct list_head *head) > +{ > + struct iommu_resv_region *region; > + int prot = IOMMU_WRITE | IOMMU_NOEXEC | IOMMU_MMIO; > + > + region = iommu_alloc_resv_region(MSI_IOVA_BASE, MSI_IOVA_LENGTH, > + prot, IOMMU_RESV_MSI); > + if (!region) > + return; > + > + list_add_tail(®ion->list, head); > +} > + > +static void arm_smmu_put_resv_regions(struct device *dev, > + struct list_head *head) > +{ > + struct iommu_resv_region *entry, *next; > + > + list_for_each_entry_safe(entry, next, head, list) > + kfree(entry); > +} > + > static struct iommu_ops arm_smmu_ops = { > .capable = arm_smmu_capable, > .domain_alloc = arm_smmu_domain_alloc, > @@ -1898,6 +1924,8 @@ static int arm_smmu_of_xlate(struct device *dev, struct of_phandle_args *args) > .domain_get_attr = arm_smmu_domain_get_attr, > .domain_set_attr = arm_smmu_domain_set_attr, > .of_xlate = arm_smmu_of_xlate, > + .get_resv_regions = arm_smmu_get_resv_regions, > + .put_resv_regions = arm_smmu_put_resv_regions, > .pgsize_bitmap = -1UL, /* Restricted during device attach */ > }; > > From mboxrd@z Thu Jan 1 00:00:00 1970 From: tnowicki@caviumnetworks.com (Tomasz Nowicki) Date: Tue, 17 Jan 2017 15:13:41 +0100 Subject: [PATCH v8 11/18] iommu/arm-smmu-v3: Implement reserved region get/put callbacks In-Reply-To: <1484127714-3263-12-git-send-email-eric.auger@redhat.com> References: <1484127714-3263-1-git-send-email-eric.auger@redhat.com> <1484127714-3263-12-git-send-email-eric.auger@redhat.com> Message-ID: To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org On 11.01.2017 10:41, Eric Auger wrote: > iommu/arm-smmu: Implement reserved region get/put callbacks > > The get() populates the list with the MSI IOVA reserved window. > > At the moment an arbitray MSI IOVA window is set at 0x8000000 > of size 1MB. This will allow to report those info in iommu-group > sysfs. > > Signed-off-by: Eric Auger > Acked-by: Will Deacon Reviewed-by: Tomasz Nowicki Thanks, Tomasz > > --- > > v7 -> v8: > - added Will's A-b > > v4: creation > --- > drivers/iommu/arm-smmu-v3.c | 28 ++++++++++++++++++++++++++++ > 1 file changed, 28 insertions(+) > > diff --git a/drivers/iommu/arm-smmu-v3.c b/drivers/iommu/arm-smmu-v3.c > index 4d6ec44..6c4111c 100644 > --- a/drivers/iommu/arm-smmu-v3.c > +++ b/drivers/iommu/arm-smmu-v3.c > @@ -412,6 +412,9 @@ > /* High-level queue structures */ > #define ARM_SMMU_POLL_TIMEOUT_US 100 > > +#define MSI_IOVA_BASE 0x8000000 > +#define MSI_IOVA_LENGTH 0x100000 > + > static bool disable_bypass; > module_param_named(disable_bypass, disable_bypass, bool, S_IRUGO); > MODULE_PARM_DESC(disable_bypass, > @@ -1883,6 +1886,29 @@ static int arm_smmu_of_xlate(struct device *dev, struct of_phandle_args *args) > return iommu_fwspec_add_ids(dev, args->args, 1); > } > > +static void arm_smmu_get_resv_regions(struct device *dev, > + struct list_head *head) > +{ > + struct iommu_resv_region *region; > + int prot = IOMMU_WRITE | IOMMU_NOEXEC | IOMMU_MMIO; > + > + region = iommu_alloc_resv_region(MSI_IOVA_BASE, MSI_IOVA_LENGTH, > + prot, IOMMU_RESV_MSI); > + if (!region) > + return; > + > + list_add_tail(®ion->list, head); > +} > + > +static void arm_smmu_put_resv_regions(struct device *dev, > + struct list_head *head) > +{ > + struct iommu_resv_region *entry, *next; > + > + list_for_each_entry_safe(entry, next, head, list) > + kfree(entry); > +} > + > static struct iommu_ops arm_smmu_ops = { > .capable = arm_smmu_capable, > .domain_alloc = arm_smmu_domain_alloc, > @@ -1898,6 +1924,8 @@ static int arm_smmu_of_xlate(struct device *dev, struct of_phandle_args *args) > .domain_get_attr = arm_smmu_domain_get_attr, > .domain_set_attr = arm_smmu_domain_set_attr, > .of_xlate = arm_smmu_of_xlate, > + .get_resv_regions = arm_smmu_get_resv_regions, > + .put_resv_regions = arm_smmu_put_resv_regions, > .pgsize_bitmap = -1UL, /* Restricted during device attach */ > }; > >