Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752081AbdDDBsm (ORCPT ); Mon, 3 Apr 2017 21:48:42 -0400 Received: from mail-pg0-f68.google.com ([74.125.83.68]:34293 "EHLO mail-pg0-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751536AbdDDBsk (ORCPT ); Mon, 3 Apr 2017 21:48:40 -0400 From: Daniel Axtens To: Madhavan Srinivasan , mpe@ellerman.id.au Cc: linux-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, ego@linux.vnet.ibm.com, bsingharora@gmail.com, benh@kernel.crashing.org, paulus@samba.org, anton@samba.org, sukadev@linux.vnet.ibm.com, mikey@neuling.org, stewart@linux.vnet.ibm.com, eranian@google.com, Hemant Kumar , Anju T Sudhakar , Madhavan Srinivasan Subject: Re: [PATCH v6 02/11] powerpc/powernv: Autoload IMC device driver module In-Reply-To: <1491231308-15282-3-git-send-email-maddy@linux.vnet.ibm.com> References: <1491231308-15282-1-git-send-email-maddy@linux.vnet.ibm.com> <1491231308-15282-3-git-send-email-maddy@linux.vnet.ibm.com> User-Agent: Notmuch/0.22.1 (http://notmuchmail.org) Emacs/24.5.1 (x86_64-pc-linux-gnu) Date: Tue, 04 Apr 2017 11:48:36 +1000 Message-ID: <87inmlkknf.fsf@possimpible.ozlabs.ibm.com> MIME-Version: 1.0 Content-Type: text/plain Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2300 Lines: 86 Hi, > + do { > + pages = PAGE_SIZE * i; > + pcni->vbase[i++] = (u64)phys_to_virt(pcni->pbase + > + pages); > + } while (i < (pcni->size / PAGE_SIZE)); I also just noticed that there's no check here against IMC_NEST_MAX_PAGES: should that be inserted? (If for no other reason than to stop every static analysis tool complaining!) Daniel > + } > + > + return 0; > +err: > + return -ENODEV; > +} > + > +static const struct of_device_id opal_imc_match[] = { > + { .compatible = IMC_DTB_COMPAT }, > + {}, > +}; > + > +static struct platform_driver opal_imc_driver = { > + .driver = { > + .name = "opal-imc-counters", > + .of_match_table = opal_imc_match, > + }, > + .probe = opal_imc_counters_probe, > +}; > + > +MODULE_DEVICE_TABLE(of, opal_imc_match); > +module_platform_driver(opal_imc_driver); > +MODULE_DESCRIPTION("PowerNV OPAL IMC driver"); > +MODULE_LICENSE("GPL"); > diff --git a/arch/powerpc/platforms/powernv/opal.c b/arch/powerpc/platforms/powernv/opal.c > index e0f856bfbfe8..85ea1296f030 100644 > --- a/arch/powerpc/platforms/powernv/opal.c > +++ b/arch/powerpc/platforms/powernv/opal.c > @@ -14,6 +14,7 @@ > #include > #include > #include > +#include > #include > #include > #include > @@ -30,6 +31,7 @@ > #include > #include > #include > +#include > > #include "powernv.h" > > @@ -631,6 +633,15 @@ static void opal_pdev_init(const char *compatible) > of_platform_device_create(np, NULL, NULL); > } > > +static void opal_imc_init_dev(void) > +{ > + struct device_node *np; > + > + np = of_find_compatible_node(NULL, NULL, IMC_DTB_COMPAT); > + if (np) > + of_platform_device_create(np, NULL, NULL); > +} > + > static int kopald(void *unused) > { > unsigned long timeout = msecs_to_jiffies(opal_heartbeat) + 1; > @@ -704,6 +715,9 @@ static int __init opal_init(void) > /* Setup a heatbeat thread if requested by OPAL */ > opal_init_heartbeat(); > > + /* Detect IMC pmu counters support and create PMUs */ > + opal_imc_init_dev(); > + > /* Create leds platform devices */ > leds = of_find_node_by_path("/ibm,opal/leds"); > if (leds) { > -- > 2.7.4