[9610] drivers: modem_if: change recv buffer property to Cacheable
authorJiyoung Jeong <ji_0.jeong@samsung.com>
Wed, 24 Oct 2018 08:08:26 +0000 (17:08 +0900)
committerDongsik Son <dongsik.son@samsung.com>
Wed, 24 Oct 2018 13:23:38 +0000 (22:23 +0900)
Change-Id: I96a305749625f029e816fd8f0e06490498cbaf75
Signed-off-by: Jiyoung Jeong <ji_0.jeong@samsung.com>
drivers/misc/modem_if/Kconfig
drivers/misc/modem_if/modem_dump.c
drivers/misc/modem_if/modem_link_device_shmem.c
drivers/misc/modem_if/modem_link_device_shmem.h

index 6a5672b857131239d34a2739e28eb53becc8425a..73e946bf7b30fe6132b83b811a2d2b10a9b0fbd8 100644 (file)
@@ -16,6 +16,7 @@ config MODEM_CHIP_MODAP_S3XXAP
        select CP_SECURE_BOOT
        select LINK_DEVICE_NAPI
        select MODEM_IF_NET_GRO
+       select CACHED_RAW_RX_BUFFER
        default n
 
 menu "Configurations"
@@ -58,6 +59,10 @@ config MODEM_IF_NET_GRO
        ---help---
         This enables GRO(Generic Receive Offload) feature
 
+config CACHED_RAW_RX_BUFFER
+       bool "Set cached RX RAW BUFFER for high data performance"
+       default n
+
 config UART_SWITCH
        bool "UART SWITCH Support"
        default n
index f3a2041b44cdd7b380c4958ef01ec76aeb7b0811..b73e8ffbecf3bfe7d7a336931e34756338de06fb 100644 (file)
@@ -30,12 +30,6 @@ static int save_dump_file(struct link_device *ld, struct io_device *iod,
                return -EFAULT;
        }
 
-       ret = copy_to_user((void __user *)arg, &dump_size, sizeof(dump_size));
-       if (ret) {
-               mif_err("ERR! copy_from_user fail!\n");
-               return -EFAULT;
-       }
-
        while (copied < dump_size) {
                if (dump_size - copied < alloc_size)
                        alloc_size =  dump_size - copied;
@@ -79,12 +73,19 @@ int save_vss_dump(struct link_device *ld, struct io_device *iod,
 {
        struct shmem_link_device *shmd = to_shmem_link_device(ld);
        size_t vss_size = shm_get_vss_size();
+       int ret = 0;
 
        if (vss_size == 0 || shmd->vss_base == NULL) {
                mif_err("ERR! save_vss_dump fail!\n");
                return -EFAULT;
        }
 
+       ret = copy_to_user((void __user *)arg, &vss_size, sizeof(vss_size));
+       if (ret) {
+               mif_err("ERR! copy_from_user fail!\n");
+               return -EFAULT;
+       }
+
        return save_dump_file(ld, iod, arg, shmd->vss_base, vss_size);
 }
 
@@ -93,12 +94,19 @@ int save_acpm_dump(struct link_device *ld, struct io_device *iod,
 {
        struct shmem_link_device *shmd = to_shmem_link_device(ld);
        size_t acpm_size = shm_get_acpm_size();
+       int ret = 0;
 
        if (acpm_size == 0 || shmd->acpm_base == NULL) {
                mif_err("ERR! save_acpm_dump fail!\n");
                return -EFAULT;
        }
 
+       ret = copy_to_user((void __user *)arg, &acpm_size, sizeof(acpm_size));
+       if (ret) {
+               mif_err("ERR! copy_from_user fail!\n");
+               return -EFAULT;
+       }
+
        return save_dump_file(ld, iod, arg, shmd->acpm_base, acpm_size);
 }
 
@@ -107,11 +115,32 @@ int save_shmem_dump(struct link_device *ld, struct io_device *iod,
 {
        struct shmem_link_device *shmd = to_shmem_link_device(ld);
        size_t shmem_size = shmd->size;
+       int ret = 0;
+#ifdef CONFIG_CACHED_RAW_RX_BUFFER
+       u8 *rxq_buff;
+       int rxq_buff_size;
+
+       rxq_buff = get_rxq_buff(shmd, IPC_RAW);
+       rxq_buff_size = get_rxq_buff_size(shmd, IPC_RAW);
+#endif
 
        if (shmem_size == 0 || shmd->base == NULL) {
                mif_err("ERR! save_shmem_dump fail!\n");
                return -EFAULT;
        }
 
-       return save_dump_file(ld, iod, arg, (u8 __iomem *)shmd->base, shmem_size);
+       ret = copy_to_user((void __user *)arg, &shmem_size, sizeof(shmem_size));
+       if (ret) {
+               mif_err("ERR! copy_from_user fail!\n");
+               return -EFAULT;
+       }
+
+#ifdef CONFIG_CACHED_RAW_RX_BUFFER
+       ret = save_dump_file(ld, iod, arg, (u8 __iomem *)shmd->base, shmem_size - rxq_buff_size);
+       __inval_dcache_area((void *)rxq_buff, rxq_buff_size);
+       ret = save_dump_file(ld, iod, arg, (u8 __iomem *)rxq_buff, rxq_buff_size);
+#else
+       ret = save_dump_file(ld, iod, arg, (u8 __iomem *)shmd->base, shmem_size);
+#endif
+       return ret;
 }
index 3c4ed5fed949187d08c209a2713774d9bd794215..b0ac06613c1905865e2a242d52837430bbe0b4ad 100644 (file)
@@ -668,6 +668,9 @@ static int rx_ipc_frames(struct shmem_link_device *shmd, int dev,
        int out;        /* index to the start of current frame  */
        int tot;        /* total length including padding data  */
        int rcvd_pkt;   /* number of received packets           */
+#ifdef CONFIG_CACHED_RAW_RX_BUFFER
+       int len;
+#endif
 
        src = circ->buff;
        qsize = circ->qsize;
@@ -678,6 +681,17 @@ static int rx_ipc_frames(struct shmem_link_device *shmd, int dev,
        tot = 0;
        rcvd_pkt = 0;
 
+#ifdef CONFIG_CACHED_RAW_RX_BUFFER
+       if ((out + rcvd) <= qsize) {
+               __inval_dcache_area((void *)(src + out), rcvd);
+       } else {
+               len = qsize - out;
+
+               __inval_dcache_area((void *)(src + out), len);
+               __inval_dcache_area((void *)src, rcvd - len);
+       }
+#endif
+
        while (rest > 0) {
                u8 ch;
 
@@ -779,6 +793,9 @@ static int rx_ipc_frames(struct shmem_link_device *shmd, int dev,
        int rest;       /* size of the rest data                */
        int out;        /* index to the start of current frame  */
        int tot;        /* total length including padding data  */
+#ifdef CONFIG_CACHED_RAW_RX_BUFFER
+       int len;
+#endif
 
        src = circ->buff;
        qsize = circ->qsize;
@@ -788,6 +805,17 @@ static int rx_ipc_frames(struct shmem_link_device *shmd, int dev,
        rest = circ->size;
        tot = 0;
 
+#ifdef CONFIG_CACHED_RAW_RX_BUFFER
+       if ((out + rcvd) <= qsize) {
+               __inval_dcache_area((void *)(src + out), rcvd);
+       } else {
+               len = qsize - out;
+
+               __inval_dcache_area((void *)(src + out), len);
+               __inval_dcache_area((void *)src, rcvd - len);
+       }
+#endif
+
        while (rest > 0) {
                u8 ch;
 
@@ -1188,6 +1216,9 @@ static int rx_udl_frames(struct shmem_link_device *shmd, int dev,
        u32 rest;       /* size of the rest data                */
        u32 out;        /* index to the start of current frame  */
        unsigned int tot;       /* total length including padding data  */
+#ifdef CONFIG_CACHED_RAW_RX_BUFFER
+       int len;
+#endif
 
        src = circ->buff;
        qsize = circ->qsize;
@@ -1195,6 +1226,18 @@ static int rx_udl_frames(struct shmem_link_device *shmd, int dev,
        rcvd = circ->size;
        rest = circ->size;
        tot = 0;
+
+#ifdef CONFIG_CACHED_RAW_RX_BUFFER
+       if ((out + rcvd) <= qsize) {
+               __inval_dcache_area((void *)(src + out), rcvd);
+       } else {
+               len = qsize - out;
+
+               __inval_dcache_area((void *)(src + out), len);
+               __inval_dcache_area((void *)src, rcvd - len);
+       }
+#endif
+
        while (rest > 0) {
                u8 ch;
 
@@ -2254,7 +2297,11 @@ static void shmem_remap_4mb_ipc_region(struct shmem_link_device *shmd)
 
        dev->rxq.head = (u32 __iomem *)&map->raw_rx_head;
        dev->rxq.tail = (u32 __iomem *)&map->raw_rx_tail;
+#ifdef CONFIG_CACHED_RAW_RX_BUFFER
+       dev->rxq.buff = (u8 __iomem *)phys_to_virt(shmd->start + SZ_2M);
+#else
        dev->rxq.buff = (u8 __iomem *)&map->raw_rx_buff[0];
+#endif
        dev->rxq.size = SHM_4M_RAW_RX_BUFF_SZ;
 
        dev->mask_req_ack = INT_MASK_REQ_ACK_R;
@@ -2273,8 +2320,11 @@ static int shmem_init_ipc_map(struct shmem_link_device *shmd)
        else
                return -EINVAL;
 
+#ifdef CONFIG_CACHED_RAW_RX_BUFFER
+       memset(shmd->base, 0, shmd->size - SHM_4M_RAW_RX_BUFF_SZ);
+#else
        memset(shmd->base, 0, shmd->size);
-
+#endif
        shmd->magic = shmd->ipc_map.magic;
        shmd->access = shmd->ipc_map.access;
 
@@ -2879,7 +2929,11 @@ struct link_device *shmem_create_link_device(struct platform_device *pdev)
 
        shmd->start = modem->shmem_base + modem->ipcmem_offset;
        shmd->size = modem->ipc_size;
+#ifdef CONFIG_CACHED_RAW_RX_BUFFER
+       shmd->base = shm_request_region(shmd->start, shmd->size - SHM_4M_RAW_RX_BUFF_SZ);
+#else
        shmd->base = shm_request_region(shmd->start, shmd->size);
+#endif
        if (!shmd->base) {
                mif_err("%s: ERR! shm_request_region fail\n", ld->name);
                goto error;
index 2a3e3ac0c6f1bd7e39533e5877a270585d439124..e11c2c6edae1a3925232ddd79cdc5c1c9d04ce25 100644 (file)
 #ifndef __MODEM_LINK_DEVICE_SHMEM_H__
 #define __MODEM_LINK_DEVICE_SHMEM_H__
 
+#ifdef CONFIG_CACHED_RAW_RX_BUFFER
+#include <asm/cacheflush.h>
+#endif
+
 #include "modem_utils.h"
 #include "modem_link_device_memory.h"