Received: by 2002:ac0:946b:0:0:0:0:0 with SMTP id j40csp712457imj; Wed, 13 Feb 2019 16:18:19 -0800 (PST) X-Google-Smtp-Source: AHgI3IYmak7HWGWnsE12VqApcuQORauOPNuT0cxlMQfbONrzRuW7V5CLeIQ1GuIfVCcZZxDjhzIQ X-Received: by 2002:a63:f648:: with SMTP id u8mr867498pgj.91.1550103499885; Wed, 13 Feb 2019 16:18:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1550103499; cv=none; d=google.com; s=arc-20160816; b=v7hmYLxSdpaOOY7NsXAGBCBDRpFim5C9gKa+4FrqaqLAxUddNIDD/RuipMzoaisM3C Il9kUMCMpw7xmEkXu70exOAl/EcfQmj2X5jk9bFIADybaAA5fJpdKSh2LvAm+m7dv1lt h5AnsVX5XVLfi0GxfIFhSegCLSo20GlSMZqv3pxK7wevatH53IUv5U77pYuBGEj+7gZu B2Kw7l6yDgvtlylsXnDaZOd7BGYHK4r7LOfLJ9dbttaAq+m/y45eRuGU8flLyLngG3XY /7pjmYDU5R3oop6aPXlDZpmFW/JB01P57Ur2mdiuo1QKbCbD8G8K2bm0ER+V2ZZHRQYr EATQ== 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=AItHD0Bs3mwjyW81OtSgeXRQc0eyfAVbZFzr8+TYnuE=; b=UXtiWGA3HPE0yvKL01ecg+wzhWbwWdBItp2V5qt7JFgRJWvYKAvrB7x7TJ0j7o7mlB PZsaD17CRwcGa0A03twct4ITcLc8P3R62b9XhvZz8F5OyczJj1D2JMtbFYoM/+VzzpzD JX5fsRGTRak3Hl628nlfqbWL1xE7gVWVR+R21t+Z1pTALVnlPFfDKDy6cClvDykypyzo f18D+XgjwLfgId5UDTxYfI38vYsOES6gCYr2uWd9FUj8QQqFbayqa4UqXKHiDVLgPYNC YYF+OQCFUedWJN1y8W7OWPdOeyeb0no4kHWfPaORrGnvxbLzmnS+tDR5WdPLlRK8Gfwf DQBQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=xYEj9yXv; 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 bb8si751887plb.261.2019.02.13.16.18.04; Wed, 13 Feb 2019 16:18:19 -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=@kernel.org header.s=default header.b=xYEj9yXv; 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 S2394092AbfBMSpp (ORCPT + 99 others); Wed, 13 Feb 2019 13:45:45 -0500 Received: from mail.kernel.org ([198.145.29.99]:44326 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2394072AbfBMSpm (ORCPT ); Wed, 13 Feb 2019 13:45:42 -0500 Received: from localhost (5356596B.cm-6-7b.dynamic.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 E5CFE222D2; Wed, 13 Feb 2019 18:45:40 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1550083541; bh=qRVX3gCA5Z4JRwds7/Nhne6j4J0XyLlTtjYoEYCnJZg=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xYEj9yXvZgRFtqZRBDJRhH6X0uvc05MReHPyD9z8xxpyTEejn1vxtaeD9okfu6CQX BVqMR68qeX66its9GjYeNXMxGtdTlSdbKEW4uewcHrMUaPcpqG6UuAjCXADFMTsbjo gEQ7qvW05T7rOn81t0oPuNqe6bpFAxzqREWAYS8c= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Yifeng Li , Paul Burton , linux-mips@vger.kernel.org, Huacai Chen , Ralf Baechle , James Hogan , Aaro Koskinen Subject: [PATCH 4.20 27/50] mips: loongson64: remove unreachable(), fix loongson_poweroff(). Date: Wed, 13 Feb 2019 19:38:32 +0100 Message-Id: <20190213183657.921615249@linuxfoundation.org> X-Mailer: git-send-email 2.20.1 In-Reply-To: <20190213183655.747168774@linuxfoundation.org> References: <20190213183655.747168774@linuxfoundation.org> User-Agent: quilt/0.65 X-stable: review X-Patchwork-Hint: ignore 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 4.20-stable review patch. If anyone has any objections, please let me know. ------------------ From: Yifeng Li commit 8a96669d77897ff3613157bf43f875739205d66d upstream. 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 Signed-off-by: Paul Burton Cc: linux-mips@vger.kernel.org Cc: Huacai Chen Cc: Ralf Baechle Cc: James Hogan Cc: linux-kernel@vger.kernel.org Cc: Aaro Koskinen Cc: stable@vger.kernel.org # v4.17+ Signed-off-by: Greg Kroah-Hartman --- arch/mips/loongson64/common/reset.c | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) --- 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;