From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-alma10-1.taild15c8.ts.net [100.103.45.18]) (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 B7BDC3DB309 for ; Thu, 11 Jun 2026 15:21:30 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781191291; cv=none; b=dSq5Sycm7Bb4gr0TeL6G0CWu+14eH+uhGOT0DTFGJI81C853sKaWu912PlYuez7qcLWtC1PRmClxkYxRQtcDn8fRVSfBumanxJ2VPpGI5VKipc5lqxhU+9uXQE/cqSIk66Ia9IKHZSZ0uOl9xnU36GkHRqMe4On0Avtv5pc5EVQ= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1781191291; c=relaxed/simple; bh=3B9/BkOAIjv7l8ZvpjMz+fCejAZaYVa+JH6H4iBgwDE=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=dVFsmyW0+9e5Ye4tTpZretINd29wdwF+Jp1hOkQfklXmtA1zHnt2+oiAGVqV1KtBa7l9M5ZtJpJZRv+SM4c4XVezkdTs/ulQSgWdJIaCG4xYJBeaTGx1cBsMeNt+ZNTSn4nUzdmlSXq+P90m+mbBVZSs1McZCnz300zIb2pYZ/A= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=100.103.45.18 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 546E21F00898; Thu, 11 Jun 2026 15:21:30 +0000 (UTC) From: Dave Jiang To: linux-cxl@vger.kernel.org Cc: djbw@kernel.org, dave@stgolabs.net, jic23@kernel.org, alison.schofield@intel.com, vishal.l.verma@intel.com Subject: [PATCH v4 1/6] cxl/test: Add test for module parameters Date: Thu, 11 Jun 2026 08:21:19 -0700 Message-ID: <20260611152124.3656434-2-dave.jiang@intel.com> X-Mailer: git-send-email 2.54.0 In-Reply-To: <20260611152124.3656434-1-dave.jiang@intel.com> References: <20260611152124.3656434-1-dave.jiang@intel.com> Precedence: bulk X-Mailing-List: linux-cxl@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Add a test for module paraters during module init to make sure that only one is activated. Suggested-by: Alison Schofield Signed-off-by: Dave Jiang --- v4: - Make have_multiple_modparms static (sashiko) - Check hmem_test mod param (sashiko) --- tools/testing/cxl/test/cxl.c | 20 ++++++++++++++++++++ tools/testing/cxl/test/hmem_test.c | 3 ++- tools/testing/cxl/test/mock.h | 2 ++ 3 files changed, 24 insertions(+), 1 deletion(-) diff --git a/tools/testing/cxl/test/cxl.c b/tools/testing/cxl/test/cxl.c index 296516eecfd6..1c8ac8bdd8f7 100644 --- a/tools/testing/cxl/test/cxl.c +++ b/tools/testing/cxl/test/cxl.c @@ -1814,11 +1814,31 @@ static struct attribute *cxl_acpi_attrs[] = { }; ATTRIBUTE_GROUPS(cxl_acpi); +static bool __init have_multiple_modparms(void) +{ + int count = 0; + + if (interleave_arithmetic) + count++; + if (extended_linear_cache) + count++; + if (fail_autoassemble) + count++; + if (hmem_test) + count++; + + return count > 1; +} + static __init int cxl_test_init(void) { int rc, i; struct range mappable; + /* Enforce a single module param active at a time */ + if (have_multiple_modparms()) + return -EINVAL; + cxl_acpi_test(); cxl_core_test(); cxl_mem_test(); diff --git a/tools/testing/cxl/test/hmem_test.c b/tools/testing/cxl/test/hmem_test.c index 3a1a089e1721..0fa00f7e16db 100644 --- a/tools/testing/cxl/test/hmem_test.c +++ b/tools/testing/cxl/test/hmem_test.c @@ -3,8 +3,9 @@ #include #include #include "../../../drivers/dax/bus.h" +#include "mock.h" -static bool hmem_test; +bool hmem_test; static void hmem_test_work(struct work_struct *work) { diff --git a/tools/testing/cxl/test/mock.h b/tools/testing/cxl/test/mock.h index 4f57dc80ae7d..846d7c5d6eaa 100644 --- a/tools/testing/cxl/test/mock.h +++ b/tools/testing/cxl/test/mock.h @@ -5,6 +5,8 @@ #include #include +extern bool hmem_test; + struct cxl_mock_ops { struct list_head list; bool (*is_mock_adev)(struct acpi_device *dev); -- 2.54.0