Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

ntb_hw_amd: Update amd_ntb_get_link_status to support latest generation secondary topology

In the NTB secondary topology configuration of the latest generation,
the device behaves like an endpoint. Hence, add endpoint support and
update amd_ntb_get_link_status to accommodate endpoint devices.

Co-developed-by: Sanath S <Sanath.S@amd.com>
Signed-off-by: Sanath S <Sanath.S@amd.com>
Signed-off-by: Basavaraj Natikar <Basavaraj.Natikar@amd.com>
Reviewed-by: Dave Jiang <dave.jiang@intel.com>
Signed-off-by: Jon Mason <jdmason@kudzu.us>

authored by

Basavaraj Natikar and committed by
Jon Mason
f0c260f1 8f5ae30d

+18 -1
+17 -1
drivers/ntb/hw/amd/ntb_hw_amd.c
··· 197 197 198 198 static int amd_ntb_get_link_status(struct amd_ntb_dev *ndev) 199 199 { 200 - struct pci_dev *pdev = NULL; 200 + struct pci_dev *pdev = ndev->ntb.pdev; 201 201 struct pci_dev *pci_swds = NULL; 202 202 struct pci_dev *pci_swus = NULL; 203 203 u32 stat; 204 204 int rc; 205 205 206 206 if (ndev->ntb.topo == NTB_TOPO_SEC) { 207 + if (ndev->dev_data->is_endpoint) { 208 + rc = pcie_capability_read_dword(pdev, PCI_EXP_LNKCTL, &stat); 209 + if (rc) 210 + return rc; 211 + 212 + ndev->lnk_sta = stat; 213 + return 0; 214 + } 215 + 207 216 /* Locate the pointer to Downstream Switch for this device */ 208 217 pci_swds = pci_upstream_bridge(ndev->ntb.pdev); 209 218 if (pci_swds) { ··· 1320 1311 .mw_count = 2, 1321 1312 .mw_idx = 2, 1322 1313 }, 1314 + { /* for device 0x17d7 */ 1315 + .mw_count = 2, 1316 + .mw_idx = 2, 1317 + .is_endpoint = true, 1318 + }, 1323 1319 }; 1324 1320 1325 1321 static const struct pci_device_id amd_ntb_pci_tbl[] = { ··· 1333 1319 { PCI_VDEVICE(AMD, 0x14c0), (kernel_ulong_t)&dev_data[1] }, 1334 1320 { PCI_VDEVICE(AMD, 0x14c3), (kernel_ulong_t)&dev_data[1] }, 1335 1321 { PCI_VDEVICE(AMD, 0x155a), (kernel_ulong_t)&dev_data[1] }, 1322 + { PCI_VDEVICE(AMD, 0x17d4), (kernel_ulong_t)&dev_data[1] }, 1323 + { PCI_VDEVICE(AMD, 0x17d7), (kernel_ulong_t)&dev_data[2] }, 1336 1324 { PCI_VDEVICE(HYGON, 0x145b), (kernel_ulong_t)&dev_data[0] }, 1337 1325 { 0, } 1338 1326 };
+1
drivers/ntb/hw/amd/ntb_hw_amd.h
··· 168 168 struct ntb_dev_data { 169 169 const unsigned char mw_count; 170 170 const unsigned int mw_idx; 171 + const bool is_endpoint; 171 172 }; 172 173 173 174 struct amd_ntb_dev;