Skip to content

Commit 6014e75

Browse files
committed
Merge tag 'cxl-fixes-6.18-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/cxl/cxl
Pull cxl fixes from Dave Jiang: - Fix incorrect device handle check for Generic Initiator - Fix offset calculation for extended linear cache poison injection - Fix lockdep warning for hmem_register_resource() * tag 'cxl-fixes-6.18-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/cxl/cxl: acpi/hmat: Fix lockdep warning for hmem_register_resource() cxl: Adjust offset calculation for poison injection acpi,srat: Fix incorrect device handle check for Generic Initiator
2 parents de90cc6 + 214291c commit 6014e75

File tree

3 files changed

+28
-22
lines changed

3 files changed

+28
-22
lines changed

drivers/acpi/numa/hmat.c

Lines changed: 25 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -874,10 +874,32 @@ static void hmat_register_target_devices(struct memory_target *target)
874874
}
875875
}
876876

877-
static void hmat_register_target(struct memory_target *target)
877+
static void hmat_hotplug_target(struct memory_target *target)
878878
{
879879
int nid = pxm_to_node(target->memory_pxm);
880880

881+
/*
882+
* Skip offline nodes. This can happen when memory marked EFI_MEMORY_SP,
883+
* "specific purpose", is applied to all the memory in a proximity
884+
* domain leading to * the node being marked offline / unplugged, or if
885+
* memory-only "hotplug" node is offline.
886+
*/
887+
if (nid == NUMA_NO_NODE || !node_online(nid))
888+
return;
889+
890+
guard(mutex)(&target_lock);
891+
if (target->registered)
892+
return;
893+
894+
hmat_register_target_initiators(target);
895+
hmat_register_target_cache(target);
896+
hmat_register_target_perf(target, ACCESS_COORDINATE_LOCAL);
897+
hmat_register_target_perf(target, ACCESS_COORDINATE_CPU);
898+
target->registered = true;
899+
}
900+
901+
static void hmat_register_target(struct memory_target *target)
902+
{
881903
/*
882904
* Devices may belong to either an offline or online
883905
* node, so unconditionally add them.
@@ -895,25 +917,7 @@ static void hmat_register_target(struct memory_target *target)
895917
}
896918
mutex_unlock(&target_lock);
897919

898-
/*
899-
* Skip offline nodes. This can happen when memory
900-
* marked EFI_MEMORY_SP, "specific purpose", is applied
901-
* to all the memory in a proximity domain leading to
902-
* the node being marked offline / unplugged, or if
903-
* memory-only "hotplug" node is offline.
904-
*/
905-
if (nid == NUMA_NO_NODE || !node_online(nid))
906-
return;
907-
908-
mutex_lock(&target_lock);
909-
if (!target->registered) {
910-
hmat_register_target_initiators(target);
911-
hmat_register_target_cache(target);
912-
hmat_register_target_perf(target, ACCESS_COORDINATE_LOCAL);
913-
hmat_register_target_perf(target, ACCESS_COORDINATE_CPU);
914-
target->registered = true;
915-
}
916-
mutex_unlock(&target_lock);
920+
hmat_hotplug_target(target);
917921
}
918922

919923
static void hmat_register_targets(void)
@@ -939,7 +943,7 @@ static int hmat_callback(struct notifier_block *self,
939943
if (!target)
940944
return NOTIFY_OK;
941945

942-
hmat_register_target(target);
946+
hmat_hotplug_target(target);
943947
return NOTIFY_OK;
944948
}
945949

drivers/acpi/numa/srat.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ acpi_table_print_srat_entry(struct acpi_subtable_header *header)
237237
struct acpi_srat_generic_affinity *p =
238238
(struct acpi_srat_generic_affinity *)header;
239239

240-
if (p->device_handle_type == 0) {
240+
if (p->device_handle_type == 1) {
241241
/*
242242
* For pci devices this may be the only place they
243243
* are assigned a proximity domain

drivers/cxl/core/region.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3702,6 +3702,7 @@ static int cxl_region_debugfs_poison_inject(void *data, u64 offset)
37023702
if (validate_region_offset(cxlr, offset))
37033703
return -EINVAL;
37043704

3705+
offset -= cxlr->params.cache_size;
37053706
rc = region_offset_to_dpa_result(cxlr, offset, &result);
37063707
if (rc || !result.cxlmd || result.dpa == ULLONG_MAX) {
37073708
dev_dbg(&cxlr->dev,
@@ -3734,6 +3735,7 @@ static int cxl_region_debugfs_poison_clear(void *data, u64 offset)
37343735
if (validate_region_offset(cxlr, offset))
37353736
return -EINVAL;
37363737

3738+
offset -= cxlr->params.cache_size;
37373739
rc = region_offset_to_dpa_result(cxlr, offset, &result);
37383740
if (rc || !result.cxlmd || result.dpa == ULLONG_MAX) {
37393741
dev_dbg(&cxlr->dev,

0 commit comments

Comments
 (0)