Received: by 2002:a25:23cc:0:0:0:0:0 with SMTP id j195csp505819ybj; Thu, 7 May 2020 00:40:28 -0700 (PDT) X-Google-Smtp-Source: APiQypKoYKUtcF9FO27F+JZpYqjK4HBEd9uxpXF81/8tcZM6WE5WUeuTvODcdRqbnO9k/cT91gHa X-Received: by 2002:a17:906:2ad4:: with SMTP id m20mr11142964eje.324.1588837228512; Thu, 07 May 2020 00:40:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1588837228; cv=none; d=google.com; s=arc-20160816; b=kTxTLPg+7soBp7QILJAbk4/mfp8k64POsr3iHymfCzJ8gQHtaPNDqKjcQgE2Gfj0mR b7hYVoErWbEJBxhn5AL5UqBosl0Ei6ucKiNhvV4Pg+lDAF+XguUYz33mWsnBq31tZcz/ rt7B5t/OzjdiMP+hKHHXhTVGcYJakBiks/DXpH0gb3rYSEhNLhmcB6cx6oMYB7bpwPJC ZrefyryflOa7tlEazRABJwsTJHyKVx3PrTsGh9wHZCPojmuy53r7GbrwzQ3xhHZRc7tx bn9WwfYdatUIc1B7O6nK5kaursP1MLItHIWAH/rdTYVGVY7iO8YGYxYaHOhpN/0A6AzZ iDQg== 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=YU5i+Pk0psRcd9f1wy6RsKZfyAAEWgNSUrASmTDGmxc=; b=GctCesrd1MEN/7rq82nYHkf5mRjKWxmd6NqSaQfiV085F9t2EkODo/WeCpDqenI3u5 gSwBbUp3D80BcXNTfNeeD+i+6AVsLhvZGf0conHJzBARoHzTTu002dfIlFYbv2J9PLgz rleyFGOj7OV8U8ZCEi4XdM1aVgbtmTVZQXTQuIZ/OuWQqKbNqh3KnNu5Kyk/k6Ky6psn yJKcIE4Tako1yTG+pIdlBZ7suOiS01NDgdOTo/RDpA1IZIjXnagYtTU3Z971cW8Uh7M8 xScMQARP8b2K9BQ+QNvZMGoo1Ppb0PS+c8e6J96nfqdi9JMcT+erK2R2+CSU+XzQtHAJ J1Rg== 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 i18si2347394edr.464.2020.05.07.00.40.05; Thu, 07 May 2020 00:40:28 -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 S1726218AbgEGHfq (ORCPT + 99 others); Thu, 7 May 2020 03:35:46 -0400 Received: from inva020.nxp.com ([92.121.34.13]:40388 "EHLO inva020.nxp.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725910AbgEGHfq (ORCPT ); Thu, 7 May 2020 03:35:46 -0400 Received: from inva020.nxp.com (localhost [127.0.0.1]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 272A41A0FBF; Thu, 7 May 2020 09:35:44 +0200 (CEST) Received: from inva024.eu-rdc02.nxp.com (inva024.eu-rdc02.nxp.com [134.27.226.22]) by inva020.eu-rdc02.nxp.com (Postfix) with ESMTP id 142211A0FB0; Thu, 7 May 2020 09:35:44 +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 B93D3203C5; Thu, 7 May 2020 09:35:43 +0200 (CEST) From: Diana Craciun To: linux-kernel@vger.kernel.org Cc: laurentiu.tudor@nxp.com, stuyoder@gmail.com, leoyang.li@nxp.com, linux-arm-kernel@lists.infradead.org, gregkh@linuxfoundation.org, Diana Craciun Subject: [PATCH v2 02/12] bus/fsl-mc: Add a new parameter to dprc_scan_objects function Date: Thu, 7 May 2020 10:34:21 +0300 Message-Id: <20200507073431.2710-3-diana.craciun@oss.nxp.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20200507073431.2710-1-diana.craciun@oss.nxp.com> References: <20200507073431.2710-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 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