From patchwork Mon Jun 10 16:58:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Rob Herring \(Arm\)" X-Patchwork-Id: 166333 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp1257469ilk; Mon, 10 Jun 2019 09:58:29 -0700 (PDT) X-Google-Smtp-Source: APXvYqyvKh7aF1tSI9Vbk25LZTjLA1qvdhP79gT4ptYGs9dfq+4TS64KHuEQ7XBR9sKE2gLzIO5e X-Received: by 2002:a63:eb0a:: with SMTP id t10mr14836800pgh.99.1560185909742; Mon, 10 Jun 2019 09:58:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1560185909; cv=none; d=google.com; s=arc-20160816; b=XQTJdhd3e6gEfV00nfCmkysa1ak/C9I/OyXV1ArXyITEebWEzuH1zJAqx942MTFPaN jIdI3EzpZ7i0N0fUwILAtoqCV6itchQBe7hc+3rOyTMD3kI++bzdYc+skz5enn6vj7zC NTL8CrCGdwgARBGSJCzAAISYPiZ2w9GPaYhqJEghYuFZ9hzFSQVsuLXgqmNxjThawf4I X7++qCzU8KX2AmZN+jp+SrAC/aWpO5d6IEuXDQbLaZEz9G8qIeceMOVp498FpxiiwBxE iZUWQTvs2bZxJ2wbnYNrA1LtmWN0loC/imAfW+QxCndrD947MGnEPKprMu6Gpfx5STod i80g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:cc:list-subscribe :list-help:list-post:list-archive:list-unsubscribe:list-id :precedence:mime-version:message-id:date:subject:to:from :delivered-to; bh=Zu+mnVCQRbdn9lvbBYhkzOgRQi7q/Y9ssfkK+Jnha5g=; b=Dz+eqVyiCg7Q41Fp+AxhCzQZkdCrWk8ABz/lYoN0jtmpQ1ndSsyEHMshNr+OHHuiLq vDEEz7PkKOmT5FVf0Tdu5v/hFCF3raTB4h15a3smoOkbptbm5LILWAzQbDLpA37MMFHz NDvzGpxreBhxStTWAZSMLUZr0L13gdLC+xQ7INN9G/GAhGZMhxPI+3JneLrRFEUz+QVj 5qNXlmVfMeO2IWN1hcjMehV10HpyHba5fjzMkksyqqb067lOCMl8PIm0MXjZ67hIe+yM EM1OQH6bnGKIst6lh2LdZHl+eApYMdAHYWW3eRTcTOM2gLJbfYAeShsmFEdVkgJnf8gW I5Vw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id m127si9984039pgm.231.2019.06.10.09.58.29 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Mon, 10 Jun 2019 09:58:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 8779E8903B; Mon, 10 Jun 2019 16:58:27 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-ua1-f66.google.com (mail-ua1-f66.google.com [209.85.222.66]) by gabe.freedesktop.org (Postfix) with ESMTPS id E3A2B8903B for ; Mon, 10 Jun 2019 16:58:25 +0000 (UTC) Received: by mail-ua1-f66.google.com with SMTP id o19so3310730uap.13 for ; Mon, 10 Jun 2019 09:58:25 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=fP7YpHWgglKrcyzFnh2irV1N3UnxTxR7hTUY8S1RfRI=; b=WiaDec0JqKjFSyFwqlseBvcuhiJyfUxRsOkaOAeSAIiL9UgW39bklvhF+lRzGgv+Ru A0MH9+EhObOhJzCi9wDGngMgQhjR+CrCbZJf/gBgjUoMp5VQP2UQ+Al8dQyC5M2k4I4N V8wU86287xhIvQ9rpas2OwsOIvnWILci5WYG/Vl6osetwzjPEjMOSzmIld9ajeqUG6Od AtKFkfX552/e6ZzTIqo+5/HmfLtM+78wGtOtzeooUfDYOPUqIVkHl0Oylf9Wzq9DKfs0 hLlS6guARl8d/F+dUGfJEvLNEU7uIKvFhFGlyWl0QedGOSDAckg7Fh/LDJuGkK75rfrC 02Mg== X-Gm-Message-State: APjAAAUu1W0HkXpn6P5m8Ktxq68N8QoZ+W60zTJsvCzAWFzC9cghk+lB Kb6JcKTNF57ldlU8/liZFqNk3qI= X-Received: by 2002:a9f:3770:: with SMTP id a45mr6415917uae.64.1560185904499; Mon, 10 Jun 2019 09:58:24 -0700 (PDT) Received: from localhost.localdomain ([64.188.179.199]) by smtp.googlemail.com with ESMTPSA id p67sm3366457vkd.40.2019.06.10.09.58.23 (version=TLS1_3 cipher=AEAD-AES256-GCM-SHA384 bits=256/256); Mon, 10 Jun 2019 09:58:24 -0700 (PDT) From: Rob Herring To: dri-devel@lists.freedesktop.org Subject: [PATCH] drm/panfrost: Align GEM objects GPU VA to 2MB Date: Mon, 10 Jun 2019 10:58:06 -0600 Message-Id: <20190610165806.24854-1-robh@kernel.org> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Robin Murphy , Tomeu Vizoso , Steven Price Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" In order to increase the chances of using 2MB pages, we need to align the GPU VA mapping to 2MB. Only do this if the object size is 2MB or more. Cc: Robin Murphy Cc: Steven Price Cc: Tomeu Vizoso Signed-off-by: Rob Herring Reviewed-by: Tomeu Vizoso --- drivers/gpu/drm/panfrost/panfrost_gem.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/panfrost/panfrost_gem.c b/drivers/gpu/drm/panfrost/panfrost_gem.c index a5528a360ef4..886875ae31d3 100644 --- a/drivers/gpu/drm/panfrost/panfrost_gem.c +++ b/drivers/gpu/drm/panfrost/panfrost_gem.c @@ -52,6 +52,7 @@ struct drm_gem_object *panfrost_gem_create_object(struct drm_device *dev, size_t int ret; struct panfrost_device *pfdev = dev->dev_private; struct panfrost_gem_object *obj; + u64 align; obj = kzalloc(sizeof(*obj), GFP_KERNEL); if (!obj) @@ -59,9 +60,12 @@ struct drm_gem_object *panfrost_gem_create_object(struct drm_device *dev, size_t obj->base.base.funcs = &panfrost_gem_funcs; + size = roundup(size, PAGE_SIZE); + align = size >= SZ_2M ? SZ_2M >> PAGE_SHIFT : 0; + spin_lock(&pfdev->mm_lock); - ret = drm_mm_insert_node(&pfdev->mm, &obj->node, - roundup(size, PAGE_SIZE) >> PAGE_SHIFT); + ret = drm_mm_insert_node_generic(&pfdev->mm, &obj->node, + size >> PAGE_SHIFT, align, 0, 0); spin_unlock(&pfdev->mm_lock); if (ret) goto free_obj;