All of lore.kernel.org
 help / color / mirror / Atom feed
From: yi1.li@linux.intel.com
To: mcgrof@kernel.org, atull@kernel.org, gregkh@linuxfoundation.org,
	wagi@monom.org, dwmw2@infradead.org, rafal@milecki.pl,
	arend.vanspriel@broadcom.com, rjw@rjwysocki.net,
	moritz.fischer@ettus.com, pmladek@suse.com,
	johannes.berg@intel.com, emmanuel.grumbach@intel.com,
	luciano.coelho@intel.com, kvalo@codeaurora.org, luto@kernel.org,
	takahiro.akashi@linaro.org, dhowells@redhat.com,
	pjones@redhat.com
Cc: linux-kernel@vger.kernel.org, linux-fpga@vger.kernel.org,
	Yi Li <yi1.li@linux.intel.com>
Subject: [PATCHv2 3/3] test: add no_cache to driver_data load tester
Date: Sat, 20 May 2017 01:46:59 -0500	[thread overview]
Message-ID: <1495262819-981-4-git-send-email-yi1.li@linux.intel.com> (raw)
In-Reply-To: <1495262819-981-1-git-send-email-yi1.li@linux.intel.com>

From: Yi Li <yi1.li@linux.intel.com>

This adds a no_cache flag to simple sync and async test.

Signed-off-by: Yi Li <yi1.li@linux.intel.com>
---
 lib/test_driver_data.c                          | 43 +++++++++++++++++++++++--
 tools/testing/selftests/firmware/driver_data.sh | 36 +++++++++++++++++++++
 2 files changed, 76 insertions(+), 3 deletions(-)

diff --git a/lib/test_driver_data.c b/lib/test_driver_data.c
index 488cc6e..fa7f52b 100644
--- a/lib/test_driver_data.c
+++ b/lib/test_driver_data.c
@@ -64,6 +64,10 @@ int num_test_devs;
  *	struct driver_data_reg_params @optional field for more information.
  * @keep: whether or not we wish to free the driver_data on our own, refer to
  *	the struct driver_data_req_params @keep field for more information.
+ * @no_cache: whether or not we wish to use the internal caching mechanism
+ *      to assist drivers from fetching driver data at resume time after
+ *      suspend, refer to the struct driver_data_req_params .req
+ *      DRIVER_DATA_REQ_NO_CACHE for more information.
  * @enable_opt_cb: whether or not the optional callback should be set
  *	on a trigger. There is no equivalent setting on the struct
  *	driver_data_req_params as this is implementation specific, and in
@@ -112,6 +116,7 @@ struct test_config {
 	bool async;
 	bool optional;
 	bool keep;
+	bool no_cache;
 	bool enable_opt_cb;
 	bool use_api_versioning;
 	u8 api_min;
@@ -337,6 +342,9 @@ static ssize_t config_show(struct device *dev,
 	len += snprintf(buf+len, PAGE_SIZE,
 			"keep:\t\t%s\n",
 			config->keep ? "true" : "false");
+	len += snprintf(buf+len, PAGE_SIZE,
+			"no_cache:\t\t%s\n",
+			config->no_cache ? "true" : "false");
 
 	mutex_unlock(&test_dev->config_mutex);
 
@@ -452,7 +460,8 @@ static int trigger_config_sync(struct driver_data_test_device *test_dev)
 		DRIVER_DATA_SYNC_OPT_CB(config_sync_req_default_cb,
 					     test_dev),
 		.reqs = (config->optional ? DRIVER_DATA_REQ_OPTIONAL : 0) |
-			(config->keep ? DRIVER_DATA_REQ_KEEP : 0),
+			(config->keep ? DRIVER_DATA_REQ_KEEP : 0) |
+			(config->no_cache ? DRIVER_DATA_REQ_NO_CACHE : 0),
 	};
 	const struct driver_data_req_params *req_params;
 
@@ -518,19 +527,22 @@ static int trigger_config_async(struct driver_data_test_device *test_dev)
 	const struct driver_data_req_params req_params_default = {
 		DRIVER_DATA_DEFAULT_ASYNC(config_async_req_cb, test_dev),
 		.reqs = (config->optional ? DRIVER_DATA_REQ_OPTIONAL : 0) |
-			(config->keep ? DRIVER_DATA_REQ_KEEP : 0),
+			(config->keep ? DRIVER_DATA_REQ_KEEP : 0) |
+			(config->no_cache ? DRIVER_DATA_REQ_NO_CACHE : 0),
 	};
 	const struct driver_data_req_params req_params_opt_cb = {
 		DRIVER_DATA_DEFAULT_ASYNC(config_async_req_cb, test_dev),
 		DRIVER_DATA_ASYNC_OPT_CB(config_async_req_default_cb, test_dev),
 		.reqs = (config->optional ? DRIVER_DATA_REQ_OPTIONAL : 0) |
-			(config->keep ? DRIVER_DATA_REQ_KEEP : 0),
+			(config->keep ? DRIVER_DATA_REQ_KEEP : 0) |
+			(config->no_cache ? DRIVER_DATA_REQ_NO_CACHE : 0),
 	};
 	const struct driver_data_req_params req_params_api = {
 		DRIVER_DATA_API_CB(config_async_req_api_cb, test_dev),
 		DRIVER_DATA_API(config->api_min, config->api_max, config->api_name_postfix),
 		.reqs = (config->optional ? DRIVER_DATA_REQ_OPTIONAL : 0) |
 			(config->keep ? DRIVER_DATA_REQ_KEEP : 0) |
+			(config->no_cache ? DRIVER_DATA_REQ_NO_CACHE : 0) |
 			(config->use_api_versioning ? DRIVER_DATA_REQ_USE_API_VERSIONING : 0),
 	};
 	const struct driver_data_req_params *req_params;
@@ -656,6 +668,7 @@ static int __driver_data_config_init(struct test_config *config)
 	config->async = false;
 	config->optional = false;
 	config->keep = false;
+	config->no_cache = false;
 	config->enable_opt_cb = false;
 	config->use_api_versioning = false;
 	config->api_min = 0;
@@ -975,6 +988,29 @@ static ssize_t config_keep_show(struct device *dev,
 }
 static DEVICE_ATTR(config_keep, 0644, config_keep_show, config_keep_store);
 
+static ssize_t config_no_cache_store(struct device *dev,
+				 struct device_attribute *attr,
+				 const char *buf, size_t count)
+{
+	struct driver_data_test_device *test_dev = dev_to_test_dev(dev);
+	struct test_config *config = &test_dev->config;
+
+	return test_dev_config_update_bool(test_dev, buf, count,
+					   &config->no_cache);
+}
+
+static ssize_t config_no_cache_show(struct device *dev,
+				struct device_attribute *attr,
+				char *buf)
+{
+	struct driver_data_test_device *test_dev = dev_to_test_dev(dev);
+	struct test_config *config = &test_dev->config;
+
+	return test_dev_config_show_bool(test_dev, buf, config->no_cache);
+}
+static DEVICE_ATTR(config_no_cache, 0644, config_no_cache_show,
+		   config_no_cache_store);
+
 static ssize_t config_enable_opt_cb_store(struct device *dev,
 					  struct device_attribute *attr,
 					  const char *buf, size_t count)
@@ -1132,6 +1168,7 @@ static struct attribute *test_dev_attrs[] = {
 	TEST_DRIVER_DATA_DEV_ATTR(config_async),
 	TEST_DRIVER_DATA_DEV_ATTR(config_optional),
 	TEST_DRIVER_DATA_DEV_ATTR(config_keep),
+	TEST_DRIVER_DATA_DEV_ATTR(config_no_cache),
 	TEST_DRIVER_DATA_DEV_ATTR(config_use_api_versioning),
 	TEST_DRIVER_DATA_DEV_ATTR(config_enable_opt_cb),
 	TEST_DRIVER_DATA_DEV_ATTR(config_api_min),
diff --git a/tools/testing/selftests/firmware/driver_data.sh b/tools/testing/selftests/firmware/driver_data.sh
index c830d04..82fae0a 100755
--- a/tools/testing/selftests/firmware/driver_data.sh
+++ b/tools/testing/selftests/firmware/driver_data.sh
@@ -212,6 +212,22 @@ config_disable_keep()
 	fi
 }
 
+config_set_no_cache()
+{
+	if ! echo -n 1 >$DIR/config_no_cache; then
+		echo "$0: Unable to set to no_cache" >&2
+		exit 1
+	fi
+}
+
+config_disable_no_cache()
+{
+	if ! echo -n 0 >$DIR/config_no_cache; then
+		echo "$0: Unable to disable no_cache option" >&2
+		exit 1
+	fi
+}
+
 config_enable_opt_cb()
 {
 	if ! echo -n 1 >$DIR/config_enable_opt_cb; then
@@ -525,10 +541,30 @@ driver_data_test_0004a()
 	config_expect_result ${FUNCNAME[0]} SUCCESS
 }
 
+driver_data_test_0004s_no_cache()
+{
+	driver_data_set_sync_defaults
+	config_set_no_cache
+	config_trigger ${FUNCNAME[0]}
+	config_file_should_match ${FUNCNAME[0]}
+	config_expect_result ${FUNCNAME[0]} SUCCESS
+}
+
+driver_data_test_0004a_no_cache()
+{
+	driver_data_set_async_defaults
+	config_set_no_cache
+	config_trigger ${FUNCNAME[0]}
+	config_file_should_match ${FUNCNAME[0]}
+	config_expect_result ${FUNCNAME[0]} SUCCESS
+}
+
 driver_data_test_0004()
 {
 	driver_data_test_0004s
 	driver_data_test_0004a
+	driver_data_test_0004s_no_cache
+	driver_data_test_0004a_no_cache
 }
 
 driver_data_test_0005s()
-- 
2.7.4

  parent reply	other threads:[~2017-05-20  6:52 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-05-20  6:46 [PATCHv2 0/3] Enable no_cache flag to driver_data yi1.li
2017-05-20  6:46 ` [PATCHv2 1/3] firmware_class: move NO_CACHE from private to driver_data_req_params yi1.li
2017-05-20  6:46 ` [PATCHv2 2/3] iwlwifi: use DRIVER_DATA_REQ_NO_CACHE for driver_data yi1.li
2017-05-20  6:46 ` yi1.li [this message]
2017-05-24 19:03 ` [PATCHv2 0/3] Enable no_cache flag to driver_data Luis R. Rodriguez
2017-05-24 20:32   ` Luis R. Rodriguez
2017-05-25 22:30   ` Li, Yi
2017-05-25 22:43     ` Luis R. Rodriguez
2017-05-26 21:05       ` Li, Yi
2017-05-26 21:13         ` Luis R. Rodriguez
2017-06-06 19:31   ` Li, Yi
2017-06-07 17:59     ` Luis R. Rodriguez
2017-06-07 21:00       ` Li, Yi
2017-06-07 23:02         ` Luis R. Rodriguez

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1495262819-981-4-git-send-email-yi1.li@linux.intel.com \
    --to=yi1.li@linux.intel.com \
    --cc=arend.vanspriel@broadcom.com \
    --cc=atull@kernel.org \
    --cc=dhowells@redhat.com \
    --cc=dwmw2@infradead.org \
    --cc=emmanuel.grumbach@intel.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=johannes.berg@intel.com \
    --cc=kvalo@codeaurora.org \
    --cc=linux-fpga@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luciano.coelho@intel.com \
    --cc=luto@kernel.org \
    --cc=mcgrof@kernel.org \
    --cc=moritz.fischer@ettus.com \
    --cc=pjones@redhat.com \
    --cc=pmladek@suse.com \
    --cc=rafal@milecki.pl \
    --cc=rjw@rjwysocki.net \
    --cc=takahiro.akashi@linaro.org \
    --cc=wagi@monom.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.