Re: [PATCH 1/2] vfio/fsl-mc: return -EFAULT if copy_to_user() fails

2020-11-03 Thread Diana Craciun OSS
On 11/2/2020 11:45 PM, Alex Williamson wrote: Thanks, Dan. Diana, can I get an ack for this? Thanks, Yes, sure, I apologize for not doing it earlier. Thanks, Diana Alex On Fri, 23 Oct 2020 14:34:50 +0300 Dan Carpenter wrote: The copy_to_user() function returns the number of bytes

Re: drivers/vfio/fsl-mc/vfio_fsl_mc_intr.c:16:5: warning: no previous prototype for function 'vfio_fsl_mc_irqs_allocate'

2020-11-03 Thread Diana Craciun OSS
Hi, The warning is fixed by this patch: https://www.spinics.net/lists/kvm/msg227575.html The errors are caused by the fact that the vfio fsl-mc patches have a dependency on the fsl-mc bus series. For this particular error the missing patch is: bus/fsl-mc: Export IRQ pool handling functions

Re: [PATCH 2/2] vfio/fsl-mc: prevent underflow in vfio_fsl_mc_mmap()

2020-11-03 Thread Diana Craciun OSS
Acked-by: Diana Craciun On 10/23/2020 2:29 PM, Dan Carpenter wrote: My static analsysis tool complains that the "index" can be negative. There are some checks in do_mmap() which try to prevent underflows but I don't know if they are sufficient for this situation. Either way, mak

Re: [PATCH 1/2] vfio/fsl-mc: return -EFAULT if copy_to_user() fails

2020-11-03 Thread Diana Craciun OSS
Acked-by: Diana Craciun On 10/23/2020 2:34 PM, Dan Carpenter wrote: The copy_to_user() function returns the number of bytes remaining to be copied, but this code should return -EFAULT. Fixes: df747bcd5b21 ("vfio/fsl-mc: Implement VFIO_DEVICE_GET_REGION_INFO ioctl call") Signed-o

[PATCH] vfio/fsl-mc: Make vfio_fsl_mc_irqs_allocate static

2020-10-26 Thread Diana Craciun
of this translation unit int vfio_fsl_mc_irqs_allocate(struct vfio_fsl_mc_device *vdev) Reported-by: kernel test robot Signed-off-by: Diana Craciun --- drivers/vfio/fsl-mc/vfio_fsl_mc_intr.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/vfio/fsl-mc/vfio_fsl_mc_intr.c b

[PATCH v2] vfio/fsl-mc: fix the return of the uninitialized variable ret

2020-10-16 Thread Diana Craciun
for interrupt handling") Reported-by: Colin Ian King Signed-off-by: Diana Craciun --- drivers/vfio/fsl-mc/vfio_fsl_mc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/vfio/fsl-mc/vfio_fsl_mc.c b/drivers/vfio/fsl-mc/vfio_fsl_mc.c index 80fc7f4ed343..0113a980f974 10064

Re: [PATCH] vfio/fsl-mc: fix the return of the uninitialized variable ret

2020-10-16 Thread Diana Craciun OSS
On 10/15/2020 9:52 PM, Alex Williamson wrote: On Thu, 15 Oct 2020 13:22:26 +0100 Colin King wrote: From: Colin Ian King Currently the success path in function vfio_fsl_mc_reflck_attach is returning an uninitialized value in variable ret. Fix this by setting this to zero to indicate success.

[PATCH] vfio/fsl-mc: Fix the dead code in vfio_fsl_mc_set_irq_trigger

2020-10-15 Thread Diana Craciun
Static analysis discovered that some code in vfio_fsl_mc_set_irq_trigger is dead code. Fixed the code by changing the conditions order. Fixes: cc0ee20bd969 ("vfio/fsl-mc: trigger an interrupt via eventfd") Reported-by: Colin Ian King Signed-off-by: Diana Craciun --- drivers/v

Re: linux-next: build failure after merge of the vfio tree

2020-10-14 Thread Diana Craciun OSS
/14/2020 1:16 AM, Stephen Rothwell wrote: Hi Diana, On Tue, 13 Oct 2020 18:56:07 +0300 Diana Craciun OSS wrote: Hi, How does it fail? What's the error? Sorry about that: drivers/vfio/fsl-mc/vfio_fsl_mc_intr.c: In function 'vfio_fsl_mc_set_irq_trigger': drivers/vfio/fsl-mc

Re: linux-next: build failure after merge of the vfio tree

2020-10-13 Thread Diana Craciun OSS
Hi, How does it fail? What's the error? Thanks, Diana On 10/13/2020 6:07 AM, Stephen Rothwell wrote: Hi all, After merging the vfio tree, today's linux-next build (x86_64 allmodconfig) failed like this: Caused by commit cc0ee20bd969 ("vfio/fsl-mc: trigger an interrupt via eventfd")

[PATCH v2] vfio/fsl-mc: Fixed vfio-fsl-mc driver compilation on 32 bit

2020-10-13 Thread Diana Craciun
The FSL_MC_BUS on which the VFIO-FSL-MC driver is dependent on can be compiled on other architectures as well (not only ARM64) including 32 bit architectures. Include linux/io-64-nonatomic-hi-lo.h to make writeq/readq used in the driver available on 32bit platforms. Signed-off-by: Diana Craciun

[PATCH] Fixed vfio-fsl-mc driver compilation on 32 bit

2020-10-13 Thread Diana Craciun
The FSL_MC_BUS on which the VFIO-FSL-MC driver is dependent on can be compiled on other architectures as well (not only ARM64) including 32 bit architectures. Include linux/io-64-nonatomic-hi-lo.h to make writeq/readq used in the driver available on 32bit platforms. Signed-off-by: Diana Craciun

[PATCH v6 05/10] vfio/fsl-mc: Allow userspace to MMAP fsl-mc device MMIO regions

2020-10-05 Thread Diana Craciun
Allow userspace to mmap device regions for direct access of fsl-mc devices. Signed-off-by: Bharat Bhushan Signed-off-by: Diana Craciun --- drivers/vfio/fsl-mc/vfio_fsl_mc.c | 68 ++- 1 file changed, 66 insertions(+), 2 deletions(-) diff --git a/drivers/vfio/fsl-mc

[PATCH v6 02/10] vfio/fsl-mc: Scan DPRC objects on vfio-fsl-mc driver bind

2020-10-05 Thread Diana Craciun
The DPRC (Data Path Resource Container) device is a bus device and has child devices attached to it. When the vfio-fsl-mc driver is probed the DPRC is scanned and the child devices discovered and initialized. Signed-off-by: Bharat Bhushan Signed-off-by: Diana Craciun --- drivers/vfio/fsl-mc

[PATCH v6 06/10] vfio/fsl-mc: Added lock support in preparation for interrupt handling

2020-10-05 Thread Diana Craciun
-by: Diana Craciun --- drivers/vfio/fsl-mc/vfio_fsl_mc.c | 92 +-- drivers/vfio/fsl-mc/vfio_fsl_mc_private.h | 7 +- 2 files changed, 90 insertions(+), 9 deletions(-) diff --git a/drivers/vfio/fsl-mc/vfio_fsl_mc.c b/drivers/vfio/fsl-mc/vfio_fsl_mc.c index 55190a2730fb

[PATCH v6 07/10] vfio/fsl-mc: Add irq infrastructure for fsl-mc devices

2020-10-05 Thread Diana Craciun
This patch adds the skeleton for interrupt support for fsl-mc devices. The interrupts are not yet functional, the functionality will be added by subsequent patches. Signed-off-by: Bharat Bhushan Signed-off-by: Diana Craciun --- drivers/vfio/fsl-mc/Makefile | 2 +- drivers/vfio

[PATCH v6 01/10] vfio/fsl-mc: Add VFIO framework skeleton for fsl-mc devices

2020-10-05 Thread Diana Craciun
about the DPAA2 objects can be found here: Documentation/networking/device_drivers/freescale/dpaa2/overview.rst Signed-off-by: Bharat Bhushan Signed-off-by: Diana Craciun --- MAINTAINERS | 6 + drivers/vfio/Kconfig | 1 + drivers/vfio/Ma

[PATCH v6 08/10] vfio/fsl-mc: trigger an interrupt via eventfd

2020-10-05 Thread Diana Craciun
. However, currently, the contents of a DPRC assigned to the guest cannot be changed at runtime, so this interrupt is not configured. Signed-off-by: Bharat Bhushan Signed-off-by: Diana Craciun --- drivers/vfio/fsl-mc/vfio_fsl_mc.c | 24 +++- drivers/vfio/fsl-mc/vfio_fsl_mc_intr.c

[PATCH v6 04/10] vfio/fsl-mc: Implement VFIO_DEVICE_GET_REGION_INFO ioctl call

2020-10-05 Thread Diana Craciun
Expose to userspace information about the memory regions. Signed-off-by: Bharat Bhushan Signed-off-by: Diana Craciun --- drivers/vfio/fsl-mc/vfio_fsl_mc.c | 79 ++- drivers/vfio/fsl-mc/vfio_fsl_mc_private.h | 18 ++ 2 files changed, 96 insertions(+), 1 deletion

[PATCH v6 10/10] vfio/fsl-mc: Add support for device reset

2020-10-05 Thread Diana Craciun
Currently only resetting the DPRC container is supported which will reset all the objects inside it. Resetting individual objects is possible from the userspace by issueing commands towards MC firmware. Signed-off-by: Diana Craciun --- drivers/vfio/fsl-mc/vfio_fsl_mc.c | 18

[PATCH v6 09/10] vfio/fsl-mc: Add read/write support for fsl-mc devices

2020-10-05 Thread Diana Craciun
command once and read 64byte response by one ioctl. Signed-off-by: Bharat Bhushan Signed-off-by: Diana Craciun --- drivers/vfio/fsl-mc/vfio_fsl_mc.c | 118 +- drivers/vfio/fsl-mc/vfio_fsl_mc_private.h | 1 + 2 files changed, 116 insertions(+), 3 deletions(-) diff

[PATCH v6 03/10] vfio/fsl-mc: Implement VFIO_DEVICE_GET_INFO ioctl

2020-10-05 Thread Diana Craciun
Allow userspace to get fsl-mc device info (number of regions and irqs). Signed-off-by: Bharat Bhushan Signed-off-by: Diana Craciun Reviewed-by: Eric Auger --- drivers/vfio/fsl-mc/vfio_fsl_mc.c | 21 - 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/drivers

[PATCH v6 00/10] vfio/fsl-mc: VFIO support for FSL-MC device

2020-10-05 Thread Diana Craciun
the firmware command - Implement a bus notifier for setting driver_override Bharat Bhushan (1): vfio/fsl-mc: Add VFIO framework skeleton for fsl-mc devices Diana Craciun (9): vfio/fsl-mc: Scan DPRC objects on vfio-fsl-mc driver bind vfio/fsl-mc: Implement VFIO_DEVICE_GET_INFO ioctl v

Re: [PATCH v5 09/10] vfio/fsl-mc: Add read/write support for fsl-mc devices

2020-10-05 Thread Diana Craciun OSS
On 10/2/2020 11:50 PM, Alex Williamson wrote: On Tue, 29 Sep 2020 12:03:38 +0300 Diana Craciun wrote: The software uses a memory-mapped I/O command interface (MC portals) to communicate with the MC hardware. This command interface is used to discover, enumerate, configure and remove DPAA2

Re: [PATCH v5 02/10] vfio/fsl-mc: Scan DPRC objects on vfio-fsl-mc driver bind

2020-10-05 Thread Diana Craciun OSS
On 10/2/2020 8:24 PM, Alex Williamson wrote: On Tue, 29 Sep 2020 12:03:31 +0300 Diana Craciun wrote: The DPRC (Data Path Resource Container) device is a bus device and has child devices attached to it. When the vfio-fsl-mc driver is probed the DPRC is scanned and the child devices discovered

[PATCH v5 00/10] vfio/fsl-mc: VFIO support for FSL-MC device

2020-09-29 Thread Diana Craciun
tifier for setting driver_override Bharat Bhushan (1): vfio/fsl-mc: Add VFIO framework skeleton for fsl-mc devices Diana Craciun (9): vfio/fsl-mc: Scan DPRC objects on vfio-fsl-mc driver bind vfio/fsl-mc: Implement VFIO_DEVICE_GET_INFO ioctl vfio/fsl-mc: Implement VFIO_DEVICE_GET_REGION_INFO ioctl

[PATCH v5 04/10] vfio/fsl-mc: Implement VFIO_DEVICE_GET_REGION_INFO ioctl call

2020-09-29 Thread Diana Craciun
Expose to userspace information about the memory regions. Signed-off-by: Bharat Bhushan Signed-off-by: Diana Craciun --- drivers/vfio/fsl-mc/vfio_fsl_mc.c | 79 ++- drivers/vfio/fsl-mc/vfio_fsl_mc_private.h | 18 ++ 2 files changed, 96 insertions(+), 1 deletion

[PATCH v5 02/10] vfio/fsl-mc: Scan DPRC objects on vfio-fsl-mc driver bind

2020-09-29 Thread Diana Craciun
The DPRC (Data Path Resource Container) device is a bus device and has child devices attached to it. When the vfio-fsl-mc driver is probed the DPRC is scanned and the child devices discovered and initialized. Signed-off-by: Bharat Bhushan Signed-off-by: Diana Craciun --- drivers/vfio/fsl-mc

[PATCH v5 01/10] vfio/fsl-mc: Add VFIO framework skeleton for fsl-mc devices

2020-09-29 Thread Diana Craciun
about the DPAA2 objects can be found here: Documentation/networking/device_drivers/freescale/dpaa2/overview.rst Signed-off-by: Bharat Bhushan Signed-off-by: Diana Craciun --- MAINTAINERS | 6 + drivers/vfio/Kconfig | 1 + drivers/vfio/Ma

[PATCH v5 08/10] vfio/fsl-mc: trigger an interrupt via eventfd

2020-09-29 Thread Diana Craciun
. However, currently, the contents of a DPRC assigned to the guest cannot be changed at runtime, so this interrupt is not configured. Signed-off-by: Bharat Bhushan Signed-off-by: Diana Craciun --- drivers/vfio/fsl-mc/vfio_fsl_mc.c | 24 +++- drivers/vfio/fsl-mc/vfio_fsl_mc_intr.c

[PATCH v5 06/10] vfio/fsl-mc: Added lock support in preparation for interrupt handling

2020-09-29 Thread Diana Craciun
-by: Diana Craciun --- drivers/vfio/fsl-mc/vfio_fsl_mc.c | 92 +-- drivers/vfio/fsl-mc/vfio_fsl_mc_private.h | 7 +- 2 files changed, 90 insertions(+), 9 deletions(-) diff --git a/drivers/vfio/fsl-mc/vfio_fsl_mc.c b/drivers/vfio/fsl-mc/vfio_fsl_mc.c index 7ceadb801082

[PATCH v5 05/10] vfio/fsl-mc: Allow userspace to MMAP fsl-mc device MMIO regions

2020-09-29 Thread Diana Craciun
Allow userspace to mmap device regions for direct access of fsl-mc devices. Signed-off-by: Bharat Bhushan Signed-off-by: Diana Craciun --- drivers/vfio/fsl-mc/vfio_fsl_mc.c | 68 ++- 1 file changed, 66 insertions(+), 2 deletions(-) diff --git a/drivers/vfio/fsl-mc

[PATCH v5 09/10] vfio/fsl-mc: Add read/write support for fsl-mc devices

2020-09-29 Thread Diana Craciun
command once and read 64byte response by one ioctl. Signed-off-by: Bharat Bhushan Signed-off-by: Diana Craciun --- drivers/vfio/fsl-mc/vfio_fsl_mc.c | 118 +- drivers/vfio/fsl-mc/vfio_fsl_mc_private.h | 1 + 2 files changed, 116 insertions(+), 3 deletions(-) diff

[PATCH v5 03/10] vfio/fsl-mc: Implement VFIO_DEVICE_GET_INFO ioctl

2020-09-29 Thread Diana Craciun
Allow userspace to get fsl-mc device info (number of regions and irqs). Signed-off-by: Bharat Bhushan Signed-off-by: Diana Craciun Reviewed-by: Eric Auger --- drivers/vfio/fsl-mc/vfio_fsl_mc.c | 21 - 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/drivers

[PATCH v5 10/10] vfio/fsl-mc: Add support for device reset

2020-09-29 Thread Diana Craciun
Currently only resetting the DPRC container is supported which will reset all the objects inside it. Resetting individual objects is possible from the userspace by issueing commands towards MC firmware. Signed-off-by: Diana Craciun --- drivers/vfio/fsl-mc/vfio_fsl_mc.c | 14 +- 1

[PATCH v5 07/10] vfio/fsl-mc: Add irq infrastructure for fsl-mc devices

2020-09-29 Thread Diana Craciun
This patch adds the skeleton for interrupt support for fsl-mc devices. The interrupts are not yet functional, the functionality will be added by subsequent patches. Signed-off-by: Bharat Bhushan Signed-off-by: Diana Craciun --- drivers/vfio/fsl-mc/Makefile | 2 +- drivers/vfio

[PATCH v5 04/13] bus/fsl-mc: Set the QMAN/BMAN region flags

2020-09-29 Thread Diana Craciun
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 --- drivers/bus/fsl-mc/fsl-mc-bus.c | 7 ++- drivers/bus/fsl-mc/fsl

[PATCH v5 05/13] bus/fsl-mc: Cache the DPRC API version

2020-09-29 Thread Diana Craciun
cached. Signed-off-by: Diana Craciun --- drivers/bus/fsl-mc/dprc.c | 30 +- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/drivers/bus/fsl-mc/dprc.c b/drivers/bus/fsl-mc/dprc.c index 602f030d84eb..e76f2c76f4c8 100644 --- a/drivers/bus/fsl-mc/dprc.c +++ b

[PATCH v5 06/13] bus/fsl-mc: Add dprc-reset-container support

2020-09-29 Thread Diana Craciun
From: Bharat Bhushan DPRC reset is required by VFIO-mc in order to stop a device to further generate DMA transactions. Signed-off-by: Bharat Bhushan Signed-off-by: Laurentiu Tudor Signed-off-by: Diana Craciun --- drivers/bus/fsl-mc/dprc.c | 71

[PATCH v5 03/13] bus/fsl-mc: add support for 'driver_override' in the mc-bus

2020-09-29 Thread Diana Craciun
igned-off-by: Laurentiu Tudor Signed-off-by: Diana Craciun --- The patch does 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-b

[PATCH v5 11/13] bus/fsl-mc: Export IRQ pool handling functions to be used by VFIO

2020-09-29 Thread Diana Craciun
The IRQ pool handling functions can be used by both DPRC driver and VFIO. Adapt and export those functions. Signed-off-by: Diana Craciun --- drivers/bus/fsl-mc/dprc-driver.c | 8 +++- drivers/bus/fsl-mc/fsl-mc-allocator.c | 12 drivers/bus/fsl-mc/fsl-mc-private.h | 10

[PATCH v5 00/13] bus/fsl-mc: Extend mc-bus driver functionalities in preparation for mc-bus VFIO support

2020-09-29 Thread Diana Craciun
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

[PATCH v5 07/13] bus/fsl-mc: Export dprc_scan/dprc_remove functions to be used by multiple entities

2020-09-29 Thread Diana Craciun
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 --- drivers/bus/fsl-mc/dprc-driver.c | 26 +++--- drivers/bus/fsl-mc/fsl-mc-bus.c | 1 + include/linux/fsl

[PATCH v5 09/13] bus/fsl-mc: Add a container setup function

2020-09-29 Thread Diana Craciun
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 --- drivers/bus/fsl-mc/dprc-driver.c | 71

[PATCH v5 08/13] bus/fsl-mc: Export a cleanup function for DPRC

2020-09-29 Thread Diana Craciun
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 --- drivers/bus/fsl-mc/dprc-driver.c | 62 include/linux/fsl/mc.h | 2 ++ 2 files

[PATCH v5 13/13] bus/fsl-mc: Add a new version for dprc_get_obj_region command

2020-09-29 Thread Diana Craciun
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

[PATCH v5 10/13] bus/fsl_mc: Do not rely on caller to provide non NULL mc_io

2020-09-29 Thread Diana Craciun
Before destroying the mc_io, check first that it was allocated. Signed-off-by: Diana Craciun --- drivers/bus/fsl-mc/mc-io.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/bus/fsl-mc/mc-io.c b/drivers/bus/fsl-mc/mc-io.c index a30b53f1d87d..305015486b91 100644

[PATCH v5 12/13] bus/fsl-mc: Extend ICID size from 16bit to 32bit

2020-09-29 Thread Diana Craciun
From: Bharat Bhushan In virtual machines the device-id range is defined between 0x1-0x2. The reason for using such a large range is to avoid overlapping with the PCI range. Signed-off-by: Bharat Bhushan Signed-off-by: Laurentiu Tudor Signed-off-by: Diana Craciun --- drivers/bus/fsl

[PATCH v5 02/13] bus/fsl-mc: Add a new parameter to dprc_scan_objects function

2020-09-29 Thread Diana Craciun
. In order to use the same function in both drivers add a new parameter. Signed-off-by: Diana Craciun --- drivers/bus/fsl-mc/dprc-driver.c | 11 +++ 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/bus/fsl-mc/dprc-driver.c b/drivers/bus/fsl-mc/dprc-driver.c index

[PATCH v5 01/13] bus/fsl-mc: Do no longer export the total number of irqs outside dprc_scan_objects

2020-09-29 Thread Diana Craciun
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 --- drivers/bus/fsl-mc/dprc-driver.c | 30

Re: [PATCH v4 09/10] vfio/fsl-mc: Add read/write support for fsl-mc devices

2020-09-11 Thread Diana Craciun OSS
Hi Eric, On 9/10/2020 11:20 AM, Auger Eric wrote: Hi Diana, On 9/7/20 4:34 PM, Diana Craciun OSS wrote: Hi Eric, On 9/4/2020 11:18 AM, Auger Eric wrote: Hi Diana, On 8/26/20 11:33 AM, Diana Craciun wrote: The software uses a memory-mapped I/O command interface (MC portals) to communicate

Re: [PATCH v4 07/10] vfio/fsl-mc: Add irq infrastructure for fsl-mc devices

2020-09-07 Thread Diana Craciun OSS
Hi Eric, On 9/3/2020 11:15 PM, Auger Eric wrote: Hi Diana, On 8/26/20 11:33 AM, Diana Craciun wrote: This patch adds the skeleton for interrupt support for fsl-mc devices. The interrupts are not yet functional, the functionality will be added by subsequent patches. Signed-off-by: Bharat

Re: [PATCH v4 08/10] vfio/fsl-mc: trigger an interrupt via eventfd

2020-09-07 Thread Diana Craciun OSS
Hi Eric, On 9/4/2020 11:02 AM, Auger Eric wrote: Hi Diana, On 8/26/20 11:33 AM, Diana Craciun wrote: This patch allows to set an eventfd for fsl-mc device interrupts and also to trigger the interrupt eventfd from userspace for testing. All fsl-mc device interrupts are MSIs. The MSIs

Re: [PATCH v4 10/10] vfio/fsl-mc: Add support for device reset

2020-09-07 Thread Diana Craciun OSS
Hi Eric, On 9/4/2020 11:21 AM, Auger Eric wrote: Hi Diana, On 8/26/20 11:33 AM, Diana Craciun wrote: Currently only resetting the DPRC container is supported which will reset all the objects inside it. Resetting individual objects is possible from the userspace by issueing commands towards MC

Re: [PATCH v4 02/10] vfio/fsl-mc: Scan DPRC objects on vfio-fsl-mc driver bind

2020-09-07 Thread Diana Craciun OSS
Hi Eric, On 9/3/2020 5:06 PM, Auger Eric wrote: Hi Diana, On 8/26/20 11:33 AM, Diana Craciun wrote: The DPRC (Data Path Resource Container) device is a bus device and has child devices attached to it. When the vfio-fsl-mc driver is probed the DPRC is scanned and the child devices discovered

Re: [PATCH v4 09/10] vfio/fsl-mc: Add read/write support for fsl-mc devices

2020-09-07 Thread Diana Craciun OSS
Hi Eric, On 9/4/2020 11:18 AM, Auger Eric wrote: Hi Diana, On 8/26/20 11:33 AM, Diana Craciun wrote: The software uses a memory-mapped I/O command interface (MC portals) to communicate with the MC hardware. This command interface is used to discover, enumerate, configure and remove DPAA2

Re: [PATCH v4 05/10] vfio/fsl-mc: Allow userspace to MMAP fsl-mc device MMIO regions

2020-09-07 Thread Diana Craciun OSS
Hi Eric, On 9/3/2020 7:05 PM, Auger Eric wrote: Hi Diana, On 8/26/20 11:33 AM, Diana Craciun wrote: Allow userspace to mmap device regions for direct access of fsl-mc devices. Signed-off-by: Bharat Bhushan Signed-off-by: Diana Craciun --- drivers/vfio/fsl-mc/vfio_fsl_mc.c | 60

Re: [PATCH v4 01/10] vfio/fsl-mc: Add VFIO framework skeleton for fsl-mc devices

2020-09-04 Thread Diana Craciun OSS
Hi Eric, On 9/3/2020 5:06 PM, Auger Eric wrote: Hi Diana, On 8/26/20 11:33 AM, Diana Craciun wrote: From: Bharat Bhushan DPAA2 (Data Path Acceleration Architecture) consists in mechanisms for processing Ethernet packets, queue management, accelerators, etc. The Management Complex (mc

Re: [PATCH v4 00/10] vfio/fsl-mc: VFIO support for FSL-MC device

2020-09-04 Thread Diana Craciun OSS
Hi Eric, On 9/3/2020 4:40 PM, Auger Eric wrote: The patches are dependent on some changes in the mc-bus (bus/fsl-mc) driver. The changes were needed in order to re-use code and to export some more functions that are needed by the VFIO driver. Currenlty the mc-bus patches are under review:

[PATCH v4 02/10] vfio/fsl-mc: Scan DPRC objects on vfio-fsl-mc driver bind

2020-08-26 Thread Diana Craciun
The DPRC (Data Path Resource Container) device is a bus device and has child devices attached to it. When the vfio-fsl-mc driver is probed the DPRC is scanned and the child devices discovered and initialized. Signed-off-by: Bharat Bhushan Signed-off-by: Diana Craciun --- drivers/vfio/fsl-mc

[PATCH v4 03/10] vfio/fsl-mc: Implement VFIO_DEVICE_GET_INFO ioctl

2020-08-26 Thread Diana Craciun
Allow userspace to get fsl-mc device info (number of regions and irqs). Signed-off-by: Bharat Bhushan Signed-off-by: Diana Craciun --- drivers/vfio/fsl-mc/vfio_fsl_mc.c | 21 - 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/drivers/vfio/fsl-mc/vfio_fsl_mc.c

[PATCH v4 00/10] vfio/fsl-mc: VFIO support for FSL-MC device

2020-08-26 Thread Diana Craciun
sl-mc: Add VFIO framework skeleton for fsl-mc devices Diana Craciun (9): vfio/fsl-mc: Scan DPRC objects on vfio-fsl-mc driver bind vfio/fsl-mc: Implement VFIO_DEVICE_GET_INFO ioctl vfio/fsl-mc: Implement VFIO_DEVICE_GET_REGION_INFO ioctl call vfio/fsl-mc: Allow userspace to MMAP fsl-mc devi

[PATCH v4 05/10] vfio/fsl-mc: Allow userspace to MMAP fsl-mc device MMIO regions

2020-08-26 Thread Diana Craciun
Allow userspace to mmap device regions for direct access of fsl-mc devices. Signed-off-by: Bharat Bhushan Signed-off-by: Diana Craciun --- drivers/vfio/fsl-mc/vfio_fsl_mc.c | 60 +-- 1 file changed, 58 insertions(+), 2 deletions(-) diff --git a/drivers/vfio/fsl-mc

[PATCH v4 09/10] vfio/fsl-mc: Add read/write support for fsl-mc devices

2020-08-26 Thread Diana Craciun
command once and read 64byte response by one ioctl. Signed-off-by: Bharat Bhushan Signed-off-by: Diana Craciun --- drivers/vfio/fsl-mc/vfio_fsl_mc.c | 115 +- drivers/vfio/fsl-mc/vfio_fsl_mc_private.h | 1 + 2 files changed, 114 insertions(+), 2 deletions(-) diff

[PATCH v4 07/10] vfio/fsl-mc: Add irq infrastructure for fsl-mc devices

2020-08-26 Thread Diana Craciun
This patch adds the skeleton for interrupt support for fsl-mc devices. The interrupts are not yet functional, the functionality will be added by subsequent patches. Signed-off-by: Bharat Bhushan Signed-off-by: Diana Craciun --- drivers/vfio/fsl-mc/Makefile | 2 +- drivers/vfio

[PATCH v4 04/10] vfio/fsl-mc: Implement VFIO_DEVICE_GET_REGION_INFO ioctl call

2020-08-26 Thread Diana Craciun
Expose to userspace information about the memory regions. Signed-off-by: Bharat Bhushan Signed-off-by: Diana Craciun --- drivers/vfio/fsl-mc/vfio_fsl_mc.c | 79 ++- drivers/vfio/fsl-mc/vfio_fsl_mc_private.h | 19 ++ 2 files changed, 97 insertions(+), 1 deletion

[PATCH v4 06/10] vfio/fsl-mc: Added lock support in preparation for interrupt handling

2020-08-26 Thread Diana Craciun
-by: Diana Craciun --- drivers/vfio/fsl-mc/vfio_fsl_mc.c | 91 +-- drivers/vfio/fsl-mc/vfio_fsl_mc_private.h | 8 +- 2 files changed, 91 insertions(+), 8 deletions(-) diff --git a/drivers/vfio/fsl-mc/vfio_fsl_mc.c b/drivers/vfio/fsl-mc/vfio_fsl_mc.c index 64d5c1fff51f

[PATCH v4 01/10] vfio/fsl-mc: Add VFIO framework skeleton for fsl-mc devices

2020-08-26 Thread Diana Craciun
about the DPAA2 objects can be found here: Documentation/networking/device_drivers/freescale/dpaa2/overview.rst Signed-off-by: Bharat Bhushan Signed-off-by: Diana Craciun --- MAINTAINERS | 6 + drivers/vfio/Kconfig | 1 + drivers/vfio/Ma

[PATCH v4 08/10] vfio/fsl-mc: trigger an interrupt via eventfd

2020-08-26 Thread Diana Craciun
. However, currently, the contents of a DPRC assigned to the guest cannot be changed at runtime, so this interrupt is not configured. Signed-off-by: Bharat Bhushan Signed-off-by: Diana Craciun --- drivers/vfio/fsl-mc/vfio_fsl_mc.c | 18 ++- drivers/vfio/fsl-mc/vfio_fsl_mc_intr.c| 160

[PATCH v4 10/10] vfio/fsl-mc: Add support for device reset

2020-08-26 Thread Diana Craciun
Currently only resetting the DPRC container is supported which will reset all the objects inside it. Resetting individual objects is possible from the userspace by issueing commands towards MC firmware. Signed-off-by: Diana Craciun --- drivers/vfio/fsl-mc/vfio_fsl_mc.c | 15 ++- 1

[PATCH v4 06/13] bus/fsl-mc: Add dprc-reset-container support

2020-08-26 Thread Diana Craciun
From: Bharat Bhushan DPRC reset is required by VFIO-mc in order to stop a device to further generate DMA transactions. Signed-off-by: Bharat Bhushan Signed-off-by: Laurentiu Tudor Signed-off-by: Diana Craciun --- drivers/bus/fsl-mc/dprc.c | 71

[PATCH v4 09/13] bus/fsl-mc: Add a container setup function

2020-08-26 Thread Diana Craciun
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 --- drivers/bus/fsl-mc/dprc-driver.c | 65

[PATCH v4 10/13] bus/fsl_mc: Do not rely on caller to provide non NULL mc_io

2020-08-26 Thread Diana Craciun
Before destroying the mc_io, check first that it was allocated. Signed-off-by: Diana Craciun --- drivers/bus/fsl-mc/mc-io.c | 7 ++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/drivers/bus/fsl-mc/mc-io.c b/drivers/bus/fsl-mc/mc-io.c index a30b53f1d87d..305015486b91 100644

[PATCH v4 07/13] bus/fsl-mc: Export dprc_scan/dprc_remove functions to be used by multiple entities

2020-08-26 Thread Diana Craciun
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 --- drivers/bus/fsl-mc/dprc-driver.c | 26 +++--- drivers/bus/fsl-mc/fsl-mc-bus.c | 1 + include/linux/fsl

[PATCH v4 13/13] bus/fsl-mc: Add a new version for dprc_get_obj_region command

2020-08-26 Thread Diana Craciun
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

[PATCH v4 08/13] bus/fsl-mc: Export a cleanup function for DPRC

2020-08-26 Thread Diana Craciun
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 --- drivers/bus/fsl-mc/dprc-driver.c | 52 include/linux/fsl/mc.h | 2 ++ 2 files

[PATCH v4 00/13] bus/fsl-mc: Extend mc-bus driver functionalities in preparation for mc-bus VFIO support

2020-08-26 Thread Diana Craciun
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 AP

[PATCH v4 12/13] bus/fsl-mc: Extend ICID size from 16bit to 32bit

2020-08-26 Thread Diana Craciun
From: Bharat Bhushan In virtual machines the device-id range is defined between 0x1-0x2. The reason for using such a large range is to avoid overlapping with the PCI range. Signed-off-by: Bharat Bhushan Signed-off-by: Laurentiu Tudor Signed-off-by: Diana Craciun --- drivers/bus/fsl

[PATCH v4 03/13] bus/fsl-mc: add support for 'driver_override' in the mc-bus

2020-08-26 Thread Diana Craciun
igned-off-by: Laurentiu Tudor Signed-off-by: Diana Craciun --- 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-b

[PATCH v4 11/13] bus/fsl-mc: Export IRQ pool handling functions to be used by VFIO

2020-08-26 Thread Diana Craciun
The IRQ pool handling functions can be used by both DPRC driver and VFIO. Adapt and export those functions. Signed-off-by: Diana Craciun --- 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

[PATCH v4 04/13] bus/fsl-mc: Set the QMAN/BMAN region flags

2020-08-26 Thread Diana Craciun
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 --- drivers/bus/fsl-mc/fsl-mc-bus.c | 7 ++- drivers/bus/fsl-mc/fsl

[PATCH v4 05/13] bus/fsl-mc: Cache the DPRC API version

2020-08-26 Thread Diana Craciun
cached. Signed-off-by: Diana Craciun --- drivers/bus/fsl-mc/dprc.c | 30 +- 1 file changed, 21 insertions(+), 9 deletions(-) diff --git a/drivers/bus/fsl-mc/dprc.c b/drivers/bus/fsl-mc/dprc.c index 602f030d84eb..e76f2c76f4c8 100644 --- a/drivers/bus/fsl-mc/dprc.c +++ b

[PATCH v4 02/13] bus/fsl-mc: Add a new parameter to dprc_scan_objects function

2020-08-26 Thread Diana Craciun
. In order to use the same function in both drivers add a new parameter. Signed-off-by: Diana Craciun --- drivers/bus/fsl-mc/dprc-driver.c | 11 +++ 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/drivers/bus/fsl-mc/dprc-driver.c b/drivers/bus/fsl-mc/dprc-driver.c index

[PATCH v4 01/13] bus/fsl-mc: Do no longer export the total number of irqs outside dprc_scan_objects

2020-08-26 Thread Diana Craciun
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 --- drivers/bus/fsl-mc/dprc-driver.c | 30

Re: [PATCH v3 03/13] bus/fsl-mc: add support for 'driver_override' in the mc-bus

2020-07-06 Thread Diana Craciun OSS
now). Diana On 7/6/2020 4:57 PM, Andrew Lunn wrote: Hi Diana On Mon, Jul 06, 2020 at 03:42:33PM +0300, Diana Craciun wrote: From: Bharat Bhushan This patch is required for vfio-fsl-mc meta driver to successfully bind layerscape container devices for device passthrough. This patch adds

Re: [PATCH v3 13/13] bus/fsl-mc: Add a new version for dprc_get_obj_region command

2020-07-06 Thread Diana Craciun OSS
On 7/6/2020 4:14 PM, Laurentiu Tudor wrote: On 7/6/2020 3:42 PM, Diana Craciun wrote: From: Diana Craciun 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

[PATCH v3 4/9] vfio/fsl-mc: Implement VFIO_DEVICE_GET_REGION_INFO ioctl call

2020-07-06 Thread Diana Craciun
Expose to userspace information about the memory regions. Signed-off-by: Bharat Bhushan Signed-off-by: Diana Craciun --- drivers/vfio/fsl-mc/vfio_fsl_mc.c | 77 ++- drivers/vfio/fsl-mc/vfio_fsl_mc_private.h | 19 ++ 2 files changed, 95 insertions(+), 1 deletion

[PATCH v3 8/9] vfio/fsl-mc: trigger an interrupt via eventfd

2020-07-06 Thread Diana Craciun
. However, currently, the contents of a DPRC assigned to the guest cannot be changed at runtime, so this interrupt is not configured. Signed-off-by: Bharat Bhushan Signed-off-by: Diana Craciun --- drivers/vfio/fsl-mc/vfio_fsl_mc.c | 18 ++- drivers/vfio/fsl-mc/vfio_fsl_mc_intr.c| 160

[PATCH v3 7/9] vfio/fsl-mc: Add irq infrastructure for fsl-mc devices

2020-07-06 Thread Diana Craciun
This patch adds the skeleton for interrupt support for fsl-mc devices. The interrupts are not yet functional, the functionality will be added by subsequent patches. Signed-off-by: Bharat Bhushan Signed-off-by: Diana Craciun --- drivers/vfio/fsl-mc/Makefile | 2 +- drivers/vfio

[PATCH v3 6/9] vfio/fsl-mc: Added lock support in preparation for interrupt handling

2020-07-06 Thread Diana Craciun
From: Diana Craciun Only the DPRC object allocates interrupts from the MSI interrupt domain. The interrupts are managed by the DPRC in a pool of interrupts. The access to this pool of interrupts has to be protected with a lock. This patch extends the current lock implementation to have a lock

[PATCH v3 2/9] vfio/fsl-mc: Scan DPRC objects on vfio-fsl-mc driver bind

2020-07-06 Thread Diana Craciun
The DPRC (Data Path Resource Container) device is a bus device and has child devices attached to it. When the vfio-fsl-mc driver is probed the DPRC is scanned and the child devices discovered and initialized. Signed-off-by: Bharat Bhushan Signed-off-by: Diana Craciun --- drivers/vfio/fsl-mc

[PATCH v3 9/9] vfio/fsl-mc: Add read/write support for fsl-mc devices

2020-07-06 Thread Diana Craciun
command once and read 64byte response by one ioctl. Signed-off-by: Bharat Bhushan Signed-off-by: Diana Craciun --- drivers/vfio/fsl-mc/vfio_fsl_mc.c | 115 +- drivers/vfio/fsl-mc/vfio_fsl_mc_private.h | 1 + 2 files changed, 114 insertions(+), 2 deletions(-) diff

[PATCH v3 1/9] vfio/fsl-mc: Add VFIO framework skeleton for fsl-mc devices

2020-07-06 Thread Diana Craciun
about the DPAA2 objects can be found here: Documentation/networking/device_drivers/freescale/dpaa2/overview.rst Signed-off-by: Bharat Bhushan Signed-off-by: Diana Craciun --- MAINTAINERS | 6 + drivers/vfio/Kconfig | 1 + drivers/vfio/Ma

[PATCH v3 5/9] vfio/fsl-mc: Allow userspace to MMAP fsl-mc device MMIO regions

2020-07-06 Thread Diana Craciun
Allow userspace to mmap device regions for direct access of fsl-mc devices. Signed-off-by: Bharat Bhushan Signed-off-by: Diana Craciun --- drivers/vfio/fsl-mc/vfio_fsl_mc.c | 59 +-- 1 file changed, 57 insertions(+), 2 deletions(-) diff --git a/drivers/vfio/fsl-mc

[PATCH v3 3/9] vfio/fsl-mc: Implement VFIO_DEVICE_GET_INFO ioctl

2020-07-06 Thread Diana Craciun
Allow userspace to get fsl-mc device info (number of regions and irqs). Signed-off-by: Bharat Bhushan Signed-off-by: Diana Craciun --- drivers/vfio/fsl-mc/vfio_fsl_mc.c | 21 - 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/drivers/vfio/fsl-mc/vfio_fsl_mc.c

[PATCH v3 0/9] vfio/fsl-mc: VFIO support for FSL-MC devices

2020-07-06 Thread Diana Craciun
d for all DPAA2 objects - review fixes v1 --> v2 - Fixed the container reset, a new flag added to the firmware command - Implement a bus notifier for setting driver_override Bharat Bhushan (1): vfio/fsl-mc: Add VFIO framework skeleton for fsl-mc devices Diana Craciun (8): vfio/fsl-mc: Scan

[PATCH v3 11/13] bus/fsl-mc: Export IRQ pool handling functions to be used by VFIO

2020-07-06 Thread Diana Craciun
From: Diana Craciun The IRQ pool handling functions can be used by both DPRC driver and VFIO. Adapt and export those functions. Signed-off-by: Diana Craciun --- drivers/bus/fsl-mc/dprc-driver.c | 7 +++ drivers/bus/fsl-mc/fsl-mc-allocator.c | 12 drivers/bus/fsl-mc/fsl

[PATCH v3 00/13] bus/fsl-mc: Extend mc-bus driver functionalities in preparation for mc-bus VFIO support

2020-07-06 Thread Diana Craciun
From: Diana Craciun 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

[PATCH v3 08/13] bus/fsl-mc: Export a cleanup function for DPRC

2020-07-06 Thread Diana Craciun
From: Diana Craciun 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 --- drivers/bus/fsl-mc/dprc-driver.c | 52 include/linux/fsl/mc.h

[PATCH v3 13/13] bus/fsl-mc: Add a new version for dprc_get_obj_region command

2020-07-06 Thread Diana Craciun
From: Diana Craciun 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

  1   2   >