From patchwork Thu Jul 24 17:33:09 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefano Stabellini X-Patchwork-Id: 34238 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ie0-f200.google.com (mail-ie0-f200.google.com [209.85.223.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id C885B20C7F for ; Thu, 24 Jul 2014 17:36:07 +0000 (UTC) Received: by mail-ie0-f200.google.com with SMTP id at20sf19560169iec.11 for ; Thu, 24 Jul 2014 10:36:07 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:delivered-to:from:to:date:message-id:in-reply-to :references:mime-version:cc:subject:precedence:list-id :list-unsubscribe:list-post:list-help:list-subscribe:sender :errors-to:x-original-sender:x-original-authentication-results :mailing-list:list-archive:content-type:content-transfer-encoding; bh=YUnd94WACzSAZNKh3XExuh/G62K8zao0iPi/ScDHfas=; b=HvMJJg6evYtnp1OCyI6+gF7rt9UQ7z45yO/wpnJh9d/RwwC0Ep9DAABaAjAT54D+kp mdf2IBTRDvLAPZn4qs0dTtMkJyKz3/lb2KAPO6rpAkJsxGLnnos06LXj6JHuNRtsDUnU j05g9PZ2A2UauLKs/MqDJwYm2tP16sV5sv01N3mang0IPiPO3KipMI4ZecKwxK8b1o7y 0k1b+JynwdvYJdMt6ZCs43R9pSt9VMQYdquOzluOoZq7Pcsfs9/uvCN5p3QMhOMTy1OB 01yVFfSMQ5jDJCrTUC5A5Sh9Pjt0ga50DsA/j8KfM81Hd97x0EkpcGC7GRSFHGpbv03S QdyQ== X-Gm-Message-State: ALoCoQknaOmOSQyiKn/UQZURjdWc52+83yVas6Y9I3R0mt/HvUMLRujNnv2ALkEEHIFGZY3d/DQM X-Received: by 10.42.177.5 with SMTP id bg5mr4428195icb.27.1406223367359; Thu, 24 Jul 2014 10:36:07 -0700 (PDT) X-BeenThere: patchwork-forward@linaro.org Received: by 10.140.87.37 with SMTP id q34ls883658qgd.5.gmail; Thu, 24 Jul 2014 10:36:07 -0700 (PDT) X-Received: by 10.236.10.66 with SMTP id 42mr14916403yhu.68.1406223367201; Thu, 24 Jul 2014 10:36:07 -0700 (PDT) Received: from mail-vc0-f170.google.com (mail-vc0-f170.google.com [209.85.220.170]) by mx.google.com with ESMTPS id u8si19093299yhg.85.2014.07.24.10.36.07 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 24 Jul 2014 10:36:07 -0700 (PDT) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.170 as permitted sender) client-ip=209.85.220.170; Received: by mail-vc0-f170.google.com with SMTP id lf12so5423740vcb.29 for ; Thu, 24 Jul 2014 10:36:07 -0700 (PDT) X-Received: by 10.52.244.81 with SMTP id xe17mr12349424vdc.24.1406223366959; Thu, 24 Jul 2014 10:36:06 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.221.37.5 with SMTP id tc5csp383650vcb; Thu, 24 Jul 2014 10:36:06 -0700 (PDT) X-Received: by 10.42.89.204 with SMTP id h12mr14079572icm.37.1406223366379; Thu, 24 Jul 2014 10:36:06 -0700 (PDT) Received: from lists.xen.org (lists.xen.org. [50.57.142.19]) by mx.google.com with ESMTPS id d9si21133375igo.13.2014.07.24.10.36.05 for (version=TLSv1 cipher=RC4-SHA bits=128/128); Thu, 24 Jul 2014 10:36:06 -0700 (PDT) Received-SPF: none (google.com: xen-devel-bounces@lists.xen.org does not designate permitted sender hosts) client-ip=50.57.142.19; Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1XAMut-0002Yp-OO; Thu, 24 Jul 2014 17:34:55 +0000 Received: from mail6.bemta4.messagelabs.com ([85.158.143.247]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1XAMup-0002To-68 for xen-devel@lists.xensource.com; Thu, 24 Jul 2014 17:34:51 +0000 Received: from [85.158.143.35:3893] by server-2.bemta-4.messagelabs.com id 8E/64-04525-AB341D35; Thu, 24 Jul 2014 17:34:50 +0000 X-Env-Sender: Stefano.Stabellini@citrix.com X-Msg-Ref: server-5.tower-21.messagelabs.com!1406223286!19957100!3 X-Originating-IP: [66.165.176.63] X-SpamReason: No, hits=0.0 required=7.0 tests=sa_preprocessor: VHJ1c3RlZCBJUDogNjYuMTY1LjE3Ni42MyA9PiAzMDYwNDg=\n X-StarScan-Received: X-StarScan-Version: 6.11.3; banners=-,-,- X-VirusChecked: Checked Received: (qmail 25761 invoked from network); 24 Jul 2014 17:34:49 -0000 Received: from smtp02.citrix.com (HELO SMTP02.CITRIX.COM) (66.165.176.63) by server-5.tower-21.messagelabs.com with RC4-SHA encrypted SMTP; 24 Jul 2014 17:34:49 -0000 X-IronPort-AV: E=Sophos;i="5.01,725,1400025600"; d="scan'208";a="155886525" Received: from accessns.citrite.net (HELO FTLPEX01CL01.citrite.net) ([10.9.154.239]) by FTLPIPO02.CITRIX.COM with ESMTP; 24 Jul 2014 17:34:18 +0000 Received: from ukmail1.uk.xensource.com (10.80.16.128) by smtprelay.citrix.com (10.13.107.78) with Microsoft SMTP Server id 14.3.181.6; Thu, 24 Jul 2014 13:34:17 -0400 Received: from kaball.uk.xensource.com ([10.80.2.59]) by ukmail1.uk.xensource.com with esmtp (Exim 4.69) (envelope-from ) id 1XAMuC-00067o-FL; Thu, 24 Jul 2014 18:34:12 +0100 From: Stefano Stabellini To: Date: Thu, 24 Jul 2014 18:33:09 +0100 Message-ID: <1406223192-26267-7-git-send-email-stefano.stabellini@eu.citrix.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: References: MIME-Version: 1.0 X-DLP: MIA2 Cc: julien.grall@citrix.com, Ian.Campbell@citrix.com, JBeulich@suse.com, Stefano Stabellini Subject: [Xen-devel] [PATCH v9 07/10] xen: remove workaround to inject evtchn_irq on irq enable X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: List-Unsubscribe: , List-Post: , List-Help: , List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: stefano.stabellini@eu.citrix.com X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.220.170 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Archive: evtchn_upcall_pending is already set by common code at vcpu creation, therefore on ARM we also need to call vgic_vcpu_inject_irq for it. Currently we do that from vgic_enable_irqs as a workaround. Do this properly by introducing an appropriate arch specific hook: arch_evtchn_inject. arch_evtchn_inject is called by map_vcpu_info to inject the evtchn irq into the guest. On ARM is implemented by calling vgic_vcpu_inject_irq, on x86 is unneeded. Signed-off-by: Stefano Stabellini CC: JBeulich@suse.com --- Changes in v9: - use an arch hook. Changes in v2: - coding style fix; - add comment; - return an error if arch_set_info_guest is called without VGCF_online. --- xen/arch/arm/vgic.c | 23 +++++++++-------------- xen/common/domain.c | 1 + xen/include/asm-arm/event.h | 2 ++ xen/include/asm-x86/event.h | 2 ++ 4 files changed, 14 insertions(+), 14 deletions(-) diff --git a/xen/arch/arm/vgic.c b/xen/arch/arm/vgic.c index 299ae7e..474eebd 100644 --- a/xen/arch/arm/vgic.c +++ b/xen/arch/arm/vgic.c @@ -263,20 +263,10 @@ void vgic_enable_irqs(struct vcpu *v, uint32_t r, int n) v_target = d->arch.vgic.handler->get_target_vcpu(v, irq); p = irq_to_pending(v_target, irq); set_bit(GIC_IRQ_GUEST_ENABLED, &p->status); - /* We need to force the first injection of evtchn_irq because - * evtchn_upcall_pending is already set by common code on vcpu - * creation. */ - if ( irq == v_target->domain->arch.evtchn_irq && - vcpu_info(current, evtchn_upcall_pending) && - list_empty(&p->inflight) ) - vgic_vcpu_inject_irq(v_target, irq); - else { - unsigned long flags; - spin_lock_irqsave(&v_target->arch.vgic.lock, flags); - if ( !list_empty(&p->inflight) && !test_bit(GIC_IRQ_GUEST_VISIBLE, &p->status) ) - gic_raise_guest_irq(v_target, irq, p->priority); - spin_unlock_irqrestore(&v_target->arch.vgic.lock, flags); - } + spin_lock_irqsave(&v_target->arch.vgic.lock, flags); + if ( !list_empty(&p->inflight) && !test_bit(GIC_IRQ_GUEST_VISIBLE, &p->status) ) + gic_raise_guest_irq(v_target, irq, p->priority); + spin_unlock_irqrestore(&v_target->arch.vgic.lock, flags); if ( p->desc != NULL ) { irq_set_affinity(p->desc, cpumask_of(v_target->processor)); @@ -432,6 +422,11 @@ void vgic_vcpu_inject_spi(struct domain *d, unsigned int irq) vgic_vcpu_inject_irq(v, irq); } +void arch_evtchn_inject(struct vcpu *v) +{ + vgic_vcpu_inject_irq(v, v->domain->arch.evtchn_irq); +} + /* * Local variables: * mode: C diff --git a/xen/common/domain.c b/xen/common/domain.c index cd64aea..05d0049 100644 --- a/xen/common/domain.c +++ b/xen/common/domain.c @@ -1058,6 +1058,7 @@ int map_vcpu_info(struct vcpu *v, unsigned long gfn, unsigned offset) vcpu_info(v, evtchn_upcall_pending) = 1; for ( i = 0; i < BITS_PER_EVTCHN_WORD(d); i++ ) set_bit(i, &vcpu_info(v, evtchn_pending_sel)); + arch_evtchn_inject(v); return 0; } diff --git a/xen/include/asm-arm/event.h b/xen/include/asm-arm/event.h index 5330dfe..8c77427 100644 --- a/xen/include/asm-arm/event.h +++ b/xen/include/asm-arm/event.h @@ -56,6 +56,8 @@ static inline int arch_virq_is_global(int virq) return 1; } +void arch_evtchn_inject(struct vcpu *v); + #endif /* * Local variables: diff --git a/xen/include/asm-x86/event.h b/xen/include/asm-x86/event.h index a82062e..3c1a9d1 100644 --- a/xen/include/asm-x86/event.h +++ b/xen/include/asm-x86/event.h @@ -44,4 +44,6 @@ static inline int arch_virq_is_global(uint32_t virq) return 1; } +static inline void arch_evtchn_inject(struct vcpu *v) { } + #endif