From patchwork Wed Jan 24 18:10:56 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Przywara X-Patchwork-Id: 125693 Delivered-To: patch@linaro.org Received: by 10.46.66.141 with SMTP id h13csp580988ljf; Wed, 24 Jan 2018 10:13:37 -0800 (PST) X-Google-Smtp-Source: AH8x226sZBD3jpM4R4/oQjHEbuTFJ27XzKe3phzWmFYxSS5H0yPwaX6N4wH5o+piNsXpro+VCjKn X-Received: by 10.36.122.79 with SMTP id a76mr9933647itc.36.1516817617316; Wed, 24 Jan 2018 10:13:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516817617; cv=none; d=google.com; s=arc-20160816; b=rsy/vpilTrrma1gZc+CaUgnJou8cQgAKHGs+aK/zwnlcB3U/QwRrWsiAZtr4HoxFVy nM+RaWVU/OLCMEre6H0XcmQG00gdIvI4dMeuFd9mhmbCclfgXfEu4IOjrVVv//MoVr8J 3sn6fQi/95WRQ67RZRAXXSiRTtZVQc09zNoVZegp3Z+kwWxonbpMi0FOocZgyQ1BKwT8 2jbcl7pOrn+RkwxuYnDgiuSN6EGfZUJbtLqKWMFhRJ3dks17yn3zrW1HwKE+RzezMtyi rn2eGh5DuxYk1yqFrOj7ml9wF0Bb2Pf6+3yfTBpAFWWABoST0AhXyaqdCyRPh41U94sD dsvQ== 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=xhecCOAnTw847wCUvSeyPYCRhvP/eFEh8xa52OxtnSE=; b=nv6vw3MMIZPgjQyXmIjND1Wx/OcDUHydI1bWlo0c5tE+mSznJ320Z9qnxuP/Mq3vh+ +cYvZ5rN3H8ltQgnTWihUmBFTlI2BhbzA6VdFpsXsa70Lzmc3YdGx7Oc6i4q6SOtU0sB 4OJrtgEn4o7qmxqGMgRynppAn9ucHybjcp7QfjOXvovbX+ogJzmgrs+hkSKmVTYuPj2k 5BOitu21acIO5s5iOer8JIK5jDtTyPUerOT6OLvIhKWgw5Wc25dMExB6DG2v9ndYLz9M Jbsae+odOkEfu98yrifeudw6qZYl3Zvre85gZqdc+q9gn50Z/5N9gvC80XIVQjS20BMy LKYg== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=EqXrlxJx; 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 n23si590107iob.156.2018.01.24.10.13.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 24 Jan 2018 10:13:37 -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=EqXrlxJx; 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 1eePVo-00079z-7e; Wed, 24 Jan 2018 18:11:04 +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 1eePVn-00078y-5j for xen-devel@lists.xenproject.org; Wed, 24 Jan 2018 18:11:03 +0000 X-Inumbo-ID: ec3a1a3f-0131-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 ec3a1a3f-0131-11e8-ba59-bc764e045a96; Wed, 24 Jan 2018 19:10:57 +0100 (CET) Received: by mail-wm0-x243.google.com with SMTP id v71so10364131wmv.2 for ; Wed, 24 Jan 2018 10:11:00 -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=N1VUEKhhwis+pxx01CNJjz/L2zTFwzU5pb3PwhD1/1E=; b=EqXrlxJxJPP5I07LtOT4wam7b0oPjdMcmahf2Coh6oPMuO3n1jwZRcxokKuPyZddBE Bw0hvfNtmV7tP4EUAvWS+Rix+HgFI5ywEyQdXa3XS9l9rWfMr4NUwAyK/ktQj2JFaBwM uc5nddPzelqbR27uVpYIXD72ln0E6T98JwFrU= 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=N1VUEKhhwis+pxx01CNJjz/L2zTFwzU5pb3PwhD1/1E=; b=gVYkE4Pm2YUSLj6N1zGDsRadlVvT5q9T8zlBQkZOZWXV9vjZRH/Y7PJB35y6Eprbaz 3ygQqqiGDBELfZ04psPYsk70FO3NXbZDEtUgVuIg+RZM+py7RrfGiWDB+hXAIleuxZMO Wl0SQEj20tUSlMucIyJu/rwnprkUaCHvRUggy7ApO2vtmuJXIyfFj28r2rIlgJ/vPCf7 xiLPsaFPEUjItbU3wkmmhP+jFeLToZqLrE8IncoORg6XlZVY7l5UZ1PInvgel+kClsEp oQ22mLFX7pgLmLjmyEKjaUYsUYU6GjALwjVbpfobXtjYQc6WD+jb8V+snHwofL4YgoQT RIyg== X-Gm-Message-State: AKwxytcR7liReQ/PK9+2CKEMhQXY89JQg7w70OpaxEVdZKCqjDX7xiHd kJAaNsnhv8pMt8WVyUdpQocTCifsSyU= X-Received: by 10.28.93.80 with SMTP id r77mr5030975wmb.73.1516817459677; Wed, 24 Jan 2018 10:10:59 -0800 (PST) Received: from e104803-lin.lan (mail.andrep.de. [217.160.17.100]) by smtp.gmail.com with ESMTPSA id r68sm899379wmd.47.2018.01.24.10.10.58 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 24 Jan 2018 10:10:59 -0800 (PST) From: Andre Przywara To: Julien Grall , Stefano Stabellini Date: Wed, 24 Jan 2018 18:10:56 +0000 Message-Id: <20180124181058.6157-7-andre.przywara@linaro.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180124181058.6157-1-andre.przywara@linaro.org> References: <20180124181058.6157-1-andre.przywara@linaro.org> Cc: xen-devel@lists.xenproject.org Subject: [Xen-devel] [PATCH v3 6/8] ARM: VGIC: factor out vgic_get_hw_irq_desc() 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" At the moment we happily access the VGIC internal struct pending_irq (which describes a virtual IRQ) in irq.c. Factor out the actually needed functionality to learn the associated hardware IRQ and move that into gic-vgic.c to improve abstraction. Signed-off-by: Andre Przywara Acked-by: Stefano Stabellini --- xen/arch/arm/gic-vgic.c | 15 +++++++++++++++ xen/arch/arm/irq.c | 7 ++----- xen/include/asm-arm/vgic.h | 2 ++ 3 files changed, 19 insertions(+), 5 deletions(-) diff --git a/xen/arch/arm/gic-vgic.c b/xen/arch/arm/gic-vgic.c index d44e4dacd3..3ad98dcd3a 100644 --- a/xen/arch/arm/gic-vgic.c +++ b/xen/arch/arm/gic-vgic.c @@ -411,6 +411,21 @@ void gic_dump_vgic_info(struct vcpu *v) printk("Pending irq=%d\n", p->irq); } +struct irq_desc *vgic_get_hw_irq_desc(struct domain *d, struct vcpu *v, + unsigned int virq) +{ + struct pending_irq *p; + + if ( !v ) + v = d->vcpu[0]; + + p = irq_to_pending(v, virq); + if ( !p ) + return NULL; + + return p->desc; +} + int vgic_connect_hw_irq(struct domain *d, struct vcpu *v, unsigned int virq, struct irq_desc *desc) { diff --git a/xen/arch/arm/irq.c b/xen/arch/arm/irq.c index 7f133de549..62103a20e3 100644 --- a/xen/arch/arm/irq.c +++ b/xen/arch/arm/irq.c @@ -534,19 +534,16 @@ int release_guest_irq(struct domain *d, unsigned int virq) struct irq_desc *desc; struct irq_guest *info; unsigned long flags; - struct pending_irq *p; int ret; /* Only SPIs are supported */ if ( virq < NR_LOCAL_IRQS || virq >= vgic_num_irqs(d) ) return -EINVAL; - p = spi_to_pending(d, virq); - if ( !p->desc ) + desc = vgic_get_hw_irq_desc(d, NULL, virq); + if ( !desc ) return -EINVAL; - desc = p->desc; - spin_lock_irqsave(&desc->lock, flags); ret = -EINVAL; diff --git a/xen/include/asm-arm/vgic.h b/xen/include/asm-arm/vgic.h index f4240df371..ebc0cfaee8 100644 --- a/xen/include/asm-arm/vgic.h +++ b/xen/include/asm-arm/vgic.h @@ -219,6 +219,8 @@ int vgic_v2_init(struct domain *d, int *mmio_count); int vgic_v3_init(struct domain *d, int *mmio_count); bool vgic_evtchn_irq_pending(struct vcpu *v); +struct irq_desc *vgic_get_hw_irq_desc(struct domain *d, struct vcpu *v, + unsigned int virq); int vgic_connect_hw_irq(struct domain *d, struct vcpu *v, unsigned int virq, struct irq_desc *desc);