mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-09-24 10:17:28 +00:00
hv: ptdev: minor refine about ptirq_build_physical_msi
The virtual MSI information could be included in ptirq_remapping_info structrue, there's no need to pass another input paramater for this puepose. So we could remove the ptirq_msi_info input. Tracked-On: #4550 Signed-off-by: Li Fei1 <fei1.li@intel.com>
This commit is contained in:
@@ -62,7 +62,7 @@ static inline void enable_disable_msi(const struct pci_vdev *vdev, bool enable)
|
||||
*/
|
||||
static void remap_vmsi(const struct pci_vdev *vdev)
|
||||
{
|
||||
struct ptirq_msi_info info = {};
|
||||
struct msi_info info = {};
|
||||
union pci_bdf pbdf = vdev->pdev->bdf;
|
||||
struct acrn_vm *vm = vpci2vm(vdev->vpci);
|
||||
uint32_t capoff = vdev->msi.capoff;
|
||||
@@ -76,17 +76,17 @@ static void remap_vmsi(const struct pci_vdev *vdev)
|
||||
} else {
|
||||
vmsi_msgdata = pci_vdev_read_vcfg(vdev, (capoff + PCIR_MSI_DATA), 2U);
|
||||
}
|
||||
info.vmsi_addr.full = (uint64_t)vmsi_addrlo | ((uint64_t)vmsi_addrhi << 32U);
|
||||
info.vmsi_data.full = vmsi_msgdata;
|
||||
info.addr.full = (uint64_t)vmsi_addrlo | ((uint64_t)vmsi_addrhi << 32U);
|
||||
info.data.full = vmsi_msgdata;
|
||||
|
||||
if (ptirq_prepare_msix_remap(vm, vdev->bdf.value, pbdf.value, 0U, &info) == 0) {
|
||||
pci_pdev_write_cfg(pbdf, capoff + PCIR_MSI_ADDR, 0x4U, (uint32_t)info.pmsi_addr.full);
|
||||
pci_pdev_write_cfg(pbdf, capoff + PCIR_MSI_ADDR, 0x4U, (uint32_t)info.addr.full);
|
||||
if (vdev->msi.is_64bit) {
|
||||
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);
|
||||
(uint32_t)(info.addr.full >> 32U));
|
||||
pci_pdev_write_cfg(pbdf, capoff + PCIR_MSI_DATA_64BIT, 0x2U, (uint16_t)info.data.full);
|
||||
} else {
|
||||
pci_pdev_write_cfg(pbdf, capoff + PCIR_MSI_DATA, 0x2U, (uint16_t)info.pmsi_data.full);
|
||||
pci_pdev_write_cfg(pbdf, capoff + PCIR_MSI_DATA, 0x2U, (uint16_t)info.data.full);
|
||||
}
|
||||
|
||||
/* If MSI Enable is being set, make sure INTxDIS bit is set */
|
||||
|
@@ -79,14 +79,14 @@ static void remap_one_vmsix_entry(const struct pci_vdev *vdev, uint32_t index)
|
||||
{
|
||||
const struct msix_table_entry *ventry;
|
||||
struct msix_table_entry *pentry;
|
||||
struct ptirq_msi_info info = {};
|
||||
struct msi_info info = {};
|
||||
int32_t ret;
|
||||
|
||||
mask_one_msix_vector(vdev, index);
|
||||
ventry = &vdev->msix.table_entries[index];
|
||||
if ((ventry->vector_control & PCIM_MSIX_VCTRL_MASK) == 0U) {
|
||||
info.vmsi_addr.full = vdev->msix.table_entries[index].addr;
|
||||
info.vmsi_data.full = vdev->msix.table_entries[index].data;
|
||||
info.addr.full = vdev->msix.table_entries[index].addr;
|
||||
info.data.full = vdev->msix.table_entries[index].data;
|
||||
|
||||
ret = ptirq_prepare_msix_remap(vpci2vm(vdev->vpci), vdev->bdf.value, vdev->pdev->bdf.value, (uint16_t)index, &info);
|
||||
if (ret == 0) {
|
||||
@@ -99,10 +99,10 @@ static void remap_one_vmsix_entry(const struct pci_vdev *vdev, uint32_t index)
|
||||
* write only
|
||||
*/
|
||||
stac();
|
||||
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((uint32_t)(info.addr.full), (void *)&(pentry->addr));
|
||||
mmio_write32((uint32_t)(info.addr.full >> 32U), (void *)((char *)&(pentry->addr) + 4U));
|
||||
|
||||
mmio_write32(info.pmsi_data.full, (void *)&(pentry->data));
|
||||
mmio_write32(info.data.full, (void *)&(pentry->data));
|
||||
mmio_write32(vdev->msix.table_entries[index].vector_control, (void *)&(pentry->vector_control));
|
||||
clac();
|
||||
}
|
||||
|
Reference in New Issue
Block a user