Received: by 2002:a25:d783:0:0:0:0:0 with SMTP id o125csp785538ybg; Thu, 19 Mar 2020 08:43:36 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvfufwXgy2fC/9AM7b5ZhPgSyokYMNHrwKeyk5gCxJU37sAoOJBbJM1SNscwZZH0WwuLCGt X-Received: by 2002:a05:6830:231d:: with SMTP id u29mr2687327ote.1.1584632616076; Thu, 19 Mar 2020 08:43:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584632616; cv=none; d=google.com; s=arc-20160816; b=RO6uhntDtRuwpg3X0ICeqtGpYBJefl8Kl9pMGAI/5Hl0sHHMbg0FsxIN+m53w/8JE+ NghN4RqOodMjanOkwyHR/5WvgBUDROc88KclhnXVgkLCqNB4f7h6LR4aKpoBnjFWIJpY KYLWdqsTRml5Pb3shwH6eBS+EzFh1jRTP1vJ3VCHxruK5zhQ0I+i6BgKX184L7TCVJYk eDWTk0zjfSiGJLO0dRRCSN/3Qpp9vJJamugx98H3rqVfW0o9rPO0x+VoB4RquhSgU4P3 BoMJ8yZyq3Mqyy3J0gqL8Nucbhmwb0t1meYeiiNzZqsQ2q9TsoHeldGTYENact+Z4Du5 F4gQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=WKn9oy7LjzjNbIva9cztXWD+TvZE+H/DGoDlTlp0qBE=; b=a9kHUNwhqCWuD0mn125v0Qm9x3kS7yPruDHxBIU5mTfH3pJxVqq14laQoHpvOVOOE1 QBD0uvuOxev7LJ0bPygHoiyxOG6KZQ1+m3hrzAopm4Bq+SNbCZ80LPCCsjItBiZ20INz JxDNMuCjjnUu7hANeUVFBR9pR2rQ2q4xe2EhPTlevX53p0+4CZDoeaD9cey1dNtGmj+e 7gp0jO3EKzMF21GlitZ33+vn6QpLGhVf6db2Uk6j85bj0+1FISUqXT9FKJWHvf4hgH7E fxTU6BsmrVx8v7pqqkKYTIrz0DInzFaz6SSksKqhths6DPoFzwp578p+wHgWZW+MysMX kb2Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id p189si1269372oic.178.2020.03.19.08.43.21; Thu, 19 Mar 2020 08:43:36 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728094AbgCSPlL (ORCPT + 99 others); Thu, 19 Mar 2020 11:41:11 -0400 Received: from inva021.nxp.com ([92.121.34.21]:51796 "EHLO inva021.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727462AbgCSPlL (ORCPT ); Thu, 19 Mar 2020 11:41:11 -0400 Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id E0D692000E8; Thu, 19 Mar 2020 16:41:09 +0100 (CET) Received: from inva024.eu-rdc02.nxp.com (inva024.eu-rdc02.nxp.com [134.27.226.22]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id D1A922000E7; Thu, 19 Mar 2020 16:41:09 +0100 (CET) Received: from fsr-ub1864-111.ea.freescale.net (fsr-ub1864-111.ea.freescale.net [10.171.82.141]) by inva024.eu-rdc02.nxp.com (Postfix) with ESMTP id 846DE205C2; Thu, 19 Mar 2020 16:41:09 +0100 (CET) From: Diana Craciun To: linux-kernel@vger.kernel.org, laurentiu.tudor@nxp.com, stuyoder@gmail.com, leoyang.li@nxp.com, linux-arm-kernel@lists.infradead.org, bharatb.yadav@gmail.com Cc: Diana Craciun Subject: [PATCH 02/10] bus/fsl-mc: Add a new parameter to dprc_scan_objects function Date: Thu, 19 Mar 2020 17:40:43 +0200 Message-Id: <20200319154051.30609-3-diana.craciun@oss.nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200319154051.30609-1-diana.craciun@oss.nxp.com> References: <20200319154051.30609-1-diana.craciun@oss.nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Prepare the dprc_scan_objects function to be used by the VFIO mc driver code. The function is used to scan the mc objects by the bus driver. The same functionality is needed by the VFIO mc driver, but in this case the interrupt configuration is delayed until the userspace configures the interrupts. In order to use the same function in both drivers add a new parameter. Signed-off-by: Diana Craciun --- drivers/bus/fsl-mc/dprc-driver.c | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/drivers/bus/fsl-mc/dprc-driver.c b/drivers/bus/fsl-mc/dprc-driver.c index 035b220779d0..d373b28abe2d 100644 --- a/drivers/bus/fsl-mc/dprc-driver.c +++ b/drivers/bus/fsl-mc/dprc-driver.c @@ -198,7 +198,9 @@ static void dprc_add_new_devices(struct fsl_mc_device *mc_bus_dev, * dprc_scan_objects - Discover objects in a DPRC * * @mc_bus_dev: pointer to the fsl-mc device that represents a DPRC object - * + * @alloc_interrupts: if true the function allocates the interrupt pool, + * otherwise the interrupt allocation is delayed + * Detects objects added and removed from a DPRC and synchronizes the * state of the Linux bus driver, MC by adding and removing * devices accordingly. @@ -211,7 +213,8 @@ static void dprc_add_new_devices(struct fsl_mc_device *mc_bus_dev, * populated before they can get allocation requests from probe callbacks * of the device drivers for the non-allocatable devices. */ -static int dprc_scan_objects(struct fsl_mc_device *mc_bus_dev) +static int dprc_scan_objects(struct fsl_mc_device *mc_bus_dev, + bool alloc_interrupts) { int num_child_objects; int dprc_get_obj_failures; @@ -299,7 +302,7 @@ static int dprc_scan_objects(struct fsl_mc_device *mc_bus_dev) irq_count, FSL_MC_IRQ_POOL_MAX_TOTAL_IRQS); } - if (!mc_bus->irq_resources) { + if (alloc_interrupts && !mc_bus->irq_resources) { error = fsl_mc_populate_irq_pool(mc_bus, FSL_MC_IRQ_POOL_MAX_TOTAL_IRQS); if (error < 0) @@ -339,7 +342,7 @@ static int dprc_scan_container(struct fsl_mc_device *mc_bus_dev) * Discover objects in the DPRC: */ mutex_lock(&mc_bus->scan_mutex); - error = dprc_scan_objects(mc_bus_dev); + error = dprc_scan_objects(mc_bus_dev, true); mutex_unlock(&mc_bus->scan_mutex); if (error < 0) { fsl_mc_cleanup_all_resource_pools(mc_bus_dev); @@ -409,7 +412,7 @@ static irqreturn_t dprc_irq0_handler_thread(int irq_num, void *arg) DPRC_IRQ_EVENT_OBJ_DESTROYED | DPRC_IRQ_EVENT_OBJ_CREATED)) { - error = dprc_scan_objects(mc_dev); + error = dprc_scan_objects(mc_dev, true); if (error < 0) { /* * If the error is -ENXIO, we ignore it, as it indicates -- 2.17.1