Commit 3f675dbe authored by Carrie.Cai's avatar Carrie.Cai
Browse files

fix 0day bugs for Mont-TSSE in CI test

Montage inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/I975BF


CVE: NA

--------------------------------------------------------

fix the 0day bug report by ci
Reported-by: default avatarkernel test robot <lkp@intel.com>
Closes:https://lore.kernel.org/oe-kbuild-all/202402290504.Dzt3mHvf-lkp@intel.com/



Signed-off-by: default avatarCarrie.Cai <carrie.cai@montage-tech.com>
parent 97ba28f6
Loading
Loading
Loading
Loading
+0 −1
Original line number Diff line number Diff line
@@ -72,7 +72,6 @@ int tsse_devmgr_add_dev(struct tsse_dev *tsse_dev);
void tsse_devmgr_rm_dev(struct tsse_dev *tdev);
int tsse_prepare_restart_dev(struct tsse_dev *tdev);
int tsse_start_dev(struct tsse_dev *tdev);
struct tsse_dev *get_tssedev(int id);

static inline struct tsse_dev *pci_to_tsse_dev(struct pci_dev *pci_dev)
{
+1 −25
Original line number Diff line number Diff line
@@ -34,12 +34,6 @@ static inline void tsse_list_add(struct list_head *new, struct list_head *prev,
	WRITE_ONCE(prev->next, new);
}

static inline void tsse_list_add_tail(struct list_head *new,
				      struct list_head *head)
{
	tsse_list_add(new, head->prev, head);
}

static int tsse_dev_pf_get(struct tsse_dev *vf_tsse_dev)
{
	int ret = 0;
@@ -104,7 +98,7 @@ void tsse_dev_put(struct tsse_dev *tdev)
	}
}

int tsse_stop_dev(struct tsse_dev *tdev, bool busy_exit)
static int tsse_stop_dev(struct tsse_dev *tdev, bool busy_exit)
{
	int times, max_retry = 150;

@@ -209,21 +203,3 @@ struct list_head *tsse_devmgr_get_head(void)
{
	return &tsse_dev_table;
}

struct tsse_dev *get_tssedev(int id)
{
	struct list_head *itr;
	struct tsse_dev *ptr;

	mutex_lock(&tsse_dev_table_lock);

	list_for_each(itr, &tsse_dev_table) {
		ptr = list_entry(itr, struct tsse_dev, list);
		break;
	}

	mutex_unlock(&tsse_dev_table_lock);

	return ptr;
}
EXPORT_SYMBOL_GPL(get_tssedev);
+2 −2
Original line number Diff line number Diff line
@@ -23,7 +23,7 @@
#define SEARCH_PATTERN "MT_CFG_BUILD_VERSION_DETAIL"
#define SEARCH_PATTERN_LEN 28

int fw_send_msg(struct tsse_ipc *tsseipc, struct ipc_msg *msg)
static int fw_send_msg(struct tsse_ipc *tsseipc, struct ipc_msg *msg)
{
	u8 *h2d;
	u32 int_reg;
@@ -48,7 +48,7 @@ int fw_send_msg(struct tsse_ipc *tsseipc, struct ipc_msg *msg)
	return 0;
}

void fw_free(void *msg_t)
static void fw_free(void *msg_t)
{
	struct tsse_msg *tssemsg;
	struct ipc_msg *payload;
+5 −17
Original line number Diff line number Diff line
@@ -14,7 +14,7 @@
#include "tsse_dev.h"
#include "tsse_service.h"

struct tsse_msg *get_msginf(void __iomem *d2h)
static struct tsse_msg *get_msginf(void __iomem *d2h)
{
	uint32_t u_len;
	struct tsse_msg *tssemsg;
@@ -38,7 +38,7 @@ struct tsse_msg *get_msginf(void __iomem *d2h)
	return tssemsg;
}

void ipc_recieve_msg(struct tsse_ipc *tsseipc, struct ipc_msg *msg)
static void ipc_recieve_msg(struct tsse_ipc *tsseipc, struct ipc_msg *msg)
{
	uint32_t u_len = msg->header.i_len - sizeof(struct ipc_header);
	uint32_t *msg_data = NULL;
@@ -50,7 +50,7 @@ void ipc_recieve_msg(struct tsse_ipc *tsseipc, struct ipc_msg *msg)

}

int msg_rout(struct tsse_ipc *tsseipc, struct tsse_msg *tssemsg)
static int msg_rout(struct tsse_ipc *tsseipc, struct tsse_msg *tssemsg)
{
	int ret = 0;
	struct ipc_msg *msg;
@@ -100,26 +100,14 @@ void notify_device(struct tsse_ipc *tsseipc)
}
EXPORT_SYMBOL(notify_device);

void ipc_send_msg(struct tsse_ipc *tsseipc, struct ipc_data *msg)
{
	u8 *h2d = NULL;

	h2d = (u8 *)(tsseipc->virt_addr + HOST2MAIN_IPC_OFFSET);
	memcpy_toio(h2d, msg, sizeof(struct ipc_header));
	memcpy_toio(h2d + sizeof(struct ipc_header), (u32 *)msg->i_ptr,
		    msg->header.i_len - sizeof(struct ipc_header));
	return;

}

void ipc_hw_init(struct tsse_ipc *hw_ipc)
static void ipc_hw_init(struct tsse_ipc *hw_ipc)
{
	writel(0x1, hw_ipc->virt_addr + MAIN2HOST_INTR_ENABLE_OFFSET);
	writel(0x0, hw_ipc->virt_addr + HOST2MAIN_INTR_SET_OFFSET);
	writel(0x0, hw_ipc->virt_addr + MAIN2HOST_INTR_SET_OFFSET);
}

int ipc_init_msg(struct tsse_ipc *tsseipc)
static int ipc_init_msg(struct tsse_ipc *tsseipc)
{
	u8 *h2d;
	u32 int_reg;
+3 −5
Original line number Diff line number Diff line
@@ -5,14 +5,13 @@
 * Copyright © 2023 Montage Technology. All rights reserved.
 */
#include <linux/errno.h>
#include "tsse_ipc.h"
#include "tsse_fw_service.h"
#include "tsse_service.h"

int service_rout(struct tsse_ipc *tsseipc, struct ipc_msg *msg)
{
	struct msg_info *info;
	uint32_t msg_class;
	int ret;
	int ret = 0;

	info = (struct msg_info *)msg->i_data;
	msg_class = info->msg_class;
@@ -25,6 +24,5 @@ int service_rout(struct tsse_ipc *tsseipc, struct ipc_msg *msg)
		ret = -EINVAL;
		break;
	}
	return 0;

	return ret;
}