powerpc: Fix personality handling in ppc64_personality()
[linux/fpc-iii.git] / arch / powerpc / kernel / epapr_paravirt.c
blob028aeae370b657fb91096be96243efdf0e8bf61f
1 /*
2 * ePAPR para-virtualization support.
4 * This program is free software; you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License, version 2, as
6 * published by the Free Software Foundation.
8 * This program is distributed in the hope that it will be useful,
9 * but WITHOUT ANY WARRANTY; without even the implied warranty of
10 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
11 * GNU General Public License for more details.
13 * You should have received a copy of the GNU General Public License
14 * along with this program; if not, write to the Free Software
15 * Foundation, 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
17 * Copyright (C) 2012 Freescale Semiconductor, Inc.
20 #include <linux/of.h>
21 #include <asm/epapr_hcalls.h>
22 #include <asm/cacheflush.h>
23 #include <asm/code-patching.h>
25 bool epapr_paravirt_enabled;
27 static int __init epapr_paravirt_init(void)
29 struct device_node *hyper_node;
30 const u32 *insts;
31 int len, i;
33 hyper_node = of_find_node_by_path("/hypervisor");
34 if (!hyper_node)
35 return -ENODEV;
37 insts = of_get_property(hyper_node, "hcall-instructions", &len);
38 if (!insts)
39 return -ENODEV;
41 if (len % 4 || len > (4 * 4))
42 return -ENODEV;
44 for (i = 0; i < (len / 4); i++)
45 patch_instruction(epapr_hypercall_start + i, insts[i]);
47 epapr_paravirt_enabled = true;
49 return 0;
52 early_initcall(epapr_paravirt_init);