HV: fix sbuf "Casting operation to a pointer"

ACRN Coding guidelines requires two different types pointer can't
convert to each other, except void *.

Tracked-On: #861
Signed-off-by: Huihuang Shi <huihuang.shi@intel.com>
Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
Huihuang Shi 2019-07-09 11:20:04 +08:00 committed by wenlingz
parent 79d033027b
commit 2ec1694901
5 changed files with 10 additions and 15 deletions

View File

@ -89,7 +89,7 @@ void do_logmsg(uint32_t severity, const char *fmt, ...)
/* Check if flags specify to output to memory */
if (do_mem_log) {
uint32_t i, msg_len;
struct shared_buf *sbuf = (struct shared_buf *)per_cpu(sbuf, pcpu_id)[ACRN_HVLOG];
struct shared_buf *sbuf = per_cpu(sbuf, pcpu_id)[ACRN_HVLOG];
/* If sbuf is not ready, we just drop the massage */
if (sbuf != NULL) {

View File

@ -319,8 +319,7 @@ static int32_t profiling_generate_data(int32_t collector, uint32_t type)
__func__, get_pcpu_id());
if (collector == COLLECT_PROFILE_DATA) {
sbuf = (struct shared_buf *)
per_cpu(sbuf, get_pcpu_id())[ACRN_SEP];
sbuf = per_cpu(sbuf, get_pcpu_id())[ACRN_SEP];
if (sbuf == NULL) {
ss->samples_dropped++;
@ -381,21 +380,18 @@ static int32_t profiling_generate_data(int32_t collector, uint32_t type)
}
for (i = 0U; i < (((DATA_HEADER_SIZE - 1U) / SEP_BUF_ENTRY_SIZE) + 1U); i++) {
(void)sbuf_put((struct shared_buf *)sbuf,
(uint8_t *)&pkt_header + i * SEP_BUF_ENTRY_SIZE);
(void)sbuf_put(sbuf, (uint8_t *)&pkt_header + i * SEP_BUF_ENTRY_SIZE);
}
for (i = 0U; i < (((payload_size - 1U) / SEP_BUF_ENTRY_SIZE) + 1U); i++) {
(void)sbuf_put((struct shared_buf *)sbuf,
(uint8_t *)payload + i * SEP_BUF_ENTRY_SIZE);
(void)sbuf_put(sbuf, (uint8_t *)payload + i * SEP_BUF_ENTRY_SIZE);
}
ss->samples_logged++;
}
} else if (collector == COLLECT_POWER_DATA) {
sbuf = (struct shared_buf *)
per_cpu(sbuf, get_pcpu_id())[ACRN_SOCWATCH];
sbuf = per_cpu(sbuf, get_pcpu_id())[ACRN_SOCWATCH];
if (sbuf == NULL) {
dev_dbg(ACRN_DBG_PROFILING,
@ -455,11 +451,11 @@ static int32_t profiling_generate_data(int32_t collector, uint32_t type)
return 0;
}
/* copy header */
(void)profiling_sbuf_put_variable((struct shared_buf *)sbuf,
(void)profiling_sbuf_put_variable(sbuf,
(uint8_t *)&pkt_header, (uint32_t)DATA_HEADER_SIZE);
/* copy payload */
(void)profiling_sbuf_put_variable((struct shared_buf *)sbuf,
(void)profiling_sbuf_put_variable(sbuf,
(uint8_t *)payload, (uint32_t)payload_size);
spinlock_irqrestore_release(sw_lock, rflags);

View File

@ -85,7 +85,7 @@ int32_t sbuf_share_setup(uint16_t pcpu_id, uint32_t sbuf_id, uint64_t *hva)
return -EINVAL;
}
per_cpu(sbuf, pcpu_id)[sbuf_id] = hva;
per_cpu(sbuf, pcpu_id)[sbuf_id] = (struct shared_buf *) hva;
pr_info("%s share sbuf for pCPU[%u] with sbuf_id[%u] setup successfully",
__func__, pcpu_id, sbuf_id);

View File

@ -49,8 +49,7 @@ static inline bool trace_check(uint16_t cpu_id)
static inline void trace_put(uint16_t cpu_id, uint32_t evid, uint32_t n_data, struct trace_entry *entry)
{
struct shared_buf *sbuf = (struct shared_buf *)
per_cpu(sbuf, cpu_id)[ACRN_TRACE];
struct shared_buf *sbuf = per_cpu(sbuf, cpu_id)[ACRN_TRACE];
entry->tsc = rdtsc();
entry->id = evid;

View File

@ -24,7 +24,7 @@ struct per_cpu_region {
uint8_t vmxon_region[PAGE_SIZE];
void *vmcs_run;
#ifdef HV_DEBUG
uint64_t *sbuf[ACRN_SBUF_ID_MAX];
struct shared_buf *sbuf[ACRN_SBUF_ID_MAX];
char logbuf[LOG_MESSAGE_MAX_SIZE];
uint32_t npk_log_ref;
#endif