vcsm: Add new clean/invalidate command for 2D blocks
authorpopcornmix <popcornmix@gmail.com>
Fri, 18 Aug 2017 15:06:57 +0000 (16:06 +0100)
committerpopcornmix <popcornmix@gmail.com>
Tue, 22 Aug 2017 14:23:00 +0000 (15:23 +0100)
host_applications/linux/kernel_headers/vmcs_sm_ioctl.h
host_applications/linux/libs/sm/user-vcsm.c
host_applications/linux/libs/sm/user-vcsm.h

index 55dd64af8cc8be52544dd24564f9e83ef8bb7b33..c7dda8a378df8953be0b71bc512cba30b94bba3f 100644 (file)
@@ -74,6 +74,7 @@ enum vmcs_sm_cmd_e {
        VMCS_SM_CMD_HOST_WALK_PID_MAP,
 
        VMCS_SM_CMD_CLEAN_INVALID,
+       VMCS_SM_CMD_CLEAN_INVALID2,
 
        VMCS_SM_CMD_LAST        /* Do no delete */
 };
@@ -187,6 +188,18 @@ struct vmcs_sm_ioctl_clean_invalid {
        } s[8];
 };
 
+struct vmcs_sm_ioctl_clean_invalid2 {
+       uint8_t op_count;
+       uint8_t zero[3];
+       struct vmcs_sm_ioctl_clean_invalid_block {
+               uint16_t invalidate_mode;
+               uint16_t block_count;
+               void *   start_address;
+               uint32_t block_size;
+               uint32_t inter_block_stride;
+       } s[0];
+};
+
 /* IOCTL numbers */
 #define VMCS_SM_IOCTL_MEM_ALLOC\
        _IOR(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_ALLOC,\
@@ -218,6 +231,9 @@ struct vmcs_sm_ioctl_clean_invalid {
 #define VMCS_SM_IOCTL_MEM_CLEAN_INVALID\
        _IOR(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_CLEAN_INVALID,\
         struct vmcs_sm_ioctl_clean_invalid)
+#define VMCS_SM_IOCTL_MEM_CLEAN_INVALID2\
+       _IOR(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_CLEAN_INVALID2,\
+        struct vmcs_sm_ioctl_clean_invalid2)
 
 #define VMCS_SM_IOCTL_SIZE_USR_HDL\
        _IOR(VMCS_SM_MAGIC_TYPE, VMCS_SM_CMD_SIZE_USR_HANDLE,\
index b5a8a19c24566cbae2110d831392028177dedaf5..48f45cae7f1d1551b6d7152d7f5653375abbdd3f 100644 (file)
@@ -1596,3 +1596,36 @@ int vcsm_clean_invalid( struct vcsm_user_clean_invalid_s *s )
 out:
    return rc;
 }
+
+/* Flush or invalidate the memory associated with this user opaque handle
+**
+** Returns:        non-zero on error
+**
+** structure contains a list of flush/invalidate commands
+** See header file
+*/
+int vcsm_clean_invalid2( struct vcsm_user_clean_invalid2_s *s )
+{
+   int rc = 0;
+
+   if ( vcsm_handle == VCSM_INVALID_HANDLE )
+   {
+      vcos_log_error( "[%s]: [%d]: invalid device or invalid handle!",
+                      __func__,
+                      getpid() );
+
+      rc = -1;
+      goto out;
+   }
+
+   rc = ioctl( vcsm_handle,
+                VMCS_SM_IOCTL_MEM_CLEAN_INVALID2,
+                s );
+
+   /* Done.
+   */
+   goto out;
+
+out:
+   return rc;
+}
index 897066813da3bf8cacdd84d87398f89cca16440b..ecd705970ec26e2b54532c17641cb51c5667e019 100644 (file)
@@ -439,6 +439,20 @@ struct vcsm_user_clean_invalid_s {
 
 int vcsm_clean_invalid( struct vcsm_user_clean_invalid_s *s );
 
+struct vcsm_user_clean_invalid2_s {
+       unsigned char op_count;
+       unsigned char zero[3];
+       struct vcsm_user_clean_invalid2_block_s {
+               unsigned short invalidate_mode;
+               unsigned short block_count;
+               void *   start_address;
+               unsigned int block_size;
+               unsigned int inter_block_stride;
+       } s[0];
+};
+
+int vcsm_clean_invalid2( struct vcsm_user_clean_invalid2_s *s );
+
 #ifdef __cplusplus
 }
 #endif