[PATCH 2/5] bus: mhi: host: Add support for separate controller configurations for VF and PF

Vivek.Pernamitta@quicinc.com posted 5 patches 3 months ago
There is a newer version of this series
[PATCH 2/5] bus: mhi: host: Add support for separate controller configurations for VF and PF
Posted by Vivek.Pernamitta@quicinc.com 3 months ago
From: Vivek Pernamitta <quic_vpernami@quicinc.com>

Implement support for separate controller configurations for both
Virtual Functions (VF) and Physical Functions (PF).

This enhancement allows for more flexible and efficient management of
resources. The PF takes on a supervisory role and will have bootup
information such as SAHARA, DIAG, and NDB (for file system sync data,
etc.). VFs can handle function-specific data transfers, such as data plane
or hardware data.

Signed-off-by: Vivek Pernamitta <quic_vpernami@quicinc.com>
---
 drivers/bus/mhi/host/pci_generic.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/drivers/bus/mhi/host/pci_generic.c b/drivers/bus/mhi/host/pci_generic.c
index 3e6e2d38935927cf3352c039266cae7cadb4c118..22de02c26ceb946fb618d962ac8882d2db1be6b4 100644
--- a/drivers/bus/mhi/host/pci_generic.c
+++ b/drivers/bus/mhi/host/pci_generic.c
@@ -34,6 +34,7 @@
 /**
  * struct mhi_pci_dev_info - MHI PCI device specific information
  * @config: MHI controller configuration
+ * @vf_config: MHI controller configuration for Virtual function (optional)
  * @name: name of the PCI module
  * @fw: firmware path (if any)
  * @edl: emergency download mode firmware path (if any)
@@ -47,6 +48,7 @@
  */
 struct mhi_pci_dev_info {
 	const struct mhi_controller_config *config;
+	const struct mhi_controller_config *vf_config;
 	const char *name;
 	const char *fw;
 	const char *edl;
@@ -1242,9 +1244,14 @@ static int mhi_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
 		return -ENOMEM;
 
 	INIT_WORK(&mhi_pdev->recovery_work, mhi_pci_recovery_work);
+
+	if (pdev->is_virtfn && info->vf_config)
+		mhi_cntrl_config = info->vf_config;
+	else
+		mhi_cntrl_config = info->config;
+
 	timer_setup(&mhi_pdev->health_check_timer, health_check, 0);
 
-	mhi_cntrl_config = info->config;
 	mhi_cntrl = &mhi_pdev->mhi_cntrl;
 
 	mhi_cntrl->cntrl_dev = &pdev->dev;

-- 
2.34.1
Re: [PATCH 2/5] bus: mhi: host: Add support for separate controller configurations for VF and PF
Posted by Krishna Chaitanya Chundru 3 months ago

On 7/3/2025 8:39 PM, Vivek.Pernamitta@quicinc.com wrote:
> From: Vivek Pernamitta <quic_vpernami@quicinc.com>
> 
> Implement support for separate controller configurations for both
> Virtual Functions (VF) and Physical Functions (PF).
> 
> This enhancement allows for more flexible and efficient management of
> resources. The PF takes on a supervisory role and will have bootup
> information such as SAHARA, DIAG, and NDB (for file system sync data,
> etc.). VFs can handle function-specific data transfers, such as data plane
> or hardware data.
Better cite the spec which points PF takes supervisory role.

With that added.

Reviewed-by: Krishna Chaitanya Chundru <krishna.chundru@oss.qualcomm.com>

- Krishna Chaitanya
> 
> Signed-off-by: Vivek Pernamitta <quic_vpernami@quicinc.com>
> ---
>   drivers/bus/mhi/host/pci_generic.c | 9 ++++++++-
>   1 file changed, 8 insertions(+), 1 deletion(-)
> 
> diff --git a/drivers/bus/mhi/host/pci_generic.c b/drivers/bus/mhi/host/pci_generic.c
> index 3e6e2d38935927cf3352c039266cae7cadb4c118..22de02c26ceb946fb618d962ac8882d2db1be6b4 100644
> --- a/drivers/bus/mhi/host/pci_generic.c
> +++ b/drivers/bus/mhi/host/pci_generic.c
> @@ -34,6 +34,7 @@
>   /**
>    * struct mhi_pci_dev_info - MHI PCI device specific information
>    * @config: MHI controller configuration
> + * @vf_config: MHI controller configuration for Virtual function (optional)
>    * @name: name of the PCI module
>    * @fw: firmware path (if any)
>    * @edl: emergency download mode firmware path (if any)
> @@ -47,6 +48,7 @@
>    */
>   struct mhi_pci_dev_info {
>   	const struct mhi_controller_config *config;
> +	const struct mhi_controller_config *vf_config;
>   	const char *name;
>   	const char *fw;
>   	const char *edl;
> @@ -1242,9 +1244,14 @@ static int mhi_pci_probe(struct pci_dev *pdev, const struct pci_device_id *id)
>   		return -ENOMEM;
>   
>   	INIT_WORK(&mhi_pdev->recovery_work, mhi_pci_recovery_work);
> +
> +	if (pdev->is_virtfn && info->vf_config)
> +		mhi_cntrl_config = info->vf_config;
> +	else
> +		mhi_cntrl_config = info->config;
> +
>   	timer_setup(&mhi_pdev->health_check_timer, health_check, 0);
>   
> -	mhi_cntrl_config = info->config;
>   	mhi_cntrl = &mhi_pdev->mhi_cntrl;
>   
>   	mhi_cntrl->cntrl_dev = &pdev->dev;
>