From patchwork Mon Oct 14 11:36:42 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Patchwork-Id: 835663 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 25CB6197A7F; Mon, 14 Oct 2024 11:36:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728905818; cv=none; b=mLwL837eTp6S8jUQ0mgu7kXXM3TmXLmqnOH0P5eQ0ih+DpYLdwK1BXCO94uaMg8E2C9MheGld28Wqtri2YV/YwlFT9Ty/Xs9mNCLhV/i42YmCdKwPunP2jSM3Eeh1lUWmlgyRZVsaWv6wGfSjN/tQXE9NN8eMAiXC8WMDo0TrEI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728905818; c=relaxed/simple; bh=kSJZarY2z94X+3xL5Dh3VLdVKOYPHcJphuWhWCcRZ9A=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=LHO+RUMiPiWxaHibHKZ2sAzt1uKvrlv3AhwcyNf/+vWsJ/UWThInNlxF4Vfa5FKrmEHYSaDnLnSIKXqqgy/O/2xAZWt1F+ENBBNP+kxgPCRB9Or+snayqNNbtOzooZuSmauDJgTMfCq/n7084HN0zrhkqMhqWG8Jk4c1/0kon4g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=e8b2Ltvn; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=Vn6R1vmr; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="e8b2Ltvn"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="Vn6R1vmr" From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1728905815; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=d1+jZEqucYiU1F2rEs1tJbHqPXnN7gfk5dJrwm4cXRU=; b=e8b2LtvnIPlQNKvndj4Eu/qNiWl60X/4jzRlIs7ARJ8gZOG0cZEYySmq+15901RaCs6uOZ c7fS1IaCXF4T1dRk+G+nQdicxvF8sgPwvm0w4dQmzhjPc29UZtZJ41Oy64Ah9iapQpkYVv XR9uP6x9h7cJOqv4pbC0WxeaxwuYPXLiYuR2ocjQMEbDAyGxddtgXeCGz/SSjeXs+c6jkS pgVqsbCRBVJaoxJU8LRcbCWtjT5ozcNH4SLec+Yyqm67m/zzY/UjTXtJMslMu6AchO1F3R S+AqtnnzIyIqGLKbr3s+fm0JgsvD+hBLspXUJotlwS0ExOCyBsS9kxDmCe3G4w== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1728905815; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=d1+jZEqucYiU1F2rEs1tJbHqPXnN7gfk5dJrwm4cXRU=; b=Vn6R1vmrNroEp0fnkH67IQ2vJVD73wbv0C8JkuntWzXcp2zsldxWOHs7oTfFX++IYnQFmW ZI1Qx0qKxJdheqBA== Date: Mon, 14 Oct 2024 13:36:42 +0200 Subject: [PATCH 1/4] LoongArch: Don't crash in stack_top() for tasks without vDSO Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241014-kunit-loongarch-v1-1-1699b2ad6099@linutronix.de> References: <20241014-kunit-loongarch-v1-0-1699b2ad6099@linutronix.de> In-Reply-To: <20241014-kunit-loongarch-v1-0-1699b2ad6099@linutronix.de> To: Huacai Chen , WANG Xuerui , Jiaxun Yang , Brendan Higgins , David Gow , Rae Moar Cc: loongarch@lists.linux.dev, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com, =?utf-8?q?Tho?= =?utf-8?q?mas_Wei=C3=9Fschuh?= X-Developer-Signature: v=1; a=ed25519-sha256; t=1728905811; l=1878; i=thomas.weissschuh@linutronix.de; s=20240209; h=from:subject:message-id; bh=kSJZarY2z94X+3xL5Dh3VLdVKOYPHcJphuWhWCcRZ9A=; b=wW/i4s60xhVIYXXE3HBqscJ+MQg3YWy/nOdbmhVNj6ec07TysLo1111FKSVmBn+BSRNOtnXjV XAi28MJhxSWAA/KqBKJ0qNG8JLKzNPyJPXYISTIJS0oaG37P6lmza80 X-Developer-Key: i=thomas.weissschuh@linutronix.de; a=ed25519; pk=pfvxvpFUDJV2h2nY0FidLUml22uGLSjByFbM6aqQQws= Not all tasks have a vDSO mapped, for example kthreads never do. If such a task ever ends up calling stack_top(), it will derefence the NULL vdso pointer and crash. This can for example happen when using kunit: [<9000000000203874>] stack_top+0x58/0xa8 [<90000000002956cc>] arch_pick_mmap_layout+0x164/0x220 [<90000000003c284c>] kunit_vm_mmap_init+0x108/0x12c [<90000000003c1fbc>] __kunit_add_resource+0x38/0x8c [<90000000003c2704>] kunit_vm_mmap+0x88/0xc8 [<9000000000410b14>] usercopy_test_init+0xbc/0x25c [<90000000003c1db4>] kunit_try_run_case+0x5c/0x184 [<90000000003c3d54>] kunit_generic_run_threadfn_adapter+0x24/0x48 [<900000000022e4bc>] kthread+0xc8/0xd4 [<9000000000200ce8>] ret_from_kernel_thread+0xc/0xa4 Fixes: 803b0fc5c3f2 ("LoongArch: Add process management") Signed-off-by: Thomas Weißschuh --- arch/loongarch/kernel/process.c | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/arch/loongarch/kernel/process.c b/arch/loongarch/kernel/process.c index f2ff8b5d591e4fd638109d2c98d75543c01a112c..6e58f65455c7ca3eae2e88ed852c8655a6701e5c 100644 --- a/arch/loongarch/kernel/process.c +++ b/arch/loongarch/kernel/process.c @@ -293,13 +293,15 @@ unsigned long stack_top(void) { unsigned long top = TASK_SIZE & PAGE_MASK; - /* Space for the VDSO & data page */ - top -= PAGE_ALIGN(current->thread.vdso->size); - top -= VVAR_SIZE; - - /* Space to randomize the VDSO base */ - if (current->flags & PF_RANDOMIZE) - top -= VDSO_RANDOMIZE_SIZE; + if (current->thread.vdso) { + /* Space for the VDSO & data page */ + top -= PAGE_ALIGN(current->thread.vdso->size); + top -= VVAR_SIZE; + + /* Space to randomize the VDSO base */ + if (current->flags & PF_RANDOMIZE) + top -= VDSO_RANDOMIZE_SIZE; + } return top; } From patchwork Mon Oct 14 11:36:43 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Patchwork-Id: 835279 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D04E31922CA; Mon, 14 Oct 2024 11:36:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728905819; cv=none; b=CUZHAsvM4/51Vd2hThtdh7jTV8vIp9/1ZlspJOcZB+2ui4YgoOkWB448GKYauwItlkBKowbJwrmHrZZc9RFdq6guuNmTRhSfC5k3IsbiCcfquQOentce1u32c86VrlPygZUO6WjNpLtX02Twi6vSbPcqt55cjfreXoqdmCbUdyc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728905819; c=relaxed/simple; bh=HfaIZkVQ2Ehy5PgvdYYtum//iKrrszeXOAZiOvTB5c8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=cviDl73JKIfNCeKltYdD7TLzhNOicE6fYJ78vEFKriyHhSPmQ56XHSXB90Ko31K1mP32oBX1yMENdrDGIfcYjK6ONUQEhPuLJBXt1WUsNNMq7A8RyJBjgbQcpnkz+/cuBgH97VtDPGe9TI2di7rK/lAhDNXCKWj66Lq0wGk5gI8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=vW50XccO; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=+BPADPfk; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="vW50XccO"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="+BPADPfk" From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1728905816; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=S7VYLGYLqzSV2mxL+JEBIPWdWkYJ6W05nNMBLA96WmY=; b=vW50XccOacAGwWxJdiJSoe2FjAw9RWy4kinILGRMgSGdM+afpCHel7nru7lGbZvc4hXQ9H J3dZud04h+uaOtvsXs4fmVS192Mx/ar1euUb6y71X/PlKgIyGToOalJUkpkdIEqN1pS9gm Hwxsja82TbhUTGbWt06hmZcBq+sSZAvwW9Y+nwm6W4ojr+2fZJS54yGWGpcUi0N1tOqut1 pQUcXZeKyNCxAahT0tVn/6I81ugsWLzTZflpR7JmVBCWiLscTd4tZooyLsJLhedJQz6IAY bi3rUfFn1c8H50zvweuNjFU5sB8XnSuP6CW6jFCLV8z5gB1VdV2RTUnUbpgr+g== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1728905816; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=S7VYLGYLqzSV2mxL+JEBIPWdWkYJ6W05nNMBLA96WmY=; b=+BPADPfk/1iiT6ynHAOiftp7EtBWB1xYmSL8J9i93rgBMy9BPhAHDdhPQDZNfin52s6YEC gHwsbHg9qtGnJ1Cg== Date: Mon, 14 Oct 2024 13:36:43 +0200 Subject: [PATCH 2/4] kunit: qemu_configs: add LoongArch config Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241014-kunit-loongarch-v1-2-1699b2ad6099@linutronix.de> References: <20241014-kunit-loongarch-v1-0-1699b2ad6099@linutronix.de> In-Reply-To: <20241014-kunit-loongarch-v1-0-1699b2ad6099@linutronix.de> To: Huacai Chen , WANG Xuerui , Jiaxun Yang , Brendan Higgins , David Gow , Rae Moar Cc: loongarch@lists.linux.dev, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com, =?utf-8?q?Tho?= =?utf-8?q?mas_Wei=C3=9Fschuh?= X-Developer-Signature: v=1; a=ed25519-sha256; t=1728905811; l=1114; i=thomas.weissschuh@linutronix.de; s=20240209; h=from:subject:message-id; bh=HfaIZkVQ2Ehy5PgvdYYtum//iKrrszeXOAZiOvTB5c8=; b=xnkirkC7lH0ga6Y65QuSgoJhMiIyIOrl3EC8JduOKELXHJHS4XnciTxIr0tZH7rvDbMPBzF0v VdcfqHMO94SBHncVKDJ8aliGciYjEKmU6KKFeRmruHz1gC5+/gjaR1i X-Developer-Key: i=thomas.weissschuh@linutronix.de; a=ed25519; pk=pfvxvpFUDJV2h2nY0FidLUml22uGLSjByFbM6aqQQws= Add a basic config to run kunit tests on LoongArch. This requires QEMU 9.1.0 or later for the necessary direct kernel boot support. Signed-off-by: Thomas Weißschuh Reviewed-by: David Gow --- tools/testing/kunit/qemu_configs/loongarch.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/tools/testing/kunit/qemu_configs/loongarch.py b/tools/testing/kunit/qemu_configs/loongarch.py new file mode 100644 index 0000000000000000000000000000000000000000..e7bb7c07819677dfdefac012821a732555813cae --- /dev/null +++ b/tools/testing/kunit/qemu_configs/loongarch.py @@ -0,0 +1,16 @@ +from ..qemu_config import QemuArchParams + +QEMU_ARCH = QemuArchParams(linux_arch='loongarch', + kconfig=''' +CONFIG_EFI_STUB=n +CONFIG_PCI_HOST_GENERIC=y +CONFIG_SERIAL_8250=y +CONFIG_SERIAL_8250_CONSOLE=y +CONFIG_SERIAL_OF_PLATFORM=y +''', + qemu_arch='loongarch64', + kernel_path='arch/loongarch/boot/vmlinux.elf', + kernel_command_line='console=ttyS0', + extra_qemu_params=[ + '-machine', 'virt', + '-cpu', 'max',]) From patchwork Mon Oct 14 11:36:44 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Patchwork-Id: 835661 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 84F64176AAD; Mon, 14 Oct 2024 11:36:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728905821; cv=none; b=NU2Rkstr/PMArzTzRuU5njgefyDZFt/trS1JVNaaXu5hIXMHLEsQgzEUDNEhN7oUMcsgxMv4SZAlhzMABLbiB79XN/7aBt+ad89vUJVf6fVNPmWkRMlTvEH34uKNytcHi82hC322toqQQ3WBZVjHF/HxK/djFP595I6Ge2XpldU= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728905821; c=relaxed/simple; bh=iV9iYcnvXEvBIGYtw1XBB2r0gTapDMBeog8rfya7C0o=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=iy477pPA84nb2J3NTPhM+eF8Wlv69HtYVkmQs34UiPtVVNJHSy1BwCr6bVHFjk/GnTUMr8oE3UprHRezDxNk791Ojq7m4ZVdL9yxOkWf1QOH86uipdJeadGqvX4RMNeLOeI/1Iyw+4IEwcyOzRifgMac4FNs4bewpqCr+CZ3gAc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=e4CTyyOx; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=Zg14PZAl; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="e4CTyyOx"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="Zg14PZAl" From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1728905816; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GLsVtAZb2EYpxmn9symEBJzk9S6QfVhcbYEMjgcfIsg=; b=e4CTyyOxYILPG30h7pyThAUs8wD14RA0jZPAGrDei0jOty3abXFwa3AbDtsH5+pbP9MN+J 5Mlnl3UO2PNYTVtvJlfiSJqJgvOPYq7TDEQLDU/K0qsa42msfKyG3w4LVG6arYrZzH/IrG KF2QvMOGdyGyz7JKsRju6a2YahsQv5lwwdxXok3wOYdrpq8gtqvn1396EmmlXafUNCw4/g ZkqwDpSkFGNXvdylwH6mMjiZiGWEvzoFKO7/vT+rTEZFxiQOWnZTaOjenwy/rOXq92YNM1 7O7/KRdotpPYTdM/Ssxp8kn4zewI2/x2gL9di4nTsMR54KHhQfGMakVw5hv3qQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1728905816; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=GLsVtAZb2EYpxmn9symEBJzk9S6QfVhcbYEMjgcfIsg=; b=Zg14PZAlJEQcDEen6OHbhXImV/XxL1LGb2tNHCVB9g3JtdLOjgV5KwECbFsjohAmVMyGts D4dBHaj5SMX+bDCA== Date: Mon, 14 Oct 2024 13:36:44 +0200 Subject: [PATCH 3/4] kunit: tool: Allow overriding the shutdown mode from qemu config Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241014-kunit-loongarch-v1-3-1699b2ad6099@linutronix.de> References: <20241014-kunit-loongarch-v1-0-1699b2ad6099@linutronix.de> In-Reply-To: <20241014-kunit-loongarch-v1-0-1699b2ad6099@linutronix.de> To: Huacai Chen , WANG Xuerui , Jiaxun Yang , Brendan Higgins , David Gow , Rae Moar Cc: loongarch@lists.linux.dev, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com, =?utf-8?q?Tho?= =?utf-8?q?mas_Wei=C3=9Fschuh?= X-Developer-Signature: v=1; a=ed25519-sha256; t=1728905811; l=1298; i=thomas.weissschuh@linutronix.de; s=20240209; h=from:subject:message-id; bh=iV9iYcnvXEvBIGYtw1XBB2r0gTapDMBeog8rfya7C0o=; b=RSxObr6NF8M25HxJfwEBRbSNlGHQZpyR+R6RVKYbEeiHcGbJOEzHt2uPWVZk0Kfd0cNnEvyMH DrroxlD65g+AUZOqsRA84e8zEx/BlWQnwvnAYAOT0sybIrB0hExU1Dt X-Developer-Key: i=thomas.weissschuh@linutronix.de; a=ed25519; pk=pfvxvpFUDJV2h2nY0FidLUml22uGLSjByFbM6aqQQws= Not all platforms support machine reboot. If it a proper reboot is not supported the machine will hang. Allow the QEMU configuration to override the necessary shutdown mode for the specific system under test. Signed-off-by: Thomas Weißschuh Reviewed-by: David Gow --- tools/testing/kunit/kunit_kernel.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/tools/testing/kunit/kunit_kernel.py b/tools/testing/kunit/kunit_kernel.py index 61931c4926fd6645f2c62dd13f9842a432ec4167..e76d7894b6c5195ece49f0d8c7ac35130df428a9 100644 --- a/tools/testing/kunit/kunit_kernel.py +++ b/tools/testing/kunit/kunit_kernel.py @@ -105,7 +105,9 @@ class LinuxSourceTreeOperationsQemu(LinuxSourceTreeOperations): self._kconfig = qemu_arch_params.kconfig self._qemu_arch = qemu_arch_params.qemu_arch self._kernel_path = qemu_arch_params.kernel_path - self._kernel_command_line = qemu_arch_params.kernel_command_line + ' kunit_shutdown=reboot' + self._kernel_command_line = qemu_arch_params.kernel_command_line + if 'kunit_shutdown=' not in self._kernel_command_line: + self._kernel_command_line += ' kunit_shutdown=reboot' self._extra_qemu_params = qemu_arch_params.extra_qemu_params self._serial = qemu_arch_params.serial From patchwork Mon Oct 14 11:36:45 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Patchwork-Id: 835662 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 97B6D19C557; Mon, 14 Oct 2024 11:36:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=193.142.43.55 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728905820; cv=none; b=qxbvINrrBRHYyK4HYzvH/lElM78+bnuAXS3Y3ZYZxnpoDIZF2vGH02dRE7YAGsuDSWGu1hXDRFyiYTm4FDLWlFzB31RGTUFTTee1IRHsv1NYKVOPeoVeH4yIX1ZOozqMCkyzJvH9LGLOMIRzN8Fnd++vNDiduDYN0798qZ+JFk4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1728905820; c=relaxed/simple; bh=L2g9um9oivjoyxdDxHIjYJE+3H3VkzceTni0Q/yD3cw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=TKp16Y298S4bJ2XZ8Y75yQeYA+b0uFw6rPcyR/YGec5Y91Bxq0o9OzeG1ECO8m56UPrB4rVsWzX+Cp2Ovkl9KrFfD1hFrMFKkw3ZOZ5rTcvKgZjobSQViHdHhrv0ULXFFuzaKPxhxupaEShdHuPyB5PBB+zTO1mN7ugZi5n8/l4= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de; spf=pass smtp.mailfrom=linutronix.de; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=j2xo15mJ; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b=w5lO+OBI; arc=none smtp.client-ip=193.142.43.55 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linutronix.de Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linutronix.de Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="j2xo15mJ"; dkim=permerror (0-bit key) header.d=linutronix.de header.i=@linutronix.de header.b="w5lO+OBI" From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1728905817; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0ZWjQkkdi8HSm2h1+TS/T+pWxvqm9LlF9rGfeZByhFs=; b=j2xo15mJirgy1wRhLsvcZBiHaaoUN/Z9ZLITThaskd1RNdFiZUSdA/kY7q28m2KQrXRlMR ZbwV+7O26CjKGKR49JTtsSihLIWzA5gtTawjLAyZtHMKxn736gyTHIPE6E9ZwTsNjdPyRt nHKEzxh7b7nZc8cE8PgrGjk5RXfm4fvoDBCkfpreN9Mil2VPsq00VZr3RlbLwQAyfcttl/ D/XKObNBLKRvKJ/GjdjrYcS0xr76lsa2Z8vsam27IBhc1i3KT21dRTgyag3eyMtSkmmPMp 7nzM3bncXNFQq9BuNPOjeyZFzxO45Ayk1NWF3cj3V6QUz2eVpQyfjRw8vLCNEQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1728905817; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=0ZWjQkkdi8HSm2h1+TS/T+pWxvqm9LlF9rGfeZByhFs=; b=w5lO+OBIralzMDIkhgE0hCSQRWJXYi4hIozL22ikZ0V5EuOCc/VV97LiYFQVvorAbZ2/aV CiVF8skM+UWiEnBQ== Date: Mon, 14 Oct 2024 13:36:45 +0200 Subject: [PATCH 4/4] kunit: qemu_configs: loongarch: Enable shutdown Precedence: bulk X-Mailing-List: linux-kselftest@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241014-kunit-loongarch-v1-4-1699b2ad6099@linutronix.de> References: <20241014-kunit-loongarch-v1-0-1699b2ad6099@linutronix.de> In-Reply-To: <20241014-kunit-loongarch-v1-0-1699b2ad6099@linutronix.de> To: Huacai Chen , WANG Xuerui , Jiaxun Yang , Brendan Higgins , David Gow , Rae Moar Cc: loongarch@lists.linux.dev, linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com, =?utf-8?q?Tho?= =?utf-8?q?mas_Wei=C3=9Fschuh?= X-Developer-Signature: v=1; a=ed25519-sha256; t=1728905811; l=1335; i=thomas.weissschuh@linutronix.de; s=20240209; h=from:subject:message-id; bh=L2g9um9oivjoyxdDxHIjYJE+3H3VkzceTni0Q/yD3cw=; b=G11ZFpQbnm6r+Vm9sYeV6cF810ymPsjl0nNNeRoZEJKTfYsIqaOmVHK+KjOAyctIcSN/hgjsA QKD2fT9tArUDWYiF8IUca3hB0N89AoStT5ObkrUnJu2Yv822Z74Pt4X X-Developer-Key: i=thomas.weissschuh@linutronix.de; a=ed25519; pk=pfvxvpFUDJV2h2nY0FidLUml22uGLSjByFbM6aqQQws= QEMU for LoongArch does not yet support shutdown/restart through ACPI. Use the pvpanic driver to enable shutdowns. This requires 9.1.0 for shutdown support in pvpanic, but that is the requirement of kunit on LoongArch anyways. Signed-off-by: Thomas Weißschuh Reviewed-by: David Gow --- tools/testing/kunit/qemu_configs/loongarch.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/tools/testing/kunit/qemu_configs/loongarch.py b/tools/testing/kunit/qemu_configs/loongarch.py index e7bb7c07819677dfdefac012821a732555813cae..1d2b780fbd5c0bde20aa6a5cd1217d0b3b443a93 100644 --- a/tools/testing/kunit/qemu_configs/loongarch.py +++ b/tools/testing/kunit/qemu_configs/loongarch.py @@ -4,13 +4,16 @@ QEMU_ARCH = QemuArchParams(linux_arch='loongarch', kconfig=''' CONFIG_EFI_STUB=n CONFIG_PCI_HOST_GENERIC=y +CONFIG_PVPANIC=y +CONFIG_PVPANIC_PCI=y CONFIG_SERIAL_8250=y CONFIG_SERIAL_8250_CONSOLE=y CONFIG_SERIAL_OF_PLATFORM=y ''', qemu_arch='loongarch64', kernel_path='arch/loongarch/boot/vmlinux.elf', - kernel_command_line='console=ttyS0', + kernel_command_line='console=ttyS0 kunit_shutdown=poweroff', extra_qemu_params=[ '-machine', 'virt', + '-device', 'pvpanic-pci', '-cpu', 'max',])