Received: by 2002:ac0:a5b6:0:0:0:0:0 with SMTP id m51-v6csp3757691imm; Mon, 18 Jun 2018 03:38:16 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIMh1C1Q+3oAS6SXuQ0si4cZWJsNBTC09o0xcswwcX4QrRXMJLdZY3AplfzQurFfqG0t6RH X-Received: by 2002:a62:e005:: with SMTP id f5-v6mr13002303pfh.88.1529318296844; Mon, 18 Jun 2018 03:38:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529318296; cv=none; d=google.com; s=arc-20160816; b=nWpmKdXl01OyNWk9nv2e3WwYqv3vS5jRNxzROwQwhl1ty9ACnj+vYChfcHD3jr0NWc 96XHVSLS8xESr8wWQhGzYM06bEQ4gaoneqhKEiHz7ka7pH+VzrApIqvodqwEo8fJZAEU niUaug4jTu/tozv4UQ46okwnASFgmKDPia8s0vXDGib/p+5557zDa2Ds5qbk0uijxr33 xitufUxF0vS73N7QyAMxfmKSFG5teY9CjpWD1u/7dlOf2YmtsT6k26A3I0v+aB9h3LvU yneb3o6PAmLJTAC6JOhJ4hHEkv5NivTnFTput3hdHTjgFxKZ1QQAjynRbCIxdxCFaHDE TTIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=ka9EThYpYwIjgT/vp5s9dEYSaQKXoVvU6zwB+Rve1ZQ=; b=tKY9L6GesgjziY6Zwrr6BgUpITycLhgVQw4zzOsaaT1AbpZ5w4nZth4DY5inp5zrNM gywOd23+P2g7nBhfBxP+p4kQ86VtsgaSQ1/lPWHqr6iK0D1RFFlZufwYDmTl9UdYSVEd PSXs9pbm5KxILkmcJB2yidqbwmcRjK5O5K5U2VK8EFDNNSlS+hJSIjxvYOIMNyn531tR L5+iXrPsHlSi4Kpz26bTolwiumzLKp/Dfj8I3544sscDTUqnyV7Llf5skqHJzioK3rNA 8xoRzO6+YRf6OahfHQlb1KgDidcS6NJgkiYGg4l3CIK5eJeoKs5iB576y8mKgLCBywnQ 4g5A== ARC-Authentication-Results: i=1; mx.google.com; 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 f7-v6si15137375plb.253.2018.06.18.03.38.03; Mon, 18 Jun 2018 03:38:16 -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; 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 S934271AbeFRIQJ (ORCPT + 99 others); Mon, 18 Jun 2018 04:16:09 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:52964 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934242AbeFRIQI (ORCPT ); Mon, 18 Jun 2018 04:16:08 -0400 Received: from localhost (LFbn-1-12247-202.w90-92.abo.wanadoo.fr [90.92.61.202]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 63C80C75; Mon, 18 Jun 2018 08:16:07 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Madhavan Srinivasan , Michael Ellerman , Sasha Levin Subject: [PATCH 4.16 031/279] powerpc/64s: Default l1d_size to 64K in RFI fallback flush Date: Mon, 18 Jun 2018 10:10:16 +0200 Message-Id: <20180618080610.113679785@linuxfoundation.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180618080608.851973560@linuxfoundation.org> References: <20180618080608.851973560@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 4.16-stable review patch. If anyone has any objections, please let me know. ------------------ From: Madhavan Srinivasan [ Upstream commit 9dfbf78e4114fcaf4ef61c49885c3ab5bad40d0b ] If there is no d-cache-size property in the device tree, l1d_size could be zero. We don't actually expect that to happen, it's only been seen on mambo (simulator) in some configurations. A zero-size l1d_size leads to the loop in the asm wrapping around to 2^64-1, and then walking off the end of the fallback area and eventually causing a page fault which is fatal. Just default to 64K which is correct on some CPUs, and sane enough to not cause a crash on others. Fixes: aa8a5e0062ac9 ('powerpc/64s: Add support for RFI flush of L1-D cache') Signed-off-by: Madhavan Srinivasan [mpe: Rewrite comment and change log] Signed-off-by: Michael Ellerman Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- arch/powerpc/kernel/setup_64.c | 11 +++++++++++ 1 file changed, 11 insertions(+) --- a/arch/powerpc/kernel/setup_64.c +++ b/arch/powerpc/kernel/setup_64.c @@ -864,6 +864,17 @@ static void init_fallback_flush(void) int cpu; l1d_size = ppc64_caches.l1d.size; + + /* + * If there is no d-cache-size property in the device tree, l1d_size + * could be zero. That leads to the loop in the asm wrapping around to + * 2^64-1, and then walking off the end of the fallback area and + * eventually causing a page fault which is fatal. Just default to + * something vaguely sane. + */ + if (!l1d_size) + l1d_size = (64 * 1024); + limit = min(ppc64_bolted_size(), ppc64_rma_size); /*