Received: by 10.192.165.156 with SMTP id m28csp1123314imm; Wed, 11 Apr 2018 12:53:30 -0700 (PDT) X-Google-Smtp-Source: AIpwx492QGqKHrW9T2xakT3LMYrFb/bdyg1NiZ6UqhBDAvDg8cTo6BKYy8hjp+w7RhgvexWZNA5S X-Received: by 10.98.65.220 with SMTP id g89mr5095493pfd.97.1523476410133; Wed, 11 Apr 2018 12:53:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1523476410; cv=none; d=google.com; s=arc-20160816; b=Sb3F9ywXtGFMktEi8+N7CMBWkw/PwCHxBhGE57MahpOq80TqIumew1n8S3pRfnV2Yk 5B/fksVvLAxuTPMSsxL6b19gStvO9W8f9N8uej85DujMednqt0FX56zjsYSIogOAHs6o f/tHj1BY6bxrI3ZrLrB1adQnZd4bMzLU6iiB0N0mNXp4eR27MrkiNo/YvnIYVNBO9QSU ONzbbiGe1bdJrlQ/vp/J8NxUDOZ/ENxIyG64kSQiXW0iRM+H2QWz1sNI6W61TFeXgAxn m50kSzd8PNs70cgbQul+rHEuHtyDDPA34aOtA9s4CROYRUeyQ5vJEqMgH+aCOnKdY88e hsGg== 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=2mpKMYs9xawPqW8v7hJ/bee01n9tYRTtqpzQG+lwPuc=; b=DMSjcDTj3PudTQ5q1bGi96t6LaiLRM8Lpqny1wVcATX5L2TpPfCIL8DK5I5unVuBor w7Evo8i6HcL+zTH3qRhyPbsuYNuSAnsO3Gp7spTtecRlZ0ResoFT9atU/76xk5g2hAZs M3+/WKoaDcdXHoe/cDFijrwcIyMX9x2Gy1UmtLcNnU5utynzGjLTuoZ/hAtMOQF0jwKg mnj3RdzTSIyKbqQUkUriz6pH+BWs81aWS0pTQ+wpZOnWx/RWvNbde5Oqfz6biBg7laQD FQpUVAyYHkXSOiO5rGKnuR5JYpM4izY9NCOg26IhJT2btg3Kk3MTfq+RrEQxTtRO+r4L zObA== 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 p61-v6si1696798plb.633.2018.04.11.12.52.53; Wed, 11 Apr 2018 12:53:30 -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 S934110AbeDKS7c (ORCPT + 99 others); Wed, 11 Apr 2018 14:59:32 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:37426 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932894AbeDKS7a (ORCPT ); Wed, 11 Apr 2018 14:59:30 -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 68DA4C3C; Wed, 11 Apr 2018 18:59:29 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Ivan Mikhaylov , Michael Ellerman , Sasha Levin Subject: [PATCH 4.9 153/310] powerpc/[booke|4xx]: Dont clobber TCR[WP] when setting TCR[DIE] Date: Wed, 11 Apr 2018 20:34:52 +0200 Message-Id: <20180411183629.008582849@linuxfoundation.org> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20180411183622.305902791@linuxfoundation.org> References: <20180411183622.305902791@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.9-stable review patch. If anyone has any objections, please let me know. ------------------ From: Ivan Mikhaylov [ Upstream commit 6e2f03e292ef46eed2b31b0a344a91d514f9cd81 ] Prevent a kernel panic caused by unintentionally clearing TCR watchdog bits. At this point in the kernel boot, the watchdog may have already been enabled by u-boot. The original code's attempt to write to the TCR register results in an inadvertent clearing of the watchdog configuration bits, causing the 476 to reset. Signed-off-by: Ivan Mikhaylov Signed-off-by: Michael Ellerman Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- arch/powerpc/kernel/time.c | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) --- a/arch/powerpc/kernel/time.c +++ b/arch/powerpc/kernel/time.c @@ -719,12 +719,20 @@ static int __init get_freq(char *name, i static void start_cpu_decrementer(void) { #if defined(CONFIG_BOOKE) || defined(CONFIG_40x) + unsigned int tcr; + /* Clear any pending timer interrupts */ mtspr(SPRN_TSR, TSR_ENW | TSR_WIS | TSR_DIS | TSR_FIS); - /* Enable decrementer interrupt */ - mtspr(SPRN_TCR, TCR_DIE); -#endif /* defined(CONFIG_BOOKE) || defined(CONFIG_40x) */ + tcr = mfspr(SPRN_TCR); + /* + * The watchdog may have already been enabled by u-boot. So leave + * TRC[WP] (Watchdog Period) alone. + */ + tcr &= TCR_WP_MASK; /* Clear all bits except for TCR[WP] */ + tcr |= TCR_DIE; /* Enable decrementer */ + mtspr(SPRN_TCR, tcr); +#endif } void __init generic_calibrate_decr(void)