Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932460AbbFIWYo (ORCPT ); Tue, 9 Jun 2015 18:24:44 -0400 Received: from mail-bl2on0114.outbound.protection.outlook.com ([65.55.169.114]:52192 "EHLO na01-bl2-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753722AbbFIWYf (ORCPT ); Tue, 9 Jun 2015 18:24:35 -0400 Authentication-Results: spf=fail (sender IP is 192.88.168.50) smtp.mailfrom=freescale.com; freescale.mail.onmicrosoft.com; dkim=none (message not signed) header.d=none; From: "J. German Rivera" To: , , , CC: , , , , , , , , , , "J. German Rivera" Subject: [PATCH v4 5/7] staging: fsl-mc: Allow the MC bus driver to run without GIC support Date: Tue, 9 Jun 2015 16:59:06 -0500 Message-ID: <1433887148-2310-6-git-send-email-German.Rivera@freescale.com> X-Mailer: git-send-email 2.3.3 In-Reply-To: <1433887148-2310-1-git-send-email-German.Rivera@freescale.com> References: <1433887148-2310-1-git-send-email-German.Rivera@freescale.com> X-EOPAttributedMessage: 0 X-Microsoft-Exchange-Diagnostics: 1;BY2FFO11FD022;1:L4RZgRofa3mC8tehOWp//+a36cTM4aFFKsLotu27LoTqHNCmL++DMoEjwKD3z1xOerQZR5G2FFZgTocp4N1x6NL3oss0cQjAUoQaoC3hpVVRX2adoNVad/ohzu9JzZUZyNvJUQFY4g35JJCCoRWPo6/Fjiy4qsHUH1ltmqFqc9C4uDL2ghQdIxe929pQ/XniCYRTIqEnR8v8B1dT68j6FKOmHX90ZlOQX6FXnOtWaK8gr1CAE/aroG3CVNCY2eq+TmqhkBX0SaOsucYA9M84So9e4igOR9HT3ZJwlDSeUndgIXx2GSXgP8j+X1tnf5+SWHOdVNeR6LMmsH08A7RLfQ== X-Forefront-Antispam-Report: CIP:192.88.168.50;CTRY:US;IPV:NLI;EFV:NLI;SFV:NSPM;SFS:(10019020)(6009001)(339900001)(199003)(189002)(229853001)(36756003)(104016003)(86362001)(106466001)(19580405001)(76176999)(19580395003)(46102003)(85426001)(50986999)(105606002)(50226001)(77096005)(47776003)(87936001)(62966003)(77156002)(5001770100001)(92566002)(48376002)(50466002)(107886002)(5001920100001)(5001960100002)(6806004)(189998001)(2201001)(2950100001)(4001430100001);DIR:OUT;SFP:1102;SCL:1;SRVR:BY1PR0301MB1303;H:tx30smr01.am.freescale.net;FPR:;SPF:Fail;MLV:sfv;A:1;MX:1;LANG:en; MIME-Version: 1.0 Content-Type: text/plain X-Microsoft-Exchange-Diagnostics: 1;BY1PR0301MB1303;2:5tJYG1PSzj0HUBHZVUGlC2IabGX0RWvUNCT8hEkn1RG/pYuZkRt/DpeXUX4yL1Q4;2:xY+3vyw75OX0WtmGSyU0vfTFF2BHOtrJRJNZ7UwoYDKJna/DIgKvRmcsYFiofKMvZkPwiEbSRP3AtKPhT8y0M1JI/EW0Vj+6/bATgIe3ctJZ+X99OcMnlfAoW3VJ37AqmDtDnahigY4KKozMwh6B+rB+T7gKR0qme7Id0N8GcMPESLllGjk5hxDOqpj9VoC+oJVevKuRqKocY8YlFbT1q7GilaeLTlvHHe1A/gbE4EM=;6:wdOZyGhL4mTTEj2p/ZUAul42omF6COcGMYW5ur/js5+TKKem8uDmvlet7iifm7fHkXzgEbCsevQS+qyN1+iMs1GqevnwcNwTwoc9EZ1PGqza2LKcuzoSb+0+nZPbqh8qjzdIfdZFKtpVrRdB9swTYfl7mpQ0bvii3uLGY8TA+ktVyddyW4TYv0rmUBuOzupvaT8xeuZL+suoW+rPnuRoTOa3r/Y8cE5FodUKUOPOwI1fkE7DntFLIKHza8vYWJ2nFJQstZMD97Qozw0KJtP2C+e0v42bWKeNr+6qGgXkPbUOED3fAtuNbPnd6dc1fN+XoC/9CImemvETQRcqU8qfaw== X-Microsoft-Antispam: UriScan:;BCL:0;PCL:0;RULEID:;SRVR:BY1PR0301MB1303; X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:; X-Exchange-Antispam-Report-CFA-Test: BCL:0;PCL:0;RULEID:(601004)(5005006)(520003)(3002001);SRVR:BY1PR0301MB1303;BCL:0;PCL:0;RULEID:;SRVR:BY1PR0301MB1303; X-Microsoft-Exchange-Diagnostics: 1;BY1PR0301MB1303;3:h5Cb4hWgSQYRToAJpqQNOjFgL0MRilVq8sVsTeIRXzM02ljq3dbkorutATXuo3eerJB6dQp5ove/fsAQvrdHd80CQ+e1a/FlfC0h5Gy0vU2/C8EQ3woZ2MOl9yDG6WG3PjTQSGRocv/r/CGxvyvbbBlifD5LIwkH4Cs7+lWVj2ldFNRMatN97JN77SUrd0xDLNIgYZZ6kWkyc+7Ej6qGQVQ0hjF22m2ck0aYT8Z6rwTfLgyYmnDsx1BYoRpaXqCu5de22Gqd6TPaVq3Q0TnyYHfXNT1dEtcAyzyeq7EP/N3X2NAu7MON7xMLtJrsuQtJ X-Forefront-PRVS: 06022AA85F X-Microsoft-Exchange-Diagnostics: 1;BY1PR0301MB1303;9:G/hI0xUgSEWNhyAmmlsXHGi50MRfxKDTfa7tPHeuLO6y1KhzRVWNhJof3tHQCaGmI4QYtnT3VXcDza99SiN+wZKKcWsaooDx3LBZb3I553KbZstAKEnBUA8ntqJHyYSxdUvQ2Bwz4Jb1lymW8BS83pEmZelvJFvgUOWQmbuseMdz2jxWM7zZllKr8Bb6oghGY8UMT5Nm1E0Aupd7ZS45RYFxOmHghL0Ajx3o8SR0stM8T8zKk6P4dFE2bLjPXFgZ/BxLh7huvy9J6RD+F/kC9oUqaOjWWyj2vC1uC8DvNPIYM4itv7BIExk1y19njZF/IIiRR3obSG1gj8NRhJvHJR9ARum7wFiOgLMcuhDYHciYiLbC118YagJvQWCOIaRLH60sV1XpuaJ24u14CEb4fTEVndRIjmgYIxbuu9cNhq3jn1LRNf6dNgFBDI6OACdQv+0tWdEUiOdDAuBfEVYjkC/IzyH4hO4pSaAs8zrQgLwalr5mbrButZBIAkcQWtlBj3v0pmp7xG/u17KEOjAGzZO3PfJLmkqVBm+FW5EGvRAmHcklXmfShfe7KSavwnDB6cDgd0YdaVyF+0C1x+DKwUwcfBGiaCvw58yiyLXJJ4FwC5pAs11iqfsjyc+JSz2Gt8bOtFgtEY+LV6eCbt09Ubbvi32sVQCG5nlLNLfbQw/UQeI/i1NWWfNM66eI7WQPDv/DufbIxEw2+kXkcIdT+cBNegnjhsHFWRkYLNvjJYhoD/9izPHEZzihBZWKn4YN1ci/MZKuuSd9DTLQcul0bCnSdEklZlKWy4rRWW8kQJY05IpTIFbuOkYx/wakHEu7+anV2EFPbze5yJIGdziNbqadKxs3pG/2LPGTvzHoRH/fQs8T3gPNbE/rtm74syvKCYVG6iICttBRzm258+YvDUUoYgbo4Y8sfAnMV3hSU1k= X-Microsoft-Exchange-Diagnostics: 1;BY1PR0301MB1303;3:XnsPGE7qgQTUfoLd0BxNxm13K7YRHjH0Iw3G3jiNWmzN9JdwybJAn6er4PUomai46j7lf6Sraz0q54ClA6aZWreGo0sVX8626zssHJqibEOkq8Kxd49la6YVT0GsC98q9u21Gmw/OlZwsKewa/+KNQ==;10:Y1NSthmdsx7+CRHUHIs4c1SBaoRetTs8e3/p/sAh8hp5rgzPvdVAEsSvOW/FQO8W1ARNX2unUAgWZ5Gy9uAnQqpPcT8Ih+5eJOx+lXv7OwE=;6:fhmgsRZA88DmGutHERNIVje3fYPs6LJCUy1rwNSVdsBJ+Rva+2Gcc8op2xzQt/HD X-OriginatorOrg: freescale.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 09 Jun 2015 22:08:50.5945 (UTC) X-MS-Exchange-CrossTenant-Id: 710a03f5-10f6-4d38-9ff4-a80b81da590d X-MS-Exchange-CrossTenant-OriginalAttributedTenantConnectingIp: TenantId=710a03f5-10f6-4d38-9ff4-a80b81da590d;Ip=[192.88.168.50];Helo=[tx30smr01.am.freescale.net] X-MS-Exchange-CrossTenant-FromEntityHeader: HybridOnPrem X-MS-Exchange-Transport-CrossTenantHeadersStamped: BY1PR0301MB1303 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 7090 Lines: 197 If the msi-parent property is not present in the fsl,qoriq-mc node of the device tree, the MC bus driver will assume that the GIC is not supported. This change is made in order to be able to use the MC bus driver in a KVM VM, without having GIC-ITS support in guests. Added function fsl_mc_interrupts_supported(), which can be called from DPAA2 object drivers. Signed-off-by: J. German Rivera Reviewed-by: Stuart Yoder --- drivers/staging/fsl-mc/bus/dprc-driver.c | 31 +++++++++++++++++++---------- drivers/staging/fsl-mc/bus/mc-allocator.c | 4 ++++ drivers/staging/fsl-mc/bus/mc-bus.c | 16 +++++++++++++++ drivers/staging/fsl-mc/include/mc-private.h | 4 ++++ drivers/staging/fsl-mc/include/mc.h | 2 ++ 5 files changed, 47 insertions(+), 10 deletions(-) diff --git a/drivers/staging/fsl-mc/bus/dprc-driver.c b/drivers/staging/fsl-mc/bus/dprc-driver.c index 6bd20c0..dc97681 100644 --- a/drivers/staging/fsl-mc/bus/dprc-driver.c +++ b/drivers/staging/fsl-mc/bus/dprc-driver.c @@ -323,6 +323,7 @@ static int dprc_scan_container(struct fsl_mc_device *mc_bus_dev) int error; unsigned int irq_count; struct fsl_mc_bus *mc_bus = to_fsl_mc_bus(mc_bus_dev); + struct fsl_mc *mc = dev_get_drvdata(fsl_mc_bus_type.dev_root->parent); dprc_init_all_resource_pools(mc_bus_dev); @@ -335,7 +336,7 @@ static int dprc_scan_container(struct fsl_mc_device *mc_bus_dev) if (error < 0) return error; - if (!mc_bus->irq_resources) { + if (mc->gic_supported && !mc_bus->irq_resources) { irq_count += FSL_MC_IRQ_POOL_MAX_EXTRA_IRQS; error = fsl_mc_populate_irq_pool(mc_bus, irq_count); if (error < 0) @@ -634,6 +635,7 @@ static int dprc_probe(struct fsl_mc_device *mc_dev) struct fsl_mc_bus *mc_bus = to_fsl_mc_bus(mc_dev); bool mc_io_created = false; bool dev_root_set = false; + struct fsl_mc *mc = dev_get_drvdata(fsl_mc_bus_type.dev_root->parent); if (WARN_ON(strcmp(mc_dev->obj_desc.type, "dprc") != 0)) return -EINVAL; @@ -686,19 +688,23 @@ static int dprc_probe(struct fsl_mc_device *mc_dev) if (error < 0) goto error_cleanup_open; - /* - * Configure interrupts for the DPRC object associated with this MC bus: - */ - error = dprc_setup_irqs(mc_dev); - if (error < 0) - goto error_cleanup_dprc_scan; + if (mc->gic_supported) { + /* + * Configure interrupts for the DPRC object associated with + * this MC bus: + */ + error = dprc_setup_irqs(mc_dev); + if (error < 0) + goto error_cleanup_dprc_scan; + } dev_info(&mc_dev->dev, "DPRC device bound to driver"); return 0; error_cleanup_dprc_scan: device_for_each_child(&mc_dev->dev, NULL, __fsl_mc_device_remove); - fsl_mc_cleanup_irq_pool(mc_bus); + if (mc->gic_supported) + fsl_mc_cleanup_irq_pool(mc_bus); error_cleanup_open: (void)dprc_close(mc_dev->mc_io, mc_dev->mc_handle); @@ -738,6 +744,7 @@ static int dprc_remove(struct fsl_mc_device *mc_dev) { int error; struct fsl_mc_bus *mc_bus = to_fsl_mc_bus(mc_dev); + struct fsl_mc *mc = dev_get_drvdata(fsl_mc_bus_type.dev_root->parent); if (WARN_ON(strcmp(mc_dev->obj_desc.type, "dprc") != 0)) return -EINVAL; @@ -747,13 +754,17 @@ static int dprc_remove(struct fsl_mc_device *mc_dev) if (WARN_ON(!mc_bus->irq_resources)) return -EINVAL; - dprc_teardown_irqs(mc_dev); + if (mc->gic_supported) + dprc_teardown_irqs(mc_dev); + device_for_each_child(&mc_dev->dev, NULL, __fsl_mc_device_remove); error = dprc_close(mc_dev->mc_io, mc_dev->mc_handle); if (error < 0) dev_err(&mc_dev->dev, "dprc_close() failed: %d\n", error); - fsl_mc_cleanup_irq_pool(mc_bus); + if (mc->gic_supported) + fsl_mc_cleanup_irq_pool(mc_bus); + dev_info(&mc_dev->dev, "DPRC device unbound from driver"); return 0; } diff --git a/drivers/staging/fsl-mc/bus/mc-allocator.c b/drivers/staging/fsl-mc/bus/mc-allocator.c index e445f79..3bdfefb 100644 --- a/drivers/staging/fsl-mc/bus/mc-allocator.c +++ b/drivers/staging/fsl-mc/bus/mc-allocator.c @@ -485,6 +485,10 @@ int __must_check fsl_mc_allocate_irqs(struct fsl_mc_device *mc_dev) struct fsl_mc_device_irq **irqs = NULL; struct fsl_mc_bus *mc_bus; struct fsl_mc_resource_pool *res_pool; + struct fsl_mc *mc = dev_get_drvdata(fsl_mc_bus_type.dev_root->parent); + + if (!mc->gic_supported) + return -ENOTSUPP; if (WARN_ON(mc_dev->irqs)) return -EINVAL; diff --git a/drivers/staging/fsl-mc/bus/mc-bus.c b/drivers/staging/fsl-mc/bus/mc-bus.c index e5ea3ea..36bfe68 100644 --- a/drivers/staging/fsl-mc/bus/mc-bus.c +++ b/drivers/staging/fsl-mc/bus/mc-bus.c @@ -287,6 +287,14 @@ void fsl_mc_driver_unregister(struct fsl_mc_driver *mc_driver) } EXPORT_SYMBOL_GPL(fsl_mc_driver_unregister); +bool fsl_mc_interrupts_supported(void) +{ + struct fsl_mc *mc = dev_get_drvdata(fsl_mc_bus_type.dev_root->parent); + + return mc->gic_supported; +} +EXPORT_SYMBOL_GPL(fsl_mc_interrupts_supported); + static int get_dprc_icid(struct fsl_mc_io *mc_io, int container_id, uint16_t *icid) { @@ -839,6 +847,14 @@ static int fsl_mc_bus_probe(struct platform_device *pdev) if (error < 0) return error; + error = create_mc_irq_domain(pdev, &mc->irq_domain); + if (error < 0) { + dev_warn(&pdev->dev, + "WARNING: MC bus driver will run without interrupt support\n"); + } else { + mc->gic_supported = true; + } + /* * Get physical address of MC portal for the root DPRC: */ diff --git a/drivers/staging/fsl-mc/include/mc-private.h b/drivers/staging/fsl-mc/include/mc-private.h index 8e02dc9..af7bd81 100644 --- a/drivers/staging/fsl-mc/include/mc-private.h +++ b/drivers/staging/fsl-mc/include/mc-private.h @@ -42,11 +42,15 @@ * struct fsl_mc - Private data of a "fsl,qoriq-mc" platform device * @root_mc_bus_dev: MC object device representing the root DPRC * @irq_domain: IRQ domain for the fsl-mc bus type + * @gic_supported: boolean flag that indicates if the GIC interrupt controller + * is supported. + * @num_translation_ranges: number of entries in addr_translation_ranges * @addr_translation_ranges: array of bus to system address translation ranges */ struct fsl_mc { struct fsl_mc_device *root_mc_bus_dev; struct irq_domain *irq_domain; + bool gic_supported; u8 num_translation_ranges; struct fsl_mc_addr_translation_range *translation_ranges; }; diff --git a/drivers/staging/fsl-mc/include/mc.h b/drivers/staging/fsl-mc/include/mc.h index 7fa2816..56b7b47 100644 --- a/drivers/staging/fsl-mc/include/mc.h +++ b/drivers/staging/fsl-mc/include/mc.h @@ -209,6 +209,8 @@ int __must_check __fsl_mc_driver_register(struct fsl_mc_driver *fsl_mc_driver, void fsl_mc_driver_unregister(struct fsl_mc_driver *driver); +bool fsl_mc_interrupts_supported(void); + int __must_check fsl_mc_portal_allocate(struct fsl_mc_device *mc_dev, uint16_t mc_io_flags, struct fsl_mc_io **new_mc_io); -- 2.3.3 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/