Received: by 2002:a25:6193:0:0:0:0:0 with SMTP id v141csp3681999ybb; Mon, 23 Mar 2020 05:50:41 -0700 (PDT) X-Google-Smtp-Source: ADFU+vvxllrWhRQCvCbtbirFvmS5iXdB2QhwBfvnWhkxl8Y3VEVyRpToyltkAff+vYhrlawSLhKD X-Received: by 2002:a4a:8962:: with SMTP id g31mr305392ooi.97.1584967841150; Mon, 23 Mar 2020 05:50:41 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1584967841; cv=pass; d=google.com; s=arc-20160816; b=EMvytL2htf5iDFyfE2ahP7RWjvKRTxEJ3tT4FNcXzZiElnEsaRs0rmD2CHbavYdKtt DsvNHee7pPiSRZH8Ct5fx2Q0Z3iZG108VFdqflfU2iVq/bZakPkXxdP1vJ+DouVnqaPc QlfZu9ILSvBENfZQ1aF4+H4j/IL1pFAJv3x+zeHH2Qm8UODoUb2z1JWNp3HZYdjalZRz euM29qdXOPYvE6zVq0b8g63myJ3Z3PtWrrOhGk372QXxqoJP6LUDPbX2WwAp2N0eN46t 9K2c6slnw25/7m+0gD/nYPWM0Dr2XvCHROhqCmRBNnPzps81Uq7sYwUcFm+enM++J35L zo1Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :content-language:in-reply-to:user-agent:date:message-id:from :references:to:subject:dkim-signature; bh=8ESEo1P6mOjsUssu8jocwbgmI5YrdBNL9pw5mjUayc8=; b=X+p2E/LDWK8+SYmjUr0uM7Dv1BDuWZJhAB2QCn9hkcu3A1OFTYLp2VhOG7/NzhiJiJ 88T6r1+yCNh0kMZBlRqAVy2eEuOLy/hYQWBnV5PYtGU53si/ksbFGxznmw8EDeKzR1Du tS7+MX7zFyLn6+Z6wFtwmS+NbwU2x+vjiXn6SiV99bTo4wpQasEAdDYS5hMvuMlzuWQB 10CHbWBGW8zRoDHsWnST8DF7rm2oMUfged5E02ExroZCABRX1bLtZSWImBAhgtFrSkCY d9IGfkLNskl7BJvKjHR10OTdpPkMbiD3V5a4DhGzIzW1ZRZ51mau8zIiGdMshS1roj68 0SRA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=R0YZHztp; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.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=pass (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 w13si7527284otm.111.2020.03.23.05.50.28; Mon, 23 Mar 2020 05:50:41 -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; dkim=pass header.i=@nxp.com header.s=selector2 header.b=R0YZHztp; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.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=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728353AbgCWMsu (ORCPT + 99 others); Mon, 23 Mar 2020 08:48:50 -0400 Received: from mail-am6eur05on2050.outbound.protection.outlook.com ([40.107.22.50]:6117 "EHLO EUR05-AM6-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1728265AbgCWMst (ORCPT ); Mon, 23 Mar 2020 08:48:49 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=C4oeyhSlV0B/z+xBLaQ8/PurlTywRGR4ijM4oaPm8iruuFQlXNo1ojkgxPWC3IUAJodxEubClLG74jZ5p9IkThf4rxsUxhkM4fERqOHwjgQNSIoJNEB4WMOuR9r8380V5YYA3oWgCrrC0QwWQOBYJzh+H/VQ3U926X2OYaQ0ZLnAllJoBa685GCJcLzG7vd0AvsPqcVWGT0WMnDqTMC2r2mn00ez8c/IyZFR0CDUnpDfCAfEiF67kHNHZg6PxM2iKcyJPjz/9w4jZLt84GufTZgMhxEFIvN8LwWWhD6SjRjl/WPIa9K1dzaHgy+93vx+5wBOyd4qo54guRX6bS7kgw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=8ESEo1P6mOjsUssu8jocwbgmI5YrdBNL9pw5mjUayc8=; b=oIoYpHfeZAFsTrXupDKzjePEt57QUlX6QYaHdHKn3nUGK8e3pV3nwJD/qgPj0d9kYQvIPFPiJSrxLvObBnzEHHXZ/EoRB/EQJSSLYy8gJrOLToIgqL1JZMhhoQgAx5ICNg+0oIlOMVjS6/iV8Xy9+0bQO4pKhke2qm6cgbb+olM7NqQ2cCX8XDYV6RYSqFc8Mu/HcOwpJb/bDrE57vbrxLDX68JBLjhe2WzeRt27JSo2m9jyue0h30MWMNjY1yrICAobgEfC5FHr2e+wwIx9FJ57E0vLS3Ma26eYg8BTQb5KD0eZi8uTUoLzwQwKErkKlztVSYmfixEBnHu5rhJjOQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=8ESEo1P6mOjsUssu8jocwbgmI5YrdBNL9pw5mjUayc8=; b=R0YZHztpexKowEDmCF6xv0JHogFTlacYj6YQ1k+q2LgPgO07rdDvHrXxZRNch2TYvJuJ8OyowyQ6kHIXZrewEazAqi3Js5QBu3QKREqwk/iMXkuL0u4XPK3WqUJoDzjencAY0Ex5SqLQ/93rV0oP5SA/p0LiIqvUyFyllilhMD8= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=laurentiu.tudor@nxp.com; Received: from AM6PR04MB5925.eurprd04.prod.outlook.com (20.179.2.147) by AM6PR04MB6536.eurprd04.prod.outlook.com (20.179.246.222) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2835.22; Mon, 23 Mar 2020 12:48:46 +0000 Received: from AM6PR04MB5925.eurprd04.prod.outlook.com ([fe80::dd71:5f33:1b21:cd9e]) by AM6PR04MB5925.eurprd04.prod.outlook.com ([fe80::dd71:5f33:1b21:cd9e%5]) with mapi id 15.20.2835.021; Mon, 23 Mar 2020 12:48:46 +0000 Subject: Re: [PATCH 07/10] bus/fsl-mc: Export a dprc scan function to be used by multiple entities To: Diana Craciun , linux-kernel@vger.kernel.org, stuyoder@gmail.com, leoyang.li@nxp.com, linux-arm-kernel@lists.infradead.org, bharatb.yadav@gmail.com References: <20200319154051.30609-1-diana.craciun@oss.nxp.com> <20200319154051.30609-8-diana.craciun@oss.nxp.com> From: Laurentiu Tudor Message-ID: <493be973-9b6b-2c24-ca38-00c17721ebb8@nxp.com> Date: Mon, 23 Mar 2020 14:48:36 +0200 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.6.0 In-Reply-To: <20200319154051.30609-8-diana.craciun@oss.nxp.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-GB Content-Transfer-Encoding: 7bit X-ClientProxiedBy: BYAPR07CA0024.namprd07.prod.outlook.com (2603:10b6:a02:bc::37) To AM6PR04MB5925.eurprd04.prod.outlook.com (2603:10a6:20b:ab::19) MIME-Version: 1.0 X-MS-Exchange-MessageSentRepresentingType: 1 Received: from [10.213.175.155] (192.88.158.246) by BYAPR07CA0024.namprd07.prod.outlook.com (2603:10b6:a02:bc::37) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.2835.19 via Frontend Transport; Mon, 23 Mar 2020 12:48:43 +0000 X-Originating-IP: [192.88.158.246] X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-MS-Office365-Filtering-Correlation-Id: 5c946201-ecf4-4a8b-b151-08d7cf2886c6 X-MS-TrafficTypeDiagnostic: AM6PR04MB6536:|AM6PR04MB6536: X-MS-Exchange-Transport-Forked: True X-Microsoft-Antispam-PRVS: X-MS-Oob-TLC-OOBClassifiers: OLM:1824; X-Forefront-PRVS: 0351D213B3 X-Forefront-Antispam-Report: SFV:NSPM;SFS:(10009020)(4636009)(39860400002)(396003)(346002)(376002)(136003)(366004)(199004)(86362001)(31696002)(26005)(186003)(478600001)(53546011)(52116002)(31686004)(6486002)(36756003)(16526019)(8936002)(8676002)(81156014)(81166006)(66476007)(44832011)(2906002)(316002)(66556008)(16576012)(6666004)(2616005)(956004)(5660300002)(66946007);DIR:OUT;SFP:1101;SCL:1;SRVR:AM6PR04MB6536;H:AM6PR04MB5925.eurprd04.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;A:1; Received-SPF: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) X-MS-Exchange-SenderADCheck: 1 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: NYw3+nAPDCKkQg+79yWVMoPjVYNpolT1SikT2LKDcXK5O9EpL3DW35CfLxBSXl1xku+V4LXmkckzNu49rdTUhRs60+SE9DWbUDReRTOrgVS/s41UJMxhfAQZaNbdw7QTxG4v9ce1MIg0Txnxos5UacqbHC8Tqs/XkhjIdZRtOSSsgr0Lm1HSupd87/TzM8dw9Y4qcojvhKgvne5sl9V+6fJLmWmTdVBL5kViNlAap5B0rBnZCrEOFIfEUTQviXq3e7JyBZQT8klD9t9PJhclyP1TTln/gx87RsNU8bQMBTHqQcCF9Tg1pfLNf3TAb4IaXA2R6dl76lfkwZUzfxq/kTKGy1c5FHHwXlAX/fGpziu4C+iJTjJ5YWTCTZY9lltj3Uy6lo7DLSfkayaIvVcUb+s4ztt9wwVcFT8E5PwoqizLi2wQpuVP+oenz+0uD1wk X-MS-Exchange-AntiSpam-MessageData: G+micOx25ElV0VxHdytwEzxBJARrAY0zUejN+JEqw2o3l5GhRkx7WC4Gyz6sWm8NlgAqBX2O1gCB6QFaSTJ4RBzAjgmjd6sAbfSlFhVGSIm1iJQ/OfEGQ/TiPHEjbbREKnDO/tTL8SQayBr3jZghZg== X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 5c946201-ecf4-4a8b-b151-08d7cf2886c6 X-MS-Exchange-CrossTenant-OriginalArrivalTime: 23 Mar 2020 12:48:46.4503 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: NGqRo3ITyI1Q0i9yv63ag2JFy4MfSPtJqw1ZdFd2o/7MPEUKC5XUtlfeIkx20oS2b44bnbInt8EliICm22LCXg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM6PR04MB6536 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 3/19/2020 5:40 PM, Diana Craciun wrote: > Currently the DPRC scan function is used only by the bus driver. > But the same functionality will be needed by the VFIO driver. > To support this, the dprc scan function was exported and a little > bit adjusted to fit both scenarios. > > Signed-off-by: Diana Craciun > --- > drivers/bus/fsl-mc/dprc-driver.c | 15 ++++++--------- > drivers/bus/fsl-mc/fsl-mc-bus.c | 2 ++ > include/linux/fsl/mc.h | 4 ++++ > 3 files changed, 12 insertions(+), 9 deletions(-) > > diff --git a/drivers/bus/fsl-mc/dprc-driver.c b/drivers/bus/fsl-mc/dprc-driver.c > index 7eaf78900dfc..789220f0372a 100644 > --- a/drivers/bus/fsl-mc/dprc-driver.c > +++ b/drivers/bus/fsl-mc/dprc-driver.c > @@ -335,7 +335,9 @@ static int dprc_scan_objects(struct fsl_mc_device *mc_bus_dev, > * bus driver with the actual state of the MC by adding and removing > * devices as appropriate. > */ > -static int dprc_scan_container(struct fsl_mc_device *mc_bus_dev) > +int dprc_scan_container(struct fsl_mc_device *mc_bus_dev, > + const char *driver_override, > + bool alloc_interrupts) > { > int error; > struct fsl_mc_bus *mc_bus = to_fsl_mc_bus(mc_bus_dev); > @@ -346,15 +348,12 @@ 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, NULL, true); > + error = dprc_scan_objects(mc_bus_dev, driver_override, alloc_interrupts); > mutex_unlock(&mc_bus->scan_mutex); > - if (error < 0) { > - fsl_mc_cleanup_all_resource_pools(mc_bus_dev); > - return error; > - } > > return 0; > } > +EXPORT_SYMBOL_GPL(dprc_scan_container); > > /** > * dprc_irq0_handler - Regular ISR for DPRC interrupt 0 > @@ -679,12 +678,10 @@ static int dprc_probe(struct fsl_mc_device *mc_dev) > goto error_cleanup_open; > } > > - mutex_init(&mc_bus->scan_mutex); > - It's not obvious that this is related, maybe it should be mentioned in the commit message. > /* > * Discover MC objects in DPRC object: > */ > - error = dprc_scan_container(mc_dev); > + error = dprc_scan_container(mc_dev, NULL, true); > if (error < 0) > goto error_cleanup_open; > > diff --git a/drivers/bus/fsl-mc/fsl-mc-bus.c b/drivers/bus/fsl-mc/fsl-mc-bus.c > index a99a0edef252..1865221bb12d 100644 > --- a/drivers/bus/fsl-mc/fsl-mc-bus.c > +++ b/drivers/bus/fsl-mc/fsl-mc-bus.c > @@ -635,7 +635,9 @@ int fsl_mc_device_add(struct fsl_mc_obj_desc *obj_desc, > if (!mc_bus) > return -ENOMEM; > > + mutex_init(&mc_bus->scan_mutex); > mc_dev = &mc_bus->mc_dev; > + nit: extra white space. --- Best Regards, Laurentiu > } else { > /* > * Allocate a regular fsl_mc_device object: > diff --git a/include/linux/fsl/mc.h b/include/linux/fsl/mc.h > index b9d5e5955adb..2bdd96a482fb 100644 > --- a/include/linux/fsl/mc.h > +++ b/include/linux/fsl/mc.h > @@ -476,6 +476,10 @@ int dprc_reset_container(struct fsl_mc_io *mc_io, > u16 token, > int child_container_id); > > +int dprc_scan_container(struct fsl_mc_device *mc_bus_dev, > + const char *driver_override, > + bool alloc_interrupts); > + > /* > * Data Path Buffer Pool (DPBP) API > * Contains initialization APIs and runtime control APIs for DPBP >