From patchwork Thu May 11 17:53:23 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andre Przywara X-Patchwork-Id: 9722663 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id CB22C60236 for ; Thu, 11 May 2017 17:54:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CB518286D0 for ; Thu, 11 May 2017 17:54:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C0622286E6; Thu, 11 May 2017 17:54:02 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 70B94286D0 for ; Thu, 11 May 2017 17:54:02 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d8sFb-0000Tr-D7; Thu, 11 May 2017 17:51:43 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xenproject.org with esmtp (Exim 4.84_2) (envelope-from ) id 1d8sFa-0000RY-1t for xen-devel@lists.xenproject.org; Thu, 11 May 2017 17:51:42 +0000 Received: from [85.158.137.68] by server-3.bemta-3.messagelabs.com id 7B/1B-02005-DA4A4195; Thu, 11 May 2017 17:51:41 +0000 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFrrGLMWRWlGSWpSXmKPExsVysyfVTXfNEpF Ig9O/DCy+b5nM5MDocfjDFZYAxijWzLyk/IoE1owfO08zFbzhrXh3KaiBcRl3FyMnh5DAZkaJ R3/Kuxi5gOzljBJHl6xnBUmwCehK7Lj5mhnEFhEIlXi64DszSBGzwBpGiXOLfrKBJIQF3CTW/ TnDDmKzCKhKfFi0lgXE5hWwluj/dA7MlhCQk2g4fx9sECdQfMn0WSwQm60kdu0+zTqBkXsBI8 MqRo3i1KKy1CJdI0u9pKLM9IyS3MTMHF1DA2O93NTi4sT01JzEpGK95PzcTYxA/9YzMDDuYGz a63eIUZKDSUmUl3GiSKQQX1J+SmVGYnFGfFFpTmrxIUYZDg4lCd6ri4FygkWp6akVaZk5wECD SUtw8CiJ8N4HSfMWFyTmFmemQ6ROMSpKifMKAsNTSAAkkVGaB9cGC+5LjLJSwryMDAwMQjwFq UW5mSWo8q8YxTkYlYR5d4KM58nMK4Gb/gpoMRPQ4v4/wiCLSxIRUlINjBNeNnolTSvYEvCW1b j0ud/yFdNu8drpudbvdldnMq1iDi4V4P2peVsgZuejX7fVLz/bHt4pNOcR270n19I2xopovc5 I8inY6/ezu/RUUI3PkYz9Zw5Oeu228fm7/F91LCViMyo43RXsvk+ot/pz2OjKpQer/LaX5V86 uvfFkojp6zr7a1ycmZVYijMSDbWYi4oTAbgM/QNpAgAA X-Env-Sender: andre.przywara@arm.com X-Msg-Ref: server-16.tower-31.messagelabs.com!1494525100!92426877!1 X-Originating-IP: [217.140.101.70] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 9.4.12; banners=-,-,- X-VirusChecked: Checked Received: (qmail 32473 invoked from network); 11 May 2017 17:51:40 -0000 Received: from foss.arm.com (HELO foss.arm.com) (217.140.101.70) by server-16.tower-31.messagelabs.com with SMTP; 11 May 2017 17:51:40 -0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 093B1174E; Thu, 11 May 2017 10:51:40 -0700 (PDT) Received: from e104803-lin.lan (unknown [10.1.207.46]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id D75583F4FF; Thu, 11 May 2017 10:51:38 -0700 (PDT) From: Andre Przywara To: Julien Grall , Stefano Stabellini Date: Thu, 11 May 2017 18:53:23 +0100 Message-Id: <20170511175340.8448-12-andre.przywara@arm.com> X-Mailer: git-send-email 2.9.0 In-Reply-To: <20170511175340.8448-1-andre.przywara@arm.com> References: <20170511175340.8448-1-andre.przywara@arm.com> Cc: xen-devel@lists.xenproject.org, Vijaya Kumar K , Vijay Kilari , Shanker Donthineni Subject: [Xen-devel] [PATCH v9 11/28] ARM: VGIC: add vcpu_id to struct pending_irq X-BeenThere: xen-devel@lists.xen.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.xen.org Sender: "Xen-devel" X-Virus-Scanned: ClamAV using ClamSMTP The target CPU for an LPI is encoded in the interrupt translation table entry, so can't be easily derived from just an LPI number (short of walking *all* tables and find the matching LPI). To avoid this in case we need to know the VCPU (for the INVALL command, for instance), put the VCPU ID in the struct pending_irq, so that it is easily accessible. We use the remaining 8 bits of padding space for that to avoid enlarging the size of struct pending_irq. The number of VCPUs is limited to 127 at the moment anyway, which we also confirm with a BUILD_BUG_ON. Signed-off-by: Andre Przywara --- xen/arch/arm/vgic.c | 3 +++ xen/include/asm-arm/vgic.h | 1 + 2 files changed, 4 insertions(+) diff --git a/xen/arch/arm/vgic.c b/xen/arch/arm/vgic.c index 27d6b51..97a2cf2 100644 --- a/xen/arch/arm/vgic.c +++ b/xen/arch/arm/vgic.c @@ -63,6 +63,9 @@ struct vgic_irq_rank *vgic_rank_irq(struct vcpu *v, unsigned int irq) void vgic_init_pending_irq(struct pending_irq *p, unsigned int virq) { + /* The lpi_vcpu_id field must be big enough to hold a VCPU ID. */ + BUILD_BUG_ON(BIT(sizeof(p->lpi_vcpu_id) * 8) < MAX_VIRT_CPUS); + INIT_LIST_HEAD(&p->inflight); INIT_LIST_HEAD(&p->lr_queue); p->irq = virq; diff --git a/xen/include/asm-arm/vgic.h b/xen/include/asm-arm/vgic.h index e2111a5..02732db 100644 --- a/xen/include/asm-arm/vgic.h +++ b/xen/include/asm-arm/vgic.h @@ -73,6 +73,7 @@ struct pending_irq uint8_t lr; uint8_t priority; uint8_t lpi_priority; /* Caches the priority if this is an LPI. */ + uint8_t lpi_vcpu_id; /* The VCPU for an LPI. */ /* inflight is used to append instances of pending_irq to * vgic.inflight_irqs */ struct list_head inflight;