From patchwork Mon Mar 31 10:46:03 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Anup Patel X-Patchwork-Id: 3913301 Return-Path: X-Original-To: patchwork-linux-arm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 546039F2B6 for ; Mon, 31 Mar 2014 10:48:37 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 6D6D420212 for ; Mon, 31 Mar 2014 10:48:36 +0000 (UTC) Received: from casper.infradead.org (casper.infradead.org [85.118.1.10]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 574B6201F5 for ; Mon, 31 Mar 2014 10:48:34 +0000 (UTC) Received: from merlin.infradead.org ([2001:4978:20e::2]) by casper.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WUZkm-0005lf-6t; Mon, 31 Mar 2014 10:47:44 +0000 Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1WUZkb-0004fx-UC; Mon, 31 Mar 2014 10:47:33 +0000 Received: from mail-pa0-f54.google.com ([209.85.220.54]) by merlin.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1WUZkH-0004b7-G8 for linux-arm-kernel@lists.infradead.org; Mon, 31 Mar 2014 10:47:14 +0000 Received: by mail-pa0-f54.google.com with SMTP id lf10so7989011pab.41 for ; Mon, 31 Mar 2014 03:46:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=gGWccLSyTydQ3X13+U/ByRO0vzx1pLznBEPPy6pNKZg=; b=mdIw5p9Rc3S5llitlRNc3jYeoLhOZOP8Y2Ki/WbDUP2lIAFjiFhE3Q0JY/5tgIISq1 sMXr7Enjw4gsfMspYO0tYL4DH7MdPuCk45B1tqkV4qUT5PRCD5cLRm7rC5wxCiOXy3Sc EyVjJyQHFecM3u2vjCb47qgEgbhu5O7uerbR3xYBG4ioE3tQ9em/DH8oEhqNU4uHEEbd uvdo7jzWQa1An9sce+FJSXn2Mk6GOzpRn5MEzUDFF3j9/88dlACrqjL3YHgz/YMfDC0l kQ4IJJWYbZG0cBwkm0B4tWGb938SlQpdVRIRxPqzR56t+tIBHVEgcfPX/qMlSaWS3vCa mL9Q== X-Gm-Message-State: ALoCoQkc2GoHdJP/bQG2v5Q5OwnkA6yk21uJkioAAHeUj4va0W1PipHdjl8lyXNA0oAQO4fX+lWq X-Received: by 10.66.193.161 with SMTP id hp1mr24456915pac.20.1396262809308; Mon, 31 Mar 2014 03:46:49 -0700 (PDT) Received: from pnqlab006.amcc.com ([182.73.239.130]) by mx.google.com with ESMTPSA id oa3sm42582874pbb.15.2014.03.31.03.46.45 for (version=TLSv1.1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Mon, 31 Mar 2014 03:46:48 -0700 (PDT) From: Anup Patel To: kvmarm@lists.cs.columbia.edu Subject: [PATCH v6 02/12] ARM/ARM64: KVM: Add common header for PSCI related defines Date: Mon, 31 Mar 2014 16:16:03 +0530 Message-Id: <1396262773-7723-3-git-send-email-anup.patel@linaro.org> X-Mailer: git-send-email 1.7.9.5 In-Reply-To: <1396262773-7723-1-git-send-email-anup.patel@linaro.org> References: <1396262773-7723-1-git-send-email-anup.patel@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20140331_064713_649663_13904567 X-CRM114-Status: GOOD ( 10.40 ) X-Spam-Score: -2.6 (--) Cc: Mark Rutland , Rob Herring , linaro-kernel@lists.linaro.org, Anup Patel , Marc Zyngier , patches@apm.com, linux-arm-kernel@lists.infradead.org, Christoffer Dall , Pranavkumar Sawargaonkar X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Spam-Status: No, score=-4.8 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP We need a common place to share PSCI related defines among ARM kernel, ARM64 kernel, KVM ARM/ARM64 PSCI emulation, and user space. We introduce uapi/linux/psci.h for this purpose. This newly added header will be first used by KVM ARM/ARM64 in-kernel PSCI emulation and user space (i.e. QEMU or KVMTOOL). Signed-off-by: Anup Patel Signed-off-by: Pranavkumar Sawargaonkar --- include/uapi/linux/Kbuild | 1 + include/uapi/linux/psci.h | 55 +++++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 56 insertions(+) create mode 100644 include/uapi/linux/psci.h diff --git a/include/uapi/linux/Kbuild b/include/uapi/linux/Kbuild index 6929571..24e9033 100644 --- a/include/uapi/linux/Kbuild +++ b/include/uapi/linux/Kbuild @@ -317,6 +317,7 @@ header-y += ppp-ioctl.h header-y += ppp_defs.h header-y += pps.h header-y += prctl.h +header-y += psci.h header-y += ptp_clock.h header-y += ptrace.h header-y += qnx4_fs.h diff --git a/include/uapi/linux/psci.h b/include/uapi/linux/psci.h new file mode 100644 index 0000000..41f727e --- /dev/null +++ b/include/uapi/linux/psci.h @@ -0,0 +1,55 @@ +/* + * ARM Power State and Coordination Interface (PSCI) header + * + * This header holds common PSCI defines and macros shared by: + * ARM kernel, ARM64 kernel, KVM ARM/ARM64 and user space. + * + * Copyright (C) 2014 Anup Patel + */ + +#ifndef _UAPI_LINUX_PSCI_H +#define _UAPI_LINUX_PSCI_H + +/* PSCI v0.1 interface */ +#define PSCI_FN(base, n) ((base) + (n)) + +#define PSCI_FN_CPU_SUSPEND(base) PSCI_FN(base, 0) +#define PSCI_FN_CPU_OFF(base) PSCI_FN(base, 1) +#define PSCI_FN_CPU_ON(base) PSCI_FN(base, 2) +#define PSCI_FN_MIGRATE(base) PSCI_FN(base, 3) + +/* PSCI v0.2 interface */ +#define PSCI_0_2_FN_BASE 0x84000000 +#define PSCI_0_2_FN(n) (PSCI_0_2_FN_BASE + (n)) +#define PSCI_0_2_FN64_BASE 0xC4000000 +#define PSCI_0_2_FN64(n) (PSCI_0_2_FN64_BASE + (n)) + +#define PSCI_0_2_FN_PSCI_VERSION PSCI_0_2_FN(0) +#define PSCI_0_2_FN_CPU_SUSPEND PSCI_0_2_FN(1) +#define PSCI_0_2_FN_CPU_OFF PSCI_0_2_FN(2) +#define PSCI_0_2_FN_CPU_ON PSCI_0_2_FN(3) +#define PSCI_0_2_FN_AFFINITY_INFO PSCI_0_2_FN(4) +#define PSCI_0_2_FN_MIGRATE PSCI_0_2_FN(5) +#define PSCI_0_2_FN_MIGRATE_INFO_TYPE PSCI_0_2_FN(6) +#define PSCI_0_2_FN_MIGRATE_INFO_UP_CPU PSCI_0_2_FN(7) +#define PSCI_0_2_FN_SYSTEM_OFF PSCI_0_2_FN(8) +#define PSCI_0_2_FN_SYSTEM_RESET PSCI_0_2_FN(9) + +#define PSCI_0_2_FN64_CPU_SUSPEND PSCI_0_2_FN64(1) +#define PSCI_0_2_FN64_CPU_ON PSCI_0_2_FN64(3) +#define PSCI_0_2_FN64_AFFINITY_INFO PSCI_0_2_FN64(4) +#define PSCI_0_2_FN64_MIGRATE PSCI_0_2_FN64(5) +#define PSCI_0_2_FN64_MIGRATE_INFO_UP_CPU PSCI_0_2_FN64(7) + +/* PSCI return values */ +#define PSCI_RET_SUCCESS 0 +#define PSCI_RET_NOT_SUPPORTED ((unsigned long)-1) +#define PSCI_RET_INVALID_PARAMS ((unsigned long)-2) +#define PSCI_RET_DENIED ((unsigned long)-3) +#define PSCI_RET_ALREADY_ON ((unsigned long)-4) +#define PSCI_RET_ON_PENDING ((unsigned long)-5) +#define PSCI_RET_INTERNAL_FAILURE ((unsigned long)-6) +#define PSCI_RET_NOT_PRESENT ((unsigned long)-7) +#define PSCI_RET_DISABLED ((unsigned long)-8) + +#endif /* _UAPI_LINUX_PSCI_H */