From patchwork Fri Mar 9 15:11:27 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Przywara X-Patchwork-Id: 131141 Delivered-To: patch@linaro.org Received: by 10.80.194.209 with SMTP id u17csp1135332edf; Fri, 9 Mar 2018 07:13:57 -0800 (PST) X-Google-Smtp-Source: AG47ELv4J00e9ESWxsOH9kJQLiJ6pN1H+LRi97UP3C59UMMqQcXaWAacKWNHIXje5Wn95DVn1wUA X-Received: by 2002:a24:5ad4:: with SMTP id v203-v6mr4134485ita.150.1520608437063; Fri, 09 Mar 2018 07:13:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1520608437; cv=none; d=google.com; s=arc-20160816; b=IpGj7JRfY8a411hwQ0718TNS+cQcqO/vawgEVvVbNTUo1SG2i+PKi6tXrjplL7cIfg 8VKFtGG8oupDFmY87EF5tBXUZiReZlUma7hWQmHDw5PS+PHzQiDPW6FJQ1rjB6bhL+YA Ruo+wQPtz3UqtfXV7ArYScxmDJSV7EHmUbXCoCeWYbr1FBBzi6EJBc+IX+54oRgs4QJG bf9p3LWMz/OWRpYXo3D0/3SesuLxvk2sgw7Um/y/MSeAi/baYd2nXRSGaVnG0En0Z8Lq nDw2tOo6JLWBwyDv1F+s2r3Q+TVOrr46O5i6IxXGidXT4cEIJDAiuPGqtEUAqOjEdJ22 4oqw== 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=H7SBB0N727KOKB1oHkr86lxukR1gEAPq+t/uH/Lb45M=; b=neqfCcsOzwgs2iQ7KnTF55QHToD5OcK1SkNu4SWg7Y8qlxsMOwVWgvNhY7ebNWpCg7 zX98wYvpP78Hc+iqnHb76VpVfXOPPJicSDPRW6e+C5jBx/BkF+QtGtik7xIuTED1awOS 9967WuhOJJrGzs8gTnREzXiap7aswE1XhC7K/K/orx0qmO1zmjam6N8KA/HW2zivVQNO LMDsQvYCIN/Lrg4mdgP4t9qILIIMVQHNKF7lKpqRfF+kmG30UQq9oPTwuYzSOhiV6XQw Hj0Yy5Wo/c0q4kV9Q82B2ORrDW8rTBiKqKDxlw4zbJf7VnAZstRaGsrb+NyeubB9o+oh RX2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=OITRlbNE; 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 x22si1059918ioi.66.2018.03.09.07.13.56 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 09 Mar 2018 07:13:57 -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=OITRlbNE; 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 1euJgc-0005zC-IH; Fri, 09 Mar 2018 15:11:58 +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 1euJga-0005wa-O9 for xen-devel@lists.xenproject.org; Fri, 09 Mar 2018 15:11:56 +0000 X-Inumbo-ID: 093fb541-23ac-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 093fb541-23ac-11e8-ba59-bc764e045a96; Fri, 09 Mar 2018 16:10:43 +0100 (CET) Received: by mail-wm0-x243.google.com with SMTP id a20so3861116wmd.1 for ; Fri, 09 Mar 2018 07:11:55 -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=oKcjPCBMTCCglp6qEwOmTuFfmYy3ywV/aS7sc2KwGks=; b=OITRlbNEfRwPibEYk0EkZX6tWGFwpulV6bwAD8nLG+WTrd3kqE6I6NgqLUSNRnLrK8 CiKS7/w32weLk5CD7Amf+vepNi1SavrBHAGDOJ90mqvmLe0MU5uKQprWo4XFjI8cFrmN UUwNW6v69jjythdR4hUVFmJ7y6YXx/DQsgDEc= 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=oKcjPCBMTCCglp6qEwOmTuFfmYy3ywV/aS7sc2KwGks=; b=f/CdVXycWI9mgGHA+KaqTuaolIgYijIxnkVnJwWlHQwmtZiAwHeRhHHnbeExiG5hAv gaNnLCny/WpEULa3vkMIkhSjg3LuwEQBPPLXgeo9jQ2wSuRorxNgFOEBO1JV2SF/Gb3O 0elCbUsfjrpZW/NrVG4tL8OEd64l75BVSX4GFf0zp086YBNMWYvnkoDMkVaCV+CaSYeC lXwngCoqNNdVCXvr60bd8UfeNaZ+iC9Wv25BSJG0njNaqk9ghedtBQEKcgnkdF51ROFV OgPwo+PbPPqC79HCg/LIo295EXGpcFpkBI8hajwLKJDQVSXhvPUdNQ1ojQfbLhw3EFKz jvrA== X-Gm-Message-State: AElRT7Hzu6614PRRgDWRk1lPcDWApItfgb+op5lw13lgkZuOJ4lgUvf2 dZbAD5fb56ZUfG/EWV0Yz7cGiZmbTrw= X-Received: by 10.28.210.135 with SMTP id j129mr2498402wmg.41.1520608314597; Fri, 09 Mar 2018 07:11:54 -0800 (PST) Received: from e104803-lin.lan (mail.andrep.de. [217.160.17.100]) by smtp.gmail.com with ESMTPSA id 1sm1721198wmj.35.2018.03.09.07.11.53 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 09 Mar 2018 07:11:54 -0800 (PST) From: Andre Przywara To: Stefano Stabellini , Julien Grall Date: Fri, 9 Mar 2018 15:11:27 +0000 Message-Id: <20180309151133.31371-12-andre.przywara@linaro.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180309151133.31371-1-andre.przywara@linaro.org> References: <20180309151133.31371-1-andre.przywara@linaro.org> Cc: xen-devel@lists.xenproject.org Subject: [Xen-devel] [PATCH 11/17] 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 --- 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 d6f550ff44..0787ba9549 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 void 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); + +void 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); unsigned int vgic_max_vcpus(const struct domain *d);