Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp610413ybh; Sun, 12 Jul 2020 17:41:52 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw6QLtw9YjZaGvMaVCAmNPemcPB51J64Z4QFn9Ec417ar20kVpV6/4eHnoMDNl04VuONyt8 X-Received: by 2002:a17:906:71d4:: with SMTP id i20mr75583710ejk.533.1594600912725; Sun, 12 Jul 2020 17:41:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594600912; cv=none; d=google.com; s=arc-20160816; b=YlIr3soOTyNKjGsGnWzbYRnGXZD1qxTm9pHRKCA3zKgJPyMhDQ4O8F1kvsNdZtyNiM gAgUS6UnGYeE5Uh7drt+akT587YfrtShbgBkHGT5kuIsQ5px9LfsHWkCE8W/n2k4kq+a 9HvD7SxW9aopq79qoZK3IVMsydg2/Zl9lLQCvI6pwAiDCxbE7elaT0c6aDoCL8CoPhe4 T7UZwwpNRZMp/HKwAQY22nK3wzxAc721GIvZCFXlu3Lbq5KaPqV66oyzmtk0dDJnqAlJ hKNmjTZjfsJ9M+TZ2x/AvEnFbrD9i8M5z4Gy/uvWSS9kNP6qiL3GmZpJy9XoxxH+BlSK nB5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=g0AyRgeo4BEr9j6w4Przg7qSFRU4h688XiJcnxouhyk=; b=g2LAihc4acuZ1XRVB80Q8QBNId1sqADCRF12RDztW4AgXf7DcEZA9IpDAtMn/8kgk9 k/aJPahAtLzslCLDUGbu6NcsO2G4vrc1OKa7QmU1qUn3jEDDP/aP2J4ZuCaMYnSyClSi cPwQsKow169R9bPNFpFOcgDqot+/vgsEEr6WGW0SXRJhVvXP1M7dmvyCGtgcleBVul0s mp1UhhuwwKV0d469ZdXyoszEG5wDqsVWpbaqrSakC0wlpToDi3OdcCKJjPWOSkTsbxFe FMYXoHsYa7ogRuazsUD97EXYJ+6h1ZUBQ+iUy8Crm6fRyCaZQmYWlhMUw+5Z3XDWBPmF QqRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=KB727iWE; 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=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id a66si10299358edf.398.2020.07.12.17.41.30; Sun, 12 Jul 2020 17:41:52 -0700 (PDT) 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; dkim=pass header.i=@chromium.org header.s=google header.b=KB727iWE; 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=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727112AbgGMAig (ORCPT + 99 others); Sun, 12 Jul 2020 20:38:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41290 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727021AbgGMAig (ORCPT ); Sun, 12 Jul 2020 20:38:36 -0400 Received: from mail-vs1-xe42.google.com (mail-vs1-xe42.google.com [IPv6:2607:f8b0:4864:20::e42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 147A8C08C5DB for ; Sun, 12 Jul 2020 17:38:36 -0700 (PDT) Received: by mail-vs1-xe42.google.com with SMTP id d11so3252444vsq.3 for ; Sun, 12 Jul 2020 17:38:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=g0AyRgeo4BEr9j6w4Przg7qSFRU4h688XiJcnxouhyk=; b=KB727iWE6w5PGxDvHa2wMRrbthwrun9FRgyTC4B4X7EbxLxG6FdFeC67YzVOR4lsHJ zyacQjO2mMSGubdbACm0TfaMStvb+6H3WogGdpeeIJm1xd8Iw2CS0a0Ob1BjenJom+xI dcKKYQB/EsxLk/eyTmJPjelq7Zl1iRYhjVfw8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=g0AyRgeo4BEr9j6w4Przg7qSFRU4h688XiJcnxouhyk=; b=TjCo/kXNjv/R6Ei6M7iJnGrVYvpPB3Ljvgv/FXMZZr9eD+SbFjCrWwkcxfpTJklA4W WG4K3etgPJJ2+Ws+tTxj7rikSIpv3sjZW7pY9TSqD1+2cpsiMoT0WpdBM/BQIi0t2gpU gUdw2fYaQlGI6EcxmdjZNLN0IXZ2dnpSDa8WyWh7/8zO3aYYPJiXNybX41CnMA7706nQ BKoeF6Aw9W3dh7r4GrkD74W3SUE6WkjYHe7bIw1mi0Xu+BBLt8uVrtlr4FbpBY/XkQCu 1ywFjMwNyeTQesurRLGkJ2w3fZBADOW4Y6B1/qWhejKSc20ZEF32CRJrhWGf8x8dgtfZ rj8g== X-Gm-Message-State: AOAM531Mps3LArpgd8iO0EpiGp63HKPUMwQ483AopHq6C+L8wGy5v09a iO9KLdbC9LV7/MKLBXUqOS35ECBYoJas+gVQ3Llb/g== X-Received: by 2002:a67:f5c6:: with SMTP id t6mr13334091vso.14.1594600715022; Sun, 12 Jul 2020 17:38:35 -0700 (PDT) MIME-Version: 1.0 References: <20200711064846.16007-1-yong.wu@mediatek.com> <20200711064846.16007-7-yong.wu@mediatek.com> In-Reply-To: <20200711064846.16007-7-yong.wu@mediatek.com> From: Nicolas Boichat Date: Mon, 13 Jul 2020 08:38:24 +0800 Message-ID: Subject: Re: [PATCH 06/21] iommu/io-pgtable-arm-v7s: Use ias to check the valid iova in unmap To: Yong Wu Cc: Joerg Roedel , Matthias Brugger , Rob Herring , Robin Murphy , Will Deacon , Evan Green , Tomasz Figa , "moderated list:ARM/Mediatek SoC support" , srv_heupstream , Devicetree List , lkml , linux-arm Mailing List , iommu@lists.linux-foundation.org, youlin.pei@mediatek.com, anan.sun@mediatek.com, cui.zhang@mediatek.com, chao.hao@mediatek.com, ming-fan.chen@mediatek.com Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sat, Jul 11, 2020 at 2:50 PM Yong Wu wrote: > > As title. > > 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 4272fe4e17f4..01f2a8876808 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))) This is a little odd as iova is unsigned long and 1ULL is unsigned long long. Would it be better to keep the spirit of the previous test and do something like: if (WARN_ON(iova >> data->iop.cfg.ias)) ? > return 0; > > return __arm_v7s_unmap(data, gather, iova, size, 1, data->pgd); > -- > 2.18.0