From: Krishna Chaitanya Chundru <krishna.chundru@oss.qualcomm.com>
To: Bjorn Helgaas <helgaas@kernel.org>
Cc: "Bjorn Helgaas" <bhelgaas@google.com>,
"Ilpo Järvinen" <ilpo.jarvinen@linux.intel.com>,
"Jingoo Han" <jingoohan1@gmail.com>,
"Manivannan Sadhasivam" <manivannan.sadhasivam@linaro.org>,
"Lorenzo Pieralisi" <lpieralisi@kernel.org>,
"Krzysztof Wilczyński" <kw@linux.com>,
"Rob Herring" <robh@kernel.org>,
"Johannes Berg" <johannes@sipsolutions.net>,
"Jeff Johnson" <jjohnson@kernel.org>,
linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-arm-msm@vger.kernel.org, mhi@lists.linux.dev,
linux-wireless@vger.kernel.org, ath11k@lists.infradead.org,
quic_pyarlaga@quicinc.com, quic_vbadigan@quicinc.com,
quic_vpernami@quicinc.com, quic_mrana@quicinc.com,
"Jeff Johnson" <jeff.johnson@oss.qualcomm.com>,
"Miaoqing Pan" <quic_miaoqing@quicinc.com>
Subject: Re: [PATCH v2 10/10] wifi: ath11k: add support for MHI bandwidth scaling
Date: Tue, 18 Mar 2025 10:53:24 +0530 [thread overview]
Message-ID: <ab9a0399-95e6-09a1-0eed-84cc73efcf51@oss.qualcomm.com> (raw)
In-Reply-To: <20250313172828.GA740705@bhelgaas>
On 3/13/2025 10:58 PM, Bjorn Helgaas wrote:
> On Thu, Mar 13, 2025 at 05:10:17PM +0530, Krishna Chaitanya Chundru wrote:
>> From: Miaoqing Pan <quic_miaoqing@quicinc.com>
>>
>> Add support for MHI bandwidth scaling, which will reduce power consumption
>> if WLAN operates with lower bandwidth. This feature is only enabled for
>> QCA6390.
>
> What is the event that initiates bandwidth scaling or reduces power
> consumption? Is there any kind of user interface like a sysfs knob
> an administrator can use?
>
it is initiated by the endpoint firmware based upon the bandwidth
requirements, if there is high bandwidth data endpoint requests for
higher data rates or if there is less bandwidth they request for lower
data rates to reduce power. Endpoint initiates this through MHI
protocol.
We will update the commit with this information.
> Does this happen based on ath11k usage? Battery or thermal status?
>
> I guess reducing power consumption or reducing heat is probably the
> driving factor since we would always use max performance if power and
> heat were not issues?
>
> Some hints here would be useful.
>
>> Tested-on: WCN6855 hw2.1 PCI WLAN.HSP.1.1-04546-QCAHSPSWPL_V1_V2_SILICONZ_IOE-1
>> Signed-off-by: Miaoqing Pan <quic_miaoqing@quicinc.com>
>> ---
>> drivers/net/wireless/ath/ath11k/mhi.c | 41 +++++++++++++++++++++++++++++++++++
>> 1 file changed, 41 insertions(+)
>>
>> diff --git a/drivers/net/wireless/ath/ath11k/mhi.c b/drivers/net/wireless/ath/ath11k/mhi.c
>> index 6e45f464a429..74769c0993ae 100644
>> --- a/drivers/net/wireless/ath/ath11k/mhi.c
>> +++ b/drivers/net/wireless/ath/ath11k/mhi.c
>> @@ -20,6 +20,7 @@
>> #define MHI_TIMEOUT_DEFAULT_MS 20000
>> #define RDDM_DUMP_SIZE 0x420000
>> #define MHI_CB_INVALID 0xff
>> +#define MHI_BW_SCALE_CHAN_DB 126
>>
>> static const struct mhi_channel_config ath11k_mhi_channels_qca6390[] = {
>> {
>> @@ -73,6 +74,17 @@ static struct mhi_event_config ath11k_mhi_events_qca6390[] = {
>> .client_managed = false,
>> .offload_channel = false,
>> },
>> + {
>> + .num_elements = 8,
>> + .irq_moderation_ms = 0,
>> + .irq = 1,
>> + .mode = MHI_DB_BRST_DISABLE,
>> + .data_type = MHI_ER_BW_SCALE,
>> + .priority = 2,
>> + .hardware_event = false,
>> + .client_managed = false,
>> + .offload_channel = false,
>> + },
>> };
>>
>> static const struct mhi_controller_config ath11k_mhi_config_qca6390 = {
>> @@ -313,6 +325,33 @@ static void ath11k_mhi_op_write_reg(struct mhi_controller *mhi_cntrl,
>> writel(val, addr);
>> }
>>
>> +static int ath11k_mhi_op_get_misc_doorbell(struct mhi_controller *mhi_cntrl,
>> + enum mhi_er_data_type type)
>> +{
>> + if (type == MHI_ER_BW_SCALE)
>> + return MHI_BW_SCALE_CHAN_DB;
>> +
>> + return -EINVAL;
>> +}
>> +
>> +static int ath11k_mhi_op_bw_scale(struct mhi_controller *mhi_cntrl,
>> + struct mhi_link_info *link_info)
>> +{
>> + enum pci_bus_speed speed = pci_lnkctl2_bus_speed(link_info->target_link_speed);
>> + struct ath11k_base *ab = dev_get_drvdata(mhi_cntrl->cntrl_dev);
>> + struct pci_dev *pci_dev = to_pci_dev(ab->dev);
>> + struct pci_dev *pdev;
>> +
>> + if (!pci_dev)
>> + return -EINVAL;
>> +
>> + pdev = pci_upstream_bridge(pci_dev);
>> + if (!pdev)
>> + return -ENODEV;
>> +
>> + return pcie_set_target_speed(pdev, speed, true);
>
> Seems kind of unfortunate that:
>
> 1) The endpoint driver needs to be involved here, even though it
> does nothing that is endpoint-specific, and
>
As mentioned above the trigger to switch data rates is from the firmware
running in the endpoint. so we need to do from endpoint driver only.
> 2) The endpoint driver twiddles something in *another* device (the
> upstream bridge). There's a potential locking issue here and
> potential conflict with any other devices that may be below that
> bridge.
>
pcie_set_target_speed API is already having locks to protect/synchronize
various endpoint requests.
- Krishna Chaitanya.
>> +}
>> +
>> static int ath11k_mhi_read_addr_from_dt(struct mhi_controller *mhi_ctrl)
>> {
>> struct device_node *np;
>> @@ -389,6 +428,8 @@ int ath11k_mhi_register(struct ath11k_pci *ab_pci)
>> mhi_ctrl->status_cb = ath11k_mhi_op_status_cb;
>> mhi_ctrl->read_reg = ath11k_mhi_op_read_reg;
>> mhi_ctrl->write_reg = ath11k_mhi_op_write_reg;
>> + mhi_ctrl->bw_scale = ath11k_mhi_op_bw_scale;
>> + mhi_ctrl->get_misc_doorbell = ath11k_mhi_op_get_misc_doorbell;
>>
>> switch (ab->hw_rev) {
>> case ATH11K_HW_QCN9074_HW10:
>>
>> --
>> 2.34.1
>>
next prev parent reply other threads:[~2025-03-18 5:23 UTC|newest]
Thread overview: 28+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-03-13 11:40 [PATCH v2 00/10] bus: mhi: host: Add support for mhi bus bw Krishna Chaitanya Chundru
2025-03-13 11:40 ` [PATCH v2 01/10] PCI: update current bus speed as part of pci_bus_add_devices() Krishna Chaitanya Chundru
2025-03-13 17:00 ` Bjorn Helgaas
2025-04-25 15:46 ` Manivannan Sadhasivam
2025-03-13 17:00 ` Bjorn Helgaas
2025-03-13 11:40 ` [PATCH v2 02/10] PCI/bwctrl: Add support to scale bandwidth before & after link re-training Krishna Chaitanya Chundru
2025-04-25 15:57 ` Manivannan Sadhasivam
2025-05-16 12:49 ` Krishna Chaitanya Chundru
2025-03-13 11:40 ` [PATCH v2 03/10] PCI: dwc: Implement .pre_scale_bus_bw() & .post_scale_bus_bw hook Krishna Chaitanya Chundru
2025-04-25 16:02 ` Manivannan Sadhasivam
2025-03-13 11:40 ` [PATCH v2 04/10] PCI: qcom: Extract core logic from qcom_pcie_icc_opp_update() Krishna Chaitanya Chundru
2025-03-13 11:40 ` [PATCH v2 05/10] PCI: qcom: Add support for PCIe bus bw scaling Krishna Chaitanya Chundru
2025-04-25 16:07 ` Manivannan Sadhasivam
2025-03-13 11:40 ` [PATCH v2 06/10] bus: mhi: host: Add support to read MHI capabilities Krishna Chaitanya Chundru
2025-03-13 17:05 ` Bjorn Helgaas
2025-04-25 16:18 ` Manivannan Sadhasivam
2025-03-13 11:40 ` [PATCH v2 07/10] bus: mhi: host: Add support for Bandwidth scale Krishna Chaitanya Chundru
2025-04-25 16:43 ` Manivannan Sadhasivam
2025-05-06 4:29 ` Krishna Chaitanya Chundru
2025-05-17 2:20 ` Krishna Chaitanya Chundru
2025-03-13 11:40 ` [PATCH v2 08/10] PCI: Export pci_set_target_speed() Krishna Chaitanya Chundru
2025-03-13 11:40 ` [PATCH v2 09/10] PCI: Add function to convert lnkctl2speed to pci_bus_speed Krishna Chaitanya Chundru
2025-03-13 17:16 ` Bjorn Helgaas
2025-03-13 23:48 ` Jeff Johnson
2025-03-13 11:40 ` [PATCH v2 10/10] wifi: ath11k: add support for MHI bandwidth scaling Krishna Chaitanya Chundru
2025-03-13 17:28 ` Bjorn Helgaas
2025-03-18 5:23 ` Krishna Chaitanya Chundru [this message]
2025-03-13 23:53 ` Jeff Johnson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ab9a0399-95e6-09a1-0eed-84cc73efcf51@oss.qualcomm.com \
--to=krishna.chundru@oss.qualcomm.com \
--cc=ath11k@lists.infradead.org \
--cc=bhelgaas@google.com \
--cc=helgaas@kernel.org \
--cc=ilpo.jarvinen@linux.intel.com \
--cc=jeff.johnson@oss.qualcomm.com \
--cc=jingoohan1@gmail.com \
--cc=jjohnson@kernel.org \
--cc=johannes@sipsolutions.net \
--cc=kw@linux.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pci@vger.kernel.org \
--cc=linux-wireless@vger.kernel.org \
--cc=lpieralisi@kernel.org \
--cc=manivannan.sadhasivam@linaro.org \
--cc=mhi@lists.linux.dev \
--cc=quic_miaoqing@quicinc.com \
--cc=quic_mrana@quicinc.com \
--cc=quic_pyarlaga@quicinc.com \
--cc=quic_vbadigan@quicinc.com \
--cc=quic_vpernami@quicinc.com \
--cc=robh@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox