From patchwork Mon Mar 5 16:04:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Przywara X-Patchwork-Id: 130672 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp2853794lja; Mon, 5 Mar 2018 08:07:10 -0800 (PST) X-Google-Smtp-Source: AG47ELu30u2H8SiItDU8pZ4cDjaInEifQBuzqtTToDsBR/6ofCjXr7PGaRiZWD1bBOjDoUUhzUgj X-Received: by 10.107.128.77 with SMTP id b74mr17920082iod.233.1520266030436; Mon, 05 Mar 2018 08:07:10 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520266030; cv=none; d=google.com; s=arc-20160816; b=zozSzEA7yA/M+5qWMEm26TB33U0Ry2zJd3H1IWEy9DHDNT6bvlWfn7QfTdrUQmNRMj +MF5ucDGqGtc+9oC9vV+Fp03WvyRZsBiopUGr2b5XX536rJ9T2uBK32umhURKtdqgKO6 jy4sJ6EK5TS2fy+0FtsyBHmdFI+Eo9aa8auCVcvWREUpKiR1KA8MRLdwSYzYZlbD+G+P QsOMgb3JeEilbZ87pCmt2QyBQ3FCd+aN5eos3m34I5NYDM5F7WVTvXcTo5pCqQ5mgreW okvx3T2GqVkSwGYV2EsJZqKMAG0Y/5rlmZQl02hgp5RjEBQK/UqC0tTr9UPG4EG6na68 yRiQ== 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=zYM3fqocLJY79ZBBcMUL2UFY/HXCp0I1ohbI0qjEaVg=; b=EbVx5FzjjVeu9CAF8hEtkda0haG6Zeq3fKGz8CUSWphsFkrQxJDx8dx0hH3XdSCwec B3w+YXbtARSrmR3VbSyfGGws2eEFhsLwuNdMAmIdzEPbLAorPWmgPPBkdNUYkB/bg1uu FI9ytFFgVIq2r1ptz0I/Fn+qp/RP+1bvj3+6SIzFAQh1MJwmK+X0DNn43Fe0QlXnmNbk abk/rvc7mEcwpP0Jh8yXWAjtlRa7MZXoBCu/HyzTmUfJEEL2kkeJkQw3b7OQtJWCVQ34 SDLTmrAh9AbxFJ32oZOitV87Db9UGezQpx+srf0QlxOsY1ygHPQhTZ5Txo2XIAJk9dxK 1UmQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=Tgu6WKWl; 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 r4si6057717itg.115.2018.03.05.08.07.10 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Mar 2018 08:07:10 -0800 (PST) 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=Tgu6WKWl; 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 1essbx-0000Ny-60; Mon, 05 Mar 2018 16:05:13 +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 1essbv-0000H3-F2 for xen-devel@lists.xenproject.org; Mon, 05 Mar 2018 16:05:11 +0000 X-Inumbo-ID: d39e5101-208e-11e8-ba59-bc764e045a96 Received: from mail-wm0-x243.google.com (unknown [2a00:1450:400c:c09::243]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id d39e5101-208e-11e8-ba59-bc764e045a96; Mon, 05 Mar 2018 17:04:05 +0100 (CET) Received: by mail-wm0-x243.google.com with SMTP id z81so16908209wmb.4 for ; Mon, 05 Mar 2018 08:05:10 -0800 (PST) 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=yLFRwbrphuoVIcHsQyqJgje36hZWfE8Y3piW9eiPtHw=; b=Tgu6WKWlm/Xo7fvx+uUmaJqTpbKJlvK2Hu3spTKXL2QnXL9oj4Ny4lhY2Nw/8rM7Tu sOcAgqcWPpDC3+UetfFCPoO9iRG8FgnmBXdhcoSRHIMEV2zWQYYZYIN6aLkTA88UDkaa oImW/vOShpQRJipAbCH3wWduD1ZKS9aaF5AuA= 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=yLFRwbrphuoVIcHsQyqJgje36hZWfE8Y3piW9eiPtHw=; b=S2oJDWQa7KpUekWLvqXNL4vxbBMJVcMjRkQMPgHoUCTkqYbtP9sm9RvuDCimCVuQiA 52cAvzoqLorY3QmbQJc4Cg0K4O4QGVY5wp0MNfWnz2TulBiBqb+Su4y75rQQUNlWjAgN pekImz0tchR1cuD8CukhTk9jrndP14AVupkr6Q9p7Uhp4ylUkBoEgsi2IHZuSvoCzX4Y iYe13QGm8ykb+oHy/4TQSYKaUWVE8X4OzmyfEW01kTKOngbj/9j19n5omQrJyxHZCqdK w5LF3h2rLhByUecDpe14lqXJlc1VrFiT39y0NqZBI6AgbdjrJl3W/U11xe0JrYPkOhKS o9iQ== X-Gm-Message-State: AElRT7Gsb0dTC2yq2+ssdLLT16ftWFKrHOymvZYFwY7W1xqs4NxpdAcl cH3Y2XhaRu/BPrGbSsse4eyu+w== X-Received: by 10.28.118.1 with SMTP id r1mr8573628wmc.80.1520265909574; Mon, 05 Mar 2018 08:05:09 -0800 (PST) Received: from e104803-lin.lan (mail.andrep.de. [217.160.17.100]) by smtp.gmail.com with ESMTPSA id y6sm6574381wmy.14.2018.03.05.08.05.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 05 Mar 2018 08:05:09 -0800 (PST) From: Andre Przywara To: Julien Grall , Stefano Stabellini Date: Mon, 5 Mar 2018 16:04:04 +0000 Message-Id: <20180305160415.16760-47-andre.przywara@linaro.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180305160415.16760-1-andre.przywara@linaro.org> References: <20180305160415.16760-1-andre.przywara@linaro.org> Cc: xen-devel@lists.xenproject.org Subject: [Xen-devel] [PATCH 46/57] ARM: new VGIC: Add event channel IRQ handling 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 Xen core/arch code relies on two abstracted functions to inject an event channel IRQ and to query its pending state. Implement those to query the state of the new VGIC implementation. Signed-off-by: Andre Przywara Acked-by: Julien Grall --- Changelog RFC ... v1: - add locking xen/arch/arm/vgic/vgic.c | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/xen/arch/arm/vgic/vgic.c b/xen/arch/arm/vgic/vgic.c index 5bbf55da21..0bf257c865 100644 --- a/xen/arch/arm/vgic/vgic.c +++ b/xen/arch/arm/vgic/vgic.c @@ -698,6 +698,29 @@ void vgic_kick_vcpus(struct domain *d) } } +void arch_evtchn_inject(struct vcpu *v) +{ + vgic_inject_irq(v->domain, v, v->domain->arch.evtchn_irq, true); +} + +bool vgic_evtchn_irq_pending(struct vcpu *v) +{ + struct vgic_irq *irq; + unsigned long flags; + bool pending; + + /* Does not work for LPIs. */ + ASSERT(!is_lpi(v->domain->arch.evtchn_irq)); + + irq = vgic_get_irq(v->domain, v, v->domain->arch.evtchn_irq); + spin_lock_irqsave(&irq->irq_lock, flags); + pending = irq_is_pending(irq); + spin_unlock_irqrestore(&irq->irq_lock, flags); + vgic_put_irq(v->domain, irq); + + return pending; +} + struct irq_desc *vgic_get_hw_irq_desc(struct domain *d, struct vcpu *v, unsigned int virq) {