From 068cfca9e8c54902c45b8c35b49191c766d346c9 Mon Sep 17 00:00:00 2001
From: Sugizaki Yukimasa <i.can.speak.c.and.basic@gmail.com>
Date: Wed, 10 Jan 2018 04:32:20 +0900
Subject: [PATCH 155/454] vcsm: Add no-op cache operation constant

Signed-off-by: Sugizaki Yukimasa <i.can.speak.c.and.basic@gmail.com>
---
 drivers/char/broadcom/vc_sm/vmcs_sm.c  | 10 ++++++++++
 include/linux/broadcom/vmcs_sm_ioctl.h |  1 +
 2 files changed, 11 insertions(+)

--- a/drivers/char/broadcom/vc_sm/vmcs_sm.c
+++ b/drivers/char/broadcom/vc_sm/vmcs_sm.c
@@ -1269,6 +1269,8 @@ static int clean_invalid_mem_2d(const vo
 	}
 
 	switch (cache_op) {
+	case VCSM_CACHE_OP_NOP:
+		return 0;
 	case VCSM_CACHE_OP_INV:
 		op_fn = dmac_inv_range;
 		break;
@@ -1312,6 +1314,8 @@ static int clean_invalid_resource(const
 		return 0;
 
 	switch (cache_op) {
+	case VCSM_CACHE_OP_NOP:
+		return 0;
 	case VCSM_CACHE_OP_INV:
 		stat_attempt = INVALID;
 		stat_failure = INVALID_FAIL;
@@ -2936,6 +2940,9 @@ static long vc_sm_ioctl(struct file *fil
 				goto out;
 			}
 			for (i = 0; i < sizeof(ioparam.s) / sizeof(*ioparam.s); i++) {
+				if (ioparam.s[i].cmd == VCSM_CACHE_OP_NOP)
+					break;
+
 				/* Locate resource from GUID. */
 				resource =
 					vmcs_sm_acquire_resource(file_data, ioparam.s[i].handle);
@@ -2989,6 +2996,9 @@ static long vc_sm_ioctl(struct file *fil
 					ret = clean_invalid_mem_2d((void __user*) op->start_address,
 							op->block_count, op->block_size,
 							op->inter_block_stride, op->invalidate_mode);
+					if (op->invalidate_mode == VCSM_CACHE_OP_NOP)
+						continue;
+
 					if (ret)
 						break;
 				}
--- a/include/linux/broadcom/vmcs_sm_ioctl.h
+++ b/include/linux/broadcom/vmcs_sm_ioctl.h
@@ -172,6 +172,7 @@ struct vmcs_sm_ioctl_cache {
  * Cache functions to be set to struct vmcs_sm_ioctl_clean_invalid cmd and
  * vmcs_sm_ioctl_clean_invalid2 invalidate_mode.
  */
+#define VCSM_CACHE_OP_NOP       0x00
 #define VCSM_CACHE_OP_INV       0x01
 #define VCSM_CACHE_OP_CLEAN     0x02
 #define VCSM_CACHE_OP_FLUSH     0x03
