mbox series

[v8,0/3] check interleave capability

Message ID 20240614032133.45365-1-yaoxt.fnst@fujitsu.com
Headers show
Series check interleave capability | expand

Message

Xingtao Yao (Fujitsu) June 14, 2024, 3:21 a.m. UTC
Currently, the cxl driver does not check the interleave capability of
devices (such as host bridges, switches, cxl_mem, etc.) when creating
a region.

When the driver adds a device to the region and sets its decoder, if the
device does not support the specified interleave ways or interleave
granularity, the device may ignore unsupported bits, causing the
configured decoder to be inconsistent with expectations.

During memory access, the decoder may decode the HPA into an incorrect DPA,
ultimately leading to memory access failure.

Checking the interleave capability of a device early in the process of
adding it to a region can quickly prevent this issue from occurring.

Changes:
V7[7] -> V8:
-- drop the redundant check in check_interleave_cap()
-- add cxlmem.h to kernel-doc (newly add)
-- fixup cxl_test (newly add)

V6[6] -> V7:
-- update comment.

V5[5] -> V6:
-- fix some typo.
-- update comment.
-- set rc when check failed in cxl_port_attach_region().

V4[4] -> V5:
-- update comment.
-- add nr_targets check while attaching a port to switch.
-- delete passthrough flag and allow all the capabilities for passthrough
   decoders.

V3[3] -> V4:
-- update comment.
-- optimize the code.
-- add a passthrough flag to mark the passthrough decoder.

V2[2] -> V3:
-- revert ig_cap_mask to interleave_mask.
-- fix the interleave bits check logical.

V1[1] -> V2:
-- rename interleave_mask to ig_cap_mask.
-- add a check for interleave granularity.
-- update commit.
-- move hdm caps init to parse_hdm_decoder_caps().

[1]
https://lore.kernel.org/linux-cxl/20240401075635.9333-1-yaoxt.fnst@fujitsu.com

[2]
https://lore.kernel.org/linux-cxl/20240403021747.17260-1-yaoxt.fnst@fujitsu.com

[3]
https://lore.kernel.org/linux-cxl/20240409022621.29115-1-yaoxt.fnst@fujitsu.com

[4]
https://lore.kernel.org/linux-cxl/20240422091350.4701-1-yaoxt.fnst@fujitsu.com

[5]
https://lore.kernel.org/linux-cxl/20240524092740.4260-1-yaoxt.fnst@fujitsu.com

[6]
https://lore.kernel.org/linux-cxl/20240611021511.35315-1-yaoxt.fnst@fujitsu.com

[7]
https://lore.kernel.org/linux-cxl/20240612032544.39149-1-yaoxt.fnst@fujitsu.com

Yao Xingtao (3):
  cxl/region: check interleave capability
  cxl: documentation: add cxlmem.h to cxl driver-api
  cxl_test: fix the 'create region failed' error

 .../driver-api/cxl/memory-devices.rst         |  3 +
 drivers/cxl/core/hdm.c                        | 13 +++
 drivers/cxl/core/region.c                     | 89 +++++++++++++++++++
 drivers/cxl/cxl.h                             |  2 +
 drivers/cxl/cxlmem.h                          | 10 +++
 tools/testing/cxl/test/cxl.c                  |  4 +
 6 files changed, 121 insertions(+)