Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp866281imu; Tue, 20 Nov 2018 08:07:45 -0800 (PST) X-Google-Smtp-Source: AFSGD/Xq+RIXEAXwE4HLuxePiZoxNLDBgyLhWeDPDKdI8YMRgSizjFaMKu5h54K//hWaF+PbtwAD X-Received: by 2002:a65:6215:: with SMTP id d21mr2405491pgv.289.1542730065723; Tue, 20 Nov 2018 08:07:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542730065; cv=none; d=google.com; s=arc-20160816; b=QeUn/5LhnFtH6WkKhhKk6oeA9fyj7SrOPzMDGnHDOcuN7QbNQmSDldVR8qbMqmQIuO 8EUunX3aEOvPa4uyPqFY7oL9+fYCb4qQX1I+B23mGPFBJ8cHjxz82GCHxz5zKH6YqF0T vgw6k5QNUhgL/xL4IaLIqxt+wsajpR+/N90f9EFeAQW3c4eVeWRKYEnSyjgJ9qOJoAvT 2VWbwU2GDh9zq0KY8YYQTsMX2VlPDzbp9u9lpuE3+HBWB4qJNR3snNOdif6Yt9DPIuge z/pkSaG6MH/O7zx+xfmiVOQapjrxR6VJ5Aab8ljfEZ3EswV2bQdDX7H9z/7L0bgGiCTK Grmw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :spamdiagnosticmetadata:spamdiagnosticoutput:content-language :accept-language:in-reply-to:references:message-id:date:thread-index :thread-topic:subject:cc:to:from:dkim-signature; bh=Khq1ZN21rin+/bGZw9fdwCPRSfEiiGh2PBvD7Co0Y4I=; b=YPI7tYfyPAIagZmHdCPhkRQjR6GLF3O7pWQoOan0xhnikw2qGZ+xD1SDpj5rrkvYjj 1U0QsGMRF4JhBkc0dzC3XB1X9N8hHS/GYI5n9lqakaa6L2Me34tADFlHpOkM+oOwDtLZ 7Jh0n0mDr5jGUa1zDMVh/UEhPFZbCwvnz+x3usiPtmFRqaAnoJZugKJw7tg5bSLxxn41 Ruj8NO4DsjmJpWJwNLsA+LdBapiYzrCCXyRonBRcDJGPkCAq0QtDMI2JpE5Sghpcr2NN +qNIOSznFo6InpIZvCzF2H7FeGPDfJKxTjmRDV13K7ELF/hWcXM/AQT+7rGn2q0YlDsq 46KA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector1 header.b=niVcINd7; 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 g17si15860656pgi.578.2018.11.20.08.07.28; Tue, 20 Nov 2018 08:07:45 -0800 (PST) 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=selector1 header.b=niVcINd7; 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 S1727647AbeKUCJj (ORCPT + 99 others); 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