lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20251211-siva_mhi_dp2-v1-7-d2895c4ec73a@oss.qualcomm.com>
Date: Thu, 11 Dec 2025 13:37:39 +0530
From: Sivareddy Surasani <sivareddy.surasani@....qualcomm.com>
To: Manivannan Sadhasivam <mani@...nel.org>, Jonathan Corbet <corbet@....net>,
        Arnd Bergmann <arnd@...db.de>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>
Cc: mhi@...ts.linux.dev, linux-arm-msm@...r.kernel.org,
        linux-kernel@...r.kernel.org, linux-doc@...r.kernel.org,
        Upal Kumar Saha <upal.saha@....qualcomm.com>,
        Himanshu Shukla <quic_himashuk@...cinc.com>,
        Sivareddy Surasani <sivareddy.surasani@....qualcomm.com>,
        Vivek Pernamitta <vivek.pernamitta@....qualcomm.com>
Subject: [PATCH 07/11] bus: mhi: host: core: Add overflow disable flag

From: Vivek Pernamitta <vivek.pernamitta@....qualcomm.com>

When the client transfers a large packet, the host may set
overflow events if the packet size exceeds the transfer ring
element size. Add a flag to disable overflow events.

Scenario: A device sends a packet of 5000 bytes. The host has
buffers of 2048 bytes, so the packet is split across three
buffers. The host expects one event for the entire packet, but
three events are generated: two marked as overflow and the
third as end of packet. The client driver wants only one
callback for the EOT event, not for overflow events. This
change prevents host channels from generating overflow events.

Signed-off-by: Vivek Pernamitta <vivek.pernamitta@....qualcomm.com>
Signed-off-by: Sivareddy Surasani <sivareddy.surasani@....qualcomm.com>
---
 drivers/bus/mhi/common.h        | 3 ++-
 drivers/bus/mhi/host/init.c     | 3 +++
 drivers/bus/mhi/host/internal.h | 1 +
 include/linux/mhi.h             | 2 ++
 4 files changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/bus/mhi/common.h b/drivers/bus/mhi/common.h
index 58f27c6ba63e..31ff4d2e6eba 100644
--- a/drivers/bus/mhi/common.h
+++ b/drivers/bus/mhi/common.h
@@ -282,7 +282,8 @@ struct mhi_event_ctxt {
 #define CHAN_CTX_CHSTATE_MASK		GENMASK(7, 0)
 #define CHAN_CTX_BRSTMODE_MASK		GENMASK(9, 8)
 #define CHAN_CTX_POLLCFG_MASK		GENMASK(15, 10)
-#define CHAN_CTX_RESERVED_MASK		GENMASK(31, 16)
+#define CHAN_CTX_OVF_DISABLE_MASK	GENMASK(17, 16)
+#define CHAN_CTX_RESERVED_MASK		GENMASK(31, 18)
 struct mhi_chan_ctxt {
 	__le32 chcfg;
 	__le32 chtype;
diff --git a/drivers/bus/mhi/host/init.c b/drivers/bus/mhi/host/init.c
index 4c092490c9fd..50f96f2c823f 100644
--- a/drivers/bus/mhi/host/init.c
+++ b/drivers/bus/mhi/host/init.c
@@ -340,6 +340,8 @@ static int mhi_init_dev_ctxt(struct mhi_controller *mhi_cntrl)
 		tmp |= FIELD_PREP(CHAN_CTX_BRSTMODE_MASK, mhi_chan->db_cfg.brstmode);
 		tmp &= ~CHAN_CTX_POLLCFG_MASK;
 		tmp |= FIELD_PREP(CHAN_CTX_POLLCFG_MASK, mhi_chan->db_cfg.pollcfg);
+		tmp &= ~CHAN_CTX_OVF_DISABLE_MASK;
+		tmp |= FIELD_PREP(CHAN_CTX_OVF_DISABLE_MASK, mhi_chan->db_cfg.ovf_dis);
 		chan_ctxt->chcfg = cpu_to_le32(tmp);
 
 		chan_ctxt->chtype = cpu_to_le32(mhi_chan->type);
@@ -870,6 +872,7 @@ static int parse_ch_cfg(struct mhi_controller *mhi_cntrl,
 
 		mhi_chan->ee_mask = ch_cfg->ee_mask;
 		mhi_chan->db_cfg.pollcfg = ch_cfg->pollcfg;
+		mhi_chan->db_cfg.ovf_dis = ch_cfg->ovf_disable;
 		mhi_chan->lpm_notify = ch_cfg->lpm_notify;
 		mhi_chan->offload_ch = ch_cfg->offload_channel;
 		mhi_chan->db_cfg.reset_req = ch_cfg->doorbell_mode_switch;
diff --git a/drivers/bus/mhi/host/internal.h b/drivers/bus/mhi/host/internal.h
index 97bf6a70b9fa..db00ede0aa48 100644
--- a/drivers/bus/mhi/host/internal.h
+++ b/drivers/bus/mhi/host/internal.h
@@ -189,6 +189,7 @@ struct db_cfg {
 	bool reset_req;
 	bool db_mode;
 	u32 pollcfg;
+	bool ovf_dis;
 	enum mhi_db_brst_mode brstmode;
 	dma_addr_t db_val;
 	void (*process_db)(struct mhi_controller *mhi_cntrl,
diff --git a/include/linux/mhi.h b/include/linux/mhi.h
index 299216b5e4de..926a20835467 100644
--- a/include/linux/mhi.h
+++ b/include/linux/mhi.h
@@ -215,6 +215,7 @@ enum mhi_db_brst_mode {
  * @ee_mask: Execution Environment mask for this channel
  * @pollcfg: Polling configuration for burst mode.  0 is default.  milliseconds
 	     for UL channels, multiple of 8 ring elements for DL channels
+ * @ovf_disbale: Overflow disable flag
  * @doorbell: Doorbell mode
  * @lpm_notify: The channel master requires low power mode notifications
  * @offload_channel: The client manages the channel completely
@@ -232,6 +233,7 @@ struct mhi_channel_config {
 	enum mhi_ch_type type;
 	u32 ee_mask;
 	u32 pollcfg;
+	bool ovf_disable;
 	enum mhi_db_brst_mode doorbell;
 	bool lpm_notify;
 	bool offload_channel;

-- 
2.34.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ