From patchwork Mon Feb 1 09:26:32 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: vijayak@caviumnetworks.com X-Patchwork-Id: 8177301 Return-Path: X-Original-To: patchwork-xen-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 89887BEEED for ; Mon, 1 Feb 2016 09:33:19 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id A7E2E20412 for ; Mon, 1 Feb 2016 09:33:18 +0000 (UTC) Received: from lists.xen.org (lists.xenproject.org [50.57.142.19]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0867A20414 for ; Mon, 1 Feb 2016 09:33:13 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=lists.xen.org) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aQAoa-0006vB-D4; Mon, 01 Feb 2016 09:30:32 +0000 Received: from mail6.bemta3.messagelabs.com ([195.245.230.39]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aQAnh-0006lQ-VR for xen-devel@lists.xen.org; Mon, 01 Feb 2016 09:29:38 +0000 Received: from [85.158.137.68] by server-1.bemta-3.messagelabs.com id 4A/60-02745-1852FA65; Mon, 01 Feb 2016 09:29:37 +0000 X-Env-Sender: Vijaya.Kumar@caviumnetworks.com X-Msg-Ref: server-3.tower-31.messagelabs.com!1454318974!19424315!1 X-Originating-IP: [207.46.100.53] X-SpamReason: No, hits=0.0 required=7.0 tests= X-StarScan-Received: X-StarScan-Version: 7.35.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 5535 invoked from network); 1 Feb 2016 09:29:36 -0000 Received: from mail-by2on0053.outbound.protection.outlook.com (HELO na01-by2-obe.outbound.protection.outlook.com) (207.46.100.53) by server-3.tower-31.messagelabs.com with AES256-SHA256 encrypted SMTP; 1 Feb 2016 09:29:36 -0000 Received: from cavium-Vostro-2520.caveonetworks.com (111.93.218.67) by BN3PR0701MB1688.namprd07.prod.outlook.com (10.163.39.154) with Microsoft SMTP Server (TLS) id 15.1.396.15; Mon, 1 Feb 2016 09:29:29 +0000 From: To: , , , , , Date: Mon, 1 Feb 2016 14:56:32 +0530 Message-ID: <1454318798-31913-23-git-send-email-vijayak@caviumnetworks.com> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1454318798-31913-1-git-send-email-vijayak@caviumnetworks.com> References: <1454318798-31913-1-git-send-email-vijayak@caviumnetworks.com> MIME-Version: 1.0 X-Originating-IP: [111.93.218.67] X-ClientProxiedBy: BM1PR01CA0026.INDPRD01.PROD.OUTLOOK.COM (25.163.198.161) To BN3PR0701MB1688.namprd07.prod.outlook.com (25.163.39.154) X-Microsoft-Exchange-Diagnostics: 1; BN3PR0701MB1688; 2:hGYVEHhUcMvLbgyhsg7hBt7qUYfmy4/6Wd94gPb/H4NUcJxL7A7TjoUnGWt1WY6PlqnYpeLH87oG6DolCB+/1zi9wtIqP2ipMfkZbFvkRwPgeDZQGEHBrmo6oMWK7rP1FPb6NrQhAh72U38pTeYNhg==; 3:jurEo5ZmwfoLDyYaDlvwumWAP01OO9H8Kaq3iOqsDvaCgn3HtCnlIazWzF4ije39+tty8RIB9tlsPatL/s+AbZQ8zOeENU5Er8d/8vyBkLskJ278ryMBK0neaUZs+dqb; 25:oqHYT68cuQ262RnID/LVPSoZGQkqRLiUOaAwTFcR0YK2HocLfF/c86oGCeN6PQbMX4uyrFi9eEkFxegl9diYuB3f601VzjFFjL08O3uY7UwGXdOekU9/19Xt1qeVvSK/mbtyCV1puMZUMEEFMVUK54kdR4eXVDmQ38psHskZRz/b/I4yHkHjE7SuaTGR3Co0swJBM38YrXu6JejmCWyDp3z4G8ea3tdDLIe/AsBG/ZY9H/Q/tvBYcHDSL54H2fkb X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BN3PR0701MB1688; X-MS-Office365-Filtering-Correlation-Id: 88edd470-cb09-4355-c2cf-08d32aea3166 X-Microsoft-Exchange-Diagnostics: 1; BN3PR0701MB1688; 20:Du4D1TAOFYAJHedPu+BdyTC0VL+sox6bnD1t6ZsRh22EuiAXKFxpPCdnEReWL3GHpcGtPfx5fidJbhkBJPX2pX/CE5Gxsaaq1E1rDbXZuh0R7Wc2ACF/tyTezhoXCnskU+W+9HdSHiDwaWowfglxpGaekfxDkiyxsk/3G3X1iKjX1IFCTRKouaF8UiBsMwkH5U5kAcCs+JOGEv77VvD2GHxvCklmp3mexJV2wdRZs19rxlU0Zty6cPcRMSooppSp1i+qZoNQLi7JnN22qNer46xnT+MjPwkE/6et+6oL9zlrXxhjuZ2NABmFRqmMARHVBH1y294v5DKwdG3L6UPNOq7G+a3sb9nEC5WzGrAiFQxk4QXAcy6XQsvWq61Y7U630Y7DE+4QmJl9MvvnIeBQh37WSxZ0etQCXPYP1v0/amHUSj6BFgDjJ1RB1KK5N4XCDeSNueER8iZPVjZfBYfBh3vBixEKAou8G6pAhyky3QZtyLVLa9H/qLKWGBOL7E4Zjb1bPX7empHAOat/cfHKXGgE42M5hE6lUWY4ePFgLGXms7bmC8JGmN1/M/2g027NN4WAP8dk894czkC97QPV/xR929WsOnLHEozQ7FSfhFs= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(601004)(2401047)(5005006)(8121501046)(3002001)(10201501046); SRVR:BN3PR0701MB1688; BCL:0; PCL:0; RULEID:; SRVR:BN3PR0701MB1688; X-Microsoft-Exchange-Diagnostics: 1; BN3PR0701MB1688; 4:7OMlXCiqialk78nKzko6xYyLleRaI8L/frOgg/QMAN35MEFHVynbt6ORJkiFiWv/rG+Q6bKtcyEBg3FwWfrPBokYPpLCRZHahg00JJgIhQ4P9z2G4vjgLv5Zr0Xpha+pIQIlSIEfIB2gzt9aTz2ZwF3ftunxe6FlmydOqkuIieO9CsQQPdhTSbcWoMZZxyUQtcn9x7TX7wh8TYItTQ8xr+7EJYlNO9yMDQajl5/FGL/Tj1IXbIWS24KmNK0X26tnejAFcRVfAmR9r3COQqou/yDCZet5F4TSvQL74tJRmBPxuK0oax+Haa1UYEj/RZh/H7j1W7/ql1AMT/+3eDG96V0hk0CB963SwTfNXMYiRgbc36lRmTQkO3rYDKGESTAd X-Forefront-PRVS: 0839D067E7 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(3846002)(5009440100003)(4001430100002)(586003)(1096002)(76176999)(50986999)(36756003)(189998001)(92566002)(5004730100002)(2950100001)(229853001)(50226001)(87976001)(86152002)(107886002)(2201001)(5001960100002)(77096005)(53416004)(48376002)(19580395003)(19580405001)(5003940100001)(5001770100001)(42186005)(33646002)(66066001)(47776003)(2906002)(2876002)(4326007)(122386002)(3470700001)(5008740100001)(50466002)(40100003)(7099028)(7059030)(2101003); DIR:OUT; SFP:1101; SCL:1; SRVR:BN3PR0701MB1688; H:cavium-Vostro-2520.caveonetworks.com; FPR:; SPF:None; MLV:sfv; LANG:en; X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; BN3PR0701MB1688; 23:Dr0Gd9uWdr5X6g2MT96Gbbt3hG9cOPPAbsVQb4N?= =?us-ascii?Q?HUeOpGmvgcfnVy66OFzxJT4jvpU8gE3N1vIImLk3oUMIb7yml14ZZxwuQVey?= =?us-ascii?Q?51XwVl8+fKQImaKYMPmTPLAC8j6crUQh+kvvIetXf/OFWUDAPxhb8SWkuh11?= =?us-ascii?Q?CV5TSzbnNBF4OynZ+5HlHLgR5w9Q4f/b8L7JSRAnOviQGVTGL5EH0Yu12ll3?= =?us-ascii?Q?Nspv+hWb+3FxQheFvyP5iIL5iWmg7B8vQK+2XI+GoumMajtrnU3DPU7iAKzN?= =?us-ascii?Q?6E25JysElNkku2Z6wYNV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ostics: 1; BN3PR0701MB1688; 5:s41b3wdvanmmnGGQOH7gIpPc1yZJ5tvcWTt2LK6a7To6cmdWg+J3DEmJ9HdZ0Sa7MW4TIO60a0fmkXC3StDQ2LO5euE79xZ6hicy6K9txMYRA2Pi8WjQDt8kpQkmImtNGkT668sTZfragi70Nf30Ww==; 24:Q7rg4GSgxYwvdIS9Lx0WMz7FvI/oOUhE/aaSCS+xPkk8dr1syTc9ab709TLsfa9tDoPDSghBkJF0ugQwpZpyle6gzUuINBTQFbLTHKdSSAU= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Feb 2016 09:29:29.1521 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-Transport-CrossTenantHeadersStamped: BN3PR0701MB1688 X-Mailman-Approved-At: Mon, 01 Feb 2016 09:30:20 +0000 Cc: Prasun.Kapoor@caviumnetworks.com, manish.jaggi@caviumnetworks.com, Vijaya Kumar K , vijay.kilari@gmail.com Subject: [Xen-devel] [PATCH v8 22/28] xen/arm: ITS: Allocate irq descriptors for LPIs X-BeenThere: xen-devel@lists.xen.org X-Mailman-Version: 2.1.13 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Sender: xen-devel-bounces@lists.xen.org Errors-To: xen-devel-bounces@lists.xen.org X-Spam-Status: No, score=-4.2 required=5.0 tests=BAD_ENC_HEADER,BAYES_00, RCVD_IN_DNSWL_MED, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Vijaya Kumar K Allocate dynamically irq descriptors for LPIs Signed-off-by: Vijaya Kumar K --- v8: - Use gic_nr_irq_ids() instead of nr_lpis v6: - Add separate patch for irq_pending structures - renamed and moved is_domain_lpi to vgic - Updated __irq_to_domain --- xen/arch/arm/gic-v3-its.c | 4 ++++ xen/arch/arm/irq.c | 37 ++++++++++++++++++++++++++++++++++++- xen/include/asm-arm/irq.h | 1 + 3 files changed, 41 insertions(+), 1 deletion(-) diff --git a/xen/arch/arm/gic-v3-its.c b/xen/arch/arm/gic-v3-its.c index e495d4d..1dcfc39 100644 --- a/xen/arch/arm/gic-v3-its.c +++ b/xen/arch/arm/gic-v3-its.c @@ -1496,6 +1496,10 @@ int __init its_init(struct rdist_prop *rdists) its_alloc_lpi_tables(); its_lpi_init(rdists->id_bits); + /* Allocate irq descriptors for LPIs */ + if ( init_lpi() ) + return -ENOMEM; + its = list_first_entry(&its_nodes, struct its_node, entry); /* * As per vITS design spec, Xen exposes only one virtual ITS per domain. diff --git a/xen/arch/arm/irq.c b/xen/arch/arm/irq.c index 3baac5d..e4c6019 100644 --- a/xen/arch/arm/irq.c +++ b/xen/arch/arm/irq.c @@ -31,6 +31,8 @@ static unsigned int local_irqs_type[NR_LOCAL_IRQS]; static DEFINE_SPINLOCK(local_irqs_type_lock); +static irq_desc_t *irq_desc_lpi; + /* Describe an IRQ assigned to a guest */ struct irq_guest { @@ -61,7 +63,15 @@ static DEFINE_PER_CPU(irq_desc_t[NR_LOCAL_IRQS], local_irq_desc); irq_desc_t *__irq_to_desc(int irq) { if (irq < NR_LOCAL_IRQS) return &this_cpu(local_irq_desc)[irq]; - return &irq_desc[irq-NR_LOCAL_IRQS]; + else if ( gic_is_lpi(irq) ) + { + ASSERT(irq_desc_lpi != NULL); + return &irq_desc_lpi[irq - FIRST_GIC_LPI]; + } + else + return &irq_desc[irq - NR_LOCAL_IRQS]; + + return NULL; } int __init arch_init_one_irq_desc(struct irq_desc *desc) @@ -111,6 +121,31 @@ static int init_local_irq_data(void) return 0; } +int init_lpi(void) +{ + struct irq_desc *desc; + unsigned int i, nr_lpis; + + nr_lpis = gic_nr_irq_ids() - FIRST_GIC_LPI; + ASSERT(nr_lpis >= 0); + + /* Allocate LPI irq descriptors */ + irq_desc_lpi = xzalloc_array(struct irq_desc, nr_lpis); + if ( !irq_desc_lpi ) + return -ENOMEM; + + for ( i = 0; i < nr_lpis; i++ ) + { + desc = &irq_desc_lpi[i]; + init_one_irq_desc(desc); + desc->irq = FIRST_GIC_LPI + i; + desc->arch.type = DT_IRQ_TYPE_EDGE_BOTH; + desc->action = NULL; + } + + return 0; +} + void __init init_IRQ(void) { int irq; diff --git a/xen/include/asm-arm/irq.h b/xen/include/asm-arm/irq.h index 4bb9464..323f6c0 100644 --- a/xen/include/asm-arm/irq.h +++ b/xen/include/asm-arm/irq.h @@ -65,6 +65,7 @@ int platform_get_irq(const struct dt_device_node *device, int index); void irq_set_affinity(struct irq_desc *desc, const cpumask_t *cpu_mask); void irq_set_msi_desc(struct irq_desc *desc, struct msi_desc *msi); struct msi_desc *irq_get_msi_desc(struct irq_desc *desc); +int init_lpi(void); #endif /* _ASM_HW_IRQ_H */ /*