···4343 SMCCC hvc4444SYM_FUNC_END(__arm_smccc_hvc)4545EXPORT_SYMBOL(__arm_smccc_hvc)4646+4747+ .macro SMCCC_1_2 instr4848+ /* Save `res` and free a GPR that won't be clobbered */4949+ stp x1, x19, [sp, #-16]!5050+5151+ /* Ensure `args` won't be clobbered while loading regs in next step */5252+ mov x19, x05353+5454+ /* Load the registers x0 - x17 from the struct arm_smccc_1_2_regs */5555+ ldp x0, x1, [x19, #ARM_SMCCC_1_2_REGS_X0_OFFS]5656+ ldp x2, x3, [x19, #ARM_SMCCC_1_2_REGS_X2_OFFS]5757+ ldp x4, x5, [x19, #ARM_SMCCC_1_2_REGS_X4_OFFS]5858+ ldp x6, x7, [x19, #ARM_SMCCC_1_2_REGS_X6_OFFS]5959+ ldp x8, x9, [x19, #ARM_SMCCC_1_2_REGS_X8_OFFS]6060+ ldp x10, x11, [x19, #ARM_SMCCC_1_2_REGS_X10_OFFS]6161+ ldp x12, x13, [x19, #ARM_SMCCC_1_2_REGS_X12_OFFS]6262+ ldp x14, x15, [x19, #ARM_SMCCC_1_2_REGS_X14_OFFS]6363+ ldp x16, x17, [x19, #ARM_SMCCC_1_2_REGS_X16_OFFS]6464+6565+ \instr #06666+6767+ /* Load the `res` from the stack */6868+ ldr x19, [sp]6969+7070+ /* Store the registers x0 - x17 into the result structure */7171+ stp x0, x1, [x19, #ARM_SMCCC_1_2_REGS_X0_OFFS]7272+ stp x2, x3, [x19, #ARM_SMCCC_1_2_REGS_X2_OFFS]7373+ stp x4, x5, [x19, #ARM_SMCCC_1_2_REGS_X4_OFFS]7474+ stp x6, x7, [x19, #ARM_SMCCC_1_2_REGS_X6_OFFS]7575+ stp x8, x9, [x19, #ARM_SMCCC_1_2_REGS_X8_OFFS]7676+ stp x10, x11, [x19, #ARM_SMCCC_1_2_REGS_X10_OFFS]7777+ stp x12, x13, [x19, #ARM_SMCCC_1_2_REGS_X12_OFFS]7878+ stp x14, x15, [x19, #ARM_SMCCC_1_2_REGS_X14_OFFS]7979+ stp x16, x17, [x19, #ARM_SMCCC_1_2_REGS_X16_OFFS]8080+8181+ /* Restore original x19 */8282+ ldp xzr, x19, [sp], #168383+ ret8484+.endm8585+8686+/*8787+ * void arm_smccc_1_2_hvc(const struct arm_smccc_1_2_regs *args,8888+ * struct arm_smccc_1_2_regs *res);8989+ */9090+SYM_FUNC_START(arm_smccc_1_2_hvc)9191+ SMCCC_1_2 hvc9292+SYM_FUNC_END(arm_smccc_1_2_hvc)9393+EXPORT_SYMBOL(arm_smccc_1_2_hvc)9494+9595+/*9696+ * void arm_smccc_1_2_smc(const struct arm_smccc_1_2_regs *args,9797+ * struct arm_smccc_1_2_regs *res);9898+ */9999+SYM_FUNC_START(arm_smccc_1_2_smc)100100+ SMCCC_1_2 smc101101+SYM_FUNC_END(arm_smccc_1_2_smc)102102+EXPORT_SYMBOL(arm_smccc_1_2_smc)
+55
include/linux/arm-smccc.h
···227227 unsigned long a3;228228};229229230230+#ifdef CONFIG_ARM64231231+/**232232+ * struct arm_smccc_1_2_regs - Arguments for or Results from SMC/HVC call233233+ * @a0-a17 argument values from registers 0 to 17234234+ */235235+struct arm_smccc_1_2_regs {236236+ unsigned long a0;237237+ unsigned long a1;238238+ unsigned long a2;239239+ unsigned long a3;240240+ unsigned long a4;241241+ unsigned long a5;242242+ unsigned long a6;243243+ unsigned long a7;244244+ unsigned long a8;245245+ unsigned long a9;246246+ unsigned long a10;247247+ unsigned long a11;248248+ unsigned long a12;249249+ unsigned long a13;250250+ unsigned long a14;251251+ unsigned long a15;252252+ unsigned long a16;253253+ unsigned long a17;254254+};255255+256256+/**257257+ * arm_smccc_1_2_hvc() - make HVC calls258258+ * @args: arguments passed via struct arm_smccc_1_2_regs259259+ * @res: result values via struct arm_smccc_1_2_regs260260+ *261261+ * This function is used to make HVC calls following SMC Calling Convention262262+ * v1.2 or above. The content of the supplied param are copied from the263263+ * structure to registers prior to the HVC instruction. The return values264264+ * are updated with the content from registers on return from the HVC265265+ * instruction.266266+ */267267+asmlinkage void arm_smccc_1_2_hvc(const struct arm_smccc_1_2_regs *args,268268+ struct arm_smccc_1_2_regs *res);269269+270270+/**271271+ * arm_smccc_1_2_smc() - make SMC calls272272+ * @args: arguments passed via struct arm_smccc_1_2_regs273273+ * @res: result values via struct arm_smccc_1_2_regs274274+ *275275+ * This function is used to make SMC calls following SMC Calling Convention276276+ * v1.2 or above. The content of the supplied param are copied from the277277+ * structure to registers prior to the SMC instruction. The return values278278+ * are updated with the content from registers on return from the SMC279279+ * instruction.280280+ */281281+asmlinkage void arm_smccc_1_2_smc(const struct arm_smccc_1_2_regs *args,282282+ struct arm_smccc_1_2_regs *res);283283+#endif284284+230285/**231286 * struct arm_smccc_quirk - Contains quirk information232287 * @id: quirk identification