Skip to content

Commit d2f7060

Browse files
weiny2djbw
authored andcommitted
cxl/mbox: Fix CEL logic for poison and security commands
The following debug output was observed while testing CXL cxl_core:cxl_walk_cel:721: cxl_mock_mem cxl_mem.0: Opcode 0x4300 unsupported by driver opcode 0x4300 (Get Poison) is supported by the driver and the mock device supports it. The logic should be checking that the opcode is both not poison and not security. Fix the logic to allow poison and security commands. Fixes: ad64f59 ("cxl/memdev: Only show sanitize sysfs files when supported") Cc: <stable@vger.kernel.org> Signed-off-by: Ira Weiny <ira.weiny@intel.com> Reviewed-by: Davidlohr Bueso <dave@stgolabs.net> Acked-by: Jonathan Cameron <Jonathan.Cameron@huawei.com> Link: https://lore.kernel.org/r/20230903-cxl-cel-fix-v1-1-e260c9467be3@intel.com [cleanup cxl_walk_cel() to centralized "enabled" checks] Signed-off-by: Dan Williams <dan.j.williams@intel.com>
1 parent 55b8ff0 commit d2f7060

File tree

1 file changed

+12
-11
lines changed

1 file changed

+12
-11
lines changed

drivers/cxl/core/mbox.c

Lines changed: 12 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -715,24 +715,25 @@ static void cxl_walk_cel(struct cxl_memdev_state *mds, size_t size, u8 *cel)
715715
for (i = 0; i < cel_entries; i++) {
716716
u16 opcode = le16_to_cpu(cel_entry[i].opcode);
717717
struct cxl_mem_command *cmd = cxl_mem_find_command(opcode);
718+
int enabled = 0;
718719

719-
if (!cmd && (!cxl_is_poison_command(opcode) ||
720-
!cxl_is_security_command(opcode))) {
721-
dev_dbg(dev,
722-
"Opcode 0x%04x unsupported by driver\n", opcode);
723-
continue;
724-
}
725-
726-
if (cmd)
720+
if (cmd) {
727721
set_bit(cmd->info.id, mds->enabled_cmds);
722+
enabled++;
723+
}
728724

729-
if (cxl_is_poison_command(opcode))
725+
if (cxl_is_poison_command(opcode)) {
730726
cxl_set_poison_cmd_enabled(&mds->poison, opcode);
727+
enabled++;
728+
}
731729

732-
if (cxl_is_security_command(opcode))
730+
if (cxl_is_security_command(opcode)) {
733731
cxl_set_security_cmd_enabled(&mds->security, opcode);
732+
enabled++;
733+
}
734734

735-
dev_dbg(dev, "Opcode 0x%04x enabled\n", opcode);
735+
dev_dbg(dev, "Opcode 0x%04x %s\n", opcode,
736+
enabled ? "enabled" : "unsupported by driver");
736737
}
737738
}
738739

0 commit comments

Comments
 (0)