From patchwork Tue Sep 3 14:39:48 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Jones X-Patchwork-Id: 1980092 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=woFx4sor; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=QndBwf92; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=kvm-riscv-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WypDw525Sz1yfv for ; Wed, 4 Sep 2024 00:40:00 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=97og88ltnTVogCiNvCQNDS+M+dN4WlY55wVhlsN2MhE=; b=woFx4sor5IEt+v 140GKUYNh3maf8hq692+JxOzRFbGxy2dseQ4rfYSCoPvLZQkPp14AM/lWSkKHUW9HIkhSVXGkRnYS BJT2/+2CNKneFZfMZcJNc7lUg54WWdnkxEcHw58T9+QfBl015+K2/ICl7/l0KIu9fi60FJ7yg0l2Q I3U//8yNBqBHbTYcJpuCu/MMgQONCPVZfGxtqyib/BjbxtK/LejGXipsIP+XHhAglsd1IGhN9l3Cc QfTVYbCKZhUhJVh1Qkyv+4HM7y+TtP4JozyF4bsxoN4rUfj+Ph5BpjRjkTe6wLXY/ncpQL4z+Fl9i ctccLZqecwoEWbzbnD2w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1slUhL-00000000dGP-1uBp; Tue, 03 Sep 2024 14:39:59 +0000 Received: from out-183.mta0.migadu.com ([2001:41d0:1004:224b::b7]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1slUhI-00000000dEr-3ND7 for kvm-riscv@lists.infradead.org; Tue, 03 Sep 2024 14:39:58 +0000 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1725374394; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=NPJbr+AV4ff0gStLIX6r7FtGNvxcxGtMDjNsvGlAFzc=; b=QndBwf92xNE68kZ4zIA9+ERf3pqDd299f/UsUpxg8zH5Ls2qOmUJZuwF9QkxTp+pMnthJE gddfikKHVJqaj2qte0oZGBPaUGUi8TUkWt9l4Z9ZWUHgj6z1GpjSjMCyBw+XNg86nG5w9L JmWp5qDd6lyWlSxh1O96HZ+BLv4BH5c= From: Andrew Jones To: kvm@vger.kernel.org, kvm-riscv@lists.infradead.org, kvmarm@lists.linux.dev, linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org Cc: pbonzini@redhat.com, thuth@redhat.com, lvivier@redhat.com, frankja@linux.ibm.com, imbrenda@linux.ibm.com, nrb@linux.ibm.com, atishp@rivosinc.com, cade.richard@berkeley.edu, jamestiotio@gmail.com Subject: [kvm-unit-tests PATCH 1/2] configure: Introduce add-config Date: Tue, 3 Sep 2024 16:39:48 +0200 Message-ID: <20240903143946.834864-5-andrew.jones@linux.dev> In-Reply-To: <20240903143946.834864-4-andrew.jones@linux.dev> References: <20240903143946.834864-4-andrew.jones@linux.dev> MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240903_073956_998632_E091D230 X-CRM114-Status: UNSURE ( 9.73 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.1 (--) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Allow users to add additional CONFIG_* and override defaults by concatenating a given file with #define's and #undef's to lib/config.h Signed-off-by: Andrew Jones --- configure | 14 ++++++++++++++ 1 file changed, 14 insertions(+) Content analysis details: (-2.1 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.0 T_SCC_BODY_TEXT_LINE No description available. X-BeenThere: kvm-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "kvm-riscv" Errors-To: kvm-riscv-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Allow users to add additional CONFIG_* and override defaults by concatenating a given file with #define's and #undef's to lib/config.h Signed-off-by: Andrew Jones --- configure | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/configure b/configure index 27ae9cc89657..7a1317d0650d 100755 --- a/configure +++ b/configure @@ -64,6 +64,8 @@ usage() { no environ is provided by the user (enabled by default) --erratatxt=FILE specify a file to use instead of errata.txt. Use '--erratatxt=' to ensure no file is used. + --add-config=FILE specify a file containing configs (CONFIG_*) to add on to the + generated lib/config.h. Use #undef to override default configs. --host-key-document=HOST_KEY_DOCUMENT Specify the machine-specific host-key document for creating a PVM image with 'genprotimg' (s390x only) @@ -153,6 +155,10 @@ while [[ "$1" = -* ]]; do erratatxt= [ "$arg" ] && erratatxt=$(eval realpath "$arg") ;; + --add-config) + add_config= + [ "$arg" ] && add_config=$(eval realpath "$arg") + ;; --host-key-document) host_key_document="$arg" ;; @@ -213,6 +219,10 @@ if [ "$erratatxt" ] && [ ! -f "$erratatxt" ]; then echo "erratatxt: $erratatxt does not exist or is not a regular file" exit 1 fi +if [ "$add_config" ] && [ ! -f "$add_config" ]; then + echo "add-config: $add_config does not exist or is not a regular file" + exit 1 +fi arch_name=$arch [ "$arch" = "aarch64" ] && arch="arm64" @@ -502,4 +512,8 @@ cat <> lib/config.h EOF fi +if [ "$add_config" ]; then + echo "/* Additional configs from $add_config */" >> lib/config.h + cat "$add_config" >> lib/config.h +fi echo "#endif" >> lib/config.h From patchwork Tue Sep 3 14:39:49 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Jones X-Patchwork-Id: 1980093 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; dkim=pass (2048-bit key; secure) header.d=lists.infradead.org header.i=@lists.infradead.org header.a=rsa-sha256 header.s=bombadil.20210309 header.b=4qNVV1uQ; dkim=fail reason="signature verification failed" (1024-bit key; unprotected) header.d=linux.dev header.i=@linux.dev header.a=rsa-sha256 header.s=key1 header.b=vHoflyVp; dkim-atps=neutral Authentication-Results: legolas.ozlabs.org; spf=none (no SPF record) smtp.mailfrom=lists.infradead.org (client-ip=2607:7c80:54:3::133; helo=bombadil.infradead.org; envelope-from=kvm-riscv-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org; receiver=patchwork.ozlabs.org) Received: from bombadil.infradead.org (bombadil.infradead.org [IPv6:2607:7c80:54:3::133]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (secp384r1) server-digest SHA384) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4WypF02BjYz1yfv for ; Wed, 4 Sep 2024 00:40:04 +1000 (AEST) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-ID:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=z7Bk8rxI+2VgqyD/1U2Y2CebGCrOVhjmVYsTxZiKt7o=; b=4qNVV1uQRSO9NY CM/2gD7enGKiNZbjd4VmdoKNntNDM/oGbEjR4rnWC/PcNwBJH51sTOyVxI19mJQd05Zt/lIQyWWr2 KbyQ2NqlDxYyp2bYWApk9PStFi0y9ZRDUyCPlsiqPCIt8jb7N1DyAvX8MjEBXRWEXUvB0fbfR8oPk LRkB4CYHmRWsCl9gmEv9TCikAa8TXL+/QD05UbzwQkNtXK9rj1CVNsZu5ntl37W35v9+BU3KA4V8r p0jOiTFg/q34j4HOGC7nKSxCy0vgG3glNBgJuJxhvg2I1DEW+yDu8spZV4m4/X1Aj0evHQbHxsDNl E7twt05wDYRym+bZpf2w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1slUhO-00000000dHs-43cj; Tue, 03 Sep 2024 14:40:02 +0000 Received: from out-175.mta0.migadu.com ([2001:41d0:1004:224b::af]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1slUhL-00000000dFu-2WDw for kvm-riscv@lists.infradead.org; Tue, 03 Sep 2024 14:40:01 +0000 X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1725374396; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=acROeX4wqHQCBibnKLGyiTpwL0vS0RTu/8rh/TC4rLI=; b=vHoflyVpKDBL64vOUcRFDZgtoMnMqr7rwaRFtKEoQMfwFLEhKq5tk7LEfCwXEynItLVdq6 tjakOD0DyfhDsmpS74rXU2Hp/uMw/gF1zkwEDUs0P8OCRQYTNbjiXiwxKSFkzxTUgxYXk3 vK98MhaeymL1QkoxovGVAv1Na1ChSP8= From: Andrew Jones To: kvm@vger.kernel.org, kvm-riscv@lists.infradead.org, kvmarm@lists.linux.dev, linuxppc-dev@lists.ozlabs.org, linux-s390@vger.kernel.org Cc: pbonzini@redhat.com, thuth@redhat.com, lvivier@redhat.com, frankja@linux.ibm.com, imbrenda@linux.ibm.com, nrb@linux.ibm.com, atishp@rivosinc.com, cade.richard@berkeley.edu, jamestiotio@gmail.com Subject: [kvm-unit-tests PATCH 2/2] riscv: Make NR_CPUS configurable Date: Tue, 3 Sep 2024 16:39:49 +0200 Message-ID: <20240903143946.834864-6-andrew.jones@linux.dev> In-Reply-To: <20240903143946.834864-4-andrew.jones@linux.dev> References: <20240903143946.834864-4-andrew.jones@linux.dev> MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240903_073959_825116_9C825082 X-CRM114-Status: GOOD ( 11.11 ) X-Spam-Score: -2.1 (--) X-Spam-Report: Spam detection software, running on the system "bombadil.infradead.org", has NOT identified this incoming email as spam. The original message has been attached to this so you can view it or label similar future email. If you have any questions, see the administrator of that system for details. Content preview: Unit tests would like to go nuts with the number of harts in order to help shake out issues with hart number assumptions. Rather than set a huge number that will only be used when a platform supports [...] Content analysis details: (-2.1 points, 5.0 required) pts rule name description ---- ---------------------- -------------------------------------------------- -0.0 SPF_PASS SPF: sender matches SPF record -0.0 SPF_HELO_PASS SPF: HELO matches SPF record -0.1 DKIM_VALID_EF Message has a valid DKIM or DK signature from envelope-from domain -0.1 DKIM_VALID Message has at least one valid DKIM or DK signature -0.1 DKIM_VALID_AU Message has a valid DKIM or DK signature from author's domain 0.1 DKIM_SIGNED Message has a DKIM or DK signature, not necessarily valid -1.9 BAYES_00 BODY: Bayes spam probability is 0 to 1% [score: 0.0000] -0.0 T_SCC_BODY_TEXT_LINE No description available. X-BeenThere: kvm-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "kvm-riscv" Errors-To: kvm-riscv-bounces+incoming=patchwork.ozlabs.org@lists.infradead.org Unit tests would like to go nuts with the number of harts in order to help shake out issues with hart number assumptions. Rather than set a huge number that will only be used when a platform supports a huge number or when QEMU is told to exceed the recommended number of vcpus, make the number configurable. However, we do bump the default from 16 to 2*xlen since we would like to always force kvm-unit-tests to use cpumasks with more than one word in order to ensure that code stays maintained. To override the default for NR_CPUS to, e.g. 256, testers should use --add-config. For example, $ cat < 256.config #undef CONFIG_NR_CPUS #define CONFIG_NR_CPUS 256 EOF $ ./configure --arch=riscv64 --cross-prefix=riscv64-linux-gnu- --add-config=256.config Signed-off-by: Andrew Jones --- configure | 3 ++- lib/riscv/asm/setup.h | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/configure b/configure index 7a1317d0650d..5ed0c28fcaea 100755 --- a/configure +++ b/configure @@ -508,7 +508,8 @@ EOF elif [ "$arch" = "riscv32" ] || [ "$arch" = "riscv64" ]; then cat <> lib/config.h -#define CONFIG_UART_EARLY_BASE 0x10000000 +#define CONFIG_NR_CPUS (__riscv_xlen * 2) +#define CONFIG_UART_EARLY_BASE 0x10000000 EOF fi diff --git a/lib/riscv/asm/setup.h b/lib/riscv/asm/setup.h index a13159bfe395..43b63c56d96f 100644 --- a/lib/riscv/asm/setup.h +++ b/lib/riscv/asm/setup.h @@ -2,9 +2,10 @@ #ifndef _ASMRISCV_SETUP_H_ #define _ASMRISCV_SETUP_H_ #include +#include #include -#define NR_CPUS 16 +#define NR_CPUS CONFIG_NR_CPUS extern struct thread_info cpus[NR_CPUS]; extern int nr_cpus; extern uint64_t timebase_frequency;