diff mbox series

[2/2] mhi: pci_generic: Fix shared MSI vector support

Message ID 1609836975-5758-2-git-send-email-loic.poulain@linaro.org
State Superseded
Headers show
Series [1/2] mhi: unconstify mhi_event_config | expand

Commit Message

Loic Poulain Jan. 5, 2021, 8:56 a.m. UTC
When a shared MSI vector must be used (e.g. when VTd is disabled on
x86_64), each event MSI vector must be set to the shared vector idx.

Signed-off-by: Loic Poulain <loic.poulain@linaro.org>

---
 drivers/bus/mhi/pci_generic.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

-- 
2.7.4

Comments

Manivannan Sadhasivam Jan. 5, 2021, 3:29 p.m. UTC | #1
On Tue, Jan 05, 2021 at 09:56:15AM +0100, Loic Poulain wrote:
> When a shared MSI vector must be used (e.g. when VTd is disabled on

> x86_64), each event MSI vector must be set to the shared vector idx.

> 

> Signed-off-by: Loic Poulain <loic.poulain@linaro.org>

> ---

>  drivers/bus/mhi/pci_generic.c | 9 +++++++--

>  1 file changed, 7 insertions(+), 2 deletions(-)

> 

> diff --git a/drivers/bus/mhi/pci_generic.c b/drivers/bus/mhi/pci_generic.c

> index 86ff0c3..23ef585 100644

> --- a/drivers/bus/mhi/pci_generic.c

> +++ b/drivers/bus/mhi/pci_generic.c

> @@ -154,7 +154,7 @@ static const struct mhi_channel_config modem_qcom_v1_mhi_channels[] = {

>  	MHI_CHANNEL_CONFIG_HW_DL(101, "IP_HW0", 128, 3),

>  };

>  

> -static const struct mhi_event_config modem_qcom_v1_mhi_events[] = {

> +static struct mhi_event_config modem_qcom_v1_mhi_events[] = {

>  	/* first ring is control+data ring */

>  	MHI_EVENT_CONFIG_CTRL(0),

>  	/* DIAG dedicated event ring */

> @@ -164,7 +164,7 @@ static const struct mhi_event_config modem_qcom_v1_mhi_events[] = {

>  	MHI_EVENT_CONFIG_HW_DATA(3, 101)

>  };

>  

> -static const struct mhi_controller_config modem_qcom_v1_mhiv_config = {

> +static struct mhi_controller_config modem_qcom_v1_mhiv_config = {

>  	.max_channels = 128,

>  	.timeout_ms = 8000,

>  	.num_channels = ARRAY_SIZE(modem_qcom_v1_mhi_channels),

> @@ -297,6 +297,11 @@ static int mhi_pci_get_irqs(struct mhi_controller *mhi_cntrl,

>  	if (nr_vectors < mhi_cntrl->nr_irqs) {

>  		dev_warn(&pdev->dev, "Not enough MSI vectors (%d/%d), use shared MSI\n",


So now the log should say, "using shared MSI"! with that,

Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>


Thanks,
Mani

>  			 nr_vectors, mhi_cntrl_config->num_events);

> +

> +		/* Patch msi vectors, use only one (shared) */

> +		for (i = 0; i < mhi_cntrl_config->num_events; i++)

> +			mhi_cntrl_config->event_cfg[i].irq = 0;

> +		mhi_cntrl->nr_irqs = 1;

>  	}

>  

>  	irq = devm_kcalloc(&pdev->dev, mhi_cntrl->nr_irqs, sizeof(int), GFP_KERNEL);

> -- 

> 2.7.4

>
diff mbox series

Patch

diff --git a/drivers/bus/mhi/pci_generic.c b/drivers/bus/mhi/pci_generic.c
index 86ff0c3..23ef585 100644
--- a/drivers/bus/mhi/pci_generic.c
+++ b/drivers/bus/mhi/pci_generic.c
@@ -154,7 +154,7 @@  static const struct mhi_channel_config modem_qcom_v1_mhi_channels[] = {
 	MHI_CHANNEL_CONFIG_HW_DL(101, "IP_HW0", 128, 3),
 };
 
-static const struct mhi_event_config modem_qcom_v1_mhi_events[] = {
+static struct mhi_event_config modem_qcom_v1_mhi_events[] = {
 	/* first ring is control+data ring */
 	MHI_EVENT_CONFIG_CTRL(0),
 	/* DIAG dedicated event ring */
@@ -164,7 +164,7 @@  static const struct mhi_event_config modem_qcom_v1_mhi_events[] = {
 	MHI_EVENT_CONFIG_HW_DATA(3, 101)
 };
 
-static const struct mhi_controller_config modem_qcom_v1_mhiv_config = {
+static struct mhi_controller_config modem_qcom_v1_mhiv_config = {
 	.max_channels = 128,
 	.timeout_ms = 8000,
 	.num_channels = ARRAY_SIZE(modem_qcom_v1_mhi_channels),
@@ -297,6 +297,11 @@  static int mhi_pci_get_irqs(struct mhi_controller *mhi_cntrl,
 	if (nr_vectors < mhi_cntrl->nr_irqs) {
 		dev_warn(&pdev->dev, "Not enough MSI vectors (%d/%d), use shared MSI\n",
 			 nr_vectors, mhi_cntrl_config->num_events);
+
+		/* Patch msi vectors, use only one (shared) */
+		for (i = 0; i < mhi_cntrl_config->num_events; i++)
+			mhi_cntrl_config->event_cfg[i].irq = 0;
+		mhi_cntrl->nr_irqs = 1;
 	}
 
 	irq = devm_kcalloc(&pdev->dev, mhi_cntrl->nr_irqs, sizeof(int), GFP_KERNEL);