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: 13788823 Received: from out-171.mta0.migadu.com (out-171.mta0.migadu.com [91.218.175.171]) (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 B3AD1155A47 for ; Tue, 3 Sep 2024 14:39:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.171 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725374397; cv=none; b=BYXpcs5oLJskfiZX2kprh76ofSrnVePNN88oqAPTSdU+6by0YTX9dSk91+M1oJKEKdW5MH/t3sRtWVT+vAX4+VD6AISvOhcv39pDkmZX3KJD6ClRVCiZo6zCXY5rpiwvtmp+hl3hyEm/Ext6ZnaFlYqZOkkTDmLcqorUD67SAlE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725374397; c=relaxed/simple; bh=lJ4aEI+SfYVmS7VzkaKDURPs2wcpEPNtzNdsSTh5Xqo=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=JL+6cRZSeabbO2CjFYD/O/zfdpSi/s+p45l58LEIaRftZKdoGlUikLIDCwg2IUMzHhtVVC+6IKDKXzEGfqqpz1AorwdiA/6H1cyZF5n56813Krm9HdMSlcMYyO2F0HVn6nTeBzIiopuKXxa/wT9ii+9wjpAtI8dpqJ2p1c9c2/Y= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=QndBwf92; arc=none smtp.client-ip=91.218.175.171 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="QndBwf92" 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> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT 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: 13788824 Received: from out-183.mta0.migadu.com (out-183.mta0.migadu.com [91.218.175.183]) (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 E083817DFF4 for ; Tue, 3 Sep 2024 14:39:58 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.183 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725374400; cv=none; b=nj/Atr1fepokyzZSCTECwfXZhrixkIA726CBwWyhtK+Bix4ABRHJ8Vo5rWuHG/YRmPJ4odBsAvAUkWpHREKE62607eAjg61a9eM4l+ApOJPc8AwvmVLe8KekGTNJu45ZRU/Jm4F8PpF/GJxVxu0J2haMinxr1xYs7JlHQJWUWJQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1725374400; c=relaxed/simple; bh=7r3q/OA4JOn6gDyQoxbuK/DlZbC7pbU4kuOIDChyxuk=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=XUQG000FFFMRBIZDGqi6tJKscL3g9b//1YNLHiXEydUx+tgEQaUvAP2eiAWGo1M88yJpdVs0hB2ry7WhV+S6G7MpXQtKk2dgPzVRGB7oBJC9Y+eALDe5YH0/ffPIGvR7v+k7/vcAZiYOHJNWTbTPSuBAZL5u/W0QFAFFCW47cZc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=vHoflyVp; arc=none smtp.client-ip=91.218.175.183 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="vHoflyVp" 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> Precedence: bulk X-Mailing-List: kvm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-Migadu-Flow: FLOW_OUT 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;