Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp1802782pxb; Fri, 20 Aug 2021 14:35:10 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzlS2ryMjhw3n9gXokZXCPjG9O3aMtp3DnhgiJJLQj9A+RGsi8Kbw+sw8Tcer9fGyQQOE+9 X-Received: by 2002:a05:6402:d49:: with SMTP id ec9mr24353597edb.333.1629495310137; Fri, 20 Aug 2021 14:35:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629495310; cv=none; d=google.com; s=arc-20160816; b=vv+2p0h6djpgZGJlypLQr/vVMibSSsgCbxr3O2otAvllHNjWIm/fxP5AzTgXQGIS40 WXfVmpqWFaOHyH8ZrXrLPWRh/AsoUeKmbse/cx9c6RSn6vu+MMakDomr8Knf82WjlCEl GjMjvpbJVHGjyGvbh8Y0Ho83iltFj0Zxs21o3UzNSkcCJc15WujvMbxTBMR2zbkobzNZ CRE51Qa2tBD4McgYKuj233hqvO6RABEo7lmMACm+o7Bsh/87vPtjWJON8IAn7cnB6xIw 8a0z+xhiiaKOsFR9P/vbLY5ahEQGueYNJHxiZ8lT6oxXRxtqV9KMReZgEKeQKMKXvmb/ p85w== 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; bh=WHOK0UbYZpLjuH6uRDPbUwZFjbqSr1DIRsZUHyu5xq8=; b=EA6IllXEAcyzI51XBhf+PVwRVRmiUHkN7Atf9Vi5jLiNnavCYKDd6gxkoZQe+sAroV OOoRKd1CxW2HyKBNr/+OtVoqQp8SuCgvRXWMEV4J1Vm+XV18oekHoiepZzDbkHtHnsxt fAW/EeQvKiCkLf/OkuTNTJhagSCFX6rwDAhBWAESK/XfFTkPkC3CmXsCrdLmy4Rb/BTY oKh6X2bBLLP/ZPcNJ7WrdARcMUm4zApDRSnnNno3wpvqH/soy85VwRE8WSj3b7qJ7cnZ AGfH8MPIefo8VsHDoWQHTXZuVuJjmdVXdXoMK1l1EaoQFHOvl9228jDaO8ZdahWy4ndy qPgA== 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=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z2si8004005edq.209.2021.08.20.14.34.47; Fri, 20 Aug 2021 14:35:10 -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; 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=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240919AbhHTVc0 (ORCPT + 99 others); Fri, 20 Aug 2021 17:32:26 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48268 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240955AbhHTVcZ (ORCPT ); Fri, 20 Aug 2021 17:32:25 -0400 Received: from bhuna.collabora.co.uk (bhuna.collabora.co.uk [IPv6:2a00:1098:0:82:1000:25:2eeb:e3e3]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 417ECC061757; Fri, 20 Aug 2021 14:31:47 -0700 (PDT) Received: from localhost.localdomain (unknown [IPv6:2600:8800:8c06:1000::c8f3]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: alyssa) by bhuna.collabora.co.uk (Postfix) with ESMTPSA id 65D5D1F44A90; Fri, 20 Aug 2021 22:31:43 +0100 (BST) From: Alyssa Rosenzweig To: dri-devel@lists.freedesktop.org Cc: Rob Herring , Tomeu Vizoso , Steven Price , Alyssa Rosenzweig , David Airlie , Daniel Vetter , linux-kernel@vger.kernel.org, Chris Morgan , stable@vger.kernel.org Subject: [PATCH 3/3] drm/panfrost: Clamp lock region to Bifrost minimum Date: Fri, 20 Aug 2021 17:31:17 -0400 Message-Id: <20210820213117.13050-4-alyssa.rosenzweig@collabora.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210820213117.13050-1-alyssa.rosenzweig@collabora.com> References: <20210820213117.13050-1-alyssa.rosenzweig@collabora.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org When locking a region, we currently clamp to a PAGE_SIZE as the minimum lock region. While this is valid for Midgard, it is invalid for Bifrost, where the minimum locking size is 8x larger than the 4k page size. Add a hardware definition for the minimum lock region size (corresponding to KBASE_LOCK_REGION_MIN_SIZE_LOG2 in kbase) and respect it. Signed-off-by: Alyssa Rosenzweig Tested-by: Chris Morgan Cc: --- drivers/gpu/drm/panfrost/panfrost_mmu.c | 2 +- drivers/gpu/drm/panfrost/panfrost_regs.h | 2 ++ 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/panfrost/panfrost_mmu.c b/drivers/gpu/drm/panfrost/panfrost_mmu.c index 3a795273e505..dfe5f1d29763 100644 --- a/drivers/gpu/drm/panfrost/panfrost_mmu.c +++ b/drivers/gpu/drm/panfrost/panfrost_mmu.c @@ -66,7 +66,7 @@ static void lock_region(struct panfrost_device *pfdev, u32 as_nr, /* The size is encoded as ceil(log2) minus(1), which may be calculated * with fls. The size must be clamped to hardware bounds. */ - size = max_t(u64, size, PAGE_SIZE); + size = max_t(u64, size, AS_LOCK_REGION_MIN_SIZE); region_width = fls64(size - 1) - 1; region |= region_width; diff --git a/drivers/gpu/drm/panfrost/panfrost_regs.h b/drivers/gpu/drm/panfrost/panfrost_regs.h index 1940ff86e49a..6c5a11ef1ee8 100644 --- a/drivers/gpu/drm/panfrost/panfrost_regs.h +++ b/drivers/gpu/drm/panfrost/panfrost_regs.h @@ -316,6 +316,8 @@ #define AS_FAULTSTATUS_ACCESS_TYPE_READ (0x2 << 8) #define AS_FAULTSTATUS_ACCESS_TYPE_WRITE (0x3 << 8) +#define AS_LOCK_REGION_MIN_SIZE (1ULL << 15) + #define gpu_write(dev, reg, data) writel(data, dev->iomem + reg) #define gpu_read(dev, reg) readl(dev->iomem + reg) -- 2.30.2