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-next>] [day] [month] [year] [list]
Message-ID: <20240321172402.346191-1-jtornosm@redhat.com>
Date: Thu, 21 Mar 2024 18:23:53 +0100
From: Jose Ignacio Tornos Martinez <jtornosm@...hat.com>
To: kvalo@...nel.org,
	jjohnson@...nel.org,
	linux-wireless@...r.kernel.org,
	ath11k@...ts.infradead.org,
	linux-kernel@...r.kernel.org
Cc: quic_bqiang@...cinc.com,
	Jose Ignacio Tornos Martinez <jtornosm@...hat.com>
Subject: [PATCH] wifi: ath11k: workaround to use VMs

Currently, this driver is not working when the device is handled in a
Virtual Machine (PCI pass-through), as it was already reported here:
https://lore.kernel.org/all/fc6bd06f-d52b-4dee-ab1b-4bb845cc0b95@quicinc.com/T/
Baochen Qiang focused the problem and described how to have it working
for a specific real MSI vector from host that needs to be used in VM too.
And this value, as it was commented, can change.

The problem seems complex to me and I don't know if there is any easy way
to solve it. Meanwhile and using the information from Baochen Qiang,
since the use of VMs is very interesting for testing procedures,
I would like to just add this workaround that consists on adding a
parameter to pass the real MSI vector from host to the VM. In that way,
checking the 'lscpi' command output from host, it could be handled manually
or with some user tool in order to have the VM with the driver working.
Of course, if this parameter is not configured (zero value and default),
we will have the same behavior as always.

Signed-off-by: Jose Ignacio Tornos Martinez <jtornosm@...hat.com>
---
 drivers/net/wireless/ath/ath11k/pci.c | 20 ++++++++++++++++++++
 1 file changed, 20 insertions(+)

diff --git a/drivers/net/wireless/ath/ath11k/pci.c b/drivers/net/wireless/ath/ath11k/pci.c
index be9d2c69cc41..0e322956b10f 100644
--- a/drivers/net/wireless/ath/ath11k/pci.c
+++ b/drivers/net/wireless/ath/ath11k/pci.c
@@ -31,6 +31,11 @@
 
 #define TCSR_SOC_HW_SUB_VER	0x1910010
 
+static ulong ath11k_host_msi_addr = 0;
+module_param_named(host_msi_addr, ath11k_host_msi_addr, ulong, 0644);
+MODULE_PARM_DESC(host_msi_addr,
+		 "Workaround to configure the MSI address that is used from host in order to be used in VM");
+
 static const struct pci_device_id ath11k_pci_id_table[] = {
 	{ PCI_VDEVICE(QCOM, QCA6390_DEVICE_ID) },
 	{ PCI_VDEVICE(QCOM, WCN6855_DEVICE_ID) },
@@ -443,6 +448,18 @@ static int ath11k_pci_alloc_msi(struct ath11k_pci *ab_pci)
 
 	ath11k_pci_msi_disable(ab_pci);
 
+	if (ath11k_host_msi_addr) {
+		ab_pci->ab->pci.msi.ep_base_data = 0;
+		ab->pci.msi.addr_hi = (u32)(ath11k_host_msi_addr >> 32);
+		ab->pci.msi.addr_lo = (u32)(ath11k_host_msi_addr & 0xffffffff);
+
+		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;
+	}
+
 	msi_desc = irq_get_msi_desc(ab_pci->pdev->irq);
 	if (!msi_desc) {
 		ath11k_err(ab, "msi_desc is NULL!\n");
@@ -482,6 +499,9 @@ static int ath11k_pci_config_msi_data(struct ath11k_pci *ab_pci)
 {
 	struct msi_desc *msi_desc;
 
+	if (ath11k_host_msi_addr)
+		return 0;
+
 	msi_desc = irq_get_msi_desc(ab_pci->pdev->irq);
 	if (!msi_desc) {
 		ath11k_err(ab_pci->ab, "msi_desc is NULL!\n");
-- 
2.44.0


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ