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;
Show replies by date