@@ -1756,16 +1756,17 @@ int xc_domain_ioport_mapping(xc_interface *xch,
int xc_domain_update_msi_irq(
xc_interface *xch,
uint32_t domid,
- uint32_t gvec,
uint32_t pirq,
+ uint64_t addr,
+ uint32_t data,
uint32_t gflags,
uint64_t gtable);
int xc_domain_unbind_msi_irq(xc_interface *xch,
uint32_t domid,
- uint32_t gvec,
uint32_t pirq,
- uint32_t gflags);
+ uint64_t addr,
+ uint32_t data);
int xc_domain_bind_pt_irq(xc_interface *xch,
uint32_t domid,
@@ -1735,8 +1735,9 @@ int xc_deassign_dt_device(
int xc_domain_update_msi_irq(
xc_interface *xch,
uint32_t domid,
- uint32_t gvec,
uint32_t pirq,
+ uint64_t addr,
+ uint32_t data,
uint32_t gflags,
uint64_t gtable)
{
@@ -1750,7 +1751,8 @@ int xc_domain_update_msi_irq(
bind = &(domctl.u.bind_pt_irq);
bind->irq_type = PT_IRQ_TYPE_MSI;
bind->machine_irq = pirq;
- bind->u.msi.gvec = gvec;
+ bind->u.msi.addr = addr;
+ bind->u.msi.data = data;
bind->u.msi.gflags = gflags;
bind->u.msi.gtable = gtable;
@@ -1761,9 +1763,9 @@ int xc_domain_update_msi_irq(
int xc_domain_unbind_msi_irq(
xc_interface *xch,
uint32_t domid,
- uint32_t gvec,
uint32_t pirq,
- uint32_t gflags)
+ uint64_t addr,
+ uint32_t data)
{
int rc;
struct xen_domctl_bind_pt_irq *bind;
@@ -1775,8 +1777,8 @@ int xc_domain_unbind_msi_irq(
bind = &(domctl.u.bind_pt_irq);
bind->irq_type = PT_IRQ_TYPE_MSI;
bind->machine_irq = pirq;
- bind->u.msi.gvec = gvec;
- bind->u.msi.gflags = gflags;
+ bind->u.msi.addr = addr;
+ bind->u.msi.data = data;
rc = do_domctl(xch, &domctl);
return rc;
@@ -101,12 +101,12 @@ int vmsi_deliver(
void vmsi_deliver_pirq(struct domain *d, const struct hvm_pirq_dpci *pirq_dpci)
{
- uint32_t flags = pirq_dpci->gmsi.gflags;
- int vector = pirq_dpci->gmsi.gvec;
- uint8_t dest = (uint8_t)flags;
- bool dest_mode = flags & XEN_DOMCTL_VMSI_X86_DM_MASK;
- uint8_t delivery_mode = MASK_EXTR(flags, XEN_DOMCTL_VMSI_X86_DELIV_MASK);
- bool trig_mode = flags & XEN_DOMCTL_VMSI_X86_TRIG_MASK;
+ uint8_t vector = pirq_dpci->gmsi.data & MSI_DATA_VECTOR_MASK;
+ uint8_t dest = MASK_EXTR(pirq_dpci->gmsi.addr, MSI_ADDR_DEST_ID_MASK);
+ bool dest_mode = pirq_dpci->gmsi.addr & MSI_ADDR_DESTMODE_MASK;
+ uint8_t delivery_mode = MASK_EXTR(pirq_dpci->gmsi.data,
+ MSI_DATA_DELIVERY_MODE_MASK);
+ bool trig_mode = pirq_dpci->gmsi.data & MSI_DATA_TRIGGER_MASK;
HVM_DBG_LOG(DBG_LEVEL_IOAPIC,
"msi: dest=%x dest_mode=%x delivery_mode=%x "
@@ -339,19 +339,17 @@ int pt_irq_create_bind(
{
case PT_IRQ_TYPE_MSI:
{
- uint8_t dest, delivery_mode;
+ uint8_t dest, delivery_mode, gvec;
bool dest_mode;
int dest_vcpu_id;
const struct vcpu *vcpu;
- uint32_t gflags = pt_irq_bind->u.msi.gflags &
- ~XEN_DOMCTL_VMSI_X86_UNMASKED;
if ( !(pirq_dpci->flags & HVM_IRQ_DPCI_MAPPED) )
{
pirq_dpci->flags = HVM_IRQ_DPCI_MAPPED | HVM_IRQ_DPCI_MACH_MSI |
HVM_IRQ_DPCI_GUEST_MSI;
- pirq_dpci->gmsi.gvec = pt_irq_bind->u.msi.gvec;
- pirq_dpci->gmsi.gflags = gflags;
+ pirq_dpci->gmsi.data = pt_irq_bind->u.msi.data;
+ pirq_dpci->gmsi.addr = pt_irq_bind->u.msi.addr;
/*
* 'pt_irq_create_bind' can be called after 'pt_irq_destroy_bind'.
* The 'pirq_cleanup_check' which would free the structure is only
@@ -383,8 +381,8 @@ int pt_irq_create_bind(
}
if ( unlikely(rc) )
{
- pirq_dpci->gmsi.gflags = 0;
- pirq_dpci->gmsi.gvec = 0;
+ pirq_dpci->gmsi.addr = 0;
+ pirq_dpci->gmsi.data = 0;
pirq_dpci->dom = NULL;
pirq_dpci->flags = 0;
pirq_cleanup_check(info, d);
@@ -403,22 +401,23 @@ int pt_irq_create_bind(
}
/* If pirq is already mapped as vmsi, update guest data/addr. */
- if ( pirq_dpci->gmsi.gvec != pt_irq_bind->u.msi.gvec ||
- pirq_dpci->gmsi.gflags != gflags )
+ if ( pirq_dpci->gmsi.data != pt_irq_bind->u.msi.data ||
+ pirq_dpci->gmsi.addr != pt_irq_bind->u.msi.addr )
{
/* Directly clear pending EOIs before enabling new MSI info. */
pirq_guest_eoi(info);
- pirq_dpci->gmsi.gvec = pt_irq_bind->u.msi.gvec;
- pirq_dpci->gmsi.gflags = gflags;
+ pirq_dpci->gmsi.data = pt_irq_bind->u.msi.data;
+ pirq_dpci->gmsi.addr = pt_irq_bind->u.msi.addr;
}
}
/* Calculate dest_vcpu_id for MSI-type pirq migration. */
- dest = MASK_EXTR(pirq_dpci->gmsi.gflags,
- XEN_DOMCTL_VMSI_X86_DEST_ID_MASK);
- dest_mode = pirq_dpci->gmsi.gflags & XEN_DOMCTL_VMSI_X86_DM_MASK;
- delivery_mode = MASK_EXTR(pirq_dpci->gmsi.gflags,
- XEN_DOMCTL_VMSI_X86_DELIV_MASK);
+ dest = MASK_EXTR(pirq_dpci->gmsi.addr, MSI_ADDR_DEST_ID_MASK);
+ dest_mode = pirq_dpci->gmsi.addr & MSI_ADDR_DESTMODE_MASK;
+ delivery_mode = MASK_EXTR(pirq_dpci->gmsi.data,
+ MSI_DATA_DELIVERY_MODE_MASK);
+ gvec = pirq_dpci->gmsi.data & MSI_DATA_VECTOR_MASK;
+ pirq_dpci->gmsi.gvec = gvec;
dest_vcpu_id = hvm_girq_dest_2_vcpu_id(d, dest, dest_mode);
pirq_dpci->gmsi.dest_vcpu_id = dest_vcpu_id;
@@ -837,9 +836,8 @@ static int _hvm_dpci_msi_eoi(struct domain *d,
if ( (pirq_dpci->flags & HVM_IRQ_DPCI_MACH_MSI) &&
(pirq_dpci->gmsi.gvec == vector) )
{
- unsigned int dest = MASK_EXTR(pirq_dpci->gmsi.gflags,
- XEN_DOMCTL_VMSI_X86_DEST_ID_MASK);
- bool dest_mode = pirq_dpci->gmsi.gflags & XEN_DOMCTL_VMSI_X86_DM_MASK;
+ uint32_t dest = MASK_EXTR(pirq_dpci->gmsi.addr, MSI_ADDR_DEST_ID_MASK);
+ bool dest_mode = pirq_dpci->gmsi.addr & MSI_ADDR_DESTMODE_MASK;
if ( vlapic_match_dest(vcpu_vlapic(current), NULL, 0, dest,
dest_mode) )
@@ -132,9 +132,10 @@ struct dev_intx_gsi_link {
#define HVM_IRQ_DPCI_TRANSLATE (1u << _HVM_IRQ_DPCI_TRANSLATE_SHIFT)
struct hvm_gmsi_info {
- uint32_t gvec;
- uint32_t gflags;
+ uint32_t data;
int dest_vcpu_id; /* -1 :multi-dest, non-negative: dest_vcpu_id */
+ uint64_t addr;
+ uint8_t gvec;
bool posted; /* directly deliver to guest via VT-d PI? */
};
@@ -536,15 +536,11 @@ struct xen_domctl_bind_pt_irq {
uint8_t intx;
} pci;
struct {
- uint8_t gvec;
uint32_t gflags;
-#define XEN_DOMCTL_VMSI_X86_DEST_ID_MASK 0x0000ff
-#define XEN_DOMCTL_VMSI_X86_RH_MASK 0x000100
-#define XEN_DOMCTL_VMSI_X86_DM_MASK 0x000200
-#define XEN_DOMCTL_VMSI_X86_DELIV_MASK 0x007000
-#define XEN_DOMCTL_VMSI_X86_TRIG_MASK 0x008000
#define XEN_DOMCTL_VMSI_X86_UNMASKED 0x010000
+ uint32_t data;
+ uint64_t addr;
uint64_aligned_t gtable;
} msi;
struct {