[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [Xen-changelog] [xen master] domctl/x86: move vMSI related #define-s to public interface
commit 25dcf06ff76c306cf0360882fcf250e045891493 Author: Jan Beulich <JBeulich@xxxxxxxx> AuthorDate: Fri Sep 1 10:24:10 2017 -0600 Commit: Wei Liu <wei.liu2@xxxxxxxxxx> CommitDate: Fri Sep 1 17:42:09 2017 +0100 domctl/x86: move vMSI related #define-s to public interface Xen and qemu having identical #define-s (with different names) is a strong hint that these should be part of the public interface, at the same time making obvious that any change to the values in an interface modification (and hence needs suitable care). Signed-off-by: Jan Beulich <jbeulich@xxxxxxxx> Acked-by: Andrew Cooper <andrew.cooper3@xxxxxxxxxx> Acked-by: Wei Liu <wei.liu2@xxxxxxxxxx> --- xen/arch/x86/hvm/vmsi.c | 7 +++---- xen/drivers/passthrough/io.c | 22 +++++++++++++--------- xen/include/asm-x86/hvm/irq.h | 11 ----------- xen/include/public/domctl.h | 7 +++++++ 4 files changed, 23 insertions(+), 24 deletions(-) diff --git a/xen/arch/x86/hvm/vmsi.c b/xen/arch/x86/hvm/vmsi.c index a36692c..9b35e9b 100644 --- a/xen/arch/x86/hvm/vmsi.c +++ b/xen/arch/x86/hvm/vmsi.c @@ -104,10 +104,9 @@ 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; - uint8_t dest_mode = !!(flags & VMSI_DM_MASK); - uint8_t delivery_mode = (flags & VMSI_DELIV_MASK) - >> GFLAGS_SHIFT_DELIV_MODE; - uint8_t trig_mode = (flags&VMSI_TRIG_MODE) >> GFLAGS_SHIFT_TRG_MODE; + 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; HVM_DBG_LOG(DBG_LEVEL_IOAPIC, "msi: dest=%x dest_mode=%x delivery_mode=%x " diff --git a/xen/drivers/passthrough/io.c b/xen/drivers/passthrough/io.c index 1d260bd..ec9f41a 100644 --- a/xen/drivers/passthrough/io.c +++ b/xen/drivers/passthrough/io.c @@ -339,10 +339,12 @@ int pt_irq_create_bind( { case PT_IRQ_TYPE_MSI: { - uint8_t dest, dest_mode, delivery_mode; + uint8_t dest, delivery_mode; + bool dest_mode; int dest_vcpu_id; const struct vcpu *vcpu; - uint32_t gflags = pt_irq_bind->u.msi.gflags & ~VMSI_UNMASKED; + uint32_t gflags = pt_irq_bind->u.msi.gflags & + ~XEN_DOMCTL_VMSI_X86_UNMASKED; if ( !(pirq_dpci->flags & HVM_IRQ_DPCI_MAPPED) ) { @@ -412,10 +414,11 @@ int pt_irq_create_bind( } } /* Calculate dest_vcpu_id for MSI-type pirq migration. */ - dest = pirq_dpci->gmsi.gflags & VMSI_DEST_ID_MASK; - dest_mode = !!(pirq_dpci->gmsi.gflags & VMSI_DM_MASK); - delivery_mode = (pirq_dpci->gmsi.gflags & VMSI_DELIV_MASK) >> - GFLAGS_SHIFT_DELIV_MODE; + 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_vcpu_id = hvm_girq_dest_2_vcpu_id(d, dest, dest_mode); pirq_dpci->gmsi.dest_vcpu_id = dest_vcpu_id; @@ -439,7 +442,7 @@ int pt_irq_create_bind( pi_update_irte(vcpu ? &vcpu->arch.hvm_vmx.pi_desc : NULL, info, pirq_dpci->gmsi.gvec); - if ( pt_irq_bind->u.msi.gflags & VMSI_UNMASKED ) + if ( pt_irq_bind->u.msi.gflags & XEN_DOMCTL_VMSI_X86_UNMASKED ) { unsigned long flags; struct irq_desc *desc = pirq_spin_lock_irq_desc(info, &flags); @@ -834,8 +837,9 @@ static int _hvm_dpci_msi_eoi(struct domain *d, if ( (pirq_dpci->flags & HVM_IRQ_DPCI_MACH_MSI) && (pirq_dpci->gmsi.gvec == vector) ) { - int dest = pirq_dpci->gmsi.gflags & VMSI_DEST_ID_MASK; - int dest_mode = !!(pirq_dpci->gmsi.gflags & VMSI_DM_MASK); + 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; if ( vlapic_match_dest(vcpu_vlapic(current), NULL, 0, dest, dest_mode) ) diff --git a/xen/include/asm-x86/hvm/irq.h b/xen/include/asm-x86/hvm/irq.h index 9546c24..3b6b4bd 100644 --- a/xen/include/asm-x86/hvm/irq.h +++ b/xen/include/asm-x86/hvm/irq.h @@ -131,17 +131,6 @@ struct dev_intx_gsi_link { #define HVM_IRQ_DPCI_IDENTITY_GSI (1u << _HVM_IRQ_DPCI_IDENTITY_GSI_SHIFT) #define HVM_IRQ_DPCI_TRANSLATE (1u << _HVM_IRQ_DPCI_TRANSLATE_SHIFT) -#define VMSI_DEST_ID_MASK 0xff -#define VMSI_RH_MASK 0x100 -#define VMSI_DM_MASK 0x200 -#define VMSI_DELIV_MASK 0x7000 -#define VMSI_TRIG_MODE 0x8000 -#define VMSI_UNMASKED 0x10000 - -#define GFLAGS_SHIFT_RH 8 -#define GFLAGS_SHIFT_DELIV_MODE 12 -#define GFLAGS_SHIFT_TRG_MODE 15 - struct hvm_gmsi_info { uint32_t gvec; uint32_t gflags; diff --git a/xen/include/public/domctl.h b/xen/include/public/domctl.h index 83c7c75..50ff58f 100644 --- a/xen/include/public/domctl.h +++ b/xen/include/public/domctl.h @@ -576,6 +576,13 @@ struct xen_domctl_bind_pt_irq { 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 + uint64_aligned_t gtable; } msi; struct { -- generated by git-patchbot for /home/xen/git/xen.git#master _______________________________________________ Xen-changelog mailing list Xen-changelog@xxxxxxxxxxxxx https://lists.xenproject.org/xen-changelog
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |