lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <1495262819-981-2-git-send-email-yi1.li@linux.intel.com>
Date:   Sat, 20 May 2017 01:46:57 -0500
From:   yi1.li@...ux.intel.com
To:     mcgrof@...nel.org, atull@...nel.org, gregkh@...uxfoundation.org,
        wagi@...om.org, dwmw2@...radead.org, rafal@...ecki.pl,
        arend.vanspriel@...adcom.com, rjw@...ysocki.net,
        moritz.fischer@...us.com, pmladek@...e.com,
        johannes.berg@...el.com, emmanuel.grumbach@...el.com,
        luciano.coelho@...el.com, kvalo@...eaurora.org, luto@...nel.org,
        takahiro.akashi@...aro.org, dhowells@...hat.com, pjones@...hat.com
Cc:     linux-kernel@...r.kernel.org, linux-fpga@...r.kernel.org,
        Yi Li <yi1.li@...ux.intel.com>
Subject: [PATCHv2 1/3] firmware_class: move NO_CACHE from private to driver_data_req_params

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

This adds DRIVER_DATA_REQ_NO_CACHE flag with .req flag under struct
driver_data_req_params. When this flag is set, the driver_data driver
will bypass the internal caching mechanism, its used by streaming
case and other drivers which implement their own cache thing.

Signed-off-by: Yi Li <yi1.li@...ux.intel.com>
---
 drivers/base/firmware_class.c | 16 +++++++---------
 include/linux/driver_data.h   |  4 ++++
 2 files changed, 11 insertions(+), 9 deletions(-)

diff --git a/drivers/base/firmware_class.c b/drivers/base/firmware_class.c
index 7af430a..444c9a8 100644
--- a/drivers/base/firmware_class.c
+++ b/drivers/base/firmware_class.c
@@ -72,14 +72,10 @@ enum driver_data_mode {
  * 	issue a uevent to userspace. Userspace in turn is expected to be
  * 	monitoring for uevents for the firmware_class and will use the
  * 	exposted sysfs interface to upload the driver data for the caller.
- * @DRIVER_DATA_PRIV_REQ_NO_CACHE: indicates that the driver data request
- * 	should not set up and use the internal caching mechanism to assist
- * 	drivers from fetching driver data at resume time after suspend.
  */
 enum driver_data_priv_reqs {
 	DRIVER_DATA_PRIV_REQ_FALLBACK			= 1 << 0,
 	DRIVER_DATA_PRIV_REQ_FALLBACK_UEVENT		= 1 << 1,
-	DRIVER_DATA_PRIV_REQ_NO_CACHE			= 1 << 2,
 };
 
 /**
@@ -151,10 +147,12 @@ struct driver_data_params {
 	}
 
 #define __DATA_REQ_FIRMWARE_BUF(buf, size)				\
+	.req_params = {							\
+		.reqs = DRIVER_DATA_REQ_NO_CACHE,			\
+	},								\
 	.priv_params = {						\
 		.priv_reqs = DRIVER_DATA_PRIV_REQ_FALLBACK |		\
-			     DRIVER_DATA_PRIV_REQ_FALLBACK_UEVENT |	\
-			     DRIVER_DATA_PRIV_REQ_NO_CACHE,		\
+			     DRIVER_DATA_PRIV_REQ_FALLBACK_UEVENT,	\
 		.alloc_buf = buf,					\
 		.alloc_buf_size = size,					\
 	}
@@ -186,7 +184,7 @@ struct driver_data_params {
 #define driver_data_param_uevent(params)	\
 	(!!((params)->priv_reqs & DRIVER_DATA_PRIV_REQ_FALLBACK_UEVENT))
 #define driver_data_param_nocache(params)	\
-	(!!((params)->priv_reqs & DRIVER_DATA_PRIV_REQ_NO_CACHE))
+	(!!((params)->reqs & DRIVER_DATA_REQ_NO_CACHE))
 
 #define driver_data_param_optional(params)	\
 	(!!((params)->reqs & DRIVER_DATA_REQ_OPTIONAL))
@@ -793,14 +791,14 @@ static int assign_firmware_buf(struct firmware *fw, struct device *device,
 	/* don't cache firmware handled without uevent */
 	if (device &&
 	    driver_data_param_uevent(&data_params->priv_params) &&
-	    !driver_data_param_nocache(&data_params->priv_params))
+	    !driver_data_param_nocache(&data_params->req_params))
 		fw_add_devm_name(device, buf->fw_id);
 
 	/*
 	 * After caching firmware image is started, let it piggyback
 	 * on request firmware.
 	 */
-	if (!driver_data_param_nocache(&data_params->priv_params) &&
+	if (!driver_data_param_nocache(&data_params->req_params) &&
 	    buf->fwc->state == FW_LOADER_START_CACHE) {
 		if (fw_cache_piggyback_on_request(buf->fw_id))
 			kref_get(&buf->ref);
diff --git a/include/linux/driver_data.h b/include/linux/driver_data.h
index bf51e0b..b6ef5ee 100644
--- a/include/linux/driver_data.h
+++ b/include/linux/driver_data.h
@@ -117,11 +117,15 @@ union driver_data_cbs {
  *	file to be present given the API range, it is only required for one
  *	file in the API range to be present.  If the %DRIVER_DATA_REQ_OPTIONAL
  *	flag is also enabled then all files are treated as optional.
+ * @DRIVER_DATA_REQ_NO_CACHE: indicates that the driver data request
+ *	should not set up and use the internal caching mechanism to assist
+ *	drivers from fetching driver data at resume time after suspend.
  */
 enum driver_data_reqs {
 	DRIVER_DATA_REQ_OPTIONAL			= 1 << 0,
 	DRIVER_DATA_REQ_KEEP				= 1 << 1,
 	DRIVER_DATA_REQ_USE_API_VERSIONING		= 1 << 2,
+	DRIVER_DATA_REQ_NO_CACHE			= 1 << 3,
 };
 
 /**
-- 
2.7.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ