mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-08-05 10:20:55 +00:00
HV: remove vpci ops
Do not call vpci ops, call the corresponding sharing mode/partition functions directly instead. Remove struct vpci_ops from vpci.h Tracked-On: #2534 Signed-off-by: dongshen <dongsheng.x.zhang@intel.com> Acked-by: Eddie Dong <eddie.dong@intel.com>
This commit is contained in:
parent
aa1ee9424c
commit
a403128a46
@ -172,10 +172,3 @@ void partition_mode_cfgwrite(struct acrn_vpci *vpci, union pci_bdf vbdf,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct vpci_ops partition_mode_vpci_ops = {
|
|
||||||
.init = partition_mode_vpci_init,
|
|
||||||
.deinit = partition_mode_vpci_deinit,
|
|
||||||
.cfgread = partition_mode_cfgread,
|
|
||||||
.cfgwrite = partition_mode_cfgwrite,
|
|
||||||
};
|
|
||||||
|
@ -68,7 +68,6 @@ static inline void pci_vdev_write_cfg_u32(struct pci_vdev *vdev, uint32_t offset
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef CONFIG_PARTITION_MODE
|
#ifdef CONFIG_PARTITION_MODE
|
||||||
extern const struct vpci_ops partition_mode_vpci_ops;
|
|
||||||
void vdev_hostbridge_init(struct pci_vdev *vdev);
|
void vdev_hostbridge_init(struct pci_vdev *vdev);
|
||||||
int32_t vdev_hostbridge_cfgread(const struct pci_vdev *vdev, uint32_t offset, uint32_t bytes, uint32_t *val);
|
int32_t vdev_hostbridge_cfgread(const struct pci_vdev *vdev, uint32_t offset, uint32_t bytes, uint32_t *val);
|
||||||
int32_t vdev_hostbridge_cfgwrite(struct pci_vdev *vdev, uint32_t offset, uint32_t bytes, uint32_t val);
|
int32_t vdev_hostbridge_cfgwrite(struct pci_vdev *vdev, uint32_t offset, uint32_t bytes, uint32_t val);
|
||||||
@ -80,8 +79,6 @@ int32_t vdev_pt_cfgwrite(struct pci_vdev *vdev, uint32_t offset, uint32_t bytes,
|
|||||||
void vdev_pt_deinit(const struct pci_vdev *vdev);
|
void vdev_pt_deinit(const struct pci_vdev *vdev);
|
||||||
|
|
||||||
#else
|
#else
|
||||||
extern const struct vpci_ops sharing_mode_vpci_ops;
|
|
||||||
|
|
||||||
void vmsi_init(struct pci_vdev *vdev);
|
void vmsi_init(struct pci_vdev *vdev);
|
||||||
int32_t vmsi_cfgread(const struct pci_vdev *vdev, uint32_t offset, uint32_t bytes, uint32_t *val);
|
int32_t vmsi_cfgread(const struct pci_vdev *vdev, uint32_t offset, uint32_t bytes, uint32_t *val);
|
||||||
int32_t vmsi_cfgwrite(struct pci_vdev *vdev, uint32_t offset, uint32_t bytes, uint32_t val);
|
int32_t vmsi_cfgwrite(struct pci_vdev *vdev, uint32_t offset, uint32_t bytes, uint32_t val);
|
||||||
|
@ -142,13 +142,6 @@ void sharing_mode_vpci_deinit(const struct acrn_vm *vm)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
const struct vpci_ops sharing_mode_vpci_ops = {
|
|
||||||
.init = sharing_mode_vpci_init,
|
|
||||||
.deinit = sharing_mode_vpci_deinit,
|
|
||||||
.cfgread = sharing_mode_cfgread,
|
|
||||||
.cfgwrite = sharing_mode_cfgwrite,
|
|
||||||
};
|
|
||||||
|
|
||||||
void vpci_set_ptdev_intr_info(const struct acrn_vm *target_vm, uint16_t vbdf, uint16_t pbdf)
|
void vpci_set_ptdev_intr_info(const struct acrn_vm *target_vm, uint16_t vbdf, uint16_t pbdf)
|
||||||
{
|
{
|
||||||
struct pci_vdev *vdev;
|
struct pci_vdev *vdev;
|
||||||
|
@ -75,9 +75,11 @@ static uint32_t pci_cfgdata_io_read(struct acrn_vm *vm, uint16_t addr, size_t by
|
|||||||
uint32_t val = ~0U;
|
uint32_t val = ~0U;
|
||||||
|
|
||||||
if (pi->cached_enable) {
|
if (pi->cached_enable) {
|
||||||
if ((vpci->ops != NULL) && (vpci->ops->cfgread != NULL)) {
|
#ifdef CONFIG_PARTITION_MODE
|
||||||
vpci->ops->cfgread(vpci, pi->cached_bdf, pi->cached_reg + offset, bytes, &val);
|
partition_mode_cfgread(vpci, pi->cached_bdf, pi->cached_reg + offset, bytes, &val);
|
||||||
}
|
#else
|
||||||
|
sharing_mode_cfgread(vpci, pi->cached_bdf, pi->cached_reg + offset, bytes, &val);
|
||||||
|
#endif
|
||||||
pci_cfg_clear_cache(pi);
|
pci_cfg_clear_cache(pi);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -91,9 +93,11 @@ static void pci_cfgdata_io_write(struct acrn_vm *vm, uint16_t addr, size_t bytes
|
|||||||
uint16_t offset = addr - PCI_CONFIG_DATA;
|
uint16_t offset = addr - PCI_CONFIG_DATA;
|
||||||
|
|
||||||
if (pi->cached_enable) {
|
if (pi->cached_enable) {
|
||||||
if ((vpci->ops != NULL) && (vpci->ops->cfgwrite != NULL)) {
|
#ifdef CONFIG_PARTITION_MODE
|
||||||
vpci->ops->cfgwrite(vpci, pi->cached_bdf, pi->cached_reg + offset, bytes, val);
|
partition_mode_cfgwrite(vpci, pi->cached_bdf, pi->cached_reg + offset, bytes, val);
|
||||||
}
|
#else
|
||||||
|
sharing_mode_cfgwrite(vpci, pi->cached_bdf, pi->cached_reg + offset, bytes, val);
|
||||||
|
#endif
|
||||||
pci_cfg_clear_cache(pi);
|
pci_cfg_clear_cache(pi);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -101,6 +105,7 @@ static void pci_cfgdata_io_write(struct acrn_vm *vm, uint16_t addr, size_t bytes
|
|||||||
void vpci_init(struct acrn_vm *vm)
|
void vpci_init(struct acrn_vm *vm)
|
||||||
{
|
{
|
||||||
struct acrn_vpci *vpci = &vm->vpci;
|
struct acrn_vpci *vpci = &vm->vpci;
|
||||||
|
int32_t ret;
|
||||||
|
|
||||||
struct vm_io_range pci_cfgaddr_range = {
|
struct vm_io_range pci_cfgaddr_range = {
|
||||||
.flags = IO_ATTR_RW,
|
.flags = IO_ATTR_RW,
|
||||||
@ -117,12 +122,12 @@ void vpci_init(struct acrn_vm *vm)
|
|||||||
vpci->vm = vm;
|
vpci->vm = vm;
|
||||||
|
|
||||||
#ifdef CONFIG_PARTITION_MODE
|
#ifdef CONFIG_PARTITION_MODE
|
||||||
vpci->ops = &partition_mode_vpci_ops;
|
ret = partition_mode_vpci_init(vm);
|
||||||
#else
|
#else
|
||||||
vpci->ops = &sharing_mode_vpci_ops;
|
ret = sharing_mode_vpci_init(vm);
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
if ((vpci->ops->init != NULL) && (vpci->ops->init(vm) == 0)) {
|
if (ret == 0) {
|
||||||
/*
|
/*
|
||||||
* SOS: intercept port CF8 only.
|
* SOS: intercept port CF8 only.
|
||||||
* UOS or partition mode: register handler for CF8 only and I/O requests to CF9/CFA/CFB are
|
* UOS or partition mode: register handler for CF8 only and I/O requests to CF9/CFA/CFB are
|
||||||
@ -139,9 +144,9 @@ void vpci_init(struct acrn_vm *vm)
|
|||||||
|
|
||||||
void vpci_cleanup(const struct acrn_vm *vm)
|
void vpci_cleanup(const struct acrn_vm *vm)
|
||||||
{
|
{
|
||||||
const struct acrn_vpci *vpci = &vm->vpci;
|
#ifdef CONFIG_PARTITION_MODE
|
||||||
|
partition_mode_vpci_deinit(vm);
|
||||||
if ((vpci->ops != NULL) && (vpci->ops->deinit != NULL)) {
|
#else
|
||||||
vpci->ops->deinit(vm);
|
sharing_mode_vpci_deinit(vm);
|
||||||
}
|
#endif
|
||||||
}
|
}
|
||||||
|
@ -88,19 +88,9 @@ struct pci_addr_info {
|
|||||||
bool cached_enable;
|
bool cached_enable;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct vpci_ops {
|
|
||||||
int32_t (*init)(const struct acrn_vm *vm);
|
|
||||||
void (*deinit)(const struct acrn_vm *vm);
|
|
||||||
void (*cfgread)(struct acrn_vpci *vpci, union pci_bdf vbdf, uint32_t offset,
|
|
||||||
uint32_t bytes, uint32_t *val);
|
|
||||||
void (*cfgwrite)(struct acrn_vpci *vpci, union pci_bdf vbdf, uint32_t offset,
|
|
||||||
uint32_t bytes, uint32_t val);
|
|
||||||
};
|
|
||||||
|
|
||||||
struct acrn_vpci {
|
struct acrn_vpci {
|
||||||
struct acrn_vm *vm;
|
struct acrn_vm *vm;
|
||||||
struct pci_addr_info addr_info;
|
struct pci_addr_info addr_info;
|
||||||
const struct vpci_ops *ops;
|
|
||||||
uint32_t pci_vdev_cnt;
|
uint32_t pci_vdev_cnt;
|
||||||
struct pci_vdev pci_vdevs[CONFIG_MAX_PCI_DEV_NUM];
|
struct pci_vdev pci_vdevs[CONFIG_MAX_PCI_DEV_NUM];
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user