From patchwork Thu Mar 15 20:30:17 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Przywara X-Patchwork-Id: 131882 Delivered-To: patch@linaro.org Received: by 10.46.84.17 with SMTP id i17csp1580965ljb; Thu, 15 Mar 2018 13:35:08 -0700 (PDT) X-Google-Smtp-Source: AG47ELtrl6bm5MRDfYc5Wy8mnb8ONTHeta7dwPOn/T3KLrR4XckTQlLMvIzscI8Y7jJizNnTUWLI X-Received: by 10.107.170.26 with SMTP id t26mr10441271ioe.104.1521146004704; Thu, 15 Mar 2018 13:33:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521146004; cv=none; d=google.com; s=arc-20160816; b=ld876OwLMYpFhZo4vUORFc5IupyGRmeVQuasbhT0S3bjQvdrixxOJTPxKOFzFaiVC4 CBOdEwWAdyx9SMPcLvA+WUeeDm0SUYAFHrEnQJIpayK88WDewq5HwgwEEB62mai0Qkq2 sPAp1CVAbNCOpQKQ7Hs//6n7XbdP0ZLzBwWTBu6lddJLsiOrsRtd20kv6g71tfelNelW KrTYXafOdwM2miDV6uRj2ArMgP9WyUMlTMI9olU3+CQtgpqqizoT6qj4P5mfoOo+d454 QzZkESbCqBYh+z9yhzt4jh8FQG9cbY+vB1KOV7rRLmuUw1pf2lGCva4em/+neO2g4nct y+7Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:cc:references:in-reply-to:message-id:date:to :from:dkim-signature:arc-authentication-results; bh=hltA9xr42TY0KLGRDtVMQbqWfRa6sRmL3IqbJiHZVUk=; b=qwaitnEpU1K6rz8mU1KVNCixFxwe+bIXVQOnSWVTvbWIkwQhBpy7el2UtDNsKll+Ka edfvFbelxGRkSHT0E+4YYQbDPblw0tSf4qGkKtRsalqBQkBSxHYHI80+uad07jirf69Z hzMKruxpxd6wqurVlGm7+TJmq4v3SiO0OmPbNTZtXR6amGnxxNZ6bdBKs6spgL3ig5rq koxQv6adlaSCVwVHjJ5ss0cHhj/nCsMPBI9siuUmpjzUmhP/sNHCbRBZA5r+NmMT+BzR 1iJIeuyFoPWPZNZnHncRgeEHP8A6c+Wb5hIq4luTqghFszNRTIDUgEnA0QhpYY8bnqtw lulQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=XmEDPn+I; spf=pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id m203si3566144ioa.190.2018.03.15.13.33.24 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 15 Mar 2018 13:33:24 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=XmEDPn+I; spf=pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ewZWz-0003EF-Q3; Thu, 15 Mar 2018 20:31:21 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1ewZWy-0003CN-Bp for xen-devel@lists.xenproject.org; Thu, 15 Mar 2018 20:31:20 +0000 X-Inumbo-ID: cdb550aa-288f-11e8-9728-bc764e045a96 Received: from mail-wm0-x241.google.com (unknown [2a00:1450:400c:c09::241]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id cdb550aa-288f-11e8-9728-bc764e045a96; Thu, 15 Mar 2018 21:31:13 +0100 (CET) Received: by mail-wm0-x241.google.com with SMTP id e194so12783128wmd.3 for ; Thu, 15 Mar 2018 13:31:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=+YQjZEioUlurLZo2ikV6w3CUuGKZ7AVznQ0UhMwD26E=; b=XmEDPn+I6sEJCMfZ4KcF0LINPybHV1BlF+CaBvznScL8lNgNHu5mEmOL6K/x16ua17 5TyZP5fb4XXBSITgDlS65ImCKs/l/y/3AZISeR1tjhQVWEiDKlf04BHh1cnUsaw2UOWX G/r1YGdLjrORq3OrtNptbXPZx/nNgn74Ejub0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=+YQjZEioUlurLZo2ikV6w3CUuGKZ7AVznQ0UhMwD26E=; b=C1AlRd3iBFcinxg4M+Wyulu34ITfJhJD1QoCsbz6TwhWDiPZiydMSz28ielee2mriE /l5ByRsMhjRScjMdkJUEVdmIWUksLTBoB2Wu+QIB/YorIcuZuxsZ2Hmcqvf7JggGLVuk LCrKD4i4YvP8inb29f4bOx/fDI/gvNwt86OPKxfldu0cXMwx+GWUsbcpRDxdtQvQhT2U hWfZoS8NN6RkAJq7+tzrzTkKJAM3WZJsYiy9j95WNdIgGjP9cSKwVojPmnBHdSm8COAU NkwMpHUN1kUIpDke65dEflokaKN2Ibh6BmA68H4w6ZCAkK7Q/mUl8tPLKEnr9HzaNGKn LOig== X-Gm-Message-State: AElRT7E7JfMkxKTsg/tDoGztEZO51cPzUWIBtRiVrkNeWTqpGpNxLEuN 87ZQNjL3QnA5/dICwBj/BSdcoQ== X-Received: by 10.28.43.66 with SMTP id r63mr3184546wmr.93.1521145878215; Thu, 15 Mar 2018 13:31:18 -0700 (PDT) Received: from e104803-lin.lan (mail.andrep.de. [217.160.17.100]) by smtp.gmail.com with ESMTPSA id w125sm3217102wmw.20.2018.03.15.13.31.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Thu, 15 Mar 2018 13:31:17 -0700 (PDT) From: Andre Przywara To: Stefano Stabellini , Julien Grall Date: Thu, 15 Mar 2018 20:30:17 +0000 Message-Id: <20180315203050.19791-13-andre.przywara@linaro.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180315203050.19791-1-andre.przywara@linaro.org> References: <20180315203050.19791-1-andre.przywara@linaro.org> Cc: xen-devel@lists.xenproject.org Subject: [Xen-devel] [PATCH v2 12/45] ARM: evtchn: Handle level triggered IRQs correctly X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" The event channel IRQ has level triggered semantics, however the current VGIC treats everything as edge triggered. To correctly process those IRQs, we have to lower the (virtual) IRQ line at some point in time, depending on whether ther interrupt condition still prevails. Check the per-VCPU evtchn_upcall_pending variable to make the interrupt line match its status, and call this function upon every hypervisor entry. Signed-off-by: Andre Przywara Reviewed-by: Julien Grall --- xen/arch/arm/domain.c | 7 +++++++ xen/arch/arm/traps.c | 1 + xen/include/asm-arm/event.h | 1 + 3 files changed, 9 insertions(+) diff --git a/xen/arch/arm/domain.c b/xen/arch/arm/domain.c index 4462e62599..18b915d2e9 100644 --- a/xen/arch/arm/domain.c +++ b/xen/arch/arm/domain.c @@ -954,6 +954,13 @@ void vcpu_mark_events_pending(struct vcpu *v) vgic_inject_irq(v->domain, v, v->domain->arch.evtchn_irq, true); } +void vcpu_update_evtchn_irq(struct vcpu *v) +{ + bool pending = vcpu_info(v, evtchn_upcall_pending); + + vgic_inject_irq(v->domain, v, v->domain->arch.evtchn_irq, pending); +} + /* The ARM spec declares that even if local irqs are masked in * the CPSR register, an irq should wake up a cpu from WFI anyway. * For this reason we need to check for irqs that need delivery, diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c index 46464d7bb9..c13223a69f 100644 --- a/xen/arch/arm/traps.c +++ b/xen/arch/arm/traps.c @@ -2033,6 +2033,7 @@ static void enter_hypervisor_head(struct cpu_user_regs *regs) * trap and how it can be optimised. */ vtimer_sync(current); + vcpu_update_evtchn_irq(current); #endif vgic_sync_from_lrs(current); diff --git a/xen/include/asm-arm/event.h b/xen/include/asm-arm/event.h index c7a415ef57..2f51864043 100644 --- a/xen/include/asm-arm/event.h +++ b/xen/include/asm-arm/event.h @@ -6,6 +6,7 @@ void vcpu_kick(struct vcpu *v); void vcpu_mark_events_pending(struct vcpu *v); +void vcpu_update_evtchn_irq(struct vcpu *v); void vcpu_block_unless_event_pending(struct vcpu *v); static inline int vcpu_event_delivery_is_enabled(struct vcpu *v)