From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932236AbdDFPzn (ORCPT ); Thu, 6 Apr 2017 11:55:43 -0400 Received: from foss.arm.com ([217.140.101.70]:45006 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751283AbdDFPzg (ORCPT ); Thu, 6 Apr 2017 11:55:36 -0400 Date: Thu, 6 Apr 2017 16:55:11 +0100 From: Mark Rutland To: Julien Grall Cc: Daniel Kiper , Juergen Gross , Boris Ostrovsky , sstabellini@kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, xen-devel@lists.xen.org, Matt Fleming , Ard Biesheuvel , linux-efi@vger.kernel.org Subject: Re: [PATCH] arm64: xen: Implement EFI reset_system callback Message-ID: <20170406155453.GA3966@leverpostej> References: <20170405181417.15985-1-julien.grall@arm.com> <3f6f5853-cd08-8afc-f71a-b0c1545c7564@arm.com> <20170406142710.GE4372@olila.local.net-space.pl> <20170406152040.GH4372@olila.local.net-space.pl> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.21 (2010-09-15) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org [Adding the EFI maintainers] Tl;DR: Xen's EFI wrappery doesn't implement reset_system, so when invoked on arm64 we get a NULL dereference. On Thu, Apr 06, 2017 at 04:39:13PM +0100, Julien Grall wrote: > On 06/04/17 16:20, Daniel Kiper wrote: > >On Thu, Apr 06, 2017 at 04:38:24PM +0200, Juergen Gross wrote: > >>On 06/04/17 16:27, Daniel Kiper wrote: > >>>On Thu, Apr 06, 2017 at 09:32:32AM +0100, Julien Grall wrote: > >>>>Hi Juergen, > >>>> > >>>>On 06/04/17 07:23, Juergen Gross wrote: > >>>>>On 05/04/17 21:49, Boris Ostrovsky wrote: > >>>>>>On 04/05/2017 02:14 PM, Julien Grall wrote: > >>>>>>>The x86 code has theoritically a similar issue, altought EFI does not > >>>>>>>seem to be the preferred method. I have left it unimplemented on x86 and > >>>>>>>CCed Linux Xen x86 maintainers to know their view here. > >>>>>> > >>>>>>(+Daniel) > >>>>>> > >>>>>>This could be a problem for x86 as well, at least theoretically. > >>>>>>xen_machine_power_off() may call pm_power_off(), which is efi.reset_system. > >>>>>> > >>>>>>So I think we should have a similar routine there. > >>>>> > >>>>>+1 > >>>>> > >>>>>I don't see any problem with such a routine added, in contrast to > >>>>>potential "reboots" instead of power off without it. > >>>>> > >>>>>So I think this dummy xen_efi_reset_system() should be added to > >>>>>drivers/xen/efi.c instead. > >>>> > >>>>I will resend the patch during day with xen_efi_reset_system moved > >>>>to common code and implement the x86 counterpart (thought, I will > >>>>not be able to test it). > >>> > >>>I think that this is ARM specific issue. On x86 machine_restart() calls > >>>xen_restart(). Hence, everything works. So, I think that it should be > >>>fixed only for ARM. Anyway, please CC me when you send a patch. > >> > >>What about xen_machine_power_off() (as stated in Boris' mail)? > > > >Guys what do you think about that: > > > >--- a/drivers/firmware/efi/reboot.c > >+++ b/drivers/firmware/efi/reboot.c > >@@ -55,7 +55,7 @@ static void efi_power_off(void) > > > > static int __init efi_shutdown_init(void) > > { > >- if (!efi_enabled(EFI_RUNTIME_SERVICES)) > >+ if (!efi_enabled(EFI_RUNTIME_SERVICES) || efi_enabled(EFI_PARAVIRT)) > > return -ENODEV; > > > > if (efi_poweroff_required()) > > > > > >Julien, for ARM64 please take a look at arch/arm64/kernel/efi.c:efi_poweroff_required(void). > > > >I hope that tweaks for both files should solve our problem. > > This sounds good for power off (I haven't tried to power off DOM0 > yet). Please, let's keep the Xen knowledge constrained to the Xen EFI wrapper, rather than spreading it further. IMO, given reset_system is a *mandatory* function, the Xen wrapper should provide an implementation. I don't see why you can't implement a wrapper that calls the usual Xen poweroff/reset functions. Thanks, Mark. From mboxrd@z Thu Jan 1 00:00:00 1970 From: Mark Rutland Subject: Re: [PATCH] arm64: xen: Implement EFI reset_system callback Date: Thu, 6 Apr 2017 16:55:11 +0100 Message-ID: <20170406155453.GA3966@leverpostej> References: <20170405181417.15985-1-julien.grall@arm.com> <3f6f5853-cd08-8afc-f71a-b0c1545c7564@arm.com> <20170406142710.GE4372@olila.local.net-space.pl> <20170406152040.GH4372@olila.local.net-space.pl> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Return-path: Content-Disposition: inline In-Reply-To: Sender: linux-efi-owner-u79uwXL29TY76Z2rM5mHXA@public.gmane.org To: Julien Grall Cc: Daniel Kiper , Juergen Gross , Boris Ostrovsky , sstabellini-DgEjT+Ai2ygdnm+yROfE0A@public.gmane.org, linux-kernel-u79uwXL29TY76Z2rM5mHXA@public.gmane.org, linux-arm-kernel-IAPFreCvJWM7uuMidbF8XUB+6BGkLq7r@public.gmane.org, xen-devel-GuqFBffKawuEi8DpZVb4nw@public.gmane.org, Matt Fleming , Ard Biesheuvel , linux-efi-u79uwXL29TY76Z2rM5mHXA@public.gmane.org List-Id: linux-efi@vger.kernel.org [Adding the EFI maintainers] Tl;DR: Xen's EFI wrappery doesn't implement reset_system, so when invoked on arm64 we get a NULL dereference. On Thu, Apr 06, 2017 at 04:39:13PM +0100, Julien Grall wrote: > On 06/04/17 16:20, Daniel Kiper wrote: > >On Thu, Apr 06, 2017 at 04:38:24PM +0200, Juergen Gross wrote: > >>On 06/04/17 16:27, Daniel Kiper wrote: > >>>On Thu, Apr 06, 2017 at 09:32:32AM +0100, Julien Grall wrote: > >>>>Hi Juergen, > >>>> > >>>>On 06/04/17 07:23, Juergen Gross wrote: > >>>>>On 05/04/17 21:49, Boris Ostrovsky wrote: > >>>>>>On 04/05/2017 02:14 PM, Julien Grall wrote: > >>>>>>>The x86 code has theoritically a similar issue, altought EFI does not > >>>>>>>seem to be the preferred method. I have left it unimplemented on x86 and > >>>>>>>CCed Linux Xen x86 maintainers to know their view here. > >>>>>> > >>>>>>(+Daniel) > >>>>>> > >>>>>>This could be a problem for x86 as well, at least theoretically. > >>>>>>xen_machine_power_off() may call pm_power_off(), which is efi.reset_system. > >>>>>> > >>>>>>So I think we should have a similar routine there. > >>>>> > >>>>>+1 > >>>>> > >>>>>I don't see any problem with such a routine added, in contrast to > >>>>>potential "reboots" instead of power off without it. > >>>>> > >>>>>So I think this dummy xen_efi_reset_system() should be added to > >>>>>drivers/xen/efi.c instead. > >>>> > >>>>I will resend the patch during day with xen_efi_reset_system moved > >>>>to common code and implement the x86 counterpart (thought, I will > >>>>not be able to test it). > >>> > >>>I think that this is ARM specific issue. On x86 machine_restart() calls > >>>xen_restart(). Hence, everything works. So, I think that it should be > >>>fixed only for ARM. Anyway, please CC me when you send a patch. > >> > >>What about xen_machine_power_off() (as stated in Boris' mail)? > > > >Guys what do you think about that: > > > >--- a/drivers/firmware/efi/reboot.c > >+++ b/drivers/firmware/efi/reboot.c > >@@ -55,7 +55,7 @@ static void efi_power_off(void) > > > > static int __init efi_shutdown_init(void) > > { > >- if (!efi_enabled(EFI_RUNTIME_SERVICES)) > >+ if (!efi_enabled(EFI_RUNTIME_SERVICES) || efi_enabled(EFI_PARAVIRT)) > > return -ENODEV; > > > > if (efi_poweroff_required()) > > > > > >Julien, for ARM64 please take a look at arch/arm64/kernel/efi.c:efi_poweroff_required(void). > > > >I hope that tweaks for both files should solve our problem. > > This sounds good for power off (I haven't tried to power off DOM0 > yet). Please, let's keep the Xen knowledge constrained to the Xen EFI wrapper, rather than spreading it further. IMO, given reset_system is a *mandatory* function, the Xen wrapper should provide an implementation. I don't see why you can't implement a wrapper that calls the usual Xen poweroff/reset functions. Thanks, Mark. From mboxrd@z Thu Jan 1 00:00:00 1970 From: mark.rutland@arm.com (Mark Rutland) Date: Thu, 6 Apr 2017 16:55:11 +0100 Subject: [PATCH] arm64: xen: Implement EFI reset_system callback In-Reply-To: References: <20170405181417.15985-1-julien.grall@arm.com> <3f6f5853-cd08-8afc-f71a-b0c1545c7564@arm.com> <20170406142710.GE4372@olila.local.net-space.pl> <20170406152040.GH4372@olila.local.net-space.pl> Message-ID: <20170406155453.GA3966@leverpostej> To: linux-arm-kernel@lists.infradead.org List-Id: linux-arm-kernel.lists.infradead.org [Adding the EFI maintainers] Tl;DR: Xen's EFI wrappery doesn't implement reset_system, so when invoked on arm64 we get a NULL dereference. On Thu, Apr 06, 2017 at 04:39:13PM +0100, Julien Grall wrote: > On 06/04/17 16:20, Daniel Kiper wrote: > >On Thu, Apr 06, 2017 at 04:38:24PM +0200, Juergen Gross wrote: > >>On 06/04/17 16:27, Daniel Kiper wrote: > >>>On Thu, Apr 06, 2017 at 09:32:32AM +0100, Julien Grall wrote: > >>>>Hi Juergen, > >>>> > >>>>On 06/04/17 07:23, Juergen Gross wrote: > >>>>>On 05/04/17 21:49, Boris Ostrovsky wrote: > >>>>>>On 04/05/2017 02:14 PM, Julien Grall wrote: > >>>>>>>The x86 code has theoritically a similar issue, altought EFI does not > >>>>>>>seem to be the preferred method. I have left it unimplemented on x86 and > >>>>>>>CCed Linux Xen x86 maintainers to know their view here. > >>>>>> > >>>>>>(+Daniel) > >>>>>> > >>>>>>This could be a problem for x86 as well, at least theoretically. > >>>>>>xen_machine_power_off() may call pm_power_off(), which is efi.reset_system. > >>>>>> > >>>>>>So I think we should have a similar routine there. > >>>>> > >>>>>+1 > >>>>> > >>>>>I don't see any problem with such a routine added, in contrast to > >>>>>potential "reboots" instead of power off without it. > >>>>> > >>>>>So I think this dummy xen_efi_reset_system() should be added to > >>>>>drivers/xen/efi.c instead. > >>>> > >>>>I will resend the patch during day with xen_efi_reset_system moved > >>>>to common code and implement the x86 counterpart (thought, I will > >>>>not be able to test it). > >>> > >>>I think that this is ARM specific issue. On x86 machine_restart() calls > >>>xen_restart(). Hence, everything works. So, I think that it should be > >>>fixed only for ARM. Anyway, please CC me when you send a patch. > >> > >>What about xen_machine_power_off() (as stated in Boris' mail)? > > > >Guys what do you think about that: > > > >--- a/drivers/firmware/efi/reboot.c > >+++ b/drivers/firmware/efi/reboot.c > >@@ -55,7 +55,7 @@ static void efi_power_off(void) > > > > static int __init efi_shutdown_init(void) > > { > >- if (!efi_enabled(EFI_RUNTIME_SERVICES)) > >+ if (!efi_enabled(EFI_RUNTIME_SERVICES) || efi_enabled(EFI_PARAVIRT)) > > return -ENODEV; > > > > if (efi_poweroff_required()) > > > > > >Julien, for ARM64 please take a look at arch/arm64/kernel/efi.c:efi_poweroff_required(void). > > > >I hope that tweaks for both files should solve our problem. > > This sounds good for power off (I haven't tried to power off DOM0 > yet). Please, let's keep the Xen knowledge constrained to the Xen EFI wrapper, rather than spreading it further. IMO, given reset_system is a *mandatory* function, the Xen wrapper should provide an implementation. I don't see why you can't implement a wrapper that calls the usual Xen poweroff/reset functions. Thanks, Mark.