From: Claudio Carvalho <cclaudio@linux•ibm.com>
To: Paul Mackerras <paulus@ozlabs•org>,
Michael Ellerman <mpe@ellerman•id.au>,
kvm-ppc@vger•kernel.org, linuxppc-dev@ozlabs•org
Cc: Madhavan Srinivasan <maddy@linux•vnet.ibm.com>,
Michael Anderson <andmike@linux•ibm.com>,
Ram Pai <linuxram@us•ibm.com>,
Bharata B Rao <bharata@linux•ibm.com>,
Sukadev Bhattiprolu <sukadev@linux•vnet.ibm.com>,
Thiago Jung Bauermann <bauerman@linux•ibm.com>,
Anshuman Khandual <khandual@linux•vnet.ibm.com>
Subject: [RFC PATCH v2 03/10] powerpc: Introduce FW_FEATURE_ULTRAVISOR
Date: Sat, 18 May 2019 11:25:17 -0300 [thread overview]
Message-ID: <20190518142524.28528-4-cclaudio@linux.ibm.com> (raw)
In-Reply-To: <20190518142524.28528-1-cclaudio@linux.ibm.com>
This feature tells if the ultravisor firmware is available to handle
ucalls.
Signed-off-by: Claudio Carvalho <cclaudio@linux•ibm.com>
[Device node name to "ibm,ultravisor"]
Signed-off-by: Michael Anderson <andmike@linux•ibm.com>
---
arch/powerpc/include/asm/firmware.h | 5 +++--
arch/powerpc/include/asm/ultravisor.h | 15 +++++++++++++++
arch/powerpc/kernel/Makefile | 1 +
arch/powerpc/kernel/prom.c | 6 ++++++
arch/powerpc/kernel/ultravisor.c | 26 ++++++++++++++++++++++++++
5 files changed, 51 insertions(+), 2 deletions(-)
create mode 100644 arch/powerpc/include/asm/ultravisor.h
create mode 100644 arch/powerpc/kernel/ultravisor.c
diff --git a/arch/powerpc/include/asm/firmware.h b/arch/powerpc/include/asm/firmware.h
index 00bc42d95679..43b48c4d3ca9 100644
--- a/arch/powerpc/include/asm/firmware.h
+++ b/arch/powerpc/include/asm/firmware.h
@@ -54,6 +54,7 @@
#define FW_FEATURE_DRC_INFO ASM_CONST(0x0000000800000000)
#define FW_FEATURE_BLOCK_REMOVE ASM_CONST(0x0000001000000000)
#define FW_FEATURE_PAPR_SCM ASM_CONST(0x0000002000000000)
+#define FW_FEATURE_ULTRAVISOR ASM_CONST(0x0000004000000000)
#ifndef __ASSEMBLY__
@@ -72,9 +73,9 @@ enum {
FW_FEATURE_TYPE1_AFFINITY | FW_FEATURE_PRRN |
FW_FEATURE_HPT_RESIZE | FW_FEATURE_DRMEM_V2 |
FW_FEATURE_DRC_INFO | FW_FEATURE_BLOCK_REMOVE |
- FW_FEATURE_PAPR_SCM,
+ FW_FEATURE_PAPR_SCM | FW_FEATURE_ULTRAVISOR,
FW_FEATURE_PSERIES_ALWAYS = 0,
- FW_FEATURE_POWERNV_POSSIBLE = FW_FEATURE_OPAL,
+ FW_FEATURE_POWERNV_POSSIBLE = FW_FEATURE_OPAL | FW_FEATURE_ULTRAVISOR,
FW_FEATURE_POWERNV_ALWAYS = 0,
FW_FEATURE_PS3_POSSIBLE = FW_FEATURE_LPAR | FW_FEATURE_PS3_LV1,
FW_FEATURE_PS3_ALWAYS = FW_FEATURE_LPAR | FW_FEATURE_PS3_LV1,
diff --git a/arch/powerpc/include/asm/ultravisor.h b/arch/powerpc/include/asm/ultravisor.h
new file mode 100644
index 000000000000..e5009b0d84ea
--- /dev/null
+++ b/arch/powerpc/include/asm/ultravisor.h
@@ -0,0 +1,15 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Ultravisor definitions
+ *
+ * Copyright 2019, IBM Corporation.
+ *
+ */
+#ifndef _ASM_POWERPC_ULTRAVISOR_H
+#define _ASM_POWERPC_ULTRAVISOR_H
+
+/* Internal functions */
+extern int early_init_dt_scan_ultravisor(unsigned long node, const char *uname,
+ int depth, void *data);
+
+#endif /* _ASM_POWERPC_ULTRAVISOR_H */
diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile
index 0ea6c4aa3a20..c8ca219e54bf 100644
--- a/arch/powerpc/kernel/Makefile
+++ b/arch/powerpc/kernel/Makefile
@@ -154,6 +154,7 @@ endif
obj-$(CONFIG_EPAPR_PARAVIRT) += epapr_paravirt.o epapr_hcalls.o
obj-$(CONFIG_KVM_GUEST) += kvm.o kvm_emul.o
+obj-$(CONFIG_PPC_UV) += ultravisor.o
# Disable GCOV, KCOV & sanitizers in odd or sensitive code
GCOV_PROFILE_prom_init.o := n
diff --git a/arch/powerpc/kernel/prom.c b/arch/powerpc/kernel/prom.c
index 4221527b082f..8a9a8a319959 100644
--- a/arch/powerpc/kernel/prom.c
+++ b/arch/powerpc/kernel/prom.c
@@ -59,6 +59,7 @@
#include <asm/firmware.h>
#include <asm/dt_cpu_ftrs.h>
#include <asm/drmem.h>
+#include <asm/ultravisor.h>
#include <mm/mmu_decl.h>
@@ -713,6 +714,11 @@ void __init early_init_devtree(void *params)
of_scan_flat_dt(early_init_dt_scan_fw_dump, NULL);
#endif
+#if defined(CONFIG_PPC_UV)
+ /* Scan tree for ultravisor feature */
+ of_scan_flat_dt(early_init_dt_scan_ultravisor, NULL);
+#endif
+
/* Retrieve various informations from the /chosen node of the
* device-tree, including the platform type, initrd location and
* size, TCE reserve, and more ...
diff --git a/arch/powerpc/kernel/ultravisor.c b/arch/powerpc/kernel/ultravisor.c
new file mode 100644
index 000000000000..ac23835bdf5a
--- /dev/null
+++ b/arch/powerpc/kernel/ultravisor.c
@@ -0,0 +1,26 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Ultravisor high level interfaces
+ *
+ * Copyright 2019, IBM Corporation.
+ *
+ */
+#include <linux/init.h>
+#include <linux/printk.h>
+#include <linux/string.h>
+
+#include <asm/ultravisor.h>
+#include <asm/firmware.h>
+
+int __init early_init_dt_scan_ultravisor(unsigned long node, const char *uname,
+ int depth, void *data)
+{
+ if (depth != 1 || strcmp(uname, "ibm,ultravisor") != 0)
+ return 0;
+
+ /* TODO: check the compatible devtree property once it is created */
+
+ powerpc_firmware_features |= FW_FEATURE_ULTRAVISOR;
+ pr_debug("Ultravisor detected!\n");
+ return 1;
+}
--
2.20.1
next prev parent reply other threads:[~2019-05-18 14:32 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-18 14:25 [RFC PATCH v2 00/10] kvmppc: Paravirtualize KVM to support ultravisor Claudio Carvalho
2019-05-18 14:25 ` [RFC PATCH v2 01/10] KVM: PPC: Ultravisor: Add PPC_UV config option Claudio Carvalho
2019-05-18 14:25 ` [RFC PATCH v2 02/10] KVM: PPC: Ultravisor: Introduce the MSR_S bit Claudio Carvalho
2019-05-18 14:25 ` Claudio Carvalho [this message]
2019-05-18 14:25 ` [RFC PATCH v2 04/10] KVM: PPC: Ultravisor: Add generic ultravisor call handler Claudio Carvalho
2019-05-18 14:25 ` [RFC PATCH v2 05/10] KVM: PPC: Ultravisor: Use UV_WRITE_PATE ucall to register a PATE Claudio Carvalho
2019-05-18 14:25 ` [RFC PATCH v2 06/10] KVM: PPC: Ultravisor: Restrict flush of the partition tlb cache Claudio Carvalho
2019-05-18 14:25 ` [RFC PATCH v2 07/10] KVM: PPC: Ultravisor: Restrict LDBAR access Claudio Carvalho
2019-05-20 5:43 ` Paul Mackerras
2019-05-21 5:24 ` Madhavan Srinivasan
2019-05-30 22:51 ` Claudio Carvalho
2019-05-18 14:25 ` [RFC PATCH v2 08/10] KVM: PPC: Ultravisor: Return to UV for hcalls from SVM Claudio Carvalho
2019-05-20 6:17 ` Paul Mackerras
2019-05-18 14:25 ` [RFC PATCH v2 09/10] KVM: PPC: Book3S HV: Fixed for running secure guests Claudio Carvalho
2019-05-20 6:40 ` Paul Mackerras
2019-05-18 14:25 ` [RFC PATCH v2 10/10] KVM: PPC: Ultravisor: Check for MSR_S during hv_reset_msr Claudio Carvalho
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190518142524.28528-4-cclaudio@linux.ibm.com \
--to=cclaudio@linux$(echo .)ibm.com \
--cc=andmike@linux$(echo .)ibm.com \
--cc=bauerman@linux$(echo .)ibm.com \
--cc=bharata@linux$(echo .)ibm.com \
--cc=khandual@linux$(echo .)vnet.ibm.com \
--cc=kvm-ppc@vger$(echo .)kernel.org \
--cc=linuxppc-dev@ozlabs$(echo .)org \
--cc=linuxram@us$(echo .)ibm.com \
--cc=maddy@linux$(echo .)vnet.ibm.com \
--cc=mpe@ellerman$(echo .)id.au \
--cc=paulus@ozlabs$(echo .)org \
--cc=sukadev@linux$(echo .)vnet.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox