Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp3630373pxk; Tue, 29 Sep 2020 01:56:32 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwvtMDWkLqTYqTAs3f09H0qpXHj/YPr9z5AzZQAPtbEENukLKR621BufoORQZdPS9FTymPR X-Received: by 2002:a17:906:7e42:: with SMTP id z2mr2823098ejr.206.1601369792384; Tue, 29 Sep 2020 01:56:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601369792; cv=none; d=google.com; s=arc-20160816; b=tIfvHPhs7a1dU+E6QklOqXWWBES0fJYW9QafUP+UFeehIdZZzfDa+7hDbf68/2UHRi nyLJTT8tCHDIaDVvbXNK7E9tX5C8EF8XW4fwPn1euXKM4ElvVCkXX/ZeGurMrYNZpBlj o92OY7S5mZtX3VDW2t7vieYueImrOlwLibxcRCFHI15E3QgQzMmlktBqLIjSqGgFLZRp ScHvjPOM5+aou1fvt8xwsKdQdu8047FIkqx3LCIAIImIUYznDtZJ9dKykbRLwSdwEqGd ecF+k0++xxGKitFkBEF30MSOL+5uz51m2uukPAApTHm8ne5dhmsvoLjKhaDWwOi+TemZ 2xrw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:references:in-reply-to:message-id:date:subject :cc:to:from; bh=wl5JwRHomGzlMnGC9i1JE7qJBtrhRrkgVFk/Ag+mvnE=; b=en9zXQJQZGCARyXfp82RVEftZ51imoIPE9gyuVP4fO+gMpaQYsuUcYTcT8hiK+t55W 8UwnsT1Bleq3I58tf6S7VXVGbbhrCI6zSZJdyZo36nmmAr1o6tj6lyJLm69pOh1Nbv1c iNVqw1k8lalA85M9ZOZsWlefc7lHF7NorPR0Rp4slVZ4+e/FubnRC4v2P9tKIfGAtWlY o4REnL41c9C9m7Znh8jaCpe9gz4U6mWC/JxEIXEEaxVeBWEvif4opCjRacUF8yvywzme zbLaK2h6Z5FfujH+oZLKlwluI7KBfJ5gst22rqun+CMw3ficmFI6Sqvo4UGolFdsPz8l TMVA== 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 os2si2298019ejb.112.2020.09.29.01.56.09; Tue, 29 Sep 2020 01:56:32 -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 S1727850AbgI2IzJ (ORCPT + 99 others); Tue, 29 Sep 2020 04:55:09 -0400 Received: from inva021.nxp.com ([92.121.34.21]:53774 "EHLO inva021.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727650AbgI2IzH (ORCPT ); Tue, 29 Sep 2020 04:55:07 -0400 Received: from inva021.nxp.com (localhost [127.0.0.1]) by inva021.eu-rdc02.nxp.com (Postfix) with ESMTP id 91A4620106C; Tue, 29 Sep 2020 10:55: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 84CD72000AA; Tue, 29 Sep 2020 10:55: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 2F5BD2037B; Tue, 29 Sep 2020 10:55:05 +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, Diana Craciun Subject: [PATCH v5 02/13] bus/fsl-mc: Add a new parameter to dprc_scan_objects function Date: Tue, 29 Sep 2020 11:54:30 +0300 Message-Id: <20200929085441.17448-3-diana.craciun@oss.nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200929085441.17448-1-diana.craciun@oss.nxp.com> References: <20200929085441.17448-1-diana.craciun@oss.nxp.com> X-Virus-Scanned: ClamAV using ClamSMTP 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