From patchwork Thu Jan 24 11:16:31 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexandru Elisei X-Patchwork-Id: 10778753 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 3706213B5 for ; Thu, 24 Jan 2019 11:17:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 271892E9D4 for ; Thu, 24 Jan 2019 11:17:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 1B60A2EB51; Thu, 24 Jan 2019 11:17:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BF6C32E9D4 for ; Thu, 24 Jan 2019 11:17:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727698AbfAXLRE (ORCPT ); Thu, 24 Jan 2019 06:17:04 -0500 Received: from foss.arm.com ([217.140.101.70]:54794 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727661AbfAXLRE (ORCPT ); Thu, 24 Jan 2019 06:17:04 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 3B1E11650; Thu, 24 Jan 2019 03:17:04 -0800 (PST) Received: from login12.euhpc.arm.com (login12.euhpc.arm.com [10.6.27.168]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 2C2693F237; Thu, 24 Jan 2019 03:17:03 -0800 (PST) From: Alexandru Elisei To: kvm@vger.kernel.org Cc: drjones@redhat.com, kvmarm@lists.cs.columbia.edu, andre.przywara@arm.com, vladimir.murzin@arm.com Subject: [kvm-unit-tests PATCH 4/7] lib: arm: Implement PSCI SYSTEM_OFF in psci_system_off() Date: Thu, 24 Jan 2019 11:16:31 +0000 Message-Id: <20190124111634.4727-5-alexandru.elisei@arm.com> X-Mailer: git-send-email 2.17.0 In-Reply-To: <20190124111634.4727-1-alexandru.elisei@arm.com> References: <20190124111634.4727-1-alexandru.elisei@arm.com> Sender: kvm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: kvm@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP A new function psci_system_off() is added which implements the PSCI SYSTEM_OFF function. A call causes the hypervisor to terminate the virtual machine. Consumers for the function will be added in a later patch. Signed-off-by: Alexandru Elisei --- lib/arm/asm/psci.h | 1 + lib/arm/psci.c | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/lib/arm/asm/psci.h b/lib/arm/asm/psci.h index ed51708fd265..93409996349a 100644 --- a/lib/arm/asm/psci.h +++ b/lib/arm/asm/psci.h @@ -9,5 +9,6 @@ extern int psci_cpu_on(unsigned long cpuid, unsigned long entry_point); extern void psci_sys_reset(void); extern int cpu_psci_cpu_boot(unsigned int cpu); extern void cpu_psci_cpu_die(void); +extern void psci_system_off(void); #endif /* _ASMARM_PSCI_H_ */ diff --git a/lib/arm/psci.c b/lib/arm/psci.c index 119f74e57e91..d8dc428e8e8b 100644 --- a/lib/arm/psci.c +++ b/lib/arm/psci.c @@ -48,6 +48,12 @@ void cpu_psci_cpu_die(void) printf("CPU%d unable to power off (error = %d)\n", smp_processor_id(), err); } +void psci_system_off(void) +{ + int err = psci_invoke(PSCI_0_2_FN_SYSTEM_OFF, 0, 0, 0); + printf("CPU%d unable to do system off (error = %d)\n", smp_processor_id(), err); +} + void psci_sys_reset(void) { psci_invoke(PSCI_0_2_FN_SYSTEM_RESET, 0, 0, 0);