Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp2936729pxb; Tue, 24 Aug 2021 10:58:58 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwujBiLUby1WOOX8o9zi0lMOhZPBBbrk+8QBXaf8G5x5UhjKh7f86RJhNPoO5xUk11dSzqY X-Received: by 2002:a6b:b883:: with SMTP id i125mr31332694iof.144.1629827938327; Tue, 24 Aug 2021 10:58:58 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629827938; cv=none; d=google.com; s=arc-20160816; b=VT3M2mtbt5xPWekS+tzfbE/NBGSEOW1J/d3vqCv3xpPd/r1LAwW6NMtqg/BDCtz4Cz LN0zsuEh0zvOLZwpzLDGqcqsyrLrVQdSvPC2uzpM/TqN0N/9SM7kSZYdln7kU+d561ZU /Hfs53LO+dbeECm1fgNDuNSzXft6oW3vWqFmTCrWtoFxrMh7wuKrgsg51B8HDxj1rMG+ QzmR7tWZWBcJTZlOqKLzyLXCbyRn+5YZwPhzj9OnAFYhYuyTNFgsQx8HJ9AamRpkeeW6 Z0+CigsLBa2j2n9d28Ka1SpsU1w66lZIxiZcqYsgbiobZoO3Ajp3UuF79XQFcNUyUznb ZnmQ== 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=R8m9OYmSLzrCDe8JaDjywULUN2PsifV6wDprYdgHSKo=; b=L1/RPih2Zb/JApIlvEIAreCUax3mSjBT44Q3PT4s/nuNObaEDdgdrU1Yq5M9JvVl+5 wUZvAONNDHxeoM4sFQd+GNFQJ01GLxYPhgytWfOt1JGEuDabOaYKN0YoehIJOwylOKIB 1IAwTnpBYdzW143QO03kcvC2HtFT0soxtqUbSl7LBy7YvJCbk0c9jC3gonsMxT093CuN aqqI6483dGhKlysbWdRGi2BejdzQslK8eiov8hm+wkYHD2S+zFz4l7zzYVushminspJC c20+d01SdZrUy61rdgb1tYpmX0KLoElvUw/kHBo0+HodvMngqY7kXdBzKzSUf+xgu9IN Iz0g== 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 w13si17405598jae.1.2021.08.24.10.58.47; Tue, 24 Aug 2021 10:58:58 -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 S241415AbhHXR5c (ORCPT + 99 others); Tue, 24 Aug 2021 13:57:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40806 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241244AbhHXR50 (ORCPT ); Tue, 24 Aug 2021 13:57:26 -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 C7B2DC0C1765; Tue, 24 Aug 2021 10:31:15 -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 020A81F41A29; Tue, 24 Aug 2021 18:31:10 +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 v2 3/4] drm/panfrost: Clamp lock region to Bifrost minimum Date: Tue, 24 Aug 2021 13:30:27 -0400 Message-Id: <20210824173028.7528-4-alyssa.rosenzweig@collabora.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20210824173028.7528-1-alyssa.rosenzweig@collabora.com> References: <20210824173028.7528-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 Reviewed-by: Steven Price 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