Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp664272ybl; Thu, 22 Aug 2019 03:01:02 -0700 (PDT) X-Google-Smtp-Source: APXvYqzJ0qgk7+Wjqbef7Z2rkGsX9gpIzB4/iuTe5MRnil8dTCF+c3UOCmBk1gDrJ+anF4XnlZHe X-Received: by 2002:a17:90b:28f:: with SMTP id az15mr4581106pjb.18.1566468062599; Thu, 22 Aug 2019 03:01:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566468062; cv=none; d=google.com; s=arc-20160816; b=S3/sA0RF7HEIUKSkSc3/kRz+XcwGcv1bGbK1YhbY2u84DZ1bI+7/w8er0N3rihd3nM sH7PKDlC+VazC0XEFW2Hfem04Qg+xQHvnpZ70EbsyikJmnGZTUAK3EbP0GETHnT+2OTH qnpSVfC6CbT90TRtItvLdXq7GkAABLYDrmgKA7CQ4PRt9aj4aLUqx886aw2GI7Faiiwd cAp86EM4uGPlwjXusGTxc70EjiQR5sOvmmmuqtMluWT8RFWqCKBZTQJ07/J8ys8ILy4/ JNprE/9zKxt1fQ6BswQHd8V0dewr2cej8GvBYrEeVRTArKwowZwLkWv2oLNtvaLZWrpO 6+RA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:date:cc:to:from:subject:message-id; bh=zm+Dr2gbX3xs9PqRY7B6RnWivwaghT8ZLcZyCNZY6/c=; b=f+66yiHNOqv9b2C2dfLjMeOvqIFO4uvEr3UATrSZzNKy3oIQu9MHEw77JzRclHYfK8 Pe3ERa1O1EiEMFmUQ7b/dEUCJYoedDLsBsY6+PQRZa779fw39UzCBBlPPQsaL2htBwmM HVXsVrkxSwyfQ2rTSXCAShEa5CpSvJ/ppKADj9vWqiYKgK+XO0ZQCCHkZwQFFX9q+D8f g9bxUCszqUPlFjFyFAGge42F3NOzASoI244UpLGDMTIYSSYxZdes7NtaeUMFz9pC7PgM xx4IK1EyfjCbRuUcl0uPLW76d9U4RdGokrR6ADlcJbtiXvBpW+aTX0Le5PfhaNDhpPuD Hevw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 12si17583928pfi.199.2019.08.22.03.00.47; Thu, 22 Aug 2019 03:01:02 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=mediatek.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732804AbfHVI4m (ORCPT + 99 others); Thu, 22 Aug 2019 04:56:42 -0400 Received: from Mailgw01.mediatek.com ([1.203.163.78]:17849 "EHLO mailgw01.mediatek.com" rhost-flags-OK-FAIL-OK-FAIL) by vger.kernel.org with ESMTP id S1731348AbfHVI4m (ORCPT ); Thu, 22 Aug 2019 04:56:42 -0400 X-UUID: 12062e92b4164c44998da9081270e292-20190822 X-UUID: 12062e92b4164c44998da9081270e292-20190822 Received: from mtkcas34.mediatek.inc [(172.27.4.253)] by mailgw01.mediatek.com (envelope-from ) (mailgw01.mediatek.com ESMTP with TLS) with ESMTP id 515483021; Thu, 22 Aug 2019 16:56:30 +0800 Received: from MTKCAS36.mediatek.inc (172.27.4.186) by MTKMBS31DR.mediatek.inc (172.27.6.102) with Microsoft SMTP Server (TLS) id 15.0.1395.4; Thu, 22 Aug 2019 16:56:22 +0800 Received: from [10.17.3.153] (172.27.4.253) by MTKCAS36.mediatek.inc (172.27.4.170) with Microsoft SMTP Server id 15.0.1395.4 via Frontend Transport; Thu, 22 Aug 2019 16:56:21 +0800 Message-ID: <1566464186.11621.7.camel@mhfsdcap03> Subject: Re: [PATCH v10 09/23] iommu/io-pgtable-arm-v7s: Extend to support PA[33:32] for MediaTek From: Yong Wu To: Will Deacon CC: , , Nicolas Boichat , , , , Joerg Roedel , , Evan Green , Tomasz Figa , , Rob Herring , , Matthias Brugger , , , Robin Murphy , "Matthias Kaehlcke" , Date: Thu, 22 Aug 2019 16:56:26 +0800 In-Reply-To: <20190821152448.qmoqjh5zznfpdi6n@willie-the-truck> References: <1566395606-7975-1-git-send-email-yong.wu@mediatek.com> <1566395606-7975-10-git-send-email-yong.wu@mediatek.com> <20190821152448.qmoqjh5zznfpdi6n@willie-the-truck> Content-Type: text/plain; charset="UTF-8" X-Mailer: Evolution 3.10.4-0ubuntu2 MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-TM-SNTS-SMTP: A53204EC2B24E8ED10E65E7323376A240E74388A8016195038C20EBC411B98902000:8 X-MTK: N Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 2019-08-21 at 16:24 +0100, Will Deacon wrote: > On Wed, Aug 21, 2019 at 09:53:12PM +0800, Yong Wu wrote: > > MediaTek extend the arm v7s descriptor to support up to 34 bits PA where > > the bit32 and bit33 are encoded in the bit9 and bit4 of the PTE > > respectively. Meanwhile the iova still is 32bits. > > > > Regarding whether the pagetable address could be over 4GB, the mt8183 > > support it while the previous mt8173 don't, thus keep it as is. > > > > Signed-off-by: Yong Wu > > --- > > drivers/iommu/io-pgtable-arm-v7s.c | 32 +++++++++++++++++++++++++------- > > include/linux/io-pgtable.h | 7 +++---- > > 2 files changed, 28 insertions(+), 11 deletions(-) > > [...] > > > @@ -731,7 +747,9 @@ static struct io_pgtable *arm_v7s_alloc_pgtable(struct io_pgtable_cfg *cfg, > > { > > struct arm_v7s_io_pgtable *data; > > > > - if (cfg->ias > ARM_V7S_ADDR_BITS || cfg->oas > ARM_V7S_ADDR_BITS) > > + if (cfg->ias > ARM_V7S_ADDR_BITS || > > + (cfg->oas > ARM_V7S_ADDR_BITS && > > + !(cfg->quirks & IO_PGTABLE_QUIRK_ARM_MTK_EXT))) > > Please can you instead change arm_v7s_alloc_pgtable() so that it allows an > ias of up to 34 when the IO_PGTABLE_QUIRK_ARM_MTK_EXT is set? Here I only simply skip the oas checking for our case. then which way do your prefer? something like you commented before:? if (cfg->ias > ARM_V7S_ADDR_BITS) return NULL; if (cfg->quirks & IO_PGTABLE_QUIRK_ARM_MTK_EXT) { if (!IS_ENABLED(CONFIG_PHYS_ADDR_T_64BIT)) cfg->oas = min(cfg->oas, ARM_V7S_ADDR_BITS); else if (cfg->oas > 34) return NULL; } else if (cfg->oas > ARM_V7S_ADDR_BITS) { return NULL; } > > With that change: > > Acked-by: Will Deacon > > Will > > _______________________________________________ > Linux-mediatek mailing list > Linux-mediatek@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-mediatek