Skip to contentSkip to conversation

bus: mhi: Remove auto-start option

PATCH Applied Loic Poulain 4 participants 11 messages Sep 21, 2020 – Nov 16, 2020

Subsystems (6)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/2 bus: mhi: Remove auto-start option

There is really no point having an auto-start for channels. This is confusing for the device drivers, some have to enable the channels, others don't have... and waste resources (e.g. pre allocated buffers) that may never be used.

This is really up to the MHI device(channel) driver to manage the state of its channels.

---
v2: split MHI and qrtr changes in dedicated commits

 drivers/bus/mhi/core/init.c     | 9 ---------
 drivers/bus/mhi/core/internal.h | 1 -
 include/linux/mhi.h             | 2 --
 3 files changed, 12 deletions(-)
drivers/bus/mhi/core/init.c +0 -9
index dccc824..8798deb 100644
@@ -721,7 +721,6 @@ static int parse_ch_cfg(struct mhi_controller *mhi_cntrl,
 		mhi_chan->offload_ch = ch_cfg->offload_channel;
 		mhi_chan->db_cfg.reset_req = ch_cfg->doorbell_mode_switch;
 		mhi_chan->pre_alloc = ch_cfg->auto_queue;
-		mhi_chan->auto_start = ch_cfg->auto_start;
 
 		/*
 		 * If MHI host allocates buffers, then the channel direction
@@ -1119,11 +1118,6 @@ static int mhi_driver_probe(struct device *dev)
 			goto exit_probe;
 
 		ul_chan->xfer_cb = mhi_drv->ul_xfer_cb;
-		if (ul_chan->auto_start) {
-			ret = mhi_prepare_channel(mhi_cntrl, ul_chan);
-			if (ret)
-				goto exit_probe;
-		}
 	}
 
 	ret = -EINVAL;
@@ -1157,9 +1151,6 @@ static int mhi_driver_probe(struct device *dev)
 	if (ret)
 		goto exit_probe;
 
-	if (dl_chan && dl_chan->auto_start)
-		mhi_prepare_channel(mhi_cntrl, dl_chan);
-
 	mhi_device_put(mhi_dev);
 
 	return ret;
drivers/bus/mhi/core/internal.h +0 -1
index 5a81a42..73b52a0 100644
@@ -563,7 +563,6 @@ struct mhi_chan {
 	bool configured;
 	bool offload_ch;
 	bool pre_alloc;
-	bool auto_start;
 	bool wake_capable;
 };
 
include/linux/mhi.h +0 -2
index 811e686..0d277c7 100644
@@ -214,7 +214,6 @@ enum mhi_db_brst_mode {
  * @offload_channel: The client manages the channel completely
  * @doorbell_mode_switch: Channel switches to doorbell mode on M0 transition
  * @auto_queue: Framework will automatically queue buffers for DL traffic
- * @auto_start: Automatically start (open) this channel
  * @wake-capable: Channel capable of waking up the system
  */
 struct mhi_channel_config {
@@ -232,7 +231,6 @@ struct mhi_channel_config {
 	bool offload_channel;
 	bool doorbell_mode_switch;
 	bool auto_queue;
-	bool auto_start;
 	bool wake_capable;
 };
 
Signature · 1 line
2.7.4
#1 lore raw

PATCH v2 2/2 net: qrtr: Start MHI channels during init

Start MHI device channels so that transfers can be performed. The MHI stack does not auto-start channels anymore.

---
v2: split MHI and qrtr changes in dedicated commits

 net/qrtr/mhi.c | 5 +++++
 1 file changed, 5 insertions(+)
net/qrtr/mhi.c +5 -0
index ff0c414..7100f0b 100644
@@ -76,6 +76,11 @@ static int qcom_mhi_qrtr_probe(struct mhi_device *mhi_dev,
 	struct qrtr_mhi_dev *qdev;
 	int rc;
 
+	/* start channels */
+	rc = mhi_prepare_for_transfer(mhi_dev);
+	if (rc)
+		return rc;
+
 	qdev = devm_kzalloc(&mhi_dev->dev, sizeof(*qdev), GFP_KERNEL);
 	if (!qdev)
 		return -ENOMEM;
Signature · 1 line
2.7.4
Reviewed-by on v2 2/2
#2 lore raw

Re: [PATCH v2 2/2] net: qrtr: Start MHI channels during init

Quoted 4 lines · Loic Poulain

Start MHI device channels so that transfers can be performed. The MHI stack does not auto-start channels anymore.

Dave: I'd like to queue this patch through MHI tree because there is a dependent change in MHI bus. So, can you please provide your Ack?

Thanks,
Mani

Quoted 25 lines

---
v2: split MHI and qrtr changes in dedicated commits

 net/qrtr/mhi.c | 5 +++++
 1 file changed, 5 insertions(+)
net/qrtr/mhi.c +5 -0
index ff0c414..7100f0b 100644
@@ -76,6 +76,11 @@ static int qcom_mhi_qrtr_probe(struct mhi_device *mhi_dev,
 	struct qrtr_mhi_dev *qdev;
 	int rc;
 
+	/* start channels */
+	rc = mhi_prepare_for_transfer(mhi_dev);
+	if (rc)
+		return rc;
+
 	qdev = devm_kzalloc(&mhi_dev->dev, sizeof(*qdev), GFP_KERNEL);
 	if (!qdev)
 		return -ENOMEM;
Signature · 1 line
2.7.4
maintainer Acked-by
#3 lore raw

Re: [PATCH v2 2/2] net: qrtr: Start MHI channels during init

From: Manivannan Sadhasivam <[email protected]>
Date: Sat, 26 Sep 2020 13:26:56 +0530

Quoted 10 lines · Loic Poulain
Quoted 4 lines

Start MHI device channels so that transfers can be performed. The MHI stack does not auto-start channels anymore.

Dave: I'd like to queue this patch through MHI tree because there is a dependent change in MHI bus. So, can you please provide your Ack?

Sure:

#4 lore raw

Re: [PATCH v2 2/2] net: qrtr: Start MHI channels during init

In reply to Loic Poulain
Quoted 4 lines · Loic Poulain

Start MHI device channels so that transfers can be performed. The MHI stack does not auto-start channels anymore.

Applied to mhi-next!

Thanks,
Mani

Quoted 25 lines

---
v2: split MHI and qrtr changes in dedicated commits

 net/qrtr/mhi.c | 5 +++++
 1 file changed, 5 insertions(+)
net/qrtr/mhi.c +5 -0
index ff0c414..7100f0b 100644
@@ -76,6 +76,11 @@ static int qcom_mhi_qrtr_probe(struct mhi_device *mhi_dev,
 	struct qrtr_mhi_dev *qdev;
 	int rc;
 
+	/* start channels */
+	rc = mhi_prepare_for_transfer(mhi_dev);
+	if (rc)
+		return rc;
+
 	qdev = devm_kzalloc(&mhi_dev->dev, sizeof(*qdev), GFP_KERNEL);
 	if (!qdev)
 		return -ENOMEM;
Signature · 1 line
2.7.4
#5 lore raw

Re: [PATCH v2 2/2] net: qrtr: Start MHI channels during init

In reply to Loic Poulain

+ath11k list

Quoted 4 lines · Loic Poulain

Start MHI device channels so that transfers can be performed. The MHI stack does not auto-start channels anymore.

Applied to mhi-ath11k-immutable branch! This branch will get merged into mhi-next and ath-next.

Thanks,
Mani

Quoted 25 lines

---
v2: split MHI and qrtr changes in dedicated commits

 net/qrtr/mhi.c | 5 +++++
 1 file changed, 5 insertions(+)
net/qrtr/mhi.c +5 -0
index ff0c414..7100f0b 100644
@@ -76,6 +76,11 @@ static int qcom_mhi_qrtr_probe(struct mhi_device *mhi_dev,
 	struct qrtr_mhi_dev *qdev;
 	int rc;
 
+	/* start channels */
+	rc = mhi_prepare_for_transfer(mhi_dev);
+	if (rc)
+		return rc;
+
 	qdev = devm_kzalloc(&mhi_dev->dev, sizeof(*qdev), GFP_KERNEL);
 	if (!qdev)
 		return -ENOMEM;
Signature · 1 line
2.7.4
Signature · 3 lines
ath11k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath11k
#6 lore raw
In reply to Loic Poulain
Quoted 9 lines · Loic Poulain

There is really no point having an auto-start for channels. This is confusing for the device drivers, some have to enable the channels, others don't have... and waste resources (e.g. pre allocated buffers) that may never be used.

This is really up to the MHI device(channel) driver to manage the state of its channels.

I need to hold this series for next merge window as this has the dependency with ath11k driver and I'm not sure about the networking tree's merge window.

I'll merge this one and post patches to remove auto_start from ath11k mhi driver for v5.11.

Thanks,
Mani

Quoted 77 lines

---
v2: split MHI and qrtr changes in dedicated commits

 drivers/bus/mhi/core/init.c     | 9 ---------
 drivers/bus/mhi/core/internal.h | 1 -
 include/linux/mhi.h             | 2 --
 3 files changed, 12 deletions(-)
drivers/bus/mhi/core/init.c +0 -9
index dccc824..8798deb 100644
@@ -721,7 +721,6 @@ static int parse_ch_cfg(struct mhi_controller *mhi_cntrl,
 		mhi_chan->offload_ch = ch_cfg->offload_channel;
 		mhi_chan->db_cfg.reset_req = ch_cfg->doorbell_mode_switch;
 		mhi_chan->pre_alloc = ch_cfg->auto_queue;
-		mhi_chan->auto_start = ch_cfg->auto_start;
 
 		/*
 		 * If MHI host allocates buffers, then the channel direction
@@ -1119,11 +1118,6 @@ static int mhi_driver_probe(struct device *dev)
 			goto exit_probe;
 
 		ul_chan->xfer_cb = mhi_drv->ul_xfer_cb;
-		if (ul_chan->auto_start) {
-			ret = mhi_prepare_channel(mhi_cntrl, ul_chan);
-			if (ret)
-				goto exit_probe;
-		}
 	}
 
 	ret = -EINVAL;
@@ -1157,9 +1151,6 @@ static int mhi_driver_probe(struct device *dev)
 	if (ret)
 		goto exit_probe;
 
-	if (dl_chan && dl_chan->auto_start)
-		mhi_prepare_channel(mhi_cntrl, dl_chan);
-
 	mhi_device_put(mhi_dev);
 
 	return ret;
drivers/bus/mhi/core/internal.h +0 -1
index 5a81a42..73b52a0 100644
@@ -563,7 +563,6 @@ struct mhi_chan {
 	bool configured;
 	bool offload_ch;
 	bool pre_alloc;
-	bool auto_start;
 	bool wake_capable;
 };
 
include/linux/mhi.h +0 -2
index 811e686..0d277c7 100644
@@ -214,7 +214,6 @@ enum mhi_db_brst_mode {
  * @offload_channel: The client manages the channel completely
  * @doorbell_mode_switch: Channel switches to doorbell mode on M0 transition
  * @auto_queue: Framework will automatically queue buffers for DL traffic
- * @auto_start: Automatically start (open) this channel
  * @wake-capable: Channel capable of waking up the system
  */
 struct mhi_channel_config {
@@ -232,7 +231,6 @@ struct mhi_channel_config {
 	bool offload_channel;
 	bool doorbell_mode_switch;
 	bool auto_queue;
-	bool auto_start;
 	bool wake_capable;
 };
 
Signature · 1 line
2.7.4
#7 lore raw
In reply to Loic Poulain
Quoted 79 lines · Loic Poulain

There is really no point having an auto-start for channels. This is confusing for the device drivers, some have to enable the channels, others don't have... and waste resources (e.g. pre allocated buffers) that may never be used.

This is really up to the MHI device(channel) driver to manage the state of its channels.

---
v2: split MHI and qrtr changes in dedicated commits

 drivers/bus/mhi/core/init.c     | 9 ---------
 drivers/bus/mhi/core/internal.h | 1 -
 include/linux/mhi.h             | 2 --
 3 files changed, 12 deletions(-)
drivers/bus/mhi/core/init.c +0 -1
index dccc824..8798deb 100644
@@ -721,7 +721,6 @@ static int parse_ch_cfg(struct mhi_controller 
 *mhi_cntrl,
 		mhi_chan->offload_ch = ch_cfg->offload_channel;
 		mhi_chan->db_cfg.reset_req = ch_cfg->doorbell_mode_switch;
 		mhi_chan->pre_alloc = ch_cfg->auto_queue;
-		mhi_chan->auto_start = ch_cfg->auto_start;
 
 		/*
drivers/bus/mhi/core/init.c +0 -8
 		 * If MHI host allocates buffers, then the channel direction
@@ -1119,11 +1118,6 @@ static int mhi_driver_probe(struct device *dev)
 			goto exit_probe;
 
 		ul_chan->xfer_cb = mhi_drv->ul_xfer_cb;
-		if (ul_chan->auto_start) {
-			ret = mhi_prepare_channel(mhi_cntrl, ul_chan);
-			if (ret)
-				goto exit_probe;
-		}
 	}
 
 	ret = -EINVAL;
@@ -1157,9 +1151,6 @@ static int mhi_driver_probe(struct device *dev)
 	if (ret)
 		goto exit_probe;
 
-	if (dl_chan && dl_chan->auto_start)
-		mhi_prepare_channel(mhi_cntrl, dl_chan);
-
 	mhi_device_put(mhi_dev);
 
 	return ret;
drivers/bus/mhi/core/internal.h +0 -1
index 5a81a42..73b52a0 100644
@@ -563,7 +563,6 @@ struct mhi_chan {
 	bool configured;
 	bool offload_ch;
 	bool pre_alloc;
-	bool auto_start;
 	bool wake_capable;
 };
 
include/linux/mhi.h +0 -0
index 811e686..0d277c7 100644
@@ -214,7 +214,6 @@ enum mhi_db_brst_mode {
  * @offload_channel: The client manages the channel completely
  * @doorbell_mode_switch: Channel switches to doorbell mode on M0 

transition
* @auto_queue: Framework will automatically queue buffers for DL
traffic
- * @auto_start: Automatically start (open) this channel
* @wake-capable: Channel capable of waking up the system */
struct mhi_channel_config {

include/linux/mhi.h struct mhi_channel_config { · line 235

Quoted 6 lines
include/linux/mhi.h +0 -1
@@ -232,7 +231,6 @@ struct mhi_channel_config {
 	bool offload_channel;
 	bool doorbell_mode_switch;
 	bool auto_queue;
-	bool auto_start;
 	bool wake_capable;
 };

Chris, are you OK with this? It will change the current behavior where MHI will not start the up link channel before providing QRTR with a probe.

Reviewed-by on v2 1/2
#8 lore raw
In reply to Loic Poulain
Quoted 9 lines · Loic Poulain

There is really no point having an auto-start for channels. This is confusing for the device drivers, some have to enable the channels, others don't have... and waste resources (e.g. pre allocated buffers) that may never be used.

This is really up to the MHI device(channel) driver to manage the state of its channels.

Thanks,
Mani

Quoted 77 lines

---
v2: split MHI and qrtr changes in dedicated commits

 drivers/bus/mhi/core/init.c     | 9 ---------
 drivers/bus/mhi/core/internal.h | 1 -
 include/linux/mhi.h             | 2 --
 3 files changed, 12 deletions(-)
drivers/bus/mhi/core/init.c +0 -9
index dccc824..8798deb 100644
@@ -721,7 +721,6 @@ static int parse_ch_cfg(struct mhi_controller *mhi_cntrl,
 		mhi_chan->offload_ch = ch_cfg->offload_channel;
 		mhi_chan->db_cfg.reset_req = ch_cfg->doorbell_mode_switch;
 		mhi_chan->pre_alloc = ch_cfg->auto_queue;
-		mhi_chan->auto_start = ch_cfg->auto_start;
 
 		/*
 		 * If MHI host allocates buffers, then the channel direction
@@ -1119,11 +1118,6 @@ static int mhi_driver_probe(struct device *dev)
 			goto exit_probe;
 
 		ul_chan->xfer_cb = mhi_drv->ul_xfer_cb;
-		if (ul_chan->auto_start) {
-			ret = mhi_prepare_channel(mhi_cntrl, ul_chan);
-			if (ret)
-				goto exit_probe;
-		}
 	}
 
 	ret = -EINVAL;
@@ -1157,9 +1151,6 @@ static int mhi_driver_probe(struct device *dev)
 	if (ret)
 		goto exit_probe;
 
-	if (dl_chan && dl_chan->auto_start)
-		mhi_prepare_channel(mhi_cntrl, dl_chan);
-
 	mhi_device_put(mhi_dev);
 
 	return ret;
drivers/bus/mhi/core/internal.h +0 -1
index 5a81a42..73b52a0 100644
@@ -563,7 +563,6 @@ struct mhi_chan {
 	bool configured;
 	bool offload_ch;
 	bool pre_alloc;
-	bool auto_start;
 	bool wake_capable;
 };
 
include/linux/mhi.h +0 -2
index 811e686..0d277c7 100644
@@ -214,7 +214,6 @@ enum mhi_db_brst_mode {
  * @offload_channel: The client manages the channel completely
  * @doorbell_mode_switch: Channel switches to doorbell mode on M0 transition
  * @auto_queue: Framework will automatically queue buffers for DL traffic
- * @auto_start: Automatically start (open) this channel
  * @wake-capable: Channel capable of waking up the system
  */
 struct mhi_channel_config {
@@ -232,7 +231,6 @@ struct mhi_channel_config {
 	bool offload_channel;
 	bool doorbell_mode_switch;
 	bool auto_queue;
-	bool auto_start;
 	bool wake_capable;
 };
 
Signature · 1 line
2.7.4
#9 lore raw
In reply to Loic Poulain
Quoted 9 lines · Loic Poulain

There is really no point having an auto-start for channels. This is confusing for the device drivers, some have to enable the channels, others don't have... and waste resources (e.g. pre allocated buffers) that may never be used.

This is really up to the MHI device(channel) driver to manage the state of its channels.

Applied to mhi-next!

Thanks,
Mani

Quoted 77 lines

---
v2: split MHI and qrtr changes in dedicated commits

 drivers/bus/mhi/core/init.c     | 9 ---------
 drivers/bus/mhi/core/internal.h | 1 -
 include/linux/mhi.h             | 2 --
 3 files changed, 12 deletions(-)
drivers/bus/mhi/core/init.c +0 -9
index dccc824..8798deb 100644
@@ -721,7 +721,6 @@ static int parse_ch_cfg(struct mhi_controller *mhi_cntrl,
 		mhi_chan->offload_ch = ch_cfg->offload_channel;
 		mhi_chan->db_cfg.reset_req = ch_cfg->doorbell_mode_switch;
 		mhi_chan->pre_alloc = ch_cfg->auto_queue;
-		mhi_chan->auto_start = ch_cfg->auto_start;
 
 		/*
 		 * If MHI host allocates buffers, then the channel direction
@@ -1119,11 +1118,6 @@ static int mhi_driver_probe(struct device *dev)
 			goto exit_probe;
 
 		ul_chan->xfer_cb = mhi_drv->ul_xfer_cb;
-		if (ul_chan->auto_start) {
-			ret = mhi_prepare_channel(mhi_cntrl, ul_chan);
-			if (ret)
-				goto exit_probe;
-		}
 	}
 
 	ret = -EINVAL;
@@ -1157,9 +1151,6 @@ static int mhi_driver_probe(struct device *dev)
 	if (ret)
 		goto exit_probe;
 
-	if (dl_chan && dl_chan->auto_start)
-		mhi_prepare_channel(mhi_cntrl, dl_chan);
-
 	mhi_device_put(mhi_dev);
 
 	return ret;
drivers/bus/mhi/core/internal.h +0 -1
index 5a81a42..73b52a0 100644
@@ -563,7 +563,6 @@ struct mhi_chan {
 	bool configured;
 	bool offload_ch;
 	bool pre_alloc;
-	bool auto_start;
 	bool wake_capable;
 };
 
include/linux/mhi.h +0 -2
index 811e686..0d277c7 100644
@@ -214,7 +214,6 @@ enum mhi_db_brst_mode {
  * @offload_channel: The client manages the channel completely
  * @doorbell_mode_switch: Channel switches to doorbell mode on M0 transition
  * @auto_queue: Framework will automatically queue buffers for DL traffic
- * @auto_start: Automatically start (open) this channel
  * @wake-capable: Channel capable of waking up the system
  */
 struct mhi_channel_config {
@@ -232,7 +231,6 @@ struct mhi_channel_config {
 	bool offload_channel;
 	bool doorbell_mode_switch;
 	bool auto_queue;
-	bool auto_start;
 	bool wake_capable;
 };
 
Signature · 1 line
2.7.4
#10 lore raw
In reply to Loic Poulain

+ath11k list

Quoted 9 lines · Loic Poulain

There is really no point having an auto-start for channels. This is confusing for the device drivers, some have to enable the channels, others don't have... and waste resources (e.g. pre allocated buffers) that may never be used.

This is really up to the MHI device(channel) driver to manage the state of its channels.

Applied to mhi-ath11k-immutable branch! This branch will get merged into mhi-next and ath-next.

Thanks,
Mani

Quoted 77 lines

---
v2: split MHI and qrtr changes in dedicated commits

 drivers/bus/mhi/core/init.c     | 9 ---------
 drivers/bus/mhi/core/internal.h | 1 -
 include/linux/mhi.h             | 2 --
 3 files changed, 12 deletions(-)
drivers/bus/mhi/core/init.c +0 -9
index dccc824..8798deb 100644
@@ -721,7 +721,6 @@ static int parse_ch_cfg(struct mhi_controller *mhi_cntrl,
 		mhi_chan->offload_ch = ch_cfg->offload_channel;
 		mhi_chan->db_cfg.reset_req = ch_cfg->doorbell_mode_switch;
 		mhi_chan->pre_alloc = ch_cfg->auto_queue;
-		mhi_chan->auto_start = ch_cfg->auto_start;
 
 		/*
 		 * If MHI host allocates buffers, then the channel direction
@@ -1119,11 +1118,6 @@ static int mhi_driver_probe(struct device *dev)
 			goto exit_probe;
 
 		ul_chan->xfer_cb = mhi_drv->ul_xfer_cb;
-		if (ul_chan->auto_start) {
-			ret = mhi_prepare_channel(mhi_cntrl, ul_chan);
-			if (ret)
-				goto exit_probe;
-		}
 	}
 
 	ret = -EINVAL;
@@ -1157,9 +1151,6 @@ static int mhi_driver_probe(struct device *dev)
 	if (ret)
 		goto exit_probe;
 
-	if (dl_chan && dl_chan->auto_start)
-		mhi_prepare_channel(mhi_cntrl, dl_chan);
-
 	mhi_device_put(mhi_dev);
 
 	return ret;
drivers/bus/mhi/core/internal.h +0 -1
index 5a81a42..73b52a0 100644
@@ -563,7 +563,6 @@ struct mhi_chan {
 	bool configured;
 	bool offload_ch;
 	bool pre_alloc;
-	bool auto_start;
 	bool wake_capable;
 };
 
include/linux/mhi.h +0 -2
index 811e686..0d277c7 100644
@@ -214,7 +214,6 @@ enum mhi_db_brst_mode {
  * @offload_channel: The client manages the channel completely
  * @doorbell_mode_switch: Channel switches to doorbell mode on M0 transition
  * @auto_queue: Framework will automatically queue buffers for DL traffic
- * @auto_start: Automatically start (open) this channel
  * @wake-capable: Channel capable of waking up the system
  */
 struct mhi_channel_config {
@@ -232,7 +231,6 @@ struct mhi_channel_config {
 	bool offload_channel;
 	bool doorbell_mode_switch;
 	bool auto_queue;
-	bool auto_start;
 	bool wake_capable;
 };
 
Signature · 1 line
2.7.4
Signature · 3 lines
ath11k mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/ath11k