Hi Suzuki,
On Mon, 4 May 2020 at 22:29, Suzuki K Poulose suzuki.poulose@arm.com wrote:
On 05/04/2020 08:08 PM, Mathieu Poirier wrote:
On Fri, May 01, 2020 at 03:02:23PM +0100, Mike Leach wrote:
Add in the priority values for automatic default sink selection.
ETR are set to the highest priority, ETB and ETF a lower priority.
This will ensure the first ETR found is selected in preference to the first ETB / ETF found. ETB / ETF only used if no ETR present.
Signed-off-by: Mike Leach mike.leach@linaro.org
drivers/hwtracing/coresight/coresight-tmc.c | 5 +++++ 1 file changed, 5 insertions(+)
diff --git a/drivers/hwtracing/coresight/coresight-tmc.c b/drivers/hwtracing/coresight/coresight-tmc.c index 1cf82fa58289..99296b061279 100644 --- a/drivers/hwtracing/coresight/coresight-tmc.c +++ b/drivers/hwtracing/coresight/coresight-tmc.c @@ -442,6 +442,8 @@ static int tmc_probe(struct amba_device *adev, const struct amba_id *id) struct resource *res = &adev->res; struct coresight_desc desc = { 0 }; struct coresight_dev_list *dev_list = NULL;
/* default sink select priority to low priority value */
int select_priority = CORESIGHT_SINK_SELECT_PRIORITY_HI + 1;
ret = -ENOMEM; drvdata = devm_kzalloc(dev, sizeof(*drvdata), GFP_KERNEL);
@@ -493,6 +495,8 @@ static int tmc_probe(struct amba_device *adev, const struct amba_id *id) idr_init(&drvdata->idr); mutex_init(&drvdata->idr_mutex); dev_list = &etr_devs;
/* set ETR to highest default sink select priority */
select_priority = CORESIGHT_SINK_SELECT_PRIORITY_HI;
Like Mathieu said, we should allow room for future IPs, which may be better than ETR. So inverting the priority interpretation is better.
The point of having a registered "HI-est" priority is to allow the search algorithm to be able to decide if it has found the best possible sink early and stop looking. Currently we have a simple priority system with ETR marked as best possible - handled in a single driver.
If some new IP (newETR) were to arrive that is a better default fit then we can consider adjusting sink priorities dynamically as each sink is registered, so the best sink on a per system basis is chosen to be the highest priority. e.g. on a system with newETR, priority order is (newETR == HI ) < ETR < others, but on a legacy system (ETR == HI ) < others.
Regards
Mike
Suzuki