linux-stable/drivers/cxl
Dan Williams 5c3c067b60 cxl/core/port: Fix unregister_port() lock assertion
The device_lock_assert() in unregister_port() fails to pick the right
device leading to splats like the following from:

echo "ACPI0017:00" > /sys/bus/platform/drivers/cxl_acpi/unbind

 WARNING: CPU: 32 PID: 1147 at include/linux/device.h:787 unregister_port+0x49/0x50 [cxl_c
 [..]
 RIP: 0010:unregister_port+0x49/0x50 [cxl_core]
 [..]
 Call Trace:
  <TASK>
  release_nodes+0x63/0x80
  devres_release_all+0x8b/0xc0
  __device_release_driver+0x190/0x240
  device_driver_detach+0x3e/0xa0
  unbind_store+0x113/0x130

Fix it up to assert on the device_lock() for ACPI0017 for root and 1st
level ports, and parent ports for all the rest.

Fixes: 54cdbf845c ("cxl/port: Add a driver for 'struct cxl_port' objects")
Reported-by: Ben Widawsky <ben.widawsky@intel.com>
Reviewed-by: Ben Widawsky <ben.widawsky@intel.com>
Link: https://lore.kernel.org/r/164439224893.2941117.18331456248117887720.stgit@dwillia2-desk3.amr.corp.intel.com
Signed-off-by: Dan Williams <dan.j.williams@intel.com>
2022-02-11 13:26:49 -08:00
..
core cxl/core/port: Fix unregister_port() lock assertion 2022-02-11 13:26:49 -08:00
acpi.c cxl/core/port: Fix / relax decoder target enumeration 2022-02-08 23:15:10 -08:00
cxl.h cxl/core/port: Add endpoint decoders 2022-02-08 22:57:32 -08:00
cxlmem.h cxl/mem: Add the cxl_mem driver 2022-02-08 22:57:32 -08:00
cxlpci.h cxl/pci: Retrieve CXL DVSEC memory info 2022-02-08 22:57:31 -08:00
Kconfig cxl/mem: Add the cxl_mem driver 2022-02-08 22:57:32 -08:00
Makefile cxl/mem: Add the cxl_mem driver 2022-02-08 22:57:32 -08:00
mem.c cxl/mem: Add the cxl_mem driver 2022-02-08 22:57:32 -08:00
pci.c cxl/pci: Emit device serial number 2022-02-08 22:57:32 -08:00
pmem.c cxl: Prove CXL locking 2022-02-08 22:57:29 -08:00
port.c cxl/core/port: Add endpoint decoders 2022-02-08 22:57:32 -08:00