From mboxrd@z Thu Jan 1 00:00:00 1970 From: Stephen Warren Subject: Re: [PATCH v2 3/3] ARM: tegra: set CPU reset handler with firmware op Date: Fri, 14 Jun 2013 09:30:11 -0600 Message-ID: <51BB3703.8040203@wwwdotorg.org> References: <1371114745-24710-1-git-send-email-acourbot@nvidia.com> <1371114745-24710-4-git-send-email-acourbot@nvidia.com> <51BA1C3D.1010608@wwwdotorg.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 7bit Return-path: In-Reply-To: Sender: linux-tegra-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Alexandre Courbot Cc: Alexandre Courbot , Joseph Lo , Karan Jhavar , Varun Wadekar , Chris Johnson , Matthew Longnecker , Russell King - ARM Linux , Tomasz Figa , Dave Martin , Jassi Brar , "devicetree-discuss-uLR06cmDAlY/bJ5BZ2RsiQ@public.gmane.org" , "linux-tegra-u79uwXL29TY76Z2rM5mHXA@public.gmane.org" , Linux Kernel Mailing List , "linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org" List-Id: devicetree@vger.kernel.org On 06/14/2013 02:54 AM, Alexandre Courbot wrote: > On Fri, Jun 14, 2013 at 4:23 AM, Stephen Warren wrote: >> On 06/13/2013 03:12 AM, Alexandre Courbot wrote: >>> Use a firmware operation to set the CPU reset handler and only resort to >>> doing it ourselves if there is none defined. >>> >>> This supports the booting of secondary CPUs on devices using a TrustZone >>> secure monitor. >> >>> diff --git a/arch/arm/mach-tegra/reset.c b/arch/arm/mach-tegra/reset.c >> >>> + err = call_firmware_op(set_cpu_boot_addr, 0, reset_address); >>> + switch (err) { >>> + case -ENOSYS: >>> + tegra_cpu_reset_handler_set(reset_address); >>> + /* pass-through */ >> >> Rather than detecting -ENOSYS and falling back to the custom >> tegra_cpu_reset_handler_set(), does it make sense to plug in >> tegra_cpu_reset_handler_set as the firmware op when there is no secure >> firmware detected? That way, this code wouldn't need the special case; >> that would be isolated to firmware.c. > > Mmmm I admit I just followed what Exynos did without thinking much > about it. I don't see any reason why your suggestion wouldn't work, > but on second thought tegra_cpu_reset_handler_set() is not a firmware > operation - wouldn't it be unexpected (and maybe confusing) to have it > called through call_firmware_op()? I would see call_firmware_op() as an abstraction that performs certain operations, which in some cases are performed by firmware. If the operation doesn't actually need to call into firmware in some situations, that seems fine to me. But you're right, others may object. Perhaps get a ruling from whoever created firmware_ops and/or some main ARM maintainers.