Skip to content

Commit

Permalink
hv: fill region ID to hv-land ivshmem PCI config space
Browse files Browse the repository at this point in the history
   1) region ID shall be configured by user via config tool.
   2) region ID is programmed to "Subsystem ID" of PCI config space.
   2) "Subsystem Vendor ID" is harded coded as 0x8086

Tracked-On: #8566
Signed-off-by: Yonghua Huang <yonghua.huang@intel.com>
Reviewed-by: Junjie Mao <junjie.mao@intel.com>
  • Loading branch information
yonghuah authored and acrnsi-robot committed Mar 28, 2024
1 parent a7a6732 commit ddfe218
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 0 deletions.
6 changes: 6 additions & 0 deletions hypervisor/dm/vpci/ivshmem.c
Original file line number Diff line number Diff line change
Expand Up @@ -329,6 +329,9 @@ static void init_ivshmem_bar(struct pci_vdev *vdev, uint32_t bar_idx)

static void init_ivshmem_vdev(struct pci_vdev *vdev)
{
struct acrn_vm_pci_dev_config *dev_config = vdev->pci_dev_config;
struct ivshmem_shm_region *region = find_shm_region(dev_config->shm_region_name);

create_ivshmem_device(vdev);

/* initialize ivshmem config */
Expand All @@ -338,6 +341,9 @@ static void init_ivshmem_vdev(struct pci_vdev *vdev)
pci_vdev_write_vcfg(vdev, PCIR_CLASS, 1U, IVSHMEM_CLASS);
pci_vdev_write_vcfg(vdev, PCIR_HDRTYPE, 1U,
PCIM_HDRTYPE_NORMAL | ((vdev->bdf.bits.f == 0U) ? PCIM_MFDEV : 0U));

pci_vdev_write_vcfg(vdev, PCIV_SUB_VENDOR_ID, 2U, IVSHMEM_INTEL_SUBVENDOR_ID);
pci_vdev_write_vcfg(vdev, PCIV_SUB_SYSTEM_ID, 2U, region->region_id);
add_vmsix_capability(vdev, MAX_IVSHMEM_MSIX_TBL_ENTRY_NUM, IVSHMEM_MSIX_BAR);

/* initialize ivshmem bars */
Expand Down
1 change: 1 addition & 0 deletions hypervisor/include/dm/ivshmem.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@

#define IVSHMEM_VENDOR_ID 0x1af4U
#define IVSHMEM_DEVICE_ID 0x1110U
#define IVSHMEM_INTEL_SUBVENDOR_ID 0x8086U
#ifdef CONFIG_IVSHMEM_ENABLED

/*
Expand Down

0 comments on commit ddfe218

Please sign in to comment.