The vfio-mc bus driver needs some additional services to be exported by the
mc-bus driver like:
- a way to reset the DPRC container
- driver_override support
- functions to setup/tear down a DPRC
- functions for allocating the pool of interrupts. In case of VFIO the
interrupts are not configured at probe time, but later by userspace
request
v3 -> v4
- Rebased on the latest kernel.
- Exported a dprc_remove function
v2 -> v3
- Add a new version for dprc_get_obj_region
- Export the cacheability bus specific bits defines
v1 -> v2
- Remove driver_override propagation through various functions
- Cache the DPRC API version
The patches are related with "vfio/fsl-mc: VFIO support for FSL-MC
devices" patches, but the series were split because they are targeting
different subsystems. However, the mc-bus patches may suffer changes
when addressing the VFIO review comments.
The patches do not address the comment regarding moving driver_override
in the core code. I prefer not to tie these patches on that change and
address that separately.
Bharat Bhushan (3):
bus/fsl-mc: add support for 'driver_override' in the mc-bus
bus/fsl-mc: Add dprc-reset-container support
bus/fsl-mc: Extend ICID size from 16bit to 32bit
Diana Craciun (10):
bus/fsl-mc: Do no longer export the total number of irqs outside
dprc_scan_objects
bus/fsl-mc: Add a new parameter to dprc_scan_objects function
bus/fsl-mc: Set the QMAN/BMAN region flags
bus/fsl-mc: Cache the DPRC API version
bus/fsl-mc: Export dprc_scan/dprc_remove functions to be used by
multiple entities
bus/fsl-mc: Export a cleanup function for DPRC
bus/fsl-mc: Add a container setup function
bus/fsl_mc: Do not rely on caller to provide non NULL mc_io
bus/fsl-mc: Export IRQ pool handling functions to be used by VFIO
bus/fsl-mc: Add a new version for dprc_get_obj_region command
drivers/bus/fsl-mc/dprc-driver.c | 175 ++++++++++++++++----------
drivers/bus/fsl-mc/dprc.c | 141 +++++++++++++++++----
drivers/bus/fsl-mc/fsl-mc-allocator.c | 12 +-
drivers/bus/fsl-mc/fsl-mc-bus.c | 64 +++++++++-
drivers/bus/fsl-mc/fsl-mc-private.h | 31 ++---
drivers/bus/fsl-mc/mc-io.c | 7 +-
include/linux/fsl/mc.h | 41 +++++-
7 files changed, 349 insertions(+), 122 deletions(-)
--
2.17.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
The total number of interrupts is only used for some checks
outside the dprc_scan_objects function. Furthermore, in some
situations the check is made twice. Move the bounds check inside
the function for all situations.
Signed-off-by: Diana Craciun <redacted>
---
drivers/bus/fsl-mc/dprc-driver.c | 30 ++++++++++--------------------
1 file changed, 10 insertions(+), 20 deletions(-)
Prepare the dprc_scan_objects function to be used by
the VFIO mc driver code. The function is used to scan the mc
objects by the bus driver. The same functionality is
needed by the VFIO mc driver, but in this case the
interrupt configuration is delayed until the userspace
configures the interrupts. In order to use the same function
in both drivers add a new parameter.
Signed-off-by: Diana Craciun <redacted>
---
drivers/bus/fsl-mc/dprc-driver.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)
There are already firmware API commands that have multiple
versions. For each multiple version command, another command
to retrieve the API version is issued. This may introduce an important
overhead. The version does not change while the system is running,
so the DPRC API version can be safely cached.
Signed-off-by: Diana Craciun <redacted>
---
drivers/bus/fsl-mc/dprc.c | 30 +++++++++++++++++++++---------
1 file changed, 21 insertions(+), 9 deletions(-)
The IRQ pool handling functions can be used by both DPRC
driver and VFIO. Adapt and export those functions.
Signed-off-by: Diana Craciun <redacted>
---
drivers/bus/fsl-mc/dprc-driver.c | 7 +++----
drivers/bus/fsl-mc/fsl-mc-allocator.c | 12 ++++++++----
drivers/bus/fsl-mc/fsl-mc-private.h | 10 ----------
include/linux/fsl/mc.h | 11 +++++++++++
4 files changed, 22 insertions(+), 18 deletions(-)
@@ -352,10 +352,14 @@ int fsl_mc_populate_irq_pool(struct fsl_mc_bus *mc_bus,structfsl_mc_device_irq*irq_resources;structfsl_mc_device_irq*mc_dev_irq;interror;-structfsl_mc_device*mc_bus_dev=&mc_bus->mc_dev;+structfsl_mc_bus*mc_bus=to_fsl_mc_bus(mc_bus_dev);structfsl_mc_resource_pool*res_pool=&mc_bus->resource_pools[FSL_MC_POOL_IRQ];+/* do nothing if the IRQ pool is already populated */+if(mc_bus->irq_resources)+return0;+if(irq_count==0||irq_count>FSL_MC_IRQ_POOL_MAX_TOTAL_IRQS)return-EINVAL;
From: Bharat Bhushan <redacted>
In virtual machines the device-id range is defined
between 0x10000-0x20000. The reason for using such a
large range is to avoid overlapping with the PCI range.
Signed-off-by: Bharat Bhushan <redacted>
Signed-off-by: Laurentiu Tudor <laurentiu.tudor@nxp.com>
Signed-off-by: Diana Craciun <redacted>
---
drivers/bus/fsl-mc/dprc.c | 2 +-
drivers/bus/fsl-mc/fsl-mc-bus.c | 2 +-
drivers/bus/fsl-mc/fsl-mc-private.h | 5 ++---
include/linux/fsl/mc.h | 2 +-
4 files changed, 5 insertions(+), 6 deletions(-)
The QMAN region is memory mapped, so it should be of type
IORESOURCE_MEM. The region flags bits were wrongly used to
pass additional information. Use the bus specific bits for
this purpose.
Signed-off-by: Diana Craciun <redacted>
---
drivers/bus/fsl-mc/fsl-mc-bus.c | 7 ++-----
drivers/bus/fsl-mc/fsl-mc-private.h | 6 ------
include/linux/fsl/mc.h | 8 ++++++++
3 files changed, 10 insertions(+), 11 deletions(-)
@@ -358,12 +358,6 @@ int dprc_set_obj_irq(struct fsl_mc_io *mc_io,intobj_id,u8irq_index,structdprc_irq_cfg*irq_cfg);--/* Region flags */-/* Cacheable - Indicates that region should be mapped as cacheable */-#define DPRC_REGION_CACHEABLE 0x00000001-#define DPRC_REGION_SHAREABLE 0x00000002-/***enumdprc_region_type-Regiontype*@DPRC_REGION_TYPE_MC_PORTAL:MCportalregion
@@ -148,6 +149,13 @@ struct fsl_mc_obj_desc {*/#define FSL_MC_IS_DPRC 0x0001+/* Region flags */+/* Indicates that region can be mapped as cacheable */+#define FSL_MC_REGION_CACHEABLE 0x00000001++/* Indicates that region can be mapped as shareable */+#define FSL_MC_REGION_SHAREABLE 0x00000002+/***structfsl_mc_device-MCobjectdeviceobject*@dev:Linuxdrivermodeldeviceobject
--
2.17.1
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
From: Bharat Bhushan <redacted>
This patch is required for vfio-fsl-mc meta driver to successfully bind
layerscape container devices for device passthrough. This patch adds
a mechanism to allow a layerscape device to specify a driver rather than
a layerscape driver provide a device match.
Example to allow a device (dprc.1) to specifically bind
with driver (vfio-fsl-mc):-
- echo vfio-fsl-mc > /sys/bus/fsl-mc/devices/dprc.1/driver_override
- echo dprc.1 > /sys/bus/fsl-mc/drivers/fsl_mc_dprc/unbind
- echo dprc.1 > /sys/bus/fsl-mc/drivers/vfio-fsl-mc/bind
Signed-off-by: Bharat Bhushan <redacted>
Signed-off-by: Laurentiu Tudor <laurentiu.tudor@nxp.com>
Signed-off-by: Diana Craciun <redacted>
---
The patche do not address the comment regarding moving driver_override
in the core code. I prefer not to tie these patches on that change and
address that separately.
drivers/bus/fsl-mc/fsl-mc-bus.c | 54 +++++++++++++++++++++++++++++++++
include/linux/fsl/mc.h | 2 ++
2 files changed, 56 insertions(+)
@@ -78,6 +79,12 @@ static int fsl_mc_bus_match(struct device *dev, struct device_driver *drv)structfsl_mc_driver*mc_drv=to_fsl_mc_driver(drv);boolfound=false;+/* When driver_override is set, only bind to the matching driver */+if(mc_dev->driver_override){+found=!strcmp(mc_dev->driver_override,mc_drv->driver.name);+gotoout;+}+if(!mc_drv->match_id_table)gotoout;
Create and export a cleanup function for DPRC. The function
is used by the DPRC driver, but it will be used by the VFIO
driver as well.
Signed-off-by: Diana Craciun <redacted>
---
drivers/bus/fsl-mc/dprc-driver.c | 52 ++++++++++++++++++++++++--------
include/linux/fsl/mc.h | 2 ++
2 files changed, 41 insertions(+), 13 deletions(-)
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. Also the scan mutex initialization
is done when the bus object is created, not in dprc_probe in order
to be used by both VFIO and bus driver.
Similarily dprc_remove_devices is exported to be used by VFIO.
Signed-off-by: Diana Craciun <redacted>
---
drivers/bus/fsl-mc/dprc-driver.c | 26 +++++++++++---------------
drivers/bus/fsl-mc/fsl-mc-bus.c | 1 +
include/linux/fsl/mc.h | 7 +++++++
3 files changed, 19 insertions(+), 15 deletions(-)
The region size reported by the firmware for mc and software
portals was less than allocated by the hardware. This may be
problematic when mmapping the region in user space because the
region size is less than page size. However the size as reserved
by the hardware is 64K.
Signed-off-by: Diana Craciun <redacted>
---
drivers/bus/fsl-mc/dprc.c | 38 ++++++++++++++++++-----------
drivers/bus/fsl-mc/fsl-mc-private.h | 3 +++
2 files changed, 27 insertions(+), 14 deletions(-)
Both DPRC driver and VFIO driver use the same initialization code
for the DPRC. Introduced a new function which groups this
initialization code. The function is exported and may be
used by VFIO as well.
Signed-off-by: Diana Craciun <redacted>
---
drivers/bus/fsl-mc/dprc-driver.c | 65 ++++++++++++++++++++++----------
include/linux/fsl/mc.h | 2 +
2 files changed, 48 insertions(+), 19 deletions(-)
Before destroying the mc_io, check first that it was
allocated.
Signed-off-by: Diana Craciun <redacted>
---
drivers/bus/fsl-mc/mc-io.c | 7 ++++++-
1 file changed, 6 insertions(+), 1 deletion(-)
The vfio-mc bus driver needs some additional services to be exported by the
mc-bus driver like:
- a way to reset the DPRC container
- driver_override support
- functions to setup/tear down a DPRC
- functions for allocating the pool of interrupts. In case of VFIO the
interrupts are not configured at probe time, but later by userspace
request
v3 -> v4
- Rebased on the latest kernel.
- Exported a dprc_remove function
v2 -> v3
- Add a new version for dprc_get_obj_region
- Export the cacheability bus specific bits defines
v1 -> v2
- Remove driver_override propagation through various functions
- Cache the DPRC API version
The patches are related with "vfio/fsl-mc: VFIO support for FSL-MC
devices" patches, but the series were split because they are targeting
different subsystems. However, the mc-bus patches may suffer changes
when addressing the VFIO review comments.
The patches do not address the comment regarding moving driver_override
in the core code. I prefer not to tie these patches on that change and
address that separately.
Bharat Bhushan (3):
bus/fsl-mc: add support for 'driver_override' in the mc-bus
bus/fsl-mc: Add dprc-reset-container support
bus/fsl-mc: Extend ICID size from 16bit to 32bit
Diana Craciun (10):
bus/fsl-mc: Do no longer export the total number of irqs outside
dprc_scan_objects
bus/fsl-mc: Add a new parameter to dprc_scan_objects function
bus/fsl-mc: Set the QMAN/BMAN region flags
bus/fsl-mc: Cache the DPRC API version
bus/fsl-mc: Export dprc_scan/dprc_remove functions to be used by
multiple entities
bus/fsl-mc: Export a cleanup function for DPRC
bus/fsl-mc: Add a container setup function
bus/fsl_mc: Do not rely on caller to provide non NULL mc_io
bus/fsl-mc: Export IRQ pool handling functions to be used by VFIO
bus/fsl-mc: Add a new version for dprc_get_obj_region command
drivers/bus/fsl-mc/dprc-driver.c | 175 ++++++++++++++++----------
drivers/bus/fsl-mc/dprc.c | 141 +++++++++++++++++----
drivers/bus/fsl-mc/fsl-mc-allocator.c | 12 +-
drivers/bus/fsl-mc/fsl-mc-bus.c | 64 +++++++++-
drivers/bus/fsl-mc/fsl-mc-private.h | 31 ++---
drivers/bus/fsl-mc/mc-io.c | 7 +-
include/linux/fsl/mc.h | 41 +++++-
7 files changed, 349 insertions(+), 122 deletions(-)
For the series:
Reviewed-by: Laurentiu Tudor <laurentiu.tudor@nxp.com>
Acked-by: Laurentiu Tudor <laurentiu.tudor@nxp.com>
---
Best Regards, Laurentiu
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel