{"id":288,"url":"http://patchwork.ozlabs.org/api/1.0/patches/288/?format=json","project":{"id":2,"url":"http://patchwork.ozlabs.org/api/1.0/projects/2/?format=json","name":"Linux PPC development","link_name":"linuxppc-dev","list_id":"linuxppc-dev.lists.ozlabs.org","list_email":"linuxppc-dev@lists.ozlabs.org","web_url":"https://github.com/linuxppc/wiki/wiki","scm_url":"https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git","webscm_url":"https://git.kernel.org/pub/scm/linux/kernel/git/powerpc/linux.git/"},"msgid":"<1221546450-15761-2-git-send-email-ehrhardt@linux.vnet.ibm.com>","date":"2008-09-16T06:27:28","name":"kvmppc: read device tree hypervisor node infrastructure","commit_ref":null,"pull_url":null,"state":"changes-requested","archived":true,"hash":"bf9dd3b4499972aa8e1f903e66ca2663375e9db3","submitter":{"id":151,"url":"http://patchwork.ozlabs.org/api/1.0/people/151/?format=json","name":null,"email":"ehrhardt@linux.vnet.ibm.com"},"delegate":{"id":47,"url":"http://patchwork.ozlabs.org/api/1.0/users/47/?format=json","username":"hollisb","first_name":"Hollis","last_name":"Blanchard","email":"hollis@penguinppc.org"},"mbox":"http://patchwork.ozlabs.org/project/linuxppc-dev/patch/1221546450-15761-2-git-send-email-ehrhardt@linux.vnet.ibm.com/mbox/","series":[],"check":"pending","checks":"http://patchwork.ozlabs.org/api/patches/288/checks/","tags":{},"headers":{"Return-Path":"<linuxppc-dev-bounces+patchwork=ozlabs.org@ozlabs.org>","X-Original-To":["patchwork@ozlabs.org","linuxppc-dev@ozlabs.org"],"Delivered-To":["patchwork@ozlabs.org","linuxppc-dev@ozlabs.org"],"Received":["from ozlabs.org (localhost [127.0.0.1])\n\tby ozlabs.org (Postfix) with ESMTP id 5DB67DDF02\n\tfor <patchwork@ozlabs.org>; Tue, 16 Sep 2008 16:28:31 +1000 (EST)","from mtagate2.de.ibm.com (mtagate2.de.ibm.com [195.212.17.162])\n\t(using TLSv1 with cipher DHE-RSA-AES256-SHA (256/256 bits))\n\t(Client CN \"mtagate2.de.ibm.com\", Issuer \"Equifax\" (verified OK))\n\tby ozlabs.org (Postfix) with ESMTPS id 03567DDDFA\n\tfor <linuxppc-dev@ozlabs.org>; Tue, 16 Sep 2008 16:28:10 +1000 (EST)","from d12nrmr1607.megacenter.de.ibm.com\n\t(d12nrmr1607.megacenter.de.ibm.com [9.149.167.49])\n\tby mtagate2.de.ibm.com (8.13.1/8.13.1) with ESMTP id m8G6Rwch030557\n\tfor <linuxppc-dev@ozlabs.org>; Tue, 16 Sep 2008 06:28:01 GMT","from d12av01.megacenter.de.ibm.com (d12av01.megacenter.de.ibm.com\n\t[9.149.165.212])\n\tby d12nrmr1607.megacenter.de.ibm.com (8.13.8/8.13.8/NCO v9.1) with\n\tESMTP id m8G6Rwma2207950\n\tfor <linuxppc-dev@ozlabs.org>; Tue, 16 Sep 2008 08:27:58 +0200","from d12av01.megacenter.de.ibm.com (loopback [127.0.0.1])\n\tby d12av01.megacenter.de.ibm.com (8.12.11.20060308/8.13.3) with ESMTP\n\tid m8G6Rs2t025222\n\tfor <linuxppc-dev@ozlabs.org>; Tue, 16 Sep 2008 08:27:55 +0200","from localhost.localdomain (dyn-9-152-198-109.boeblingen.de.ibm.com\n\t[9.152.198.109])\n\tby d12av01.megacenter.de.ibm.com (8.12.11.20060308/8.12.11) with\n\tESMTP id m8G6Rsbt024799; Tue, 16 Sep 2008 08:27:54 +0200"],"From":"ehrhardt@linux.vnet.ibm.com","To":"linuxppc-dev@ozlabs.org, kvm-ppc@vger.kernel.org","Subject":"[PATCH 1/3] kvmppc: read device tree hypervisor node infrastructure","Date":"Tue, 16 Sep 2008 08:27:28 +0200","Message-Id":"<1221546450-15761-2-git-send-email-ehrhardt@linux.vnet.ibm.com>","X-Mailer":"git-send-email 1.5.4.3","In-Reply-To":"<1221546450-15761-1-git-send-email-ehrhardt@linux.vnet.ibm.com>","References":"<1221546450-15761-1-git-send-email-ehrhardt@linux.vnet.ibm.com>","Cc":"hollisb@us.ibm.com","X-BeenThere":"linuxppc-dev@ozlabs.org","X-Mailman-Version":"2.1.11","Precedence":"list","List-Id":"Linux on PowerPC Developers Mail List <linuxppc-dev.ozlabs.org>","List-Unsubscribe":"<https://ozlabs.org/mailman/options/linuxppc-dev>,\n\t<mailto:linuxppc-dev-request@ozlabs.org?subject=unsubscribe>","List-Archive":"<http://ozlabs.org/pipermail/linuxppc-dev>","List-Post":"<mailto:linuxppc-dev@ozlabs.org>","List-Help":"<mailto:linuxppc-dev-request@ozlabs.org?subject=help>","List-Subscribe":"<https://ozlabs.org/mailman/listinfo/linuxppc-dev>,\n\t<mailto:linuxppc-dev-request@ozlabs.org?subject=subscribe>","MIME-Version":"1.0","Content-Type":"text/plain; charset=\"us-ascii\"","Content-Transfer-Encoding":"7bit","Sender":"linuxppc-dev-bounces+patchwork=ozlabs.org@ozlabs.org","Errors-To":"linuxppc-dev-bounces+patchwork=ozlabs.org@ozlabs.org"},"content":"From: Christian Ehrhardt <ehrhardt@linux.vnet.ibm.com>\n\nThis patch adds the guest portion of the device tree based host->guest\ncommunication. Using the device tree infrastructure this patch implements\nkvm_para_available and kvm_arch_para_features (in this patch just the\ninfrastructure, no specific feature registered).\n\nSigned-off-by: Christian Ehrhardt <ehrhardt@linux.vnet.ibm.com>","diff":"diff --git a/arch/powerpc/kernel/Makefile b/arch/powerpc/kernel/Makefile\n--- a/arch/powerpc/kernel/Makefile\n+++ b/arch/powerpc/kernel/Makefile\n@@ -80,6 +80,8 @@\n \n obj-$(CONFIG_8XX_MINIMAL_FPEMU) += softemu8xx.o\n \n+obj-$(CONFIG_KVM_GUEST)\t\t+= kvm.o\n+\n ifneq ($(CONFIG_PPC_INDIRECT_IO),y)\n obj-y\t\t\t\t+= iomap.o\n endif\ndiff --git a/arch/powerpc/kernel/kvm.c b/arch/powerpc/kernel/kvm.c\nnew file mode 100644\n--- /dev/null\n+++ b/arch/powerpc/kernel/kvm.c\n@@ -0,0 +1,30 @@\n+/*\n+ * This program is free software; you can redistribute it and/or modify\n+ * it under the terms of the GNU General Public License, version 2, as\n+ * published by the Free Software Foundation.\n+ *\n+ * This program is distributed in the hope that it will be useful,\n+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\n+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\n+ * GNU General Public License for more details.\n+ *\n+ * You should have received a copy of the GNU General Public License\n+ * along with this program; if not, write to the Free Software\n+ * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.\n+ *\n+ * Copyright IBM Corp. 2008\n+ *\n+ * Authors:\n+ * \tHollis Blanchard <hollisb@us.ibm.com>\n+ * \tChristian Ehrhardt <ehrhardt@de.ibm.com>\n+ */\n+\n+#include <linux/percpu.h>\n+#include <linux/mm.h>\n+#include <linux/kvm_para.h>\n+\n+void __init kvm_guest_init(void)\n+{\n+\tif (!kvm_para_available())\n+\t\treturn;\n+}\ndiff --git a/arch/powerpc/kernel/setup_32.c b/arch/powerpc/kernel/setup_32.c\n--- a/arch/powerpc/kernel/setup_32.c\n+++ b/arch/powerpc/kernel/setup_32.c\n@@ -17,6 +17,7 @@\n #include <linux/cpu.h>\n #include <linux/console.h>\n #include <linux/lmb.h>\n+#include <linux/kvm_para.h>\n \n #include <asm/io.h>\n #include <asm/prom.h>\n@@ -319,5 +320,7 @@\n \t\tppc_md.setup_arch();\n \tif ( ppc_md.progress ) ppc_md.progress(\"arch: exit\", 0x3eab);\n \n+\tkvm_guest_init();\n+\n \tpaging_init();\n }\ndiff --git a/arch/powerpc/platforms/44x/Kconfig b/arch/powerpc/platforms/44x/Kconfig\n--- a/arch/powerpc/platforms/44x/Kconfig\n+++ b/arch/powerpc/platforms/44x/Kconfig\n@@ -152,3 +152,10 @@\n # 44x errata/workaround config symbols, selected by the CPU models above\n config IBM440EP_ERR42\n \tbool\n+\n+config KVM_GUEST\n+\tbool \"KVM Guest support\"\n+\tdepends on EXPERIMENTAL\n+\thelp\n+\tThis option enables various optimizations for running under the KVM\n+\thypervisor.\ndiff --git a/include/asm-powerpc/kvm_para.h b/include/asm-powerpc/kvm_para.h\n--- a/include/asm-powerpc/kvm_para.h\n+++ b/include/asm-powerpc/kvm_para.h\n@@ -14,7 +14,9 @@\n  *\n  * Copyright IBM Corp. 2008\n  *\n- * Authors: Hollis Blanchard <hollisb@us.ibm.com>\n+ * Authors:\n+ * \tHollis Blanchard <hollisb@us.ibm.com>\n+ * \tChristian Ehrhardt <ehrhardt@de.ibm.com>\n  */\n \n #ifndef __POWERPC_KVM_PARA_H__\n@@ -22,15 +24,50 @@\n \n #ifdef __KERNEL__\n \n+#include <linux/of.h>\n+\n+static struct kvmppc_para_features {\n+\tchar *dtcell;\n+\tint feature;\n+} para_features[] = {\n+};\n+\n static inline int kvm_para_available(void)\n {\n-\treturn 0;\n+\tstruct device_node *dn;\n+\tint ret;\n+\n+\tdn = of_find_node_by_path(\"/hypervisor\");\n+\tret = !!dn;\n+\n+\tof_node_put(dn);\n+\n+\treturn ret;\n }\n \n static inline unsigned int kvm_arch_para_features(void)\n {\n-\treturn 0;\n+\tstruct device_node *dn;\n+\tconst int *dtval;\n+\tunsigned int features = 0;\n+\tint i;\n+\n+\tdn = of_find_node_by_path(\"/hypervisor\");\n+\tif (!dn)\n+\t\treturn 0;\n+\n+\tfor (i = 0; i < ARRAY_SIZE(para_features); i++) {\n+\t\tdtval = of_get_property(dn, para_features[i].dtcell, NULL);\n+\t\tif (dtval && *dtval == 1)\n+\t\t\tfeatures |= (1 << para_features[i].feature);\n+\t}\n+\n+\tof_node_put(dn);\n+\n+\treturn features;\n }\n+\n+void kvm_guest_init(void);\n \n #endif /* __KERNEL__ */\n \n","prefixes":[]}