From patchwork Thu Sep 5 13:29:17 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ryan Grimm X-Patchwork-Id: 1158434 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 46PM7056Hyz9sPG for ; Thu, 5 Sep 2019 23:32:12 +1000 (AEST) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.ibm.com Received: from bilbo.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 46PM6y6wL3zDr5b for ; Thu, 5 Sep 2019 23:32:10 +1000 (AEST) X-Original-To: skiboot@lists.ozlabs.org Delivered-To: skiboot@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=linux.ibm.com (client-ip=148.163.158.5; helo=mx0a-001b2d01.pphosted.com; envelope-from=grimm@linux.ibm.com; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.ibm.com Received: from mx0a-001b2d01.pphosted.com (mx0b-001b2d01.pphosted.com [148.163.158.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 46PM462kZTzDqv9 for ; Thu, 5 Sep 2019 23:29:42 +1000 (AEST) Received: from pps.filterd (m0098413.ppops.net [127.0.0.1]) by mx0b-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x85DSm3U002987; Thu, 5 Sep 2019 09:29:36 -0400 Received: from ppma02wdc.us.ibm.com (aa.5b.37a9.ip4.static.sl-reverse.com [169.55.91.170]) by mx0b-001b2d01.pphosted.com with ESMTP id 2uu2cmautc-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 05 Sep 2019 09:29:36 -0400 Received: from pps.filterd (ppma02wdc.us.ibm.com [127.0.0.1]) by ppma02wdc.us.ibm.com (8.16.0.27/8.16.0.27) with SMTP id x85DQTMS003573; Thu, 5 Sep 2019 13:29:35 GMT Received: from b01cxnp23032.gho.pok.ibm.com (b01cxnp23032.gho.pok.ibm.com [9.57.198.27]) by ppma02wdc.us.ibm.com with ESMTP id 2uqgh79jj1-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 05 Sep 2019 13:29:35 +0000 Received: from b01ledav002.gho.pok.ibm.com (b01ledav002.gho.pok.ibm.com [9.57.199.107]) by b01cxnp23032.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x85DTYcm53412200 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Thu, 5 Sep 2019 13:29:35 GMT Received: from b01ledav002.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id D1145124055; Thu, 5 Sep 2019 13:29:34 +0000 (GMT) Received: from b01ledav002.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 80698124052; Thu, 5 Sep 2019 13:29:34 +0000 (GMT) Received: from alain.ibm.com (unknown [9.85.158.174]) by b01ledav002.gho.pok.ibm.com (Postfix) with ESMTP; Thu, 5 Sep 2019 13:29:34 +0000 (GMT) From: Ryan Grimm To: skiboot@lists.ozlabs.org Date: Thu, 5 Sep 2019 09:29:17 -0400 Message-Id: <20190905132919.8765-7-grimm@linux.ibm.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190905132919.8765-1-grimm@linux.ibm.com> References: <20190905132919.8765-1-grimm@linux.ibm.com> MIME-Version: 1.0 X-TM-AS-GCONF: 00 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-09-05_04:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=13 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=779 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1906280000 definitions=main-1909050132 Subject: [Skiboot] [RFC PATCH 6/8] pef: ultra-call support for skiboot X-BeenThere: skiboot@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Mailing list for skiboot development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ryan Grimm Errors-To: skiboot-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "Skiboot" From: Madhavan Srinivasan A new type of system call called the ultra call is used to get the services of the ultravisor. This ultracall support is needed in skiboot to access the xscoms which are in the secure memory area. Signed-off-by: Madhavan Srinivasan Signed-off-by: Santosh Sivaraj [ andmike: ABI hange to switch from r0 to r3 ] Signed-off-by: Michael Anderson [ grimm: Comments to start_uv for register usage ] Signed-off-by: Ryan Grimm --- asm/head.S | 34 +++++++++++++++++++++++++++++++++- include/ultravisor.h | 1 + 2 files changed, 34 insertions(+), 1 deletion(-) diff --git a/asm/head.S b/asm/head.S index 18ce3044..f8808b08 100644 --- a/asm/head.S +++ b/asm/head.S @@ -1066,6 +1066,11 @@ start_kernel_secondary: mfspr %r3,SPR_PIR bctr +/* start_uv register usage: + * + * r3 is base address of UV + * r4 is ptr to struct uv_opal + */ .global start_uv start_uv: mflr %r0 @@ -1083,7 +1088,34 @@ start_uv: addi %r7,%r5,1 li %r4,0 li %r5,0 - bctrl + bctrl /* branch to UV here */ ld %r0,16(%r1) mtlr %r0 blr + +.global ucall +ucall: + mflr %r0 + stdu %r1,-STACK_FRAMESIZE(%r1) + std %r0,STACK_LR(%r1) + mfcr %r0 + stw %r0,STACK_CR(%r1) + std %r4,STACK_GPR4(%r1) /* Save ret buffer */ + mr %r4,%r5 + mr %r5,%r6 + mr %r6,%r7 + mr %r7,%r8 + mr %r8,%r9 + mr %r9,%r10 + sc 2 /* invoke the ultravisor */ + ld %r12,STACK_GPR4(%r1) + std %r4, 0(%r12) + std %r5, 8(%r12) + std %r6, 16(%r12) + std %r7, 24(%r12) + lwz %r0,STACK_CR(%r1) + mtcrf 0xff,%r0 + ld %r0,STACK_LR(%r1) + mtlr %r0 + addi %r1,%r1,STACK_FRAMESIZE + blr /* return r3 = status */ diff --git a/include/ultravisor.h b/include/ultravisor.h index 976b6323..3fc2ecd9 100644 --- a/include/ultravisor.h +++ b/include/ultravisor.h @@ -36,5 +36,6 @@ extern void uv_preload_image(void); extern void uv_decompress_image(void); extern void init_uv(void); extern int start_ultravisor(void); +extern long ucall(unsigned long opcode, unsigned long *retbuf, ...); #endif /* __ULTRAVISOR_H */