From nobody Fri Sep 25 11:07:39 2026 Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) (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 149B2392C25; Sun, 13 Sep 2026 23:50:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=159.69.126.157 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789343429; cv=none; b=P8G6fJopy9puLMq1d/KeZZNIWbGLPUAYZMNnlT7bJtW1ASG72WwxsNujpC/Jh/KKWJMWiXXCiCL+np2qr2MyPfJEfHRCvPIl1r6OMEGId+fDyBnxpG8jCHU1h1HEPNF1fTG2JZR0hMAStXFo3ZesGPTXQV64RWSfmYy1aCh6ODs= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789343429; c=relaxed/simple; bh=0J+FM3DgylRCkiex+2g+WBKWTN3pZvI6BIC1xKGYLjE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=rwZ0HBhiWhYNPse/lL7fuissE2gl6UA5onhBenlINGWNR2nwGht+rDU2BZpLU5sDEiY3K1A+lGCtdjWM1zZsj+MCrvsPGtxSpI48Kkl40ZrFS/rSvz2tzRg6D4j5DouKL3RhdFCR9im/3co9lb/cBIXrLjMp6czgOAcCRBQTDa0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net; spf=pass smtp.mailfrom=weissschuh.net; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b=b1JZebpr; arc=none smtp.client-ip=159.69.126.157 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b="b1JZebpr" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1789343422; bh=0J+FM3DgylRCkiex+2g+WBKWTN3pZvI6BIC1xKGYLjE=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=b1JZebprQ7niRJFcC57tulQIbzGjXHbFGkt8FpV0YzRbYv2cejNzjZlpdKtDHViJB N3+8idW0xe8BIH3uE79/waQ5FWcEcaQTF2qHActL1Jt8H+lRpt/yP2fCDOrGp87cF3 jJsuiUFxLna2I20o1ZQ7ZQ8wI64jQpT/RT0ie6bM= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Mon, 14 Sep 2026 01:50:08 +0200 Subject: [PATCH v2 1/5] microblaze: uaccess: Zero out destination on failed get_user() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260914-kunit-microblaze-v2-1-7d5756e858f8@weissschuh.net> References: <20260914-kunit-microblaze-v2-0-7d5756e858f8@weissschuh.net> In-Reply-To: <20260914-kunit-microblaze-v2-0-7d5756e858f8@weissschuh.net> To: Michal Simek , Brendan Higgins , David Gow , Rae Moar Cc: linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1789343420; l=1081; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=0J+FM3DgylRCkiex+2g+WBKWTN3pZvI6BIC1xKGYLjE=; b=S9hVt93u6sjnYg34rrmE1Wr14EdxdTjVqLieaIdK8DxJApjv07ON8Iw+6ltoDl7LPGW8YCVz1 FgKb1C//BHcCQqYpOWW99oCy5/+HJh5ORErA4DCQHYFbz90pAhzPvRH X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= On failure get_user() is supposed to zero out the destination variable. This is documented in the kdoc of the microblaze get_user() implementation and validated in lib/tests/usercopy_kunit.c. Currently that zeroing is missing. Add it. Fixes: 0d6de9532663 ("microblaze_mmu_v2: uaccess MMU update") Signed-off-by: Thomas Wei=C3=9Fschuh Reviewed-by: David Gow --- arch/microblaze/include/asm/uaccess.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/arch/microblaze/include/asm/uaccess.h b/arch/microblaze/includ= e/asm/uaccess.h index afa0dd8d013f..77203af255e5 100644 --- a/arch/microblaze/include/asm/uaccess.h +++ b/arch/microblaze/include/asm/uaccess.h @@ -95,7 +95,8 @@ extern long __user_bad(void); #define get_user(x, ptr) ({ \ const typeof(*(ptr)) __user *__gu_ptr =3D (ptr); \ access_ok(__gu_ptr, sizeof(*__gu_ptr)) ? \ - __get_user(x, __gu_ptr) : -EFAULT; \ + __get_user(x, __gu_ptr) : \ + ((x) =3D 0, -EFAULT); \ }) =20 #define __get_user(x, ptr) \ --=20 2.55.0 From nobody Fri Sep 25 11:07:39 2026 Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) (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 E5F77386C12; Sun, 13 Sep 2026 23:50:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=159.69.126.157 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789343428; cv=none; b=FIu79avnIcAakLnAdcGZblT6AVF1HUvENb4ZLhHQA5FNgpqUEhondbYNF3V/M6ftC6OkDG0JPU5jHeynjFM/g60foY5xhKISzBKip2IKVSD407Zx5145csVu3R9b0DoZkL1kk5ZzAmGfdkiVVdccTqmhW2Fh96WsMTAcYMGsj7s= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789343428; c=relaxed/simple; bh=spOLWJ0AT1LoUd1wenGeTkrlYwKJabco7j2luwxNOCs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Ktzbz0iaMjpcNT0BAaKPuMoyVdUxLSa4V20wkbZwul7XGfzPH/dqyCy6AyBAohc7x82BoJF50B4EN/ndQdARkrWMJq6y4AhVN/fEWXary03cJrY/dbTmZSAcleMWmzqpeEoG/7zqPLRbp/yVm4bONO5zZkwanvmeRKHskWeNnmA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net; spf=pass smtp.mailfrom=weissschuh.net; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b=bjHe5R0l; arc=none smtp.client-ip=159.69.126.157 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b="bjHe5R0l" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1789343423; bh=spOLWJ0AT1LoUd1wenGeTkrlYwKJabco7j2luwxNOCs=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=bjHe5R0l2wdv58koUu5oKLZQvlZVaFCo1Drr90P5n8brgfjB7fibEUlQMPOQ73Xr2 4mq8OOgdRI4bd9akJh51fxqny8Z8rhaEXNFnELmW4SFshlM0inI8fMw1Sit9NaMcJ1 x/0xnAnnD9nRXPu/8EZVpmKv+My83ee3hrOz/Ezc= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Mon, 14 Sep 2026 01:50:09 +0200 Subject: [PATCH v2 2/5] microblaze: Pass -m{big,little}-endian through KBUILD_CPPFLAGS Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260914-kunit-microblaze-v2-2-7d5756e858f8@weissschuh.net> References: <20260914-kunit-microblaze-v2-0-7d5756e858f8@weissschuh.net> In-Reply-To: <20260914-kunit-microblaze-v2-0-7d5756e858f8@weissschuh.net> To: Michal Simek , Brendan Higgins , David Gow , Rae Moar Cc: linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1789343420; l=1579; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=spOLWJ0AT1LoUd1wenGeTkrlYwKJabco7j2luwxNOCs=; b=zNQqs3kRuZI/aiHy5E0kQTLQVIUGHehFHotDa7vnk24s/+pzJw1CPM8FNPQb+l+hz06e7maHR bZ0dxWGx/LxBWpdxIAEMp8mAxKIoC5+TDvVRnrBJxICn7WYYk0f3+AX X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= These parameters are also necessary for preprocessed files which do not contain code. One example is arch/microblaze/kernel/vmlinux.lds.S which inspects __MICROBLAZEEL__ for the definition of 'jiffies_64'. As currently the endianness is not passed from the build system for this file, the preprocessor will instead use the default endianness of the toolchain. When a default big-endian toolchain is used to build a little-endian kernel, that kernel will hang during delay calibration as 'jiffies' never changes. Make sure all preprocessor invocations know about the correct endianness by passing it through KBUILD_CPPFLAGS. This will also be inherited by CFLAGS and AFLAGS. Fixes: 02b08045a030 ("microblaze: Add support for little-endian Microblaze") Signed-off-by: Thomas Wei=C3=9Fschuh --- arch/microblaze/Makefile | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/arch/microblaze/Makefile b/arch/microblaze/Makefile index 02e6be9c5b0d..9087a366ce78 100644 --- a/arch/microblaze/Makefile +++ b/arch/microblaze/Makefile @@ -34,12 +34,10 @@ CPUFLAGS-$(CONFIG_XILINX_MICROBLAZE0_USE_BARREL) +=3D -= mxl-barrel-shift CPUFLAGS-$(CONFIG_XILINX_MICROBLAZE0_USE_PCMP_INSTR) +=3D -mxl-pattern-com= pare =20 ifdef CONFIG_CPU_BIG_ENDIAN -KBUILD_CFLAGS +=3D -mbig-endian -KBUILD_AFLAGS +=3D -mbig-endian +KBUILD_CPPFLAGS +=3D -mbig-endian KBUILD_LDFLAGS +=3D -EB else -KBUILD_CFLAGS +=3D -mlittle-endian -KBUILD_AFLAGS +=3D -mlittle-endian +KBUILD_CPPFLAGS +=3D -mlittle-endian KBUILD_LDFLAGS +=3D -EL endif =20 --=20 2.55.0 From nobody Fri Sep 25 11:07:39 2026 Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) (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 B469D3E51E2; Sun, 13 Sep 2026 23:50:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=159.69.126.157 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789343431; cv=none; b=NlrvYOQChbjFHatI1YZjDIDtIYVkgD/OQc1VdjR/Jmv8UJwtCdjI1JHuKARL8LiIBZhBzOvfyHWSsmEJDi4bpiht0pY1AcldTt0FE/MF+RqSYl8JKJuGJvF+Gc8BVZuNP5lksqlwC+rMOveWkWj2+HTQTwr8uXCVyfOzCnqNS2I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789343431; c=relaxed/simple; bh=47t/BnchK8lADjlejQ0oF1vY5hblA9MezhK+dtcxmUY=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=O1sVtwkIH4BsZSwLxY78ixdG7eEBuqlD+pL/woup+Mh9Gp18XlGRVmDjiHYWXBnHcp2hr4LZGoPlXQOP4MzTc6T6WYrvhkYolNpRLCS8JRsQebclWCX9T14me09EZuoB4xELxof/t3TS2m/Dm0NLoTnDDtAlK2CV/zF3a7e37EQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net; spf=pass smtp.mailfrom=weissschuh.net; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b=LuUdVZ40; arc=none smtp.client-ip=159.69.126.157 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b="LuUdVZ40" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1789343423; bh=47t/BnchK8lADjlejQ0oF1vY5hblA9MezhK+dtcxmUY=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=LuUdVZ40b0vDKGt+UuGkWTt4d5q4m91ST5UhukOh0HCV3nR8ffqBZ3jhor6g+jTFu pGXLDCkDaTyQpmfbAESOV6C7dG2FhGiGHdVYXB/zWuEaApSQUJNRHE1NoFkkMqSkBk L5cERnpQ578mMJlN+vhaWUNMccyH4HwYgsQhiZFw= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Mon, 14 Sep 2026 01:50:10 +0200 Subject: [PATCH v2 3/5] microblaze: reset: Call POWER_OFF handlers Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260914-kunit-microblaze-v2-3-7d5756e858f8@weissschuh.net> References: <20260914-kunit-microblaze-v2-0-7d5756e858f8@weissschuh.net> In-Reply-To: <20260914-kunit-microblaze-v2-0-7d5756e858f8@weissschuh.net> To: Michal Simek , Brendan Higgins , David Gow , Rae Moar Cc: linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1789343420; l=776; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=47t/BnchK8lADjlejQ0oF1vY5hblA9MezhK+dtcxmUY=; b=tkxh/ivHiCi9L0Dn7U7gbs961EgxOmXkB7CMUHGscF5EsWy1sJgglXa7PZUogD8L7//88skEf 6/iWki82p7+BiMS9Y/wX3o+WyADpEEASJoc+1kpsZtm0jIyT8toOszP X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= System power off might be implemented through sys_off handlers. Currently these are not respected on microblaze. On power_off call into the generic power off function which will execute all regustered handlers. Signed-off-by: Thomas Wei=C3=9Fschuh Acked-by: David Gow --- arch/microblaze/kernel/reset.c | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/microblaze/kernel/reset.c b/arch/microblaze/kernel/reset.c index 2f66c7963084..774bc1f79119 100644 --- a/arch/microblaze/kernel/reset.c +++ b/arch/microblaze/kernel/reset.c @@ -28,6 +28,7 @@ void machine_halt(void) void machine_power_off(void) { pr_notice("Machine power off...\n"); + do_kernel_power_off(); while (1) ; } --=20 2.55.0 From nobody Fri Sep 25 11:07:39 2026 Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) (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 B24ED3E49CB; Sun, 13 Sep 2026 23:50:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=159.69.126.157 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789343430; cv=none; b=iSi52jurTAPZDN6Wu3CRVh4NY2zt+BBloDjfSegtjw2ILm4TeDT+l2BrUja60etQTyiz3I9eyH4J+AxbZawvtbuP87enU9pYe3/hU7TzOaTi3c4XApBKBue1VKVO3LLWhqXpmtFAQNs05q8jTAi4gIccXdRd0dJO2KuM5pm5A+g= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789343430; c=relaxed/simple; bh=coN69LJf3sKMTzz7yrlr3DPNCHcPQEiBNoxBEnrxxy0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=W9HsZyBBN7FCJItch7+D5BdADT+0/xmhLvH1WpBFNwNrMC+qMpgmWZEzl3gflT55kL3QPGNbcstXWYfJsy/trhmJnvURssr8BiWg/XyIHMgcYnMJbc5B4JA/RUcQWfNL5FqrUpynKuhGq8b/jru6z6U7laef93GJcQhUwA7yJiM= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net; spf=pass smtp.mailfrom=weissschuh.net; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b=LVFIJnm4; arc=none smtp.client-ip=159.69.126.157 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b="LVFIJnm4" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1789343423; bh=coN69LJf3sKMTzz7yrlr3DPNCHcPQEiBNoxBEnrxxy0=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=LVFIJnm4I+OyT+vVr6u9FjxSAf6XqqW4psV6lIJts/lRQ3zb4NwOihcM5aCWGvs5Q 9Tnt94rijBGnc5bXxjR1DoN6WA+MZLl+bt/1uhQbiGYacjl4F7At25tycS+w4JsLhT QZxLFkfvLzHUnlZuCUcT8k1YL8AYCkyd5OyAVO44= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Mon, 14 Sep 2026 01:50:11 +0200 Subject: [PATCH v2 4/5] microblaze: reset: Provide a power off handler through an unaligned PC Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260914-kunit-microblaze-v2-4-7d5756e858f8@weissschuh.net> References: <20260914-kunit-microblaze-v2-0-7d5756e858f8@weissschuh.net> In-Reply-To: <20260914-kunit-microblaze-v2-0-7d5756e858f8@weissschuh.net> To: Michal Simek , Brendan Higgins , David Gow , Rae Moar Cc: linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1789343420; l=2320; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=coN69LJf3sKMTzz7yrlr3DPNCHcPQEiBNoxBEnrxxy0=; b=bYMIUSpSoA8TMnMdQffyr6Cd/dm5gX/qetulpC8yUikusQ8baMRS9B+34jarzvwJKuMfGh0dc YW7hEUmBSAtBhMetQuD4y4ZrJlBd2WNUyNNlydO/qmz0s4TnpbwiOUo X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= microblaze is missing a generic architecture-wide power off mechanism. To enable KUnit for microblaze it is necessary for KUnit to shut down the machine in a way that QEMU will recognize. The machines emulated by QEMU do not provide machine-specific power off functionality which could be used. However at least the petalogix-s3adsp1800 machine will abort if an unaligned instruction is executed. An ugly message will be printed but that is not an issue for KUnit. Make use of this to provide a power off handler. Signed-off-by: Thomas Wei=C3=9Fschuh Tested-by: David Gow --- This is quite hacky. But I didn't find a better solution. --- arch/microblaze/Kconfig | 9 +++++++++ arch/microblaze/kernel/reset.c | 21 +++++++++++++++++++++ 2 files changed, 30 insertions(+) diff --git a/arch/microblaze/Kconfig b/arch/microblaze/Kconfig index 484ebb3baedf..0ca8999dd770 100644 --- a/arch/microblaze/Kconfig +++ b/arch/microblaze/Kconfig @@ -216,3 +216,12 @@ config MB_MANAGER Say N here unless you know what you are doing. =20 endmenu + +config MB_POWER_OFF_THROUGH_UNALIGNED_PC + bool "Power off through unaligned PC" + help + This options adds a power off handler which executes an unaligned PC + so the machine resets in a generic way. This works for the + petalogix-s3adsp1800 QEMU machine. + + Say N here unless you know what you are doing. diff --git a/arch/microblaze/kernel/reset.c b/arch/microblaze/kernel/reset.c index 774bc1f79119..42031c535d48 100644 --- a/arch/microblaze/kernel/reset.c +++ b/arch/microblaze/kernel/reset.c @@ -41,3 +41,24 @@ void machine_restart(char *cmd) pr_emerg("Reboot failed -- System halted\n"); while (1); } + +#ifdef CONFIG_MB_POWER_OFF_THROUGH_UNALIGNED_PC +static int unaligned_pc_sys_off(struct sys_off_data *data) +{ + __asm__( + "bri 1\n" + ); + + return NOTIFY_DONE; +} + +static int __init register_unaligned_pc_sys_off(void) +{ + struct sys_off_handler *sys_off; + + sys_off =3D register_sys_off_handler(SYS_OFF_MODE_POWER_OFF, SYS_OFF_PRIO= _LOW, + unaligned_pc_sys_off, NULL); + return PTR_ERR_OR_ZERO(sys_off); +} +device_initcall(register_unaligned_pc_sys_off); +#endif /* CONFIG_MB_POWER_OFF_THROUGH_UNALIGNED_PC */ --=20 2.55.0 From nobody Fri Sep 25 11:07:39 2026 Received: from todd.t-8ch.de (todd.t-8ch.de [159.69.126.157]) (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 952473E3D9E; Sun, 13 Sep 2026 23:50:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=159.69.126.157 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789343435; cv=none; b=GGhv3u/pG4RoGb9+huLEqXxXX3RUIIS1klX2FtBRi2BZzUqIa9bbskAcm5qUBzUF9rjkEH1Nw3vRCKSgD5NOozWV6bFQUxtEVroBV0miOr/JLi02UHeEnVUiRM/aHJmq+nPF4Ay5SesDIm9dmaWfjFw5GedFSjq78xSFjiJT/S4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789343435; c=relaxed/simple; bh=GhDK7+iED9atD/ApSHODcxSUBxH7+/t/TGI7b7nhf20=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=eXtxFqHLsicIIgQsFCcyLWVMZtjXGBaz3TTA95f5Jt7XHqhsTwXQ1Ve3YfcubqWMYXU23ambJWevXY7MD1R+II48UWuovVbLg9bAEGq7GU/f76Ejhv+LPJnda3P+bpgjT9T7jdYh1ZNw8C4eO5dXavXqbhVxwD4U6GJ617EIvQU= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net; spf=pass smtp.mailfrom=weissschuh.net; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b=PuRGLgDY; arc=none smtp.client-ip=159.69.126.157 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=weissschuh.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=weissschuh.net header.i=@weissschuh.net header.b="PuRGLgDY" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1789343424; bh=GhDK7+iED9atD/ApSHODcxSUBxH7+/t/TGI7b7nhf20=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=PuRGLgDYWadUOyhIPrKkjnXuu+fQn85x961cXcFmL72H+tP78bjyl/xwyJHWiTE4M 7c0v5NqNiIikwlH6xGT9UKS4tAZ+RxvUJB6We6OHGvvXplM6GNULbMhonKdZesHcDc kzX650X6VCoo4+TBR8HPjeGf5cRcHsBeWnLWktbo= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Mon, 14 Sep 2026 01:50:12 +0200 Subject: [PATCH v2 5/5] kunit: qemu_configs: Add microblaze configurations Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20260914-kunit-microblaze-v2-5-7d5756e858f8@weissschuh.net> References: <20260914-kunit-microblaze-v2-0-7d5756e858f8@weissschuh.net> In-Reply-To: <20260914-kunit-microblaze-v2-0-7d5756e858f8@weissschuh.net> To: Michal Simek , Brendan Higgins , David Gow , Rae Moar Cc: linux-kernel@vger.kernel.org, linux-kselftest@vger.kernel.org, kunit-dev@googlegroups.com, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1789343420; l=2811; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=GhDK7+iED9atD/ApSHODcxSUBxH7+/t/TGI7b7nhf20=; b=FRvAmyX9eYFv0cGe8nrtCuwyXvzYDMPNNSHqgCFQSa59JAOmZ7dsQdFARBT8cM16B/DbzMpDA apeLanpWa/BCr4Eq7tkaagU8w1nzDKSu+cHrwh06xxI2vujyGvbzlQW X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= Add basic configurations to run kunit tests on big and little endian microblaze. Suggested-by: Michal Simek Link: https://lore.kernel.org/lkml/5cd8df03-ad51-460c-9b20-3bf288831b5a@amd= .com/ Signed-off-by: Thomas Wei=C3=9Fschuh Reviewed-by: David Gow --- tools/testing/kunit/qemu_configs/microblazebe.py | 24 ++++++++++++++++++++ tools/testing/kunit/qemu_configs/microblazeel.py | 28 ++++++++++++++++++++= ++++ 2 files changed, 52 insertions(+) diff --git a/tools/testing/kunit/qemu_configs/microblazebe.py b/tools/testi= ng/kunit/qemu_configs/microblazebe.py new file mode 100644 index 000000000000..f37b7af20142 --- /dev/null +++ b/tools/testing/kunit/qemu_configs/microblazebe.py @@ -0,0 +1,24 @@ +# SPDX-License-Identifier: GPL-2.0-only +from ..qemu_config import QemuArchParams + +QEMU_ARCH =3D QemuArchParams(linux_arch=3D'microblaze', + kconfig=3D''' +CONFIG_KERNEL_BASE_ADDR=3D0x90000000 +CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR=3D1 +CONFIG_XILINX_MICROBLAZE0_USE_PCMP_INSTR=3D1 +CONFIG_XILINX_MICROBLAZE0_USE_BARREL=3D1 +CONFIG_XILINX_MICROBLAZE0_USE_DIV=3D0 +CONFIG_XILINX_MICROBLAZE0_USE_HW_MUL=3D1 +CONFIG_XILINX_MICROBLAZE0_USE_FPU=3D0 +CONFIG_CPU_BIG_ENDIAN=3Dy +CONFIG_SERIAL_UARTLITE=3Dy +CONFIG_SERIAL_UARTLITE_CONSOLE=3Dy +CONFIG_MB_POWER_OFF_THROUGH_UNALIGNED_PC=3Dy +''', + qemu_arch=3D'microblaze', + kernel_path=3D'arch/microblaze/boot/linux.bin', + kernel_command_line=3D'kunit_shutdown=3Dpoweroff', + extra_qemu_params=3D[ + '-M', 'petalogix-s3adsp1800', + ], +) diff --git a/tools/testing/kunit/qemu_configs/microblazeel.py b/tools/testi= ng/kunit/qemu_configs/microblazeel.py new file mode 100644 index 000000000000..25db2052db06 --- /dev/null +++ b/tools/testing/kunit/qemu_configs/microblazeel.py @@ -0,0 +1,28 @@ +# SPDX-License-Identifier: GPL-2.0-only +from ..qemu_config import QemuArchParams + +QEMU_ARCH =3D QemuArchParams(linux_arch=3D'microblaze', + kconfig=3D''' +CONFIG_KERNEL_BASE_ADDR=3D0x50000000 +CONFIG_XILINX_MICROBLAZE0_FAMILY=3D"virtex5" +CONFIG_XILINX_MICROBLAZE0_USE_MSR_INSTR=3D1 +CONFIG_XILINX_MICROBLAZE0_USE_PCMP_INSTR=3D1 +CONFIG_XILINX_MICROBLAZE0_USE_BARREL=3D1 +CONFIG_XILINX_MICROBLAZE0_USE_DIV=3D1 +CONFIG_XILINX_MICROBLAZE0_USE_HW_MUL=3D2 +CONFIG_XILINX_MICROBLAZE0_USE_FPU=3D1 +CONFIG_CPU_LITTLE_ENDIAN=3Dy +CONFIG_SERIAL_8250=3Dy +CONFIG_SERIAL_8250_CONSOLE=3Dy +CONFIG_SERIAL_8250_16550A_VARIANTS=3Dy +CONFIG_SERIAL_OF_PLATFORM=3Dy +CONFIG_MB_POWER_OFF_THROUGH_UNALIGNED_PC=3Dy +''', + qemu_arch=3D'microblaze', + kernel_path=3D'arch/microblaze/boot/linux.bin', + kernel_command_line=3D'kunit_shutdown=3Dpoweroff', + extra_qemu_params=3D[ + '-M', 'petalogix-ml605', + ], +) + --=20 2.55.0