Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp935992pxb; Tue, 14 Sep 2021 11:59:02 -0700 (PDT) X-Google-Smtp-Source: ABdhPJycu7ayYboLc9hDhvjuynqac7sZwI6mGcHK1YPNsPl6fvWOrYgAaXUuLqS4I2xvxTm/ymk/ X-Received: by 2002:a6b:296:: with SMTP id 144mr14966854ioc.114.1631645942446; Tue, 14 Sep 2021 11:59:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631645942; cv=none; d=google.com; s=arc-20160816; b=R3r5ygqJcLQuUTIQoGdbU72piZjmWt00fY+CJz6dF8TBu1liAulM19TPKhSiEbG1Pp RTr7OkB8dz3hgolZiNhJLGH6v7HJ36RWuDTKptF9KOOxBdTkZcbhBNJwzoQ7eacvMy6P u/EdGJKTFA2vEeZatUbx1ZHcu7RLRmVqciLYkO6/az1w/Ru78dmmM9nzHdH8DIh6prf1 3Wi0Fbb5lO6UapoXsX7o0asler8p9O2dO9xhbcfB8YwDFH9U59iqdwXdysESwuBM7fCj BzR+L0PivNX1KThmb590+Bx0D9N1sqXRbk4KQJkQmB1slb6skGfNIiMDnqDnb3lBa5ia +/4g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-transfer-encoding :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=g2+loS70cSgdFxeOP/sRqiawauBWZZoV++pN8aeuNG4=; b=RIEw21c9e5clD6J892bfeGjQd+aqTQp7eew0O7p58s3ASBAthPgiq/A2gX6cxUR2oP NQZmrRUwCNAu/hr0XA9UHkoVUmc4zEEs7ZV/iB8kVwJQn1U3CEouQC64jOdJ4LBOlOih bM4zK0B0iW6NpnLLoKEMQG3UTgiQYWI9/aHlY0tJnUICSf/DeHoMrFyC0dAihGsRSBR8 X31q06aCRc2joHIjummkx9pYd8rLxasiuD3kY+654FD26oLFOL/5zr4yCw74yP/ewNrO XLNUV7PqvXT1oinhTKUsvcxC9UEtcmKLmLllITDO/WXZ6S8sudL5AMg/+uqpxuD0KQoa d7Jw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=LiNspIrK; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l20si13685710jaj.132.2021.09.14.11.58.48; Tue, 14 Sep 2021 11:59:02 -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=@gmail.com header.s=20210112 header.b=LiNspIrK; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232182AbhINS6o (ORCPT + 99 others); Tue, 14 Sep 2021 14:58:44 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45786 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229728AbhINS6n (ORCPT ); Tue, 14 Sep 2021 14:58:43 -0400 Received: from mail-pl1-x636.google.com (mail-pl1-x636.google.com [IPv6:2607:f8b0:4864:20::636]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 56FD3C061574; Tue, 14 Sep 2021 11:57:26 -0700 (PDT) Received: by mail-pl1-x636.google.com with SMTP id f21so6651861plb.4; Tue, 14 Sep 2021 11:57:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:content-transfer-encoding:in-reply-to :user-agent; bh=g2+loS70cSgdFxeOP/sRqiawauBWZZoV++pN8aeuNG4=; b=LiNspIrKHZ8lHoj51foc14YEVker+hYXD5WF7LtIW9JrAXaWxwNzMiZ7xZoVWbD56P MlFik++pPRVz1wMEMRg0xe0uhGUAVrFDWHIsl5zMK0v3OPiy9BPD8vIvB4rBSZDgwaKq 46NuEayBAIue4b0SSqeqACnyrYFZsCeiXF4+IUceZp71L8dOXKnnrCrHHDCc9NPJp3AL 8KhA1a0Gw4MSqKRZvyU9vcKv7FsJdQZ8vZxLCLxHxJm6nOYwgOeqrtO2pK5FkBCmhHVx PK1IE/dSrc8ZJG9VL6NT7kXko3iE9mZF7frY1a+63UCcRBror9iuqWugJdnwQBeLi7NZ sPTg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:content-transfer-encoding :in-reply-to:user-agent; bh=g2+loS70cSgdFxeOP/sRqiawauBWZZoV++pN8aeuNG4=; b=1viJGb0v20uQvxUbbApBRyEd2GoER1X5w7RI7lr9d10rEGTXsDxKLfa1Krwb76Mj2N xgYlP5/X+FuZnkzT/0LMdsrGnhMCckGJ3UnRm7XSMU88KiUJ3tDH9Rz10LMZm0C/Fguo wDsXnkyiL0E32rNEHW3gImwQAsTBWBvzp9CY8cpPv7OkVqRDvquni/j1fgPfWT2XDdhd +ucvdlEg6LQmFQM4vZfBby+TU7fdM5VH29fWqo/cdmL/rdVtD4+INxq5n7ZdKidWlq55 Jb8YQ3qq1I46NEI77TY9wchp/UsA5xbBd/FQjcNV64T1sUhWQ1R6Kk8NQwRMLAL0Rb6G nOBQ== X-Gm-Message-State: AOAM532zbqROIsV3Rem/5huNIpZujER6FCq/b/eo1+83OgoETwdpVyEG Iv3KhuWMkyYLlehLZuRzgsg= X-Received: by 2002:a17:90a:1984:: with SMTP id 4mr3788827pji.87.1631645845834; Tue, 14 Sep 2021 11:57:25 -0700 (PDT) Received: from Asurada-Nvidia (thunderhill.nvidia.com. [216.228.112.22]) by smtp.gmail.com with ESMTPSA id x15sm12057669pgt.34.2021.09.14.11.57.24 (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Tue, 14 Sep 2021 11:57:25 -0700 (PDT) Date: Tue, 14 Sep 2021 11:49:34 -0700 From: Nicolin Chen To: Dmitry Osipenko Cc: thierry.reding@gmail.com, joro@8bytes.org, will@kernel.org, vdumpa@nvidia.com, jonathanh@nvidia.com, linux-tegra@vger.kernel.org, iommu@lists.linux-foundation.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH v6 6/6] iommu/tegra-smmu: Add pagetable mappings to debugfs Message-ID: <20210914184933.GA32705@Asurada-Nvidia> References: <20210914013858.31192-1-nicoleotsuka@gmail.com> <20210914013858.31192-7-nicoleotsuka@gmail.com> <31501a62-3312-9f04-3bb8-790d0481746c@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <31501a62-3312-9f04-3bb8-790d0481746c@gmail.com> User-Agent: Mutt/1.9.4 (2018-02-28) Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Sep 14, 2021 at 04:29:15PM +0300, Dmitry Osipenko wrote: > 14.09.2021 04:38, Nicolin Chen пишет: > > +static unsigned long pd_pt_index_iova(unsigned int pd_index, unsigned int pt_index) > > +{ > > + return ((dma_addr_t)pd_index & (SMMU_NUM_PDE - 1)) << SMMU_PDE_SHIFT | > > + ((dma_addr_t)pt_index & (SMMU_NUM_PTE - 1)) << SMMU_PTE_SHIFT; > > +} > > We know that IOVA is fixed to u32 for this controller. Can we avoid all > these dma_addr_t castings? It should make code cleaner a tad, IMO. Tegra210 actually supports 34-bit IOVA...