Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751404AbeAELEj (ORCPT + 1 other); Fri, 5 Jan 2018 06:04:39 -0500 Received: from mail-dm3nam03on0040.outbound.protection.outlook.com ([104.47.41.40]:55776 "EHLO NAM03-DM3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1750992AbeAELEf (ORCPT ); Fri, 5 Jan 2018 06:04:35 -0500 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=nxp.com; nxp.com; dkim=none (message not signed) header.d=none;nxp.com; dmarc=fail action=none header.from=nxp.com; From: Ioana Radulescu To: CC: , , , , , Subject: [PATCH 1/2] staging: fsl-mc/dpio: Add dpaa2_io_service_select() API Date: Fri, 5 Jan 2018 05:04:31 -0600 Message-ID: <20180105110432.26813-2-ruxandra.radulescu@nxp.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20180105110432.26813-1-ruxandra.radulescu@nxp.com> References: <20180105110432.26813-1-ruxandra.radulescu@nxp.com> X-EOPAttributedMessage: 0 X-Matching-Connectors: 131596238472762742;(91ab9b29-cfa4-454e-5278-08d120cd25b8);() X-Forefront-Antispam-Report: CIP:192.88.168.50;IPV:NLI;CTRY:US;EFV:NLI;SFV:NSPM;SFS:(10009020)(979002)(376002)(346002)(396003)(39860400002)(39380400002)(2980300002)(1109001)(1110001)(339900001)(189003)(199004)(16586007)(356003)(15760500003)(76176011)(8656006)(59450400001)(2950100002)(6916009)(68736007)(53936002)(8936002)(48376002)(77096006)(54906003)(1076002)(316002)(2906002)(104016004)(305945005)(81166006)(85426001)(47776003)(2351001)(4326008)(51416003)(39060400002)(105606002)(106466001)(8676002)(5660300001)(50226002)(50466002)(81156014)(36756003)(498600001)(97736004)(86362001)(969003)(989001)(999001)(1009001)(1019001);DIR:OUT;SFP:1101;SCL:1;SRVR:BN6PR03MB2691;H:tx30smr01.am.freescale.net;FPR:;SPF:Fail;PTR:InfoDomainNonexistent;MX:1;A:1;LANG:en; X-Microsoft-Exchange-Diagnostics: 1;BL2FFO11FD056;1:FNc+WBO9FCCJQ0yE2pRwhni6oY4yZBTrqld32IcuYQcRg6luFPQ8zIiVcPKBi93aBLQ3PIV1LUt0y8ng2dvE816EoOeF/IT2CST9919C5U1LaNhWRwP7UqtNwjIG2Qd1 MIME-Version: 1.0 Content-Type: text/plain X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7007aa37-b01d-4228-5576-08d5542c0a69 X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:(4534020)(4628075)(201703131517081)(5600026)(4604075)(2017052603307);SRVR:BN6PR03MB2691; X-Microsoft-Exchange-Diagnostics: 1;BN6PR03MB2691;3:nfdi9W2pjc/UxzROB2fi9EVtqkBHPU79YdeSHQrgYNd211BSL8JoV8SlbcbECG9vaIXeWw+8k7kp89zZeUMzrY3YHuFbpDrC2jJq8kQb8T+wtK2IHp/30KuIgNHd0sq0wO/y0Lq2Ir5F+KCUn6oQL8W/ktZq8q8IF5NW7RV4AHkxgbKWHqNpkC5iOa6fmPZc3F1jm9uVEE1cO/fQA1WUb3J2hj3hMJIkBj3DDWeXfynAL04Dr/T9xo5xe5gbhFjLoGpGnzCR0qn690PzMI3FH9+OqjBHLcMP4wzddN1HxGV9GB2TQ98hUYgf+0CVIdtih+rdWqvAzNFXXDuvlXp7gNjh/G7zrT+fyWy95hjXyL4=;25:jlv860ySr3123hHkzzyn24vwmpAC/A01T4QhDWOREJqPYnTjiLk3DaRW3x1z2EN6fhIP2lIQWubhhpHhkHSokhx3MtST1lHN1HBebaECZd9RfvlevY3pg15Kkg2Xq/5ONwaLvZO3VeigWqEC+LMmrz5DopTLX+ex5ml9vue1Qbk3T3KLOhyNTCIywJNJorA3guEUMl8c0Tp5lD+PYkhKxaTQAHnsLrH1p+VjrLNsK1ES0HT2LkWJpWuVxFhohgF21U7nq3bTj4ClXeumRxwegAMol4PuI3ye5XpD2OyBCSXwB9Ihbmp97uEb6cbkKD85Uf5L/1CIW91vgx0HQvEjxw== X-MS-TrafficTypeDiagnostic: BN6PR03MB2691: X-Microsoft-Exchange-Diagnostics: 1;BN6PR03MB2691;31:WGYCO7U6e+LMUj5JLaXMw5RO+/uLXlXIHjb1vHN+LYZYhJXgpYWnG6Vjikd1PEjGSybgkh3wBPZtI+t8CjeAE88sA1cBPUyyBG9P5Uy1+RoWzkMlCafcE/R7U/9c0Tu6BJ7O9e7UKXZX7lUps1NnPNXGecsEYP4AC2+eOWWyvJXppZxBtPRZCDLOu/LM19GWtQ3QebZVM3brl5f3HpHwsg9zlQnjiPXp4YzkikVe5NM=;4:CmBdLJ0huNO8xDHWTs6fvwP/i9EAjgWXQNThRKhLqiL9ITKdTSwUKGwsAHvpG9tXtqUe6y9bZqVqdVUUZI6Mgm15qr61KUKw3afIyjvZ3/+SxJdCFFvpd9prFq11jp7QaCSIayr9FMOsF5pzR1I8lfZkOj50cNd0iv1nFPgsTrxuTvXZ8g5SeAU0MhsI1O+py4AM4A5sedyhCTyVLgZ+uhqay+GcuLMxyp+ZaAJqF4Ya2Trpf4oO7R/NjptcLTqlllhaX5M+q1ubxDcj1MrnR6Za06H5FPrGsrzKX0bRhIMheS1sv58uE6Mle+Q7xIow X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(6095135)(2401047)(8121501046)(5005006)(93006095)(93001095)(10201501046)(3002001)(3231023)(944510075)(944921075)(946801075)(946901075)(6055026)(6096035)(201703131430075)(201703131448075)(201703131433075)(201703161259150)(201703151042153)(20161123559100)(20161123563025)(20161123556025)(20161123565025)(20161123561025)(201708071742011);SRVR:BN6PR03MB2691;BCL:0;PCL:0;RULEID:(100000803101)(100110400095)(400006);SRVR:BN6PR03MB2691; X-Forefront-PRVS: 05437568AA X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1;BN6PR03MB2691;23:VDH9xkqJ6nux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m6eNw1DiepLxGNNG0xCbqb0MGmqJOVZCS9QCm0mYw5cW9mL2R5mriU9j5B5s3x1Mp+CjIJ8rFKsdLHmP5a8EdtqzIlcc=;7:V7aBa7HtAS79+6JQVEoONIOhgjSVpRqUiFcCcNBJr6cOLoqXP+Hf44M+tpwue/NhyXD6CcOcFwAr7+V3Lu8JpHJdmAuY2zUe088k3mZDRJriRn6ZdOB7sz9FWCX3FW2AVdXq9YiF37FwbZbZFjyHpa0TsYy7J0rkq++6MdKAZe2GDgVSjt6taAJVcf2wnyR/s+QGAY28084x6fu1FxHKYQv99POhEeNvW1GNI/ZWB04Pae5VUovJGqXl0xrxC7lt SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-MS-Exchange-CrossTenant-OriginalArrivalTime: 05 Jan 2018 11:04:07.0734 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7007aa37-b01d-4228-5576-08d5542c0a69 X-MS-Exchange-CrossTenant-Id: 5afe0b00-7697-4969-b663-5eab37d5f47e X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=5afe0b00-7697-4969-b663-5eab37d5f47e;Ip=[192.88.168.50];Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN6PR03MB2691 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: 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 -- 2.7.4