Skip to content

Commit

Permalink
ACPI: HMAT: use %u instead of %d to print u32 values
Browse files Browse the repository at this point in the history
Use %u instead of %d to print u32 values to expand the value range,
especially when latency or bandwidth value is bigger than INT_MAX.

Then HMAT latency can support up to 4.29s and bandwidth can support
up to 4PB/s.

Reviewed-by: Dan Williams <dan.j.williams@intel.com>
Reviewed-by: Jingqi Liu <Jingqi.liu@intel.com>
Signed-off-by: Tao Xu <tao3.xu@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
  • Loading branch information
Tao Xu authored and Rafael J. Wysocki committed Nov 12, 2019
1 parent 59b2c5b commit 0f1839d
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions drivers/acpi/numa/hmat.c
Original file line number Diff line number Diff line change
Expand Up @@ -293,7 +293,7 @@ static __init int hmat_parse_locality(union acpi_subtable_headers *header,
u8 type, mem_hier;

if (hmat_loc->header.length < sizeof(*hmat_loc)) {
pr_notice("HMAT: Unexpected locality header length: %d\n",
pr_notice("HMAT: Unexpected locality header length: %u\n",
hmat_loc->header.length);
return -EINVAL;
}
Expand All @@ -305,12 +305,12 @@ static __init int hmat_parse_locality(union acpi_subtable_headers *header,
total_size = sizeof(*hmat_loc) + sizeof(*entries) * ipds * tpds +
sizeof(*inits) * ipds + sizeof(*targs) * tpds;
if (hmat_loc->header.length < total_size) {
pr_notice("HMAT: Unexpected locality header length:%d, minimum required:%d\n",
pr_notice("HMAT: Unexpected locality header length:%u, minimum required:%u\n",
hmat_loc->header.length, total_size);
return -EINVAL;
}

pr_info("HMAT: Locality: Flags:%02x Type:%s Initiator Domains:%d Target Domains:%d Base:%lld\n",
pr_info("HMAT: Locality: Flags:%02x Type:%s Initiator Domains:%u Target Domains:%u Base:%lld\n",
hmat_loc->flags, hmat_data_type(type), ipds, tpds,
hmat_loc->entry_base_unit);

Expand All @@ -323,7 +323,7 @@ static __init int hmat_parse_locality(union acpi_subtable_headers *header,
value = hmat_normalize(entries[init * tpds + targ],
hmat_loc->entry_base_unit,
type);
pr_info(" Initiator-Target[%d-%d]:%d%s\n",
pr_info(" Initiator-Target[%u-%u]:%u%s\n",
inits[init], targs[targ], value,
hmat_data_type_suffix(type));

Expand All @@ -350,13 +350,13 @@ static __init int hmat_parse_cache(union acpi_subtable_headers *header,
u32 attrs;

if (cache->header.length < sizeof(*cache)) {
pr_notice("HMAT: Unexpected cache header length: %d\n",
pr_notice("HMAT: Unexpected cache header length: %u\n",
cache->header.length);
return -EINVAL;
}

attrs = cache->cache_attributes;
pr_info("HMAT: Cache: Domain:%d Size:%llu Attrs:%08x SMBIOS Handles:%d\n",
pr_info("HMAT: Cache: Domain:%u Size:%llu Attrs:%08x SMBIOS Handles:%d\n",
cache->memory_PD, cache->cache_size, attrs,
cache->number_of_SMBIOShandles);

Expand Down Expand Up @@ -411,17 +411,17 @@ static int __init hmat_parse_proximity_domain(union acpi_subtable_headers *heade
struct memory_target *target = NULL;

if (p->header.length != sizeof(*p)) {
pr_notice("HMAT: Unexpected address range header length: %d\n",
pr_notice("HMAT: Unexpected address range header length: %u\n",
p->header.length);
return -EINVAL;
}

if (hmat_revision == 1)
pr_info("HMAT: Memory (%#llx length %#llx) Flags:%04x Processor Domain:%d Memory Domain:%d\n",
pr_info("HMAT: Memory (%#llx length %#llx) Flags:%04x Processor Domain:%u Memory Domain:%u\n",
p->reserved3, p->reserved4, p->flags, p->processor_PD,
p->memory_PD);
else
pr_info("HMAT: Memory Flags:%04x Processor Domain:%d Memory Domain:%d\n",
pr_info("HMAT: Memory Flags:%04x Processor Domain:%u Memory Domain:%u\n",
p->flags, p->processor_PD, p->memory_PD);

if (p->flags & ACPI_HMAT_MEMORY_PD_VALID && hmat_revision == 1) {
Expand Down

0 comments on commit 0f1839d

Please sign in to comment.