Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751521AbdITQhU (ORCPT ); Wed, 20 Sep 2017 12:37:20 -0400 Received: from metis.ext.4.pengutronix.de ([92.198.50.35]:42541 "EHLO metis.ext.4.pengutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751024AbdITQhT (ORCPT ); Wed, 20 Sep 2017 12:37:19 -0400 Date: Wed, 20 Sep 2017 18:37:16 +0200 From: Uwe =?iso-8859-1?Q?Kleine-K=F6nig?= To: Gregory CLEMENT Cc: Jan Luebbe , Thomas Petazzoni , Andrew Lunn , Jason Cooper , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, kernel@pengutronix.de, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH 1/2] bus: mbus: fix window size calculation for 4GB windows Message-ID: <20170920163716.l6kpf56ig5gfqzbi@pengutronix.de> References: <20170828152517.24506-1-jlu@pengutronix.de> <20170828152517.24506-2-jlu@pengutronix.de> <87wp4urbp5.fsf@free-electrons.com> MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <87wp4urbp5.fsf@free-electrons.com> User-Agent: NeoMutt/20170113 (1.7.2) X-SA-Exim-Connect-IP: 2001:67c:670:100:5054:ff:fe2a:3aa X-SA-Exim-Mail-From: ukl@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-kernel@vger.kernel.org Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1424 Lines: 33 On Tue, Sep 19, 2017 at 04:43:18PM +0200, Gregory CLEMENT wrote: > Hi Jan, > > On lun., ao?t 28 2017, Jan Luebbe wrote: > > > At least the Armada XP SoC supports 4GB on a single DRAM window. Because > > the size register values contain the actual size - 1, the MSB is set in > > that case. For example, the SDRAM window's control register's value is > > 0xffffffe1 for 4GB (bits 31 to 24 contain the size). > > > > The MBUS driver reads back each window's size from registers and > > calculates the actual size as (control_reg | ~DDR_SIZE_MASK) + 1, which > > overflows for 32 bit values, resulting in other miscalculations further > > on (a bad RAM window for the CESA crypto engine calculated by > > mvebu_mbus_setup_cpu_target_nooverlap() in my case). > > > > This patch changes the type in 'struct mbus_dram_window' from u32 to > > u64, which allows us to keep using the same register calculation code in > > most MBUS-using drivers (which calculate ->size - 1 again). > > > > Your patch looks good, but as it is a fix we should also apply it on > stable, could you provide the commit to fix? It was there just from the start: the .c file was introduced in v3.10-rc1~64^2~1^2~8^2~2 and already did that 32 bit calculus. Best regards Uwe -- Pengutronix e.K. | Uwe Kleine-K?nig | Industrial Linux Solutions | http://www.pengutronix.de/ |