mirror of
https://github.com/projectacrn/acrn-hypervisor.git
synced 2025-06-22 05:30:24 +00:00
hv: ptdev: remove vector index from structure ptdev_msi_info
Since it's stored in source id already. Signed-off-by: Li, Fei1 <fei1.li@intel.com> Acked-by: Anthony Xu <anthony.xu@intel.com>
This commit is contained in:
parent
d8cc29b6ea
commit
2371839cad
@ -160,11 +160,11 @@ ptdev_build_physical_rte(struct vm *vm,
|
|||||||
*/
|
*/
|
||||||
static struct ptdev_remapping_info *
|
static struct ptdev_remapping_info *
|
||||||
add_msix_remapping(struct vm *vm, uint16_t virt_bdf, uint16_t phys_bdf,
|
add_msix_remapping(struct vm *vm, uint16_t virt_bdf, uint16_t phys_bdf,
|
||||||
uint32_t msix_entry_index)
|
uint32_t entry_nr)
|
||||||
{
|
{
|
||||||
struct ptdev_remapping_info *entry;
|
struct ptdev_remapping_info *entry;
|
||||||
DEFINE_MSI_SID(phys_sid, phys_bdf, msix_entry_index);
|
DEFINE_MSI_SID(phys_sid, phys_bdf, entry_nr);
|
||||||
DEFINE_MSI_SID(virt_sid, virt_bdf, msix_entry_index);
|
DEFINE_MSI_SID(virt_sid, virt_bdf, entry_nr);
|
||||||
|
|
||||||
spinlock_obtain(&ptdev_lock);
|
spinlock_obtain(&ptdev_lock);
|
||||||
entry = ptdev_lookup_entry_by_sid(PTDEV_INTR_MSI, &phys_sid, NULL);
|
entry = ptdev_lookup_entry_by_sid(PTDEV_INTR_MSI, &phys_sid, NULL);
|
||||||
@ -194,7 +194,7 @@ add_msix_remapping(struct vm *vm, uint16_t virt_bdf, uint16_t phys_bdf,
|
|||||||
entry->vm->vm_id, entry->virt_sid.msi_id.bdf,
|
entry->vm->vm_id, entry->virt_sid.msi_id.bdf,
|
||||||
vm->vm_id, virt_bdf);
|
vm->vm_id, virt_bdf);
|
||||||
ASSERT(false, "msix entry pbdf%x idx%d already in vm%d",
|
ASSERT(false, "msix entry pbdf%x idx%d already in vm%d",
|
||||||
phys_bdf, msix_entry_index, entry->vm->vm_id);
|
phys_bdf, entry_nr, entry->vm->vm_id);
|
||||||
|
|
||||||
spinlock_release(&ptdev_lock);
|
spinlock_release(&ptdev_lock);
|
||||||
return NULL;
|
return NULL;
|
||||||
@ -207,17 +207,17 @@ add_msix_remapping(struct vm *vm, uint16_t virt_bdf, uint16_t phys_bdf,
|
|||||||
|
|
||||||
dev_dbg(ACRN_DBG_IRQ,
|
dev_dbg(ACRN_DBG_IRQ,
|
||||||
"VM%d MSIX add vector mapping vbdf%x:pbdf%x idx=%d",
|
"VM%d MSIX add vector mapping vbdf%x:pbdf%x idx=%d",
|
||||||
entry->vm->vm_id, virt_bdf, phys_bdf, msix_entry_index);
|
entry->vm->vm_id, virt_bdf, phys_bdf, entry_nr);
|
||||||
|
|
||||||
return entry;
|
return entry;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* deactive & remove mapping entry of vbdf:msix_entry_index for vm */
|
/* deactive & remove mapping entry of vbdf:entry_nr for vm */
|
||||||
static void
|
static void
|
||||||
remove_msix_remapping(struct vm *vm, uint16_t virt_bdf, uint32_t msix_entry_index)
|
remove_msix_remapping(struct vm *vm, uint16_t virt_bdf, uint32_t entry_nr)
|
||||||
{
|
{
|
||||||
struct ptdev_remapping_info *entry;
|
struct ptdev_remapping_info *entry;
|
||||||
DEFINE_MSI_SID(virt_sid, virt_bdf, msix_entry_index);
|
DEFINE_MSI_SID(virt_sid, virt_bdf, entry_nr);
|
||||||
|
|
||||||
spinlock_obtain(&ptdev_lock);
|
spinlock_obtain(&ptdev_lock);
|
||||||
entry = ptdev_lookup_entry_by_sid(PTDEV_INTR_MSI, &virt_sid, vm);
|
entry = ptdev_lookup_entry_by_sid(PTDEV_INTR_MSI, &virt_sid, vm);
|
||||||
@ -233,7 +233,7 @@ remove_msix_remapping(struct vm *vm, uint16_t virt_bdf, uint32_t msix_entry_inde
|
|||||||
dev_dbg(ACRN_DBG_IRQ,
|
dev_dbg(ACRN_DBG_IRQ,
|
||||||
"VM%d MSIX remove vector mapping vbdf-pbdf:0x%x-0x%x idx=%d",
|
"VM%d MSIX remove vector mapping vbdf-pbdf:0x%x-0x%x idx=%d",
|
||||||
entry->vm->vm_id, virt_bdf,
|
entry->vm->vm_id, virt_bdf,
|
||||||
entry->phys_sid.msi_id.bdf, msix_entry_index);
|
entry->phys_sid.msi_id.bdf, entry_nr);
|
||||||
|
|
||||||
release_entry(entry);
|
release_entry(entry);
|
||||||
|
|
||||||
@ -477,17 +477,17 @@ void ptdev_intx_ack(struct vm *vm, uint8_t virt_pin,
|
|||||||
|
|
||||||
/* Main entry for PCI device assignment with MSI and MSI-X
|
/* Main entry for PCI device assignment with MSI and MSI-X
|
||||||
* MSI can up to 8 vectors and MSI-X can up to 1024 Vectors
|
* MSI can up to 8 vectors and MSI-X can up to 1024 Vectors
|
||||||
* We use msix_entry_index to indicate coming vectors
|
* We use entry_nr to indicate coming vectors
|
||||||
* msix_entry_index = 0 means first vector
|
* entry_nr = 0 means first vector
|
||||||
* user must provide bdf and msix_entry_index
|
* user must provide bdf and entry_nr
|
||||||
*
|
*
|
||||||
* This function is called by SOS pci MSI config routine through hcall
|
* This function is called by SOS pci MSI config routine through hcall
|
||||||
*/
|
*/
|
||||||
int ptdev_msix_remap(struct vm *vm, uint16_t virt_bdf,
|
int ptdev_msix_remap(struct vm *vm, uint16_t virt_bdf,
|
||||||
struct ptdev_msi_info *info)
|
uint16_t entry_nr, struct ptdev_msi_info *info)
|
||||||
{
|
{
|
||||||
struct ptdev_remapping_info *entry;
|
struct ptdev_remapping_info *entry;
|
||||||
DEFINE_MSI_SID(virt_sid, virt_bdf, info->msix_entry_index);
|
DEFINE_MSI_SID(virt_sid, virt_bdf, entry_nr);
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Device Model should pre-hold the mapping entries by calling
|
* Device Model should pre-hold the mapping entries by calling
|
||||||
@ -502,8 +502,8 @@ int ptdev_msix_remap(struct vm *vm, uint16_t virt_bdf,
|
|||||||
if (entry == NULL) {
|
if (entry == NULL) {
|
||||||
/* VM0 we add mapping dynamically */
|
/* VM0 we add mapping dynamically */
|
||||||
if (is_vm0(vm)) {
|
if (is_vm0(vm)) {
|
||||||
entry = add_msix_remapping(vm, virt_bdf, virt_bdf,
|
entry = add_msix_remapping(vm,
|
||||||
info->msix_entry_index);
|
virt_bdf, virt_bdf, entry_nr);
|
||||||
if (entry == NULL) {
|
if (entry == NULL) {
|
||||||
pr_err("dev-assign: msi entry exist in others");
|
pr_err("dev-assign: msi entry exist in others");
|
||||||
return -ENODEV;
|
return -ENODEV;
|
||||||
@ -532,10 +532,8 @@ int ptdev_msix_remap(struct vm *vm, uint16_t virt_bdf,
|
|||||||
|
|
||||||
dev_dbg(ACRN_DBG_IRQ,
|
dev_dbg(ACRN_DBG_IRQ,
|
||||||
"PCI %x:%x.%x MSI VR[%d] 0x%x->0x%x assigned to vm%d",
|
"PCI %x:%x.%x MSI VR[%d] 0x%x->0x%x assigned to vm%d",
|
||||||
(virt_bdf >> 8) & 0xFFU,
|
(virt_bdf >> 8) & 0xFFU, (virt_bdf >> 3) & 0x1FU,
|
||||||
(virt_bdf >> 3) & 0x1FU,
|
(virt_bdf) & 0x7U, entry_nr,
|
||||||
(virt_bdf) & 0x7U,
|
|
||||||
info->msix_entry_index,
|
|
||||||
entry->msi.virt_vector,
|
entry->msi.virt_vector,
|
||||||
entry->msi.phys_vector,
|
entry->msi.phys_vector,
|
||||||
entry->vm->vm_id);
|
entry->vm->vm_id);
|
||||||
|
@ -623,13 +623,12 @@ int32_t hcall_remap_pci_msix(struct vm *vm, uint16_t vmid, uint64_t param)
|
|||||||
ret = -1;
|
ret = -1;
|
||||||
} else {
|
} else {
|
||||||
info.msix = remap.msix;
|
info.msix = remap.msix;
|
||||||
info.msix_entry_index = remap.msix_entry_index;
|
|
||||||
info.vmsi_ctl = remap.msi_ctl;
|
info.vmsi_ctl = remap.msi_ctl;
|
||||||
info.vmsi_addr = remap.msi_addr;
|
info.vmsi_addr = remap.msi_addr;
|
||||||
info.vmsi_data = remap.msi_data;
|
info.vmsi_data = remap.msi_data;
|
||||||
|
|
||||||
ret = ptdev_msix_remap(target_vm,
|
ret = ptdev_msix_remap(target_vm,
|
||||||
remap.virt_bdf, &info);
|
remap.virt_bdf, remap.msix_entry_index, &info);
|
||||||
remap.msi_data = info.pmsi_data;
|
remap.msi_data = info.pmsi_data;
|
||||||
remap.msi_addr = info.pmsi_addr;
|
remap.msi_addr = info.pmsi_addr;
|
||||||
|
|
||||||
|
@ -12,7 +12,7 @@
|
|||||||
void ptdev_intx_ack(struct vm *vm, uint8_t virt_pin,
|
void ptdev_intx_ack(struct vm *vm, uint8_t virt_pin,
|
||||||
enum ptdev_vpin_source vpin_src);
|
enum ptdev_vpin_source vpin_src);
|
||||||
int ptdev_msix_remap(struct vm *vm, uint16_t virt_bdf,
|
int ptdev_msix_remap(struct vm *vm, uint16_t virt_bdf,
|
||||||
struct ptdev_msi_info *info);
|
uint16_t entry_nr, struct ptdev_msi_info *info);
|
||||||
int ptdev_intx_pin_remap(struct vm *vm, uint8_t virt_pin,
|
int ptdev_intx_pin_remap(struct vm *vm, uint8_t virt_pin,
|
||||||
enum ptdev_vpin_source vpin_src);
|
enum ptdev_vpin_source vpin_src);
|
||||||
int ptdev_add_intx_remapping(struct vm *vm, __unused uint16_t virt_bdf,
|
int ptdev_add_intx_remapping(struct vm *vm, __unused uint16_t virt_bdf,
|
||||||
|
@ -44,7 +44,6 @@ struct ptdev_msi_info {
|
|||||||
uint32_t pmsi_addr; /* phys msi_addr */
|
uint32_t pmsi_addr; /* phys msi_addr */
|
||||||
uint32_t pmsi_data; /* phys msi_data */
|
uint32_t pmsi_data; /* phys msi_data */
|
||||||
int msix; /* 0-MSI, 1-MSIX */
|
int msix; /* 0-MSI, 1-MSIX */
|
||||||
uint32_t msix_entry_index; /* MSI: 0, MSIX: index of vector table*/
|
|
||||||
uint32_t virt_vector;
|
uint32_t virt_vector;
|
||||||
uint32_t phys_vector;
|
uint32_t phys_vector;
|
||||||
};
|
};
|
||||||
|
Loading…
Reference in New Issue
Block a user