From patchwork Mon Feb 1 09:26:22 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: 8177171 Return-Path: X-Original-To: patchwork-xen-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id C11169F4DD for ; Mon, 1 Feb 2016 09:32:56 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 9350220439 for ; Mon, 1 Feb 2016 09:32:55 +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 F239420430 for ; Mon, 1 Feb 2016 09:32:53 +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 1aQAoV-0006rP-73; Mon, 01 Feb 2016 09:30:27 +0000 Received: from mail6.bemta14.messagelabs.com ([193.109.254.103]) by lists.xen.org with esmtp (Exim 4.72) (envelope-from ) id 1aQAmv-0006hf-F5 for xen-devel@lists.xen.org; Mon, 01 Feb 2016 09:28:49 +0000 Received: from [193.109.254.147] by server-10.bemta-14.messagelabs.com id 1C/90-25438-1552FA65; Mon, 01 Feb 2016 09:28:49 +0000 X-Env-Sender: Vijaya.Kumar@caviumnetworks.com X-Msg-Ref: server-16.tower-27.messagelabs.com!1454318927!20445084!1 X-Originating-IP: [157.56.110.100] X-SpamReason: No, hits=0.5 required=7.0 tests=BODY_RANDOM_LONG X-StarScan-Received: X-StarScan-Version: 7.35.1; banners=-,-,- X-VirusChecked: Checked Received: (qmail 30121 invoked from network); 1 Feb 2016 09:28:48 -0000 Received: from mail-bn1bn0100.outbound.protection.outlook.com (HELO na01-bn1-obe.outbound.protection.outlook.com) (157.56.110.100) by server-16.tower-27.messagelabs.com with AES256-SHA256 encrypted SMTP; 1 Feb 2016 09:28:48 -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:28:41 +0000 From: To: , , , , , Date: Mon, 1 Feb 2016 14:56:22 +0530 Message-ID: <1454318798-31913-13-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:F508JGDYcolyQMvpF3hv+tvRF5ZFXrg7vlolL11chrf70oTWm4UIfB8LZa5jp0W0WH6ksV1yb50Hb2gWHRmqm2d1NQp08m9OEMKP5t0e9ZE6zwRApuBm17KvN9wRQskVBO4Z1WO+zCgeLzhfmk6OdA==; 3:VeviuFtu17x2DLV0WV1nPDtx5Qt1lDcneUb+/43er7RJMvph+f4Z0VjkV/ZToA9w60v+0Ya5juYwDaYwUl0Vxz/Whr4ROiugONvhJBAOqGFxNij3/hXCKZINd5M1Ms3W; 25:F4f/WFst2t8Qc/vNR/k8nBNhJe5TemjqS2UjjTvV6T2TB8DSKUyEUwsPIOjnWpY/vonwmHTrCNV5KSHKYn3bkVwNr0bUGUcu3yTPGCXIGnB3y9BbNBUTJBEHq4UKH2ajbwWogutz31RE4ISgRBFZQtIAPCVgCabFqK1s95XzWvRF6dmEUZItq0DTcGp1j2PZpz5vkjBF5mJCCrIwC64qawFHhs8Co+tFYOoGDfirGs+DEWM654lBg6bFHC1hpGgW X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BN3PR0701MB1688; X-MS-Office365-Filtering-Correlation-Id: f1e72722-d888-4262-2c62-08d32aea155e X-Microsoft-Exchange-Diagnostics: 1; BN3PR0701MB1688; 20:yRsZ9p+VtcUoNNifLhS1rlu0HC9462hI9TQeh/8+G7otCF6exBuWwsNanGEOJkBz1BV31FNsa+U+Rq/v2b87bCXknQ8G8qm05L5g+kboQV9kODCtR0EB6vps84JajW7nQiVGTyC0w2wuUHuXHlU85DKY27s+L0w7axYc097IsvqPInOV3qwS53AsbKBeqHTnwUym/HcV6RI4oKYJkJHyu40OMM9YUVOYnlyMNXRJp39bDd8OYsHY5zX6ZkHlw7Rj2LcIx3wHdrzfY7zKHUZaxmqJ2XdBpEgfefDoT2rJ7Z8f4JsOJUDP6Rl7/LZd+AcuiXb4zCsvCTTUXaygmxZiS8c1itbSw/QxMVCaXvTONowv26cCDf7CXqWqPt0f968/u2eJsup01juYl3DvBb9LsiNM2kqTuc64Ml6gzKzUood1oZpyNTjXMElxe//OCNVlCmOpEXPx0jGtPkwsRL/vvRRdZ2oXjTk2uJn65E403emUu2Zqa7SPTuqqCKScGhGEX6YLJEv2b15F9cJt+ibEElLhVY7kib7avZ+8y5BB29VbUjdd67vwWoxuS12XkXcMet3FQ7g+803TsoAWIcDewmPyrnIMrNHatmjEgQkWLAk= 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:frey048MdgDYaYuy1uZ4k83buWVPhtK5UFKaZKentjyDJaPvwizkafg3pRewJNRkaYO4Bbgg4ydPoYzxayJrkEXTQ4Mql0rinIL6Rrg41+F/531knK9SgMbUd2elhtbzFgfsTQrkHLPWNlTpqpKSBaoraG60EAUHbRiZJ6ocXBYfwvLvDEw/HjaLT0bmJfr0VWaQ7DDTQQMMtfPZkjgYUfJg9yjxZOVv2O74YzyOZmCVM54Eevdbyejc+NcSy+xMxY7rUnTbQ8WyPSumXZbneI/Eic+JZLixiVwnrfevJsv8BII1nIQXVUv7Jlo5JNexJbPCOzt4UHhuqvPf/xnA9e+bMJekPjcPDihC/wSrezgs10RkWc4wyxbOrJ0Z55OC X-Forefront-PRVS: 0839D067E7 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(6009001)(3846002)(5009440100003)(586003)(1096002)(76176999)(50986999)(36756003)(189998001)(92566002)(5004730100002)(2950100001)(229853001)(50226001)(87976001)(86152002)(2201001)(5001960100002)(77096005)(53416004)(48376002)(19580395003)(19580405001)(5003940100001)(5001770100001)(42186005)(33646002)(66066001)(47776003)(2906002)(2876002)(4326007)(122386002)(3470700001)(5008740100001)(50466002)(575784001)(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:kf/LPE8iGQ7UqznHT67+6eDwpX6UnFzHRIpPmkV?= =?us-ascii?Q?bQu4NdYG/zsyuodd4xvcug6vMPkMVnzEtLIFXzmUWV0xGN4mf+lYW62fWcCH?= =?us-ascii?Q?9m/Wf9ZHhnDbdFnwBoJ/3SOqNS/nrxUFxZ426WA6WqdD9tGLjuQxT+BVhb1d?= =?us-ascii?Q?HXpmHU8IqoB8PaFULUCxYNjgWlT6wKBlWJIOdiOGSB1VlTEjGUnILo0dEMdG?= =?us-ascii?Q?Ig+Qs2IZQVkAPDg2jFNNXhadjF48SISUXs6Lt4M02Kb8SNpfqPmIyvYiTwSU?= =?us-ascii?Q?2aJo4UxDH+ONg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zC0ZmBq3ABZ5rwKmO9CEB4Ux/8p7EM+uwOGrdzbEnXB7fSMM1Qb0JsVvDEuMJkCGC1uWYCGGIALKqGnIdygRdgofacFKEu/Qs4jL00oP0A/3ek4T0Hw==; 24:s7M8nsZuHcSL/YY3YNI99cB9tAj9EMUYwwRUZ6xD2i/HLS3Idn5dC3w3mzt/grLs1l620pF4B9ljyGaQMQJV+jtXZVU41QIuWn0D2j1duqs= SpamDiagnosticOutput: 1:23 SpamDiagnosticMetadata: NSPM X-OriginatorOrg: caviumnetworks.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 01 Feb 2016 09:28:41.8850 (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, Zoltan Kiss , Vijaya Kumar K , vijay.kilari@gmail.com Subject: [Xen-devel] [PATCH v8 12/28] xen/arm: ITS: Plumb hw_irq_controller 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 Change callbacks gic_host_irq_type and gic_guest_irq_type to gic_get_host_irq_type and gic_get_guest_irq_type in gic_hw_operations, which returns hw_irq_controller based on irq type (SPI or LPI). Signed-off-by: Vijaya Kumar K CC: Zoltan Kiss Reviewed-by: Julien Grall --- v8: Dropped helper to get hw_irq_controller --- xen/arch/arm/gic-hip04.c | 14 ++++++++++++-- xen/arch/arm/gic-v2.c | 14 ++++++++++++-- xen/arch/arm/gic-v3.c | 21 +++++++++++++++++++-- xen/arch/arm/gic.c | 4 ++-- xen/include/asm-arm/gic-its.h | 3 +++ xen/include/asm-arm/gic.h | 4 ++-- 6 files changed, 50 insertions(+), 10 deletions(-) diff --git a/xen/arch/arm/gic-hip04.c b/xen/arch/arm/gic-hip04.c index 9a4091b..193849e 100644 --- a/xen/arch/arm/gic-hip04.c +++ b/xen/arch/arm/gic-hip04.c @@ -630,6 +630,16 @@ static hw_irq_controller hip04gic_guest_irq_type = { .set_affinity = hip04gic_irq_set_affinity, }; +static hw_irq_controller *hip04gic_get_host_irq_type(unsigned int irq) +{ + return &hip04gic_host_irq_type; +} + +static hw_irq_controller *hip04gic_get_guest_irq_type(unsigned int irq) +{ + return &hip04gic_guest_irq_type; +} + static int __init hip04gic_init(void) { int res; @@ -708,8 +718,8 @@ const static struct gic_hw_operations hip04gic_ops = { .save_state = hip04gic_save_state, .restore_state = hip04gic_restore_state, .dump_state = hip04gic_dump_state, - .gic_host_irq_type = &hip04gic_host_irq_type, - .gic_guest_irq_type = &hip04gic_guest_irq_type, + .gic_get_host_irq_type = hip04gic_get_host_irq_type, + .gic_get_guest_irq_type = hip04gic_get_guest_irq_type, .eoi_irq = hip04gic_eoi_irq, .deactivate_irq = hip04gic_dir_irq, .read_irq = hip04gic_read_irq, diff --git a/xen/arch/arm/gic-v2.c b/xen/arch/arm/gic-v2.c index 915fd63..d8de68e 100644 --- a/xen/arch/arm/gic-v2.c +++ b/xen/arch/arm/gic-v2.c @@ -630,6 +630,16 @@ static bool_t gicv2_is_aliased(paddr_t cbase, paddr_t csize) return ((val_low & 0xfff0fff) == 0x0202043B && val_low == val_high); } +static hw_irq_controller *gicv2_get_host_irq_type(unsigned int irq) +{ + return &gicv2_host_irq_type; +} + +static hw_irq_controller *gicv2_get_guest_irq_type(unsigned int irq) +{ + return &gicv2_guest_irq_type; +} + static int __init gicv2_init(void) { int res; @@ -748,8 +758,8 @@ const static struct gic_hw_operations gicv2_ops = { .save_state = gicv2_save_state, .restore_state = gicv2_restore_state, .dump_state = gicv2_dump_state, - .gic_host_irq_type = &gicv2_host_irq_type, - .gic_guest_irq_type = &gicv2_guest_irq_type, + .gic_get_host_irq_type = gicv2_get_host_irq_type, + .gic_get_guest_irq_type = gicv2_get_guest_irq_type, .eoi_irq = gicv2_eoi_irq, .deactivate_irq = gicv2_dir_irq, .read_irq = gicv2_read_irq, diff --git a/xen/arch/arm/gic-v3.c b/xen/arch/arm/gic-v3.c index f7cf4e5..45fe624 100644 --- a/xen/arch/arm/gic-v3.c +++ b/xen/arch/arm/gic-v3.c @@ -40,6 +40,7 @@ #include #include #include +#include #include /* Global state */ @@ -1184,6 +1185,22 @@ static const hw_irq_controller gicv3_guest_irq_type = { .set_affinity = gicv3_irq_set_affinity, }; +static hw_irq_controller *gicv3_get_host_irq_type(unsigned int irq) +{ + if ( gic_is_lpi(irq) ) + return &its_host_lpi_type; + + return &gicv3_host_irq_type; +} + +static hw_irq_controller *gicv3_get_guest_irq_type(unsigned int irq) +{ + if ( gic_is_lpi(irq) ) + return &its_guest_lpi_type; + + return &gicv3_guest_irq_type; +} + static int __init cmp_rdist(const void *a, const void *b) { const struct rdist_region *l = a, *r = a; @@ -1352,8 +1369,8 @@ static const struct gic_hw_operations gicv3_ops = { .save_state = gicv3_save_state, .restore_state = gicv3_restore_state, .dump_state = gicv3_dump_state, - .gic_host_irq_type = &gicv3_host_irq_type, - .gic_guest_irq_type = &gicv3_guest_irq_type, + .gic_get_host_irq_type = gicv3_get_host_irq_type, + .gic_get_guest_irq_type = gicv3_get_guest_irq_type, .eoi_irq = gicv3_eoi_irq, .deactivate_irq = gicv3_dir_irq, .read_irq = gicv3_read_irq, diff --git a/xen/arch/arm/gic.c b/xen/arch/arm/gic.c index 0c43a5b..d54bba9 100644 --- a/xen/arch/arm/gic.c +++ b/xen/arch/arm/gic.c @@ -128,7 +128,7 @@ void gic_route_irq_to_xen(struct irq_desc *desc, const cpumask_t *cpu_mask, ASSERT(test_bit(_IRQ_DISABLED, &desc->status)); ASSERT(spin_is_locked(&desc->lock)); - desc->handler = gic_hw_ops->gic_host_irq_type; + desc->handler = gic_hw_ops->gic_get_host_irq_type(desc->irq); gic_set_irq_properties(desc, cpu_mask, priority); } @@ -159,7 +159,7 @@ int gic_route_irq_to_guest(struct domain *d, unsigned int virq, test_bit(GIC_IRQ_GUEST_ENABLED, &p->status) ) goto out; - desc->handler = gic_hw_ops->gic_guest_irq_type; + desc->handler = gic_hw_ops->gic_get_guest_irq_type(desc->irq); set_bit(_IRQ_GUEST, &desc->status); gic_set_irq_properties(desc, cpumask_of(v_target->processor), priority); diff --git a/xen/include/asm-arm/gic-its.h b/xen/include/asm-arm/gic-its.h index 7fd7140..fd6ebfb 100644 --- a/xen/include/asm-arm/gic-its.h +++ b/xen/include/asm-arm/gic-its.h @@ -281,6 +281,9 @@ struct its_device { struct rb_node node; }; +extern const hw_irq_controller its_host_lpi_type; +extern const hw_irq_controller its_guest_lpi_type; + void irqdesc_set_lpi_event(struct irq_desc *desc, unsigned id); unsigned int irqdesc_get_lpi_event(struct irq_desc *desc); struct its_device *irqdesc_get_its_device(struct irq_desc *desc); diff --git a/xen/include/asm-arm/gic.h b/xen/include/asm-arm/gic.h index c6e7a8d..6b4883a 100644 --- a/xen/include/asm-arm/gic.h +++ b/xen/include/asm-arm/gic.h @@ -322,10 +322,10 @@ struct gic_hw_operations { void (*dump_state)(const struct vcpu *); /* hw_irq_controller to enable/disable/eoi host irq */ - hw_irq_controller *gic_host_irq_type; + hw_irq_controller *(*gic_get_host_irq_type)(unsigned int irq); /* hw_irq_controller to enable/disable/eoi guest irq */ - hw_irq_controller *gic_guest_irq_type; + hw_irq_controller *(*gic_get_guest_irq_type)(unsigned int irq); /* End of Interrupt */ void (*eoi_irq)(struct irq_desc *irqd);