From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.1 required=3.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH,MAILING_LIST_MULTI, SIGNED_OFF_BY,SPF_PASS,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id D4540C28CF8 for ; Tue, 20 Nov 2018 15:39:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 957F520851 for ; Tue, 20 Nov 2018 15:39:56 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=nxp.com header.i=@nxp.com header.b="niVcINd7" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 957F520851 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=nxp.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727807AbeKUCJj (ORCPT ); Tue, 20 Nov 2018 21:09:39 -0500 Received: from mail-eopbgr20052.outbound.protection.outlook.com ([40.107.2.52]:58502 "EHLO EUR02-VE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1725911AbeKUCJi (ORCPT ); Tue, 20 Nov 2018 21:09:38 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Khq1ZN21rin+/bGZw9fdwCPRSfEiiGh2PBvD7Co0Y4I=; b=niVcINd7duAbhEzgVB91oWQTyOLcYPIyowohJmaTVWUUgUDcGK4DGsbFay8lsN/M6/BCYSdiDbUXxjkDmJk8WzlHYmMZYBSc9JMjm6vVBL5tXJ+a5PeemR7vJ40CZr06l8siYModf6OfzXk//xJAEQi8n3JPzPR1xRiM3xt8OsE= Received: from VI1PR0402MB2800.eurprd04.prod.outlook.com (10.172.255.18) by VI1PR0402MB3501.eurprd04.prod.outlook.com (52.134.4.18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.1361.14; Tue, 20 Nov 2018 15:39:46 +0000 Received: from VI1PR0402MB2800.eurprd04.prod.outlook.com ([fe80::78a4:e54f:f26:36d9]) by VI1PR0402MB2800.eurprd04.prod.outlook.com ([fe80::78a4:e54f:f26:36d9%7]) with mapi id 15.20.1294.045; Tue, 20 Nov 2018 15:39:46 +0000 From: Ioana Ciornei To: "gregkh@linuxfoundation.org" , Laurentiu Tudor CC: "linux-kernel@vger.kernel.org" , "netdev-owner@vger.kernel.org" , Ioana Ciocoi Radulescu , Horia Geanta , Leo Li , Ioana Ciornei Subject: [PATCH v3 3/4] bus: fsl-mc: add root dprc rescan attribute Thread-Topic: [PATCH v3 3/4] bus: fsl-mc: add root dprc rescan attribute Thread-Index: AQHUgOdDUkff/NjhQU6BTxReijq/+g== Date: Tue, 20 Nov 2018 15:39:45 +0000 Message-ID: <1542728371-6972-4-git-send-email-ioana.ciornei@nxp.com> References: <1542728371-6972-1-git-send-email-ioana.ciornei@nxp.com> In-Reply-To: <1542728371-6972-1-git-send-email-ioana.ciornei@nxp.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-clientproxiedby: VI1PR0701CA0037.eurprd07.prod.outlook.com (2603:10a6:800:90::23) To VI1PR0402MB2800.eurprd04.prod.outlook.com (2603:10a6:800:ad::18) authentication-results: spf=none (sender IP is ) smtp.mailfrom=ioana.ciornei@nxp.com; x-ms-exchange-messagesentrepresentingtype: 1 x-originating-ip: [86.34.165.90] x-ms-publictraffictype: Email x-microsoft-exchange-diagnostics: 1;VI1PR0402MB3501;6:efB2GC/gYroDKFxsEy9Ho34Wg9lyUrPrUK3BJQGVs3WS634wm3pgwjVpu6v3g+SShQn2rNdMi3ntZhiKl+aNSEfUnq12P4YI2wEwJMp2Q8AyVWOkzy7uIcu5y4kX6xKB8sRKb51HKnbT0DPHJgevZx8f5q0+/Buk4XSWPrUDCQFgG0s6Lg9X3HhNobFlY2X/KRezHDNw18yEs7DQR9RjHbjzkDOn9AG+vzBzK92oyaDm07g06sbT7GDT3mHmpWeVHqFwE1qc1V1JHSpAqcx8VLTa0w8wxOTzmZdcx3paXmQXAtrS5cmb8aQ56oF9Omlcp0AXbJnMJUvgPWWvBGbnl2KzOHdv3j8eiuY1s5G+lWxNq+I+wTfOd4C5etH80AihFeY/HlHoG/HPNzwlJCDPd4NA49HWFyrESGlbRTvWIT6MtdHOTHVEO+OsHFwMuHSM1b2lc6PdJ9rPyXcKddL+lA==;5:Bxzo7SGVLu30oF1ZI2W5T0lcQJ0wn0SSsCR3Jts6Uo4OgF8Vosa2gCP6qRd1JGe2SJL15V32hR/GTLZfGqzoxozRh5DzJ4YGEAjsUQAdi8Z9Dmywx4Z2Trfuts8r/m6UNS6WOKtpJDfygyzfBMOh+wWCAeKTYQHP0L4A9JIVOkw=;7:Tuf3fZdLnbvKxUhF8X0DzSvpfdspwC0jArB+eKMyf+t0G6eqIyQ5uxxwL0hhAAOrqNi9kBvulHfzrP0al2NA66TPmddwOp1nbuUGIi3X9B/VSuGj7OY1pkqKIkbhzKGe4NfXWGPrHnero+m9zSdK+g== x-ms-office365-filtering-correlation-id: 9dad77b1-9fb5-4c62-52cd-08d64efe65a4 x-ms-office365-filtering-ht: Tenant x-microsoft-antispam: BCL:0;PCL:0;RULEID:(2390098)(7020095)(4652040)(8989299)(5600074)(711020)(4618075)(4534185)(4627221)(201703031133081)(201702281549075)(8990200)(2017052603328)(7153060)(7193020);SRVR:VI1PR0402MB3501; x-ms-traffictypediagnostic: VI1PR0402MB3501: x-microsoft-antispam-prvs: x-ms-exchange-senderadcheck: 1 x-exchange-antispam-report-cfa-test: BCL:0;PCL:0;RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(93006095)(93001095)(3231442)(944501410)(52105112)(3002001)(10201501046)(6055026)(148016)(149066)(150057)(6041310)(20161123558120)(20161123564045)(20161123560045)(20161123562045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(201708071742011)(7699051)(76991095);SRVR:VI1PR0402MB3501;BCL:0;PCL:0;RULEID:;SRVR:VI1PR0402MB3501; x-forefront-prvs: 08626BE3A5 x-forefront-antispam-report: SFV:NSPM;SFS:(10009020)(136003)(376002)(396003)(39860400002)(346002)(366004)(189003)(199004)(50944005)(2906002)(97736004)(256004)(102836004)(14444005)(2900100001)(71190400001)(2616005)(11346002)(71200400001)(52116002)(44832011)(6436002)(478600001)(186003)(26005)(68736007)(76176011)(4326008)(99286004)(486006)(2501003)(6636002)(6512007)(316002)(6116002)(7736002)(3846002)(6506007)(54906003)(110136005)(8936002)(476003)(5660300001)(86362001)(575784001)(6486002)(305945005)(66066001)(53936002)(36756003)(14454004)(446003)(81166006)(8676002)(81156014)(386003)(106356001)(105586002)(25786009);DIR:OUT;SFP:1101;SCL:1;SRVR:VI1PR0402MB3501;H:VI1PR0402MB2800.eurprd04.prod.outlook.com;FPR:;SPF:None;LANG:en;PTR:InfoNoRecords;MX:1;A:1; received-spf: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) x-microsoft-antispam-message-info: /IWrMQcZnv3S/RBrru2bDQ80j5DRfbWDIRCkwL+fgi+FYN4OoBvAGPYw1s5aH+XIBMGCZ3t6GREeOiMc8i8ASmZiSv/nTelFlsxauRsvqxqrR/sA/2q/+YXLMATH2rDBRA4/U5Ocw25LZO5QdfAp0uv5ny2VeJRYi8bwgPzi5YEN05Zx3i5V3o3HBT6FM4YU+nC7q+DXfCXke82GVsiPHmnUW4BwUl0lSglRLDiA11wkCFizb8RoV9oU3fS31VPAj+t18nuJqHihIm+GA+kqWHMY0Gv2+k1U7xqwoAPmtZP6YkWITo+8+1XRLQaP+OQNYdYGE8GgQ+YRaCsa1h1+pF9vD2DNqln2NV0u+5hGncA= spamdiagnosticoutput: 1:99 spamdiagnosticmetadata: NSPM Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 9dad77b1-9fb5-4c62-52cd-08d64efe65a4 X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Nov 2018 15:39:45.7044 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0402MB3501 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Introduce the rescan attribute as a device attribute to synchronize the fsl-mc bus objects and the MC firmware. To rescan the root dprc only, e.g. echo 1 > /sys/bus/fsl-mc/devices/dprc.1/rescan Signed-off-by: Ioana Ciornei --- Changes in v2: - remove the rescan dev_attr on the remove path Changes in v3: - none Documentation/ABI/stable/sysfs-bus-fsl-mc | 9 ++++++++ MAINTAINERS | 1 + drivers/bus/fsl-mc/dprc-driver.c | 36 +++++++++++++++++++++++++++= ++++ 3 files changed, 46 insertions(+) create mode 100644 Documentation/ABI/stable/sysfs-bus-fsl-mc diff --git a/Documentation/ABI/stable/sysfs-bus-fsl-mc b/Documentation/ABI/= stable/sysfs-bus-fsl-mc new file mode 100644 index 0000000..9f3a95e --- /dev/null +++ b/Documentation/ABI/stable/sysfs-bus-fsl-mc @@ -0,0 +1,9 @@ +What: /sys/bus/fsl-mc/devices/dprc.*/rescan +Date: November 2018 +KernelVersion: 5.0 +Contact: Ioana Ciornei +Description: Writing a non-zero value to this attribute will + force a rescan of dprc.X container in the system and + synchronize the objects under dprc.X and the + Management Complex firmware. +Users: Userspace drivers and management tools diff --git a/MAINTAINERS b/MAINTAINERS index e841cc4..7b76a80 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -12283,6 +12283,7 @@ F: drivers/bus/fsl-mc/ F: Documentation/devicetree/bindings/misc/fsl,qoriq-mc.txt F: Documentation/networking/dpaa2/overview.rst F: include/uapi/linux/fsl_mc.h +F: Documentation/ABI/stable/sysfs-bus-fsl-mc =20 QT1010 MEDIA DRIVER M: Antti Palosaari diff --git a/drivers/bus/fsl-mc/dprc-driver.c b/drivers/bus/fsl-mc/dprc-dri= ver.c index bab0d5a..2f94aba 100644 --- a/drivers/bus/fsl-mc/dprc-driver.c +++ b/drivers/bus/fsl-mc/dprc-driver.c @@ -354,6 +354,33 @@ static int dprc_scan_container(struct fsl_mc_device *m= c_bus_dev) return 0; } =20 +static ssize_t rescan_store(struct device *dev, + struct device_attribute *attr, + const char *buf, size_t count) +{ + struct fsl_mc_device *root_mc_dev; + struct fsl_mc_bus *root_mc_bus; + unsigned long val; + + if (!fsl_mc_is_root_dprc(dev)) + return -EINVAL; + + root_mc_dev =3D to_fsl_mc_device(dev); + root_mc_bus =3D to_fsl_mc_bus(root_mc_dev); + + if (kstrtoul(buf, 0, &val) < 0) + return -EINVAL; + + if (val) { + mutex_lock(&root_mc_bus->scan_mutex); + dprc_scan_objects(root_mc_dev, NULL); + mutex_unlock(&root_mc_bus->scan_mutex); + } + + return count; +} +static DEVICE_ATTR_WO(rescan); + /** * dprc_irq0_handler - Regular ISR for DPRC interrupt 0 * @@ -692,6 +719,13 @@ static int dprc_probe(struct fsl_mc_device *mc_dev) =20 mutex_init(&mc_bus->scan_mutex); =20 + error =3D device_create_file(&mc_dev->dev, &dev_attr_rescan); + if (error < 0) { + dev_err(&mc_dev->dev, "device_create_file() failed: %d\n", + error); + goto error_cleanup_open; + } + /* * Discover MC objects in DPRC object: */ @@ -788,6 +822,8 @@ static int dprc_remove(struct fsl_mc_device *mc_dev) fsl_mc_uapi_remove_device_file(mc_bus); } =20 + device_remove_file(&mc_dev->dev, &dev_attr_rescan); + dev_info(&mc_dev->dev, "DPRC device unbound from driver"); return 0; } --=20 1.9.1