Received: by 2002:a05:6a10:1d13:0:0:0:0 with SMTP id pp19csp454982pxb; Wed, 25 Aug 2021 07:10:55 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwhe5nApI4cFEHT26d5SylOLJU/m0ffB8r3kzCUr8HXtiUAib1W/3W7Fme/tF18Kv9mL9g8 X-Received: by 2002:a17:907:3f91:: with SMTP id hr17mr13470028ejc.496.1629900655146; Wed, 25 Aug 2021 07:10:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629900655; cv=none; d=google.com; s=arc-20160816; b=M8f66j6MKf96mcgYbU46iDYwhYszhFgW6i5Mq0qdNvWuXzkRuORbHa4q8YnStKihfa 3iOWhrYtmSR/OKp2y8KLGGWlMGBmfIdMGZFyAalZbTcrAOV0o59iB7N/46q+GvHM8KYd RD//4fKrVzFJGuWJW3+cwCD5oJKvXubxlojIKG74Gc+NZP/qCHVITMgIPoETAMLuz9qo ChJ2UybjAlN2IwnUSFAt1K6pEhXhaDEN7HHcLBDSYiwyROo9p02MXPMrSBLXJcAE6ptw nfEshbwUJ1bbbml3IugLs0urBmDKVw0nVFva0IwX7jK4TV9xS2lNMFO6PotuOCSi7bv1 7j2g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date; bh=rB+IrNAYznurZbmehqgnUTETmtzqq3m4tckM9ZI0E3s=; b=m6JAO0mS/GBmeMxbGaorMKZDNELPXjCG6fKDbG0X38z2/5HIVMGjG96WxSfIWhK4RX pVyhr/whavZwbHB1HVy9q+Xz3zNiWFuFoKkRhUO3gRjF1lOnf5dnvFX/4NUM665b4xBF c8EcXOe3xZ6DKfoA3VBzidf6yXBbAdvvxqKPY2rB/5zzQbyJgIH1SV/HQ2nzoW38F6YE wpmWYHBl5pUq0fnw1+DYCcJMJDz5y8rULiP24nPhT0Y9ARgUIVQOnCmM3+QV2Gkjdyvw kChWi+zYpE7rcWuPT1n9Je7hqz6NJXyUqq3odUv+/U6SqCbtXqRWH7m1pe0Qsn7hIBZj 6eeg== 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 du3si12495218ejc.378.2021.08.25.07.10.31; Wed, 25 Aug 2021 07:10:55 -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 S240742AbhHYOIq (ORCPT + 99 others); Wed, 25 Aug 2021 10:08:46 -0400 Received: from bhuna.collabora.co.uk ([46.235.227.227]:51072 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229760AbhHYOIq (ORCPT ); Wed, 25 Aug 2021 10:08:46 -0400 Received: from maud (unknown [IPv6:2600:8800:8c06:1000::c8f3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: alyssa) by bhuna.collabora.co.uk (Postfix) with ESMTPSA id 1C7811F4169F; Wed, 25 Aug 2021 15:07:35 +0100 (BST) Date: Wed, 25 Aug 2021 10:07:21 -0400 From: Alyssa Rosenzweig To: Steven Price Cc: Alyssa Rosenzweig , dri-devel@lists.freedesktop.org, Rob Herring , Tomeu Vizoso , David Airlie , Daniel Vetter , linux-kernel@vger.kernel.org Subject: Re: [PATCH v2 4/4] drm/panfrost: Handle non-aligned lock addresses Message-ID: References: <20210824173028.7528-1-alyssa.rosenzweig@collabora.com> <20210824173028.7528-5-alyssa.rosenzweig@collabora.com> <6fe675c4-d22b-22da-ba3c-f6d33419b9ed@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6fe675c4-d22b-22da-ba3c-f6d33419b9ed@arm.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org > > In practice, the current callers pass PAGE_SIZE aligned inputs, avoiding > > the bug. Therefore this doesn't need to be backported. Still, that's a > > happy accident and not a precondition of lock_region, so we let's do the > > right thing to future proof. > > Actually it's worse than that due to the hardware behaviour, the spec > states (for LOCKADDR_BASE): > > > Only the upper bits of the address are used. The address is aligned to a > > multiple of the region size, so a variable number of low-order bits are > > ignored, depending on the selected region size. It is recommended that software > > ensures that these low bits in the address are cleared, to avoid confusion. > > It appears that indeed this has caused confusion ;) > > So for a simple request like locking from 0xCAFE0000 - 0xCB010000 (size > = 0x30000) the region width gets rounded up (to 0x40000) which causes > the start address to be effectively rounded down (by the hardware) to > 0xCAFC0000 and we fail to lock 0xCB000000-0xCB010000. > > Interestingly (unless my reading of this is wrong) that means to lock > 0xFFFF0000-0x100010000 (i.e. crossing the 4GB boundary) requires locking > *at least* 0x00000000-0x200000000 (i.e. locking the first 8GB). > > This appears to be broken in kbase (which actually does zero out the low > bits of the address) - I've raised a bug internally so hopefully someone > will tell me if I've read the spec completely wrong here. Horrifying, and not what I wanted to read my last day before 2 weeks of leave. Let's drop this patch, hopefully by the time I'm back, your friends in GPU can confirm that's a spec bug and not an actual hardware/driver one... Can you apply the other 3 patches in the mean time? Thanks :-)