mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-16 22:39:29 +00:00
hv: Add bit representation for MSI addr and data
As we enable Interrupt Remapping, bit positions in MSI address and data registers have a different syntax for programming. This patch adds bit granularity for MSI address and data structs. Tracked-On: #2407 Signed-off-by: Sainath Grandhi <sainath.grandhi@intel.com>
This commit is contained in:
committed by
wenlingz
parent
6825043078
commit
7d57eb056e
@@ -69,24 +69,24 @@ static int32_t vmsi_remap(const struct pci_vdev *vdev, bool enable)
|
||||
}
|
||||
|
||||
info.is_msix = 0;
|
||||
info.vmsi_addr = (uint64_t)addrlo | ((uint64_t)addrhi << 32U);
|
||||
info.vmsi_addr.full = (uint64_t)addrlo | ((uint64_t)addrhi << 32U);
|
||||
|
||||
/* MSI is being enabled or disabled */
|
||||
if (enable) {
|
||||
info.vmsi_data = msgdata;
|
||||
info.vmsi_data.full = msgdata;
|
||||
} else {
|
||||
info.vmsi_data = 0U;
|
||||
info.vmsi_data.full = 0U;
|
||||
}
|
||||
|
||||
ret = ptirq_msix_remap(vm, vdev->vbdf.value, 0U, &info);
|
||||
if (ret == 0) {
|
||||
/* Update MSI Capability structure to physical device */
|
||||
pci_pdev_write_cfg(pbdf, capoff + PCIR_MSI_ADDR, 0x4U, (uint32_t)info.pmsi_addr);
|
||||
pci_pdev_write_cfg(pbdf, capoff + PCIR_MSI_ADDR, 0x4U, (uint32_t)info.pmsi_addr.full);
|
||||
if ((msgctrl & PCIM_MSICTRL_64BIT) != 0U) {
|
||||
pci_pdev_write_cfg(pbdf, capoff + PCIR_MSI_ADDR_HIGH, 0x4U, (uint32_t)(info.pmsi_addr >> 32U));
|
||||
pci_pdev_write_cfg(pbdf, capoff + PCIR_MSI_DATA_64BIT, 0x2U, (uint16_t)info.pmsi_data);
|
||||
pci_pdev_write_cfg(pbdf, capoff + PCIR_MSI_ADDR_HIGH, 0x4U, (uint32_t)(info.pmsi_addr.full >> 32U));
|
||||
pci_pdev_write_cfg(pbdf, capoff + PCIR_MSI_DATA_64BIT, 0x2U, (uint16_t)info.pmsi_data.full);
|
||||
} else {
|
||||
pci_pdev_write_cfg(pbdf, capoff + PCIR_MSI_DATA, 0x2U, (uint16_t)info.pmsi_data);
|
||||
pci_pdev_write_cfg(pbdf, capoff + PCIR_MSI_DATA, 0x2U, (uint16_t)info.pmsi_data.full);
|
||||
}
|
||||
|
||||
/* If MSI Enable is being set, make sure INTxDIS bit is set */
|
||||
|
@@ -56,8 +56,8 @@ static int32_t vmsix_remap_entry(const struct pci_vdev *vdev, uint32_t index, bo
|
||||
int32_t ret;
|
||||
|
||||
info.is_msix = 1;
|
||||
info.vmsi_addr = vdev->msix.tables[index].addr;
|
||||
info.vmsi_data = (enable) ? vdev->msix.tables[index].data : 0U;
|
||||
info.vmsi_addr.full = vdev->msix.tables[index].addr;
|
||||
info.vmsi_data.full = (enable) ? vdev->msix.tables[index].data : 0U;
|
||||
|
||||
ret = ptirq_msix_remap(vdev->vpci->vm, vdev->vbdf.value, (uint16_t)index, &info);
|
||||
if (ret == 0) {
|
||||
@@ -71,10 +71,10 @@ static int32_t vmsix_remap_entry(const struct pci_vdev *vdev, uint32_t index, bo
|
||||
* write only
|
||||
*/
|
||||
stac();
|
||||
mmio_write32((uint32_t)(info.pmsi_addr), (void *)&(pentry->addr));
|
||||
mmio_write32((uint32_t)(info.pmsi_addr >> 32U), (void *)((char *)&(pentry->addr) + 4U));
|
||||
mmio_write32((uint32_t)(info.pmsi_addr.full), (void *)&(pentry->addr));
|
||||
mmio_write32((uint32_t)(info.pmsi_addr.full >> 32U), (void *)((char *)&(pentry->addr) + 4U));
|
||||
|
||||
mmio_write32(info.pmsi_data, (void *)&(pentry->data));
|
||||
mmio_write32(info.pmsi_data.full, (void *)&(pentry->data));
|
||||
mmio_write32(vdev->msix.tables[index].vector_control, (void *)&(pentry->vector_control));
|
||||
clac();
|
||||
}
|
||||
|
Reference in New Issue
Block a user