Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp11787018pxu; Thu, 31 Dec 2020 22:14:13 -0800 (PST) X-Google-Smtp-Source: ABdhPJyCFqXTp8lP/eiw3hqSUJhHvTQDo3YQa4KQZa9UD2ZxiY4elshY8yy0FXsF0A4a5yYQ+YHB X-Received: by 2002:a17:906:adce:: with SMTP id lb14mr55844275ejb.502.1609481653246; Thu, 31 Dec 2020 22:14:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1609481653; cv=none; d=google.com; s=arc-20160816; b=tPjbHQxd5g7Nu/ZEiswcxI5FQtuUgow88UfvNDaV5k7AQPDgqhiuaRJpniBfeYP9An Ru9/eWCB7SjvnYWQsDg68own3X/4yTaawQUUiNhDTB23/v2MouDMSy+c/iS1mOvPs1Kg oIq7R2i4Bo86QhdVivh1VPZfNn+uaU9htXGuD1CHCCL09CShj5iDfdYbHnfAZM+H9m6m rXmYALO7GT5OJRP3ytKYRENqVGbYMzc3fOvW4dGkSJ2PqffdRu0qQW4MJIlWkF8rUGOx 5xjYOfdxpV8t2d7fDpJtPw5nctHH/le12Sn1o4ACAEI5Wq9p0DRFSrOBOgTH8hK3pLMK QgHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=FmAkaRO9ofNP/6j9RK7haiAvDC6oSSf/13JUxt6XUpg=; b=Eei/2nZb2DNZJZpYIFL3Bp56SHurQML8Xepao5raQsmPvUJiQ0Ka5z7VR2zt0tiids e8/x7rcbtw5Og1kOoJHQjtEgPcCfLq6S6sbY2DZRibxaNeTSHiWW6aD+PtOrlQXyVL/h y8tWYcsAZLNjwsq3+5vXYnpeAMKbByZZnfivusCObiQIGHzygO+3KNZvLv1gRppO26mv toz2zhd1jJzAP+DkIlBfi3wCUZkF7UpBh6SmE6E05Cf5nh519DUfyoVDC9JxIlUjYrhN 7+IGuPfAi9iIaE35RysQ6T4/zcJ9Kke0ioX9EHIaU6aK7mF+AZrq0CGIo/BEFAFVUbFa UvHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=BTMVd0Mn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id kt6si9946913ejb.378.2020.12.31.22.13.34; Thu, 31 Dec 2020 22:14:13 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=BTMVd0Mn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726558AbhAAGMW (ORCPT + 99 others); Fri, 1 Jan 2021 01:12:22 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:50612 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726322AbhAAGMV (ORCPT ); Fri, 1 Jan 2021 01:12:21 -0500 Received: from mail-pf1-x42b.google.com (mail-pf1-x42b.google.com [IPv6:2607:f8b0:4864:20::42b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3FB70C061573 for ; Thu, 31 Dec 2020 22:11:41 -0800 (PST) Received: by mail-pf1-x42b.google.com with SMTP id w6so12168109pfu.1 for ; Thu, 31 Dec 2020 22:11:41 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to; bh=FmAkaRO9ofNP/6j9RK7haiAvDC6oSSf/13JUxt6XUpg=; b=BTMVd0Mnqvbh3hjtXYbPj9j74wDyKIql+z3uzxuM5xuQAVoMXSKz68StDG467zM5gL lvwlI4fOHLz+mv5b0ErbqlGWWyl8tWGzA1SnsxWFG6wP5czUXTou6TvowB3iiVZaAI3O 4DO8B5/oFa0HQtN0FO5vm7EwCV4tJ+AtMKDtemFQSkuBTnewTscBD3e5Kqg8SzTWBRg5 3ZlRywm8P+aB1GKNr+2JTuPkLg32hC6MrCcHWrS6v8LcY+KZUsjAEqSDyJrb7nC0LVkl IC9r1Mmu6lndRqyWw5fVdwdKhNyaE80WfXdW2LS+EgXDP0zkW7NiksFm3EZuKHEx74Y1 pIXA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to; bh=FmAkaRO9ofNP/6j9RK7haiAvDC6oSSf/13JUxt6XUpg=; b=qWBWvPd156LcGlOHsBt7v2aJka1x3PzM9Za7JQCNcF60KVJ3G1ukGBtT3nH4XcUNUF 1hXtPFTOdmlocAz39TZOvWdSh+L5ZoLQv+T3SLDdU8rQGgdBsXVRjsJuzVUXWRYZZW0J obNdXd4SQWukJDFzp6sOYT6CQsIysLNJKSWX9/sthk9NPBRnmmQAf5oHGstHmMeYVULE x9IAL0dPDm9CObydFZk7t+LmSxwtisqOrb6WTcOpHbPmLu6XMVeiHSScnubphxTekLR2 Bnycwp80aFvM088VNnaf7h7PduQRq+d5CuEnDRvRxW493TOkNRY7tpL1Ff9T9e/GXXGF OYVw== X-Gm-Message-State: AOAM533RdufeG0u6Px0WAshXciyC3xMvQhn15r+crFoPZkmloJNz9ELv sqpldeQy7bIFH5Ygcip1Cl8UdWNf0Aw= X-Received: by 2002:a63:c444:: with SMTP id m4mr58675255pgg.420.1609481499888; Thu, 31 Dec 2020 22:11:39 -0800 (PST) Received: from localhost (g39.222-224-245.ppp.wakwak.ne.jp. [222.224.245.39]) by smtp.gmail.com with ESMTPSA id h10sm43515056pfn.213.2020.12.31.22.11.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 31 Dec 2020 22:11:39 -0800 (PST) Date: Fri, 1 Jan 2021 15:11:35 +0900 From: Stafford Horne To: Joel Stanley Cc: Jonas Bonn , Stefan Kristiansson , Geert Uytterhoeven , openrisc@lists.librecores.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] openrisc: restart: Call common handlers before hanging Message-ID: <20210101061135.GA3106870@lianli.shorne-pla.net> References: <20201227091446.118437-1-joel@jms.id.au> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20201227091446.118437-1-joel@jms.id.au> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, Dec 27, 2020 at 07:44:46PM +1030, Joel Stanley wrote: > Currently openrisc will print a message and then hang in an infinite > loop when rebooting. > > This patch adopts some code from ARM, which calls the common restart > infrastructure and hangs after a small delay if the restart infra > doesn't do anything. > > Signed-off-by: Joel Stanley > --- > Geert has a patch[1] for the litex soc code that adds a restart hander. > Openrisc doesn't hit that code path, this patch fixes that. > > [1] https://github.com/geertu/linux/commit/7d09dc0797a8208a11eb7c0c2156c1a4c120180f > > arch/openrisc/kernel/process.c | 13 ++++++++++--- > 1 file changed, 10 insertions(+), 3 deletions(-) > > diff --git a/arch/openrisc/kernel/process.c b/arch/openrisc/kernel/process.c > index 3c98728cce24..181448f74316 100644 > --- a/arch/openrisc/kernel/process.c > +++ b/arch/openrisc/kernel/process.c > @@ -34,6 +34,7 @@ > #include > #include > #include > +#include > > #include > #include > @@ -49,10 +50,16 @@ > */ > struct thread_info *current_thread_info_set[NR_CPUS] = { &init_thread_info, }; > > -void machine_restart(void) > +void machine_restart(char *cmd) > { > - printk(KERN_INFO "*** MACHINE RESTART ***\n"); > - __asm__("l.nop 1"); Just a note, this nop with argument 1, is used by the simulators to shutdown. I am happy to get rid of this though. The simulator should be simulating how real hardware is shut down not doing these tricks. > + do_kernel_restart(cmd); As you mentioned this depends on Geert's patch. Does he plan to submit it soon? Geert is CCed. > + > + /* Give a grace period for failure to restart of 1s */ > + mdelay(1000); > + > + /* Whoops - the platform was unable to reboot. Tell the user! */ > + pr_emerg("Reboot failed -- System halted\n"); > + while (1); > } > > /* > -- > 2.29.2 I am queing this for 5.11 anyway is it hurt's nothing without Geert's patch. -Stafford