|
10 | 10 | #include <linux/wait.h>
|
11 | 11 | #include <linux/delay.h>
|
12 | 12 | #include <linux/dma-mapping.h>
|
| 13 | +#include <asm/cacheflush.h> |
13 | 14 | #include "hbm.h"
|
14 | 15 | #include "client.h"
|
15 | 16 |
|
@@ -772,6 +773,14 @@ static void ishtp_cl_send_msg_dma(struct ishtp_device *dev,
|
772 | 773 | /* write msg to dma buf */
|
773 | 774 | memcpy(msg_addr, cl_msg->send_buf.data, cl_msg->send_buf.size);
|
774 | 775 |
|
| 776 | + /* |
| 777 | + * if current fw don't support cache snooping, driver have to |
| 778 | + * flush the cache manually. |
| 779 | + */ |
| 780 | + if (dev->ops->dma_no_cache_snooping && |
| 781 | + dev->ops->dma_no_cache_snooping(dev)) |
| 782 | + clflush_cache_range(msg_addr, cl_msg->send_buf.size); |
| 783 | + |
775 | 784 | /* send dma_xfer hbm msg */
|
776 | 785 | off = msg_addr - (unsigned char *)dev->ishtp_host_dma_tx_buf;
|
777 | 786 | ishtp_hbm_hdr(&hdr, sizeof(struct dma_xfer_hbm));
|
@@ -996,6 +1005,15 @@ void recv_ishtp_cl_msg_dma(struct ishtp_device *dev, void *msg,
|
996 | 1005 | }
|
997 | 1006 |
|
998 | 1007 | buffer = rb->buffer.data;
|
| 1008 | + |
| 1009 | + /* |
| 1010 | + * if current fw don't support cache snooping, driver have to |
| 1011 | + * flush the cache manually. |
| 1012 | + */ |
| 1013 | + if (dev->ops->dma_no_cache_snooping && |
| 1014 | + dev->ops->dma_no_cache_snooping(dev)) |
| 1015 | + clflush_cache_range(msg, hbm->msg_length); |
| 1016 | + |
999 | 1017 | memcpy(buffer, msg, hbm->msg_length);
|
1000 | 1018 | rb->buf_idx = hbm->msg_length;
|
1001 | 1019 |
|
|
0 commit comments