mirror of
https://github.com/armbian/linux-cix.git
synced 2026-01-06 12:30:45 -08:00
Merge branches 'v5.15/vfio/spdx-license-cleanups', 'v5.15/vfio/dma-valid-waited-v3', 'v5.15/vfio/vfio-pci-core-v5' and 'v5.15/vfio/vfio-ap' into v5.15/vfio/next
This commit is contained in:
@@ -103,6 +103,7 @@ need pass only as many optional fields as necessary:
|
||||
- subvendor and subdevice fields default to PCI_ANY_ID (FFFFFFFF)
|
||||
- class and classmask fields default to 0
|
||||
- driver_data defaults to 0UL.
|
||||
- override_only field defaults to 0.
|
||||
|
||||
Note that driver_data must match the value used by any of the pci_device_id
|
||||
entries defined in the driver. This makes the driver_data field mandatory
|
||||
|
||||
@@ -19466,6 +19466,7 @@ T: git git://github.com/awilliam/linux-vfio.git
|
||||
F: Documentation/driver-api/vfio.rst
|
||||
F: drivers/vfio/
|
||||
F: include/linux/vfio.h
|
||||
F: include/linux/vfio_pci_core.h
|
||||
F: include/uapi/linux/vfio.h
|
||||
|
||||
VFIO FSL-MC DRIVER
|
||||
|
||||
@@ -798,14 +798,12 @@ struct kvm_s390_cpu_model {
|
||||
unsigned short ibc;
|
||||
};
|
||||
|
||||
struct kvm_s390_module_hook {
|
||||
int (*hook)(struct kvm_vcpu *vcpu);
|
||||
struct module *owner;
|
||||
};
|
||||
typedef int (*crypto_hook)(struct kvm_vcpu *vcpu);
|
||||
|
||||
struct kvm_s390_crypto {
|
||||
struct kvm_s390_crypto_cb *crycb;
|
||||
struct kvm_s390_module_hook *pqap_hook;
|
||||
struct rw_semaphore pqap_hook_rwsem;
|
||||
crypto_hook *pqap_hook;
|
||||
__u32 crycbd;
|
||||
__u8 aes_kw;
|
||||
__u8 dea_kw;
|
||||
|
||||
@@ -2559,12 +2559,26 @@ static void kvm_s390_set_crycb_format(struct kvm *kvm)
|
||||
kvm->arch.crypto.crycbd |= CRYCB_FORMAT1;
|
||||
}
|
||||
|
||||
/*
|
||||
* kvm_arch_crypto_set_masks
|
||||
*
|
||||
* @kvm: pointer to the target guest's KVM struct containing the crypto masks
|
||||
* to be set.
|
||||
* @apm: the mask identifying the accessible AP adapters
|
||||
* @aqm: the mask identifying the accessible AP domains
|
||||
* @adm: the mask identifying the accessible AP control domains
|
||||
*
|
||||
* Set the masks that identify the adapters, domains and control domains to
|
||||
* which the KVM guest is granted access.
|
||||
*
|
||||
* Note: The kvm->lock mutex must be locked by the caller before invoking this
|
||||
* function.
|
||||
*/
|
||||
void kvm_arch_crypto_set_masks(struct kvm *kvm, unsigned long *apm,
|
||||
unsigned long *aqm, unsigned long *adm)
|
||||
{
|
||||
struct kvm_s390_crypto_cb *crycb = kvm->arch.crypto.crycb;
|
||||
|
||||
mutex_lock(&kvm->lock);
|
||||
kvm_s390_vcpu_block_all(kvm);
|
||||
|
||||
switch (kvm->arch.crypto.crycbd & CRYCB_FORMAT_MASK) {
|
||||
@@ -2595,13 +2609,23 @@ void kvm_arch_crypto_set_masks(struct kvm *kvm, unsigned long *apm,
|
||||
/* recreate the shadow crycb for each vcpu */
|
||||
kvm_s390_sync_request_broadcast(kvm, KVM_REQ_VSIE_RESTART);
|
||||
kvm_s390_vcpu_unblock_all(kvm);
|
||||
mutex_unlock(&kvm->lock);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(kvm_arch_crypto_set_masks);
|
||||
|
||||
/*
|
||||
* kvm_arch_crypto_clear_masks
|
||||
*
|
||||
* @kvm: pointer to the target guest's KVM struct containing the crypto masks
|
||||
* to be cleared.
|
||||
*
|
||||
* Clear the masks that identify the adapters, domains and control domains to
|
||||
* which the KVM guest is granted access.
|
||||
*
|
||||
* Note: The kvm->lock mutex must be locked by the caller before invoking this
|
||||
* function.
|
||||
*/
|
||||
void kvm_arch_crypto_clear_masks(struct kvm *kvm)
|
||||
{
|
||||
mutex_lock(&kvm->lock);
|
||||
kvm_s390_vcpu_block_all(kvm);
|
||||
|
||||
memset(&kvm->arch.crypto.crycb->apcb0, 0,
|
||||
@@ -2613,7 +2637,6 @@ void kvm_arch_crypto_clear_masks(struct kvm *kvm)
|
||||
/* recreate the shadow crycb for each vcpu */
|
||||
kvm_s390_sync_request_broadcast(kvm, KVM_REQ_VSIE_RESTART);
|
||||
kvm_s390_vcpu_unblock_all(kvm);
|
||||
mutex_unlock(&kvm->lock);
|
||||
}
|
||||
EXPORT_SYMBOL_GPL(kvm_arch_crypto_clear_masks);
|
||||
|
||||
@@ -2630,6 +2653,7 @@ static void kvm_s390_crypto_init(struct kvm *kvm)
|
||||
{
|
||||
kvm->arch.crypto.crycb = &kvm->arch.sie_page2->crycb;
|
||||
kvm_s390_set_crycb_format(kvm);
|
||||
init_rwsem(&kvm->arch.crypto.pqap_hook_rwsem);
|
||||
|
||||
if (!test_kvm_facility(kvm, 76))
|
||||
return;
|
||||
|
||||
@@ -610,6 +610,7 @@ static int handle_io_inst(struct kvm_vcpu *vcpu)
|
||||
static int handle_pqap(struct kvm_vcpu *vcpu)
|
||||
{
|
||||
struct ap_queue_status status = {};
|
||||
crypto_hook pqap_hook;
|
||||
unsigned long reg0;
|
||||
int ret;
|
||||
uint8_t fc;
|
||||
@@ -654,18 +655,20 @@ static int handle_pqap(struct kvm_vcpu *vcpu)
|
||||
return kvm_s390_inject_program_int(vcpu, PGM_SPECIFICATION);
|
||||
|
||||
/*
|
||||
* Verify that the hook callback is registered, lock the owner
|
||||
* and call the hook.
|
||||
* If the hook callback is registered, there will be a pointer to the
|
||||
* hook function pointer in the kvm_s390_crypto structure. Lock the
|
||||
* owner, retrieve the hook function pointer and call the hook.
|
||||
*/
|
||||
down_read(&vcpu->kvm->arch.crypto.pqap_hook_rwsem);
|
||||
if (vcpu->kvm->arch.crypto.pqap_hook) {
|
||||
if (!try_module_get(vcpu->kvm->arch.crypto.pqap_hook->owner))
|
||||
return -EOPNOTSUPP;
|
||||
ret = vcpu->kvm->arch.crypto.pqap_hook->hook(vcpu);
|
||||
module_put(vcpu->kvm->arch.crypto.pqap_hook->owner);
|
||||
pqap_hook = *vcpu->kvm->arch.crypto.pqap_hook;
|
||||
ret = pqap_hook(vcpu);
|
||||
if (!ret && vcpu->run->s.regs.gprs[1] & 0x00ff0000)
|
||||
kvm_s390_set_psw_cc(vcpu, 3);
|
||||
up_read(&vcpu->kvm->arch.crypto.pqap_hook_rwsem);
|
||||
return ret;
|
||||
}
|
||||
up_read(&vcpu->kvm->arch.crypto.pqap_hook_rwsem);
|
||||
/*
|
||||
* A vfio_driver must register a hook.
|
||||
* No hook means no driver to enable the SIE CRYCB and no queues.
|
||||
|
||||
@@ -136,7 +136,7 @@ static const struct pci_device_id *pci_match_device(struct pci_driver *drv,
|
||||
struct pci_dev *dev)
|
||||
{
|
||||
struct pci_dynid *dynid;
|
||||
const struct pci_device_id *found_id = NULL;
|
||||
const struct pci_device_id *found_id = NULL, *ids;
|
||||
|
||||
/* When driver_override is set, only bind to the matching driver */
|
||||
if (dev->driver_override && strcmp(dev->driver_override, drv->name))
|
||||
@@ -152,14 +152,28 @@ static const struct pci_device_id *pci_match_device(struct pci_driver *drv,
|
||||
}
|
||||
spin_unlock(&drv->dynids.lock);
|
||||
|
||||
if (!found_id)
|
||||
found_id = pci_match_id(drv->id_table, dev);
|
||||
if (found_id)
|
||||
return found_id;
|
||||
|
||||
for (ids = drv->id_table; (found_id = pci_match_id(ids, dev));
|
||||
ids = found_id + 1) {
|
||||
/*
|
||||
* The match table is split based on driver_override.
|
||||
* In case override_only was set, enforce driver_override
|
||||
* matching.
|
||||
*/
|
||||
if (found_id->override_only) {
|
||||
if (dev->driver_override)
|
||||
return found_id;
|
||||
} else {
|
||||
return found_id;
|
||||
}
|
||||
}
|
||||
|
||||
/* driver_override will always match, send a dummy id */
|
||||
if (!found_id && dev->driver_override)
|
||||
found_id = &pci_device_id_any;
|
||||
|
||||
return found_id;
|
||||
if (dev->driver_override)
|
||||
return &pci_device_id_any;
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -18,6 +18,7 @@
|
||||
#include <linux/delay.h>
|
||||
#include <linux/mutex.h>
|
||||
#include <linux/kvm_host.h>
|
||||
#include <linux/vfio.h>
|
||||
|
||||
#include "ap_bus.h"
|
||||
|
||||
@@ -79,14 +80,13 @@ struct ap_matrix {
|
||||
* @kvm: the struct holding guest's state
|
||||
*/
|
||||
struct ap_matrix_mdev {
|
||||
struct vfio_device vdev;
|
||||
struct list_head node;
|
||||
struct ap_matrix matrix;
|
||||
struct notifier_block group_notifier;
|
||||
struct notifier_block iommu_notifier;
|
||||
bool kvm_busy;
|
||||
wait_queue_head_t wait_for_kvm;
|
||||
struct kvm *kvm;
|
||||
struct kvm_s390_module_hook pqap_hook;
|
||||
crypto_hook pqap_hook;
|
||||
struct mdev_device *mdev;
|
||||
};
|
||||
|
||||
|
||||
@@ -1,24 +1,4 @@
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
config VFIO_IOMMU_TYPE1
|
||||
tristate
|
||||
depends on VFIO
|
||||
default n
|
||||
|
||||
config VFIO_IOMMU_SPAPR_TCE
|
||||
tristate
|
||||
depends on VFIO && SPAPR_TCE_IOMMU
|
||||
default VFIO
|
||||
|
||||
config VFIO_SPAPR_EEH
|
||||
tristate
|
||||
depends on EEH && VFIO_IOMMU_SPAPR_TCE
|
||||
default VFIO
|
||||
|
||||
config VFIO_VIRQFD
|
||||
tristate
|
||||
depends on VFIO && EVENTFD
|
||||
default n
|
||||
|
||||
menuconfig VFIO
|
||||
tristate "VFIO Non-Privileged userspace driver framework"
|
||||
select IOMMU_API
|
||||
@@ -29,9 +9,28 @@ menuconfig VFIO
|
||||
|
||||
If you don't know what to do here, say N.
|
||||
|
||||
if VFIO
|
||||
config VFIO_IOMMU_TYPE1
|
||||
tristate
|
||||
default n
|
||||
|
||||
config VFIO_IOMMU_SPAPR_TCE
|
||||
tristate
|
||||
depends on SPAPR_TCE_IOMMU
|
||||
default VFIO
|
||||
|
||||
config VFIO_SPAPR_EEH
|
||||
tristate
|
||||
depends on EEH && VFIO_IOMMU_SPAPR_TCE
|
||||
default VFIO
|
||||
|
||||
config VFIO_VIRQFD
|
||||
tristate
|
||||
select EVENTFD
|
||||
default n
|
||||
|
||||
config VFIO_NOIOMMU
|
||||
bool "VFIO No-IOMMU support"
|
||||
depends on VFIO
|
||||
help
|
||||
VFIO is built on the ability to isolate devices using the IOMMU.
|
||||
Only with an IOMMU can userspace access to DMA capable devices be
|
||||
@@ -48,4 +47,6 @@ source "drivers/vfio/pci/Kconfig"
|
||||
source "drivers/vfio/platform/Kconfig"
|
||||
source "drivers/vfio/mdev/Kconfig"
|
||||
source "drivers/vfio/fsl-mc/Kconfig"
|
||||
endif
|
||||
|
||||
source "virt/lib/Kconfig"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
config VFIO_FSL_MC
|
||||
tristate "VFIO support for QorIQ DPAA2 fsl-mc bus devices"
|
||||
depends on VFIO && FSL_MC_BUS && EVENTFD
|
||||
depends on FSL_MC_BUS
|
||||
select EVENTFD
|
||||
help
|
||||
Driver to enable support for the VFIO QorIQ DPAA2 fsl-mc
|
||||
(Management Complex) devices. This is required to passthrough
|
||||
|
||||
@@ -2,7 +2,6 @@
|
||||
|
||||
config VFIO_MDEV
|
||||
tristate "Mediated device driver framework"
|
||||
depends on VFIO
|
||||
default n
|
||||
help
|
||||
Provides a framework to virtualize devices.
|
||||
|
||||
@@ -1,19 +1,29 @@
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
config VFIO_PCI
|
||||
tristate "VFIO support for PCI devices"
|
||||
depends on VFIO && PCI && EVENTFD
|
||||
depends on MMU
|
||||
if PCI && MMU
|
||||
config VFIO_PCI_CORE
|
||||
tristate
|
||||
select VFIO_VIRQFD
|
||||
select IRQ_BYPASS_MANAGER
|
||||
|
||||
config VFIO_PCI_MMAP
|
||||
def_bool y if !S390
|
||||
|
||||
config VFIO_PCI_INTX
|
||||
def_bool y if !S390
|
||||
|
||||
config VFIO_PCI
|
||||
tristate "Generic VFIO support for any PCI device"
|
||||
select VFIO_PCI_CORE
|
||||
help
|
||||
Support for the PCI VFIO bus driver. This is required to make
|
||||
use of PCI drivers using the VFIO framework.
|
||||
Support for the generic PCI VFIO bus driver which can connect any
|
||||
PCI device to the VFIO framework.
|
||||
|
||||
If you don't know what to do here, say N.
|
||||
|
||||
if VFIO_PCI
|
||||
config VFIO_PCI_VGA
|
||||
bool "VFIO PCI support for VGA devices"
|
||||
depends on VFIO_PCI && X86 && VGA_ARB
|
||||
bool "Generic VFIO PCI support for VGA devices"
|
||||
depends on X86 && VGA_ARB
|
||||
help
|
||||
Support for VGA extension to VFIO PCI. This exposes an additional
|
||||
region on VGA devices for accessing legacy VGA addresses used by
|
||||
@@ -21,17 +31,9 @@ config VFIO_PCI_VGA
|
||||
|
||||
If you don't know what to do here, say N.
|
||||
|
||||
config VFIO_PCI_MMAP
|
||||
depends on VFIO_PCI
|
||||
def_bool y if !S390
|
||||
|
||||
config VFIO_PCI_INTX
|
||||
depends on VFIO_PCI
|
||||
def_bool y if !S390
|
||||
|
||||
config VFIO_PCI_IGD
|
||||
bool "VFIO PCI extensions for Intel graphics (GVT-d)"
|
||||
depends on VFIO_PCI && X86
|
||||
bool "Generic VFIO PCI extensions for Intel graphics (GVT-d)"
|
||||
depends on X86
|
||||
default y
|
||||
help
|
||||
Support for Intel IGD specific extensions to enable direct
|
||||
@@ -40,3 +42,5 @@ config VFIO_PCI_IGD
|
||||
and LPC bridge config space.
|
||||
|
||||
To enable Intel IGD assignment through vfio-pci, say Y.
|
||||
endif
|
||||
endif
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
# SPDX-License-Identifier: GPL-2.0-only
|
||||
|
||||
vfio-pci-y := vfio_pci.o vfio_pci_intrs.o vfio_pci_rdwr.o vfio_pci_config.o
|
||||
vfio-pci-$(CONFIG_VFIO_PCI_IGD) += vfio_pci_igd.o
|
||||
vfio-pci-$(CONFIG_S390) += vfio_pci_zdev.o
|
||||
vfio-pci-core-y := vfio_pci_core.o vfio_pci_intrs.o vfio_pci_rdwr.o vfio_pci_config.o
|
||||
vfio-pci-core-$(CONFIG_S390) += vfio_pci_zdev.o
|
||||
obj-$(CONFIG_VFIO_PCI_CORE) += vfio-pci-core.o
|
||||
|
||||
vfio-pci-y := vfio_pci.o
|
||||
vfio-pci-$(CONFIG_VFIO_PCI_IGD) += vfio_pci_igd.o
|
||||
obj-$(CONFIG_VFIO_PCI) += vfio-pci.o
|
||||
|
||||
File diff suppressed because it is too large
Load Diff
@@ -26,7 +26,7 @@
|
||||
#include <linux/vfio.h>
|
||||
#include <linux/slab.h>
|
||||
|
||||
#include "vfio_pci_private.h"
|
||||
#include <linux/vfio_pci_core.h>
|
||||
|
||||
/* Fake capability ID for standard config space */
|
||||
#define PCI_CAP_ID_BASIC 0
|
||||
@@ -108,9 +108,9 @@ static const u16 pci_ext_cap_length[PCI_EXT_CAP_ID_MAX + 1] = {
|
||||
struct perm_bits {
|
||||
u8 *virt; /* read/write virtual data, not hw */
|
||||
u8 *write; /* writeable bits */
|
||||
int (*readfn)(struct vfio_pci_device *vdev, int pos, int count,
|
||||
int (*readfn)(struct vfio_pci_core_device *vdev, int pos, int count,
|
||||
struct perm_bits *perm, int offset, __le32 *val);
|
||||
int (*writefn)(struct vfio_pci_device *vdev, int pos, int count,
|
||||
int (*writefn)(struct vfio_pci_core_device *vdev, int pos, int count,
|
||||
struct perm_bits *perm, int offset, __le32 val);
|
||||
};
|
||||
|
||||
@@ -171,7 +171,7 @@ static int vfio_user_config_write(struct pci_dev *pdev, int offset,
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int vfio_default_config_read(struct vfio_pci_device *vdev, int pos,
|
||||
static int vfio_default_config_read(struct vfio_pci_core_device *vdev, int pos,
|
||||
int count, struct perm_bits *perm,
|
||||
int offset, __le32 *val)
|
||||
{
|
||||
@@ -197,7 +197,7 @@ static int vfio_default_config_read(struct vfio_pci_device *vdev, int pos,
|
||||
return count;
|
||||
}
|
||||
|
||||
static int vfio_default_config_write(struct vfio_pci_device *vdev, int pos,
|
||||
static int vfio_default_config_write(struct vfio_pci_core_device *vdev, int pos,
|
||||
int count, struct perm_bits *perm,
|
||||
int offset, __le32 val)
|
||||
{
|
||||
@@ -244,7 +244,7 @@ static int vfio_default_config_write(struct vfio_pci_device *vdev, int pos,
|
||||
}
|
||||
|
||||
/* Allow direct read from hardware, except for capability next pointer */
|
||||
static int vfio_direct_config_read(struct vfio_pci_device *vdev, int pos,
|
||||
static int vfio_direct_config_read(struct vfio_pci_core_device *vdev, int pos,
|
||||
int count, struct perm_bits *perm,
|
||||
int offset, __le32 *val)
|
||||
{
|
||||
@@ -269,7 +269,7 @@ static int vfio_direct_config_read(struct vfio_pci_device *vdev, int pos,
|
||||
}
|
||||
|
||||
/* Raw access skips any kind of virtualization */
|
||||
static int vfio_raw_config_write(struct vfio_pci_device *vdev, int pos,
|
||||
static int vfio_raw_config_write(struct vfio_pci_core_device *vdev, int pos,
|
||||
int count, struct perm_bits *perm,
|
||||
int offset, __le32 val)
|
||||
{
|
||||
@@ -282,7 +282,7 @@ static int vfio_raw_config_write(struct vfio_pci_device *vdev, int pos,
|
||||
return count;
|
||||
}
|
||||
|
||||
static int vfio_raw_config_read(struct vfio_pci_device *vdev, int pos,
|
||||
static int vfio_raw_config_read(struct vfio_pci_core_device *vdev, int pos,
|
||||
int count, struct perm_bits *perm,
|
||||
int offset, __le32 *val)
|
||||
{
|
||||
@@ -296,7 +296,7 @@ static int vfio_raw_config_read(struct vfio_pci_device *vdev, int pos,
|
||||
}
|
||||
|
||||
/* Virt access uses only virtualization */
|
||||
static int vfio_virt_config_write(struct vfio_pci_device *vdev, int pos,
|
||||
static int vfio_virt_config_write(struct vfio_pci_core_device *vdev, int pos,
|
||||
int count, struct perm_bits *perm,
|
||||
int offset, __le32 val)
|
||||
{
|
||||
@@ -304,7 +304,7 @@ static int vfio_virt_config_write(struct vfio_pci_device *vdev, int pos,
|
||||
return count;
|
||||
}
|
||||
|
||||
static int vfio_virt_config_read(struct vfio_pci_device *vdev, int pos,
|
||||
static int vfio_virt_config_read(struct vfio_pci_core_device *vdev, int pos,
|
||||
int count, struct perm_bits *perm,
|
||||
int offset, __le32 *val)
|
||||
{
|
||||
@@ -396,7 +396,7 @@ static inline void p_setd(struct perm_bits *p, int off, u32 virt, u32 write)
|
||||
}
|
||||
|
||||
/* Caller should hold memory_lock semaphore */
|
||||
bool __vfio_pci_memory_enabled(struct vfio_pci_device *vdev)
|
||||
bool __vfio_pci_memory_enabled(struct vfio_pci_core_device *vdev)
|
||||
{
|
||||
struct pci_dev *pdev = vdev->pdev;
|
||||
u16 cmd = le16_to_cpu(*(__le16 *)&vdev->vconfig[PCI_COMMAND]);
|
||||
@@ -413,7 +413,7 @@ bool __vfio_pci_memory_enabled(struct vfio_pci_device *vdev)
|
||||
* Restore the *real* BARs after we detect a FLR or backdoor reset.
|
||||
* (backdoor = some device specific technique that we didn't catch)
|
||||
*/
|
||||
static void vfio_bar_restore(struct vfio_pci_device *vdev)
|
||||
static void vfio_bar_restore(struct vfio_pci_core_device *vdev)
|
||||
{
|
||||
struct pci_dev *pdev = vdev->pdev;
|
||||
u32 *rbar = vdev->rbar;
|
||||
@@ -460,7 +460,7 @@ static __le32 vfio_generate_bar_flags(struct pci_dev *pdev, int bar)
|
||||
* Pretend we're hardware and tweak the values of the *virtual* PCI BARs
|
||||
* to reflect the hardware capabilities. This implements BAR sizing.
|
||||
*/
|
||||
static void vfio_bar_fixup(struct vfio_pci_device *vdev)
|
||||
static void vfio_bar_fixup(struct vfio_pci_core_device *vdev)
|
||||
{
|
||||
struct pci_dev *pdev = vdev->pdev;
|
||||
int i;
|
||||
@@ -514,7 +514,7 @@ static void vfio_bar_fixup(struct vfio_pci_device *vdev)
|
||||
vdev->bardirty = false;
|
||||
}
|
||||
|
||||
static int vfio_basic_config_read(struct vfio_pci_device *vdev, int pos,
|
||||
static int vfio_basic_config_read(struct vfio_pci_core_device *vdev, int pos,
|
||||
int count, struct perm_bits *perm,
|
||||
int offset, __le32 *val)
|
||||
{
|
||||
@@ -536,7 +536,7 @@ static int vfio_basic_config_read(struct vfio_pci_device *vdev, int pos,
|
||||
}
|
||||
|
||||
/* Test whether BARs match the value we think they should contain */
|
||||
static bool vfio_need_bar_restore(struct vfio_pci_device *vdev)
|
||||
static bool vfio_need_bar_restore(struct vfio_pci_core_device *vdev)
|
||||
{
|
||||
int i = 0, pos = PCI_BASE_ADDRESS_0, ret;
|
||||
u32 bar;
|
||||
@@ -552,7 +552,7 @@ static bool vfio_need_bar_restore(struct vfio_pci_device *vdev)
|
||||
return false;
|
||||
}
|
||||
|
||||
static int vfio_basic_config_write(struct vfio_pci_device *vdev, int pos,
|
||||
static int vfio_basic_config_write(struct vfio_pci_core_device *vdev, int pos,
|
||||
int count, struct perm_bits *perm,
|
||||
int offset, __le32 val)
|
||||
{
|
||||
@@ -692,7 +692,7 @@ static int __init init_pci_cap_basic_perm(struct perm_bits *perm)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int vfio_pm_config_write(struct vfio_pci_device *vdev, int pos,
|
||||
static int vfio_pm_config_write(struct vfio_pci_core_device *vdev, int pos,
|
||||
int count, struct perm_bits *perm,
|
||||
int offset, __le32 val)
|
||||
{
|
||||
@@ -747,7 +747,7 @@ static int __init init_pci_cap_pm_perm(struct perm_bits *perm)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int vfio_vpd_config_write(struct vfio_pci_device *vdev, int pos,
|
||||
static int vfio_vpd_config_write(struct vfio_pci_core_device *vdev, int pos,
|
||||
int count, struct perm_bits *perm,
|
||||
int offset, __le32 val)
|
||||
{
|
||||
@@ -829,7 +829,7 @@ static int __init init_pci_cap_pcix_perm(struct perm_bits *perm)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int vfio_exp_config_write(struct vfio_pci_device *vdev, int pos,
|
||||
static int vfio_exp_config_write(struct vfio_pci_core_device *vdev, int pos,
|
||||
int count, struct perm_bits *perm,
|
||||
int offset, __le32 val)
|
||||
{
|
||||
@@ -913,7 +913,7 @@ static int __init init_pci_cap_exp_perm(struct perm_bits *perm)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int vfio_af_config_write(struct vfio_pci_device *vdev, int pos,
|
||||
static int vfio_af_config_write(struct vfio_pci_core_device *vdev, int pos,
|
||||
int count, struct perm_bits *perm,
|
||||
int offset, __le32 val)
|
||||
{
|
||||
@@ -1072,7 +1072,7 @@ int __init vfio_pci_init_perm_bits(void)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int vfio_find_cap_start(struct vfio_pci_device *vdev, int pos)
|
||||
static int vfio_find_cap_start(struct vfio_pci_core_device *vdev, int pos)
|
||||
{
|
||||
u8 cap;
|
||||
int base = (pos >= PCI_CFG_SPACE_SIZE) ? PCI_CFG_SPACE_SIZE :
|
||||
@@ -1089,7 +1089,7 @@ static int vfio_find_cap_start(struct vfio_pci_device *vdev, int pos)
|
||||
return pos;
|
||||
}
|
||||
|
||||
static int vfio_msi_config_read(struct vfio_pci_device *vdev, int pos,
|
||||
static int vfio_msi_config_read(struct vfio_pci_core_device *vdev, int pos,
|
||||
int count, struct perm_bits *perm,
|
||||
int offset, __le32 *val)
|
||||
{
|
||||
@@ -1109,7 +1109,7 @@ static int vfio_msi_config_read(struct vfio_pci_device *vdev, int pos,
|
||||
return vfio_default_config_read(vdev, pos, count, perm, offset, val);
|
||||
}
|
||||
|
||||
static int vfio_msi_config_write(struct vfio_pci_device *vdev, int pos,
|
||||
static int vfio_msi_config_write(struct vfio_pci_core_device *vdev, int pos,
|
||||
int count, struct perm_bits *perm,
|
||||
int offset, __le32 val)
|
||||
{
|
||||
@@ -1189,7 +1189,7 @@ static int init_pci_cap_msi_perm(struct perm_bits *perm, int len, u16 flags)
|
||||
}
|
||||
|
||||
/* Determine MSI CAP field length; initialize msi_perms on 1st call per vdev */
|
||||
static int vfio_msi_cap_len(struct vfio_pci_device *vdev, u8 pos)
|
||||
static int vfio_msi_cap_len(struct vfio_pci_core_device *vdev, u8 pos)
|
||||
{
|
||||
struct pci_dev *pdev = vdev->pdev;
|
||||
int len, ret;
|
||||
@@ -1222,7 +1222,7 @@ static int vfio_msi_cap_len(struct vfio_pci_device *vdev, u8 pos)
|
||||
}
|
||||
|
||||
/* Determine extended capability length for VC (2 & 9) and MFVC */
|
||||
static int vfio_vc_cap_len(struct vfio_pci_device *vdev, u16 pos)
|
||||
static int vfio_vc_cap_len(struct vfio_pci_core_device *vdev, u16 pos)
|
||||
{
|
||||
struct pci_dev *pdev = vdev->pdev;
|
||||
u32 tmp;
|
||||
@@ -1263,7 +1263,7 @@ static int vfio_vc_cap_len(struct vfio_pci_device *vdev, u16 pos)
|
||||
return len;
|
||||
}
|
||||
|
||||
static int vfio_cap_len(struct vfio_pci_device *vdev, u8 cap, u8 pos)
|
||||
static int vfio_cap_len(struct vfio_pci_core_device *vdev, u8 cap, u8 pos)
|
||||
{
|
||||
struct pci_dev *pdev = vdev->pdev;
|
||||
u32 dword;
|
||||
@@ -1338,7 +1338,7 @@ static int vfio_cap_len(struct vfio_pci_device *vdev, u8 cap, u8 pos)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int vfio_ext_cap_len(struct vfio_pci_device *vdev, u16 ecap, u16 epos)
|
||||
static int vfio_ext_cap_len(struct vfio_pci_core_device *vdev, u16 ecap, u16 epos)
|
||||
{
|
||||
struct pci_dev *pdev = vdev->pdev;
|
||||
u8 byte;
|
||||
@@ -1412,7 +1412,7 @@ static int vfio_ext_cap_len(struct vfio_pci_device *vdev, u16 ecap, u16 epos)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int vfio_fill_vconfig_bytes(struct vfio_pci_device *vdev,
|
||||
static int vfio_fill_vconfig_bytes(struct vfio_pci_core_device *vdev,
|
||||
int offset, int size)
|
||||
{
|
||||
struct pci_dev *pdev = vdev->pdev;
|
||||
@@ -1459,7 +1459,7 @@ static int vfio_fill_vconfig_bytes(struct vfio_pci_device *vdev,
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int vfio_cap_init(struct vfio_pci_device *vdev)
|
||||
static int vfio_cap_init(struct vfio_pci_core_device *vdev)
|
||||
{
|
||||
struct pci_dev *pdev = vdev->pdev;
|
||||
u8 *map = vdev->pci_config_map;
|
||||
@@ -1549,7 +1549,7 @@ static int vfio_cap_init(struct vfio_pci_device *vdev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int vfio_ecap_init(struct vfio_pci_device *vdev)
|
||||
static int vfio_ecap_init(struct vfio_pci_core_device *vdev)
|
||||
{
|
||||
struct pci_dev *pdev = vdev->pdev;
|
||||
u8 *map = vdev->pci_config_map;
|
||||
@@ -1669,7 +1669,7 @@ static const struct pci_device_id known_bogus_vf_intx_pin[] = {
|
||||
* for each area requiring emulated bits, but the array of pointers
|
||||
* would be comparable in size (at least for standard config space).
|
||||
*/
|
||||
int vfio_config_init(struct vfio_pci_device *vdev)
|
||||
int vfio_config_init(struct vfio_pci_core_device *vdev)
|
||||
{
|
||||
struct pci_dev *pdev = vdev->pdev;
|
||||
u8 *map, *vconfig;
|
||||
@@ -1773,7 +1773,7 @@ out:
|
||||
return pcibios_err_to_errno(ret);
|
||||
}
|
||||
|
||||
void vfio_config_free(struct vfio_pci_device *vdev)
|
||||
void vfio_config_free(struct vfio_pci_core_device *vdev)
|
||||
{
|
||||
kfree(vdev->vconfig);
|
||||
vdev->vconfig = NULL;
|
||||
@@ -1790,7 +1790,7 @@ void vfio_config_free(struct vfio_pci_device *vdev)
|
||||
* Find the remaining number of bytes in a dword that match the given
|
||||
* position. Stop at either the end of the capability or the dword boundary.
|
||||
*/
|
||||
static size_t vfio_pci_cap_remaining_dword(struct vfio_pci_device *vdev,
|
||||
static size_t vfio_pci_cap_remaining_dword(struct vfio_pci_core_device *vdev,
|
||||
loff_t pos)
|
||||
{
|
||||
u8 cap = vdev->pci_config_map[pos];
|
||||
@@ -1802,7 +1802,7 @@ static size_t vfio_pci_cap_remaining_dword(struct vfio_pci_device *vdev,
|
||||
return i;
|
||||
}
|
||||
|
||||
static ssize_t vfio_config_do_rw(struct vfio_pci_device *vdev, char __user *buf,
|
||||
static ssize_t vfio_config_do_rw(struct vfio_pci_core_device *vdev, char __user *buf,
|
||||
size_t count, loff_t *ppos, bool iswrite)
|
||||
{
|
||||
struct pci_dev *pdev = vdev->pdev;
|
||||
@@ -1885,7 +1885,7 @@ static ssize_t vfio_config_do_rw(struct vfio_pci_device *vdev, char __user *buf,
|
||||
return ret;
|
||||
}
|
||||
|
||||
ssize_t vfio_pci_config_rw(struct vfio_pci_device *vdev, char __user *buf,
|
||||
ssize_t vfio_pci_config_rw(struct vfio_pci_core_device *vdev, char __user *buf,
|
||||
size_t count, loff_t *ppos, bool iswrite)
|
||||
{
|
||||
size_t done = 0;
|
||||
|
||||
2158
drivers/vfio/pci/vfio_pci_core.c
Normal file
2158
drivers/vfio/pci/vfio_pci_core.c
Normal file
File diff suppressed because it is too large
Load Diff
@@ -15,7 +15,7 @@
|
||||
#include <linux/uaccess.h>
|
||||
#include <linux/vfio.h>
|
||||
|
||||
#include "vfio_pci_private.h"
|
||||
#include <linux/vfio_pci_core.h>
|
||||
|
||||
#define OPREGION_SIGNATURE "IntelGraphicsMem"
|
||||
#define OPREGION_SIZE (8 * 1024)
|
||||
@@ -25,8 +25,9 @@
|
||||
#define OPREGION_RVDS 0x3c2
|
||||
#define OPREGION_VERSION 0x16
|
||||
|
||||
static ssize_t vfio_pci_igd_rw(struct vfio_pci_device *vdev, char __user *buf,
|
||||
size_t count, loff_t *ppos, bool iswrite)
|
||||
static ssize_t vfio_pci_igd_rw(struct vfio_pci_core_device *vdev,
|
||||
char __user *buf, size_t count, loff_t *ppos,
|
||||
bool iswrite)
|
||||
{
|
||||
unsigned int i = VFIO_PCI_OFFSET_TO_INDEX(*ppos) - VFIO_PCI_NUM_REGIONS;
|
||||
void *base = vdev->region[i].data;
|
||||
@@ -45,7 +46,7 @@ static ssize_t vfio_pci_igd_rw(struct vfio_pci_device *vdev, char __user *buf,
|
||||
return count;
|
||||
}
|
||||
|
||||
static void vfio_pci_igd_release(struct vfio_pci_device *vdev,
|
||||
static void vfio_pci_igd_release(struct vfio_pci_core_device *vdev,
|
||||
struct vfio_pci_region *region)
|
||||
{
|
||||
memunmap(region->data);
|
||||
@@ -56,7 +57,7 @@ static const struct vfio_pci_regops vfio_pci_igd_regops = {
|
||||
.release = vfio_pci_igd_release,
|
||||
};
|
||||
|
||||
static int vfio_pci_igd_opregion_init(struct vfio_pci_device *vdev)
|
||||
static int vfio_pci_igd_opregion_init(struct vfio_pci_core_device *vdev)
|
||||
{
|
||||
__le32 *dwordp = (__le32 *)(vdev->vconfig + OPREGION_PCI_ADDR);
|
||||
u32 addr, size;
|
||||
@@ -160,7 +161,7 @@ static int vfio_pci_igd_opregion_init(struct vfio_pci_device *vdev)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static ssize_t vfio_pci_igd_cfg_rw(struct vfio_pci_device *vdev,
|
||||
static ssize_t vfio_pci_igd_cfg_rw(struct vfio_pci_core_device *vdev,
|
||||
char __user *buf, size_t count, loff_t *ppos,
|
||||
bool iswrite)
|
||||
{
|
||||
@@ -253,7 +254,7 @@ static ssize_t vfio_pci_igd_cfg_rw(struct vfio_pci_device *vdev,
|
||||
return count;
|
||||
}
|
||||
|
||||
static void vfio_pci_igd_cfg_release(struct vfio_pci_device *vdev,
|
||||
static void vfio_pci_igd_cfg_release(struct vfio_pci_core_device *vdev,
|
||||
struct vfio_pci_region *region)
|
||||
{
|
||||
struct pci_dev *pdev = region->data;
|
||||
@@ -266,7 +267,7 @@ static const struct vfio_pci_regops vfio_pci_igd_cfg_regops = {
|
||||
.release = vfio_pci_igd_cfg_release,
|
||||
};
|
||||
|
||||
static int vfio_pci_igd_cfg_init(struct vfio_pci_device *vdev)
|
||||
static int vfio_pci_igd_cfg_init(struct vfio_pci_core_device *vdev)
|
||||
{
|
||||
struct pci_dev *host_bridge, *lpc_bridge;
|
||||
int ret;
|
||||
@@ -314,7 +315,7 @@ static int vfio_pci_igd_cfg_init(struct vfio_pci_device *vdev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
int vfio_pci_igd_init(struct vfio_pci_device *vdev)
|
||||
int vfio_pci_igd_init(struct vfio_pci_core_device *vdev)
|
||||
{
|
||||
int ret;
|
||||
|
||||
|
||||
@@ -20,20 +20,20 @@
|
||||
#include <linux/wait.h>
|
||||
#include <linux/slab.h>
|
||||
|
||||
#include "vfio_pci_private.h"
|
||||
#include <linux/vfio_pci_core.h>
|
||||
|
||||
/*
|
||||
* INTx
|
||||
*/
|
||||
static void vfio_send_intx_eventfd(void *opaque, void *unused)
|
||||
{
|
||||
struct vfio_pci_device *vdev = opaque;
|
||||
struct vfio_pci_core_device *vdev = opaque;
|
||||
|
||||
if (likely(is_intx(vdev) && !vdev->virq_disabled))
|
||||
eventfd_signal(vdev->ctx[0].trigger, 1);
|
||||
}
|
||||
|
||||
void vfio_pci_intx_mask(struct vfio_pci_device *vdev)
|
||||
void vfio_pci_intx_mask(struct vfio_pci_core_device *vdev)
|
||||
{
|
||||
struct pci_dev *pdev = vdev->pdev;
|
||||
unsigned long flags;
|
||||
@@ -73,7 +73,7 @@ void vfio_pci_intx_mask(struct vfio_pci_device *vdev)
|
||||
*/
|
||||
static int vfio_pci_intx_unmask_handler(void *opaque, void *unused)
|
||||
{
|
||||
struct vfio_pci_device *vdev = opaque;
|
||||
struct vfio_pci_core_device *vdev = opaque;
|
||||
struct pci_dev *pdev = vdev->pdev;
|
||||
unsigned long flags;
|
||||
int ret = 0;
|
||||
@@ -107,7 +107,7 @@ static int vfio_pci_intx_unmask_handler(void *opaque, void *unused)
|
||||
return ret;
|
||||
}
|
||||
|
||||
void vfio_pci_intx_unmask(struct vfio_pci_device *vdev)
|
||||
void vfio_pci_intx_unmask(struct vfio_pci_core_device *vdev)
|
||||
{
|
||||
if (vfio_pci_intx_unmask_handler(vdev, NULL) > 0)
|
||||
vfio_send_intx_eventfd(vdev, NULL);
|
||||
@@ -115,7 +115,7 @@ void vfio_pci_intx_unmask(struct vfio_pci_device *vdev)
|
||||
|
||||
static irqreturn_t vfio_intx_handler(int irq, void *dev_id)
|
||||
{
|
||||
struct vfio_pci_device *vdev = dev_id;
|
||||
struct vfio_pci_core_device *vdev = dev_id;
|
||||
unsigned long flags;
|
||||
int ret = IRQ_NONE;
|
||||
|
||||
@@ -139,7 +139,7 @@ static irqreturn_t vfio_intx_handler(int irq, void *dev_id)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int vfio_intx_enable(struct vfio_pci_device *vdev)
|
||||
static int vfio_intx_enable(struct vfio_pci_core_device *vdev)
|
||||
{
|
||||
if (!is_irq_none(vdev))
|
||||
return -EINVAL;
|
||||
@@ -168,7 +168,7 @@ static int vfio_intx_enable(struct vfio_pci_device *vdev)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int vfio_intx_set_signal(struct vfio_pci_device *vdev, int fd)
|
||||
static int vfio_intx_set_signal(struct vfio_pci_core_device *vdev, int fd)
|
||||
{
|
||||
struct pci_dev *pdev = vdev->pdev;
|
||||
unsigned long irqflags = IRQF_SHARED;
|
||||
@@ -223,7 +223,7 @@ static int vfio_intx_set_signal(struct vfio_pci_device *vdev, int fd)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void vfio_intx_disable(struct vfio_pci_device *vdev)
|
||||
static void vfio_intx_disable(struct vfio_pci_core_device *vdev)
|
||||
{
|
||||
vfio_virqfd_disable(&vdev->ctx[0].unmask);
|
||||
vfio_virqfd_disable(&vdev->ctx[0].mask);
|
||||
@@ -244,7 +244,7 @@ static irqreturn_t vfio_msihandler(int irq, void *arg)
|
||||
return IRQ_HANDLED;
|
||||
}
|
||||
|
||||
static int vfio_msi_enable(struct vfio_pci_device *vdev, int nvec, bool msix)
|
||||
static int vfio_msi_enable(struct vfio_pci_core_device *vdev, int nvec, bool msix)
|
||||
{
|
||||
struct pci_dev *pdev = vdev->pdev;
|
||||
unsigned int flag = msix ? PCI_IRQ_MSIX : PCI_IRQ_MSI;
|
||||
@@ -285,7 +285,7 @@ static int vfio_msi_enable(struct vfio_pci_device *vdev, int nvec, bool msix)
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int vfio_msi_set_vector_signal(struct vfio_pci_device *vdev,
|
||||
static int vfio_msi_set_vector_signal(struct vfio_pci_core_device *vdev,
|
||||
int vector, int fd, bool msix)
|
||||
{
|
||||
struct pci_dev *pdev = vdev->pdev;
|
||||
@@ -364,7 +364,7 @@ static int vfio_msi_set_vector_signal(struct vfio_pci_device *vdev,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int vfio_msi_set_block(struct vfio_pci_device *vdev, unsigned start,
|
||||
static int vfio_msi_set_block(struct vfio_pci_core_device *vdev, unsigned start,
|
||||
unsigned count, int32_t *fds, bool msix)
|
||||
{
|
||||
int i, j, ret = 0;
|
||||
@@ -385,7 +385,7 @@ static int vfio_msi_set_block(struct vfio_pci_device *vdev, unsigned start,
|
||||
return ret;
|
||||
}
|
||||
|
||||
static void vfio_msi_disable(struct vfio_pci_device *vdev, bool msix)
|
||||
static void vfio_msi_disable(struct vfio_pci_core_device *vdev, bool msix)
|
||||
{
|
||||
struct pci_dev *pdev = vdev->pdev;
|
||||
int i;
|
||||
@@ -417,7 +417,7 @@ static void vfio_msi_disable(struct vfio_pci_device *vdev, bool msix)
|
||||
/*
|
||||
* IOCTL support
|
||||
*/
|
||||
static int vfio_pci_set_intx_unmask(struct vfio_pci_device *vdev,
|
||||
static int vfio_pci_set_intx_unmask(struct vfio_pci_core_device *vdev,
|
||||
unsigned index, unsigned start,
|
||||
unsigned count, uint32_t flags, void *data)
|
||||
{
|
||||
@@ -444,7 +444,7 @@ static int vfio_pci_set_intx_unmask(struct vfio_pci_device *vdev,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int vfio_pci_set_intx_mask(struct vfio_pci_device *vdev,
|
||||
static int vfio_pci_set_intx_mask(struct vfio_pci_core_device *vdev,
|
||||
unsigned index, unsigned start,
|
||||
unsigned count, uint32_t flags, void *data)
|
||||
{
|
||||
@@ -464,7 +464,7 @@ static int vfio_pci_set_intx_mask(struct vfio_pci_device *vdev,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int vfio_pci_set_intx_trigger(struct vfio_pci_device *vdev,
|
||||
static int vfio_pci_set_intx_trigger(struct vfio_pci_core_device *vdev,
|
||||
unsigned index, unsigned start,
|
||||
unsigned count, uint32_t flags, void *data)
|
||||
{
|
||||
@@ -507,7 +507,7 @@ static int vfio_pci_set_intx_trigger(struct vfio_pci_device *vdev,
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int vfio_pci_set_msi_trigger(struct vfio_pci_device *vdev,
|
||||
static int vfio_pci_set_msi_trigger(struct vfio_pci_core_device *vdev,
|
||||
unsigned index, unsigned start,
|
||||
unsigned count, uint32_t flags, void *data)
|
||||
{
|
||||
@@ -613,7 +613,7 @@ static int vfio_pci_set_ctx_trigger_single(struct eventfd_ctx **ctx,
|
||||
return -EINVAL;
|
||||
}
|
||||
|
||||
static int vfio_pci_set_err_trigger(struct vfio_pci_device *vdev,
|
||||
static int vfio_pci_set_err_trigger(struct vfio_pci_core_device *vdev,
|
||||
unsigned index, unsigned start,
|
||||
unsigned count, uint32_t flags, void *data)
|
||||
{
|
||||
@@ -624,7 +624,7 @@ static int vfio_pci_set_err_trigger(struct vfio_pci_device *vdev,
|
||||
count, flags, data);
|
||||
}
|
||||
|
||||
static int vfio_pci_set_req_trigger(struct vfio_pci_device *vdev,
|
||||
static int vfio_pci_set_req_trigger(struct vfio_pci_core_device *vdev,
|
||||
unsigned index, unsigned start,
|
||||
unsigned count, uint32_t flags, void *data)
|
||||
{
|
||||
@@ -635,11 +635,11 @@ static int vfio_pci_set_req_trigger(struct vfio_pci_device *vdev,
|
||||
count, flags, data);
|
||||
}
|
||||
|
||||
int vfio_pci_set_irqs_ioctl(struct vfio_pci_device *vdev, uint32_t flags,
|
||||
int vfio_pci_set_irqs_ioctl(struct vfio_pci_core_device *vdev, uint32_t flags,
|
||||
unsigned index, unsigned start, unsigned count,
|
||||
void *data)
|
||||
{
|
||||
int (*func)(struct vfio_pci_device *vdev, unsigned index,
|
||||
int (*func)(struct vfio_pci_core_device *vdev, unsigned index,
|
||||
unsigned start, unsigned count, uint32_t flags,
|
||||
void *data) = NULL;
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
#include <linux/vfio.h>
|
||||
#include <linux/vgaarb.h>
|
||||
|
||||
#include "vfio_pci_private.h"
|
||||
#include <linux/vfio_pci_core.h>
|
||||
|
||||
#ifdef __LITTLE_ENDIAN
|
||||
#define vfio_ioread64 ioread64
|
||||
@@ -38,7 +38,7 @@
|
||||
#define vfio_iowrite8 iowrite8
|
||||
|
||||
#define VFIO_IOWRITE(size) \
|
||||
static int vfio_pci_iowrite##size(struct vfio_pci_device *vdev, \
|
||||
static int vfio_pci_iowrite##size(struct vfio_pci_core_device *vdev, \
|
||||
bool test_mem, u##size val, void __iomem *io) \
|
||||
{ \
|
||||
if (test_mem) { \
|
||||
@@ -65,7 +65,7 @@ VFIO_IOWRITE(64)
|
||||
#endif
|
||||
|
||||
#define VFIO_IOREAD(size) \
|
||||
static int vfio_pci_ioread##size(struct vfio_pci_device *vdev, \
|
||||
static int vfio_pci_ioread##size(struct vfio_pci_core_device *vdev, \
|
||||
bool test_mem, u##size *val, void __iomem *io) \
|
||||
{ \
|
||||
if (test_mem) { \
|
||||
@@ -94,7 +94,7 @@ VFIO_IOREAD(32)
|
||||
* reads with -1. This is intended for handling MSI-X vector tables and
|
||||
* leftover space for ROM BARs.
|
||||
*/
|
||||
static ssize_t do_io_rw(struct vfio_pci_device *vdev, bool test_mem,
|
||||
static ssize_t 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)
|
||||
@@ -200,7 +200,7 @@ static ssize_t do_io_rw(struct vfio_pci_device *vdev, bool test_mem,
|
||||
return done;
|
||||
}
|
||||
|
||||
static int vfio_pci_setup_barmap(struct vfio_pci_device *vdev, int bar)
|
||||
static int vfio_pci_setup_barmap(struct vfio_pci_core_device *vdev, int bar)
|
||||
{
|
||||
struct pci_dev *pdev = vdev->pdev;
|
||||
int ret;
|
||||
@@ -224,7 +224,7 @@ static int vfio_pci_setup_barmap(struct vfio_pci_device *vdev, int bar)
|
||||
return 0;
|
||||
}
|
||||
|
||||
ssize_t vfio_pci_bar_rw(struct vfio_pci_device *vdev, char __user *buf,
|
||||
ssize_t vfio_pci_bar_rw(struct vfio_pci_core_device *vdev, char __user *buf,
|
||||
size_t count, loff_t *ppos, bool iswrite)
|
||||
{
|
||||
struct pci_dev *pdev = vdev->pdev;
|
||||
@@ -288,7 +288,7 @@ out:
|
||||
return done;
|
||||
}
|
||||
|
||||
ssize_t vfio_pci_vga_rw(struct vfio_pci_device *vdev, char __user *buf,
|
||||
ssize_t vfio_pci_vga_rw(struct vfio_pci_core_device *vdev, char __user *buf,
|
||||
size_t count, loff_t *ppos, bool iswrite)
|
||||
{
|
||||
int ret;
|
||||
@@ -384,7 +384,7 @@ static void vfio_pci_ioeventfd_do_write(struct vfio_pci_ioeventfd *ioeventfd,
|
||||
static int vfio_pci_ioeventfd_handler(void *opaque, void *unused)
|
||||
{
|
||||
struct vfio_pci_ioeventfd *ioeventfd = opaque;
|
||||
struct vfio_pci_device *vdev = ioeventfd->vdev;
|
||||
struct vfio_pci_core_device *vdev = ioeventfd->vdev;
|
||||
|
||||
if (ioeventfd->test_mem) {
|
||||
if (!down_read_trylock(&vdev->memory_lock))
|
||||
@@ -410,7 +410,7 @@ static void vfio_pci_ioeventfd_thread(void *opaque, void *unused)
|
||||
vfio_pci_ioeventfd_do_write(ioeventfd, ioeventfd->test_mem);
|
||||
}
|
||||
|
||||
long vfio_pci_ioeventfd(struct vfio_pci_device *vdev, loff_t offset,
|
||||
long vfio_pci_ioeventfd(struct vfio_pci_core_device *vdev, loff_t offset,
|
||||
uint64_t data, int count, int fd)
|
||||
{
|
||||
struct pci_dev *pdev = vdev->pdev;
|
||||
|
||||
@@ -14,7 +14,7 @@
|
||||
#include <asm/pci_clp.h>
|
||||
#include <asm/pci_io.h>
|
||||
|
||||
#include "vfio_pci_private.h"
|
||||
#include <linux/vfio_pci_core.h>
|
||||
|
||||
/*
|
||||
* Add the Base PCI Function information to the device info region.
|
||||
@@ -109,7 +109,7 @@ static int zpci_pfip_cap(struct zpci_dev *zdev, struct vfio_info_cap *caps)
|
||||
/*
|
||||
* Add all supported capabilities to the VFIO_DEVICE_GET_INFO capability chain.
|
||||
*/
|
||||
int vfio_pci_info_zdev_add_caps(struct vfio_pci_device *vdev,
|
||||
int vfio_pci_info_zdev_add_caps(struct vfio_pci_core_device *vdev,
|
||||
struct vfio_info_cap *caps)
|
||||
{
|
||||
struct zpci_dev *zdev = to_zpci(vdev->pdev);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user