From patchwork Sun Oct 25 06:04:37 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 1387124 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=gmx.de Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=gmx.net header.i=@gmx.net header.a=rsa-sha256 header.s=badeba3b8450 header.b=g/mu6G7V; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CJnWx3m1Lz9sVW for ; Sun, 25 Oct 2020 17:05:48 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id B35B6824A8; Sun, 25 Oct 2020 07:05:08 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=gmx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; secure) header.d=gmx.net header.i=@gmx.net header.b="g/mu6G7V"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id CC2BA8248E; Sun, 25 Oct 2020 07:05:01 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,FREEMAIL_FROM,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mout.gmx.net (mout.gmx.net [212.227.15.15]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 4F2D18244B for ; Sun, 25 Oct 2020 07:04:56 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=gmx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=xypron.glpk@gmx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1603605895; bh=0JeEtO97p1y2v/pDA//1RhpZejj4RR3MhuATkfVXQWw=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=g/mu6G7VWD4v2ffEAvh2tRZk8ZjRohvjIriaKPCgA9jne/t4QsGmT/wZqD2hFz6cJ RSLYVXysMrH1mYXifsEoArcPrb2RqFg1zXWjjQuHK2uiJ4ckbFJ+31GXkBuRXXrrFK iJJUc/TruVIlq9fx4MEgs/oyQkyRzXDPmrfsjy6I= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from LT02.fritz.box ([178.202.41.107]) by mail.gmx.com (mrgmx004 [212.227.17.184]) with ESMTPSA (Nemesis) id 1M3UUy-1kX7NV0HJa-000cNm; Sun, 25 Oct 2020 07:04:55 +0100 From: Heinrich Schuchardt To: Simon Glass Cc: u-boot@lists.denx.de, Heinrich Schuchardt Subject: [PATCH 1/5] sandbox: eth-raw: do not close the console input Date: Sun, 25 Oct 2020 07:04:37 +0100 Message-Id: <20201025060441.11961-2-xypron.glpk@gmx.de> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201025060441.11961-1-xypron.glpk@gmx.de> References: <20201025060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y MsdWG6rkwRE1TyUorjyzFSf04aKTf+inTiSlMhgogefaVWHPNq55dgu0hlHaS9S45VEmOmlVA 1j70tn7ZuR+FcJRkvaHkOUBdmA3ssCPIHrXbw12HLwGuLbvaoYClO40ulSjgr5B3dgn+7GgOd nE5/MRRsFbhuzOQP9nOw== X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean When the sandbox eth-raw device host_lo is removed this leads to closing the console input. Do not call close(0). Signed-off-by: Heinrich Schuchardt Reviewed-by: Simon Glass --- arch/sandbox/cpu/eth-raw-os.c | 8 ++++---- arch/sandbox/cpu/os.c | 5 ++++- 2 files changed, 8 insertions(+), 5 deletions(-) -- 2.28.0 diff --git a/arch/sandbox/cpu/eth-raw-os.c b/arch/sandbox/cpu/eth-raw-os.c index da01d1addf..6a8d809756 100644 --- a/arch/sandbox/cpu/eth-raw-os.c +++ b/arch/sandbox/cpu/eth-raw-os.c @@ -53,7 +53,7 @@ int sandbox_eth_raw_os_is_local(const char *ifname) } ret = !!(ifr.ifr_flags & IFF_LOOPBACK); out: - close(fd); + os_close(fd); return ret; } @@ -220,7 +220,7 @@ int sandbox_eth_raw_os_send(void *packet, int length, struct sockaddr_in addr; if (priv->local_bind_sd != -1) - close(priv->local_bind_sd); + os_close(priv->local_bind_sd); /* A normal UDP socket is required to bind */ priv->local_bind_sd = socket(AF_INET, SOCK_DGRAM, 0); @@ -284,11 +284,11 @@ void sandbox_eth_raw_os_stop(struct eth_sandbox_raw_priv *priv) { free(priv->device); priv->device = NULL; - close(priv->sd); + os_close(priv->sd); priv->sd = -1; if (priv->local) { if (priv->local_bind_sd != -1) - close(priv->local_bind_sd); + os_close(priv->local_bind_sd); priv->local_bind_sd = -1; priv->local_bind_udp_port = 0; } diff --git a/arch/sandbox/cpu/os.c b/arch/sandbox/cpu/os.c index e7ec892bdf..c461fb0db0 100644 --- a/arch/sandbox/cpu/os.c +++ b/arch/sandbox/cpu/os.c @@ -86,7 +86,10 @@ int os_open(const char *pathname, int os_flags) int os_close(int fd) { - return close(fd); + /* Do not close the console input */ + if (fd) + return close(fd); + return -1; } int os_unlink(const char *pathname) From patchwork Sun Oct 25 06:04:38 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 1387121 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=gmx.de Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=gmx.net header.i=@gmx.net header.a=rsa-sha256 header.s=badeba3b8450 header.b=g65b1Z5s; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CJnWG4y8wz9sSW for ; Sun, 25 Oct 2020 17:05:14 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 3B3808248D; Sun, 25 Oct 2020 07:05:00 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=gmx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; secure) header.d=gmx.net header.i=@gmx.net header.b="g65b1Z5s"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id 8259882483; Sun, 25 Oct 2020 07:04:58 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,FREEMAIL_FROM,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mout.gmx.net (mout.gmx.net [212.227.15.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 3071A8244A for ; Sun, 25 Oct 2020 07:04:56 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=gmx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=xypron.glpk@gmx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1603605895; bh=2VN10RsJecuaPwF/pWg2bSrYN5NklPHUfoHZQFynyVc=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=g65b1Z5sWrPSYm2pNYh46ek053Weph6114yLjckhDEvqfXRw5HCXSA46gwp7eQ8FQ EVLPbaBF+30Wtn07MbU5cP0Sb5ph3vWiKk4zdq9IeKob88sos/AhB+fKV3v8ulHwd0 gJ8pZktxHSlaVgLqWMYpmKwOsRLbRgpTHLbm4Nu0= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from LT02.fritz.box ([178.202.41.107]) by mail.gmx.com (mrgmx004 [212.227.17.184]) with ESMTPSA (Nemesis) id 1M2wGs-1kXfbv1Dem-003Nno; Sun, 25 Oct 2020 07:04:55 +0100 From: Heinrich Schuchardt To: Simon Glass Cc: u-boot@lists.denx.de, Heinrich Schuchardt Subject: [PATCH 2/5] sandbox: enable poweroff command Date: Sun, 25 Oct 2020 07:04:38 +0100 Message-Id: <20201025060441.11961-3-xypron.glpk@gmx.de> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201025060441.11961-1-xypron.glpk@gmx.de> References: <20201025060441.11961-1-xypron.glpk@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:UEypzio6CPISbr9BqO2ckhCCPBNEdhYxMKKEaF+BKgCwdz37fHH 4ZBpHeSXRhBq9TQDUqHSYBuz/sIT58YuNuohCDUdn6Ej+oNvs6gZs0k8bcL29lQrNKrlpxN OiDoHOL84HpTnYtOmVK7kjWnyxzAcy+VabAwyU/oV/NrIvEC3ygQ9p5MEJt/+HgLONGL/+b RGGFXzHJ7aQRP78KqT2fA== X-UI-Out-Filterresults: notjunk:1;V03:K0:VUWsaYRf/3o=:1KALftvI+hSGjm8YzkzOGK 4kjBZCh1LYmaxOM5ofyU3CB2vGyrroHwxhsdUUKlbPbOaD5G0uSXkEbJ7lC5HS1ZKeH3esLPE gh469kKDg/pSlEc0uLk/jboLXlh8yE1nMSfQdubrTyRcRnNBEHi9Z8z8dQk/QIpuBKiBKWhRm ZzUjQAmV23xFomfwgtbXrZE/F1TvT2PNJPF7/oqnEVJecaIkAYk8w54bhQ1GOvjjuZ7cC+TVY QnOW7hA/jVuOAaCemvUSh/3wUKW7RpPEjWP0JwrhFwI3ncSQSfMoWwEa3dWlMwgE3mhOTiMXx 1GERhVYilidENrWnk7RK3LTaHx/wuwqTan8M5CKG0wA/rq9lpSKTIqtEV7ZQT6gCYWP0y7Kxu gpDp9sXmPfWrHagz8O2bpOR3DDsyvf7LL6DHFJniAkNCpi2YCRr5g4IdrmWVH5DIasef5qrYv cBQks9i9yEQQ36pSY0642xpmSU/hUQ/UF5yWk1HNmkWt6eHBUi3hz0R0hWvpkIxe8qnBNPjcz uxVoyr2+CsfUhDug7PtkvTYP+wXdKYrxFer07xz5BN/GcKCW2WgBENb6tFLuv7W8b4NEDRZ4f FiAfOycx2r8nbZBXM7X3cXphWdmFGp5C4j+MP9OGD9UWagKUefVAYNkDBjQebryeMA771bfW/ XDDcuCIn5k7axRqn8uUGn2F8E1oq0bDYmnYqGPIWjdJG5qPnEp0pqWuoyquqwmM9ZHBJAgq5V rOamWaym4PaCP9C12xLBDb5bFtnxdYCuw1PVeF8v/BhqGrVlhh1UbMs76BixnLb29tSlVpYGl iSMSSbNPk6Na1osBnkQ/O3aak0yfE3ubz3WYgM9+Pk2MFzSMbb1P24/Jot/PXwQBP0uZu99kj ced8OZ+SHbf04+ItjMkw== X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean The command to shut down a device is 'poweroff'. It is a deficit of the sandbox that it does not support resetting yet but shuts down upong seeing the 'reset' command. Once the sandbox properly supports reset we need the 'poweroff' command to leave the sandbox. Signed-off-by: Heinrich Schuchardt Reviewed-by: Simon Glass --- arch/Kconfig | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) -- 2.28.0 diff --git a/arch/Kconfig b/arch/Kconfig index 683e384319..63e9d725b7 100644 --- a/arch/Kconfig +++ b/arch/Kconfig @@ -87,6 +87,7 @@ config SANDBOX bool "Sandbox" select BOARD_LATE_INIT select BZIP2 + select CMD_POWEROFF select DM select DM_GPIO select DM_I2C @@ -102,7 +103,7 @@ config SANDBOX select PCI_ENDPOINT select SPI select SUPPORT_OF_CONTROL - select SYSRESET_CMD_POWEROFF if CMD_POWEROFF + select SYSRESET_CMD_POWEROFF imply BITREVERSE select BLOBLIST imply CMD_DM From patchwork Sun Oct 25 06:04:39 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 1387122 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=85.214.62.61; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=gmx.de Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=gmx.net header.i=@gmx.net header.a=rsa-sha256 header.s=badeba3b8450 header.b=EYB+W+5b; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [85.214.62.61]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CJnWV0KRhz9sSW for ; Sun, 25 Oct 2020 17:05:25 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 5440C82479; Sun, 25 Oct 2020 07:05:06 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=gmx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; secure) header.d=gmx.net header.i=@gmx.net header.b="EYB+W+5b"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id C68848249C; Sun, 25 Oct 2020 07:05:00 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,FREEMAIL_FROM,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mout.gmx.net (mout.gmx.net [212.227.15.19]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 56B2482465 for ; Sun, 25 Oct 2020 07:04:56 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=gmx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=xypron.glpk@gmx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1603605895; bh=Ohl0ryPKmlJTLi0x+PJgUjwidIRaXHdUdsWo6Oa142U=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=EYB+W+5bugCmB73iZcnuz7OeVomia/lR0+YCBoYHIEeSqa9ankUU4twk749cwfABn 58LB67UUcomcqxX8z50sfdYrhwkXIJSGD40ukenDAI4Gv6hpLyXXHoCJ51aU+bpWRB JiM9xmB+G7wDU/Vs9OaBatCejhwE04ScbFKqo/hk= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from LT02.fritz.box ([178.202.41.107]) by mail.gmx.com (mrgmx004 [212.227.17.184]) with ESMTPSA (Nemesis) id 1N6bfw-1kLFLF23na-0182z8; Sun, 25 Oct 2020 07:04:55 +0100 From: Heinrich Schuchardt To: Simon Glass Cc: u-boot@lists.denx.de, Heinrich Schuchardt Subject: [PATCH 3/5] test/py: test poweroff Date: Sun, 25 Oct 2020 07:04:39 +0100 Message-Id: <20201025060441.11961-4-xypron.glpk@gmx.de> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201025060441.11961-1-xypron.glpk@gmx.de> References: <20201025060441.11961-1-xypron.glpk@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:lO8qInSDCThC+aYorwo5Y6z4jmj2XhehUxUfL9qRQ7DFpxlt6It tO9PmTQFdAlLS/7gSAuJAQVfEyZky744nOlfOxhxen3sy5SKTysJOdADwfamtjBcFUm4rMI XBjLgy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version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean It is the 'poweroff' and not the 'reset' command that should shut down the sandbox. Adjust the unit test accordingly Signed-off-by: Heinrich Schuchardt Reviewed-by: Simon Glass --- test/py/tests/test_sandbox_exit.py | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) -- 2.28.0 diff --git a/test/py/tests/test_sandbox_exit.py b/test/py/tests/test_sandbox_exit.py index a301f4b559..2d242ae0f6 100644 --- a/test/py/tests/test_sandbox_exit.py +++ b/test/py/tests/test_sandbox_exit.py @@ -6,11 +6,11 @@ import pytest import signal @pytest.mark.boardspec('sandbox') -@pytest.mark.buildconfigspec('sysreset') -def test_reset(u_boot_console): - """Test that the "reset" command exits sandbox process.""" +@pytest.mark.buildconfigspec('sysreset_cmd_poweroff') +def test_poweroff(u_boot_console): + """Test that the "poweroff" command exits sandbox process.""" - u_boot_console.run_command('reset', wait_for_prompt=False) + u_boot_console.run_command('poweroff', wait_for_prompt=False) assert(u_boot_console.validate_exited()) @pytest.mark.boardspec('sandbox') From patchwork Sun Oct 25 06:04:40 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 1387123 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=gmx.de Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=gmx.net header.i=@gmx.net header.a=rsa-sha256 header.s=badeba3b8450 header.b=R+jOJfDx; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CJnWk03RXz9sVH for ; Sun, 25 Oct 2020 17:05:37 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 8E2E08249B; Sun, 25 Oct 2020 07:05:07 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=gmx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; secure) header.d=gmx.net header.i=@gmx.net header.b="R+jOJfDx"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id EC7D88248F; Sun, 25 Oct 2020 07:05:00 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,FREEMAIL_FROM,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mout.gmx.net (mout.gmx.net [212.227.15.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id 8CEFB82479 for ; Sun, 25 Oct 2020 07:04:56 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=gmx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=xypron.glpk@gmx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1603605895; bh=4cO9ODulUKfsjskdkKp0io3W/uZC38V7lWyWJ8WXtKA=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=R+jOJfDxYFl6YEj0kJ1f75UJeEiF83zxNbkcKXnJQmQKBwGK3ImlhLp8apAoG74o+ FWmYx1qbtcmChnGyXJZQoPMAcirbHi5MXfcTrFE0R4Mbm7PO627JaygB1Rxb/skBsw IxUTWw//g5sdg2pxks9HdUbl2nkIpm2rookLiX4g= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from LT02.fritz.box ([178.202.41.107]) by mail.gmx.com (mrgmx004 [212.227.17.184]) with ESMTPSA (Nemesis) id 1MQMyZ-1kjXb42v69-00MIED; Sun, 25 Oct 2020 07:04:55 +0100 From: Heinrich Schuchardt To: Simon Glass Cc: u-boot@lists.denx.de, Heinrich Schuchardt Subject: [PATCH 4/5] sandbox: implement reset Date: Sun, 25 Oct 2020 07:04:40 +0100 Message-Id: <20201025060441.11961-5-xypron.glpk@gmx.de> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201025060441.11961-1-xypron.glpk@gmx.de> References: <20201025060441.11961-1-xypron.glpk@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:ou0LyRgSM0UHENpR216hIC7+spwxZY6P1Kes8zUX6Uutiu1ILW6 gakFSk8LbqgcGu9k94gTqQoEbJVTq4dfXSMe3pc6n//OvsG5TtrE7YZVzav/oQgs6RwsvzD 4z9wGDObemDfE56lCE1Fol/QmuZ/FcNaIsiM697sYKlwKiIvm8nwOBCsPLaelk7rcaV/p0Q PYiBUrS5yGGJ3ELrYCFQw== X-UI-Out-Filterresults: notjunk:1;V03:K0:iNXmOrRDlWg=:beQdOI8Z7te4T9obEVdziH YhCIPRRV+KLveKHRzg3W/7M3PneqZmWmz73HWN95kscVw5RZLDLcJLgHmBijh8DgzIUTkj4dW bTuX8Hnup0/VB+FVvAdu9f3Ez+I6XqrKz4kixPlS3BpC+OMqjJPC/xy62OLezsaYJ06chIMSJ VpCDGgJhN7oyZuQ5njnqUZu0OdRWR0YrTUZx9N0g7KiSYScaXa5UNofVSn1R7rRMVsV/MwV0a hQrmgBjF9uGrwa3rcT0xG3i8qIE7LXGAptcdDaU4LqBIb4Zfl3bAU6efM9fg1OadMdb8oLpXm ZUxKvHscmwAmdxOmEFMmchQjk0QhICALDQTUHGFaqnHyU2378E+drjhdjYenmq8C7x/buB8K2 sMDLTesSiFCK7noh288dQmUK4vh4tvlsqkDeytt2WAohX6v8ZydwjZUP2fFWJpa3yoiuweuTy cpqlg8AHcELQFVu9osm79ybLqBTox3f2MaprJVXg2lIF90ZPyny9MAgPeE+W0koySb2iV7qlx pCctXzI+Ein3wAZACJuqyRkIECF3wdkbbcLEf7QrUS7tj3XTW/FzBJTTW3Iws9sM6/MPzQyDk 1cpZXk6Y3tkylI7GnRVPKw2qmbnpaNFitv4NpLg0b5rSjLPwbRBor1iXPGAgHJb26WoGFXaC5 UETjDSthPqB2HmBU/hlFLANAzy9mkDFLgaQg7rMmoG4jOTYjB1H2PRCr7rYGv8zpIdNSCI/hV kRiP1dCim4yKuh/Akrl8rOHsZxHgFomBvQmoNjnIxGRwPYTKoTfpKXXJDK6Zt4ZCyPwCseP2n TGRdMVlyulOGKKI4QFeiU0yDBwR+En1M0GMqWmO8xcJ9FoVjfHERbS3qpCql+mHjh3JgZey4t Vc7C7RwRUg4WHQ8S9T/Q== X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean Up to now the sandbox would shutdown upon a cold reset request. Instead it should be reset. In our coding we use static variables. The only safe way to return to an initial state is to relaunch the U-Boot binary. The reset implementation uses a longjmp() to return to the main() function and then relaunches U-Boot using execv(). Signed-off-by: Heinrich Schuchardt --- arch/sandbox/cpu/os.c | 14 ++++++++++++++ arch/sandbox/cpu/start.c | 22 ++++++++++++++++++++++ arch/sandbox/cpu/state.c | 1 + arch/sandbox/include/asm/u-boot-sandbox.h | 3 +++ drivers/sysreset/sysreset_sandbox.c | 3 +++ include/os.h | 5 +++++ 6 files changed, 48 insertions(+) -- 2.28.0 diff --git a/arch/sandbox/cpu/os.c b/arch/sandbox/cpu/os.c index c461fb0db0..ed044e87fb 100644 --- a/arch/sandbox/cpu/os.c +++ b/arch/sandbox/cpu/os.c @@ -817,3 +817,17 @@ void *os_find_text_base(void) return base; } + +void os_relaunch(int argc, char *argv[]) +{ + char **args; + + args = calloc(argc + 1, sizeof(char *)); + if (!args) + goto out; + memcpy(args, argv, sizeof(char *) * argc); + args[argc] = NULL; + execv(args[0], args); +out: + os_exit(1); +} diff --git a/arch/sandbox/cpu/start.c b/arch/sandbox/cpu/start.c index c6a2bbe468..ee1d4b9581 100644 --- a/arch/sandbox/cpu/start.c +++ b/arch/sandbox/cpu/start.c @@ -5,6 +5,7 @@ #include #include +#include #include #include #include @@ -14,11 +15,15 @@ #include #include #include +#include #include #include DECLARE_GLOBAL_DATA_PTR; +/* longjmp buffer for reset */ +static struct jmp_buf_data reset_jmp; + /* Compare two options so that they can be sorted into alphabetical order */ static int h_compare_opt(const void *p1, const void *p2) { @@ -394,12 +399,29 @@ void state_show(struct sandbox_state *state) printf("\n"); } +void sandbox_reset(void) +{ + /* Do this here while it still has an effect */ + os_fd_restore(); + if (state_uninit()) + os_exit(2); + + if (dm_uninit()) + os_exit(2); + + /* This is considered normal termination for now */ + longjmp(&reset_jmp, 1); +} + int main(int argc, char *argv[]) { struct sandbox_state *state; gd_t data; int ret; + if (setjmp(&reset_jmp)) + os_relaunch(argc, argv); + memset(&data, '\0', sizeof(data)); gd = &data; gd->arch.text_base = os_find_text_base(); diff --git a/arch/sandbox/cpu/state.c b/arch/sandbox/cpu/state.c index 34b6fff7e7..59f37fab0b 100644 --- a/arch/sandbox/cpu/state.c +++ b/arch/sandbox/cpu/state.c @@ -358,6 +358,7 @@ void state_reset_for_test(struct sandbox_state *state) /* No reset yet, so mark it as such. Always allow power reset */ state->last_sysreset = SYSRESET_COUNT; state->sysreset_allowed[SYSRESET_POWER_OFF] = true; + state->sysreset_allowed[SYSRESET_COLD] = true; state->allow_memio = false; memset(&state->wdt, '\0', sizeof(state->wdt)); diff --git a/arch/sandbox/include/asm/u-boot-sandbox.h b/arch/sandbox/include/asm/u-boot-sandbox.h index 798d003077..b1bdcbcde5 100644 --- a/arch/sandbox/include/asm/u-boot-sandbox.h +++ b/arch/sandbox/include/asm/u-boot-sandbox.h @@ -84,6 +84,9 @@ void sandbox_set_enable_pci_map(int enable); */ int sandbox_read_fdt_from_file(void); +/* Reset sandbox */ +void sandbox_reset(void); + /* Exit sandbox (quit U-Boot) */ void sandbox_exit(void); diff --git a/drivers/sysreset/sysreset_sandbox.c b/drivers/sysreset/sysreset_sandbox.c index 69c22a7000..c92132798c 100644 --- a/drivers/sysreset/sysreset_sandbox.c +++ b/drivers/sysreset/sysreset_sandbox.c @@ -56,6 +56,9 @@ static int sandbox_sysreset_request(struct udevice *dev, enum sysreset_t type) switch (type) { case SYSRESET_COLD: state->last_sysreset = type; + if (!state->sysreset_allowed[type]) + return -EACCES; + sandbox_reset(); break; case SYSRESET_POWER_OFF: state->last_sysreset = type; diff --git a/include/os.h b/include/os.h index 1874ae674f..187dbf06f2 100644 --- a/include/os.h +++ b/include/os.h @@ -355,4 +355,9 @@ int os_read_file(const char *name, void **bufp, int *sizep); */ void *os_find_text_base(void); +/** + * os_relaunch() - restart the sandbox + */ +void os_relaunch(int argc, char *argv[]); + #endif From patchwork Sun Oct 25 06:04:41 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Heinrich Schuchardt X-Patchwork-Id: 1387125 X-Patchwork-Delegate: sjg@chromium.org Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Authentication-Results: ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.denx.de (client-ip=2a01:238:438b:c500:173d:9f52:ddab:ee01; helo=phobos.denx.de; envelope-from=u-boot-bounces@lists.denx.de; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=gmx.de Authentication-Results: ozlabs.org; dkim=pass (1024-bit key; secure) header.d=gmx.net header.i=@gmx.net header.a=rsa-sha256 header.s=badeba3b8450 header.b=QGTT9Fce; dkim-atps=neutral Received: from phobos.denx.de (phobos.denx.de [IPv6:2a01:238:438b:c500:173d:9f52:ddab:ee01]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 4CJnX8132Cz9sSW for ; Sun, 25 Oct 2020 17:05:59 +1100 (AEDT) Received: from h2850616.stratoserver.net (localhost [IPv6:::1]) by phobos.denx.de (Postfix) with ESMTP id 05BFE824BB; Sun, 25 Oct 2020 07:05:10 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=gmx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=u-boot-bounces@lists.denx.de Authentication-Results: phobos.denx.de; dkim=pass (1024-bit key; secure) header.d=gmx.net header.i=@gmx.net header.b="QGTT9Fce"; dkim-atps=neutral Received: by phobos.denx.de (Postfix, from userid 109) id B4BA582479; Sun, 25 Oct 2020 07:05:02 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on phobos.denx.de X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,FREEMAIL_FROM,RCVD_IN_MSPIKE_H2,SPF_HELO_NONE, T_FILL_THIS_FORM_SHORT,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.2 Received: from mout.gmx.net (mout.gmx.net [212.227.15.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by phobos.denx.de (Postfix) with ESMTPS id D44808247D for ; Sun, 25 Oct 2020 07:04:56 +0100 (CET) Authentication-Results: phobos.denx.de; dmarc=none (p=none dis=none) header.from=gmx.de Authentication-Results: phobos.denx.de; spf=pass smtp.mailfrom=xypron.glpk@gmx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.net; s=badeba3b8450; t=1603605896; bh=aORwjQh3dt2/sL2RnJXqsGmqlTbm7Rh9DBfbRDzRhBM=; h=X-UI-Sender-Class:From:To:Cc:Subject:Date:In-Reply-To:References; b=QGTT9FceO+5jIHu+X9cKk+98LXGqxRwxmv5Ap/xQnfDOEfgkGuvCxn/j/YamxgN9O ukqCRgYRdyqQ4F7xgDMNNMUqfz5VpXuZyAWvfGsQRVt3C0ln+5/5ikZE5dqOPFKXaz AUcXv5R/+xRtyl6FccKQtNHIK+c1+GsUWDT5/V/g= X-UI-Sender-Class: 01bb95c1-4bf8-414a-932a-4f6e2808ef9c Received: from LT02.fritz.box ([178.202.41.107]) by mail.gmx.com (mrgmx004 [212.227.17.184]) with ESMTPSA (Nemesis) id 1MybKp-1kBaI63koX-00ywQn; Sun, 25 Oct 2020 07:04:55 +0100 From: Heinrich Schuchardt To: Simon Glass Cc: u-boot@lists.denx.de, Heinrich Schuchardt Subject: [PATCH 5/5] test: adjust sysreset tests Date: Sun, 25 Oct 2020 07:04:41 +0100 Message-Id: <20201025060441.11961-6-xypron.glpk@gmx.de> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201025060441.11961-1-xypron.glpk@gmx.de> References: <20201025060441.11961-1-xypron.glpk@gmx.de> MIME-Version: 1.0 X-Provags-ID: V03:K1:YkvS5M7OtGTgJYgg+p52Gf81Wd/0E5Eymeh3KClnnMrjkNpw5v5 mddDJJfN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GWE8M7n4SWB4AzZ+7 TRiB49+ZLK+v4I6/2nRg== X-BeenThere: u-boot@lists.denx.de X-Mailman-Version: 2.1.34 Precedence: list List-Id: U-Boot discussion List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: u-boot-bounces@lists.denx.de Sender: "U-Boot" X-Virus-Scanned: clamav-milter 0.102.3 at phobos.denx.de X-Virus-Status: Clean As we have a working COLD_RESET on the sandbox the sysreset test has to be adjusted. Signed-off-by: Heinrich Schuchardt Reviewed-by: Simon Glass --- test/dm/sysreset.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) -- 2.28.0 diff --git a/test/dm/sysreset.c b/test/dm/sysreset.c index aec97b1cbb..691683c567 100644 --- a/test/dm/sysreset.c +++ b/test/dm/sysreset.c @@ -37,7 +37,9 @@ static int dm_test_sysreset_base(struct unit_test_state *uts) /* Device 2 is the cold sysreset device */ ut_assertok(uclass_get_device(UCLASS_SYSRESET, 2, &dev)); ut_asserteq(-ENOSYS, sysreset_request(dev, SYSRESET_WARM)); + state->sysreset_allowed[SYSRESET_COLD] = false; ut_asserteq(-EACCES, sysreset_request(dev, SYSRESET_COLD)); + state->sysreset_allowed[SYSRESET_COLD] = true; state->sysreset_allowed[SYSRESET_POWER] = false; ut_asserteq(-EACCES, sysreset_request(dev, SYSRESET_POWER)); state->sysreset_allowed[SYSRESET_POWER] = true; @@ -71,22 +73,25 @@ static int dm_test_sysreset_walk(struct unit_test_state *uts) struct sandbox_state *state = state_get_current(); /* If we generate a power sysreset, we will exit sandbox! */ + state->sysreset_allowed[SYSRESET_WARM] = false; + state->sysreset_allowed[SYSRESET_COLD] = false; state->sysreset_allowed[SYSRESET_POWER] = false; state->sysreset_allowed[SYSRESET_POWER_OFF] = false; ut_asserteq(-EACCES, sysreset_walk(SYSRESET_WARM)); ut_asserteq(-EACCES, sysreset_walk(SYSRESET_COLD)); ut_asserteq(-EACCES, sysreset_walk(SYSRESET_POWER)); + ut_asserteq(-EACCES, sysreset_walk(SYSRESET_POWER_OFF)); /* * Enable cold system reset - this should make cold system reset work, * plus a warm system reset should be promoted to cold, since this is * the next step along. */ - state->sysreset_allowed[SYSRESET_COLD] = true; + state->sysreset_allowed[SYSRESET_WARM] = true; ut_asserteq(-EINPROGRESS, sysreset_walk(SYSRESET_WARM)); - ut_asserteq(-EINPROGRESS, sysreset_walk(SYSRESET_COLD)); + ut_asserteq(-EACCES, sysreset_walk(SYSRESET_COLD)); ut_asserteq(-EACCES, sysreset_walk(SYSRESET_POWER)); - state->sysreset_allowed[SYSRESET_COLD] = false; + state->sysreset_allowed[SYSRESET_COLD] = true; state->sysreset_allowed[SYSRESET_POWER] = true; return 0;