~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

TOMOYO Linux Cross Reference
Linux/arch/powerpc/kernel/epapr_paravirt.c

Version: ~ [ linux-6.11-rc3 ] ~ [ linux-6.10.4 ] ~ [ linux-6.9.12 ] ~ [ linux-6.8.12 ] ~ [ linux-6.7.12 ] ~ [ linux-6.6.45 ] ~ [ linux-6.5.13 ] ~ [ linux-6.4.16 ] ~ [ linux-6.3.13 ] ~ [ linux-6.2.16 ] ~ [ linux-6.1.104 ] ~ [ linux-6.0.19 ] ~ [ linux-5.19.17 ] ~ [ linux-5.18.19 ] ~ [ linux-5.17.15 ] ~ [ linux-5.16.20 ] ~ [ linux-5.15.164 ] ~ [ linux-5.14.21 ] ~ [ linux-5.13.19 ] ~ [ linux-5.12.19 ] ~ [ linux-5.11.22 ] ~ [ linux-5.10.223 ] ~ [ linux-5.9.16 ] ~ [ linux-5.8.18 ] ~ [ linux-5.7.19 ] ~ [ linux-5.6.19 ] ~ [ linux-5.5.19 ] ~ [ linux-5.4.281 ] ~ [ linux-5.3.18 ] ~ [ linux-5.2.21 ] ~ [ linux-5.1.21 ] ~ [ linux-5.0.21 ] ~ [ linux-4.20.17 ] ~ [ linux-4.19.319 ] ~ [ linux-4.18.20 ] ~ [ linux-4.17.19 ] ~ [ linux-4.16.18 ] ~ [ linux-4.15.18 ] ~ [ linux-4.14.336 ] ~ [ linux-4.13.16 ] ~ [ linux-4.12.14 ] ~ [ linux-4.11.12 ] ~ [ linux-4.10.17 ] ~ [ linux-4.9.337 ] ~ [ linux-4.4.302 ] ~ [ linux-3.10.108 ] ~ [ linux-2.6.32.71 ] ~ [ linux-2.6.0 ] ~ [ linux-2.4.37.11 ] ~ [ unix-v6-master ] ~ [ ccs-tools-1.8.9 ] ~ [ policy-sample ] ~
Architecture: ~ [ i386 ] ~ [ alpha ] ~ [ m68k ] ~ [ mips ] ~ [ ppc ] ~ [ sparc ] ~ [ sparc64 ] ~

  1 // SPDX-License-Identifier: GPL-2.0-only
  2 /*
  3  * ePAPR para-virtualization support.
  4  *
  5  * Copyright (C) 2012 Freescale Semiconductor, Inc.
  6  */
  7 
  8 #include <linux/of.h>
  9 #include <linux/of_fdt.h>
 10 #include <asm/epapr_hcalls.h>
 11 #include <asm/cacheflush.h>
 12 #include <asm/code-patching.h>
 13 #include <asm/machdep.h>
 14 #include <asm/inst.h>
 15 
 16 #if !defined(CONFIG_64BIT) || defined(CONFIG_PPC_BOOK3E_64)
 17 extern void epapr_ev_idle(void);
 18 extern u32 epapr_ev_idle_start[];
 19 #endif
 20 
 21 bool epapr_paravirt_enabled;
 22 static bool __maybe_unused epapr_has_idle;
 23 
 24 static int __init early_init_dt_scan_epapr(unsigned long node,
 25                                            const char *uname,
 26                                            int depth, void *data)
 27 {
 28         const u32 *insts;
 29         int len;
 30         int i;
 31 
 32         insts = of_get_flat_dt_prop(node, "hcall-instructions", &len);
 33         if (!insts)
 34                 return 0;
 35 
 36         if (len % 4 || len > (4 * 4))
 37                 return -1;
 38 
 39         for (i = 0; i < (len / 4); i++) {
 40                 ppc_inst_t inst = ppc_inst(be32_to_cpu(insts[i]));
 41                 patch_instruction(epapr_hypercall_start + i, inst);
 42 #if !defined(CONFIG_64BIT) || defined(CONFIG_PPC_BOOK3E_64)
 43                 patch_instruction(epapr_ev_idle_start + i, inst);
 44 #endif
 45         }
 46 
 47 #if !defined(CONFIG_64BIT) || defined(CONFIG_PPC_BOOK3E_64)
 48         if (of_get_flat_dt_prop(node, "has-idle", NULL))
 49                 epapr_has_idle = true;
 50 #endif
 51 
 52         epapr_paravirt_enabled = true;
 53 
 54         return 1;
 55 }
 56 
 57 int __init epapr_paravirt_early_init(void)
 58 {
 59         of_scan_flat_dt(early_init_dt_scan_epapr, NULL);
 60 
 61         return 0;
 62 }
 63 
 64 static int __init epapr_idle_init(void)
 65 {
 66 #if !defined(CONFIG_64BIT) || defined(CONFIG_PPC_BOOK3E_64)
 67         if (epapr_has_idle)
 68                 ppc_md.power_save = epapr_ev_idle;
 69 #endif
 70 
 71         return 0;
 72 }
 73 
 74 postcore_initcall(epapr_idle_init);
 75 

~ [ source navigation ] ~ [ diff markup ] ~ [ identifier search ] ~

kernel.org | git.kernel.org | LWN.net | Project Home | SVN repository | Mail admin

Linux® is a registered trademark of Linus Torvalds in the United States and other countries.
TOMOYO® is a registered trademark of NTT DATA CORPORATION.

sflogo.php