Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp1153005pxu; Fri, 27 Nov 2020 00:35:44 -0800 (PST) X-Google-Smtp-Source: ABdhPJyUMvd5uaowS16DmjhC0MukLUubT12GnP1DgjfJQjyKHwdfOwtLFOErv2THhbkym9VohRBG X-Received: by 2002:a17:906:68c4:: with SMTP id y4mr6723461ejr.332.1606466143937; Fri, 27 Nov 2020 00:35:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606466143; cv=none; d=google.com; s=arc-20160816; b=dehccmyF7hQ5fXF6D20p/aMlUmWuqaMtuu9cX8tshv2qeQVkjiepW5t+1+uOslaC3s 7tJ5ywJ2sJ/XJLYmNnGIp8pOBZr6eqnTHkABfgxJqQ84EkMucm/n9/DsRJ4CzxpzowpN AsbcO/Ik798DdaItQiA310h/SqIez337uIkPhC7XYVgXEB58Wx1FQW1CSKcY7ifk0s7I 19lS40cLIr9yifrgVSZd8ofgEZhW1g0YY5wMTgqvkA2Ud6+aShBmivzdKc8k43MbrpmD GCWpEHjpOysPfp5yMMHDNrGGRrGc75zeHzl5XysH0eIvhXOzQ6cVQRum60T9S65NZGPy C/SQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=9B/eXTC7kqIbDOHUU65wARpGI1cl6efJbSiShEqlnPU=; b=x+DxYHB4m6FQLqiwewAsmF6RWWEJZSMaiTQpp2PCaRq1yfukQnJZXhwWepZYxsSttU tHvxiC4qctGKOA07OHxOnJ6KvF4VWky7HQo2e5BFI4MkheonvURfVlHrpXNhpEu6QDxk IQYo81ds8KPRPWe4QWgGvjud5A8S9xz3Ej0f3auFB8J8zsyUoBFLFalJC/h9CVGBUtlJ qe6FchcaNF2JlRy58anAc7sp0oWhcS50xg+sCz/osAnJ8NsCly5+u5W+hVMl8OlLcr13 rZZ94SwjsqinJyx0uNEnAbBaGo5PYnOfzqxLk1nH2QMX2K3YTchlyeN4kc6HE6eXTiFN YdYg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id u20si4652847edr.287.2020.11.27.00.35.21; Fri, 27 Nov 2020 00:35:43 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730364AbgKZPlc (ORCPT + 99 others); Thu, 26 Nov 2020 10:41:32 -0500 Received: from foss.arm.com ([217.140.110.172]:37058 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727481AbgKZPlc (ORCPT ); Thu, 26 Nov 2020 10:41:32 -0500 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 7700A31B; Thu, 26 Nov 2020 07:41:31 -0800 (PST) Received: from [10.57.59.159] (unknown [10.57.59.159]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 27CC43F71F; Thu, 26 Nov 2020 07:41:26 -0800 (PST) Subject: Re: [PATCH v4 07/24] iommu/io-pgtable-arm-v7s: Use ias to check the valid iova in unmap To: Yong Wu , Joerg Roedel , Matthias Brugger , Rob Herring , Will Deacon Cc: Krzysztof Kozlowski , Evan Green , Tomasz Figa , linux-mediatek@lists.infradead.org, srv_heupstream@mediatek.com, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, iommu@lists.linux-foundation.org, youlin.pei@mediatek.com, Nicolas Boichat , anan.sun@mediatek.com, chao.hao@mediatek.com, Greg Kroah-Hartman , kernel-team@android.com References: <20201111123838.15682-1-yong.wu@mediatek.com> <20201111123838.15682-8-yong.wu@mediatek.com> From: Robin Murphy Message-ID: Date: Thu, 26 Nov 2020 15:41:25 +0000 User-Agent: Mozilla/5.0 (Windows NT 10.0; rv:78.0) Gecko/20100101 Thunderbird/78.5.0 MIME-Version: 1.0 In-Reply-To: <20201111123838.15682-8-yong.wu@mediatek.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-GB Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 2020-11-11 12:38, Yong Wu wrote: > Use the ias for the valid iova checking in arm_v7s_unmap. This is a > preparing patch for supporting iova 34bit for MediaTek. I can't help thinking of weird ways to generate better code here, but being consistent with what we already have on the map path is probably more valuable for now. Reviewed-by: Robin Murphy > Signed-off-by: Yong Wu > --- > drivers/iommu/io-pgtable-arm-v7s.c | 2 +- > 1 file changed, 1 insertion(+), 1 deletion(-) > > diff --git a/drivers/iommu/io-pgtable-arm-v7s.c b/drivers/iommu/io-pgtable-arm-v7s.c > index a688f22cbe3b..e880745ab1e8 100644 > --- a/drivers/iommu/io-pgtable-arm-v7s.c > +++ b/drivers/iommu/io-pgtable-arm-v7s.c > @@ -717,7 +717,7 @@ static size_t arm_v7s_unmap(struct io_pgtable_ops *ops, unsigned long iova, > { > struct arm_v7s_io_pgtable *data = io_pgtable_ops_to_data(ops); > > - if (WARN_ON(upper_32_bits(iova))) > + if (WARN_ON(iova >= (1ULL << data->iop.cfg.ias))) > return 0; > > return __arm_v7s_unmap(data, gather, iova, size, 1, data->pgd); >