From patchwork Tue Feb 28 10:31:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geert Uytterhoeven X-Patchwork-Id: 657601 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id EFF7FC7EE32 for ; Tue, 28 Feb 2023 10:31:44 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230145AbjB1Kbo (ORCPT ); Tue, 28 Feb 2023 05:31:44 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47918 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230193AbjB1Kbm (ORCPT ); Tue, 28 Feb 2023 05:31:42 -0500 Received: from laurent.telenet-ops.be (laurent.telenet-ops.be [IPv6:2a02:1800:110:4::f00:19]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A22336EBF for ; Tue, 28 Feb 2023 02:31:37 -0800 (PST) Received: from ramsan.of.borg ([IPv6:2a02:1810:ac12:ed50:9202:974e:f0e0:414c]) by laurent.telenet-ops.be with bizsmtp id SaXZ2900H1hKVeJ01aXZmY; Tue, 28 Feb 2023 11:31:35 +0100 Received: from rox.of.borg ([192.168.97.57]) by ramsan.of.borg with esmtp (Exim 4.95) (envelope-from ) id 1pWxGC-00ANGn-K0; Tue, 28 Feb 2023 11:31:33 +0100 Received: from geert by rox.of.borg with local (Exim 4.95) (envelope-from ) id 1pWxGf-00FbNK-4c; Tue, 28 Feb 2023 11:31:33 +0100 From: Geert Uytterhoeven To: Brendan Higgins , David Gow Cc: linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com, linux-sh@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH 1/2] kunit: tool: Add support for overriding the QEMU serial port Date: Tue, 28 Feb 2023 11:31:02 +0100 Message-Id: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org On some platforms, the console is not the first serial port. To make this work, the first serial port in QEMU must be set to "null". Add support for this by adding an optional "serial" parameter, which defaults to "stdio", and can be overridden by platform-specific configuration. Signed-off-by: Geert Uytterhoeven Reviewed-by: David Gow --- tools/testing/kunit/kunit_kernel.py | 3 ++- tools/testing/kunit/qemu_config.py | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/testing/kunit/kunit_kernel.py b/tools/testing/kunit/kunit_kernel.py index 53e90c3358348dbe..64262875993ff070 100644 --- a/tools/testing/kunit/kunit_kernel.py +++ b/tools/testing/kunit/kunit_kernel.py @@ -106,6 +106,7 @@ class LinuxSourceTreeOperationsQemu(LinuxSourceTreeOperations): self._kernel_path = qemu_arch_params.kernel_path self._kernel_command_line = qemu_arch_params.kernel_command_line + ' kunit_shutdown=reboot' self._extra_qemu_params = qemu_arch_params.extra_qemu_params + self._serial = qemu_arch_params.serial def make_arch_config(self, base_kunitconfig: kunit_config.Kconfig) -> kunit_config.Kconfig: kconfig = kunit_config.parse_from_string(self._kconfig) @@ -121,7 +122,7 @@ class LinuxSourceTreeOperationsQemu(LinuxSourceTreeOperations): '-append', ' '.join(params + [self._kernel_command_line]), '-no-reboot', '-nographic', - '-serial', 'stdio'] + self._extra_qemu_params + '-serial', self._serial] + self._extra_qemu_params # Note: shlex.join() does what we want, but requires python 3.8+. print('Running tests with:\n$', ' '.join(shlex.quote(arg) for arg in qemu_command)) return subprocess.Popen(qemu_command, diff --git a/tools/testing/kunit/qemu_config.py b/tools/testing/kunit/qemu_config.py index 0b6a80398cccb50f..b1fba9016eed00d0 100644 --- a/tools/testing/kunit/qemu_config.py +++ b/tools/testing/kunit/qemu_config.py @@ -17,3 +17,4 @@ class QemuArchParams: kernel_path: str kernel_command_line: str extra_qemu_params: List[str] + serial: str = 'stdio' From patchwork Tue Feb 28 10:31:03 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geert Uytterhoeven X-Patchwork-Id: 657602 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id CFCC7C64EC7 for ; Tue, 28 Feb 2023 10:31:43 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229775AbjB1Kbn (ORCPT ); Tue, 28 Feb 2023 05:31:43 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47906 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230126AbjB1Kbm (ORCPT ); Tue, 28 Feb 2023 05:31:42 -0500 Received: from michel.telenet-ops.be (michel.telenet-ops.be [IPv6:2a02:1800:110:4::f00:18]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A1FF06EB4 for ; Tue, 28 Feb 2023 02:31:37 -0800 (PST) Received: from ramsan.of.borg ([IPv6:2a02:1810:ac12:ed50:9202:974e:f0e0:414c]) by michel.telenet-ops.be with bizsmtp id SaXZ2900M1hKVeJ06aXZ5Z; Tue, 28 Feb 2023 11:31:35 +0100 Received: from rox.of.borg ([192.168.97.57]) by ramsan.of.borg with esmtp (Exim 4.95) (envelope-from ) id 1pWxGC-00ANGo-KM; Tue, 28 Feb 2023 11:31:33 +0100 Received: from geert by rox.of.borg with local (Exim 4.95) (envelope-from ) id 1pWxGf-00FbNQ-5O; Tue, 28 Feb 2023 11:31:33 +0100 From: Geert Uytterhoeven To: Brendan Higgins , David Gow Cc: linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com, linux-sh@vger.kernel.org, Geert Uytterhoeven Subject: [PATCH 2/2] kunit: tool: Add support for SH under QEMU Date: Tue, 28 Feb 2023 11:31:03 +0100 Message-Id: X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-kselftest@vger.kernel.org Add basic support to run SH under QEMU via kunit_tool using the virtualized r2d platform. Signed-off-by: Geert Uytterhoeven Reviewed-by: David Gow --- All tests succeed, except for the usual suspects. drivers/clk/.kunitconfig cannot be run as CONFIG_COMMON_CLK is not available. --- tools/testing/kunit/qemu_configs/sh.py | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 tools/testing/kunit/qemu_configs/sh.py diff --git a/tools/testing/kunit/qemu_configs/sh.py b/tools/testing/kunit/qemu_configs/sh.py new file mode 100644 index 0000000000000000..78a474a5b95f3a7d --- /dev/null +++ b/tools/testing/kunit/qemu_configs/sh.py @@ -0,0 +1,17 @@ +# SPDX-License-Identifier: GPL-2.0-only +from ..qemu_config import QemuArchParams + +QEMU_ARCH = QemuArchParams(linux_arch='sh', + kconfig=''' +CONFIG_CPU_SUBTYPE_SH7751R=y +CONFIG_MEMORY_START=0x0c000000 +CONFIG_SH_RTS7751R2D=y +CONFIG_RTS7751R2D_PLUS=y +CONFIG_SERIAL_SH_SCI=y''', + qemu_arch='sh4', + kernel_path='arch/sh/boot/zImage', + kernel_command_line='console=ttySC1', + serial='null', + extra_qemu_params=[ + '-machine', 'r2d', + '-serial', 'mon:stdio'])