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=-9.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable 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 84CBCC11F65 for ; Wed, 30 Jun 2021 08:53:01 +0000 (UTC) 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 mail.kernel.org (Postfix) with ESMTPS id 5111A61CD7 for ; Wed, 30 Jun 2021 08:53:01 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 5111A61CD7 Authentication-Results: mail.kernel.org; dmarc=fail (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=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:In-Reply-To:References: Message-ID:Date:Subject:CC:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=63GntvsRhS0Yxsf1ER6oatAEoXH90eWTAj/HhwR3KcE=; b=uCtPpfCcCH/gbF qwSBqQMc/zs95Q85Lhcy3q5Sf3sgh4MhQbf3WSgrr2NiJBObcIOTa0nYYsl7wwlozx2U4xNhooPc6 MYvGHGyKQyiU3TEas8RoovjY5V1wiHktrq27+AjnwD3Oo0IEemZ9PsmM4cVhKnw3KixoBdsasHEMr HCP2PFtGTzjErLna4cXxbJ/Gbgo+KR0KbFF+MqFK5G6litArvCS33Fop7jbslVeRFJDP/rcxCNuo2 Q4fAmlQvDErkbdbzvNA/VazPY8gwwZ6PVyJEYwvEC7nhnChLNQbCboyPzXRfDQHz/FZB11JyJMnEP gR5Xtadyrcvx9ORnsqYw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lyVwM-00DLlK-24; Wed, 30 Jun 2021 08:51:26 +0000 Received: from szxga02-in.huawei.com ([45.249.212.188]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lyVvZ-00DLOn-9X for linux-arm-kernel@lists.infradead.org; Wed, 30 Jun 2021 08:50:39 +0000 Received: from dggemv703-chm.china.huawei.com (unknown [172.30.72.53]) by szxga02-in.huawei.com (SkyGuard) with ESMTP id 4GFFMv58LFzZp54; Wed, 30 Jun 2021 16:47:23 +0800 (CST) Received: from dggpemm500001.china.huawei.com (7.185.36.107) by dggemv703-chm.china.huawei.com (10.3.19.46) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Wed, 30 Jun 2021 16:50:30 +0800 Received: from lhreml710-chm.china.huawei.com (10.201.108.61) by dggpemm500001.china.huawei.com (7.185.36.107) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256) id 15.1.2176.2; Wed, 30 Jun 2021 16:50:28 +0800 Received: from lhreml710-chm.china.huawei.com ([169.254.81.184]) by lhreml710-chm.china.huawei.com ([169.254.81.184]) with mapi id 15.01.2176.012; Wed, 30 Jun 2021 09:50:26 +0100 From: Shameerali Kolothum Thodi To: Jon Nettleton , Robin Murphy CC: linux-arm-kernel , "ACPI Devel Maling List" , "iommu@lists.linux-foundation.org" , Linuxarm , "Steven Price" , "Guohanjun (Hanjun Guo)" , yangyicong , "Sami.Mujawar@arm.com" , wanghuiqiang Subject: RE: [PATCH v5 7/8] iommu/arm-smmu: Get associated RMR info and install bypass SMR Thread-Topic: [PATCH v5 7/8] iommu/arm-smmu: Get associated RMR info and install bypass SMR Thread-Index: AQHXUIyLvua7xjhPQkeDex9n58702KsTV/iAgBdgBoCAAGnfAIAAMyCAgAEihEA= Date: Wed, 30 Jun 2021 08:50:26 +0000 Message-ID: References: <20210524110222.2212-1-shameerali.kolothum.thodi@huawei.com> <20210524110222.2212-8-shameerali.kolothum.thodi@huawei.com> <2bc3ae21-f2af-ee2c-5e9d-d47633e0439e@arm.com> In-Reply-To: Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.47.82.108] MIME-Version: 1.0 X-CFilter-Loop: Reflected X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210630_015037_711157_64CD5B4A X-CRM114-Status: GOOD ( 23.54 ) 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-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org > -----Original Message----- > From: Jon Nettleton [mailto:jon@solid-run.com] > Sent: 29 June 2021 17:26 > To: Robin Murphy > Cc: Shameerali Kolothum Thodi ; > linux-arm-kernel ; ACPI Devel Maling > List ; iommu@lists.linux-foundation.org; Linuxarm > ; Steven Price ; Guohanjun > (Hanjun Guo) ; yangyicong > ; Sami.Mujawar@arm.com; wanghuiqiang > > Subject: Re: [PATCH v5 7/8] iommu/arm-smmu: Get associated RMR info and > install bypass SMR > [...] > Shameer, > > Sorry for the delays. Here is a diff of the changes that should > address the issues pointed out by Robin, > I have tested that this works as expected on my HoneyComb LX2160A. Ok. Thanks for that. > diff --git a/drivers/iommu/arm/arm-smmu/arm-smmu.c > b/drivers/iommu/arm/arm-smmu/arm-smmu.c > index ab7b9db77625..a358bd326d0b 100644 > --- a/drivers/iommu/arm/arm-smmu/arm-smmu.c > +++ b/drivers/iommu/arm/arm-smmu/arm-smmu.c > @@ -2068,29 +2068,21 @@ static void > arm_smmu_rmr_install_bypass_smr(struct arm_smmu_device *smmu) > struct list_head rmr_list; > struct iommu_resv_region *e; > int i, cnt = 0; > - u32 smr; > u32 reg; > > INIT_LIST_HEAD(&rmr_list); > if (iommu_dma_get_rmrs(dev_fwnode(smmu->dev), &rmr_list)) > return; > > - reg = arm_smmu_gr0_read(smmu, ARM_SMMU_GR0_sCR0); > + /* Rather than trying to look at existing mappings that > + * are setup by the firmware and then invalidate the ones > + * that do no have matching RMR entries, just disable the > + * SMMU until it gets enabled again in the reset routine. > + */ > > - if ((reg & ARM_SMMU_sCR0_USFCFG) && !(reg & > ARM_SMMU_sCR0_CLIENTPD)) { > - /* > - * SMMU is already enabled and disallowing bypass, so > preserve > - * the existing SMRs > - */ > - for (i = 0; i < smmu->num_mapping_groups; i++) { > - smr = arm_smmu_gr0_read(smmu, > ARM_SMMU_GR0_SMR(i)); > - if (!FIELD_GET(ARM_SMMU_SMR_VALID, smr)) > - continue; > - smmu->smrs[i].id = > FIELD_GET(ARM_SMMU_SMR_ID, smr); > - smmu->smrs[i].mask = > FIELD_GET(ARM_SMMU_SMR_MASK, smr); > - smmu->smrs[i].valid = true; > - } > - } > + reg = arm_smmu_gr0_read(smmu, ARM_SMMU_GR0_sCR0); > + reg &= ~ARM_SMMU_sCR0_CLIENTPD; > + arm_smmu_gr0_write(smmu, ARM_SMMU_GR0_sCR0, reg); > > list_for_each_entry(e, &rmr_list, list) { > u32 sid = e->fw_data.rmr.sid; > @@ -2100,25 +2092,16 @@ static void > arm_smmu_rmr_install_bypass_smr(struct arm_smmu_device *smmu) > continue; > if (smmu->s2crs[i].count == 0) { > smmu->smrs[i].id = sid; > - smmu->smrs[i].mask = ~0; > + smmu->smrs[i].mask = 0; > smmu->smrs[i].valid = true; > } > smmu->s2crs[i].count++; > smmu->s2crs[i].type = S2CR_TYPE_BYPASS; > smmu->s2crs[i].privcfg = S2CR_PRIVCFG_DEFAULT; > - smmu->s2crs[i].cbndx = 0xff; > > cnt++; > } > > - if ((reg & ARM_SMMU_sCR0_USFCFG) && !(reg & > ARM_SMMU_sCR0_CLIENTPD)) { > - /* Remove the valid bit for unused SMRs */ > - for (i = 0; i < smmu->num_mapping_groups; i++) { > - if (smmu->s2crs[i].count == 0) > - smmu->smrs[i].valid = false; > - } > - } > - > dev_notice(smmu->dev, "\tpreserved %d boot mapping%s\n", cnt, > cnt == 1 ? "" : "s"); > iommu_dma_put_rmrs(dev_fwnode(smmu->dev), &rmr_list); > > Please include that in your next patch series. Let me know if you > want me to send you the patch direct > off the list. No problem, I will take this in next. Thanks, Shameer _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel