Re: [PATCHv2 1/2] coresight: Do not default to CPU0 for missing CPU phandle

From: Sai Prakash Ranjan
Date: Fri Jun 21 2019 - 06:34:02 EST


Hello Suzuki,

On 6/21/2019 3:18 PM, Suzuki K Poulose wrote:
Hi Sai,


On 06/20/2019 07:31 PM, Sai Prakash Ranjan wrote:
Coresight platform support assumes that a missing "cpu" phandle
defaults to CPU0. This could be problematic and unnecessarily binds
components to CPU0, where they may not be. Let us make the DT binding
rules a bit stricter by not defaulting to CPU0 for missing "cpu"
affinity information.

Also in coresight etm and cpu-debug drivers, abort the probe
for such cases.

Signed-off-by: Sai Prakash Ranjan <saiprakash.ranjan@xxxxxxxxxxxxxx>
Reviewed-by: Suzuki K Poulose <suzuki.poulose@xxxxxxx>

Please drop this tag for now.


Ok will drop this.

---
 Documentation/devicetree/bindings/arm/coresight.txt | 2 +-
 drivers/hwtracing/coresight/coresight-cpu-debug.c | 3 +++
 drivers/hwtracing/coresight/coresight-etm3x.c | 3 +++
 drivers/hwtracing/coresight/coresight-etm4x.c | 3 +++
 drivers/hwtracing/coresight/coresight-platform.c | 10 +++++-----
 5 files changed, 15 insertions(+), 6 deletions(-)

diff --git a/Documentation/devicetree/bindings/arm/coresight.txt b/Documentation/devicetree/bindings/arm/coresight.txt
index 8a88ddebc1a2..c4659ba9457d 100644
--- a/Documentation/devicetree/bindings/arm/coresight.txt
+++ b/Documentation/devicetree/bindings/arm/coresight.txt
@@ -88,7 +88,7 @@ its hardware characteristcs.
ÂÂÂÂÂÂÂ registers via co-processor 14.
ÂÂÂÂÂ * cpu: the cpu phandle this ETM/PTM is affined to. When omitted the
-ÂÂÂÂÂ source is considered to belong to CPU0.
+ÂÂÂÂÂ affinity is set to invalid.

Please move this from the "Optional properties". It is not "Optional"
anymore with this change. Please make sure it is evident that this
is mandatory. Also please fix the bindings document for cpu-debug.txt.


 * Optional property for TMC:

diff --git a/drivers/hwtracing/coresight/coresight-platform.c b/drivers/hwtracing/coresight/coresight-platform.c
index 3c5ceda8db24..8b03fa573684 100644
--- a/drivers/hwtracing/coresight/coresight-platform.c
+++ b/drivers/hwtracing/coresight/coresight-platform.c
@@ -159,16 +159,16 @@ static int of_coresight_get_cpu(struct device *dev)
ÂÂÂÂÂ struct device_node *dn;
ÂÂÂÂÂ if (!dev->of_node)
-ÂÂÂÂÂÂÂ return 0;
+ÂÂÂÂÂÂÂ return -ENODEV;
+
ÂÂÂÂÂ dn = of_parse_phandle(dev->of_node, "cpu", 0);
-ÂÂÂ /* Affinity defaults to CPU0 */
ÂÂÂÂÂ if (!dn)
-ÂÂÂÂÂÂÂ return 0;
+ÂÂÂÂÂÂÂ return -ENODEV;
+
ÂÂÂÂÂ cpu = of_cpu_node_to_id(dn);
ÂÂÂÂÂ of_node_put(dn);

Please fix the acpi_coresight_get_cpu() for ACPI.


Ok will do it. Thanks again for the review comments.

-Sai

--
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member
of Code Aurora Forum, hosted by The Linux Foundation