Received: by 2002:a05:6a10:a0d1:0:0:0:0 with SMTP id j17csp3515376pxa; Wed, 26 Aug 2020 02:28:39 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzSI9gBjZccFiDKN3EuhSrkqG9Cm8u+7STHRirjMkIAGhGcE3RmpGekjeiyGUHwYCd1c0Ex X-Received: by 2002:a17:906:1756:: with SMTP id d22mr14594937eje.29.1598434118853; Wed, 26 Aug 2020 02:28:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1598434118; cv=none; d=google.com; s=arc-20160816; b=HOtsUb074Y6xlQSpf5to8m60E7jeP3HFtv41fUhjRRpYWMW0lI+UHCL6TooB8/qU52 0ckh4Ueg/xBF1XdozAcHAJIdUDZBhpE+/IujIgy1HT/EENbfK1rjOn8OMx+v+4ergrQw ZN4QiAhk/PZZjaKPDTZa4oMLPTgn0IGMwGOLBfGg8uvBzU9MvW04rwFRZKuKchtPQlnr 7ffGW7USqre//rSQbF4KqBWA7fW/6MuxTTi9EHfUvKBOGbmFYOjK/yOnFWITLWUO792m GybXSdudmjwIFgwd0GtWKEEE8142MGrkCtB8EDLShn5sCBxBV8Kb8mxMfsQpQKdk6UGB UDCQ== 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=wl5JwRHomGzlMnGC9i1JE7qJBtrhRrkgVFk/Ag+mvnE=; b=V1aEj8vH84pTUmf+Qgogh0aeJWJU97a6Yp0IrGiNT6NokGtYEpgIMQdVKId6zzo511 JvQqqOddv7eOzkNJ/T0HdzRD+niRzWZa/EshHKp8G8IXiEPEfGDt3MpCB3NotETUzUuH skaaYdj4TAEDCacVdgMvrMRL22cVWiU0lgdKFGAMZUnzvBM6kV/2hCtdC9Hswdx9HmYT TnLPjt+7kXJh6GoRGmSkSANKCwFK1PzLIxUWIEacUK6+kcP3twGg4MahhFhRiKG0+/SC 1LdYUj4Kr0byeruxmkWo9o0aGGUIsOvqHDTkPZz/JpGo+a5+nkW+q4FfBX95RUp82s5j iGiA== 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 k10si1189018ejr.684.2020.08.26.02.28.16; Wed, 26 Aug 2020 02:28: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 S1728037AbgHZJ0K (ORCPT + 99 others); Wed, 26 Aug 2020 05:26:10 -0400 Received: from inva021.nxp.com ([92.121.34.21]:43262 "EHLO inva021.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727982AbgHZJ0F (ORCPT ); Wed, 26 Aug 2020 05:26:05 -0400 Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 0AAF02007BC; Wed, 26 Aug 2020 11:26:03 +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 F27292007B4; Wed, 26 Aug 2020 11:26:02 +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 9CEC4202CA; Wed, 26 Aug 2020 11:26:02 +0200 (CEST) From: Diana Craciun To: linux-kernel@vger.kernel.org, laurentiu.tudor@nxp.com Cc: stuyoder@gmail.com, leoyang.li@nxp.com, gregkh@linuxfoundation.org, linux-arm-kernel@lists.infradead.org, bharatb.linux@gmail.com, Diana Craciun Subject: [PATCH v4 02/13] bus/fsl-mc: Add a new parameter to dprc_scan_objects function Date: Wed, 26 Aug 2020 12:25:16 +0300 Message-Id: <20200826092527.4992-3-diana.craciun@oss.nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200826092527.4992-1-diana.craciun@oss.nxp.com> References: <20200826092527.4992-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 | 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 54c576d68122..3d850515e3e5 100644 --- a/drivers/bus/fsl-mc/dprc-driver.c +++ b/drivers/bus/fsl-mc/dprc-driver.c @@ -221,6 +221,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 @@ -234,7 +236,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; @@ -322,7 +325,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) @@ -362,7 +365,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); @@ -432,7 +435,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