linux-wireless.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: James Prestwood <prestwoj@gmail.com>
To: Baochen Qiang <quic_bqiang@quicinc.com>, Kalle Valo <kvalo@kernel.org>
Cc: linux-wireless@vger.kernel.org, ath11k@lists.infradead.org
Subject: Re: ath11k and vfio-pci support
Date: Wed, 17 Jan 2024 05:20:24 -0800	[thread overview]
Message-ID: <cdec259a-b779-4856-8585-f285179e3671@gmail.com> (raw)
In-Reply-To: <16cfd010-b62d-4385-92d1-002820a8db38@quicinc.com>

Hi Baochen,

<snip>

>>>
>>> While I don't think there is a way for qemu/ath11k to get the real 
>>> MSI vector from host, I will try to read the vfio code to check 
>>> further. Before that, to unblock you, a possible hack is to hard 
>>> code the MSI vector in qemu to the same as in host, on condition 
>>> that the MSI vector doesn't change. In my case, the change looks like
>>>
>>> diff --git a/drivers/net/wireless/ath/ath11k/pci.c 
>>> b/drivers/net/wireless/ath/ath11k/pci.c
>>> index 09e65c5e55c4..89a9bbe9e4d2 100644
>>> --- a/drivers/net/wireless/ath/ath11k/pci.c
>>> +++ b/drivers/net/wireless/ath/ath11k/pci.c
>>> @@ -459,7 +459,12 @@ static int ath11k_pci_alloc_msi(struct 
>>> ath11k_pci *ab_pci)
>>>                 ab->pci.msi.addr_hi = 0;
>>>         }
>>>
>>> -       ath11k_dbg(ab, ATH11K_DBG_PCI, "msi base data is %d\n", 
>>> ab->pci.msi.ep_base_data);
>>> +       ab->pci.msi.addr_hi = 0;
>>> +       ab->pci.msi.addr_lo = 0xfee00578;
>>> +       ath11k_dbg(ab, ATH11K_DBG_PCI, "msi addr hi 0x%x lo 0x%x 
>>> base data is %d\n",
>>> +                  ab->pci.msi.addr_hi,
>>> +                  ab->pci.msi.addr_lo,
>>> +                  ab->pci.msi.ep_base_data);
>>>
>>>         return 0;
>>>
>>> @@ -487,6 +492,7 @@ static int ath11k_pci_config_msi_data(struct 
>>> ath11k_pci *ab_pci)
>>>         }
>>>
>>>         ab_pci->ab->pci.msi.ep_base_data = msi_desc->msg.data;
>>> +       ab_pci->ab->pci.msi.ep_base_data = 0;
>>>
>>>         ath11k_dbg(ab_pci->ab, ATH11K_DBG_PCI, "after request_irq 
>>> msi_ep_base_data %d\n",
>>>                    ab_pci->ab->pci.msi.ep_base_data);
>>>
>>>
>>> This hack works on my setup.
>>
>> Progress! Thank you. This didn't work for me but its likely because 
>> my host MSI vector is not fee00578. Where did you come up with this 
>> value? 
> It could, and most likely, be different from machine to machine.
>
>> I don't see anything in the dmesg logs, or in lspci etc.
>>
> fee00578 is the physical MSI vector so I got it using lspci in host, see
> ...
>         Capabilities: [50] MSI: Enable+ Count=1/32 Maskable+ 64bit-
>                 Address: fee00578  Data: 0000
>                 Masking: fffffffe  Pending: 00000000
> ...

Mine looks like this:

...

     Capabilities: [50] MSI: Enable- Count=1/32 Maskable+ 64bit-
         Address: 00000000  Data: 0000
         Masking: 00000000  Pending: 00000000
...

I've adjusted the patch:

diff --git a/drivers/net/wireless/ath/ath11k/pci.c 
b/drivers/net/wireless/ath/ath11k/pci.c
index 09e65c5e55..1cc7115582 100644
--- a/drivers/net/wireless/ath/ath11k/pci.c
+++ b/drivers/net/wireless/ath/ath11k/pci.c
@@ -459,7 +459,12 @@ static int ath11k_pci_alloc_msi(struct ath11k_pci 
*ab_pci)
                 ab->pci.msi.addr_hi = 0;
         }

-       ath11k_dbg(ab, ATH11K_DBG_PCI, "msi base data is %d\n", 
ab->pci.msi.ep_base_data);
+        ab->pci.msi.addr_hi = 0;
+        ab->pci.msi.addr_lo = 0;
+        ath11k_dbg(ab, ATH11K_DBG_PCI, "msi addr hi 0x%x lo 0x%x base 
data is %d\n",
+                   ab->pci.msi.addr_hi,
+                   ab->pci.msi.addr_lo,
+                   ab->pci.msi.ep_base_data);

         return 0;

@@ -487,6 +492,7 @@ static int ath11k_pci_config_msi_data(struct 
ath11k_pci *ab_pci)
         }

         ab_pci->ab->pci.msi.ep_base_data = msi_desc->msg.data;
+       ab_pci->ab->pci.msi.ep_base_data = 0;

         ath11k_dbg(ab_pci->ab, ATH11K_DBG_PCI, "after request_irq 
msi_ep_base_data %d\n",
                    ab_pci->ab->pci.msi.ep_base_data);

But still getting the same errors:

[    3.563057] ath11k_pci 0000:00:06.0: Service connect timeout
[    3.565044] ath11k_pci 0000:00:06.0: failed to connect to HTT: -110
[    3.567031] ath11k_pci 0000:00:06.0: failed to start core: -110
[    3.777514] ath11k_pci 0000:00:06.0: firmware crashed: MHI_CB_EE_RDDM
[    3.777555] ath11k_pci 0000:00:06.0: ignore reset dev flags 0x4000
[    3.885137] ath11k_pci 0000:00:06.0: firmware crashed: MHI_CB_EE_RDDM
[    3.885178] ath11k_pci 0000:00:06.0: ignore reset dev flags 0x4000

I know this isn't a proper fix, so if its something that needs more 
thought than just hard-coded values I understand.

Thanks,

James

>
>> Thanks,
>>
>> James
>>

  reply	other threads:[~2024-01-17 13:20 UTC|newest]

Thread overview: 51+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-01-08 13:17 ath11k and vfio-pci support James Prestwood
2024-01-10  9:00 ` Kalle Valo
2024-01-10 13:04   ` James Prestwood
2024-01-10 13:49     ` Kalle Valo
2024-01-10 14:55       ` James Prestwood
2024-01-11  3:51         ` Baochen Qiang
2024-01-11  8:16           ` Kalle Valo
2024-01-11 12:48             ` James Prestwood
2024-01-11 13:11               ` Kalle Valo
2024-01-11 13:38                 ` James Prestwood
2024-01-12  2:04                   ` Baochen Qiang
2024-01-12 12:47                     ` James Prestwood
2024-01-14 12:37                       ` Baochen Qiang
2024-01-14 14:36                         ` Kalle Valo
2024-01-15 17:46                           ` Alex Williamson
2024-01-16 10:08                             ` Baochen Qiang
2024-01-16 10:41                               ` David Woodhouse
2024-01-16 15:29                                 ` Jason Gunthorpe
2024-01-16 18:28                                 ` Alex Williamson
2024-01-16 21:10                                   ` Jeff Johnson
2024-01-17  5:47                                 ` Baochen Qiang
2024-03-21 19:14                                 ` Johannes Berg
2024-01-16 13:05                         ` James Prestwood
2024-01-17  5:26                           ` Baochen Qiang
2024-01-17 13:20                             ` James Prestwood [this message]
2024-01-17 13:43                               ` Kalle Valo
2024-01-17 14:25                                 ` James Prestwood
2024-01-18  2:09                               ` Baochen Qiang
2024-01-19 17:52                                 ` James Prestwood
2024-01-19 17:57                                   ` Kalle Valo
2024-01-19 18:07                                     ` James Prestwood
2024-01-26 18:20                                     ` James Prestwood
2024-01-27  4:31                                       ` Baochen Qiang
2024-08-12 16:59 ` [PATCH RFC/RFT] vfio/pci: Create feature to disable MSI virtualization Alex Williamson
2024-08-13 16:30   ` Jason Gunthorpe
2024-08-13 17:30     ` Thomas Gleixner
2024-08-13 23:39       ` Jason Gunthorpe
2024-12-13  9:10       ` David Woodhouse
2025-01-03 14:31         ` Jason Gunthorpe
2025-01-03 14:47           ` David Woodhouse
2025-01-03 15:19             ` Jason Gunthorpe
2024-08-13 21:14     ` Alex Williamson
2024-08-13 23:16       ` Jason Gunthorpe
2024-08-14 14:55         ` Alex Williamson
2024-08-14 15:20           ` Jason Gunthorpe
2024-08-12 17:00 ` [PATCH RFC/RFT] vfio/pci-quirks: Quirk for ath wireless Alex Williamson
2024-08-13 16:43   ` Jason Gunthorpe
2024-08-13 21:03     ` Alex Williamson
2024-08-13 23:37       ` Jason Gunthorpe
2024-08-15 16:59         ` Alex Williamson
2024-08-15 17:19           ` Jason Gunthorpe

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=cdec259a-b779-4856-8585-f285179e3671@gmail.com \
    --to=prestwoj@gmail.com \
    --cc=ath11k@lists.infradead.org \
    --cc=kvalo@kernel.org \
    --cc=linux-wireless@vger.kernel.org \
    --cc=quic_bqiang@quicinc.com \
    /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;
as well as URLs for NNTP newsgroup(s).