bcm: vcsm: fix for WORKAROUND to build on arm64 26/161226/2
authorSeung-Woo Kim <sw0312.kim@samsung.com>
Wed, 22 Nov 2017 07:38:09 +0000 (16:38 +0900)
committerSeung-Woo Kim <sw0312.kim@samsung.com>
Wed, 22 Nov 2017 07:45:50 +0000 (07:45 +0000)
The vcsm module for bcm has build error on arm64 because of not
matched pointer size and l2 cache function. Fix for WORKAROUND to
build on arm64 with commenting out cache functions and converting
pointer with proper size.

NOTE: it comments out cache operations, so it is not clear to work
properly.

Change-Id: Id67ae8aeaf59d7534dea6e3e39a0be322e04aa04
Signed-off-by: Seung-Woo Kim <sw0312.kim@samsung.com>
drivers/char/broadcom/vc_sm/vc_vchi_sm.c
drivers/char/broadcom/vc_sm/vmcs_sm.c

index 7c6ba1a244a8aff8132e0177e02b2b2a6cd364e0..ae2b9e43867cbe358dd68cc773f919b5de814d93 100644 (file)
@@ -318,7 +318,7 @@ VC_VCHI_SM_HANDLE_T vc_vchi_sm_init(VCHI_INSTANCE_T vchi_instance,
        set_user_nice(instance->io_thread, -10);
        wake_up_process(instance->io_thread);
 
-       pr_debug("%s: success - instance 0x%x", __func__, (unsigned)instance);
+       pr_debug("%s: success - instance %p", __func__, instance);
        return instance;
 
 err_close_services:
index ee4e05948c439a9045e0b65566d57587177a32e2..799ac9cf70107815718b52772da26c84e27eb880 100644 (file)
@@ -500,8 +500,8 @@ static int vc_sm_global_state_show(struct seq_file *s, void *v)
        if (sm_state == NULL)
                return 0;
 
-       seq_printf(s, "\nVC-ServiceHandle     0x%x\n",
-                  (unsigned int)sm_state->sm_handle);
+       seq_printf(s, "\nVC-ServiceHandle     %p\n",
+                  sm_state->sm_handle);
 
        /* Log all applicable mapping(s).
         */
@@ -512,8 +512,8 @@ static int vc_sm_global_state_show(struct seq_file *s, void *v)
                list_for_each_entry(map, &sm_state->map_list, map_list) {
                        map_count++;
 
-                       seq_printf(s, "\nMapping                0x%x\n",
-                                  (unsigned int)map);
+                       seq_printf(s, "\nMapping                %p\n",
+                                  map);
                        seq_printf(s, "           TGID        %u\n",
                                   map->res_pid);
                        seq_printf(s, "           VC-HDL      0x%x\n",
@@ -1153,8 +1153,10 @@ static int vcsm_vma_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
                }
 
                pfn = vcaddr_to_pfn((unsigned long)resource->res_base_mem);
+#ifdef CONFIG_ARM
                outer_inv_range(__pfn_to_phys(pfn),
                                __pfn_to_phys(pfn) + resource->res_size);
+#endif
 
                resource->res_stats[LOCK]++;
                resource->lock_count++;
@@ -1170,7 +1172,7 @@ static int vcsm_vma_fault(struct vm_area_struct *vma, struct vm_fault *vmf)
 
        /* We don't use vmf->pgoff since that has the fake offset */
        page_offset = ((unsigned long)vmf->virtual_address - vma->vm_start);
-       pfn = (uint32_t)resource->res_base_mem & 0x3FFFFFFF;
+       pfn = (unsigned long)resource->res_base_mem & 0x3FFFFFFF;
        pfn += mm_vc_mem_phys_addr;
        pfn += page_offset;
        pfn >>= PAGE_SHIFT;
@@ -1247,10 +1249,12 @@ static void vcsm_vma_cache_clean_page_range(unsigned long addr,
                                            || !pte_present(*pte))
                                                continue;
 
+#ifdef CONFIG_ARM
                                        /* Clean + invalidate */
                                        dmac_flush_range((const void *) addr,
                                                         (const void *)
                                                         (addr + PAGE_SIZE));
+#endif
 
                                } while (pte++, addr +=
                                         PAGE_SIZE, addr != pmd_next);
@@ -1741,7 +1745,7 @@ static int vc_sm_ioctl_lock(struct SM_PRIV_DATA_T *private,
        /* Lock assumed taken already, address to be mapped is known.
         */
        else
-               resource->res_base_mem = (void *)vc_addr;
+               resource->res_base_mem = (void *)(unsigned long)vc_addr;
 
        resource->res_stats[LOCK]++;
        resource->lock_count++;
@@ -1802,7 +1806,7 @@ static int vc_sm_ioctl_lock(struct SM_PRIV_DATA_T *private,
                                ret = -ENOMEM;
                                goto error;
                        } else {
-                               phys_addr = (uint32_t)resource->res_base_mem &
+                               phys_addr = (unsigned long)resource->res_base_mem &
                                    0x3FFFFFFF;
                                phys_addr += mm_vc_mem_phys_addr;
                                if (resource->res_cached
@@ -1891,7 +1895,7 @@ static int vc_sm_ioctl_unlock(struct SM_PRIV_DATA_T *private,
                        resource->res_stats[FLUSH]++;
 
                        phys_addr =
-                           (dma_addr_t)((uint32_t)resource->res_base_mem &
+                           (dma_addr_t)((unsigned long)resource->res_base_mem &
                                         0x3FFFFFFF);
                        phys_addr += (dma_addr_t)mm_vc_mem_phys_addr;
 
@@ -1911,10 +1915,12 @@ static int vc_sm_ioctl_unlock(struct SM_PRIV_DATA_T *private,
                        }
                        up_read(&current->mm->mmap_sem);
 
+#ifdef CONFIG_ARM
                        /* L2 cache flush */
                        outer_clean_range(phys_addr,
                                          phys_addr +
                                          (size_t) resource->res_size);
+#endif
                }
 
                /* We need to zap all the vmas associated with this resource */
@@ -1946,11 +1952,12 @@ static int vc_sm_ioctl_unlock(struct SM_PRIV_DATA_T *private,
                                                                        VMCS_SM_CACHE_HOST)) {
                                                        long unsigned int
                                                                phys_addr;
-                                                       phys_addr = (uint32_t)
+                                                       phys_addr = (unsigned long)
                                                                resource->res_base_mem & 0x3FFFFFFF;
                                                        phys_addr +=
                                                                mm_vc_mem_phys_addr;
 
+#ifdef CONFIG_ARM
                                                        /* L1 cache flush */
                                                        dmac_flush_range((const
                                                                                void
@@ -1964,6 +1971,7 @@ static int vc_sm_ioctl_unlock(struct SM_PRIV_DATA_T *private,
                                                                 phys_addr +
                                                                 (size_t)
                                                                 resource->res_size);
+#endif
                                                }
 
                                                iounmap((void *)map->res_addr);
@@ -2577,7 +2585,7 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
                            vmcs_sm_acquire_resource(file_data, ioparam.handle);
                        if (resource != NULL) {
                                ioparam.addr =
-                                       (unsigned int)resource->res_base_mem;
+                                       (unsigned long)resource->res_base_mem;
                                vmcs_sm_release_resource(resource, 0);
                        } else {
                                ioparam.addr = 0;
@@ -2654,7 +2662,7 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
                                resource->res_stats[FLUSH]++;
 
                                phys_addr =
-                                   (dma_addr_t)((uint32_t)
+                                   (dma_addr_t)((unsigned long)
                                                 resource->res_base_mem &
                                                 0x3FFFFFFF);
                                phys_addr += (dma_addr_t)mm_vc_mem_phys_addr;
@@ -2668,10 +2676,12 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
                                                                ioparam.size);
                                up_read(&current->mm->mmap_sem);
 
+#ifdef CONFIG_ARM
                                /* L2 cache flush */
                                outer_clean_range(phys_addr,
                                                  phys_addr +
                                                  (size_t) ioparam.size);
+#endif
                        } else if (resource == NULL) {
                                ret = -EINVAL;
                                goto out;
@@ -2710,15 +2720,17 @@ static long vc_sm_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
                                resource->res_stats[INVALID]++;
 
                                phys_addr =
-                                   (dma_addr_t)((uint32_t)
+                                   (dma_addr_t)((unsigned long)
                                                 resource->res_base_mem &
                                                 0x3FFFFFFF);
                                phys_addr += (dma_addr_t)mm_vc_mem_phys_addr;
 
+#ifdef CONFIG_ARM
                                /* L2 cache invalidate */
                                outer_inv_range(phys_addr,
                                                phys_addr +
                                                (size_t) ioparam.size);
+#endif
 
                                /* L1 cache invalidate */
                                down_read(&current->mm->mmap_sem);