All of lore.kernel.org
 help / color / mirror / Atom feed
From: Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>
To: Hanjun Guo <hanjun.guo@linaro.org>
Cc: linux-acpi@vger.kernel.org, linux-kernel@vger.kernel.org,
	Sinan Kaya <okaya@codeaurora.org>,
	Tomasz Nowicki <tn@semihalf.com>,
	Nate Watterson <nwatters@codeaurora.org>,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>
Subject: Re: [PATCH v2] ACPI/IORT: Fix iort_node_get_id() mapping entries indexing
Date: Fri, 3 Feb 2017 08:57:31 +0000	[thread overview]
Message-ID: <20170203085731.GA30745@red-moon> (raw)
In-Reply-To: <5893E8ED.1010107@linaro.org>

On Fri, Feb 03, 2017 at 10:20:29AM +0800, Hanjun Guo wrote:
> On 01/10/2017 08:00 PM, Lorenzo Pieralisi wrote:
> >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>
> >---
> >v1 -> v2:
> >	- Updated/improved commit log
> >	- Added review tags
> 
> Forgot to mention that I tested this patch on Hisilicon
> D03,
> 
> Tested-by: Hanjun Guo <hanjun.guo@linaro.org>
> 
> BTW, Lorenzo, Rafael, since it's a bugfix, can this be merged into
> 4.10-rc7?

Yes, I thought Rafael picked it up already (I can't see it in
patchwork any longer).

This one from Dan:

https://patchwork.kernel.org/patch/9521003/

should get in -rc7 too, we should have both fixes in before v4.10
is released.

Rafael can you send them both for -rc7 please ?

Thanks,
Lorenzo

      reply	other threads:[~2017-02-03  8:55 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-01-10 12:00 [PATCH v2] ACPI/IORT: Fix iort_node_get_id() mapping entries indexing Lorenzo Pieralisi
2017-01-10 15:53 ` Sinan Kaya
2017-02-03  2:20 ` Hanjun Guo
2017-02-03  8:57   ` Lorenzo Pieralisi [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20170203085731.GA30745@red-moon \
    --to=lorenzo.pieralisi@arm.com \
    --cc=hanjun.guo@linaro.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=nwatters@codeaurora.org \
    --cc=okaya@codeaurora.org \
    --cc=rjw@rjwysocki.net \
    --cc=tn@semihalf.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.