From patchwork Mon Mar 5 16:03:31 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Przywara X-Patchwork-Id: 130647 Delivered-To: patch@linaro.org Received: by 10.46.66.2 with SMTP id p2csp2853285lja; Mon, 5 Mar 2018 08:06:47 -0800 (PST) X-Google-Smtp-Source: AG47ELsFe7Fb54Q0QJNzKzwSKkJtcLuIz0XmtzH3UoXNZSs8b5iWPKYNhudUvTlzWJVuqVryf2TF X-Received: by 10.107.140.86 with SMTP id o83mr17477804iod.127.1520266007373; Mon, 05 Mar 2018 08:06:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520266007; cv=none; d=google.com; s=arc-20160816; b=Ynd3J6DlEYS3f7F/oJ8GHFnwQCO5bZ7z2/RMX+LwSkAacjoF163p9JRcO+i2shL1wq 11gZlUbF84BuBhPLzUG22fA2Pe4buK0MSGLBrgZTFM94yXEu1GMbbufPwGfwOFlJZz44 0bdFtX4YajU+h73DktOhFzXjRgmQq0OtJ1z01sou/RnwJvQ4cHcxZ0x/YVjtZutYX1nI e2WDjATL7so77lIA/mp1azUZGKkGlXxz1rlJSzfn8lIMEk6QZ2Lzcpul+Oionjdd29CQ FTZuaTgT7+yOUaFTj1UE2yH63ZxqGLVYjBWIA5CK8Uwg7GzH+E5KaJboOH4TWEO/s70v H4lw== 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=0fIj+TcbOvux0juLY871eeLjKt7+KD/wjKX6CWw7XwU=; b=j67Xyw6RMn93bi5ThtvUkSLnmEkk/KGgoMjTpBxYez68/mW2C59HSZhg8rDlwtMibl JVtQbJ1ZZT/vl6We2FS0+C+p32ekCxzGF7TVOdFmE4M0912EUKMrDzkkxe1LHb/y5/qN biYtSVQBpMkmHO/tgoqXRH8JZgLp8XKh40Ub54i5Oi3gQ6/ElYWEBFTT42slRdfW8EpP uvDKMr3UgwZSxxR+cAVEG25w7jhDzTYs6WCNwF8DR1fKZFdaDgHA+I61maHnM7GUxvzq bw04qtbt8pQkxLaiheKYbgoD+COsH4TbGF7s3FSxzrBSrd0I//5FAVM7/7X+BLpJNd2t wtNw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=VcN3y73Q; 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 v6si8968818iof.222.2018.03.05.08.06.47 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 05 Mar 2018 08:06:47 -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=VcN3y73Q; 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 1essbO-0007JE-IP; Mon, 05 Mar 2018 16:04:38 +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 1essbN-0007H0-UD for xen-devel@lists.xenproject.org; Mon, 05 Mar 2018 16:04:37 +0000 X-Inumbo-ID: bf8b3570-208e-11e8-ba59-bc764e045a96 Received: from mail-wm0-x244.google.com (unknown [2a00:1450:400c:c09::244]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id bf8b3570-208e-11e8-ba59-bc764e045a96; Mon, 05 Mar 2018 17:03:31 +0100 (CET) Received: by mail-wm0-x244.google.com with SMTP id w128so17009114wmw.0 for ; Mon, 05 Mar 2018 08:04:36 -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=ipp9j6dswDc6wqZis3O5SAd8MCdk/Z7iA5CRvwaJkLQ=; b=VcN3y73Qbwz4iN1GzUJszzlJ5EbXn8bMQWXPktQdjifeG/CfFOIDklq63bqxB8wkDc WxnGdSD9yzmTFWUoyDfDoQH9lAQZaB/BQHnSJV9y+lZvby55D8TwgfjtWtd2Ub0LAyX/ keNlvz0nx0c6QbbWgG8hXvbkatdg3s5D/1JXg= 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=ipp9j6dswDc6wqZis3O5SAd8MCdk/Z7iA5CRvwaJkLQ=; b=Nb1FmTHgkNuH3MoUkM2dbpo4+E8dMWhxiIfoCUjwanWLhV8j35xhj1hrWKptnXoFDu gOaUY/rBgvHzEQRXBSeYBIqu+OcgROvzS49Uzr8DK3m5CW0w/RUx01eBRcqoH/j87Ujb SufE0y2VFvy1I/Z1K61EcTqJy0jpt/DQJKIIOkrvUslmAcKGC5/V+xYr8mdgHJuh+hFY 7Tl1HsqCq03Zme0twv3EAHckiOcGXB5wTFIew8UINhIbtA6GBoU0Ve3F+lVsSc3x69+E tpYuIUUn9wRQc31BPhyRCpMG2TRiEmdoB+d71F3/UwN2gGoBGwgQ++btNXKvCWFG9+Xv htnQ== X-Gm-Message-State: AElRT7HNZmjulEDkey2TM2XZDYANO2jTXGXWlBX+cNRxWBouUwuinEwP 7CnQWfNW5h3byrmcYExLkEZmwA== X-Received: by 10.28.135.142 with SMTP id j136mr9219559wmd.33.1520265875798; Mon, 05 Mar 2018 08:04:35 -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.04.34 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 05 Mar 2018 08:04:35 -0800 (PST) From: Andre Przywara To: Julien Grall , Stefano Stabellini Date: Mon, 5 Mar 2018 16:03:31 +0000 Message-Id: <20180305160415.16760-14-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 13/57] ARM: VGIC: reorder prototypes in vgic.h 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" Currently vgic.h both contains prototypes used by Xen arch code outside of the actual VGIC (for instance vgic_vcpu_inject_irq()), and prototypes for functions used by the VGIC internally. Group them to later allow an easy split with one #ifdef. Signed-off-by: Andre Przywara Reviewed-by: Julien Grall --- Changelog RFC ... v1: - Remove two redundant prototypes - Add Julien's Reviewed-by: xen/include/asm-arm/vgic.h | 54 +++++++++++++++++++++++++--------------------- 1 file changed, 30 insertions(+), 24 deletions(-) diff --git a/xen/include/asm-arm/vgic.h b/xen/include/asm-arm/vgic.h index 4e1c37f091..84d82e6eb3 100644 --- a/xen/include/asm-arm/vgic.h +++ b/xen/include/asm-arm/vgic.h @@ -279,49 +279,34 @@ enum gic_sgi_mode; */ #define REG_RANK_INDEX(b, n, s) ((((n) >> s) & ((b)-1)) % 32) -/* - * In the moment vgic_num_irqs() just covers SPIs and the private IRQs, - * as it's mostly used for allocating the pending_irq and irq_desc array, - * in which LPIs don't participate. - */ -#define vgic_num_irqs(d) ((d)->arch.vgic.nr_spis + 32) -extern int domain_vgic_init(struct domain *d, unsigned int nr_spis); -extern void domain_vgic_free(struct domain *d); -extern int vcpu_vgic_init(struct vcpu *v); extern struct vcpu *vgic_get_target_vcpu(struct vcpu *v, unsigned int virq); -extern int vgic_inject_irq(struct domain *d, struct vcpu *v, unsigned int virq, - bool level); extern void vgic_remove_irq_from_queues(struct vcpu *v, struct pending_irq *p); extern void gic_remove_from_lr_pending(struct vcpu *v, struct pending_irq *p); -extern void vgic_clear_pending_irqs(struct vcpu *v); extern void vgic_init_pending_irq(struct pending_irq *p, unsigned int virq); extern struct pending_irq *irq_to_pending(struct vcpu *v, unsigned int irq); extern struct pending_irq *spi_to_pending(struct domain *d, unsigned int irq); extern struct vgic_irq_rank *vgic_rank_offset(struct vcpu *v, int b, int n, int s); extern struct vgic_irq_rank *vgic_rank_irq(struct vcpu *v, unsigned int irq); -extern bool vgic_emulate(struct cpu_user_regs *regs, union hsr hsr); extern void vgic_disable_irqs(struct vcpu *v, uint32_t r, int n); extern void vgic_enable_irqs(struct vcpu *v, uint32_t r, int n); extern void register_vgic_ops(struct domain *d, const struct vgic_ops *ops); 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, bool connect); - -extern int domain_vgic_register(struct domain *d, int *mmio_count); -extern int vcpu_vgic_free(struct vcpu *v); extern bool vgic_to_sgi(struct vcpu *v, register_t sgir, enum gic_sgi_mode irqmode, int virq, const struct sgi_target *target); extern bool vgic_migrate_irq(struct vcpu *old, struct vcpu *new, unsigned int irq); -/* Reserve a specific guest vIRQ */ -extern bool vgic_reserve_virq(struct domain *d, unsigned int virq); +/*** Common VGIC functions used by Xen arch code ****/ + +/* + * In the moment vgic_num_irqs() just covers SPIs and the private IRQs, + * as it's mostly used for allocating the pending_irq and irq_desc array, + * in which LPIs don't participate. + */ +#define vgic_num_irqs(d) ((d)->arch.vgic.nr_spis + 32) /* * Allocate a guest VIRQ @@ -329,6 +314,9 @@ extern bool vgic_reserve_virq(struct domain *d, unsigned int virq); * - spi == 1 => allocate an SPI */ extern int vgic_allocate_virq(struct domain *d, bool spi); +/* Reserve a specific guest vIRQ */ +extern bool vgic_reserve_virq(struct domain *d, unsigned int virq); +extern void vgic_free_virq(struct domain *d, unsigned int virq); static inline int vgic_allocate_ppi(struct domain *d) { @@ -340,7 +328,25 @@ static inline int vgic_allocate_spi(struct domain *d) return vgic_allocate_virq(d, true /* spi */); } -extern void vgic_free_virq(struct domain *d, unsigned int virq); +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, bool connect); + +bool vgic_evtchn_irq_pending(struct vcpu *v); + +int domain_vgic_register(struct domain *d, int *mmio_count); +int domain_vgic_init(struct domain *d, unsigned int nr_spis); +void domain_vgic_free(struct domain *d); +int vcpu_vgic_init(struct vcpu *vcpu); +int vcpu_vgic_free(struct vcpu *vcpu); + +int vgic_inject_irq(struct domain *d, struct vcpu *v, unsigned int virq, + bool level); + +extern void vgic_clear_pending_irqs(struct vcpu *v); + +extern bool vgic_emulate(struct cpu_user_regs *regs, union hsr hsr); void vgic_v2_setup_hw(paddr_t dbase, paddr_t cbase, paddr_t csize, paddr_t vbase, uint32_t aliased_offset);