Dan Williams 267214a231 cxl/port: Fix port to pci device assumptions in read_cdat_data()
Not all endpoint CXL ports are associated with PCI devices. The cxl_test
infrastructure models 'struct cxl_port' instances hosted by platform
devices. Teach read_cdat_data() to be careful about non-pci hosted
cxl_memdev instances. Otherwise, cxl_test crashes with this signature:

 RIP: 0010:xas_start+0x6d/0x290
 [..]
 Call Trace:
  <TASK>
  xas_load+0xa/0x50
  xas_find+0x25b/0x2f0
  xa_find+0x118/0x1d0
  pci_find_doe_mailbox+0x51/0xc0
  read_cdat_data+0x45/0x190 [cxl_core]
  cxl_port_probe+0x10a/0x1e0 [cxl_port]
  cxl_bus_probe+0x17/0x50 [cxl_core]

Some other cleanups are included like removing the single-use @uport
variable, and removing the indirection through 'struct cxl_dev_state' to
lookup the device that registered the memdev and may be a pci device.

Fixes: af0a6c3587dc ("cxl/pci: Use CDAT DOE mailbox created by PCI core")
Reviewed-by: Lukas Wunner <lukas@wunner.de>
Reviewed-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Link: https://lore.kernel.org/r/168213190748.708404.16215095414060364800.stgit@dwillia2-xfh.jf.intel.com
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2023-04-22 14:04:43 -07:00
..
2023-03-16 16:54:38 +09:00
2023-02-25 09:19:23 -08:00
2023-02-24 17:18:54 -08:00
2023-02-24 12:58:55 -08:00
2023-03-24 15:38:13 -07:00
2023-02-24 12:58:55 -08:00
2023-04-07 13:53:16 -07:00
2023-04-05 21:06:28 +02:00
2023-03-09 10:17:23 -08:00
2023-02-24 12:58:55 -08:00
2023-02-28 16:05:01 -08:00
2023-02-21 12:13:58 -08:00
2023-03-28 13:30:55 +02:00
2023-02-24 15:11:03 -08:00
2023-04-01 14:09:51 -07:00
2023-02-24 12:58:55 -08:00
2023-02-25 11:30:21 -08:00
2023-02-23 15:09:31 -08:00
2023-02-25 11:00:06 -08:00
2023-03-31 12:35:03 -07:00
2023-02-27 09:47:26 -08:00
2023-04-02 10:10:16 -07:00
2023-02-25 11:48:02 -08:00
2023-02-24 13:40:13 -08:00
2023-02-24 12:58:55 -08:00
2023-02-27 10:04:49 -08:00
2023-04-06 10:13:23 -07:00
2023-03-24 19:17:22 -07:00
2023-03-27 01:42:01 +01:00
2023-02-27 10:04:49 -08:00
2023-02-26 12:10:28 -08:00
2023-03-03 09:15:50 -08:00
2023-04-08 11:57:05 -07:00
2023-03-01 09:44:22 -08:00
2023-02-24 17:29:52 -08:00
2023-03-02 09:25:38 -08:00
2023-03-09 10:06:28 +01:00
2023-04-08 12:17:46 -07:00
2023-03-18 16:01:34 -07:00
2023-02-25 11:48:02 -08:00
2023-03-02 11:12:01 -08:00
2023-03-17 10:45:49 -07:00
2023-02-26 11:53:25 -08:00