Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp1709193pxb; Mon, 23 Aug 2021 02:42:51 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx7YD8KYc9gCSQa2lyo3oybkw9DgElGbP6Mx1Dxqejl4rAMPlVknCVM/7biMC9U2sAdc571 X-Received: by 2002:a05:6602:2219:: with SMTP id n25mr25108538ion.185.1629711771253; Mon, 23 Aug 2021 02:42:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629711771; cv=none; d=google.com; s=arc-20160816; b=dfvPnYK617QfB30mh4STYTx97jPJ4r9J0W5VMaVqGeH79h9f6pqatF0fUAe2pX2/2z 2dtcwIXfrbK+x/Gt0oPzs3jZW+scz3K6bQNH3fjXmq7RtITVQluI8ZbWkXJIyjN6OqNL jvgBMhtREO85yPXj1AbH80fRRB3m7x+aUX9UtV2fenz9nlJ23W6zL4c17NRN5ko1cyDv ENs0D7xiwPm0BCBL2JUVncTCC1sEFVaGQLjQbvXPacUz6ArV47aObYkwgNkU6UGPg8rF j8HgbBABgGmKTazLakWiGrkdftpDybRgiua8NL9u5hQyRxeQjjmtBO3XYt2/DBVbs/MS wZQw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=mdoyfw1TAk2M7w4m5kPB8zh1Nbl0c+YHgPymuBSAJvk=; b=TVb/aNr1wv7N8I0cUplLxwIkSd3qjLhEdGajAa2QLlJKiYLpFcKXMbzmkMIo6Hj+Al 0a96d63U2IhaxgNu1ypBQ4cMg1L4r2jQ/nTqZ6/EAbrs5larYIEVbG+YDd5erB5zAmmN pkzygzwv1M9ibRehV6RODcrAzEq/E6/SJ81whaHDmrgGWcLWLlJ6hCfpa0mIePBU/EdH Gf1GCJ5BPmhP1wVMbIuEaxTBrCuLIu9jXCC0+JBJmIoMO7Sat74UGHjGdV0HE2TUSkAq +xwSKON24UOCml0iTW9gUjx+B6NOp5CHOXnfOaJ6Yd0omO6lSW17HDsxXgggcxL/IRMj HfTA== 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=arm.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z4si12675685ilh.138.2021.08.23.02.42.39; Mon, 23 Aug 2021 02:42:51 -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=arm.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235841AbhHWJlk (ORCPT + 99 others); Mon, 23 Aug 2021 05:41:40 -0400 Received: from foss.arm.com ([217.140.110.172]:50554 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230428AbhHWJli (ORCPT ); Mon, 23 Aug 2021 05:41:38 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 1F2B76D; Mon, 23 Aug 2021 02:40:56 -0700 (PDT) Received: from [192.168.1.179] (unknown [172.31.20.19]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id E8D303F66F; Mon, 23 Aug 2021 02:40:54 -0700 (PDT) Subject: Re: [PATCH 2/3] drm/panfrost: Use u64 for size in lock_region To: Alyssa Rosenzweig , dri-devel@lists.freedesktop.org Cc: Rob Herring , Tomeu Vizoso , David Airlie , Daniel Vetter , linux-kernel@vger.kernel.org, Chris Morgan References: <20210820213117.13050-1-alyssa.rosenzweig@collabora.com> <20210820213117.13050-3-alyssa.rosenzweig@collabora.com> From: Steven Price Message-ID: <71392001-a5a9-fee2-79a5-91df55ba3081@arm.com> Date: Mon, 23 Aug 2021 10:40:53 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.11.0 MIME-Version: 1.0 In-Reply-To: <20210820213117.13050-3-alyssa.rosenzweig@collabora.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 20/08/2021 22:31, Alyssa Rosenzweig wrote: > Mali virtual addresses are 48-bit. Use a u64 instead of size_t to ensure > we can express the "lock everything" condition as ~0ULL without relying > on platform-specific behaviour. 'platform-specific behaviour' makes it sound like this is something to do with a particular board. This is 32bit/64bit - it's going to be broken on 32bit: large lock regions are not going to work. > Signed-off-by: Alyssa Rosenzweig > Suggested-by: Rob Herring > Tested-by: Chris Morgan Fixes: f3ba91228e8e ("drm/panfrost: Add initial panfrost driver") Reviewed-by: Steven Price Steve > --- > drivers/gpu/drm/panfrost/panfrost_mmu.c | 12 ++++++------ > 1 file changed, 6 insertions(+), 6 deletions(-) > > diff --git a/drivers/gpu/drm/panfrost/panfrost_mmu.c b/drivers/gpu/drm/panfrost/panfrost_mmu.c > index f6e02d0392f4..3a795273e505 100644 > --- a/drivers/gpu/drm/panfrost/panfrost_mmu.c > +++ b/drivers/gpu/drm/panfrost/panfrost_mmu.c > @@ -58,7 +58,7 @@ static int write_cmd(struct panfrost_device *pfdev, u32 as_nr, u32 cmd) > } > > static void lock_region(struct panfrost_device *pfdev, u32 as_nr, > - u64 iova, size_t size) > + u64 iova, u64 size) > { > u8 region_width; > u64 region = iova & PAGE_MASK; > @@ -78,7 +78,7 @@ static void lock_region(struct panfrost_device *pfdev, u32 as_nr, > > > static int mmu_hw_do_operation_locked(struct panfrost_device *pfdev, int as_nr, > - u64 iova, size_t size, u32 op) > + u64 iova, u64 size, u32 op) > { > if (as_nr < 0) > return 0; > @@ -95,7 +95,7 @@ static int mmu_hw_do_operation_locked(struct panfrost_device *pfdev, int as_nr, > > static int mmu_hw_do_operation(struct panfrost_device *pfdev, > struct panfrost_mmu *mmu, > - u64 iova, size_t size, u32 op) > + u64 iova, u64 size, u32 op) > { > int ret; > > @@ -112,7 +112,7 @@ static void panfrost_mmu_enable(struct panfrost_device *pfdev, struct panfrost_m > u64 transtab = cfg->arm_mali_lpae_cfg.transtab; > u64 memattr = cfg->arm_mali_lpae_cfg.memattr; > > - mmu_hw_do_operation_locked(pfdev, as_nr, 0, ~0UL, AS_COMMAND_FLUSH_MEM); > + mmu_hw_do_operation_locked(pfdev, as_nr, 0, ~0ULL, AS_COMMAND_FLUSH_MEM); > > mmu_write(pfdev, AS_TRANSTAB_LO(as_nr), transtab & 0xffffffffUL); > mmu_write(pfdev, AS_TRANSTAB_HI(as_nr), transtab >> 32); > @@ -128,7 +128,7 @@ static void panfrost_mmu_enable(struct panfrost_device *pfdev, struct panfrost_m > > static void panfrost_mmu_disable(struct panfrost_device *pfdev, u32 as_nr) > { > - mmu_hw_do_operation_locked(pfdev, as_nr, 0, ~0UL, AS_COMMAND_FLUSH_MEM); > + mmu_hw_do_operation_locked(pfdev, as_nr, 0, ~0ULL, AS_COMMAND_FLUSH_MEM); > > mmu_write(pfdev, AS_TRANSTAB_LO(as_nr), 0); > mmu_write(pfdev, AS_TRANSTAB_HI(as_nr), 0); > @@ -242,7 +242,7 @@ static size_t get_pgsize(u64 addr, size_t size) > > static void panfrost_mmu_flush_range(struct panfrost_device *pfdev, > struct panfrost_mmu *mmu, > - u64 iova, size_t size) > + u64 iova, u64 size) > { > if (mmu->as < 0) > return; >