Commit 1cd3626e authored by Wujiahai's avatar Wujiahai Committed by Peng Zhang
Browse files

BMA: Fix edma driver initialization problem and change the version number.

driver inclusion
category: bugfix
bugzilla: https://gitee.com/openeuler/kernel/issues/IAMW2S


CVE: NA

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

1. The initialization sequence of the edma_host.timer timer
 and edma_host is optimized when the iBMA initializes the edma driver.
2. Change the iBMA driver version.

Fixes: f0db1bf5 ("Huawei BMA: Adding Huawei BMA driver: host_edma_drv")
Signed-off-by: default avatarWujiahai <wujiahai@huawei.com>
parent b4480f1e
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
@@ -28,7 +28,7 @@
#ifdef DRV_VERSION
#define CDEV_VERSION		MICRO_TO_STR(DRV_VERSION)
#else
#define CDEV_VERSION		"0.3.7"
#define CDEV_VERSION		"0.3.8"
#endif

#define CDEV_DEFAULT_NUM	4
+1 −1
Original line number Diff line number Diff line
@@ -71,7 +71,7 @@ struct bma_pci_dev_s {
#ifdef DRV_VERSION
#define BMA_VERSION MICRO_TO_STR(DRV_VERSION)
#else
#define BMA_VERSION "0.3.7"
#define BMA_VERSION "0.3.8"
#endif

#ifdef CONFIG_ARM64
+34 −46
Original line number Diff line number Diff line
@@ -1319,47 +1319,15 @@ int edma_host_init(struct edma_host_s *edma_host)

	edma_host->pdev = bma_dev->bma_pci_dev->pdev;

#ifdef EDMA_TIMER
	#ifdef HAVE_TIMER_SETUP
		timer_setup(&edma_host->timer, edma_host_timeout, 0);
	#else
		setup_timer(&edma_host->timer, edma_host_timeout,
			    (unsigned long)edma_host);
	#endif
	(void)mod_timer(&edma_host->timer, jiffies_64 + TIMER_INTERVAL_CHECK);
#ifdef USE_DMA
	#ifdef HAVE_TIMER_SETUP
		timer_setup(&edma_host->dma_timer, edma_host_dma_timeout, 0);

	#else
		setup_timer(&edma_host->dma_timer, edma_host_dma_timeout,
			    (unsigned long)edma_host);
	#endif
	(void)mod_timer(&edma_host->dma_timer,
			jiffies_64 + DMA_TIMER_INTERVAL_CHECK);
#endif

#else
	init_completion(&edma_host->msg_ready);

	edma_host->edma_thread =
	    kthread_run(edma_host_thread, (void *)edma_host, "edma_host_msg");

	if (IS_ERR(edma_host->edma_thread)) {
		BMA_LOG(DLOG_ERROR, "kernel_run  edma_host_msg failed\n");
		return PTR_ERR(edma_host->edma_thread);
	}
#endif

	edma_host->msg_send_buf = kmalloc(HOST_MAX_SEND_MBX_LEN, GFP_KERNEL);
	if (!edma_host->msg_send_buf) {
		BMA_LOG(DLOG_ERROR, "malloc msg_send_buf failed!");
		ret = -ENOMEM;
		goto failed1;
		return ret;
	}

	edma_host->msg_send_write = 0;

	/* init send_msg_lock before timer setup */
	spin_lock_init(&edma_host->send_msg_lock);

	tasklet_init(&edma_host->tasklet,
@@ -1392,6 +1360,38 @@ int edma_host_init(struct edma_host_s *edma_host)
	edma_host->h2b_state = H2BSTATE_IDLE;
	edma_host->b2h_state = B2HSTATE_IDLE;

#ifdef EDMA_TIMER
	#ifdef HAVE_TIMER_SETUP
		timer_setup(&edma_host->timer, edma_host_timeout, 0);
	#else
		setup_timer(&edma_host->timer, edma_host_timeout,
			    (unsigned long)edma_host);
	#endif
	(void)mod_timer(&edma_host->timer, jiffies_64 + TIMER_INTERVAL_CHECK);
#ifdef USE_DMA
	#ifdef HAVE_TIMER_SETUP
		timer_setup(&edma_host->dma_timer, edma_host_dma_timeout, 0);

	#else
		setup_timer(&edma_host->dma_timer, edma_host_dma_timeout,
			    (unsigned long)edma_host);
	#endif
	(void)mod_timer(&edma_host->dma_timer,
			jiffies_64 + DMA_TIMER_INTERVAL_CHECK);
#endif

#else
	init_completion(&edma_host->msg_ready);

	edma_host->edma_thread =
	    kthread_run(edma_host_thread, (void *)edma_host, "edma_host_msg");

	if (IS_ERR(edma_host->edma_thread)) {
		BMA_LOG(DLOG_ERROR, "kernel_run  edma_host_msg failed\n");
		return PTR_ERR(edma_host->edma_thread);
	}
#endif

	#ifdef HAVE_TIMER_SETUP
		timer_setup(&edma_host->heartbeat_timer,
			    edma_host_heartbeat_timer, 0);
@@ -1415,18 +1415,6 @@ int edma_host_init(struct edma_host_s *edma_host)
	BMA_LOG(DLOG_ERROR, "thread ok\n");
#endif
	return 0;

failed1:
#ifdef EDMA_TIMER
	(void)del_timer_sync(&edma_host->timer);
#ifdef USE_DMA
	(void)del_timer_sync(&edma_host->dma_timer);
#endif
#else
	kthread_stop(edma_host->edma_thread);
	complete(&edma_host->msg_ready);
#endif
	return ret;
}

void edma_host_cleanup(struct edma_host_s *edma_host)
+1 −1
Original line number Diff line number Diff line
@@ -23,7 +23,7 @@
#ifdef DRV_VERSION
#define KBOX_VERSION MICRO_TO_STR(DRV_VERSION)
#else
#define KBOX_VERSION "0.3.7"
#define KBOX_VERSION "0.3.8"
#endif

#define UNUSED(x) (x = x)
+1 −1
Original line number Diff line number Diff line
@@ -31,7 +31,7 @@ extern "C" {
#ifdef DRV_VERSION
#define VETH_VERSION	MICRO_TO_STR(DRV_VERSION)
#else
#define VETH_VERSION	"0.3.7"
#define VETH_VERSION	"0.3.8"
#endif

#define MODULE_NAME	"veth"