Received: by 2002:ac0:8c8e:0:0:0:0:0 with SMTP id r14csp276846ima; Tue, 5 Feb 2019 23:09:20 -0800 (PST) X-Google-Smtp-Source: AHgI3IYi4Bk9+6u1HL4xtOJK1CelAVEZ2Cil+bKN3V3BndJH0AWF4Z5PMevdYtyOvSyUbXlsbfMU X-Received: by 2002:a62:56c7:: with SMTP id h68mr9462512pfj.134.1549436960902; Tue, 05 Feb 2019 23:09:20 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549436960; cv=none; d=google.com; s=arc-20160816; b=zsCoot4rsviAaTubMNkG6o5kQahmQ79QsjDo6WGtYUlmDVbFuZZy4nsJX+9oHGd5Ef vU8hBK/P6cGTo5j0Ck7mdzECJTo9D+1AZ5JNuRygu8prfBv09JB8vYYOlDwlDHZi2wAK exAfKxBLJWdmXByh+zGggAuD0ENcjgPbJ5txD6+vWhhp6c+u0Q2VzOi5UYnwGiK3t6gw Fdmr1ewPwKfmjNRnyrF9cDWbhDXkJEf+QX7GEtRcC9Onmdtil8ze27Nr0c8/lA5nDs98 rrsgSENnHwy4Xne4kJgirWMeqmcRJw5GI2Uy91Q1SR1Ko9/AD/mSOycpDv5W8vFsDuOa gGUg== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=y90loJs9gSDmcixygIFPtRrKQ+X+Q8y4o3KXgM54Vyg=; b=ol/IL8mgXJqztBFBFU3CwG3LVQi8VnfknrItGvakoysWEEXs5lgvNPncnpVoAn3QAx J5V9EG1iNS/4Ath/g13k8yCpz9t5WWY9AGwXYvl4LoAcbP8KiZJmJjSC1hAr4yMmVQaT Hyf1FIwilx717Pox9IPZ5CqcuQAr8ttjEF1HjsifiDDVGkUUpY5xQOvqPrWbuVerTCii AQv6cjaF9wNWcU+szbhtBlmftnIVOomUYoa6fOnvOqGF4JEu8s0Aq/KGShokxR2bsf57 /C8ynFdDtaEEy73EFPnXV9EvBTQtQrPi0v6ZEbzm6RPiKpflTRi7krkSqdWNYnaVOt6R GJog== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@tomli.me header.s=1490979754 header.b=FcceSwUb; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=tomli.me Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id b63si5420256pfa.250.2019.02.05.23.09.05; Tue, 05 Feb 2019 23:09:20 -0800 (PST) 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=@tomli.me header.s=1490979754 header.b=FcceSwUb; 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=QUARANTINE sp=QUARANTINE dis=NONE) header.from=tomli.me Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728018AbfBFHHu (ORCPT + 99 others); Wed, 6 Feb 2019 02:07:50 -0500 Received: from tomli.me ([153.92.126.73]:49936 "EHLO tomli.me" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726194AbfBFHHu (ORCPT ); Wed, 6 Feb 2019 02:07:50 -0500 Received: from tomli.me (localhost [127.0.0.1]) by tomli.me (OpenSMTPD) with ESMTP id 3060678a; Wed, 6 Feb 2019 07:07:47 +0000 (UTC) X-HELO: localhost.lan Authentication-Results: tomli.me; auth=pass (login) smtp.auth=tomli Received: from Unknown (HELO localhost.lan) (2402:f000:1:1501:200:5efe:7b75:4650) by tomli.me (qpsmtpd/0.95) with ESMTPSA (DHE-RSA-CHACHA20-POLY1305 encrypted); Wed, 06 Feb 2019 07:07:46 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed; d=tomli.me; h=from:to:cc:subject:date:message-id:mime-version:content-transfer-encoding; s=1490979754; bh=TXmS04p0/Vjvf2HiVvC4vH1nuwaTteSpJPhSTTK+8OY=; b=FcceSwUbGiM6vg+yxFZkVBAKHRbf3y8nPiXFmt8mLOoBTAatoC3ihfaHsShhzkSv/NwFAAoX0jLLcZdQHd+w8jcNAMh5uy2BB37b7KvqL5lqT2VaWE0+1YhjPQkaojf/eodtergLFWlEOAd+LWmjRaX0W2mxSfP2NN1DHm21mP3zmf59RAlUFV3iCkOBMeLcg9fxIJh1NxPptfqwQ15jNj4neCBNtwc3WQnXIpaJfdEn2DDjdSP/EdUBacekCpYCuajjAi97T7qi7s6d3ujD8fK0xKDdh+erOSDqnx0RMeYY4icl9ySRAFmZUKjDF5nWRLR4ksPD2L+MgqXeQihb1Q== From: Yifeng Li To: linux-mips@vger.kernel.org Cc: Huacai Chen , Ralf Baechle , Paul Burton , James Hogan , Yifeng Li , linux-kernel@vger.kernel.org, Aaro Koskinen Subject: [PATCH] mips: loongson64: remove unreachable(), fix loongson_poweroff(). Date: Wed, 6 Feb 2019 15:07:21 +0800 Message-Id: <20190206070721.19185-1-tomli@tomli.me> X-Mailer: git-send-email 2.20.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On my Yeeloong 8089, I noticed the machine fails to shutdown properly, and often, the function mach_prepare_reboot() is unexpectedly executed, thus the machine reboots instead. A wait loop is needed to ensure the system is in a well-defined state before going down. In commit 997e93d4df16 ("MIPS: Hang more efficiently on halt/powerdown/restart"), a general superset of the wait loop for all platforms is already provided, so we don't need to implement our own. This commit simply removes the unreachable() compiler marco after mach_prepare_reboot(), thus allowing the execution of machine_hang(). My test shows that the machine is now able to shutdown successfully. Please note that there are two different bugs preventing the machine from shutting down, another work-in-progress commit is needed to fix a lockup in cpufreq / i8259 driver, please read Reference, this commit does not fix that bug. Reference: https://lkml.org/lkml/2019/2/5/908 Signed-off-by: Yifeng Li --- arch/mips/loongson64/common/reset.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/arch/mips/loongson64/common/reset.c b/arch/mips/loongson64/common/reset.c index a60715e11306..b26892ce871c 100644 --- a/arch/mips/loongson64/common/reset.c +++ b/arch/mips/loongson64/common/reset.c @@ -59,7 +59,12 @@ static void loongson_poweroff(void) { #ifndef CONFIG_LEFI_FIRMWARE_INTERFACE mach_prepare_shutdown(); - unreachable(); + + /* + * It needs a wait loop here, but mips/kernel/reset.c already calls + * a generic delay loop, machine_hang(), so simply return. + */ + return; #else void (*fw_poweroff)(void) = (void *)loongson_sysconf.poweroff_addr; -- 2.20.1