2018-03-15 17:09:32

by Ioana Ciornei

[permalink] [raw]
Subject: [PATCH v2 0/6] bus: fsl-mc: enhance Management Complex userspace support

This patch set adds restool support in fsl-mc bus along
with a rescan attribute to the root DPRC container.

Changes in v2:
- changed mc_command in fsl_mc_command structure
- updated fsl_mc_command to use the proper types and moved it in uapi
- added proper sysfs documentation

Ioana Ciornei (6):
bus: fsl-mc: change mc_command in fsl_mc_command
bus: fsl-mc: move fsl_mc_command struct in a uapi header
bus: fsl-mc: add fsl_mc_allocator cleanup function
bus: fsl-mc: add restool userspace support
bus: fsl-mc: add root dprc rescan attribute
bus: fsl-mc: add bus rescan attribute

Documentation/ABI/stable/sysfs-bus-fsl-mc | 13 ++
Documentation/ioctl/ioctl-number.txt | 1 +
Documentation/networking/dpaa2/overview.rst | 4 +
MAINTAINERS | 2 +
drivers/bus/fsl-mc/Kconfig | 7 +
drivers/bus/fsl-mc/Makefile | 3 +
drivers/bus/fsl-mc/dpbp.c | 12 +-
drivers/bus/fsl-mc/dpcon.c | 14 +-
drivers/bus/fsl-mc/dpmcp.c | 6 +-
drivers/bus/fsl-mc/dprc-driver.c | 4 +-
drivers/bus/fsl-mc/dprc.c | 28 ++--
drivers/bus/fsl-mc/fsl-mc-allocator.c | 5 +
drivers/bus/fsl-mc/fsl-mc-bus.c | 97 +++++++++++-
drivers/bus/fsl-mc/fsl-mc-private.h | 53 +++++++
drivers/bus/fsl-mc/fsl-mc-restool.c | 219 ++++++++++++++++++++++++++++
drivers/bus/fsl-mc/mc-sys.c | 20 +--
drivers/staging/fsl-dpaa2/ethernet/dpni.c | 84 +++++------
drivers/staging/fsl-dpaa2/ethsw/dpsw.c | 64 ++++----
drivers/staging/fsl-mc/bus/dpio/dpio.c | 12 +-
include/linux/fsl/mc.h | 16 +-
include/uapi/linux/fsl_mc.h | 31 ++++
21 files changed, 561 insertions(+), 134 deletions(-)
create mode 100644 Documentation/ABI/stable/sysfs-bus-fsl-mc
create mode 100644 drivers/bus/fsl-mc/fsl-mc-restool.c
create mode 100644 include/uapi/linux/fsl_mc.h

--
1.9.1



2018-03-15 17:08:31

by Ioana Ciornei

[permalink] [raw]
Subject: [PATCH v2 6/6] bus: fsl-mc: add bus rescan attribute

Introduce the rescan attribute as a bus attribute to
synchronize the fsl-mc bus objects and the MC firmware.

To rescan the fsl-mc bus, e.g.,
echo 1 > /sys/bus/fsl-mc/rescan

Signed-off-by: Ioana Ciornei <[email protected]>
---
Changes in v2:
- added proper documentation in /Documentation/ABI/
- updated the MAINTAINERS file

Documentation/ABI/stable/sysfs-bus-fsl-mc | 7 +++++
drivers/bus/fsl-mc/fsl-mc-bus.c | 48 +++++++++++++++++++++++++++++++
2 files changed, 55 insertions(+)

diff --git a/Documentation/ABI/stable/sysfs-bus-fsl-mc b/Documentation/ABI/stable/sysfs-bus-fsl-mc
index e530e8c..0663fbd 100644
--- a/Documentation/ABI/stable/sysfs-bus-fsl-mc
+++ b/Documentation/ABI/stable/sysfs-bus-fsl-mc
@@ -4,3 +4,10 @@ KernelVersion: 4.16
Contact: Ioana Ciornei <[email protected]>
Description: Root dprc rescan attribute
Users: Userspace drivers and management tools
+
+What: /sys/bus/fsl-mc/rescan
+Date: March. 2018
+KernelVersion: 4.16
+Contact: Ioana Ciornei <[email protected]>
+Description: Bus rescan attribute
+Users: Userspace drivers and management tools
diff --git a/drivers/bus/fsl-mc/fsl-mc-bus.c b/drivers/bus/fsl-mc/fsl-mc-bus.c
index 9d02984..80010d1 100644
--- a/drivers/bus/fsl-mc/fsl-mc-bus.c
+++ b/drivers/bus/fsl-mc/fsl-mc-bus.c
@@ -172,11 +172,59 @@ static ssize_t rescan_store(struct device *dev,

ATTRIBUTE_GROUPS(fsl_mc_dev);

+static int scan_fsl_mc_bus(struct device *dev, void *data)
+{
+ struct fsl_mc_device *root_mc_dev;
+ struct fsl_mc_bus *root_mc_bus;
+
+ if (!fsl_mc_is_root_dprc(dev))
+ goto exit;
+
+ root_mc_dev = to_fsl_mc_device(dev);
+ root_mc_bus = to_fsl_mc_bus(root_mc_dev);
+ mutex_lock(&root_mc_bus->scan_mutex);
+ dprc_scan_objects(root_mc_dev, NULL);
+ mutex_unlock(&root_mc_bus->scan_mutex);
+
+exit:
+ return 0;
+}
+
+static ssize_t bus_rescan_store(struct bus_type *bus,
+ const char *buf, size_t count)
+{
+ unsigned long val;
+
+ if (kstrtoul(buf, 0, &val) < 0)
+ return -EINVAL;
+
+ if (val)
+ bus_for_each_dev(bus, NULL, NULL, scan_fsl_mc_bus);
+
+ return count;
+}
+static BUS_ATTR(rescan, 0220, NULL, bus_rescan_store);
+
+static struct attribute *fsl_mc_bus_attrs[] = {
+ &bus_attr_rescan.attr,
+ NULL,
+};
+
+static const struct attribute_group fsl_mc_bus_group = {
+ .attrs = fsl_mc_bus_attrs,
+};
+
+static const struct attribute_group *fsl_mc_bus_groups[] = {
+ &fsl_mc_bus_group,
+ NULL,
+};
+
struct bus_type fsl_mc_bus_type = {
.name = "fsl-mc",
.match = fsl_mc_bus_match,
.uevent = fsl_mc_bus_uevent,
.dev_groups = fsl_mc_dev_groups,
+ .bus_groups = fsl_mc_bus_groups,
};
EXPORT_SYMBOL_GPL(fsl_mc_bus_type);

--
1.9.1


2018-03-15 17:09:17

by Ioana Ciornei

[permalink] [raw]
Subject: [PATCH v2 4/6] bus: fsl-mc: add restool userspace support

Adding kernel support for restool, a userspace tool for resource
management, means exporting an ioctl capable device file representing
the root resource container.
This new functionality in the fsl-mc bus driver intends to provide
restool an interface to interact with the MC firmware.
Commands that are composed in userspace are sent to the MC firmware
through the RESTOOL_SEND_MC_COMMAND ioctl.
By default the implicit MC I/O portal is used for this operation,
but if the implicit one is busy, a dynamic portal is allocated and then
freed upon execution.

Signed-off-by: Ioana Ciornei <[email protected]>
---
Changes in v2:
- split the bus/driver changes in a separate patch
- moved the ioctl in the uapi header file

Documentation/ioctl/ioctl-number.txt | 1 +
Documentation/networking/dpaa2/overview.rst | 4 +
drivers/bus/fsl-mc/Kconfig | 7 +
drivers/bus/fsl-mc/Makefile | 3 +
drivers/bus/fsl-mc/fsl-mc-bus.c | 19 +++
drivers/bus/fsl-mc/fsl-mc-private.h | 48 ++++++
drivers/bus/fsl-mc/fsl-mc-restool.c | 219 ++++++++++++++++++++++++++++
include/uapi/linux/fsl_mc.h | 8 +
8 files changed, 309 insertions(+)
create mode 100644 drivers/bus/fsl-mc/fsl-mc-restool.c

diff --git a/Documentation/ioctl/ioctl-number.txt b/Documentation/ioctl/ioctl-number.txt
index 6501389..1a2d132 100644
--- a/Documentation/ioctl/ioctl-number.txt
+++ b/Documentation/ioctl/ioctl-number.txt
@@ -170,6 +170,7 @@ Code Seq#(hex) Include File Comments
'R' 00-1F linux/random.h conflict!
'R' 01 linux/rfkill.h conflict!
'R' C0-DF net/bluetooth/rfcomm.h
+'R' E0 uapi/linux/fsl_mc.h
'S' all linux/cdrom.h conflict!
'S' 80-81 scsi/scsi_ioctl.h conflict!
'S' 82-FF scsi/scsi.h conflict!
diff --git a/Documentation/networking/dpaa2/overview.rst b/Documentation/networking/dpaa2/overview.rst
index 79fede4..1056445 100644
--- a/Documentation/networking/dpaa2/overview.rst
+++ b/Documentation/networking/dpaa2/overview.rst
@@ -127,6 +127,10 @@ level.

DPRCs can be defined statically and populated with objects
via a config file passed to the MC when firmware starts it.
+There is also a Linux user space tool called "restool" that can be
+used to create/destroy containers and objects dynamically. The latest
+version of restool can be found at:
+ https://github.com/qoriq-open-source/restool

DPAA2 Objects for an Ethernet Network Interface
-----------------------------------------------
diff --git a/drivers/bus/fsl-mc/Kconfig b/drivers/bus/fsl-mc/Kconfig
index c23c77c..66ec3b9 100644
--- a/drivers/bus/fsl-mc/Kconfig
+++ b/drivers/bus/fsl-mc/Kconfig
@@ -14,3 +14,10 @@ config FSL_MC_BUS
architecture. The fsl-mc bus driver handles discovery of
DPAA2 objects (which are represented as Linux devices) and
binding objects to drivers.
+
+config FSL_MC_RESTOOL
+ bool "Management Complex (MC) restool support"
+ depends on FSL_MC_BUS
+ help
+ Provides kernel support for the Management Complex resource
+ manager user-space tool - restool.
diff --git a/drivers/bus/fsl-mc/Makefile b/drivers/bus/fsl-mc/Makefile
index 3c518c7..2017bdb 100644
--- a/drivers/bus/fsl-mc/Makefile
+++ b/drivers/bus/fsl-mc/Makefile
@@ -16,3 +16,6 @@ mc-bus-driver-objs := fsl-mc-bus.o \
fsl-mc-allocator.o \
fsl-mc-msi.o \
dpmcp.o
+
+# MC restool kernel support
+obj-$(CONFIG_FSL_MC_RESTOOL) += fsl-mc-restool.o
diff --git a/drivers/bus/fsl-mc/fsl-mc-bus.c b/drivers/bus/fsl-mc/fsl-mc-bus.c
index 5d8266c..0ade415 100644
--- a/drivers/bus/fsl-mc/fsl-mc-bus.c
+++ b/drivers/bus/fsl-mc/fsl-mc-bus.c
@@ -792,6 +792,7 @@ static int fsl_mc_bus_probe(struct platform_device *pdev)
struct fsl_mc *mc;
struct fsl_mc_device *mc_bus_dev = NULL;
struct fsl_mc_io *mc_io = NULL;
+ struct fsl_mc_bus *mc_bus = NULL;
int container_id;
phys_addr_t mc_portal_phys_addr;
u32 mc_portal_size;
@@ -863,9 +864,18 @@ static int fsl_mc_bus_probe(struct platform_device *pdev)
if (error < 0)
goto error_cleanup_mc_io;

+ mc_bus = to_fsl_mc_bus(mc_bus_dev);
+ error = fsl_mc_restool_create_device_file(mc_bus);
+ if (error < 0)
+ goto error_cleanup_device;
+
mc->root_mc_bus_dev = mc_bus_dev;
+
return 0;

+error_cleanup_device:
+ fsl_mc_device_remove(mc_bus_dev);
+
error_cleanup_mc_io:
fsl_destroy_mc_io(mc_io);
return error;
@@ -878,10 +888,12 @@ static int fsl_mc_bus_probe(struct platform_device *pdev)
static int fsl_mc_bus_remove(struct platform_device *pdev)
{
struct fsl_mc *mc = platform_get_drvdata(pdev);
+ struct fsl_mc_bus *mc_bus = to_fsl_mc_bus(mc->root_mc_bus_dev);

if (!fsl_mc_is_root_dprc(&mc->root_mc_bus_dev->dev))
return -EINVAL;

+ fsl_mc_restool_remove_device_file(mc_bus);
fsl_mc_device_remove(mc->root_mc_bus_dev);

fsl_destroy_mc_io(mc->root_mc_bus_dev->mc_io);
@@ -931,8 +943,15 @@ static int __init fsl_mc_bus_driver_init(void)
if (error < 0)
goto error_cleanup_dprc_driver;

+ error = fsl_mc_restool_init();
+ if (error < 0)
+ goto error_cleanup_mc_allocator;
+
return 0;

+error_cleanup_mc_allocator:
+ fsl_mc_allocator_driver_exit();
+
error_cleanup_dprc_driver:
dprc_driver_exit();

diff --git a/drivers/bus/fsl-mc/fsl-mc-private.h b/drivers/bus/fsl-mc/fsl-mc-private.h
index ea11b4f..00cca7d 100644
--- a/drivers/bus/fsl-mc/fsl-mc-private.h
+++ b/drivers/bus/fsl-mc/fsl-mc-private.h
@@ -10,6 +10,8 @@

#include <linux/fsl/mc.h>
#include <linux/mutex.h>
+#include <linux/cdev.h>
+#include <linux/ioctl.h>

/*
* Data Path Management Complex (DPMNG) General API
@@ -492,6 +494,24 @@ struct fsl_mc_resource_pool {
};

/**
+ * struct fsl_mc_restool - information associated with a restool device file
+ * @cdev: struct char device linked to the root dprc
+ * @dev: dev_t for the char device to be added
+ * @device: newly created device in /dev
+ * @mutex: mutex lock to serialize the open/release operations
+ * @local_instance_in_use: local MC I/O instance in use or not
+ * @dynamic_instance_count: number of dynamically created MC I/O instances
+ */
+struct fsl_mc_restool {
+ struct cdev cdev;
+ dev_t dev;
+ struct device *device;
+ struct mutex mutex; /* serialize open/release operations */
+ bool local_instance_in_use;
+ u32 dynamic_instance_count;
+};
+
+/**
* struct fsl_mc_bus - logical bus that corresponds to a physical DPRC
* @mc_dev: fsl-mc device for the bus device itself.
* @resource_pools: array of resource pools (one pool per resource type)
@@ -500,6 +520,7 @@ struct fsl_mc_resource_pool {
* @irq_resources: Pointer to array of IRQ objects for the IRQ pool
* @scan_mutex: Serializes bus scanning
* @dprc_attr: DPRC attributes
+ * @restool_misc: struct that abstracts the interaction with userspace restool
*/
struct fsl_mc_bus {
struct fsl_mc_device mc_dev;
@@ -507,6 +528,7 @@ struct fsl_mc_bus {
struct fsl_mc_device_irq *irq_resources;
struct mutex scan_mutex; /* serializes bus scanning */
struct dprc_attributes dprc_attr;
+ struct fsl_mc_restool restool_misc;
};

#define to_fsl_mc_bus(_mc_dev) \
@@ -561,4 +583,30 @@ int __must_check fsl_create_mc_io(struct device *dev,

bool fsl_mc_is_root_dprc(struct device *dev);

+#ifdef CONFIG_FSL_MC_RESTOOL
+
+int fsl_mc_restool_create_device_file(struct fsl_mc_bus *mc_bus);
+
+void fsl_mc_restool_remove_device_file(struct fsl_mc_bus *mc_bus);
+
+int fsl_mc_restool_init(void);
+
+#else
+
+static inline int fsl_mc_restool_create_device_file(struct fsl_mc_bus *mc_bus)
+{
+ return 0;
+}
+
+static inline void fsl_mc_restool_remove_device_file(struct fsl_mc_bus *mc_bus)
+{
+}
+
+static inline int fsl_mc_restool_init(void)
+{
+ return 0;
+}
+
+#endif
+
#endif /* _FSL_MC_PRIVATE_H_ */
diff --git a/drivers/bus/fsl-mc/fsl-mc-restool.c b/drivers/bus/fsl-mc/fsl-mc-restool.c
new file mode 100644
index 0000000..c39b8e8
--- /dev/null
+++ b/drivers/bus/fsl-mc/fsl-mc-restool.c
@@ -0,0 +1,219 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Management Complex (MC) restool support
+ *
+ * Copyright 2018 NXP
+ *
+ */
+
+#include <linux/slab.h>
+#include <linux/cdev.h>
+#include <linux/fs.h>
+#include <linux/uaccess.h>
+
+#include "fsl-mc-private.h"
+
+#define FSL_MC_BUS_MAX_MINORS 1
+
+static struct class *fsl_mc_bus_class;
+static int fsl_mc_bus_major;
+
+static int fsl_mc_restool_send_command(unsigned long arg,
+ struct fsl_mc_io *mc_io)
+{
+ struct fsl_mc_command mc_cmd;
+ int error;
+
+ error = copy_from_user(&mc_cmd, (void __user *)arg, sizeof(mc_cmd));
+ if (error)
+ return -EFAULT;
+
+ error = mc_send_command(mc_io, &mc_cmd);
+ if (error)
+ return error;
+
+ error = copy_to_user((void __user *)arg, &mc_cmd, sizeof(mc_cmd));
+ if (error)
+ return -EFAULT;
+
+ return 0;
+}
+
+int fsl_mc_restool_init(void)
+{
+ dev_t dev;
+ int error;
+
+ fsl_mc_bus_class = class_create(THIS_MODULE, "fsl_mc_bus");
+ if (IS_ERR(fsl_mc_bus_class)) {
+ error = PTR_ERR(fsl_mc_bus_class);
+ return error;
+ }
+
+ error = alloc_chrdev_region(&dev, 0,
+ FSL_MC_BUS_MAX_MINORS,
+ "fsl_mc_bus");
+ if (error < 0)
+ return error;
+
+ fsl_mc_bus_major = MAJOR(dev);
+
+ return 0;
+}
+
+static int fsl_mc_restool_dev_open(struct inode *inode, struct file *filep)
+{
+ struct fsl_mc_device *root_mc_device;
+ struct fsl_mc_restool *mc_restool;
+ struct fsl_mc_bus *mc_bus;
+ struct fsl_mc_io *dynamic_mc_io;
+ int error;
+
+ mc_restool = container_of(inode->i_cdev, struct fsl_mc_restool, cdev);
+ mc_bus = container_of(mc_restool, struct fsl_mc_bus, restool_misc);
+ root_mc_device = &mc_bus->mc_dev;
+
+ mutex_lock(&mc_restool->mutex);
+
+ if (!mc_restool->local_instance_in_use) {
+ filep->private_data = root_mc_device->mc_io;
+ mc_restool->local_instance_in_use = true;
+ } else {
+ dynamic_mc_io = kzalloc(sizeof(*dynamic_mc_io), GFP_KERNEL);
+ if (!dynamic_mc_io) {
+ error = -ENOMEM;
+ goto error_alloc_mc_io;
+ }
+
+ error = fsl_mc_portal_allocate(root_mc_device, 0,
+ &dynamic_mc_io);
+ if (error) {
+ pr_err("Could not allocate MC portal\n");
+ goto error_portal_allocate;
+ }
+
+ mc_restool->dynamic_instance_count++;
+ filep->private_data = dynamic_mc_io;
+ }
+
+ mutex_unlock(&mc_restool->mutex);
+
+ return 0;
+
+error_portal_allocate:
+ kfree(dynamic_mc_io);
+
+error_alloc_mc_io:
+ mutex_unlock(&mc_restool->mutex);
+
+ return error;
+}
+
+static int fsl_mc_restool_dev_release(struct inode *inode, struct file *filep)
+{
+ struct fsl_mc_device *root_mc_device;
+ struct fsl_mc_restool *mc_restool;
+ struct fsl_mc_bus *mc_bus;
+ struct fsl_mc_io *mc_io;
+
+ mc_restool = container_of(inode->i_cdev, struct fsl_mc_restool, cdev);
+ mc_bus = container_of(mc_restool, struct fsl_mc_bus, restool_misc);
+ root_mc_device = &mc_bus->mc_dev;
+ mc_io = filep->private_data;
+
+ mutex_lock(&mc_restool->mutex);
+
+ if (WARN_ON(!mc_restool->local_instance_in_use &&
+ mc_restool->dynamic_instance_count == 0)) {
+ mutex_unlock(&mc_restool->mutex);
+ return -EINVAL;
+ }
+
+ if (filep->private_data == root_mc_device->mc_io) {
+ mc_restool->local_instance_in_use = false;
+ } else {
+ fsl_mc_portal_free(mc_io);
+ kfree(mc_io);
+ mc_restool->dynamic_instance_count--;
+ }
+
+ filep->private_data = NULL;
+ mutex_unlock(&mc_restool->mutex);
+
+ return 0;
+}
+
+static long fsl_mc_restool_dev_ioctl(struct file *file,
+ unsigned int cmd,
+ unsigned long arg)
+{
+ int error;
+
+ switch (cmd) {
+ case RESTOOL_SEND_MC_COMMAND:
+ error = fsl_mc_restool_send_command(arg, file->private_data);
+ break;
+ default:
+ pr_err("%s: unexpected ioctl call number\n", __func__);
+ error = -EINVAL;
+ }
+
+ return error;
+}
+
+static const struct file_operations fsl_mc_restool_dev_fops = {
+ .owner = THIS_MODULE,
+ .open = fsl_mc_restool_dev_open,
+ .release = fsl_mc_restool_dev_release,
+ .unlocked_ioctl = fsl_mc_restool_dev_ioctl,
+};
+
+int fsl_mc_restool_create_device_file(struct fsl_mc_bus *mc_bus)
+{
+ struct fsl_mc_device *mc_dev = &mc_bus->mc_dev;
+ struct fsl_mc_restool *mc_restool = &mc_bus->restool_misc;
+ int error;
+
+ mc_restool = &mc_bus->restool_misc;
+ mc_restool->dev = MKDEV(fsl_mc_bus_major, 0);
+ cdev_init(&mc_restool->cdev, &fsl_mc_restool_dev_fops);
+
+ error = cdev_add(&mc_restool->cdev,
+ mc_restool->dev,
+ FSL_MC_BUS_MAX_MINORS);
+ if (error)
+ return error;
+
+ mc_restool->device = device_create(fsl_mc_bus_class,
+ NULL,
+ mc_restool->dev,
+ NULL,
+ "%s",
+ dev_name(&mc_dev->dev));
+ if (IS_ERR(mc_restool->device)) {
+ error = PTR_ERR(mc_restool->device);
+ goto error_device_create;
+ }
+
+ mutex_init(&mc_restool->mutex);
+
+ return 0;
+
+error_device_create:
+ cdev_del(&mc_restool->cdev);
+
+ return error;
+}
+
+void fsl_mc_restool_remove_device_file(struct fsl_mc_bus *mc_bus)
+{
+ struct fsl_mc_restool *mc_restool = &mc_bus->restool_misc;
+
+ if (WARN_ON(mc_restool->local_instance_in_use))
+ return;
+
+ if (WARN_ON(mc_restool->dynamic_instance_count != 0))
+ return;
+
+ cdev_del(&mc_restool->cdev);
+}
diff --git a/include/uapi/linux/fsl_mc.h b/include/uapi/linux/fsl_mc.h
index 90892c4..bf31472 100644
--- a/include/uapi/linux/fsl_mc.h
+++ b/include/uapi/linux/fsl_mc.h
@@ -14,10 +14,18 @@
* struct fsl_mc_command - Management Complex (MC) command structure
* @header: MC command header
* @params: MC command parameters
+ *
+ * Used by RESTOOL_SEND_MC_COMMAND
*/
struct fsl_mc_command {
__u64 header;
__u64 params[MC_CMD_NUM_OF_PARAMS];
};

+#define RESTOOL_IOCTL_TYPE 'R'
+#define RESTOOL_IOCTL_SEQ 0xE0
+
+#define RESTOOL_SEND_MC_COMMAND \
+ _IOWR(RESTOOL_IOCTL_TYPE, RESTOOL_IOCTL_SEQ, struct fsl_mc_command)
+
#endif /* _UAPI_FSL_MC_H_ */
--
1.9.1


2018-03-15 17:10:30

by Ioana Ciornei

[permalink] [raw]
Subject: [PATCH v2 1/6] bus: fsl-mc: change mc_command in fsl_mc_command

The "struct mc_command" is a very generic name for a global
kernel structure. Change its name in "struct fsl_mc_command".

Signed-off-by: Ioana Ciornei <[email protected]>
---
Changes in v2:
- added the patch itself

drivers/bus/fsl-mc/dpbp.c | 12 ++---
drivers/bus/fsl-mc/dpcon.c | 14 +++---
drivers/bus/fsl-mc/dpmcp.c | 6 +--
drivers/bus/fsl-mc/dprc.c | 28 +++++------
drivers/bus/fsl-mc/fsl-mc-bus.c | 2 +-
drivers/bus/fsl-mc/mc-sys.c | 20 ++++----
drivers/staging/fsl-dpaa2/ethernet/dpni.c | 84 +++++++++++++++----------------
drivers/staging/fsl-dpaa2/ethsw/dpsw.c | 64 +++++++++++------------
drivers/staging/fsl-mc/bus/dpio/dpio.c | 12 ++---
include/linux/fsl/mc.h | 10 ++--
10 files changed, 126 insertions(+), 126 deletions(-)

diff --git a/drivers/bus/fsl-mc/dpbp.c b/drivers/bus/fsl-mc/dpbp.c
index 0aeacc5..17e3c5d 100644
--- a/drivers/bus/fsl-mc/dpbp.c
+++ b/drivers/bus/fsl-mc/dpbp.c
@@ -31,7 +31,7 @@ int dpbp_open(struct fsl_mc_io *mc_io,
int dpbp_id,
u16 *token)
{
- struct mc_command cmd = { 0 };
+ struct fsl_mc_command cmd = { 0 };
struct dpbp_cmd_open *cmd_params;
int err;

@@ -68,7 +68,7 @@ int dpbp_close(struct fsl_mc_io *mc_io,
u32 cmd_flags,
u16 token)
{
- struct mc_command cmd = { 0 };
+ struct fsl_mc_command cmd = { 0 };

/* prepare command */
cmd.header = mc_encode_cmd_header(DPBP_CMDID_CLOSE, cmd_flags,
@@ -91,7 +91,7 @@ int dpbp_enable(struct fsl_mc_io *mc_io,
u32 cmd_flags,
u16 token)
{
- struct mc_command cmd = { 0 };
+ struct fsl_mc_command cmd = { 0 };

/* prepare command */
cmd.header = mc_encode_cmd_header(DPBP_CMDID_ENABLE, cmd_flags,
@@ -114,7 +114,7 @@ int dpbp_disable(struct fsl_mc_io *mc_io,
u32 cmd_flags,
u16 token)
{
- struct mc_command cmd = { 0 };
+ struct fsl_mc_command cmd = { 0 };

/* prepare command */
cmd.header = mc_encode_cmd_header(DPBP_CMDID_DISABLE,
@@ -137,7 +137,7 @@ int dpbp_reset(struct fsl_mc_io *mc_io,
u32 cmd_flags,
u16 token)
{
- struct mc_command cmd = { 0 };
+ struct fsl_mc_command cmd = { 0 };

/* prepare command */
cmd.header = mc_encode_cmd_header(DPBP_CMDID_RESET,
@@ -163,7 +163,7 @@ int dpbp_get_attributes(struct fsl_mc_io *mc_io,
u16 token,
struct dpbp_attr *attr)
{
- struct mc_command cmd = { 0 };
+ struct fsl_mc_command cmd = { 0 };
struct dpbp_rsp_get_attributes *rsp_params;
int err;

diff --git a/drivers/bus/fsl-mc/dpcon.c b/drivers/bus/fsl-mc/dpcon.c
index a1ba819..760555d 100644
--- a/drivers/bus/fsl-mc/dpcon.c
+++ b/drivers/bus/fsl-mc/dpcon.c
@@ -31,7 +31,7 @@ int dpcon_open(struct fsl_mc_io *mc_io,
int dpcon_id,
u16 *token)
{
- struct mc_command cmd = { 0 };
+ struct fsl_mc_command cmd = { 0 };
struct dpcon_cmd_open *dpcon_cmd;
int err;

@@ -69,7 +69,7 @@ int dpcon_close(struct fsl_mc_io *mc_io,
u32 cmd_flags,
u16 token)
{
- struct mc_command cmd = { 0 };
+ struct fsl_mc_command cmd = { 0 };

/* prepare command */
cmd.header = mc_encode_cmd_header(DPCON_CMDID_CLOSE,
@@ -93,7 +93,7 @@ int dpcon_enable(struct fsl_mc_io *mc_io,
u32 cmd_flags,
u16 token)
{
- struct mc_command cmd = { 0 };
+ struct fsl_mc_command cmd = { 0 };

/* prepare command */
cmd.header = mc_encode_cmd_header(DPCON_CMDID_ENABLE,
@@ -117,7 +117,7 @@ int dpcon_disable(struct fsl_mc_io *mc_io,
u32 cmd_flags,
u16 token)
{
- struct mc_command cmd = { 0 };
+ struct fsl_mc_command cmd = { 0 };

/* prepare command */
cmd.header = mc_encode_cmd_header(DPCON_CMDID_DISABLE,
@@ -141,7 +141,7 @@ int dpcon_reset(struct fsl_mc_io *mc_io,
u32 cmd_flags,
u16 token)
{
- struct mc_command cmd = { 0 };
+ struct fsl_mc_command cmd = { 0 };

/* prepare command */
cmd.header = mc_encode_cmd_header(DPCON_CMDID_RESET,
@@ -166,7 +166,7 @@ int dpcon_get_attributes(struct fsl_mc_io *mc_io,
u16 token,
struct dpcon_attr *attr)
{
- struct mc_command cmd = { 0 };
+ struct fsl_mc_command cmd = { 0 };
struct dpcon_rsp_get_attr *dpcon_rsp;
int err;

@@ -204,7 +204,7 @@ int dpcon_set_notification(struct fsl_mc_io *mc_io,
u16 token,
struct dpcon_notification_cfg *cfg)
{
- struct mc_command cmd = { 0 };
+ struct fsl_mc_command cmd = { 0 };
struct dpcon_cmd_set_notification *dpcon_cmd;

/* prepare command */
diff --git a/drivers/bus/fsl-mc/dpmcp.c b/drivers/bus/fsl-mc/dpmcp.c
index 8d997b0..5fbd0dbd 100644
--- a/drivers/bus/fsl-mc/dpmcp.c
+++ b/drivers/bus/fsl-mc/dpmcp.c
@@ -30,7 +30,7 @@ int dpmcp_open(struct fsl_mc_io *mc_io,
int dpmcp_id,
u16 *token)
{
- struct mc_command cmd = { 0 };
+ struct fsl_mc_command cmd = { 0 };
struct dpmcp_cmd_open *cmd_params;
int err;

@@ -66,7 +66,7 @@ int dpmcp_close(struct fsl_mc_io *mc_io,
u32 cmd_flags,
u16 token)
{
- struct mc_command cmd = { 0 };
+ struct fsl_mc_command cmd = { 0 };

/* prepare command */
cmd.header = mc_encode_cmd_header(DPMCP_CMDID_CLOSE,
@@ -88,7 +88,7 @@ int dpmcp_reset(struct fsl_mc_io *mc_io,
u32 cmd_flags,
u16 token)
{
- struct mc_command cmd = { 0 };
+ struct fsl_mc_command cmd = { 0 };

/* prepare command */
cmd.header = mc_encode_cmd_header(DPMCP_CMDID_RESET,
diff --git a/drivers/bus/fsl-mc/dprc.c b/drivers/bus/fsl-mc/dprc.c
index 5c23e8d..1c3f621 100644
--- a/drivers/bus/fsl-mc/dprc.c
+++ b/drivers/bus/fsl-mc/dprc.c
@@ -24,7 +24,7 @@ int dprc_open(struct fsl_mc_io *mc_io,
int container_id,
u16 *token)
{
- struct mc_command cmd = { 0 };
+ struct fsl_mc_command cmd = { 0 };
struct dprc_cmd_open *cmd_params;
int err;

@@ -61,7 +61,7 @@ int dprc_close(struct fsl_mc_io *mc_io,
u32 cmd_flags,
u16 token)
{
- struct mc_command cmd = { 0 };
+ struct fsl_mc_command cmd = { 0 };

/* prepare command */
cmd.header = mc_encode_cmd_header(DPRC_CMDID_CLOSE, cmd_flags,
@@ -88,7 +88,7 @@ int dprc_set_irq(struct fsl_mc_io *mc_io,
u8 irq_index,
struct dprc_irq_cfg *irq_cfg)
{
- struct mc_command cmd = { 0 };
+ struct fsl_mc_command cmd = { 0 };
struct dprc_cmd_set_irq *cmd_params;

/* prepare command */
@@ -126,7 +126,7 @@ int dprc_set_irq_enable(struct fsl_mc_io *mc_io,
u8 irq_index,
u8 en)
{
- struct mc_command cmd = { 0 };
+ struct fsl_mc_command cmd = { 0 };
struct dprc_cmd_set_irq_enable *cmd_params;

/* prepare command */
@@ -162,7 +162,7 @@ int dprc_set_irq_mask(struct fsl_mc_io *mc_io,
u8 irq_index,
u32 mask)
{
- struct mc_command cmd = { 0 };
+ struct fsl_mc_command cmd = { 0 };
struct dprc_cmd_set_irq_mask *cmd_params;

/* prepare command */
@@ -194,7 +194,7 @@ int dprc_get_irq_status(struct fsl_mc_io *mc_io,
u8 irq_index,
u32 *status)
{
- struct mc_command cmd = { 0 };
+ struct fsl_mc_command cmd = { 0 };
struct dprc_cmd_get_irq_status *cmd_params;
struct dprc_rsp_get_irq_status *rsp_params;
int err;
@@ -236,7 +236,7 @@ int dprc_clear_irq_status(struct fsl_mc_io *mc_io,
u8 irq_index,
u32 status)
{
- struct mc_command cmd = { 0 };
+ struct fsl_mc_command cmd = { 0 };
struct dprc_cmd_clear_irq_status *cmd_params;

/* prepare command */
@@ -264,7 +264,7 @@ int dprc_get_attributes(struct fsl_mc_io *mc_io,
u16 token,
struct dprc_attributes *attr)
{
- struct mc_command cmd = { 0 };
+ struct fsl_mc_command cmd = { 0 };
struct dprc_rsp_get_attributes *rsp_params;
int err;

@@ -302,7 +302,7 @@ int dprc_get_obj_count(struct fsl_mc_io *mc_io,
u16 token,
int *obj_count)
{
- struct mc_command cmd = { 0 };
+ struct fsl_mc_command cmd = { 0 };
struct dprc_rsp_get_obj_count *rsp_params;
int err;

@@ -344,7 +344,7 @@ int dprc_get_obj(struct fsl_mc_io *mc_io,
int obj_index,
struct fsl_mc_obj_desc *obj_desc)
{
- struct mc_command cmd = { 0 };
+ struct fsl_mc_command cmd = { 0 };
struct dprc_cmd_get_obj *cmd_params;
struct dprc_rsp_get_obj *rsp_params;
int err;
@@ -399,7 +399,7 @@ int dprc_set_obj_irq(struct fsl_mc_io *mc_io,
u8 irq_index,
struct dprc_irq_cfg *irq_cfg)
{
- struct mc_command cmd = { 0 };
+ struct fsl_mc_command cmd = { 0 };
struct dprc_cmd_set_obj_irq *cmd_params;

/* prepare command */
@@ -440,7 +440,7 @@ int dprc_get_obj_region(struct fsl_mc_io *mc_io,
u8 region_index,
struct dprc_region_desc *region_desc)
{
- struct mc_command cmd = { 0 };
+ struct fsl_mc_command cmd = { 0 };
struct dprc_cmd_get_obj_region *cmd_params;
struct dprc_rsp_get_obj_region *rsp_params;
int err;
@@ -482,7 +482,7 @@ int dprc_get_api_version(struct fsl_mc_io *mc_io,
u16 *major_ver,
u16 *minor_ver)
{
- struct mc_command cmd = { 0 };
+ struct fsl_mc_command cmd = { 0 };
int err;

/* prepare command */
@@ -512,7 +512,7 @@ int dprc_get_container_id(struct fsl_mc_io *mc_io,
u32 cmd_flags,
int *container_id)
{
- struct mc_command cmd = { 0 };
+ struct fsl_mc_command cmd = { 0 };
int err;

/* prepare command */
diff --git a/drivers/bus/fsl-mc/fsl-mc-bus.c b/drivers/bus/fsl-mc/fsl-mc-bus.c
index 1b333c4..5d8266c 100644
--- a/drivers/bus/fsl-mc/fsl-mc-bus.c
+++ b/drivers/bus/fsl-mc/fsl-mc-bus.c
@@ -314,7 +314,7 @@ static int mc_get_version(struct fsl_mc_io *mc_io,
u32 cmd_flags,
struct mc_version *mc_ver_info)
{
- struct mc_command cmd = { 0 };
+ struct fsl_mc_command cmd = { 0 };
struct dpmng_rsp_get_version *rsp_params;
int err;

diff --git a/drivers/bus/fsl-mc/mc-sys.c b/drivers/bus/fsl-mc/mc-sys.c
index bd03f15..3221a7f 100644
--- a/drivers/bus/fsl-mc/mc-sys.c
+++ b/drivers/bus/fsl-mc/mc-sys.c
@@ -28,14 +28,14 @@
#define MC_CMD_COMPLETION_POLLING_MIN_SLEEP_USECS 10
#define MC_CMD_COMPLETION_POLLING_MAX_SLEEP_USECS 500

-static enum mc_cmd_status mc_cmd_hdr_read_status(struct mc_command *cmd)
+static enum mc_cmd_status mc_cmd_hdr_read_status(struct fsl_mc_command *cmd)
{
struct mc_cmd_header *hdr = (struct mc_cmd_header *)&cmd->header;

return (enum mc_cmd_status)hdr->status;
}

-static u16 mc_cmd_hdr_read_cmdid(struct mc_command *cmd)
+static u16 mc_cmd_hdr_read_cmdid(struct fsl_mc_command *cmd)
{
struct mc_cmd_header *hdr = (struct mc_cmd_header *)&cmd->header;
u16 cmd_id = le16_to_cpu(hdr->cmd_id);
@@ -94,8 +94,8 @@ static const char *mc_status_to_string(enum mc_cmd_status status)
* @portal: pointer to an MC portal
* @cmd: pointer to a filled command
*/
-static inline void mc_write_command(struct mc_command __iomem *portal,
- struct mc_command *cmd)
+static inline void mc_write_command(struct fsl_mc_command __iomem *portal,
+ struct fsl_mc_command *cmd)
{
int i;

@@ -121,9 +121,9 @@ static inline void mc_write_command(struct mc_command __iomem *portal,
*
* Returns MC_CMD_STATUS_OK on Success; Error code otherwise.
*/
-static inline enum mc_cmd_status mc_read_response(struct mc_command __iomem *
- portal,
- struct mc_command *resp)
+static inline enum mc_cmd_status mc_read_response(struct fsl_mc_command __iomem
+ *portal,
+ struct fsl_mc_command *resp)
{
int i;
enum mc_cmd_status status;
@@ -156,7 +156,7 @@ static inline enum mc_cmd_status mc_read_response(struct mc_command __iomem *
* @mc_status: MC command completion status
*/
static int mc_polling_wait_preemptible(struct fsl_mc_io *mc_io,
- struct mc_command *cmd,
+ struct fsl_mc_command *cmd,
enum mc_cmd_status *mc_status)
{
enum mc_cmd_status status;
@@ -202,7 +202,7 @@ static int mc_polling_wait_preemptible(struct fsl_mc_io *mc_io,
* @mc_status: MC command completion status
*/
static int mc_polling_wait_atomic(struct fsl_mc_io *mc_io,
- struct mc_command *cmd,
+ struct fsl_mc_command *cmd,
enum mc_cmd_status *mc_status)
{
enum mc_cmd_status status;
@@ -241,7 +241,7 @@ static int mc_polling_wait_atomic(struct fsl_mc_io *mc_io,
*
* Returns '0' on Success; Error code otherwise.
*/
-int mc_send_command(struct fsl_mc_io *mc_io, struct mc_command *cmd)
+int mc_send_command(struct fsl_mc_io *mc_io, struct fsl_mc_command *cmd)
{
int error;
enum mc_cmd_status status;
diff --git a/drivers/staging/fsl-dpaa2/ethernet/dpni.c b/drivers/staging/fsl-dpaa2/ethernet/dpni.c
index b16ff5c..1a721c9 100644
--- a/drivers/staging/fsl-dpaa2/ethernet/dpni.c
+++ b/drivers/staging/fsl-dpaa2/ethernet/dpni.c
@@ -122,7 +122,7 @@ int dpni_open(struct fsl_mc_io *mc_io,
int dpni_id,
u16 *token)
{
- struct mc_command cmd = { 0 };
+ struct fsl_mc_command cmd = { 0 };
struct dpni_cmd_open *cmd_params;

int err;
@@ -160,7 +160,7 @@ int dpni_close(struct fsl_mc_io *mc_io,
u32 cmd_flags,
u16 token)
{
- struct mc_command cmd = { 0 };
+ struct fsl_mc_command cmd = { 0 };

/* prepare command */
cmd.header = mc_encode_cmd_header(DPNI_CMDID_CLOSE,
@@ -188,7 +188,7 @@ int dpni_set_pools(struct fsl_mc_io *mc_io,
u16 token,
const struct dpni_pools_cfg *cfg)
{
- struct mc_command cmd = { 0 };
+ struct fsl_mc_command cmd = { 0 };
struct dpni_cmd_set_pools *cmd_params;
int i;

@@ -222,7 +222,7 @@ int dpni_enable(struct fsl_mc_io *mc_io,
u32 cmd_flags,
u16 token)
{
- struct mc_command cmd = { 0 };
+ struct fsl_mc_command cmd = { 0 };

/* prepare command */
cmd.header = mc_encode_cmd_header(DPNI_CMDID_ENABLE,
@@ -245,7 +245,7 @@ int dpni_disable(struct fsl_mc_io *mc_io,
u32 cmd_flags,
u16 token)
{
- struct mc_command cmd = { 0 };
+ struct fsl_mc_command cmd = { 0 };

/* prepare command */
cmd.header = mc_encode_cmd_header(DPNI_CMDID_DISABLE,
@@ -270,7 +270,7 @@ int dpni_is_enabled(struct fsl_mc_io *mc_io,
u16 token,
int *en)
{
- struct mc_command cmd = { 0 };
+ struct fsl_mc_command cmd = { 0 };
struct dpni_rsp_is_enabled *rsp_params;
int err;

@@ -303,7 +303,7 @@ int dpni_reset(struct fsl_mc_io *mc_io,
u32 cmd_flags,
u16 token)
{
- struct mc_command cmd = { 0 };
+ struct fsl_mc_command cmd = { 0 };

/* prepare command */
cmd.header = mc_encode_cmd_header(DPNI_CMDID_RESET,
@@ -335,7 +335,7 @@ int dpni_set_irq_enable(struct fsl_mc_io *mc_io,
u8 irq_index,
u8 en)
{
- struct mc_command cmd = { 0 };
+ struct fsl_mc_command cmd = { 0 };
struct dpni_cmd_set_irq_enable *cmd_params;

/* prepare command */
@@ -366,7 +366,7 @@ int dpni_get_irq_enable(struct fsl_mc_io *mc_io,
u8 irq_index,
u8 *en)
{
- struct mc_command cmd = { 0 };
+ struct fsl_mc_command cmd = { 0 };
struct dpni_cmd_get_irq_enable *cmd_params;
struct dpni_rsp_get_irq_enable *rsp_params;

@@ -413,7 +413,7 @@ int dpni_set_irq_mask(struct fsl_mc_io *mc_io,
u8 irq_index,
u32 mask)
{
- struct mc_command cmd = { 0 };
+ struct fsl_mc_command cmd = { 0 };
struct dpni_cmd_set_irq_mask *cmd_params;

/* prepare command */
@@ -447,7 +447,7 @@ int dpni_get_irq_mask(struct fsl_mc_io *mc_io,
u8 irq_index,
u32 *mask)
{
- struct mc_command cmd = { 0 };
+ struct fsl_mc_command cmd = { 0 };
struct dpni_cmd_get_irq_mask *cmd_params;
struct dpni_rsp_get_irq_mask *rsp_params;
int err;
@@ -489,7 +489,7 @@ int dpni_get_irq_status(struct fsl_mc_io *mc_io,
u8 irq_index,
u32 *status)
{
- struct mc_command cmd = { 0 };
+ struct fsl_mc_command cmd = { 0 };
struct dpni_cmd_get_irq_status *cmd_params;
struct dpni_rsp_get_irq_status *rsp_params;
int err;
@@ -532,7 +532,7 @@ int dpni_clear_irq_status(struct fsl_mc_io *mc_io,
u8 irq_index,
u32 status)
{
- struct mc_command cmd = { 0 };
+ struct fsl_mc_command cmd = { 0 };
struct dpni_cmd_clear_irq_status *cmd_params;

/* prepare command */
@@ -561,7 +561,7 @@ int dpni_get_attributes(struct fsl_mc_io *mc_io,
u16 token,
struct dpni_attr *attr)
{
- struct mc_command cmd = { 0 };
+ struct fsl_mc_command cmd = { 0 };
struct dpni_rsp_get_attr *rsp_params;

int err;
@@ -609,7 +609,7 @@ int dpni_set_errors_behavior(struct fsl_mc_io *mc_io,
u16 token,
struct dpni_error_cfg *cfg)
{
- struct mc_command cmd = { 0 };
+ struct fsl_mc_command cmd = { 0 };
struct dpni_cmd_set_errors_behavior *cmd_params;

/* prepare command */
@@ -641,7 +641,7 @@ int dpni_get_buffer_layout(struct fsl_mc_io *mc_io,
enum dpni_queue_type qtype,
struct dpni_buffer_layout *layout)
{
- struct mc_command cmd = { 0 };
+ struct fsl_mc_command cmd = { 0 };
struct dpni_cmd_get_buffer_layout *cmd_params;
struct dpni_rsp_get_buffer_layout *rsp_params;
int err;
@@ -689,7 +689,7 @@ int dpni_set_buffer_layout(struct fsl_mc_io *mc_io,
enum dpni_queue_type qtype,
const struct dpni_buffer_layout *layout)
{
- struct mc_command cmd = { 0 };
+ struct fsl_mc_command cmd = { 0 };
struct dpni_cmd_set_buffer_layout *cmd_params;

/* prepare command */
@@ -731,7 +731,7 @@ int dpni_set_offload(struct fsl_mc_io *mc_io,
enum dpni_offload type,
u32 config)
{
- struct mc_command cmd = { 0 };
+ struct fsl_mc_command cmd = { 0 };
struct dpni_cmd_set_offload *cmd_params;

cmd.header = mc_encode_cmd_header(DPNI_CMDID_SET_OFFLOAD,
@@ -750,7 +750,7 @@ int dpni_get_offload(struct fsl_mc_io *mc_io,
enum dpni_offload type,
u32 *config)
{
- struct mc_command cmd = { 0 };
+ struct fsl_mc_command cmd = { 0 };
struct dpni_cmd_get_offload *cmd_params;
struct dpni_rsp_get_offload *rsp_params;
int err;
@@ -792,7 +792,7 @@ int dpni_get_qdid(struct fsl_mc_io *mc_io,
enum dpni_queue_type qtype,
u16 *qdid)
{
- struct mc_command cmd = { 0 };
+ struct fsl_mc_command cmd = { 0 };
struct dpni_cmd_get_qdid *cmd_params;
struct dpni_rsp_get_qdid *rsp_params;
int err;
@@ -830,7 +830,7 @@ int dpni_get_tx_data_offset(struct fsl_mc_io *mc_io,
u16 token,
u16 *data_offset)
{
- struct mc_command cmd = { 0 };
+ struct fsl_mc_command cmd = { 0 };
struct dpni_rsp_get_tx_data_offset *rsp_params;
int err;

@@ -865,7 +865,7 @@ int dpni_set_link_cfg(struct fsl_mc_io *mc_io,
u16 token,
const struct dpni_link_cfg *cfg)
{
- struct mc_command cmd = { 0 };
+ struct fsl_mc_command cmd = { 0 };
struct dpni_cmd_set_link_cfg *cmd_params;

/* prepare command */
@@ -894,7 +894,7 @@ int dpni_get_link_state(struct fsl_mc_io *mc_io,
u16 token,
struct dpni_link_state *state)
{
- struct mc_command cmd = { 0 };
+ struct fsl_mc_command cmd = { 0 };
struct dpni_rsp_get_link_state *rsp_params;
int err;

@@ -933,7 +933,7 @@ int dpni_set_max_frame_length(struct fsl_mc_io *mc_io,
u16 token,
u16 max_frame_length)
{
- struct mc_command cmd = { 0 };
+ struct fsl_mc_command cmd = { 0 };
struct dpni_cmd_set_max_frame_length *cmd_params;

/* prepare command */
@@ -963,7 +963,7 @@ int dpni_get_max_frame_length(struct fsl_mc_io *mc_io,
u16 token,
u16 *max_frame_length)
{
- struct mc_command cmd = { 0 };
+ struct fsl_mc_command cmd = { 0 };
struct dpni_rsp_get_max_frame_length *rsp_params;
int err;

@@ -998,7 +998,7 @@ int dpni_set_multicast_promisc(struct fsl_mc_io *mc_io,
u16 token,
int en)
{
- struct mc_command cmd = { 0 };
+ struct fsl_mc_command cmd = { 0 };
struct dpni_cmd_set_multicast_promisc *cmd_params;

/* prepare command */
@@ -1026,7 +1026,7 @@ int dpni_get_multicast_promisc(struct fsl_mc_io *mc_io,
u16 token,
int *en)
{
- struct mc_command cmd = { 0 };
+ struct fsl_mc_command cmd = { 0 };
struct dpni_rsp_get_multicast_promisc *rsp_params;
int err;

@@ -1061,7 +1061,7 @@ int dpni_set_unicast_promisc(struct fsl_mc_io *mc_io,
u16 token,
int en)
{
- struct mc_command cmd = { 0 };
+ struct fsl_mc_command cmd = { 0 };
struct dpni_cmd_set_unicast_promisc *cmd_params;

/* prepare command */
@@ -1089,7 +1089,7 @@ int dpni_get_unicast_promisc(struct fsl_mc_io *mc_io,
u16 token,
int *en)
{
- struct mc_command cmd = { 0 };
+ struct fsl_mc_command cmd = { 0 };
struct dpni_rsp_get_unicast_promisc *rsp_params;
int err;

@@ -1124,7 +1124,7 @@ int dpni_set_primary_mac_addr(struct fsl_mc_io *mc_io,
u16 token,
const u8 mac_addr[6])
{
- struct mc_command cmd = { 0 };
+ struct fsl_mc_command cmd = { 0 };
struct dpni_cmd_set_primary_mac_addr *cmd_params;
int i;

@@ -1154,7 +1154,7 @@ int dpni_get_primary_mac_addr(struct fsl_mc_io *mc_io,
u16 token,
u8 mac_addr[6])
{
- struct mc_command cmd = { 0 };
+ struct fsl_mc_command cmd = { 0 };
struct dpni_rsp_get_primary_mac_addr *rsp_params;
int i, err;

@@ -1193,7 +1193,7 @@ int dpni_get_port_mac_addr(struct fsl_mc_io *mc_io,
u16 token,
u8 mac_addr[6])
{
- struct mc_command cmd = { 0 };
+ struct fsl_mc_command cmd = { 0 };
struct dpni_rsp_get_port_mac_addr *rsp_params;
int i, err;

@@ -1229,7 +1229,7 @@ int dpni_add_mac_addr(struct fsl_mc_io *mc_io,
u16 token,
const u8 mac_addr[6])
{
- struct mc_command cmd = { 0 };
+ struct fsl_mc_command cmd = { 0 };
struct dpni_cmd_add_mac_addr *cmd_params;
int i;

@@ -1259,7 +1259,7 @@ int dpni_remove_mac_addr(struct fsl_mc_io *mc_io,
u16 token,
const u8 mac_addr[6])
{
- struct mc_command cmd = { 0 };
+ struct fsl_mc_command cmd = { 0 };
struct dpni_cmd_remove_mac_addr *cmd_params;
int i;

@@ -1293,7 +1293,7 @@ int dpni_clear_mac_filters(struct fsl_mc_io *mc_io,
int unicast,
int multicast)
{
- struct mc_command cmd = { 0 };
+ struct fsl_mc_command cmd = { 0 };
struct dpni_cmd_clear_mac_filters *cmd_params;

/* prepare command */
@@ -1327,7 +1327,7 @@ int dpni_set_rx_tc_dist(struct fsl_mc_io *mc_io,
u8 tc_id,
const struct dpni_rx_tc_dist_cfg *cfg)
{
- struct mc_command cmd = { 0 };
+ struct fsl_mc_command cmd = { 0 };
struct dpni_cmd_set_rx_tc_dist *cmd_params;

/* prepare command */
@@ -1371,7 +1371,7 @@ int dpni_set_queue(struct fsl_mc_io *mc_io,
u8 options,
const struct dpni_queue *queue)
{
- struct mc_command cmd = { 0 };
+ struct fsl_mc_command cmd = { 0 };
struct dpni_cmd_set_queue *cmd_params;

/* prepare command */
@@ -1419,7 +1419,7 @@ int dpni_get_queue(struct fsl_mc_io *mc_io,
struct dpni_queue *queue,
struct dpni_queue_id *qid)
{
- struct mc_command cmd = { 0 };
+ struct fsl_mc_command cmd = { 0 };
struct dpni_cmd_get_queue *cmd_params;
struct dpni_rsp_get_queue *rsp_params;
int err;
@@ -1473,7 +1473,7 @@ int dpni_get_statistics(struct fsl_mc_io *mc_io,
u8 page,
union dpni_statistics *stat)
{
- struct mc_command cmd = { 0 };
+ struct fsl_mc_command cmd = { 0 };
struct dpni_cmd_get_statistics *cmd_params;
struct dpni_rsp_get_statistics *rsp_params;
int i, err;
@@ -1522,7 +1522,7 @@ int dpni_set_taildrop(struct fsl_mc_io *mc_io,
u8 index,
struct dpni_taildrop *taildrop)
{
- struct mc_command cmd = { 0 };
+ struct fsl_mc_command cmd = { 0 };
struct dpni_cmd_set_taildrop *cmd_params;

/* prepare command */
@@ -1566,7 +1566,7 @@ int dpni_get_taildrop(struct fsl_mc_io *mc_io,
u8 index,
struct dpni_taildrop *taildrop)
{
- struct mc_command cmd = { 0 };
+ struct fsl_mc_command cmd = { 0 };
struct dpni_cmd_get_taildrop *cmd_params;
struct dpni_rsp_get_taildrop *rsp_params;
int err;
@@ -1610,7 +1610,7 @@ int dpni_get_api_version(struct fsl_mc_io *mc_io,
u16 *minor_ver)
{
struct dpni_rsp_get_api_version *rsp_params;
- struct mc_command cmd = { 0 };
+ struct fsl_mc_command cmd = { 0 };
int err;

cmd.header = mc_encode_cmd_header(DPNI_CMDID_GET_API_VERSION,
diff --git a/drivers/staging/fsl-dpaa2/ethsw/dpsw.c b/drivers/staging/fsl-dpaa2/ethsw/dpsw.c
index aefa52f..9b9bc60 100644
--- a/drivers/staging/fsl-dpaa2/ethsw/dpsw.c
+++ b/drivers/staging/fsl-dpaa2/ethsw/dpsw.c
@@ -43,7 +43,7 @@ int dpsw_open(struct fsl_mc_io *mc_io,
int dpsw_id,
u16 *token)
{
- struct mc_command cmd = { 0 };
+ struct fsl_mc_command cmd = { 0 };
struct dpsw_cmd_open *cmd_params;
int err;

@@ -80,7 +80,7 @@ int dpsw_close(struct fsl_mc_io *mc_io,
u32 cmd_flags,
u16 token)
{
- struct mc_command cmd = { 0 };
+ struct fsl_mc_command cmd = { 0 };

/* prepare command */
cmd.header = mc_encode_cmd_header(DPSW_CMDID_CLOSE,
@@ -103,7 +103,7 @@ int dpsw_enable(struct fsl_mc_io *mc_io,
u32 cmd_flags,
u16 token)
{
- struct mc_command cmd = { 0 };
+ struct fsl_mc_command cmd = { 0 };

/* prepare command */
cmd.header = mc_encode_cmd_header(DPSW_CMDID_ENABLE,
@@ -126,7 +126,7 @@ int dpsw_disable(struct fsl_mc_io *mc_io,
u32 cmd_flags,
u16 token)
{
- struct mc_command cmd = { 0 };
+ struct fsl_mc_command cmd = { 0 };

/* prepare command */
cmd.header = mc_encode_cmd_header(DPSW_CMDID_DISABLE,
@@ -149,7 +149,7 @@ int dpsw_reset(struct fsl_mc_io *mc_io,
u32 cmd_flags,
u16 token)
{
- struct mc_command cmd = { 0 };
+ struct fsl_mc_command cmd = { 0 };

/* prepare command */
cmd.header = mc_encode_cmd_header(DPSW_CMDID_RESET,
@@ -181,7 +181,7 @@ int dpsw_set_irq_enable(struct fsl_mc_io *mc_io,
u8 irq_index,
u8 en)
{
- struct mc_command cmd = { 0 };
+ struct fsl_mc_command cmd = { 0 };
struct dpsw_cmd_set_irq_enable *cmd_params;

/* prepare command */
@@ -218,7 +218,7 @@ int dpsw_set_irq_mask(struct fsl_mc_io *mc_io,
u8 irq_index,
u32 mask)
{
- struct mc_command cmd = { 0 };
+ struct fsl_mc_command cmd = { 0 };
struct dpsw_cmd_set_irq_mask *cmd_params;

/* prepare command */
@@ -251,7 +251,7 @@ int dpsw_get_irq_status(struct fsl_mc_io *mc_io,
u8 irq_index,
u32 *status)
{
- struct mc_command cmd = { 0 };
+ struct fsl_mc_command cmd = { 0 };
struct dpsw_cmd_get_irq_status *cmd_params;
struct dpsw_rsp_get_irq_status *rsp_params;
int err;
@@ -294,7 +294,7 @@ int dpsw_clear_irq_status(struct fsl_mc_io *mc_io,
u8 irq_index,
u32 status)
{
- struct mc_command cmd = { 0 };
+ struct fsl_mc_command cmd = { 0 };
struct dpsw_cmd_clear_irq_status *cmd_params;

/* prepare command */
@@ -323,7 +323,7 @@ int dpsw_get_attributes(struct fsl_mc_io *mc_io,
u16 token,
struct dpsw_attr *attr)
{
- struct mc_command cmd = { 0 };
+ struct fsl_mc_command cmd = { 0 };
struct dpsw_rsp_get_attr *rsp_params;
int err;

@@ -373,7 +373,7 @@ int dpsw_if_set_link_cfg(struct fsl_mc_io *mc_io,
u16 if_id,
struct dpsw_link_cfg *cfg)
{
- struct mc_command cmd = { 0 };
+ struct fsl_mc_command cmd = { 0 };
struct dpsw_cmd_if_set_link_cfg *cmd_params;

/* prepare command */
@@ -405,7 +405,7 @@ int dpsw_if_get_link_state(struct fsl_mc_io *mc_io,
u16 if_id,
struct dpsw_link_state *state)
{
- struct mc_command cmd = { 0 };
+ struct fsl_mc_command cmd = { 0 };
struct dpsw_cmd_if_get_link_state *cmd_params;
struct dpsw_rsp_if_get_link_state *rsp_params;
int err;
@@ -447,7 +447,7 @@ int dpsw_if_set_flooding(struct fsl_mc_io *mc_io,
u16 if_id,
u8 en)
{
- struct mc_command cmd = { 0 };
+ struct fsl_mc_command cmd = { 0 };
struct dpsw_cmd_if_set_flooding *cmd_params;

/* prepare command */
@@ -478,7 +478,7 @@ int dpsw_if_set_broadcast(struct fsl_mc_io *mc_io,
u16 if_id,
u8 en)
{
- struct mc_command cmd = { 0 };
+ struct fsl_mc_command cmd = { 0 };
struct dpsw_cmd_if_set_broadcast *cmd_params;

/* prepare command */
@@ -509,7 +509,7 @@ int dpsw_if_set_tci(struct fsl_mc_io *mc_io,
u16 if_id,
const struct dpsw_tci_cfg *cfg)
{
- struct mc_command cmd = { 0 };
+ struct fsl_mc_command cmd = { 0 };
struct dpsw_cmd_if_set_tci *cmd_params;
u16 tmp_conf = 0;

@@ -547,7 +547,7 @@ int dpsw_if_set_stp(struct fsl_mc_io *mc_io,
u16 if_id,
const struct dpsw_stp_cfg *cfg)
{
- struct mc_command cmd = { 0 };
+ struct fsl_mc_command cmd = { 0 };
struct dpsw_cmd_if_set_stp *cmd_params;

/* prepare command */
@@ -581,7 +581,7 @@ int dpsw_if_get_counter(struct fsl_mc_io *mc_io,
enum dpsw_counter type,
u64 *counter)
{
- struct mc_command cmd = { 0 };
+ struct fsl_mc_command cmd = { 0 };
struct dpsw_cmd_if_get_counter *cmd_params;
struct dpsw_rsp_if_get_counter *rsp_params;
int err;
@@ -620,7 +620,7 @@ int dpsw_if_enable(struct fsl_mc_io *mc_io,
u16 token,
u16 if_id)
{
- struct mc_command cmd = { 0 };
+ struct fsl_mc_command cmd = { 0 };
struct dpsw_cmd_if *cmd_params;

/* prepare command */
@@ -648,7 +648,7 @@ int dpsw_if_disable(struct fsl_mc_io *mc_io,
u16 token,
u16 if_id)
{
- struct mc_command cmd = { 0 };
+ struct fsl_mc_command cmd = { 0 };
struct dpsw_cmd_if *cmd_params;

/* prepare command */
@@ -678,7 +678,7 @@ int dpsw_if_set_max_frame_length(struct fsl_mc_io *mc_io,
u16 if_id,
u16 frame_length)
{
- struct mc_command cmd = { 0 };
+ struct fsl_mc_command cmd = { 0 };
struct dpsw_cmd_if_set_max_frame_length *cmd_params;

/* prepare command */
@@ -716,7 +716,7 @@ int dpsw_vlan_add(struct fsl_mc_io *mc_io,
u16 vlan_id,
const struct dpsw_vlan_cfg *cfg)
{
- struct mc_command cmd = { 0 };
+ struct fsl_mc_command cmd = { 0 };
struct dpsw_vlan_add *cmd_params;

/* prepare command */
@@ -752,7 +752,7 @@ int dpsw_vlan_add_if(struct fsl_mc_io *mc_io,
u16 vlan_id,
const struct dpsw_vlan_if_cfg *cfg)
{
- struct mc_command cmd = { 0 };
+ struct fsl_mc_command cmd = { 0 };
struct dpsw_cmd_vlan_manage_if *cmd_params;

/* prepare command */
@@ -790,7 +790,7 @@ int dpsw_vlan_add_if_untagged(struct fsl_mc_io *mc_io,
u16 vlan_id,
const struct dpsw_vlan_if_cfg *cfg)
{
- struct mc_command cmd = { 0 };
+ struct fsl_mc_command cmd = { 0 };
struct dpsw_cmd_vlan_manage_if *cmd_params;

/* prepare command */
@@ -824,7 +824,7 @@ int dpsw_vlan_remove_if(struct fsl_mc_io *mc_io,
u16 vlan_id,
const struct dpsw_vlan_if_cfg *cfg)
{
- struct mc_command cmd = { 0 };
+ struct fsl_mc_command cmd = { 0 };
struct dpsw_cmd_vlan_manage_if *cmd_params;

/* prepare command */
@@ -860,7 +860,7 @@ int dpsw_vlan_remove_if_untagged(struct fsl_mc_io *mc_io,
u16 vlan_id,
const struct dpsw_vlan_if_cfg *cfg)
{
- struct mc_command cmd = { 0 };
+ struct fsl_mc_command cmd = { 0 };
struct dpsw_cmd_vlan_manage_if *cmd_params;

/* prepare command */
@@ -889,7 +889,7 @@ int dpsw_vlan_remove(struct fsl_mc_io *mc_io,
u16 token,
u16 vlan_id)
{
- struct mc_command cmd = { 0 };
+ struct fsl_mc_command cmd = { 0 };
struct dpsw_cmd_vlan_remove *cmd_params;

/* prepare command */
@@ -919,7 +919,7 @@ int dpsw_fdb_add_unicast(struct fsl_mc_io *mc_io,
u16 fdb_id,
const struct dpsw_fdb_unicast_cfg *cfg)
{
- struct mc_command cmd = { 0 };
+ struct fsl_mc_command cmd = { 0 };
struct dpsw_cmd_fdb_unicast_op *cmd_params;
int i;

@@ -954,7 +954,7 @@ int dpsw_fdb_remove_unicast(struct fsl_mc_io *mc_io,
u16 fdb_id,
const struct dpsw_fdb_unicast_cfg *cfg)
{
- struct mc_command cmd = { 0 };
+ struct fsl_mc_command cmd = { 0 };
struct dpsw_cmd_fdb_unicast_op *cmd_params;
int i;

@@ -996,7 +996,7 @@ int dpsw_fdb_add_multicast(struct fsl_mc_io *mc_io,
u16 fdb_id,
const struct dpsw_fdb_multicast_cfg *cfg)
{
- struct mc_command cmd = { 0 };
+ struct fsl_mc_command cmd = { 0 };
struct dpsw_cmd_fdb_multicast_op *cmd_params;
int i;

@@ -1038,7 +1038,7 @@ int dpsw_fdb_remove_multicast(struct fsl_mc_io *mc_io,
u16 fdb_id,
const struct dpsw_fdb_multicast_cfg *cfg)
{
- struct mc_command cmd = { 0 };
+ struct fsl_mc_command cmd = { 0 };
struct dpsw_cmd_fdb_multicast_op *cmd_params;
int i;

@@ -1074,7 +1074,7 @@ int dpsw_fdb_set_learning_mode(struct fsl_mc_io *mc_io,
u16 fdb_id,
enum dpsw_fdb_learning_mode mode)
{
- struct mc_command cmd = { 0 };
+ struct fsl_mc_command cmd = { 0 };
struct dpsw_cmd_fdb_set_learning_mode *cmd_params;

/* prepare command */
@@ -1103,7 +1103,7 @@ int dpsw_get_api_version(struct fsl_mc_io *mc_io,
u16 *major_ver,
u16 *minor_ver)
{
- struct mc_command cmd = { 0 };
+ struct fsl_mc_command cmd = { 0 };
struct dpsw_rsp_get_api_version *rsp_params;
int err;

diff --git a/drivers/staging/fsl-mc/bus/dpio/dpio.c b/drivers/staging/fsl-mc/bus/dpio/dpio.c
index 3175057..ff37c80 100644
--- a/drivers/staging/fsl-mc/bus/dpio/dpio.c
+++ b/drivers/staging/fsl-mc/bus/dpio/dpio.c
@@ -37,7 +37,7 @@ int dpio_open(struct fsl_mc_io *mc_io,
int dpio_id,
u16 *token)
{
- struct mc_command cmd = { 0 };
+ struct fsl_mc_command cmd = { 0 };
struct dpio_cmd_open *dpio_cmd;
int err;

@@ -70,7 +70,7 @@ int dpio_close(struct fsl_mc_io *mc_io,
u32 cmd_flags,
u16 token)
{
- struct mc_command cmd = { 0 };
+ struct fsl_mc_command cmd = { 0 };

/* prepare command */
cmd.header = mc_encode_cmd_header(DPIO_CMDID_CLOSE,
@@ -92,7 +92,7 @@ int dpio_enable(struct fsl_mc_io *mc_io,
u32 cmd_flags,
u16 token)
{
- struct mc_command cmd = { 0 };
+ struct fsl_mc_command cmd = { 0 };

/* prepare command */
cmd.header = mc_encode_cmd_header(DPIO_CMDID_ENABLE,
@@ -114,7 +114,7 @@ int dpio_disable(struct fsl_mc_io *mc_io,
u32 cmd_flags,
u16 token)
{
- struct mc_command cmd = { 0 };
+ struct fsl_mc_command cmd = { 0 };

/* prepare command */
cmd.header = mc_encode_cmd_header(DPIO_CMDID_DISABLE,
@@ -138,7 +138,7 @@ int dpio_get_attributes(struct fsl_mc_io *mc_io,
u16 token,
struct dpio_attr *attr)
{
- struct mc_command cmd = { 0 };
+ struct fsl_mc_command cmd = { 0 };
struct dpio_rsp_get_attr *dpio_rsp;
int err;

@@ -180,7 +180,7 @@ int dpio_get_api_version(struct fsl_mc_io *mc_io,
u16 *major_ver,
u16 *minor_ver)
{
- struct mc_command cmd = { 0 };
+ struct fsl_mc_command cmd = { 0 };
int err;

/* prepare command */
diff --git a/include/linux/fsl/mc.h b/include/linux/fsl/mc.h
index cfb1fbf..f27cb14 100644
--- a/include/linux/fsl/mc.h
+++ b/include/linux/fsl/mc.h
@@ -209,7 +209,7 @@ struct mc_cmd_header {
__le16 cmd_id;
};

-struct mc_command {
+struct fsl_mc_command {
u64 header;
u64 params[MC_CMD_NUM_OF_PARAMS];
};
@@ -256,7 +256,7 @@ static inline u64 mc_encode_cmd_header(u16 cmd_id,
return header;
}

-static inline u16 mc_cmd_hdr_read_token(struct mc_command *cmd)
+static inline u16 mc_cmd_hdr_read_token(struct fsl_mc_command *cmd)
{
struct mc_cmd_header *hdr = (struct mc_cmd_header *)&cmd->header;
u16 token = le16_to_cpu(hdr->token);
@@ -273,7 +273,7 @@ struct mc_rsp_api_ver {
__le16 minor_ver;
};

-static inline u32 mc_cmd_read_object_id(struct mc_command *cmd)
+static inline u32 mc_cmd_read_object_id(struct fsl_mc_command *cmd)
{
struct mc_rsp_create *rsp_params;

@@ -281,7 +281,7 @@ static inline u32 mc_cmd_read_object_id(struct mc_command *cmd)
return le32_to_cpu(rsp_params->object_id);
}

-static inline void mc_cmd_read_api_version(struct mc_command *cmd,
+static inline void mc_cmd_read_api_version(struct fsl_mc_command *cmd,
u16 *major_ver,
u16 *minor_ver)
{
@@ -342,7 +342,7 @@ struct fsl_mc_io {
};
};

-int mc_send_command(struct fsl_mc_io *mc_io, struct mc_command *cmd);
+int mc_send_command(struct fsl_mc_io *mc_io, struct fsl_mc_command *cmd);

#ifdef CONFIG_FSL_MC_BUS
#define dev_is_fsl_mc(_dev) ((_dev)->bus == &fsl_mc_bus_type)
--
1.9.1


2018-03-15 17:11:35

by Ioana Ciornei

[permalink] [raw]
Subject: [PATCH v2 5/6] bus: fsl-mc: add root dprc rescan attribute

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 <[email protected]>
---
Changes in v2:
- added proper documentation in /Documentation/ABI/
- updated the MAINTAINERS file

Documentation/ABI/stable/sysfs-bus-fsl-mc | 6 ++++++
MAINTAINERS | 1 +
drivers/bus/fsl-mc/dprc-driver.c | 4 ++--
drivers/bus/fsl-mc/fsl-mc-bus.c | 28 ++++++++++++++++++++++++++++
drivers/bus/fsl-mc/fsl-mc-private.h | 3 +++
5 files changed, 40 insertions(+), 2 deletions(-)
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..e530e8c
--- /dev/null
+++ b/Documentation/ABI/stable/sysfs-bus-fsl-mc
@@ -0,0 +1,6 @@
+What: /sys/bus/fsl-mc/devices/dprc.*/rescan
+Date: March. 2018
+KernelVersion: 4.16
+Contact: Ioana Ciornei <[email protected]>
+Description: Root dprc rescan attribute
+Users: Userspace drivers and management tools
diff --git a/MAINTAINERS b/MAINTAINERS
index 4f54765..1268b42 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -11464,6 +11464,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

QT1010 MEDIA DRIVER
M: Antti Palosaari <[email protected]>
diff --git a/drivers/bus/fsl-mc/dprc-driver.c b/drivers/bus/fsl-mc/dprc-driver.c
index 52c7e15..be80e3a 100644
--- a/drivers/bus/fsl-mc/dprc-driver.c
+++ b/drivers/bus/fsl-mc/dprc-driver.c
@@ -214,8 +214,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,
- unsigned int *total_irq_count)
+int dprc_scan_objects(struct fsl_mc_device *mc_bus_dev,
+ unsigned int *total_irq_count)
{
int num_child_objects;
int dprc_get_obj_failures;
diff --git a/drivers/bus/fsl-mc/fsl-mc-bus.c b/drivers/bus/fsl-mc/fsl-mc-bus.c
index 0ade415..9d02984 100644
--- a/drivers/bus/fsl-mc/fsl-mc-bus.c
+++ b/drivers/bus/fsl-mc/fsl-mc-bus.c
@@ -137,8 +137,36 @@ static ssize_t modalias_show(struct device *dev, struct device_attribute *attr,
}
static DEVICE_ATTR_RO(modalias);

+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 = to_fsl_mc_device(dev);
+ root_mc_bus = 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);
+
static struct attribute *fsl_mc_dev_attrs[] = {
&dev_attr_modalias.attr,
+ &dev_attr_rescan.attr,
NULL,
};

diff --git a/drivers/bus/fsl-mc/fsl-mc-private.h b/drivers/bus/fsl-mc/fsl-mc-private.h
index 00cca7d..c1fc80e 100644
--- a/drivers/bus/fsl-mc/fsl-mc-private.h
+++ b/drivers/bus/fsl-mc/fsl-mc-private.h
@@ -545,6 +545,9 @@ int __must_check fsl_mc_device_add(struct fsl_mc_obj_desc *obj_desc,

void dprc_driver_exit(void);

+int dprc_scan_objects(struct fsl_mc_device *mc_bus_dev,
+ unsigned int *total_irq_count);
+
int __init fsl_mc_allocator_driver_init(void);

void fsl_mc_allocator_driver_exit(void);
--
1.9.1


2018-03-15 17:11:44

by Ioana Ciornei

[permalink] [raw]
Subject: [PATCH v2 3/6] bus: fsl-mc: add fsl_mc_allocator cleanup function

The userspace support for fsl-mc requires a fsl_mc_allocator
cleanup function. Add the needed function.

Signed-off-by: Ioana Ciornei <[email protected]>
---
Changes in v2:
- added the patch itself

drivers/bus/fsl-mc/fsl-mc-allocator.c | 5 +++++
drivers/bus/fsl-mc/fsl-mc-private.h | 2 ++
2 files changed, 7 insertions(+)

diff --git a/drivers/bus/fsl-mc/fsl-mc-allocator.c b/drivers/bus/fsl-mc/fsl-mc-allocator.c
index 452c5d7..fb1442b 100644
--- a/drivers/bus/fsl-mc/fsl-mc-allocator.c
+++ b/drivers/bus/fsl-mc/fsl-mc-allocator.c
@@ -646,3 +646,8 @@ int __init fsl_mc_allocator_driver_init(void)
{
return fsl_mc_driver_register(&fsl_mc_allocator_driver);
}
+
+void fsl_mc_allocator_driver_exit(void)
+{
+ fsl_mc_driver_unregister(&fsl_mc_allocator_driver);
+}
diff --git a/drivers/bus/fsl-mc/fsl-mc-private.h b/drivers/bus/fsl-mc/fsl-mc-private.h
index 52c069d..ea11b4f 100644
--- a/drivers/bus/fsl-mc/fsl-mc-private.h
+++ b/drivers/bus/fsl-mc/fsl-mc-private.h
@@ -525,6 +525,8 @@ int __must_check fsl_mc_device_add(struct fsl_mc_obj_desc *obj_desc,

int __init fsl_mc_allocator_driver_init(void);

+void fsl_mc_allocator_driver_exit(void);
+
void fsl_mc_init_all_resource_pools(struct fsl_mc_device *mc_bus_dev);

void fsl_mc_cleanup_all_resource_pools(struct fsl_mc_device *mc_bus_dev);
--
1.9.1


2018-03-15 17:11:54

by Ioana Ciornei

[permalink] [raw]
Subject: [PATCH v2 2/6] bus: fsl-mc: move fsl_mc_command struct in a uapi header

Define "struct fsl_mc_command" as a structure that can cross the
user/kernel boundary. Also change the variable types used with
the proper ones.

Signed-off-by: Ioana Ciornei <[email protected]>
---
Changes in v2:
- added the patch itself

MAINTAINERS | 1 +
include/linux/fsl/mc.h | 8 +-------
include/uapi/linux/fsl_mc.h | 23 +++++++++++++++++++++++
3 files changed, 25 insertions(+), 7 deletions(-)
create mode 100644 include/uapi/linux/fsl_mc.h

diff --git a/MAINTAINERS b/MAINTAINERS
index 473ac00..4f54765 100644
--- a/MAINTAINERS
+++ b/MAINTAINERS
@@ -11463,6 +11463,7 @@ S: Maintained
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

QT1010 MEDIA DRIVER
M: Antti Palosaari <[email protected]>
diff --git a/include/linux/fsl/mc.h b/include/linux/fsl/mc.h
index f27cb14..19a352b 100644
--- a/include/linux/fsl/mc.h
+++ b/include/linux/fsl/mc.h
@@ -12,6 +12,7 @@
#include <linux/device.h>
#include <linux/mod_devicetable.h>
#include <linux/interrupt.h>
+#include <uapi/linux/fsl_mc.h>

#define FSL_MC_VENDOR_FREESCALE 0x1957

@@ -198,8 +199,6 @@ struct fsl_mc_device {
#define to_fsl_mc_device(_dev) \
container_of(_dev, struct fsl_mc_device, dev)

-#define MC_CMD_NUM_OF_PARAMS 7
-
struct mc_cmd_header {
u8 src_id;
u8 flags_hw;
@@ -209,11 +208,6 @@ struct mc_cmd_header {
__le16 cmd_id;
};

-struct fsl_mc_command {
- u64 header;
- u64 params[MC_CMD_NUM_OF_PARAMS];
-};
-
enum mc_cmd_status {
MC_CMD_STATUS_OK = 0x0, /* Completed successfully */
MC_CMD_STATUS_READY = 0x1, /* Ready to be processed */
diff --git a/include/uapi/linux/fsl_mc.h b/include/uapi/linux/fsl_mc.h
new file mode 100644
index 0000000..90892c4
--- /dev/null
+++ b/include/uapi/linux/fsl_mc.h
@@ -0,0 +1,23 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Management Complex (MC) userspace public interface
+ *
+ * Copyright 2018 NXP
+ *
+ */
+#ifndef _UAPI_FSL_MC_H_
+#define _UAPI_FSL_MC_H_
+
+#define MC_CMD_NUM_OF_PARAMS 7
+
+/**
+ * struct fsl_mc_command - Management Complex (MC) command structure
+ * @header: MC command header
+ * @params: MC command parameters
+ */
+struct fsl_mc_command {
+ __u64 header;
+ __u64 params[MC_CMD_NUM_OF_PARAMS];
+};
+
+#endif /* _UAPI_FSL_MC_H_ */
--
1.9.1


2018-03-23 14:21:58

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH v2 2/6] bus: fsl-mc: move fsl_mc_command struct in a uapi header

On Thu, Mar 15, 2018 at 12:05:32PM -0500, Ioana Ciornei wrote:
> Define "struct fsl_mc_command" as a structure that can cross the
> user/kernel boundary. Also change the variable types used with
> the proper ones.
>
> Signed-off-by: Ioana Ciornei <[email protected]>
> ---
> Changes in v2:
> - added the patch itself
>
> MAINTAINERS | 1 +
> include/linux/fsl/mc.h | 8 +-------
> include/uapi/linux/fsl_mc.h | 23 +++++++++++++++++++++++
> 3 files changed, 25 insertions(+), 7 deletions(-)
> create mode 100644 include/uapi/linux/fsl_mc.h
>
> diff --git a/MAINTAINERS b/MAINTAINERS
> index 473ac00..4f54765 100644
> --- a/MAINTAINERS
> +++ b/MAINTAINERS
> @@ -11463,6 +11463,7 @@ S: Maintained
> 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
>
> QT1010 MEDIA DRIVER
> M: Antti Palosaari <[email protected]>
> diff --git a/include/linux/fsl/mc.h b/include/linux/fsl/mc.h
> index f27cb14..19a352b 100644
> --- a/include/linux/fsl/mc.h
> +++ b/include/linux/fsl/mc.h
> @@ -12,6 +12,7 @@
> #include <linux/device.h>
> #include <linux/mod_devicetable.h>
> #include <linux/interrupt.h>
> +#include <uapi/linux/fsl_mc.h>
>
> #define FSL_MC_VENDOR_FREESCALE 0x1957
>
> @@ -198,8 +199,6 @@ struct fsl_mc_device {
> #define to_fsl_mc_device(_dev) \
> container_of(_dev, struct fsl_mc_device, dev)
>
> -#define MC_CMD_NUM_OF_PARAMS 7
> -
> struct mc_cmd_header {
> u8 src_id;
> u8 flags_hw;
> @@ -209,11 +208,6 @@ struct mc_cmd_header {
> __le16 cmd_id;
> };
>
> -struct fsl_mc_command {
> - u64 header;
> - u64 params[MC_CMD_NUM_OF_PARAMS];
> -};
> -
> enum mc_cmd_status {
> MC_CMD_STATUS_OK = 0x0, /* Completed successfully */
> MC_CMD_STATUS_READY = 0x1, /* Ready to be processed */
> diff --git a/include/uapi/linux/fsl_mc.h b/include/uapi/linux/fsl_mc.h
> new file mode 100644
> index 0000000..90892c4
> --- /dev/null
> +++ b/include/uapi/linux/fsl_mc.h
> @@ -0,0 +1,23 @@
> +/* SPDX-License-Identifier: GPL-2.0 */

UAPI files should have the correct license on them:
/* SPDX-License-Identifier: GPL-2.0 WITH Linux-syscall-note */

thanks,

greg k-h

2018-03-23 14:55:32

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH v2 0/6] bus: fsl-mc: enhance Management Complex userspace support

On Thu, Mar 15, 2018 at 12:05:30PM -0500, Ioana Ciornei wrote:
> This patch set adds restool support in fsl-mc bus along
> with a rescan attribute to the root DPRC container.
>
> Changes in v2:
> - changed mc_command in fsl_mc_command structure
> - updated fsl_mc_command to use the proper types and moved it in uapi
> - added proper sysfs documentation

I've applied patches 1 and 3 here, can you redo patch 2 and resend them
based on my tree?

thanks,

greg k-h

2018-03-23 15:11:29

by Ioana Ciornei

[permalink] [raw]
Subject: RE: [PATCH v2 0/6] bus: fsl-mc: enhance Management Complex userspace support

> > This patch set adds restool support in fsl-mc bus along with a rescan
> > attribute to the root DPRC container.
> >
> > Changes in v2:
> > - changed mc_command in fsl_mc_command structure
> > - updated fsl_mc_command to use the proper types and moved it in uapi
> > - added proper sysfs documentation
>
> I've applied patches 1 and 3 here, can you redo patch 2 and resend them based
> on my tree?

Yes, sure. I will send the updated patch set right away.

>
> thanks,
>
> greg k-h