Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp128630ybt; Mon, 6 Jul 2020 05:47:38 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwRDAbnLdqJiIJU0EbX5f7uK5Ky+erBKtsgEQohE1Yo9wKc7DuOSX8ik08xAP70+oC5WF4X X-Received: by 2002:a17:906:2b9b:: with SMTP id m27mr31991755ejg.19.1594039658191; Mon, 06 Jul 2020 05:47:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594039658; cv=none; d=google.com; s=arc-20160816; b=USwEw9R56GLnwcdsYbAa97mX8RowhVsogbHe9bTMj/NkD+QBh2r2UxjoQw9DzVqvJ1 1ISm2eBa7CoVvyU34QVm/XAYamD09QhOkQz+L4eJNlR5OfSxT5VRvu5FF0P2JbqSC27t ZdcmdHHy7AMz10cFii/uRYnqPTB2kHcqANCpu5UhijceeQUO7s8mKiDCfrDwDmPjUZwL iwRAzCJYDoPVNcK07dbeWJlG6mjoMYxL/Iip8LdtJKk43AITyvQBJD8Vx3YHQzh+QXub 2v3IDii0t8mazMZBpEKP8m0PeJHsGWGpReqKTiyF42c7yKG1RVtl7sQsCSvCsRyRHgin i1cg== 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=nEmYBw/cMcPOE3WLYTgsKnlHvMj368IKPV/i8LEExk4=; b=EcRP6mQ/4v9jEYmzAPSVAO6H8Q7WDvDkNOCyon2X/iyuKP0KRtM2phbC/iEO4TvISl +7O4CMr305ahxi7wAQ7RF50pwwiUXPECgLkBrkxEt3Nme0+lbYqBTOmOlAPzLNcdWLjD qCRM+JW8iyUY7BJW+DNGNtsZOej/V+Tj/PPFScFP/+jg0Ityg/SF0YZU8w4tKNy4qcRY G5XQ5fyvk5x/4oMu512NLdD5WaxpmjDUqBMO6RiKdWQ1TpqXM/kq4KPFjzLHVB9HSlKl VNNW6Rjv+nmXnPcxQ93phSGXSU2ut45FRyPiMGELYXzJ2+uiR7nS63TAS4mIiHo8Lkc1 bgng== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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. [23.128.96.18]) by mx.google.com with ESMTP id k7si13881077edq.567.2020.07.06.05.47.15; Mon, 06 Jul 2020 05:47:38 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 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 S1729276AbgGFMn4 (ORCPT + 99 others); Mon, 6 Jul 2020 08:43:56 -0400 Received: from inva021.nxp.com ([92.121.34.21]:37938 "EHLO inva021.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729005AbgGFMnH (ORCPT ); Mon, 6 Jul 2020 08:43:07 -0400 Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id AB36C2004AF; Mon, 6 Jul 2020 14:43:05 +0200 (CEST) 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 9EBE82004AA; Mon, 6 Jul 2020 14:43:05 +0200 (CEST) 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 48C8F203C3; Mon, 6 Jul 2020 14:43:05 +0200 (CEST) From: Diana Craciun To: linux-kernel@vger.kernel.org, laurentiu.tudor@nxp.com, gregkh@linuxfoundation.org Cc: stuyoder@gmail.com, leoyang.li@nxp.com, linux-arm-kernel@lists.infradead.org, bharatb.linux@gmail.com, Diana Craciun Subject: [PATCH v3 02/13] bus/fsl-mc: Add a new parameter to dprc_scan_objects function Date: Mon, 6 Jul 2020 15:42:32 +0300 Message-Id: <20200706124243.10697-3-diana.craciun@nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200706124243.10697-1-diana.craciun@nxp.com> References: <20200706124243.10697-1-diana.craciun@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 From: Diana Craciun 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 | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/bus/fsl-mc/dprc-driver.c b/drivers/bus/fsl-mc/dprc-driver.c index 035b220779d0..7a8061224df8 100644 --- a/drivers/bus/fsl-mc/dprc-driver.c +++ b/drivers/bus/fsl-mc/dprc-driver.c @@ -198,6 +198,8 @@ 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 @@ -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