mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-18 22:34:48 +00:00
1bb141ed5e
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 objects. The DPAA2 objects use MSIs, so the command interface needs to be emulated such that the correct MSI is configured in the hardware (the guest has the virtual MSIs). This patch is adding read/write support for fsl-mc devices. The mc commands are emulated by the userspace. The host is just passing the correct command to the hardware. Also the current patch limits userspace to write complete 64byte command once and read 64byte response by one ioctl. Signed-off-by: Bharat Bhushan <Bharat.Bhushan@nxp.com> Signed-off-by: Diana Craciun <diana.craciun@oss.nxp.com> Signed-off-by: Alex Williamson <alex.williamson@redhat.com>
56 lines
1.3 KiB
C
56 lines
1.3 KiB
C
/* SPDX-License-Identifier: (GPL-2.0+ OR BSD-3-Clause) */
|
|
/*
|
|
* Copyright 2013-2016 Freescale Semiconductor Inc.
|
|
* Copyright 2016,2019-2020 NXP
|
|
*/
|
|
|
|
#ifndef VFIO_FSL_MC_PRIVATE_H
|
|
#define VFIO_FSL_MC_PRIVATE_H
|
|
|
|
#define VFIO_FSL_MC_OFFSET_SHIFT 40
|
|
#define VFIO_FSL_MC_OFFSET_MASK (((u64)(1) << VFIO_FSL_MC_OFFSET_SHIFT) - 1)
|
|
|
|
#define VFIO_FSL_MC_OFFSET_TO_INDEX(off) ((off) >> VFIO_FSL_MC_OFFSET_SHIFT)
|
|
|
|
#define VFIO_FSL_MC_INDEX_TO_OFFSET(index) \
|
|
((u64)(index) << VFIO_FSL_MC_OFFSET_SHIFT)
|
|
|
|
struct vfio_fsl_mc_irq {
|
|
u32 flags;
|
|
u32 count;
|
|
struct eventfd_ctx *trigger;
|
|
char *name;
|
|
};
|
|
|
|
struct vfio_fsl_mc_reflck {
|
|
struct kref kref;
|
|
struct mutex lock;
|
|
};
|
|
|
|
struct vfio_fsl_mc_region {
|
|
u32 flags;
|
|
u32 type;
|
|
u64 addr;
|
|
resource_size_t size;
|
|
void __iomem *ioaddr;
|
|
};
|
|
|
|
struct vfio_fsl_mc_device {
|
|
struct fsl_mc_device *mc_dev;
|
|
struct notifier_block nb;
|
|
int refcnt;
|
|
struct vfio_fsl_mc_region *regions;
|
|
struct vfio_fsl_mc_reflck *reflck;
|
|
struct mutex igate;
|
|
struct vfio_fsl_mc_irq *mc_irqs;
|
|
};
|
|
|
|
extern int vfio_fsl_mc_set_irqs_ioctl(struct vfio_fsl_mc_device *vdev,
|
|
u32 flags, unsigned int index,
|
|
unsigned int start, unsigned int count,
|
|
void *data);
|
|
|
|
void vfio_fsl_mc_irqs_cleanup(struct vfio_fsl_mc_device *vdev);
|
|
|
|
#endif /* VFIO_FSL_MC_PRIVATE_H */
|