From patchwork Mon Sep 21 07:36:58 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Loic Poulain X-Patchwork-Id: 292743 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 75485C43463 for ; Mon, 21 Sep 2020 07:31:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 371222085B for ; Mon, 21 Sep 2020 07:31:13 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="V+/v2ZQB" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726324AbgIUHbM (ORCPT ); Mon, 21 Sep 2020 03:31:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32838 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726211AbgIUHbM (ORCPT ); Mon, 21 Sep 2020 03:31:12 -0400 Received: from mail-wr1-x442.google.com (mail-wr1-x442.google.com [IPv6:2a00:1450:4864:20::442]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 46548C061755 for ; Mon, 21 Sep 2020 00:31:12 -0700 (PDT) Received: by mail-wr1-x442.google.com with SMTP id j2so11578298wrx.7 for ; Mon, 21 Sep 2020 00:31:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id; bh=qThituOruGqfJmANB4icVDJLbT7XwfYfdRi5PVcvaHc=; b=V+/v2ZQBqJJuvojgm7zCRBV4CVpCmG4KL+KhecuKzD41YajWMpuyCMnRbNDSSQULNY bTXPNyri/wEDokJNhweiVzo7Y+TI2yl9d579/b4lBI84172yAEeoi7i76DcCAPh8y3uj nZvZt/dYja5vxl3k1B4Xml+IzAWBtDDEjqnlRH8umIHWhdvmd5fe1yx4j085rtjdD20P oVyjyVKqf2jAfZGR97m1SIF4wbeUoDZQNXoB6WpXf4SJJhqwOuTSaQwrwkWZMMZPquSp CVyQQCxUP9UkVcfA0ApHK6s7PkSzEAovT7gEjKkcPxHIh5HlVZycaCS197KNfh92c6oG 51GA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=qThituOruGqfJmANB4icVDJLbT7XwfYfdRi5PVcvaHc=; b=TAMQvzsdhjkddtr6wcM1VSi2Yp1FNKieHu4X1srTl30bnrmX7DVUiSemIsa1aK2kr4 Ubnb4jiAMFc0TXrsHbuAAKnVhrrQTE4gTXxbgTrS9ERrWaJhmGcw04fU9iC+5gzzmVLH R+yB9Uoc1eB5eDdS0dXEwZH7rsDN5AUL+/qBu58fDOH4dsME6ROaIVheJ9YP/33S+25Y ydlHy7+JtHVV3/P/LIUD4u/XnVydKlad1C+JamNlLFTheOi/GQLr5kKvP7jR9ExpazkC tFBIDYvEOG09yO3YIPKCcHWJCC1IXp3vppz0BOSHvSeb9SQtfebyENsiImWYkiUZVZJm 3c5g== X-Gm-Message-State: AOAM532TDJfJGPtyndFzJbEgf94OGd+zRXrtkvHjzCDh6I0MvNvq2uRW BXV4zzPqjz+z2OL5+AW5SzCM1A== X-Google-Smtp-Source: ABdhPJyqhAb2P82honw+gvl6Q0MUzwYw9Oksssjjnpn2VKdXNrSximkE72wMT6s0T48BaFhy7eZ0Vg== X-Received: by 2002:adf:fc81:: with SMTP id g1mr49497243wrr.31.1600673470836; Mon, 21 Sep 2020 00:31:10 -0700 (PDT) Received: from localhost.localdomain ([2a01:e0a:490:8730:5875:9da3:b857:e7f4]) by smtp.gmail.com with ESMTPSA id u13sm18331995wrm.77.2020.09.21.00.31.09 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 21 Sep 2020 00:31:10 -0700 (PDT) From: Loic Poulain To: manivannan.sadhasivam@linaro.org, hemantk@codeaurora.org Cc: linux-arm-msm@vger.kernel.org, bjorn.andersson@linaro.org, clew@codeaurora.org, Loic Poulain Subject: [PATCH v2 1/2] bus: mhi: core: Allow shared IRQ for event rings Date: Mon, 21 Sep 2020 09:36:58 +0200 Message-Id: <1600673819-1698-1-git-send-email-loic.poulain@linaro.org> X-Mailer: git-send-email 2.7.4 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org There is no requirement for using a dedicated IRQ per event ring. Some systems does not support multiple MSI vectors (e.g. intel without CONFIG_IRQ_REMAP), In that case the MHI controller can configure all the event rings to use the same interrupt (as fallback). Allow this by removing the nr_irqs = ev_ring test and add extra check in the irq_setup function. Signed-off-by: Loic Poulain Reviewed-by: Manivannan Sadhasivam --- v2: keep nr_irqs check early in init sequence drivers/bus/mhi/core/init.c | 7 +++++++ drivers/bus/mhi/core/pm.c | 2 +- 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/bus/mhi/core/init.c b/drivers/bus/mhi/core/init.c index 19ade8a..31961af 100644 --- a/drivers/bus/mhi/core/init.c +++ b/drivers/bus/mhi/core/init.c @@ -125,6 +125,13 @@ int mhi_init_irq_setup(struct mhi_controller *mhi_cntrl) if (mhi_event->offload_ev) continue; + if (mhi_event->irq >= mhi_cntrl->nr_irqs) { + dev_err(dev, "irq %d not available for event ring\n", + mhi_event->irq); + ret = -EINVAL; + goto error_request; + } + ret = request_irq(mhi_cntrl->irq[mhi_event->irq], mhi_irq_handler, IRQF_SHARED | IRQF_NO_SUSPEND, diff --git a/drivers/bus/mhi/core/pm.c b/drivers/bus/mhi/core/pm.c index ce4d969..3de7b16 100644 --- a/drivers/bus/mhi/core/pm.c +++ b/drivers/bus/mhi/core/pm.c @@ -918,7 +918,7 @@ int mhi_async_power_up(struct mhi_controller *mhi_cntrl) dev_info(dev, "Requested to power ON\n"); - if (mhi_cntrl->nr_irqs < mhi_cntrl->total_ev_rings) + if (mhi_cntrl->nr_irqs < 1) return -EINVAL; /* Supply default wake routines if not provided by controller driver */ From patchwork Mon Sep 21 07:36:59 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Loic Poulain X-Patchwork-Id: 250144 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH, MAILING_LIST_MULTI, SIGNED_OFF_BY, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 28B96C43465 for ; Mon, 21 Sep 2020 07:31:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id E072D20809 for ; Mon, 21 Sep 2020 07:31:14 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="A5IkbEuh" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726333AbgIUHbO (ORCPT ); Mon, 21 Sep 2020 03:31:14 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:32846 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726211AbgIUHbO (ORCPT ); Mon, 21 Sep 2020 03:31:14 -0400 Received: from mail-wr1-x442.google.com (mail-wr1-x442.google.com [IPv6:2a00:1450:4864:20::442]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B7F23C061755 for ; Mon, 21 Sep 2020 00:31:13 -0700 (PDT) Received: by mail-wr1-x442.google.com with SMTP id w5so11568810wrp.8 for ; Mon, 21 Sep 2020 00:31:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=E9uK6cUKZvYaOC1SO2xlC3K+A737Lj7EsUdN8ZvLlkQ=; b=A5IkbEuhkIu7q9pLhz2cRNtfeZKzP/rs30nYcFuavg7GJY0TTqHGNcxv1VLJKd07NY BQ3cGhN1k7l8t5weJlT7brQ6nctnX6X+99VsazEQrZxv1RIUayk0u6Nqf8aycEmk45MQ LlCx+CCGRbxc61+DiybyNbCUDSm7XHtPFz8wAR1HoIYHn710RVmp2KfM3+d/Z6cxql3l i/KvfFGPmccT3qGoM/HK8lflUJpcWa4X+KWidv226myeolmDRVEWbjdaQwG56Ss8lUqQ JBFphIFTwrRBONtyl2RyswULF4asxSuy22yekRK4zStsZ3iu9+AVPvPHVckRf61MArUG WxHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=E9uK6cUKZvYaOC1SO2xlC3K+A737Lj7EsUdN8ZvLlkQ=; b=JtYCXR7+hcYiD7BclTKP/atJUSwHqZq4TcyZe0NlsX4AfvGS8wJ3mq5eGEGZFef5be Rd7EiQQEjKmp9YDc8jtEmZ03MNK0ynrD1TtSkeWiOiCKv0kgiBEi1c2EO05DiPYzSUu9 e59z4RcvGTVLXQsGEzVG6vD3aCKI2IvyADoGqnrIAHZEbLPuJkAQWo+FGRxG7gI/6Q0v 77uZTQwT/Uy69V8xgSpe/St9+qmsbCCVPDK6y2JZ5ppZgeiKF9A/XLWXcBV5u7RBck1o 1/1yMd0J5V2b1rjybdV8CKNGZ6RiHsF8peGkg9UExwnMzw1Ll35csO1LXHhh3sicu7Af 2OKQ== X-Gm-Message-State: AOAM532g5Lyu5yyvxWgfia0hRydMiOJ7096ejNk63ugaOlK48jfpjuc+ YP5tRse5KRXeD+Aqi8z0mv8vag== X-Google-Smtp-Source: ABdhPJwW4j10XVwNTtKtXR6vJevIyL58H2NTaF1wEzJtHRwToXYBdm+5Y1eY0FRh3434W/NDRexjRw== X-Received: by 2002:adf:e8ce:: with SMTP id k14mr54538631wrn.394.1600673472457; Mon, 21 Sep 2020 00:31:12 -0700 (PDT) Received: from localhost.localdomain ([2a01:e0a:490:8730:5875:9da3:b857:e7f4]) by smtp.gmail.com with ESMTPSA id u13sm18331995wrm.77.2020.09.21.00.31.11 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Mon, 21 Sep 2020 00:31:12 -0700 (PDT) From: Loic Poulain To: manivannan.sadhasivam@linaro.org, hemantk@codeaurora.org Cc: linux-arm-msm@vger.kernel.org, bjorn.andersson@linaro.org, clew@codeaurora.org, Loic Poulain Subject: [PATCH v2 2/2] bus: mhi: Remove unused nr_irqs_req variable Date: Mon, 21 Sep 2020 09:36:59 +0200 Message-Id: <1600673819-1698-2-git-send-email-loic.poulain@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1600673819-1698-1-git-send-email-loic.poulain@linaro.org> References: <1600673819-1698-1-git-send-email-loic.poulain@linaro.org> Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org nr_irqs_req is unused in MHI stack. Signed-off-by: Loic Poulain Reviewed-by: Manivannan Sadhasivam --- v2: add this patch to the series drivers/bus/mhi/core/init.c | 3 --- include/linux/mhi.h | 2 -- 2 files changed, 5 deletions(-) diff --git a/drivers/bus/mhi/core/init.c b/drivers/bus/mhi/core/init.c index 31961af..8798deb 100644 --- a/drivers/bus/mhi/core/init.c +++ b/drivers/bus/mhi/core/init.c @@ -643,9 +643,6 @@ static int parse_ev_cfg(struct mhi_controller *mhi_cntrl, mhi_event++; } - /* We need IRQ for each event ring + additional one for BHI */ - mhi_cntrl->nr_irqs_req = mhi_cntrl->total_ev_rings + 1; - return 0; error_ev_cfg: diff --git a/include/linux/mhi.h b/include/linux/mhi.h index 742dabe..0d277c7 100644 --- a/include/linux/mhi.h +++ b/include/linux/mhi.h @@ -309,7 +309,6 @@ struct mhi_controller_config { * @total_ev_rings: Total # of event rings allocated * @hw_ev_rings: Number of hardware event rings * @sw_ev_rings: Number of software event rings - * @nr_irqs_req: Number of IRQs required to operate (optional) * @nr_irqs: Number of IRQ allocated by bus master (required) * @family_number: MHI controller family number * @device_number: MHI controller device number @@ -389,7 +388,6 @@ struct mhi_controller { u32 total_ev_rings; u32 hw_ev_rings; u32 sw_ev_rings; - u32 nr_irqs_req; u32 nr_irqs; u32 family_number; u32 device_number;