Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp5236303ybl; Tue, 27 Aug 2019 01:18:06 -0700 (PDT) X-Google-Smtp-Source: APXvYqxU2EYMAD736Mn/VOQ/K3nPL94YMvehz2M8okFB/kzmi26Ha7cdTR3UQLHJWliR4U1gXY/+ X-Received: by 2002:a65:68cd:: with SMTP id k13mr20017612pgt.411.1566893886753; Tue, 27 Aug 2019 01:18:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1566893886; cv=none; d=google.com; s=arc-20160816; b=omaN6+iVokPSz9BDaSP5YS5vOIoLdJFgJVyW9MiL/+fSSO4ddLkDZTgN4e68ju5T+W WdbMlQkoyhN8F7ZJI90PQWLScxS9cqrfuiIeOrb/MgfLg0QsjS7h5+dGFJFcrfp/5lOn gJxsOAV6VD7Q8FyXhyEX5yhbuOwn3j9C3xDroJEPj6L2xHNyie4doD1d8rNbrvUwM7nz 0TW3W3pqaZLVEmSPjqyBXNFHr/sIz6XSuVdzOr+YT0HMhKqxpuS3y+k2UlicsW8E2M1o 71YgBvUzc34T3ihJAAW+pQikfXeEBVNl5lXU6l1QQ1xKpPQolcrEt7Noim/OJGua/7Fc D9pQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=+LzGvDVZBxOgRG/TA1wWwnkzTyU3VTANRxb4+weqt2o=; b=mEh0SQK8voDjEaoyeb2xiuZkmB14L919N0/8gNYu9Sc83XoghuMYS9sAgwSZYFyboA UUh9jfib8DMtlWE4WpREM5PrlLAfzo+xU0p7bj1472TD7SPamAWdxIMM77PBtqu8yXa3 Sp9mAjxs6gUnC+1H9FUVPb9ctDQR1zGki/qMl/5O/ZY4fZW/cLAyeSrqUMGlqGNtfMN2 vbu3TNtCZ5BGZQFZr9xbGkuXP4TLOTYRV9ypTpHyfSXUefZt102D1SDXiJxv9f/JSXCb jL7sTXiba82t94vix2q2EBa+1HLQFgKoS+xOODRQZvisVkUPswGoMpaRDqnNdAF2cazR 9iRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Vlazf1Bp; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id g1si11821134plt.296.2019.08.27.01.17.51; Tue, 27 Aug 2019 01:18: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=@kernel.org header.s=default header.b=Vlazf1Bp; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730329AbfH0IQQ (ORCPT + 99 others); Tue, 27 Aug 2019 04:16:16 -0400 Received: from mail.kernel.org ([198.145.29.99]:45874 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730002AbfH0HyQ (ORCPT ); Tue, 27 Aug 2019 03:54:16 -0400 Received: from localhost (83-86-89-107.cable.dynamic.v4.ziggo.nl [83.86.89.107]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 07E5F206BF; Tue, 27 Aug 2019 07:54:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1566892455; bh=GfJ9CA+FnmOmJgMvLBMy5H/eRhMID16zoKjq6w4U1+0=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Vlazf1BpXzqFhKrNNI0A15+ND7bqe1qiUMDfqH/mgL/olxFcgtb6Dia0S5JrEJFnM g3N3pLIuM0k++QpLpRfZ9XqKyl3aMWGSnTrnjRCUDXDD0wZIOYcJGL3iSX9kLD7ZQo wPLVKosFUuTm0eNoZOPm6IFMWeqt+VAQy8YdYjm4= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org, alastair@d-silva.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Michael Ellerman Subject: [PATCH 4.14 62/62] powerpc: Allow flush_(inval_)dcache_range to work across ranges >4GB Date: Tue, 27 Aug 2019 09:51:07 +0200 Message-Id: <20190827072704.089508645@linuxfoundation.org> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20190827072659.803647352@linuxfoundation.org> References: <20190827072659.803647352@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Alastair D'Silva The upstream commit: 22e9c88d486a ("powerpc/64: reuse PPC32 static inline flush_dcache_range()") has a similar effect, but since it is a rewrite of the assembler to C, is too invasive for stable. This patch is a minimal fix to address the issue in assembler. This patch applies cleanly to v5.2, v4.19 & v4.14. When calling flush_(inval_)dcache_range with a size >4GB, we were masking off the upper 32 bits, so we would incorrectly flush a range smaller than intended. This patch replaces the 32 bit shifts with 64 bit ones, so that the full size is accounted for. Signed-off-by: Alastair D'Silva Acked-by: Michael Ellerman Signed-off-by: Greg Kroah-Hartman --- arch/powerpc/kernel/misc_64.S | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) --- a/arch/powerpc/kernel/misc_64.S +++ b/arch/powerpc/kernel/misc_64.S @@ -134,7 +134,7 @@ _GLOBAL_TOC(flush_dcache_range) subf r8,r6,r4 /* compute length */ add r8,r8,r5 /* ensure we get enough */ lwz r9,DCACHEL1LOGBLOCKSIZE(r10) /* Get log-2 of dcache block size */ - srw. r8,r8,r9 /* compute line count */ + srd. r8,r8,r9 /* compute line count */ beqlr /* nothing to do? */ mtctr r8 0: dcbst 0,r6 @@ -190,7 +190,7 @@ _GLOBAL(flush_inval_dcache_range) subf r8,r6,r4 /* compute length */ add r8,r8,r5 /* ensure we get enough */ lwz r9,DCACHEL1LOGBLOCKSIZE(r10)/* Get log-2 of dcache block size */ - srw. r8,r8,r9 /* compute line count */ + srd. r8,r8,r9 /* compute line count */ beqlr /* nothing to do? */ sync isync