Received: by 2002:a05:6a10:2726:0:0:0:0 with SMTP id ib38csp115909pxb; Thu, 7 Apr 2022 00:18:05 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxVbcehSSwc8wT2WChuuNxinkAS8FMYK7bSa7WM/a8R/lik44PdmKFrXCzwg0OFNLKmGHae X-Received: by 2002:a17:906:d555:b0:6db:148e:5cc with SMTP id cr21-20020a170906d55500b006db148e05ccmr11636773ejc.63.1649315885702; Thu, 07 Apr 2022 00:18:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1649315885; cv=none; d=google.com; s=arc-20160816; b=M2HYxvS4G2/TipPeZ10Ck5kSrhjGMeuA1TjXfo8RfkhyDJXtjg8gkXZMNs8+2y3qQf UR9cil1rqXeS+zIvakpWmccl3Pt7T0XN67UCsZxUdasyPm23BjdXvsI36M7I2DdNuNlo FyAgV7QAwlJBimZxH/tLyofzOKm0ee7VffDrp9QdaiAAVK4k2ccIT3TpqRceFKsC+KJr sxsI4i/1IYvDp0OqHDG4elpV+4iykbsj4XsJU1ScfWIBuH52f5XEhq5EkDCPe4VqOAvo EvLy2jHCtkOazgSvfyOKVXJ22dSOqiiOWJilaGN/g1L6lJ4J7NVFD4GJeZKxZD57Msr7 WZBA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=fYDyepM1PAw2FFzhXN5YHyImg0OWJ25svdZsQDoslA8=; b=VWe/hbuOUUPi5I1ETGEGEUUHlRW0JT2ueBjXioyyrzCYK9VHyFy3ikeGgZO4LQui/Q jcwgJGJit0oSTUeDGftxuMJHFyZat5B6Y4Gm7wBGEKy0FUQFbEaVHavIj/G8qZ9TI5Iq Tcpp5L1+L1Tt31PtZUxsiDwqfAXdqCcTyOJigRnCsjE5zMuMz1UzFYSdyZ9VrcjqLHCr ot4G+pxSRkGC2x2IDkd6nkc/YQ384OtDlP87ypn0W4cW91mSW140gVCTL7KhoH+k9xqU tGrMN6LLnWjELvJFDHJEyZTJSAyeXwNKykB9n3/oFJt3fQm5xgZpdeoAKKhPni0scDlh xM9A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=elXd+0hz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id m3-20020a056402430300b00418c2b5bd3asi15721640edc.28.2022.04.07.00.17.41; Thu, 07 Apr 2022 00:18:05 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=elXd+0hz; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 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 S236604AbiDFVy6 (ORCPT + 99 others); Wed, 6 Apr 2022 17:54:58 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54574 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236805AbiDFVwf (ORCPT ); Wed, 6 Apr 2022 17:52:35 -0400 Received: from mail-pg1-x532.google.com (mail-pg1-x532.google.com [IPv6:2607:f8b0:4864:20::532]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0F4C6B869; Wed, 6 Apr 2022 14:46:41 -0700 (PDT) Received: by mail-pg1-x532.google.com with SMTP id h5so2342814pgc.7; Wed, 06 Apr 2022 14:46:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=fYDyepM1PAw2FFzhXN5YHyImg0OWJ25svdZsQDoslA8=; b=elXd+0hzIHUx5ashQEuu8e90wnqvXKEA+YJ3YP8dzFR3jiRs4IdIiVscG4KdugiWaP LuAPpyu1ZGkTh6WH6jY+9EWAb9kobhmG3llvn65HrTzxo1WabLA1U+2rn5uHYfm/ps1m ZspFqb+Q2o7mK6kEfcm5yFG1QX6P8GujvvcmnSDMePYf5YixkPMfU8xsIVwAz+74ymRT 0s5c9NJQzyhS1te28JaqK2S4I1QbaMV6mNo4ZVr1i+Ij5lC18s2CyPyexMj3Uf7o85gf k450TTB+5InqR2aci88INGaQB8wEutulfINYiC8VC1vIcFY0+rca678goaERpA+NC9Ku Kpaw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=fYDyepM1PAw2FFzhXN5YHyImg0OWJ25svdZsQDoslA8=; b=PlOp0L1AK9ZDdTNRsEOsomcPiTqGiqV8dOVxNV7ruXyNFAhlA41KmnIXyxWCwPlsba DD3V5LrBrS1MZgWE/d36pYhfcb7C/E9qfq0/QAfwyPYt/SG/z7VR1edDDD7lOc2i4Ezg EZUp8ldh9/R8ukHMRJfjlDPJTK3H0/RP4+fHx+nXosqSFWOdGAksZAhoZKq9daAkD1PD hoTlLEO8PZCOx2YGFjGcMgyo/NoiMppFfZXMP8FvIyQrvFV/5Iw6CxwYPXYZtASLieIt 5gAOBdcCdGAOdCUZojlxVd/NiqGoEgYUQxoMwTiMM7HGmue8H+EwJ3LpL1h0uSws/EVb LWNA== X-Gm-Message-State: AOAM530rNWIr6a7o5xyMgkks6byDb8kfEf3BtQUOG09pH2vWd1PIGKoj 23VW+7K3C1LW2Gs5KAtMbkg= X-Received: by 2002:a63:8f49:0:b0:398:7299:c130 with SMTP id r9-20020a638f49000000b003987299c130mr8716076pgn.537.1649281600514; Wed, 06 Apr 2022 14:46:40 -0700 (PDT) Received: from localhost ([2a00:79e1:abd:4a00:2703:3c72:eb1a:cffd]) by smtp.gmail.com with ESMTPSA id r24-20020a62e418000000b004fde0e5610dsm15920680pfh.210.2022.04.06.14.46.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 06 Apr 2022 14:46:39 -0700 (PDT) From: Rob Clark To: dri-devel@lists.freedesktop.org Cc: freedreno@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, Dmitry Baryshkov , Dmitry Osipenko , Rob Clark , Rob Clark , Sean Paul , Abhinav Kumar , David Airlie , Daniel Vetter , Jonathan Marek , Akhil P Oommen , Bjorn Andersson , Yangtao Li , Dan Carpenter , linux-kernel@vger.kernel.org (open list) Subject: [PATCH v3 05/10] drm/msm/gem: Drop PAGE_SHIFT for address space mm Date: Wed, 6 Apr 2022 14:46:21 -0700 Message-Id: <20220406214636.1156978-6-robdclark@gmail.com> X-Mailer: git-send-email 2.35.1 In-Reply-To: <20220406214636.1156978-1-robdclark@gmail.com> References: <20220406214636.1156978-1-robdclark@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,FREEMAIL_FROM, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Rob Clark Get rid of all the unnecessary conversion between address/size and page offsets. It just confuses things. Signed-off-by: Rob Clark Reviewed-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/adreno/a6xx_gmu.c | 2 +- drivers/gpu/drm/msm/msm_gem.c | 5 ++--- drivers/gpu/drm/msm/msm_gem.h | 4 ++-- drivers/gpu/drm/msm/msm_gem_vma.c | 16 ++++++++-------- 4 files changed, 13 insertions(+), 14 deletions(-) diff --git a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c index 3e325e2a2b1b..9f76f5b15759 100644 --- a/drivers/gpu/drm/msm/adreno/a6xx_gmu.c +++ b/drivers/gpu/drm/msm/adreno/a6xx_gmu.c @@ -1172,7 +1172,7 @@ static int a6xx_gmu_memory_alloc(struct a6xx_gmu *gmu, struct a6xx_gmu_bo *bo, return PTR_ERR(bo->obj); ret = msm_gem_get_and_pin_iova_range(bo->obj, gmu->aspace, &bo->iova, - range_start >> PAGE_SHIFT, range_end >> PAGE_SHIFT); + range_start, range_end); if (ret) { drm_gem_object_put(bo->obj); return ret; diff --git a/drivers/gpu/drm/msm/msm_gem.c b/drivers/gpu/drm/msm/msm_gem.c index f96d1dc72021..f4b68bb28a4d 100644 --- a/drivers/gpu/drm/msm/msm_gem.c +++ b/drivers/gpu/drm/msm/msm_gem.c @@ -392,7 +392,7 @@ static int get_iova_locked(struct drm_gem_object *obj, if (IS_ERR(vma)) return PTR_ERR(vma); - ret = msm_gem_init_vma(aspace, vma, obj->size >> PAGE_SHIFT, + ret = msm_gem_init_vma(aspace, vma, obj->size, range_start, range_end); if (ret) { del_vma(vma); @@ -434,8 +434,7 @@ static int msm_gem_pin_iova(struct drm_gem_object *obj, if (IS_ERR(pages)) return PTR_ERR(pages); - ret = msm_gem_map_vma(aspace, vma, prot, - msm_obj->sgt, obj->size >> PAGE_SHIFT); + ret = msm_gem_map_vma(aspace, vma, prot, msm_obj->sgt, obj->size); if (!ret) msm_obj->pin_count++; diff --git a/drivers/gpu/drm/msm/msm_gem.h b/drivers/gpu/drm/msm/msm_gem.h index 1b7f0f0b88bf..090c3b1a6d9a 100644 --- a/drivers/gpu/drm/msm/msm_gem.h +++ b/drivers/gpu/drm/msm/msm_gem.h @@ -59,7 +59,7 @@ struct msm_gem_vma { }; int msm_gem_init_vma(struct msm_gem_address_space *aspace, - struct msm_gem_vma *vma, int npages, + struct msm_gem_vma *vma, int size, u64 range_start, u64 range_end); bool msm_gem_vma_inuse(struct msm_gem_vma *vma); void msm_gem_purge_vma(struct msm_gem_address_space *aspace, @@ -68,7 +68,7 @@ void msm_gem_unmap_vma(struct msm_gem_address_space *aspace, struct msm_gem_vma *vma); int msm_gem_map_vma(struct msm_gem_address_space *aspace, struct msm_gem_vma *vma, int prot, - struct sg_table *sgt, int npages); + struct sg_table *sgt, int size); void msm_gem_close_vma(struct msm_gem_address_space *aspace, struct msm_gem_vma *vma); diff --git a/drivers/gpu/drm/msm/msm_gem_vma.c b/drivers/gpu/drm/msm/msm_gem_vma.c index dc2ae097805e..4949899f1fc7 100644 --- a/drivers/gpu/drm/msm/msm_gem_vma.c +++ b/drivers/gpu/drm/msm/msm_gem_vma.c @@ -46,7 +46,7 @@ bool msm_gem_vma_inuse(struct msm_gem_vma *vma) void msm_gem_purge_vma(struct msm_gem_address_space *aspace, struct msm_gem_vma *vma) { - unsigned size = vma->node.size << PAGE_SHIFT; + unsigned size = vma->node.size; /* Print a message if we try to purge a vma in use */ if (GEM_WARN_ON(msm_gem_vma_inuse(vma))) @@ -73,9 +73,8 @@ void msm_gem_unmap_vma(struct msm_gem_address_space *aspace, int msm_gem_map_vma(struct msm_gem_address_space *aspace, struct msm_gem_vma *vma, int prot, - struct sg_table *sgt, int npages) + struct sg_table *sgt, int size) { - unsigned size = npages << PAGE_SHIFT; int ret = 0; if (GEM_WARN_ON(!vma->iova)) @@ -120,7 +119,7 @@ void msm_gem_close_vma(struct msm_gem_address_space *aspace, /* Initialize a new vma and allocate an iova for it */ int msm_gem_init_vma(struct msm_gem_address_space *aspace, - struct msm_gem_vma *vma, int npages, + struct msm_gem_vma *vma, int size, u64 range_start, u64 range_end) { int ret; @@ -129,14 +128,15 @@ int msm_gem_init_vma(struct msm_gem_address_space *aspace, return -EBUSY; spin_lock(&aspace->lock); - ret = drm_mm_insert_node_in_range(&aspace->mm, &vma->node, npages, 0, - 0, range_start, range_end, 0); + ret = drm_mm_insert_node_in_range(&aspace->mm, &vma->node, + size, PAGE_SIZE, 0, + range_start, range_end, 0); spin_unlock(&aspace->lock); if (ret) return ret; - vma->iova = vma->node.start << PAGE_SHIFT; + vma->iova = vma->node.start; vma->mapped = false; kref_get(&aspace->kref); @@ -161,7 +161,7 @@ msm_gem_address_space_create(struct msm_mmu *mmu, const char *name, aspace->name = name; aspace->mmu = mmu; - drm_mm_init(&aspace->mm, va_start >> PAGE_SHIFT, size >> PAGE_SHIFT); + drm_mm_init(&aspace->mm, va_start, size); kref_init(&aspace->kref); -- 2.35.1