]> git.proxmox.com Git - mirror_ubuntu-zesty-kernel.git/commit
ACPI/IORT: Fix iort_node_get_id() mapping entries indexing
authorLorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Thu, 5 Jan 2017 17:32:16 +0000 (17:32 +0000)
committerSeth Forshee <seth.forshee@canonical.com>
Thu, 23 Feb 2017 20:20:50 +0000 (14:20 -0600)
commit50ac54c293575ec2ff7d99c9e9f57906c3342d88
tree04e7adedf3464ecf697bf1e7edea3e7603968b26
parent86396f09c830e0995b0b9257b83f10206c6437a5
ACPI/IORT: Fix iort_node_get_id() mapping entries indexing

Commit 618f535a6062 ("ACPI/IORT: Add single mapping function")
introduced a function (iort_node_get_id()) to retrieve ids for IORT
named components.

The iort_node_get_id() takes an index as input to refer to a specific
mapping entry in the named component IORT node mapping array.

For a mapping entry at a given index, iort_node_get_id() should return
the id value (through the id_out function parameter) and the IORT node
output_reference (through function return value) the given mapping entry
refers to.

Technically output_reference values may differ for different map
entries, (see diagram below - mapped id values may refer to different eg
IORT SMMU nodes; the kernel may not be able to handle different
output_reference values for a given named component but the IORT kernel
layer should still report the IORT mappings as reported by firmware) but
current code in iort_node_get_id() fails to use the index function
parameter to return the correct output_reference value (ie it always
returns the output_reference value of the first entry in the mapping
array whilst using the index correctly to retrieve the id value from the
respective entry).

|----------------------|
|     named component  |
|----------------------|
|      map entry[0]    |
|----------------------|
|       id value       |
| output_reference----------------> eg SMMU 1
|----------------------|
|      map entry[1]    |
|----------------------|
|       id value       |
| output_reference----------------> eg SMMU 2
|----------------------|
    .
    .
    .
|----------------------|
|      map entry[N]    |
|----------------------|
|       id value       |
| output_reference----------------> eg SMMU 1
|----------------------|

Consequently the iort_node_get_id() function always returns the IORT
node pointed at by the output_reference value of the first named
component mapping array entry, irrespective of the index parameter,
which is a bug.

Update the map array entry pointer computation in iort_node_get_id() to
take into account the index value, fixing the issue.

Fixes: 618f535a6062 ("ACPI/IORT: Add single mapping function")
Reported-by: Hanjun Guo <hanjun.guo@linaro.org>
Reviewed-by: Hanjun Guo <hanjun.guo@linaro.org>
Signed-off-by: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
Cc: Hanjun Guo <hanjun.guo@linaro.org>
Cc: Sinan Kaya <okaya@codeaurora.org>
Cc: Tomasz Nowicki <tn@semihalf.com>
Cc: Nate Watterson <nwatters@codeaurora.org>
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>
Signed-off-by: Will Deacon <will.deacon@arm.com>
(cherry picked from commit 030abd8a5d33057524c6c11c28d3191f3b5c63f6)
Signed-off-by: dann frazier <dann.frazier@canonical.com>
Signed-off-by: Seth Forshee <seth.forshee@canonical.com>
drivers/acpi/arm64/iort.c