Message ID | 20180209143937.28866-41-andre.przywara@linaro.org |
---|---|
State | Superseded |
Headers | show
Delivered-To: patch@linaro.org Received: by 10.46.124.24 with SMTP id x24csp679711ljc; Fri, 9 Feb 2018 06:42:05 -0800 (PST) X-Google-Smtp-Source: AH8x224QognvLzOaY2Lfpffu3YqByOVHgJYtpOQt8VJ65Xf1/g7i8IounzlpCGBgYF6guYOOw3Il X-Received: by 10.107.17.27 with SMTP id z27mr3464800ioi.254.1518187325528; Fri, 09 Feb 2018 06:42:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1518187325; cv=none; d=google.com; s=arc-20160816; b=N40sGrexscYNZviWeKSCUhbIGg/ixAv3rKhChQYc6OJdgPKN3qkvxG95IqY6UQY2rg HNNcJK+L9oAhUeSJBqjMsfxvBdj8rFX7KzEqVyykRnw2MNCZBfC/pc0zE9C8KAO8Bez1 xYp5jOZd5GFHqGj2KDZuuTbaS7CzQrrI8n1qXVv1bcKzNq/6jgb/2D25Kqd+Z7+6LnMU vV3M9jktCYpyDoGEFQ5D7mV1ZuPTYcTUFOvz0fFG/l0XTRpTHSWW9WivCjI0zgxgy+9t 7ibqPrxmi5SqKMhpzVZcrq4oaZ2RDnnFaSci1WSZ1VFOEgceFRSawx7i4P0DcDKw1MFq TOZw== 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:references:in-reply-to:message-id:date:to:from :dkim-signature:arc-authentication-results; bh=z3Go5d4RSh2i8I12sVG7jAkKHcBHOgKYDydcZEnVZBQ=; b=NuIca1B21d1FfjpwxDZIm8O62L4PgZJpAXjGG7uFMoY0ljWmuIVH1YOH8KgNkwiebL kKNcVvcchgpGpZPhZ61pUrPe8mAyS09rYtWzFIqFdp3jQxrbKTjpCEcSTdEl4OEfvE6Q BWDt0nSkSrfCYp7I9RC3GxPl1qQX021W2QSxeA7G3j8XmlOK0o07iuVhr+hda539GCh+ xsUFhgs1czFYj61PbHre1GJN57RQ2zGu5GFbBBYki6nXKk5yb0CC5xpkdFAjchw8YDCd Mhh3i79ST2ykFKhEf4OfnknbnwqOGwvB1H6Yik3h6EK8L8f9HrzuEiAsu5+VQ+rewecv w4nw== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@linaro.org header.s=google header.b=NhP5tFQj; 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: <xen-devel-bounces@lists.xenproject.org> Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id b204si1206225ioe.252.2018.02.09.06.42.05 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 09 Feb 2018 06:42:05 -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=NhP5tFQj; 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 <xen-devel-bounces@lists.xenproject.org>) id 1ek9qn-0001dP-Nz; Fri, 09 Feb 2018 14:40:29 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from <srs0=vdwz=fd=linaro.org=andre.przywara@srs-us1.protection.inumbo.net>) id 1ek9qn-0001Zt-0c for xen-devel@lists.xenproject.org; Fri, 09 Feb 2018 14:40:29 +0000 X-Inumbo-ID: 1ad1c680-0da7-11e8-ba59-bc764e045a96 Received: from mail-wm0-x242.google.com (unknown [2a00:1450:400c:c09::242]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id 1ad1c680-0da7-11e8-ba59-bc764e045a96; Fri, 09 Feb 2018 15:40:00 +0100 (CET) Received: by mail-wm0-x242.google.com with SMTP id 143so15758997wma.5 for <xen-devel@lists.xenproject.org>; Fri, 09 Feb 2018 06:40:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:subject:date:message-id:in-reply-to:references; bh=oueWcB5l1n9PSY+/992i83adBAtt3Rrh2fuA7hhmdws=; b=NhP5tFQjNVZ5Vl6utRU61GdRYzQyyj+cdLBCgsMvGAHhx23Mmb0vqJqyVEJykjYmHZ K4LIiAh7itZA1T7gQJ7I3r37/66zJ/+mLbxV4O0P83Ze+86t7mQ3qNHN2+21pKMbOTpq PUpEJNlTSNCfNWAaS+Sl579xI5fQjG660Og84= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:subject:date:message-id:in-reply-to :references; bh=oueWcB5l1n9PSY+/992i83adBAtt3Rrh2fuA7hhmdws=; b=ciDmFVU3/7IYnDFXbExgFlPzc6N4qaPqw4CledSy8bS6F/58l2QZYrXZ2nzrV6aFAL m57TqDXHi/oO/JXqSKmX+8Eq7s809gloaMel7LJUFi0l/hcm77W05jHn7n0V/YGVBNdn 4P944Ku6EZf3YVj4vCx6IucUcMshe3f/h7jWfurUfmIp32oH8I2qznhw3QReh1OwzsWg uPL4tctdryMrAAnqQgIXiB2E+QkC80ZBAE+olCnCF5YXpA40jEnsjq1LaNUNWzCHi9Lk m84jkoswwyDS3PJ7r8VeY/AyM5g+gYB5CEFx7LfyFI/B5whFDySemXBhVuqkMkS6Hfzs kLLA== X-Gm-Message-State: APf1xPCN8UORF5NMn4Oe1eQO5sj6f4WWdNmvNtIQ0u3nxGbl3zRt/lUe JhETQWjSsmEqMtZfX7baQZfQYg== X-Received: by 10.28.150.139 with SMTP id y133mr2176629wmd.142.1518187227342; Fri, 09 Feb 2018 06:40:27 -0800 (PST) Received: from e104803-lin.lan (mail.andrep.de. [217.160.17.100]) by smtp.gmail.com with ESMTPSA id b35sm2552229wra.13.2018.02.09.06.40.26 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 09 Feb 2018 06:40:26 -0800 (PST) From: Andre Przywara <andre.przywara@linaro.org> To: Stefano Stabellini <sstabellini@kernel.org>, Julien Grall <julien.grall@arm.com>, xen-devel@lists.xenproject.org Date: Fri, 9 Feb 2018 14:39:28 +0000 Message-Id: <20180209143937.28866-41-andre.przywara@linaro.org> X-Mailer: git-send-email 2.14.1 In-Reply-To: <20180209143937.28866-1-andre.przywara@linaro.org> References: <20180209143937.28866-1-andre.przywara@linaro.org> Subject: [Xen-devel] [RFC PATCH 40/49] ARM: new VGIC: Handle virtual IRQ allocation/reservation X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Xen developer discussion <xen-devel.lists.xenproject.org> List-Unsubscribe: <https://lists.xenproject.org/mailman/options/xen-devel>, <mailto:xen-devel-request@lists.xenproject.org?subject=unsubscribe> List-Post: <mailto:xen-devel@lists.xenproject.org> List-Help: <mailto:xen-devel-request@lists.xenproject.org?subject=help> List-Subscribe: <https://lists.xenproject.org/mailman/listinfo/xen-devel>, <mailto:xen-devel-request@lists.xenproject.org?subject=subscribe> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: base64 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" <xen-devel-bounces@lists.xenproject.org> |
Series |
New VGIC(-v2) implementation
|
expand
|
diff --git a/xen/arch/arm/vgic/vgic.c b/xen/arch/arm/vgic/vgic.c index b62cda7d2f..3b475ed1a4 100644 --- a/xen/arch/arm/vgic/vgic.c +++ b/xen/arch/arm/vgic/vgic.c @@ -713,6 +713,50 @@ bool vgic_evtchn_irq_pending(struct vcpu *v) return pending; } +bool vgic_reserve_virq(struct domain *d, unsigned int virq) +{ + if ( virq >= vgic_num_irqs(d) ) + return false; + + return !test_and_set_bit(virq, d->arch.vgic.allocated_irqs); +} + +int vgic_allocate_virq(struct domain *d, bool spi) +{ + int first, end; + unsigned int virq; + + if ( !spi ) + { + /* We only allocate PPIs. SGIs are all reserved */ + first = 16; + end = 32; + } + else + { + first = 32; + end = vgic_num_irqs(d); + } + + /* + * There is no spinlock to protect allocated_irqs, therefore + * test_and_set_bit may fail. If so retry it. + */ + do + { + virq = find_next_zero_bit(d->arch.vgic.allocated_irqs, end, first); + if ( virq >= end ) + return -1; + } while ( test_and_set_bit(virq, d->arch.vgic.allocated_irqs) ); + + return virq; +} + +void vgic_free_virq(struct domain *d, unsigned int virq) +{ + clear_bit(virq, d->arch.vgic.allocated_irqs); +} + struct irq_desc *vgic_get_hw_irq_desc(struct domain *d, struct vcpu *v, unsigned int virq) {
To find an unused virtual IRQ number Xen uses a scheme to track used virtual IRQs. Implement this interface in the new VGIC to make the Xen core/arch code happy. This is actually somewhat VGIC agnostic, so is mostly a copy of the code from the old VGIC. But it has to live in the VGIC files, so we can't easily reuse the existing implementation. Signed-off-by: Andre Przywara <andre.przywara@linaro.org> --- xen/arch/arm/vgic/vgic.c | 44 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+)