direct-io.hg

changeset 12441:169687dab774

[IA64] Fix HVM interrupts on IPF

Xen has changed to set-irq-level hypercall from shared-memory PIC stat.
This patch makes IPF accomodate this change

Signed-off-by: Anthony Xu <anthony.xu@intel.com>
author awilliam@xenbuild.aw
date Mon Nov 13 11:02:37 2006 -0700 (2006-11-13)
parents 2b0596c8a031
children fe543184f7f9
files linux-2.6-xen-sparse/arch/ia64/xen/xcom_privcmd.c xen/arch/ia64/vmx/vlsapic.c xen/arch/ia64/vmx/vmx_hypercall.c xen/include/asm-ia64/vmx.h xen/include/asm-ia64/vmx_platform.h
line diff
     1.1 --- a/linux-2.6-xen-sparse/arch/ia64/xen/xcom_privcmd.c	Mon Nov 13 10:56:08 2006 -0700
     1.2 +++ b/linux-2.6-xen-sparse/arch/ia64/xen/xcom_privcmd.c	Mon Nov 13 11:02:37 2006 -0700
     1.3 @@ -579,6 +579,9 @@ xencomm_privcmd_hvm_op(privcmd_hypercall
     1.4  	case HVMOP_set_param:
     1.5  		argsize = sizeof(xen_hvm_param_t);
     1.6  		break;
     1.7 +	case HVMOP_set_irq_level:
     1.8 +		argsize = sizeof(xen_hvm_set_irq_level_t);
     1.9 +		break;
    1.10  	default:
    1.11  		printk("%s: unknown HVMOP %d\n", __func__, cmd);
    1.12  		return -EINVAL;
     2.1 --- a/xen/arch/ia64/vmx/vlsapic.c	Mon Nov 13 10:56:08 2006 -0700
     2.2 +++ b/xen/arch/ia64/vmx/vlsapic.c	Mon Nov 13 11:02:37 2006 -0700
     2.3 @@ -666,3 +666,25 @@ void vmx_vexirq(VCPU *vcpu)
     2.4  {
     2.5      generate_exirq (vcpu);
     2.6  }
     2.7 +
     2.8 +
     2.9 +void vmx_vioapic_set_irq(struct domain *d, int irq, int level)
    2.10 +{
    2.11 +    unsigned long flags;
    2.12 +
    2.13 +    spin_lock_irqsave(&d->arch.arch_vmx.virq_assist_lock, flags);
    2.14 +    vioapic_set_irq(d, irq, level);
    2.15 +    spin_unlock_irqrestore(&d->arch.arch_vmx.virq_assist_lock, flags);
    2.16 +}
    2.17 +
    2.18 +int vmx_vlapic_set_irq(VCPU *v, uint8_t vec, uint8_t trig)
    2.19 +{
    2.20 +    int ret;
    2.21 +    int running = test_bit(_VCPUF_running, &v->vcpu_flags);
    2.22 +
    2.23 +    ret = vmx_vcpu_pend_interrupt(v, vec);
    2.24 +    vcpu_unblock(v);
    2.25 +    if (running)
    2.26 +        smp_send_event_check_cpu(v->processor);
    2.27 +    return ret;
    2.28 +}
     3.1 --- a/xen/arch/ia64/vmx/vmx_hypercall.c	Mon Nov 13 10:56:08 2006 -0700
     3.2 +++ b/xen/arch/ia64/vmx/vmx_hypercall.c	Mon Nov 13 11:02:37 2006 -0700
     3.3 @@ -34,6 +34,7 @@
     3.4  #include <public/version.h>
     3.5  #include <asm/dom_fw.h>
     3.6  #include <xen/domain.h>
     3.7 +#include <asm/vmx.h> 
     3.8  
     3.9  long
    3.10  do_hvm_op(unsigned long op, XEN_GUEST_HANDLE(void) arg)
    3.11 @@ -78,6 +79,31 @@ do_hvm_op(unsigned long op, XEN_GUEST_HA
    3.12          break;
    3.13      }
    3.14  
    3.15 +    case HVMOP_set_irq_level:
    3.16 +    {
    3.17 +        struct xen_hvm_set_irq_level op;
    3.18 +        struct domain *d;
    3.19 +
    3.20 +        if (copy_from_guest(&op, arg, 1))
    3.21 +            return -EFAULT;
    3.22 +
    3.23 +        if (!IS_PRIV(current->domain))
    3.24 +            return -EPERM;
    3.25 +
    3.26 +        d = find_domain_by_id(op.domid);
    3.27 +        if (d == NULL)
    3.28 +            return -ESRCH;
    3.29 +
    3.30 +        rc = -EINVAL;
    3.31 +        if (is_hvm_domain(d)) {
    3.32 +            vmx_vioapic_set_irq(d, op.irq, op.level);
    3.33 +            rc = 0;
    3.34 +        }
    3.35 +
    3.36 +        put_domain(d);
    3.37 +        break;
    3.38 +    }
    3.39 +
    3.40      default:
    3.41          gdprintk(XENLOG_INFO, "Bad HVM op %ld.\n", op);
    3.42          rc = -ENOSYS;
     4.1 --- a/xen/include/asm-ia64/vmx.h	Mon Nov 13 10:56:08 2006 -0700
     4.2 +++ b/xen/include/asm-ia64/vmx.h	Mon Nov 13 11:02:37 2006 -0700
     4.3 @@ -55,6 +55,7 @@ extern void vmx_relinquish_guest_resourc
     4.4  extern void vmx_relinquish_vcpu_resources(struct vcpu *v);
     4.5  extern void vmx_die_if_kernel(char *str, struct pt_regs *regs, long err);
     4.6  extern void vmx_send_assist_req(struct vcpu *v);
     4.7 +extern void vmx_vioapic_set_irq(struct domain *d, int irq, int level);
     4.8  
     4.9  static inline vcpu_iodata_t *get_vio(struct domain *d, unsigned long cpu)
    4.10  {
     5.1 --- a/xen/include/asm-ia64/vmx_platform.h	Mon Nov 13 10:56:08 2006 -0700
     5.2 +++ b/xen/include/asm-ia64/vmx_platform.h	Mon Nov 13 11:02:37 2006 -0700
     5.3 @@ -56,10 +56,10 @@ extern uint64_t dummy_tmr[];
     5.4  #define VLAPIC_ID(l) (uint16_t)(((l)->vcpu->arch.privregs->lid) >> 16)
     5.5  #define VLAPIC_IRR(l) ((l)->vcpu->arch.privregs->irr[0])
     5.6  struct vlapic *apic_round_robin(struct domain *d, uint8_t vector, uint32_t bitmap);
     5.7 -extern int vmx_vcpu_pend_interrupt(struct vcpu *vcpu, uint8_t vector);
     5.8 +extern int vmx_vlapic_set_irq(struct vcpu *v, uint8_t vec, uint8_t trig);
     5.9  static inline int vlapic_set_irq(struct vlapic *t, uint8_t vec, uint8_t trig)
    5.10  {
    5.11 -    return vmx_vcpu_pend_interrupt(t->vcpu, vec);
    5.12 +    return vmx_vlapic_set_irq(t->vcpu, vec, trig);
    5.13  }
    5.14  
    5.15  enum ioapic_irq_destination_types {