mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-16 14:28:56 +00:00
hv: dm: Use new virtual device management ioctls
IC_ADD_HV_VDEV -> ACRN_IOCTL_CREATE_VDEV IC_REMOVE_HV_VDEV -> ACRN_IOCTL_DESTROY_VDEV struct acrn_emul_dev -> struct acrn_vdev Also, move struct acrn_vdev to acrn_common.h as this structure is used by both DM and HV. Tracked-On: #6282 Signed-off-by: Shuo A Liu <shuo.a.liu@intel.com>
This commit is contained in:
@@ -147,11 +147,11 @@ static int
|
||||
create_ivshmem_from_hv(struct vmctx *ctx, struct pci_vdev *vdev,
|
||||
const char *shm_name, uint32_t shm_size)
|
||||
{
|
||||
struct acrn_emul_dev dev = {};
|
||||
struct acrn_vdev dev = {};
|
||||
uint64_t addr = 0;
|
||||
|
||||
dev.dev_id.fields.vendor_id = IVSHMEM_VENDOR_ID;
|
||||
dev.dev_id.fields.device_id = IVSHMEM_DEVICE_ID;
|
||||
dev.id.fields.vendor = IVSHMEM_VENDOR_ID;
|
||||
dev.id.fields.device = IVSHMEM_DEVICE_ID;
|
||||
dev.slot = PCI_BDF(vdev->bus, vdev->slot, vdev->func);
|
||||
dev.io_addr[IVSHMEM_MMIO_BAR] = pci_get_cfgdata32(vdev,
|
||||
PCIR_BAR(IVSHMEM_MMIO_BAR));
|
||||
@@ -347,10 +347,10 @@ static void
|
||||
destroy_ivshmem_from_hv(struct vmctx *ctx, struct pci_vdev *vdev)
|
||||
{
|
||||
|
||||
struct acrn_emul_dev emul_dev = {};
|
||||
struct acrn_vdev emul_dev = {};
|
||||
|
||||
emul_dev.dev_id.fields.vendor_id = IVSHMEM_VENDOR_ID;
|
||||
emul_dev.dev_id.fields.device_id = IVSHMEM_DEVICE_ID;
|
||||
emul_dev.id.fields.vendor = IVSHMEM_VENDOR_ID;
|
||||
emul_dev.id.fields.device = IVSHMEM_DEVICE_ID;
|
||||
emul_dev.slot = PCI_BDF(vdev->bus, vdev->slot, vdev->func);
|
||||
vm_remove_hv_vdev(ctx, &emul_dev);
|
||||
}
|
||||
|
@@ -69,11 +69,11 @@ add_vroot_port(struct vmctx *ctx, struct passthru_dev *ptdev, struct pci_device
|
||||
int offset = 0;
|
||||
uint32_t dev_cap = 0;
|
||||
|
||||
struct acrn_emul_dev rp_vdev = {};
|
||||
struct acrn_vdev rp_vdev = {};
|
||||
struct vrp_config *rp_priv = (struct vrp_config *)&rp_vdev.args;
|
||||
|
||||
rp_vdev.dev_id.fields.vendor_id = PTM_ROOT_PORT_VENDOR;
|
||||
rp_vdev.dev_id.fields.device_id = PTM_ROOT_PORT_DEVICE;
|
||||
rp_vdev.id.fields.vendor = PTM_ROOT_PORT_VENDOR;
|
||||
rp_vdev.id.fields.device = PTM_ROOT_PORT_DEVICE;
|
||||
|
||||
// virtual root port takes bdf from its downstream device
|
||||
rp_vdev.slot = PCI_BDF(ptdev->dev->bus, ptdev->dev->slot, ptdev->dev->func);
|
||||
|
@@ -89,7 +89,7 @@ pci_uart_init(struct vmctx *ctx, struct pci_vdev *dev, char *opts)
|
||||
char *tmp, *val = NULL;
|
||||
bool is_hv_land = false;
|
||||
uint32_t vuart_idx;
|
||||
struct acrn_emul_dev vdev = {};
|
||||
struct acrn_vdev vdev = {};
|
||||
int32_t err = 0;
|
||||
|
||||
if (opts != NULL) {
|
||||
@@ -116,8 +116,8 @@ pci_uart_init(struct vmctx *ctx, struct pci_vdev *dev, char *opts)
|
||||
pci_emul_alloc_bar(dev, 0, PCIBAR_MEM32, 256);
|
||||
pci_emul_alloc_bar(dev, 1, PCIBAR_MEM32, PAGE_SIZE);
|
||||
dev->arg = NULL;
|
||||
vdev.dev_id.fields.vendor_id = COM_VENDOR;
|
||||
vdev.dev_id.fields.device_id = COM_DEV;
|
||||
vdev.id.fields.vendor = COM_VENDOR;
|
||||
vdev.id.fields.device = COM_DEV;
|
||||
vdev.slot = PCI_BDF(dev->bus, dev->slot, dev->func);
|
||||
vdev.io_addr[0] = pci_get_cfgdata32(dev, PCIR_BAR(0));
|
||||
vdev.io_addr[1] = pci_get_cfgdata32(dev, PCIR_BAR(1));
|
||||
@@ -150,11 +150,11 @@ static void
|
||||
pci_uart_deinit(struct vmctx *ctx, struct pci_vdev *dev, char *opts)
|
||||
{
|
||||
struct uart_vdev *uart = (struct uart_vdev *)dev->arg;
|
||||
struct acrn_emul_dev emul_dev = {};
|
||||
struct acrn_vdev emul_dev = {};
|
||||
|
||||
if (uart == NULL) {
|
||||
emul_dev.dev_id.fields.vendor_id = COM_VENDOR;
|
||||
emul_dev.dev_id.fields.device_id = COM_DEV;
|
||||
emul_dev.id.fields.vendor = COM_VENDOR;
|
||||
emul_dev.id.fields.device = COM_DEV;
|
||||
emul_dev.slot = PCI_BDF(dev->bus, dev->slot, dev->func);
|
||||
vm_remove_hv_vdev(ctx, &emul_dev);
|
||||
return;
|
||||
|
Reference in New Issue
Block a user