Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752295AbeAESLH (ORCPT + 1 other); Fri, 5 Jan 2018 13:11:07 -0500 Received: from mail-db5eur01on0056.outbound.protection.outlook.com ([104.47.2.56]:61888 "EHLO EUR01-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751973AbeAESLF (ORCPT ); Fri, 5 Jan 2018 13:11:05 -0500 From: Roy Pledge To: Ruxandra Ioana Radulescu , "gregkh@linuxfoundation.org" CC: "devel@driverdev.osuosl.org" , "linux-kernel@vger.kernel.org" , "Laurentiu Tudor" , "stuyoder@gmail.com" , Bogdan Purcareata Subject: Re: [PATCH 1/2] staging: fsl-mc/dpio: Add dpaa2_io_service_select() API Thread-Topic: [PATCH 1/2] staging: fsl-mc/dpio: Add dpaa2_io_service_select() API Thread-Index: AQHThhT7RfT84lAXJ0eVh3dAuXjnsw== Date: Fri, 5 Jan 2018 18:11:00 +0000 Message-ID: References: <20180105110432.26813-1-ruxandra.radulescu@nxp.com> <20180105110432.26813-2-ruxandra.radulescu@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: spf=none (sender IP is ) smtp.mailfrom=roy.pledge@nxp.com; x-originating-ip: [192.88.168.1] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;VI1PR0402MB2846;7:t+i1s0IyoevnOctWtvBiYucLVeiiACmDlEXBC7zz/w96YYlfoCnEv6WavvRJY5o8RJvfihx3spBSKTckviS5EYC8mRcbcSk3HegUCMdEIK8y/sj1Ztn99P7gmhcMBFMOkjuO77ldxVav9IeqOvq+ziaZuLKfr2LEAQJDc56vHXjMtJyFPumqj5kIg5tiZ/MF1kmJ+KvHpfs2F1774939kC5RHdjV7Rl4/dW2yQRDdnuPQ6rRibv1n1l5TApOcVw7 x-ms-exchange-antispam-srfa-diagnostics: SSOS;SSOR; x-forefront-antispam-report: SFV:SKI;SCL:-1;SFV:NSPM;SFS:(10009020)(346002)(396003)(39860400002)(366004)(376002)(39380400002)(189003)(199004)(24454002)(54906003)(2906002)(110136005)(102836004)(478600001)(68736007)(7696005)(3280700002)(8936002)(3846002)(6116002)(2900100001)(3660700001)(76176011)(59450400001)(6506007)(14454004)(97736004)(99286004)(316002)(86362001)(53546011)(5660300001)(33656002)(5250100002)(8676002)(81156014)(2501003)(7736002)(4326008)(81166006)(25786009)(305945005)(15760500003)(229853002)(9686003)(106356001)(53936002)(55016002)(6436002)(39060400002)(74316002)(66066001)(105586002)(6246003);DIR:OUT;SFP:1101;SCL:1;SRVR:VI1PR0402MB2846;H:DB6PR04MB2999.eurprd04.prod.outlook.com;FPR:;SPF:None;PTR:InfoNoRecords;MX:1;A:1;LANG:en; x-ms-office365-filtering-ht: Tenant x-ms-office365-filtering-correlation-id: 6d4a0250-2d65-4d69-c6d7-08d55467ad19 x-microsoft-antispam: UriScan:;BCL:0;PCL:0;RULEID:(48565401081)(4534020)(4602075)(4627115)(201703031133081)(201702281549075)(5600026)(4604075)(3008032)(2017052603307)(7153060);SRVR:VI1PR0402MB2846; x-ms-traffictypediagnostic: VI1PR0402MB2846: x-microsoft-antispam-prvs: x-exchange-antispam-report-test: UriScan:(185117386973197); x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(6040470)(2401047)(8121501046)(5005006)(3231023)(944501075)(3002001)(10201501046)(93006095)(93001095)(6055026)(6041268)(20161123558120)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123560045)(20161123564045)(6072148)(201708071742011);SRVR:VI1PR0402MB2846;BCL:0;PCL:0;RULEID:(100000803101)(100110400095);SRVR:VI1PR0402MB2846; x-forefront-prvs: 05437568AA x-microsoft-antispam-message-info: uM2qYjnAYDCzX631VmWPrYva1/1sGMaoXm1FNrfUeKE/Acw7Roks1ZKfhj1fk1ObPspz+IdDxxcOZz0aoAFDYA== spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 8BIT MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 6d4a0250-2d65-4d69-c6d7-08d55467ad19 X-MS-Exchange-CrossTenant-originalarrivaltime: 05 Jan 2018 18:11:00.4524 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0402MB2846 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: On 1/5/2018 6:04 AM, Ioana Radulescu wrote: > All DPIO service API functions receive a dpaa2_io service pointer > as parameter (NULL meaning any service will do) which indicates > the hardware resource to be used to execute the specified command. > > There isn't however any available API for obtaining such a service > reference that could be used further, effectively forcing the users > to always request a random service for DPIO operations. > (The DPIO driver holds internally an array mapping services to cpus, > and affine services can be indirectly requested by a couple of API > functions: dpaa2_io_service_register and dpaa2_io_service_rearm > use the cpu id provided by the user to select the corresponding > service) > > This patch adds a function for selecting a DPIO service based on > the specified cpu id. If the user provides a "don't care" value > for the cpu, we revert to the default behavior and return the next > DPIO, taken in a round-robin fashion from a list of available > services. > > Signed-off-by: Ioana Radulescu > --- > drivers/staging/fsl-mc/bus/dpio/dpio-service.c | 17 +++++++++++++++++ > drivers/staging/fsl-mc/include/dpaa2-io.h | 2 ++ > 2 files changed, 19 insertions(+) > > diff --git a/drivers/staging/fsl-mc/bus/dpio/dpio-service.c b/drivers/staging/fsl-mc/bus/dpio/dpio-service.c > index a8a8e15..6e8994c 100644 > --- a/drivers/staging/fsl-mc/bus/dpio/dpio-service.c > +++ b/drivers/staging/fsl-mc/bus/dpio/dpio-service.c > @@ -104,6 +104,23 @@ static inline struct dpaa2_io *service_select(struct dpaa2_io *d) > } > > /** > + * dpaa2_io_service_select() - return a dpaa2_io service affined to this cpu > + * @cpu: the cpu id > + * > + * Return the affine dpaa2_io service, or NULL if there is no service affined > + * to the specified cpu. If DPAA2_IO_ANY_CPU is used, return the next available > + * service. > + */ > +struct dpaa2_io *dpaa2_io_service_select(int cpu) > +{ > + if (cpu == DPAA2_IO_ANY_CPU) > + return service_select(NULL); > + > + return service_select_by_cpu(NULL, cpu); > +} > +EXPORT_SYMBOL_GPL(dpaa2_io_service_select); > + > +/** > * dpaa2_io_create() - create a dpaa2_io object. > * @desc: the dpaa2_io descriptor > * > diff --git a/drivers/staging/fsl-mc/include/dpaa2-io.h b/drivers/staging/fsl-mc/include/dpaa2-io.h > index 07ad15a..9d70251 100644 > --- a/drivers/staging/fsl-mc/include/dpaa2-io.h > +++ b/drivers/staging/fsl-mc/include/dpaa2-io.h > @@ -88,6 +88,8 @@ void dpaa2_io_down(struct dpaa2_io *d); > > irqreturn_t dpaa2_io_irq(struct dpaa2_io *obj); > > +struct dpaa2_io *dpaa2_io_service_select(int cpu); > + > /** > * struct dpaa2_io_notification_ctx - The DPIO notification context structure > * @cb: The callback to be invoked when the notification arrives > Acked-by: Roy Pledge