From nobody Thu Nov 28 17:31:16 2024 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 7C6827346D; Sun, 29 Sep 2024 21:47:47 +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=1727646473; cv=none; b=hzVVAOD+SmMZwsHhAvmRMRCci1lNWRYNREeiM2s3xHsHA+mkBxbfmo98xk/a350E2x3cR1WO7cfgDhnNASuTDAJLO1+xaz3xqeCz5eZURdU5TnxjY2ROhr2g9H2pB/tIZ6+r1ofHaE7Qt36kL0NsvhOJDU2pLH8oSkR3pFPJVt8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727646473; c=relaxed/simple; bh=2joTg9n3pFsrGMI75n766a/8WHAgaUxkWPplo5U8Xrw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=RMeSjUPu/CvKU17n+LgqfZVexjRqAJcGKT8Ye6/qqmVAnCOdz6kfhsCHulig4rjvhlGwq8tHRc5D2jgaEn3+ei7QvItq3mUsVswbDtlYx7pF//d0AH8NbpvCcZFpImoo31dpxjaxn5ph1KWn7TaZipp1MeeDFoTh5xi+QgUwcQU= 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=QHRy5NPu; 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="QHRy5NPu" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1727646464; bh=2joTg9n3pFsrGMI75n766a/8WHAgaUxkWPplo5U8Xrw=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=QHRy5NPugoOAP0ZBYGf6jNGXwRaDTNqLYpk/GbdfYkuWoNd2pnKVzBZ1n7IvjKqwa mnxknStXms2/Q70Zv/6pjvNE5yJwyPXleZcXlYNX8QSREF5smO5Jh3VRu1WEcSkQDc VdmyBH1Msv6gmpISeX5/uGq+AadfiukCuBysACCY= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Sun, 29 Sep 2024 23:47:36 +0200 Subject: [PATCH 1/5] drivers/virt: introduce csky_exit system poweroff driver 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: <20240929-nolibc-csky-v1-1-bb28031a73b0@weissschuh.net> References: <20240929-nolibc-csky-v1-0-bb28031a73b0@weissschuh.net> In-Reply-To: <20240929-nolibc-csky-v1-0-bb28031a73b0@weissschuh.net> To: Guo Ren , Willy Tarreau , Shuah Khan Cc: linux-kernel@vger.kernel.org, linux-csky@vger.kernel.org, linux-kselftest@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1727646464; l=3761; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=2joTg9n3pFsrGMI75n766a/8WHAgaUxkWPplo5U8Xrw=; b=EoJZ0xJNKUTDAhAgaDW1XtW6lSt34IP8BGf6n6Hk/0whDaOrVruBUBvvZ5bEfYD0TWFiXH2Ii cenyIMPvF9zC4u0l/cU0tfxRHDI/cGgW+5jpAYNMbzebyVQGQwxhAOW X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= The C-SKY architecture does not support ACPI and no other standardized mechanism for system poweroff. On QEMU a virtual device "csky_exit" is available which can be used for poweroff. Add a driver for this virtual device. There are more features provided by the device but these are not required at this time and therefore not supported yet. Signed-off-by: Thomas Wei=C3=9Fschuh --- The OF compatible will never show up in a DTS file, it is synthesized by QEMU. Therefore I think it doesn't need explicit documentation. --- drivers/virt/Kconfig | 11 ++++++++++ drivers/virt/Makefile | 1 + drivers/virt/csky_exit.c | 57 ++++++++++++++++++++++++++++++++++++++++++++= ++++ 3 files changed, 69 insertions(+) diff --git a/drivers/virt/Kconfig b/drivers/virt/Kconfig index d8c848cf09a6afad65b28be20f5fd7e90a0c5307..652546c52d2e00138a782b94967= 2d47c5f5d2189 100644 --- a/drivers/virt/Kconfig +++ b/drivers/virt/Kconfig @@ -41,6 +41,17 @@ config FSL_HV_MANAGER 4) A kernel interface for receiving callbacks when a managed partition shuts down. =20 +config CSKY_EXIT + tristate "C-SKY QEMU shutdown driver" + depends on OF + depends on CSKY || COMPILE_TEST + help + This driver supports system shutdown via the virtual csky_exit device + provided by QEMU. + + To compile this driver as a module, choose M here: the module will + be called csky_exit. + source "drivers/virt/vboxguest/Kconfig" =20 source "drivers/virt/nitro_enclaves/Kconfig" diff --git a/drivers/virt/Makefile b/drivers/virt/Makefile index f29901bd782058d3552cdec2c2128ad47ce6fe27..5c62db9fbfa501a31c87c4902f8= 35db91633daeb 100644 --- a/drivers/virt/Makefile +++ b/drivers/virt/Makefile @@ -3,6 +3,7 @@ # Makefile for drivers that support virtualization # =20 +obj-$(CONFIG_CSKY_EXIT) +=3D csky_exit.o obj-$(CONFIG_FSL_HV_MANAGER) +=3D fsl_hypervisor.o obj-$(CONFIG_VMGENID) +=3D vmgenid.o obj-y +=3D vboxguest/ diff --git a/drivers/virt/csky_exit.c b/drivers/virt/csky_exit.c new file mode 100644 index 0000000000000000000000000000000000000000..6f42eb74071ab9ac1b7e9ef03b3= 2f9ba0ef2cf26 --- /dev/null +++ b/drivers/virt/csky_exit.c @@ -0,0 +1,57 @@ +// SPDX-License-Identifier: GPL-2.0+ +/* + * C-SKY QEMU shutdown driver + * + * Copyright (C) 2024 Thomas Wei=C3=9Fschuh + */ + +#include +#include +#include +#include +#include +#include +#include + +#define CSKY_EXIT_COMMAND_EXIT 0 + +static void csky_exit_command(void __iomem *base, u32 command, u64 value) +{ + writew(value, base + command); +} + +static int csky_exit_poweroff(struct sys_off_data *data) +{ + csky_exit_command(data->cb_data, CSKY_EXIT_COMMAND_EXIT, 0); + return 0; +} + +static int csky_exit_probe(struct platform_device *pdev) +{ + void __iomem *base; + + base =3D devm_platform_ioremap_resource(pdev, 0); + if (IS_ERR(base)) + return PTR_ERR(base); + + return devm_register_sys_off_handler(&pdev->dev, SYS_OFF_MODE_POWER_OFF, + SYS_OFF_PRIO_PLATFORM + 1, + csky_exit_poweroff, base); +} + +static const struct of_device_id csky_exit_match[] =3D { + { .compatible =3D "csky,qemu-exit" }, + { } +}; +MODULE_DEVICE_TABLE(of, csky_exit_match); + +static struct platform_driver csky_exit_driver =3D { + .driver.name =3D "csky_exit", + .driver.of_match_table =3D csky_exit_match, + .probe =3D csky_exit_probe, +}; +module_platform_driver(csky_exit_driver); + +MODULE_AUTHOR("Thomas Wei=C3=9Fschuh "); +MODULE_DESCRIPTION("C-SKY QEMU shutdown driver"); +MODULE_LICENSE("GPL"); --=20 2.46.2 From nobody Thu Nov 28 17:31:16 2024 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 7C6476BFCA; Sun, 29 Sep 2024 21:47:47 +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=1727646471; cv=none; b=YrGjclFTFIYsN0x4DENRmmwjBzpivC/9d7EPQf5I2M8F6mqP4DAIshVsJ92D7DP7Pg8hBCNTrFlZ3G7DVH+UrZeXrcvK0DaP0HlBkvc4sgoxGSkqeVpAEVh5Sjm7Aqc2WQZmhvG5zzn7ZeCPPQRDwo1HD2QT1GAdXWUVBbbQn2I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727646471; c=relaxed/simple; bh=MulA0rURMeNske1UgIGnFH1FtKaa7d9GjQrQlxdDJhs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=MNeJ8t680lYdDiQQw2U1vU/1xqYmHBQkqk8DISdlEAfANv62qMlI6nXryRmcG9qblCW1kjtQkjigYMgwUNYgHEtD/0uV79H5MaudzYc0wfptHQyQ4QsRIK2AsYXHerGHoq63WNOkFxuTD2X9+T8bDMqvd3C0bBveYNnv3sS5TkU= 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=nVvfdLLN; 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="nVvfdLLN" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1727646464; bh=MulA0rURMeNske1UgIGnFH1FtKaa7d9GjQrQlxdDJhs=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=nVvfdLLNVCiGMum1ua/MxM+fGg4WAtcee1qXj6TG4IJ739Fk4KH0vKVVk5QVVDEeX 7K5HhOWH9rJ/poSiMaI+fzozxqdyfVt0bYsjMLHd4nBKYjXnFLsm04Px0XbKUc3h6U 3fhHqDOO0GHLVr8VUY2bJG69Bcj+54Zyy6PbRVTQ= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Sun, 29 Sep 2024 23:47:37 +0200 Subject: [PATCH 2/5] tools/nolibc: provide a fallback for lseek through llseek 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: <20240929-nolibc-csky-v1-2-bb28031a73b0@weissschuh.net> References: <20240929-nolibc-csky-v1-0-bb28031a73b0@weissschuh.net> In-Reply-To: <20240929-nolibc-csky-v1-0-bb28031a73b0@weissschuh.net> To: Guo Ren , Willy Tarreau , Shuah Khan Cc: linux-kernel@vger.kernel.org, linux-csky@vger.kernel.org, linux-kselftest@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1727646464; l=986; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=MulA0rURMeNske1UgIGnFH1FtKaa7d9GjQrQlxdDJhs=; b=z9fHPM3rogDBEyaoKCauQ5Uk8UU4+nLbufcN7bota5eZy+6hygwd2HcukhexF0i+ltK3gLXbY oS07svIimY/DB0nACOBV416CUixFArCTsr3916tCo1qc6m7agaItuWW X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= Not all architectures implement the lseek syscall, for example csky for which support will be added. Provide a fallback implementation to the llseek syscall. Signed-off-by: Thomas Wei=C3=9Fschuh --- tools/include/nolibc/sys.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/tools/include/nolibc/sys.h b/tools/include/nolibc/sys.h index 7b82bc3cf107439a3f09f98b99d4d540ffb9ba2a..b3b78343647177c9e5ecb726199= 7b4f5e03fb8f5 100644 --- a/tools/include/nolibc/sys.h +++ b/tools/include/nolibc/sys.h @@ -595,6 +595,14 @@ off_t sys_lseek(int fd, off_t offset, int whence) { #ifdef __NR_lseek return my_syscall3(__NR_lseek, fd, offset, whence); +#elif defined(__NR_llseek) + off_t result; + int ret; + + ret =3D my_syscall5(__NR_llseek, fd, + sizeof(offset) > 4 ? offset >> 32 : 0, + offset, &result, whence); + return ret ? ret : result; #else return __nolibc_enosys(__func__, fd, offset, whence); #endif --=20 2.46.2 From nobody Thu Nov 28 17:31:16 2024 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 7C5C68F6D; Sun, 29 Sep 2024 21:47:47 +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=1727646471; cv=none; b=klK2cGRhsO0GbgBxNL6RNjSiiSFFVchfIT5NEg3nDBxZ3VUhqU/h+QKRYjLlF8NHGlQ1lDxUHQN5EYYoAbBC9bliXVLK6NxVANLEicE2wtRxE5b3OAHIJzznx+XMvIKJ42ZXAqXGMj50/HVKKFQ6xLGI+KcDLWnKt8N98RKgxRg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727646471; c=relaxed/simple; bh=AsJHVK60vM8HIohq226Spe/+cd3HPgDderr8uqmDSfI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ezTb06sAqVKM74da9lVsuuv5bpS/JLi2UkAXUnBEWLNJt73b0DY9O+WKtnZOdijqRlS8ab7vl9gfv6JFq4/LcebRudeqyoUOVRhGS2iusx4kUVO1Wc4Bdau81Mt93+XYjf/w56PofURc96rjeIP650TKxdxKJ3erfpNLYVfdthA= 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=t2wM1fTZ; 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="t2wM1fTZ" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1727646464; bh=AsJHVK60vM8HIohq226Spe/+cd3HPgDderr8uqmDSfI=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=t2wM1fTZQ8XyCHHB1mjswvdHmpzfvgE8zsOWWVY3nfBKUD2dupTWJ+BpGZYD0ISxS j90iwDzQ2qneKpnAAj722vOFJi3BI6CkuFnHurf1AseuisAjHPXUK9yJ3eZI7IeUoh YB4+O8taWU9VlDRBLH91aFmq9oDnq2CcdRigVw6I= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Sun, 29 Sep 2024 23:47:38 +0200 Subject: [PATCH 3/5] selftests/nolibc: add support to use standalone kernels for tests 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: <20240929-nolibc-csky-v1-3-bb28031a73b0@weissschuh.net> References: <20240929-nolibc-csky-v1-0-bb28031a73b0@weissschuh.net> In-Reply-To: <20240929-nolibc-csky-v1-0-bb28031a73b0@weissschuh.net> To: Guo Ren , Willy Tarreau , Shuah Khan Cc: linux-kernel@vger.kernel.org, linux-csky@vger.kernel.org, linux-kselftest@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1727646464; l=1908; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=AsJHVK60vM8HIohq226Spe/+cd3HPgDderr8uqmDSfI=; b=/1nN18yVpzqP1spFIXxEEJQ5Xk851s6rB1sfm2gFycmVazAio5dOkV22+Mh06qAZbrsnz9By5 v2PGey+KgNuCHGoHABCGSwNc73oWn1FVWOX96eYWofSVXpU0qZfKSBw X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= Not all architectures support loading an initramfs through qemu. One example is csky for which support is going to be added. By allowing to build the initramfs into the kernel itself this issue can be avoided. Signed-off-by: Thomas Wei=C3=9Fschuh --- tools/testing/selftests/nolibc/Makefile | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/tools/testing/selftests/nolibc/Makefile b/tools/testing/selfte= sts/nolibc/Makefile index 8de98ea7af8071caa0597aa7b86d91a2d1d50e68..e8278924cf28f17144044e69724= df1d4fde141a3 100644 --- a/tools/testing/selftests/nolibc/Makefile +++ b/tools/testing/selftests/nolibc/Makefile @@ -265,14 +265,21 @@ kernel: kernel-standalone: initramfs $(Q)$(MAKE) -C $(srctree) ARCH=3D$(ARCH) CC=3D$(CC) CROSS_COMPILE=3D$(CRO= SS_COMPILE) $(IMAGE_NAME) CONFIG_INITRAMFS_SOURCE=3D$(CURDIR)/initramfs < /= dev/null =20 +ifeq ($(QEMU_RUN_STANDALONE_$(XARCH)),) +RUN_DEPS =3D kernel initramfs.cpio +QEMU_INITRD =3D -initrd initramfs.cpio +else +RUN_DEPS =3D kernel-standalone +endif + # run the tests after building the kernel -run: kernel initramfs.cpio - $(Q)qemu-system-$(QEMU_ARCH) -display none -no-reboot -kernel "$(IMAGE)" = -initrd initramfs.cpio -serial stdio $(QEMU_ARGS) > "$(CURDIR)/run.out" +run: $(RUN_DEPS) + $(Q)qemu-system-$(QEMU_ARCH) -display none -no-reboot -kernel "$(IMAGE)" = $(QEMU_INITRD) -serial stdio $(QEMU_ARGS) > "$(CURDIR)/run.out" $(Q)$(REPORT) $(CURDIR)/run.out =20 # re-run the tests from an existing kernel rerun: - $(Q)qemu-system-$(QEMU_ARCH) -display none -no-reboot -kernel "$(IMAGE)" = -initrd initramfs.cpio -serial stdio $(QEMU_ARGS) > "$(CURDIR)/run.out" + $(Q)qemu-system-$(QEMU_ARCH) -display none -no-reboot -kernel "$(IMAGE)" = $(QEMU_INITRD) -serial stdio $(QEMU_ARGS) > "$(CURDIR)/run.out" $(Q)$(REPORT) $(CURDIR)/run.out =20 # report with existing test log --=20 2.46.2 From nobody Thu Nov 28 17:31:16 2024 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 7C6BC768E1; Sun, 29 Sep 2024 21:47:47 +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=1727646471; cv=none; b=ml7AkzG+ojCZM3RbrCGlDpnYBgoOwocTtKGHQ2Ls3ByZjMVWR0SfS8nXhRVKoXcKwXOuviNuJYWRTJJomUmZy9Wd32FtOz/VDKn5x16beUpiLkewYbLk6ANV/yG88aMspW3z1w/KiTrNqYV4NUHan2ys9kjalFQZ02YU+MGG9lc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727646471; c=relaxed/simple; bh=kt49PtAybWU6qeBrvK9KHknH5KAfe1qC7aTKAetqLQU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=k9tHMMArFOgIULOJmdnePlhJJOB0NxFpfFsaXzAuWadI8lRYYw2Jfqsjrl4BwWC+xtAW1D2D/m0TVmydJgZmSf/BtodII73xcEw6GtAk4y9z+4JKReqPReb0Xm2BS9sqM5hrB3am7av1YOfHbSWnYxRYBwbTVDhvLbh8Xy5f6Yg= 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=lqi3T4Ro; 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="lqi3T4Ro" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1727646464; bh=kt49PtAybWU6qeBrvK9KHknH5KAfe1qC7aTKAetqLQU=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=lqi3T4Rof3pcEBQn9Txflv6Rl8qZ3R7I2czIVsAYeNyosxPBt5I2bBK/XCFzeT1q9 zczc8gkoWcllZj0oz2mlWIZ5j/cgvp+AtRG7GNI8xKaGww2vFnr0pMntTiJZR+lAfV hPxXOSQIrVcXKi6D1msI1LUh8slGmJVpf3X9namM= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Sun, 29 Sep 2024 23:47:39 +0200 Subject: [PATCH 4/5] tools/nolibc: add csky support 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: <20240929-nolibc-csky-v1-4-bb28031a73b0@weissschuh.net> References: <20240929-nolibc-csky-v1-0-bb28031a73b0@weissschuh.net> In-Reply-To: <20240929-nolibc-csky-v1-0-bb28031a73b0@weissschuh.net> To: Guo Ren , Willy Tarreau , Shuah Khan Cc: linux-kernel@vger.kernel.org, linux-csky@vger.kernel.org, linux-kselftest@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1727646464; l=14066; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=kt49PtAybWU6qeBrvK9KHknH5KAfe1qC7aTKAetqLQU=; b=28wJKP4GSe3f4ZHO5k7yeetugZfYRZKOlRHphSaay8uGd/N2oOkRWCtCmQCbCT7Mo4ZcbJgKu sOCfW3ALEZXAGJJGSuSm8o2EHpTlJ318zEWDaBhAm5S8zUFnZWs/aKQ X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= Add support for the C-SKY architecture, which is very similar to LoongArch. Only v2 ABI is supported. Optimizations are disabled as the compiler[0] seems to misoptimize the code, especially the r4 register gets clobbered. Compile the initramfs directly into the kernel, as qemu does not support passing the initrd via OF. There is no qemu mainline support for qemu. Testing was done with commit 1f172a2c7cd5c2e7 of the downstream csky qemu [= 1]. Some tiny changes were necessary on top [2]. [0] gcc 13.2.0 and 14.2.0 from kernel.org crosstools [1] https://github.com/XUANTIE-RV/qemu/ [2] diff --git a/target/csky/cpu-param.h b/target/csky/cpu-param.h index 80554cc0fc03..9181b602a26f 100644 --- a/target/csky/cpu-param.h +++ b/target/csky/cpu-param.h @@ -24,11 +24,7 @@ #define TARGET_PAGE_BITS 12 #define TARGET_PHYS_ADDR_SPACE_BITS 32 -#ifdef CONFIG_USER_ONLY -#define TARGET_VIRT_ADDR_SPACE_BITS 30 -#else #define TARGET_VIRT_ADDR_SPACE_BITS 32 -#endif #define TCG_GUEST_DEFAULT_MO (0) #endif diff --git a/target/csky/op_vdsp2.c b/target/csky/op_vdsp2.c index a9985a03be33..d953f5ea94fe 100644 --- a/target/csky/op_vdsp2.c +++ b/target/csky/op_vdsp2.c @@ -4784,7 +4784,7 @@ void VDSP2_HELPER(vmulae)(CPUCSKYState *env, uint32_t= insn) wid =3D ((insn >> 20) & 0x1) | ((insn >> 24) & 0x2); lng =3D 8 * pow(2, wid); - cnt =3D 128 / lng; + cnt =3D 64 / lng; sign =3D (insn >> CSKY_VDSP2_SIGN_SHI) & CSKY_VDSP2_SIGN_MASK; rx =3D (insn >> CSKY_VDSP2_VREG_SHI_VRX) & CSKY_VDSP2_VREG_MASK; ry =3D (insn >> CSKY_VDSP2_VREG_SHI_VRY) & CSKY_VDSP2_VREG_MASK; Signed-off-by: Thomas Wei=C3=9Fschuh --- tools/include/nolibc/arch-csky.h | 161 ++++++++++++++++++++++++++++= ++++ tools/include/nolibc/arch.h | 2 + tools/testing/selftests/nolibc/Makefile | 8 ++ 3 files changed, 171 insertions(+) diff --git a/tools/include/nolibc/arch-csky.h b/tools/include/nolibc/arch-c= sky.h new file mode 100644 index 0000000000000000000000000000000000000000..158e5499375c22a6572321337ba= 4e2b8162d0d65 --- /dev/null +++ b/tools/include/nolibc/arch-csky.h @@ -0,0 +1,161 @@ +/* SPDX-License-Identifier: LGPL-2.1 OR MIT */ +/* + * C-SKY specific definitions for NOLIBC + * Copyright (C) 2023 Loongson Technology Corporation Limited + * Copyright (C) 2024 Thomas Wei=C3=9Fschuh + */ + +#ifndef _NOLIBC_ARCH_CSKY_H +#define _NOLIBC_ARCH_CSKY_H + +#include "compiler.h" +#include "crt.h" + +#if __csky__ !=3D 2 +#error Unsupported csky ABI +#endif + +/* Syscalls for C-SKY : + * - stack is 8-byte aligned + * - syscall number is passed in r7 + * - arguments are in r0, r1, r2, r3, r4, r5 + * - the system call is performed by calling "trap 0" + * - syscall return comes in r0 + * - the arguments are cast to long and assigned into the target + * registers which are then simply passed as registers to the asm code, + * so that we don't have to experience issues with register constraint= s. + */ + +#define _NOLIBC_SYSCALL_CLOBBERLIST \ + "memory", "t0", "t1", "t2", "t3", "t4", "t5", "t6", "t7", "t8", "t9" + +#define my_syscall0(num) = \ +({ = \ + register long _num __asm__ ("r7") =3D (num); \ + register long _arg1 __asm__ ("r0"); \ + \ + __asm__ volatile ( \ + "trap 0\n" \ + : "=3Dr"(_arg1) \ + : "r"(_num) \ + : _NOLIBC_SYSCALL_CLOBBERLIST \ + ); \ + _arg1; \ +}) + +#define my_syscall1(num, arg1) = \ +({ = \ + register long _num __asm__ ("r7") =3D (num); \ + register long _arg1 __asm__ ("r0") =3D (long)(arg1); \ + \ + __asm__ volatile ( \ + "trap 0\n" \ + : "+r"(_arg1) \ + : "r"(_num) \ + : _NOLIBC_SYSCALL_CLOBBERLIST \ + ); \ + _arg1; \ +}) + +#define my_syscall2(num, arg1, arg2) = \ +({ = \ + register long _num __asm__ ("r7") =3D (num); \ + register long _arg1 __asm__ ("r0") =3D (long)(arg1); \ + register long _arg2 __asm__ ("r1") =3D (long)(arg2); \ + \ + __asm__ volatile ( \ + "trap 0\n" \ + : "+r"(_arg1) \ + : "r"(_arg2), \ + "r"(_num) \ + : _NOLIBC_SYSCALL_CLOBBERLIST \ + ); \ + _arg1; \ +}) + +#define my_syscall3(num, arg1, arg2, arg3) = \ +({ = \ + register long _num __asm__ ("r7") =3D (num); \ + register long _arg1 __asm__ ("r0") =3D (long)(arg1); \ + register long _arg2 __asm__ ("r1") =3D (long)(arg2); \ + register long _arg3 __asm__ ("r2") =3D (long)(arg3); \ + \ + __asm__ volatile ( \ + "trap 0\n" \ + : "+r"(_arg1) \ + : "r"(_arg2), "r"(_arg3), \ + "r"(_num) \ + : _NOLIBC_SYSCALL_CLOBBERLIST \ + ); \ + _arg1; \ +}) + +#define my_syscall4(num, arg1, arg2, arg3, arg4) = \ +({ = \ + register long _num __asm__ ("r7") =3D (num); \ + register long _arg1 __asm__ ("r0") =3D (long)(arg1); \ + register long _arg2 __asm__ ("r1") =3D (long)(arg2); \ + register long _arg3 __asm__ ("r2") =3D (long)(arg3); \ + register long _arg4 __asm__ ("r3") =3D (long)(arg4); \ + \ + __asm__ volatile ( \ + "trap 0\n" \ + : "+r"(_arg1) \ + : "r"(_arg2), "r"(_arg3), "r"(_arg4), \ + "r"(_num) \ + : _NOLIBC_SYSCALL_CLOBBERLIST \ + ); \ + _arg1; \ +}) + +#define my_syscall5(num, arg1, arg2, arg3, arg4, arg5) = \ +({ = \ + register long _num __asm__ ("r7") =3D (num); \ + register long _arg1 __asm__ ("r0") =3D (long)(arg1); \ + register long _arg2 __asm__ ("r1") =3D (long)(arg2); \ + register long _arg3 __asm__ ("r2") =3D (long)(arg3); \ + register long _arg4 __asm__ ("r3") =3D (long)(arg4); \ + register long _arg5 __asm__ ("r4") =3D (long)(arg5); \ + \ + __asm__ volatile ( \ + "trap 0\n" \ + : "+r"(_arg1) \ + : "r"(_arg2), "r"(_arg3), "r"(_arg4), "r"(_arg5), \ + "r"(_num) \ + : _NOLIBC_SYSCALL_CLOBBERLIST \ + ); \ + _arg1; \ +}) + +#define my_syscall6(num, arg1, arg2, arg3, arg4, arg5, arg6) = \ +({ = \ + register long _num __asm__ ("r7") =3D (num); \ + register long _arg1 __asm__ ("r0") =3D (long)(arg1); \ + register long _arg2 __asm__ ("r1") =3D (long)(arg2); \ + register long _arg3 __asm__ ("r2") =3D (long)(arg3); \ + register long _arg4 __asm__ ("r3") =3D (long)(arg4); \ + register long _arg5 __asm__ ("r4") =3D (long)(arg5); \ + register long _arg6 __asm__ ("r5") =3D (long)(arg6); \ + \ + __asm__ volatile ( \ + "trap 0\n" \ + : "+r"(_arg1) \ + : "r"(_arg2), "r"(_arg3), "r"(_arg4), "r"(_arg5), "r"(_arg6), \ + "r"(_num) \ + : _NOLIBC_SYSCALL_CLOBBERLIST \ + ); \ + _arg1; \ +}) + +/* startup code */ +void __attribute__((weak, noreturn)) __nolibc_entrypoint __no_stack_protec= tor _start(void) +{ + __asm__ volatile ( + "mov r0, sp\n" /* save stack pointer to r0, as arg1 of _st= art_c */ + "andni sp, sp, 8\n" /* sp must be 8-byte aligned in the callee = */ + "jbsr _start_c\n" /* transfer to c runtime = */ + ); + __nolibc_entrypoint_epilogue(); +} + +#endif /* _NOLIBC_ARCH_CSKY_H */ diff --git a/tools/include/nolibc/arch.h b/tools/include/nolibc/arch.h index c8f4e5d3add9eb5b8a438900c084dc0449fcfbd6..71cdf1eedb2045b9abd22146c72= ee891765ad553 100644 --- a/tools/include/nolibc/arch.h +++ b/tools/include/nolibc/arch.h @@ -33,6 +33,8 @@ #include "arch-s390.h" #elif defined(__loongarch__) #include "arch-loongarch.h" +#elif defined(__csky__) +#include "arch-csky.h" #else #error Unsupported Architecture #endif diff --git a/tools/testing/selftests/nolibc/Makefile b/tools/testing/selfte= sts/nolibc/Makefile index e8278924cf28f17144044e69724df1d4fde141a3..2f51d8ea45f1c0658584f27553a= 9c8e1ecf428a9 100644 --- a/tools/testing/selftests/nolibc/Makefile +++ b/tools/testing/selftests/nolibc/Makefile @@ -67,6 +67,7 @@ IMAGE_ppc64le =3D arch/powerpc/boot/zImage IMAGE_riscv =3D arch/riscv/boot/Image IMAGE_s390 =3D arch/s390/boot/bzImage IMAGE_loongarch =3D arch/loongarch/boot/vmlinuz.efi +IMAGE_csky =3D arch/csky/boot/Image IMAGE =3D $(objtree)/$(IMAGE_$(XARCH)) IMAGE_NAME =3D $(notdir $(IMAGE)) =20 @@ -84,9 +85,11 @@ DEFCONFIG_ppc64le =3D powernv_defconfig DEFCONFIG_riscv =3D defconfig DEFCONFIG_s390 =3D defconfig DEFCONFIG_loongarch =3D defconfig +DEFCONFIG_csky =3D defconfig DEFCONFIG =3D $(DEFCONFIG_$(XARCH)) =20 EXTRACONFIG_mips32be =3D -d CONFIG_CPU_LITTLE_ENDIAN -e CONFIG_CPU_BIG_END= IAN +EXTRACONFIG_csky =3D -e CONFIG_BLK_DEV_INITRD -e CONFIG_VIRT_DRIVERS -= e CONFIG_CSKY_EXIT EXTRACONFIG =3D $(EXTRACONFIG_$(XARCH)) =20 # optional tests to run (default =3D all) @@ -106,6 +109,7 @@ QEMU_ARCH_ppc64le =3D ppc64 QEMU_ARCH_riscv =3D riscv64 QEMU_ARCH_s390 =3D s390x QEMU_ARCH_loongarch =3D loongarch64 +QEMU_ARCH_csky =3D cskyv2 QEMU_ARCH =3D $(QEMU_ARCH_$(XARCH)) =20 QEMU_ARCH_USER_ppc64le =3D ppc64le @@ -132,8 +136,11 @@ QEMU_ARGS_ppc64le =3D -M powernv -append "console= =3Dhvc0 panic=3D-1 $(TEST:%=3DNOLIBC QEMU_ARGS_riscv =3D -M virt -append "console=3DttyS0 panic=3D-1 $(TES= T:%=3DNOLIBC_TEST=3D%)" QEMU_ARGS_s390 =3D -M s390-ccw-virtio -m 1G -append "console=3DttyS0= panic=3D-1 $(TEST:%=3DNOLIBC_TEST=3D%)" QEMU_ARGS_loongarch =3D -M virt -append "console=3DttyS0,115200 panic=3D-= 1 $(TEST:%=3DNOLIBC_TEST=3D%)" +QEMU_ARGS_csky =3D -M virt -append "console=3DttyS0,115200 panic=3D-= 1 $(TEST:%=3DNOLIBC_TEST=3D%)" QEMU_ARGS =3D $(QEMU_ARGS_$(XARCH)) $(QEMU_ARGS_BIOS) $(QEMU_AR= GS_EXTRA) =20 +QEMU_RUN_STANDALONE_csky =3D 1 + # OUTPUT is only set when run from the main makefile, otherwise # it defaults to this nolibc directory. OUTPUT ?=3D $(CURDIR)/ @@ -151,6 +158,7 @@ CFLAGS_ppc64le =3D -m64 -mlittle-endian -mno-vsx $(call= cc-option,-mabi=3Delfv2) CFLAGS_s390 =3D -m64 CFLAGS_mips32le =3D -EL -mabi=3D32 -fPIC CFLAGS_mips32be =3D -EB -mabi=3D32 +CFLAGS_csky =3D -O0 CFLAGS_STACKPROTECTOR ?=3D $(call cc-option,-mstack-protector-guard=3Dglob= al $(call cc-option,-fstack-protector-all)) CFLAGS ?=3D -Os -fno-ident -fno-asynchronous-unwind-tables -std=3Dc89 -W = -Wall -Wextra \ $(call cc-option,-fno-stack-protector) \ --=20 2.46.2 From nobody Thu Nov 28 17:31:16 2024 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 F3137181D00; Sun, 29 Sep 2024 21:47:52 +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=1727646474; cv=none; b=oNvmu8W/btvdChUxGZ5t0COz/JCGSDml5SMsq0RaS7osVwLwRu1u/uQOq4hXcCbajb6aMfBmCrEdWFYJm+dmU+GOVttf3vC+TQpLYtQlsR5t3gBBLkaRbDl8h53Ipj64NdlA+UdifmsBkHT6XS8fpEO8h/dLNpRV0GdeBsLpcY4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727646474; c=relaxed/simple; bh=KjxYPOTEK04i0aDe9R3P7xjZpnny61B4KWUV7zhoxYU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=d8DflxCb+DvNr1jftPoezA6TQluLjOVhfdKWxWAdUheuth1LmzgWtUx6kNDmXYW9g8SnL5ZWDRev0LGoXvsJhnonsv101NHmVyH+TZheSuVOSMgOJG2vbj1C/XtmqLM32c8WjkaPU1+xwr6CaF0w/rtaF638G9tfzWWwAWB28ZY= 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=dMGieA04; 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="dMGieA04" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=weissschuh.net; s=mail; t=1727646465; bh=KjxYPOTEK04i0aDe9R3P7xjZpnny61B4KWUV7zhoxYU=; h=From:Date:Subject:References:In-Reply-To:To:Cc:From; b=dMGieA04I1ViWnYpd+fojwnXQNoDCDM47Tc3qxbuohIipbMr6MQ1XzJUctpFpn840 atD1wP4kFz3zep0LWQp0lYrDXi7Nk9eT+3LvMZh+Rgbry4efJlEduzfI4TXtmnWlm9 RM0IhRHYpl5reL7QvfZJKLmQQ2eFU4BEH+5OrMSk= From: =?utf-8?q?Thomas_Wei=C3=9Fschuh?= Date: Sun, 29 Sep 2024 23:47:40 +0200 Subject: [PATCH 5/5] selftests/nolibc: skip test for getppid() on csky 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: <20240929-nolibc-csky-v1-5-bb28031a73b0@weissschuh.net> References: <20240929-nolibc-csky-v1-0-bb28031a73b0@weissschuh.net> In-Reply-To: <20240929-nolibc-csky-v1-0-bb28031a73b0@weissschuh.net> To: Guo Ren , Willy Tarreau , Shuah Khan Cc: linux-kernel@vger.kernel.org, linux-csky@vger.kernel.org, linux-kselftest@vger.kernel.org, =?utf-8?q?Thomas_Wei=C3=9Fschuh?= X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1727646464; l=2023; i=linux@weissschuh.net; s=20221212; h=from:subject:message-id; bh=KjxYPOTEK04i0aDe9R3P7xjZpnny61B4KWUV7zhoxYU=; b=1ofSVpBYrnMLeG02nuqsxZrKjnXJpHxpp3FJIwFQKCCUGVb/PKQivP6lnZtC9zsAv+qE/yfU4 qMonmekTr0PBbReUXTPKJKk8O69mrEgD4eJ5VlJShxAWAaZ3vZGp+Iz X-Developer-Key: i=linux@weissschuh.net; a=ed25519; pk=KcycQgFPX2wGR5azS7RhpBqedglOZVgRPfdFSPB1LNw= Old non-mainline Linux and current non-mainline qemu-user use different syscall numbers than mainline Linux. __NR_getppid and __NR_rt_sigreturn are swapped. As the runtime environment can't be determined during compilation, sidestep the whole issue by skipping the test. Link: https://lore.kernel.org/linux-csky/2fa3151f-5aab-406c-95d9-add398ae58= b3@t-8ch.de/ Signed-off-by: Thomas Wei=C3=9Fschuh --- tools/testing/selftests/nolibc/nolibc-test.c | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/tools/testing/selftests/nolibc/nolibc-test.c b/tools/testing/s= elftests/nolibc/nolibc-test.c index 6fba7025c5e3c002085862fdf6fa950da6000d6c..daf6a9b84a3051413cbb1d01918= f745c3b83426c 100644 --- a/tools/testing/selftests/nolibc/nolibc-test.c +++ b/tools/testing/selftests/nolibc/nolibc-test.c @@ -995,7 +995,7 @@ int run_syscall(int min, int max) int tmp; int ret =3D 0; void *p1, *p2; - int has_gettid =3D 1; + int has_gettid =3D 1, has_getppid =3D 1; int has_brk; =20 /* indicates whether or not /proc is mounted */ @@ -1009,6 +1009,11 @@ int run_syscall(int min, int max) has_gettid =3D __GLIBC__ > 2 || (__GLIBC__ =3D=3D 2 && __GLIBC_MINOR__ >= =3D 30); #endif =20 + /* qemu-user and non-mainline Linux use different syscall number */ +#if defined(__csky__) + has_getppid =3D 0; +#endif + /* on musl setting brk()/sbrk() always fails */ has_brk =3D brk(0) =3D=3D 0; =20 @@ -1020,7 +1025,7 @@ int run_syscall(int min, int max) */ switch (test + __LINE__ + 1) { CASE_TEST(getpid); EXPECT_SYSNE(1, getpid(), -1); break; - CASE_TEST(getppid); EXPECT_SYSNE(1, getppid(), -1); break; + CASE_TEST(getppid); EXPECT_SYSNE(has_getppid, getppid(), -1); = break; CASE_TEST(gettid); EXPECT_SYSNE(has_gettid, gettid(), -1); br= eak; CASE_TEST(getpgid_self); EXPECT_SYSNE(1, getpgid(0), -1); break; CASE_TEST(getpgid_bad); EXPECT_SYSER(1, getpgid(-1), -1, ESRCH); b= reak; --=20 2.46.2