From patchwork Fri Mar 24 19:22:28 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jiaying Liang X-Patchwork-Id: 9643921 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C2F03601E9 for ; Fri, 24 Mar 2017 19:31:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B03E427D16 for ; Fri, 24 Mar 2017 19:31:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A4DAE27E5A; Fri, 24 Mar 2017 19:31:38 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-6.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D748627D16 for ; Fri, 24 Mar 2017 19:31:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S967152AbdCXTbg (ORCPT ); Fri, 24 Mar 2017 15:31:36 -0400 Received: from mail-by2nam01on0082.outbound.protection.outlook.com ([104.47.34.82]:33856 "EHLO NAM01-BY2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S967067AbdCXTaH (ORCPT ); Fri, 24 Mar 2017 15:30:07 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=xilinx.onmicrosoft.com; s=selector1-xilinx-com; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=LBJe7OWFRlzqnX0sXfLWSgcJXJZ04Av+uoFMSnPVgvM=; b=ODFmD63bJ33mig8vxYmXeoorCLESOCO1bTeGzjxpRz+0Z1voHbjUIFRALY8FAVy+ddCNbQhvk5ZgUpMkKQ45rUzC9R7Z208no1A9ArZkEKkxMFwFBXqq4fnJXZQbSBChqxUMxYZ4FUv3v9Dx2T4Hnd/DXjhJdHDYKAjxvO7uLbU= Received: from BN6PR02CA0065.namprd02.prod.outlook.com (10.175.94.155) by BN1PR0201MB0753.namprd02.prod.outlook.com (10.160.169.28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P384) id 15.1.977.11; Fri, 24 Mar 2017 19:29:59 +0000 Received: from SN1NAM02FT025.eop-nam02.prod.protection.outlook.com (2a01:111:f400:7e44::200) by BN6PR02CA0065.outlook.office365.com (2603:10b6:404:f9::27) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_128_CBC_SHA256_P256) id 15.1.991.14 via Frontend Transport; Fri, 24 Mar 2017 19:29:59 +0000 Authentication-Results: spf=pass (sender IP is 149.199.60.83) smtp.mailfrom=xilinx.com; vger.kernel.org; dkim=none (message not signed) header.d=none;vger.kernel.org; dmarc=bestguesspass action=none header.from=xilinx.com; Received-SPF: Pass (protection.outlook.com: domain of xilinx.com designates 149.199.60.83 as permitted sender) receiver=protection.outlook.com; client-ip=149.199.60.83; helo=xsj-pvapsmtpgw01; Received: from xsj-pvapsmtpgw01 (149.199.60.83) by SN1NAM02FT025.mail.protection.outlook.com (10.152.72.87) with Microsoft SMTP Server (version=TLS1_0, cipher=TLS_RSA_WITH_AES_256_CBC_SHA) id 15.1.977.7 via Frontend Transport; Fri, 24 Mar 2017 19:29:59 +0000 Received: from unknown-38-66.xilinx.com ([149.199.38.66] helo=xsj-pvapsmtp01) by xsj-pvapsmtpgw01 with esmtp (Exim 4.63) (envelope-from ) id 1crUuM-0006Jh-DX; Fri, 24 Mar 2017 12:29:58 -0700 Received: from [127.0.0.1] (helo=localhost) by xsj-pvapsmtp01 with smtp (Exim 4.63) (envelope-from ) id 1crUuM-0002mW-96; Fri, 24 Mar 2017 12:29:58 -0700 Received: from xsj-pvapsmtp01 (xsj-mail.xilinx.com [149.199.38.66]) by xsj-smtp-dlp1.xlnx.xilinx.com (8.13.8/8.13.1) with ESMTP id v2OJTl0F010469; Fri, 24 Mar 2017 12:29:47 -0700 Received: from [172.19.2.167] (helo=xsjjliang50.xilinx.com) by xsj-pvapsmtp01 with esmtp (Exim 4.63) (envelope-from ) id 1crUuB-0002jg-Lf; Fri, 24 Mar 2017 12:29:47 -0700 From: Wendy Liang To: CC: , , "Wendy Liang" , Wendy Liang , Michal Simek Subject: [RFC LINUX PATCH 12/19] remoteproc: use rproc_id_rsc for data got from idr_find() Date: Fri, 24 Mar 2017 12:22:28 -0700 Message-ID: <1490383355-23176-13-git-send-email-jliang@xilinx.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1490383355-23176-1-git-send-email-jliang@xilinx.com> References: <1490383355-23176-1-git-send-email-jliang@xilinx.com> X-RCIS-Action: ALLOW X-TM-AS-Product-Ver: IMSS-7.1.0.1224-8.1.0.1062-22962.005 X-TM-AS-User-Approved-Sender: Yes;Yes X-EOPAttributedMessage: 0 X-MS-Office365-Filtering-HT: Tenant X-Forefront-Antispam-Report: CIP:149.199.60.83; IPV:NLI; CTRY:US; EFV:NLI; SFV:NSPM; SFS:(10009020)(6009001)(39450400003)(39850400002)(39860400002)(39840400002)(39410400002)(2980300002)(438002)(189002)(199003)(9170700003)(77096006)(6666003)(9786002)(4326008)(76176999)(50986999)(36756003)(54906002)(33646002)(2351001)(110136004)(107886003)(38730400002)(356003)(106466001)(47776003)(305945005)(36386004)(8936002)(5003940100001)(6916009)(81166006)(5660300001)(48376002)(50466002)(8676002)(189998001)(50226002)(2950100002)(2906002)(107986001)(217873001); DIR:OUT; SFP:1101; SCL:1; SRVR:BN1PR0201MB0753; H:xsj-pvapsmtpgw01; FPR:; SPF:Pass; MLV:sfv; MX:1; A:1; LANG:en; X-Microsoft-Exchange-Diagnostics: 1; SN1NAM02FT025; 1:ObtgXd4EFMfdepVGtfy3Sc1JzpY1DBN+iKIsi6yeL9nVRNv/N92kh8kQnUo36he7IZ5e/ZGHo7EpEpK/Nz3wDyfi8Jy7AkZ1x0Fv/3MUcAuu93ac9YzGPaBOqZLp7gr7Q8TELDUEucUE/w29vT9ITWeUXZXKdG2EVcPrFSZ48KsojyNYFk/o1KFrOjiNIdmbE7UNC/2vhwatXjH8jDePxkH+JtniCI0KkN5CnWDo5l/eIPgKdaniti5CAVacZJT8LEmxJq6GoMk3wB+fJ/DTPwwXhLXiSdBwao73xsseCdbIWIDx32gfx/pl0bW8i0phTYmh+tDLbd1oiNGLf3WDrsYeFj58ZOljjchyWy7PdmIEE+ljqPuludJTiaqzNmpfIjo8VNqFWdTXHEn8kwDBTbJwZnFl2zOT1vSh0X1H7Lui7t5J99io+EiZO7/TdTRLpLrnMNnZkSVWpqWXxVj2Aek4V/wDGGvbtVIyXygtoIoC/TmAuW8a0wLVQ3dHXsaC6bRHaY6F/ftxXq+zUwlJCTVfRZp6HB8QRPTHMKOe2wvT96owa7BuCE+PAtNvYznV/g570VHpH1WLbMT0eNCjYA== MIME-Version: 1.0 X-MS-Office365-Filtering-Correlation-Id: e1aa3e72-38a9-4b74-7e4c-08d472ec2912 X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(22001)(8251501002)(2017030254075); SRVR:BN1PR0201MB0753; X-Microsoft-Exchange-Diagnostics: 1; BN1PR0201MB0753; 3:3H4NvJgr+8/3xJ5bmRRJv2tAhhjNUP9HRrgG7emZFGyyWCgmBHh0m6SMpH5OyP1bwat5GCdEqXkG36nrDiLtpaLb+CQ7BDDo+WxTRmsCqsO1scsULbWLOqaANPU3I4TgJ9ZcsQyJTJnBjsx0IR5xqan1r/12+pJLvEe58eB5v2lnIFmXtdR8iNvPYlKYl+RJ+IR1GxsIRPQezNeahvctzyIKsr3X4cxW3oqQtC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WdlovZJfkMtM9yrg4Wj4YcQBCWUvV9UuMFoKEyyAUx6HZ7F9cB7xWejtb/nx1H4XmptS3hdGcifpEpcN1iogirbcZQZopjrkEaO7l774pxhdEJkjSeQlOasPQoG2Urcth3PyyX8/VXbqe0c8BBU79g/PlLjIAJHQK6MKOXW0rfxygVs05Mc8e2stZK0CTQx8vzWqB5DeceBRyTQrqyY/1fmwGQPWaDouZufsz8OlSJ6NlOe7L1FMaII5omjwIz3rt113hBmgAdrofXZxstI/rs6QmE2LjP0TPjdsGrk/CwoD46/xK8B/q70pCbAW4qen+vbqU5UY/4Onv92/XKN2sbhJ9P+PuK8tnJRiXss/NGyPQPdxZwwDm0Zj3pZTuBHSxJXZrAwe11IKc1Ubyf4Y6AV23+m1zN2K2wxC X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(192813158149592); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(6040375)(601004)(2401047)(8121501046)(13023025)(13018025)(13024025)(5005006)(13017025)(13015025)(3002001)(10201501046)(6055026)(6041248)(20161123558025)(20161123562025)(20161123560025)(20161123555025)(20161123564025)(6072148); SRVR:BN1PR0201MB0753; BCL:0; PCL:0; RULEID:; SRVR:BN1PR0201MB0753; X-Microsoft-Exchange-Diagnostics: 1; BN1PR0201MB0753; 4:8Nf8tnPESz/gX5aaa16EpOWcPqY42tp1L/EkTZ5mTp9MaYfUxuG0MKhqPmODJEk+3PMz9oldV4DHNNUaQgoXPOW6V3RdaUp1i68S7Lno7tyZPrqxTOH7ktjgXaAxN5WX1asEp53iD5zxURRKGSR7sUbSo/Fq9IHoPM6YvJE3pwbeFPbYh3EFGlCbM/CNOq/VXQvwUM5HbMC7o/5X1ydUnx91FqfsISnuVDf03ddUrWhkVqHFEK0TRvoEFOF15Al9HftAXcs3zvHnTAoZRCSufS6ngHcyqGSCAoseyJM3H8uo5ihkQaoCzDaslT+knd1R5eyvwMQc2gN+Ys+OunqXhDS3s81k5Tqy4z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VbXfHurKx2cpXwVNXeauEEQKthyG/0e1NIqgYgPwdlABs25ex/fUGp6oT/RpQFEYHejmn9osx9855srOQCBrFzjbnrynBp/wupByq4fwRGf+Nug==; 5:wQQDJJXsbE9MlOd5Pof7FdUW2kgOyW8HyZ3E3wWut6SGZ3AK/A7/mFhKkCfHF7WKosK03jMaYU76idaVBuxtS59etcKIc+IKqY7J8SaSRvBPxLFguPHrXN++Wf8AfsKkjVa3ePKmxZkzRrP6dIU64g==; 24:a9i1UjKgwqfEK/sFElasM5I5LGILIIsQvle1EsIWpRgRKseaS6zEocLlrZjgy1IGknzjYeL2vVyLpuCXjZ0lAVVSPKG8+Q8vSEr+JBSUpGo= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; BN1PR0201MB0753; 7:6Sa4DPEsEQlxVOR6ocYlV20O/I0n/s5rAXCze8Kr6+QK30xAH2HIjEVR5OAfjQW5z2CHvOOOwW2YyecCyqXCcEXhjZETZGZmTutbrIPgTuWxepSHJfJVxt4EOfeTOyDP2CXpdEieyQ5+W9F1qM0l/VkujTa6jZ9MJrP8RZN/zvr2LqZX/yDRN5hEEfKu5icFAasmjFw+SgxK9qQ3eSJV4pFoz56i52ZwXXzFx21dQXeCUX979ajQWQR2fkNIYhLeHQI17g43Dvc/BX04HWOor3BSeK0cn/BAAoMKOxLK5qV7RcCslXVRJDypB2d+GvBMCj17lgjy+bbamSnlD9iC7w== X-OriginatorOrg: xilinx.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 24 Mar 2017 19:29:59.0821 (UTC) X-MS-Exchange-CrossTenant-Id: 657af505-d5df-48d0-8300-c31994686c5c X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=657af505-d5df-48d0-8300-c31994686c5c; Ip=[149.199.60.83]; Helo=[xsj-pvapsmtpgw01] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN1PR0201MB0753 Sender: linux-remoteproc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-remoteproc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Wendy Liang As not just rproc_vring can have notifyid, rproc uses rproc_id_rsc for the resource which has notifyid. And thus, the data got from idr_find() can be something else rather than rproc_vring. And thus, add the virtio_interrupt() to handle interrupt not just for vrings, and change the existing vq_interrupt() to call virtio_interrupt(). Signed-off-by: Wendy Liang Signed-off-by: Michal Simek --- drivers/remoteproc/remoteproc_core.c | 7 +++--- drivers/remoteproc/remoteproc_internal.h | 1 + drivers/remoteproc/remoteproc_virtio.c | 42 +++++++++++++++++++++++++++----- 3 files changed, 41 insertions(+), 9 deletions(-) diff --git a/drivers/remoteproc/remoteproc_core.c b/drivers/remoteproc/remoteproc_core.c index d711345..ffd1de2 100644 --- a/drivers/remoteproc/remoteproc_core.c +++ b/drivers/remoteproc/remoteproc_core.c @@ -274,7 +274,7 @@ int rproc_alloc_vring(struct rproc_vdev *rvdev, int i) * TODO: assign a notifyid for rvdev updates as well * TODO: support predefined notifyids (via resource table) */ - ret = idr_alloc(&rproc->notifyids, rvring, 0, 0, GFP_KERNEL); + ret = rproc_idr_alloc(rproc, rvring, RPROC_IDR_VRING, 0, 0); if (ret < 0) { dev_err(dev, "idr_alloc failed: %d\n", ret); dma_free_coherent(dev->parent, size, va, dma); @@ -337,8 +337,9 @@ void rproc_free_vring(struct rproc_vring *rvring) int idx = rvring->rvdev->vring - rvring; struct fw_rsc_vdev *rsc; - dma_free_coherent(rproc->dev.parent, size, rvring->va, rvring->dma); - idr_remove(&rproc->notifyids, rvring->notifyid); + dma_free_coherent(rproc->dev.parent, size, rvring->va, + rvring->dma); + rproc_idr_remove(rproc, rvring->notifyid); /* reset resource entry info */ rsc = (void *)rproc->table_ptr + rvring->rvdev->rsc_offset; diff --git a/drivers/remoteproc/remoteproc_internal.h b/drivers/remoteproc/remoteproc_internal.h index 865bd1c..0cfc942 100644 --- a/drivers/remoteproc/remoteproc_internal.h +++ b/drivers/remoteproc/remoteproc_internal.h @@ -72,6 +72,7 @@ struct rproc_fw_ops { /* from remoteproc_core.c */ void rproc_release(struct kref *kref); +irqreturn_t rproc_virtio_interrupt(struct rproc *rproc, int notifyid); irqreturn_t rproc_vq_interrupt(struct rproc *rproc, int vq_id); int rproc_boot_nowait(struct rproc *rproc); void rproc_vdev_release(struct kref *ref); diff --git a/drivers/remoteproc/remoteproc_virtio.c b/drivers/remoteproc/remoteproc_virtio.c index 0142cc3..e45e17b 100644 --- a/drivers/remoteproc/remoteproc_virtio.c +++ b/drivers/remoteproc/remoteproc_virtio.c @@ -43,7 +43,7 @@ static bool rproc_virtio_notify(struct virtqueue *vq) } /** - * rproc_vq_interrupt() - tell remoteproc that a virtqueue is interrupted + * rproc_virtio_interrupt() - tell remoteproc that a vdev is interrupted * @rproc: handle to the remote processor * @notifyid: index of the signalled virtqueue (unique per this @rproc) * @@ -54,17 +54,47 @@ static bool rproc_virtio_notify(struct virtqueue *vq) * Returns IRQ_NONE if no message was found in the @notifyid virtqueue, * and otherwise returns IRQ_HANDLED. */ -irqreturn_t rproc_vq_interrupt(struct rproc *rproc, int notifyid) +irqreturn_t rproc_virtio_interrupt(struct rproc *rproc, int notifyid) { + struct rproc_id_rsc *rsc; struct rproc_vring *rvring; - dev_dbg(&rproc->dev, "vq index %d is interrupted\n", notifyid); + dev_dbg(&rproc->dev, "virtio index %d is interrupted\n", notifyid); + + rsc = idr_find(&rproc->notifyids, notifyid); + if (!rsc || !rsc->rsc_ptr) + return IRQ_NONE; - rvring = idr_find(&rproc->notifyids, notifyid); - if (!rvring || !rvring->vq) + if (rsc->rsc_type == RPROC_IDR_VRING) { + rvring = rsc->rsc_ptr; + if (!rvring->vq) + return IRQ_NONE; + return vring_interrupt(0, rvring->vq); + } else if (rsc->rsc_type == RPROC_IDR_VDEV) { + dev_info(&rproc->dev, "vdev intr is not supported yet.\n"); return IRQ_NONE; + } - return vring_interrupt(0, rvring->vq); + dev_err(&rproc->dev, "Unknown rsc type: 0x%x\n", rsc->rsc_type); + return IRQ_NONE; +} +EXPORT_SYMBOL(rproc_virtio_interrupt); + +/** + * rproc_vq_interrupt() - tell remoteproc that a virtqueue is interrupted + * @rproc: handle to the remote processor + * @notifyid: index of the signalled virtqueue (unique per this @rproc) + * + * This function should be called by the platform-specific rproc driver, + * when the remote processor signals that a specific virtqueue has pending + * messages available. + * + * Returns IRQ_NONE if no message was found in the @notifyid virtqueue, + * and otherwise returns IRQ_HANDLED. + */ +irqreturn_t rproc_vq_interrupt(struct rproc *rproc, int notifyid) +{ + return rproc_virtio_interrupt(rproc, notifyid); } EXPORT_SYMBOL(rproc_vq_interrupt);