linux/drivers/vfio/pci/vfio_pci_rdwr.c

// SPDX-License-Identifier: GPL-2.0-only
/*
 * VFIO PCI I/O Port & MMIO access
 *
 * Copyright (C) 2012 Red Hat, Inc.  All rights reserved.
 *     Author: Alex Williamson <[email protected]>
 *
 * Derived from original vfio:
 * Copyright 2010 Cisco Systems, Inc.  All rights reserved.
 * Author: Tom Lyon, [email protected]
 */

#include <linux/fs.h>
#include <linux/pci.h>
#include <linux/uaccess.h>
#include <linux/io.h>
#include <linux/vfio.h>
#include <linux/vgaarb.h>

#include "vfio_pci_priv.h"

#ifdef __LITTLE_ENDIAN
#define vfio_ioread64
#define vfio_iowrite64
#define vfio_ioread32
#define vfio_iowrite32
#define vfio_ioread16
#define vfio_iowrite16
#else
#define vfio_ioread64
#define vfio_iowrite64
#define vfio_ioread32
#define vfio_iowrite32
#define vfio_ioread16
#define vfio_iowrite16
#endif
#define vfio_ioread8
#define vfio_iowrite8

#define VFIO_IOWRITE(size)

VFIO_IOWRITE()
VFIO_IOWRITE()
VFIO_IOWRITE()
#ifdef iowrite64
VFIO_IOWRITE(64)
#endif

#define VFIO_IOREAD(size)

VFIO_IOREAD()
VFIO_IOREAD()
VFIO_IOREAD()
#ifdef ioread64
VFIO_IOREAD(64)
#endif

#define VFIO_IORDWR(size)									\

VFIO_IORDWR()
VFIO_IORDWR()
VFIO_IORDWR()
#if defined(ioread64) && defined(iowrite64)
VFIO_IORDWR(64)
#endif

/*
 * Read or write from an __iomem region (MMIO or I/O port) with an excluded
 * range which is inaccessible.  The excluded range drops writes and fills
 * reads with -1.  This is intended for handling MSI-X vector tables and
 * leftover space for ROM BARs.
 */
ssize_t vfio_pci_core_do_io_rw(struct vfio_pci_core_device *vdev, bool test_mem,
			       void __iomem *io, char __user *buf,
			       loff_t off, size_t count, size_t x_start,
			       size_t x_end, bool iswrite)
{}
EXPORT_SYMBOL_GPL();

int vfio_pci_core_setup_barmap(struct vfio_pci_core_device *vdev, int bar)
{}
EXPORT_SYMBOL_GPL();

ssize_t vfio_pci_bar_rw(struct vfio_pci_core_device *vdev, char __user *buf,
			size_t count, loff_t *ppos, bool iswrite)
{}

#ifdef CONFIG_VFIO_PCI_VGA
ssize_t vfio_pci_vga_rw(struct vfio_pci_core_device *vdev, char __user *buf,
			       size_t count, loff_t *ppos, bool iswrite)
{}
#endif

static void vfio_pci_ioeventfd_do_write(struct vfio_pci_ioeventfd *ioeventfd,
					bool test_mem)
{}

static int vfio_pci_ioeventfd_handler(void *opaque, void *unused)
{}

static void vfio_pci_ioeventfd_thread(void *opaque, void *unused)
{}

int vfio_pci_ioeventfd(struct vfio_pci_core_device *vdev, loff_t offset,
		       uint64_t data, int count, int fd)
{}