All of lore.kernel.org
 help / color / mirror / Atom feed
* [Accel-config] [PATCH] accfg: test: add switch for not using umonitor
@ 2022-04-14 17:20 Dave Jiang
  0 siblings, 0 replies; only message in thread
From: Dave Jiang @ 2022-04-14 17:20 UTC (permalink / raw)
  To: accel-config

[-- Attachment #1: Type: text/plain, Size: 2603 bytes --]

Add a test flag to allow using busy poll instead of umwait to wait on
descriptor completion. 0x2 is used for the flag.

Signed-off-by: Dave Jiang <dave.jiang(a)intel.com>
---
 test/dsa.c      |    6 ++++--
 test/dsa.h      |    3 ++-
 test/dsa_test.c |    3 ++-
 3 files changed, 8 insertions(+), 4 deletions(-)

diff --git a/test/dsa.c b/test/dsa.c
index 8bc5dd566108..d3eb4ce67b2f 100644
--- a/test/dsa.c
+++ b/test/dsa.c
@@ -65,7 +65,7 @@ static inline void cpuid(unsigned int *eax, unsigned int *ebx,
 		: "memory");
 }
 
-struct dsa_context *dsa_init(void)
+struct dsa_context *dsa_init(int tflags)
 {
 	struct dsa_context *dctx;
 	unsigned int unused[2];
@@ -77,9 +77,11 @@ struct dsa_context *dsa_init(void)
 	leaf = 7;
 	waitpkg = 0;
 	cpuid(&leaf, unused, &waitpkg, unused + 1);
-	if (waitpkg & 0x20) {
+	if ((waitpkg & 0x20) && !(tflags & TEST_FLAGS_NO_UMWAIT)) {
 		dbg("umwait supported\n");
 		umwait_support = 1;
+	} else {
+		dbg("no umwait, active poll\n");
 	}
 
 	dctx = malloc(sizeof(struct dsa_context));
diff --git a/test/dsa.h b/test/dsa.h
index 6094d5ca697d..090d6e86e98b 100644
--- a/test/dsa.h
+++ b/test/dsa.h
@@ -14,6 +14,7 @@
 #define DSA_MAX_OPS 0x20
 
 #define TEST_FLAGS_BOF     0x1     /* Block on page faults */
+#define TEST_FLAGS_NO_UMWAIT	0x2	/* Disable umwait usage */
 #define TEST_FLAGS_WAIT    0x4     /* Wait in kernel */
 #define TEST_FLAGS_PREF    0x8     /* Pre-fault the buffers */
 
@@ -254,7 +255,7 @@ void memset_pattern(void *dst, uint64_t pattern, size_t len);
 int memcmp_pattern(const void *src, const uint64_t pattern, size_t len);
 int dsa_enqcmd(struct dsa_context *ctx, struct dsa_hw_desc *hw);
 
-struct dsa_context *dsa_init(void);
+struct dsa_context *dsa_init(int tflags);
 int dsa_alloc(struct dsa_context *ctx, int shared, int dev_id, int wq_id);
 int alloc_multiple_tasks(struct dsa_context *ctx, int num_itr);
 struct task *__alloc_task(void);
diff --git a/test/dsa_test.c b/test/dsa_test.c
index 8e8dc254b9f7..209d8ce9f948 100644
--- a/test/dsa_test.c
+++ b/test/dsa_test.c
@@ -18,6 +18,7 @@ static void usage(void)
 	"-w <wq_type> ; 0=dedicated, 1=shared\n"
 	"-l <length>  ; total test buffer size\n"
 	"-f <test_flags> ; 0x1: block-on-fault\n"
+	"		 ; 0x2: no umwait\n"
 	"                ; 0x4: reserved\n"
 	"                ; 0x8: prefault buffers\n"
 	"-o <opcode>     ; opcode, same value as in DSA spec\n"
@@ -697,7 +698,7 @@ int main(int argc, char *argv[])
 		}
 	}
 
-	dsa = dsa_init();
+	dsa = dsa_init(tflags);
 
 	if (!dsa)
 		return -ENOMEM;


^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2022-04-14 17:20 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-04-14 17:20 [Accel-config] [PATCH] accfg: test: add switch for not using umonitor Dave Jiang

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.