Received: by 10.192.165.148 with SMTP id m20csp243438imm; Tue, 24 Apr 2018 21:36:06 -0700 (PDT) X-Google-Smtp-Source: AIpwx480lAhuSbt6RJhGgLuR0hTMvCrumVjb5TCoTUtFd5U5s8cmcKzPQkTwXHxBWU+5bsJEHBUm X-Received: by 2002:a17:902:6bc3:: with SMTP id m3-v6mr27064500plt.363.1524630966552; Tue, 24 Apr 2018 21:36:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1524630966; cv=none; d=google.com; s=arc-20160816; b=BsfmNuQ/au/gx/s7l1U2whDFXgmaaBUWLBj9bXeFXtS3ZBEM6kPp9uYwpASQ4x/KJ/ goNzJzpy43WC7WGLAOX9zF3EEwGzMZxXWOWnAMh098akjjtLTfUaMcQLbM1Vq8P63Tzl ZMHG6HIksAL61d1o+ZqqnJDMD7O37W7Eps93iggAZ9SgmILvQVr6HMYtFKHJH0RoRudh MEOcRZYxwpn0EmOSdKtk6wKYThSoeiAESL/qMkSYgasn9TLihEvEGa2ZU9a/Ism7bS/0 wVXilCWzZ79Q5+8G/sJikZKU/uAmUuehGf29z8Ve8Qi/ws6b+aLBxskCFMN74XKF6aac mFfQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature:arc-authentication-results; bh=pVsBQgLDyqGapT6wIBX1todsgEHjoU0oyFsIPN0Uao8=; b=CSlF2S6NGD1Blsfg/+y4fuShPAqZQlReJAdNH+ac1lSwxpV6Gn9wl4cWDNzX40zsAp QazgfKuZ7TZjnr+qrMVFozCqqeGCTyulgLQXXtVRdj3scrUSyOih+uVx5p6LJnvzJxFg 4rZhuF8X5NyM8e9A4Iv6UZtVMnTF/VdB0knsZeWoeQx7j4LUGO8nRuBLyLszKIZMisxG LSns5o4zmMimFvNx0RpMKM2+afjwF30xK9AHMG7d201fJmxrD5SyUGW2vbuB0Pd57Dqf E2ZiGCySShgzoPgI5CV3nfYhCrhyM3sce7Cvjom2JQKiqURkcpgR27F64WImDUWtf41u bqSQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=a2uDFgzG; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q1-v6si15375426plb.549.2018.04.24.21.35.52; Tue, 24 Apr 2018 21:36:06 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=a2uDFgzG; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751244AbeDYEek (ORCPT + 99 others); Wed, 25 Apr 2018 00:34:40 -0400 Received: from mail-pg0-f67.google.com ([74.125.83.67]:36029 "EHLO mail-pg0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750945AbeDYEef (ORCPT ); Wed, 25 Apr 2018 00:34:35 -0400 Received: by mail-pg0-f67.google.com with SMTP id i6so12434544pgv.3 for ; Tue, 24 Apr 2018 21:34:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=pVsBQgLDyqGapT6wIBX1todsgEHjoU0oyFsIPN0Uao8=; b=a2uDFgzGXWbOCkuqtBM7xlOxZ5POMBZdfIWKJOgrTjkV6gcMC/uWZKwJOfhkCSJBRD RTbzBO/t5QClOzuA4LNDXZf+N2+szHCoNX+lrAYEj4TMVtGjJprHNZfB4gUrNXNuhSjN 3Anys3DHSnheNpz9slR+CNTJYznsVwgR69+OI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=pVsBQgLDyqGapT6wIBX1todsgEHjoU0oyFsIPN0Uao8=; b=tbiNoiC057mrYomtaLvV6L8Brj9Aq2JmexdEp/xcwlILQi7cB2wlNJ+StuNjZuyyjb ufua40GJEmp9tqbdnddjFB52DLqzaFopyIv7++3DnMUSXsrUs5+qCi+YTI9PnrqEGqKP kP8pjFSonH/QCAWGRnmf87C0UK2yFwBSRqR3kJlRi8DAnlvFDz6fgZnJycE5IC4sjqXm 0/JtQiJF/4VPt16va+5iaFQvaeqEvDmBRGD7FE0+xQD8AfAKUAWe4Cj8npS8iTyAlKQ0 B0O7nON7QjmeGia3Bu3gFv0k6tzzJ8tccCCdLtOyau9+Yd0zU2wUZtSi29BgQPcUllXl ei4w== X-Gm-Message-State: ALQs6tDtiL0pSO1B2Om/IGindUORenEJqGd60m/JP57ppsGxcdEph2k9 Imokq6cwWWsdy2AzK13yukq8QA== X-Received: by 2002:a17:902:14cb:: with SMTP id y11-v6mr27646280plg.23.1524630874558; Tue, 24 Apr 2018 21:34:34 -0700 (PDT) Received: from tuxbook-pro (104-188-17-28.lightspeed.sndgca.sbcglobal.net. [104.188.17.28]) by smtp.gmail.com with ESMTPSA id e87sm27805841pfl.65.2018.04.24.21.34.33 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Tue, 24 Apr 2018 21:34:33 -0700 (PDT) Date: Tue, 24 Apr 2018 21:35:43 -0700 From: Bjorn Andersson To: Alex Elder Cc: andy.gross@linaro.org, clew@codeaurora.org, aneela@codeaurora.org, david.brown@linaro.org, linux-arm-msm@vger.kernel.org, linux-soc@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/6] soc: qcom: smem: fix first cache entry calculation Message-ID: <20180425043543.GE2052@tuxbook-pro> References: <20180410222542.29474-1-elder@linaro.org> <20180410222542.29474-2-elder@linaro.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20180410222542.29474-2-elder@linaro.org> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue 10 Apr 15:25 PDT 2018, Alex Elder wrote: > Cached items are found at the high end of an smem partition. A > cached item's shared memory precedes the private entry structure > that describes it. > > The address of the structure describing the first cached item should > be returned by phdr_to_first_cached_entry(). However the function > calculates the start address using the wrong structure size. > > Fix this by computing the first item's entry structure address by > subtracting the size of a private entry structure rather than a > partition header structure. > > Signed-off-by: Alex Elder Sorry, I didn't spot these on the mailing list. Reviewed-by: Bjorn Andersson Regards, Bjorn > --- > drivers/soc/qcom/smem.c | 3 ++- > 1 file changed, 2 insertions(+), 1 deletion(-) > > diff --git a/drivers/soc/qcom/smem.c b/drivers/soc/qcom/smem.c > index 0b94d62fad2b..7f38c5e11440 100644 > --- a/drivers/soc/qcom/smem.c > +++ b/drivers/soc/qcom/smem.c > @@ -292,8 +292,9 @@ static void *phdr_to_first_cached_entry(struct smem_partition_header *phdr, > size_t cacheline) > { > void *p = phdr; > + struct smem_private_entry *e; > > - return p + le32_to_cpu(phdr->size) - ALIGN(sizeof(*phdr), cacheline); > + return p + le32_to_cpu(phdr->size) - ALIGN(sizeof(*e), cacheline); > } > > static void *phdr_to_last_cached_entry(struct smem_partition_header *phdr) > -- > 2.14.1 >