From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, HTML_MESSAGE,INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS, USER_AGENT_SANE_1 autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6BD6EC742A7 for ; Sat, 13 Jul 2019 08:52:01 +0000 (UTC) Received: from lists.ozlabs.org (lists.ozlabs.org [203.11.71.2]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id F23FC2083B for ; Sat, 13 Jul 2019 08:52:00 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F23FC2083B Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linux.ibm.com Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 45m3SZ6hZVzDqvx for ; Sat, 13 Jul 2019 18:51:58 +1000 (AEST) Received: from ozlabs.org (bilbo.ozlabs.org [203.11.71.1]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 45lgjx3Qg8zDr0L for ; Sat, 13 Jul 2019 04:02:13 +1000 (AEST) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.ibm.com Received: from ozlabs.org (bilbo.ozlabs.org [203.11.71.1]) by bilbo.ozlabs.org (Postfix) with ESMTP id 45lgjw3cV2z8vhn for ; Sat, 13 Jul 2019 04:02:12 +1000 (AEST) Received: by ozlabs.org (Postfix) id 45lgjw2PY9z9sDQ; Sat, 13 Jul 2019 04:02:12 +1000 (AEST) Authentication-Results: ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=linux.ibm.com (client-ip=148.163.156.1; helo=mx0a-001b2d01.pphosted.com; envelope-from=cclaudio@linux.ibm.com; receiver=) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=linux.ibm.com Received: from mx0a-001b2d01.pphosted.com (mx0a-001b2d01.pphosted.com [148.163.156.1]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 45lgjt6TFjz9sBt for ; Sat, 13 Jul 2019 04:02:10 +1000 (AEST) Received: from pps.filterd (m0098410.ppops.net [127.0.0.1]) by mx0a-001b2d01.pphosted.com (8.16.0.27/8.16.0.27) with SMTP id x6CI27Gi083686 for ; Fri, 12 Jul 2019 14:02:09 -0400 Received: from e12.ny.us.ibm.com (e12.ny.us.ibm.com [129.33.205.202]) by mx0a-001b2d01.pphosted.com with ESMTP id 2tpw8y4ebs-1 (version=TLSv1.2 cipher=AES256-GCM-SHA384 bits=256 verify=NOT) for ; Fri, 12 Jul 2019 14:02:07 -0400 Received: from localhost by e12.ny.us.ibm.com with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted for from ; Fri, 12 Jul 2019 19:02:02 +0100 Received: from b01cxnp22034.gho.pok.ibm.com (9.57.198.24) by e12.ny.us.ibm.com (146.89.104.199) with IBM ESMTP SMTP Gateway: Authorized Use Only! Violators will be prosecuted; (version=TLSv1/SSLv3 cipher=AES256-GCM-SHA384 bits=256/256) Fri, 12 Jul 2019 19:02:00 +0100 Received: from b01ledav004.gho.pok.ibm.com (b01ledav004.gho.pok.ibm.com [9.57.199.109]) by b01cxnp22034.gho.pok.ibm.com (8.14.9/8.14.9/NCO v10.0) with ESMTP id x6CI1xEo43975034 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK); Fri, 12 Jul 2019 18:01:59 GMT Received: from b01ledav004.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id 8F13E112064; Fri, 12 Jul 2019 18:01:59 +0000 (GMT) Received: from b01ledav004.gho.pok.ibm.com (unknown [127.0.0.1]) by IMSVA (Postfix) with ESMTP id BD2A0112061; Fri, 12 Jul 2019 18:01:57 +0000 (GMT) Received: from [9.18.235.77] (unknown [9.18.235.77]) by b01ledav004.gho.pok.ibm.com (Postfix) with ESMTP; Fri, 12 Jul 2019 18:01:57 +0000 (GMT) Subject: Re: [PATCH v4 2/8] powerpc: Introduce FW_FEATURE_ULTRAVISOR To: Michael Ellerman , linuxppc-dev@ozlabs.org References: <20190628200825.31049-1-cclaudio@linux.ibm.com> <20190628200825.31049-3-cclaudio@linux.ibm.com> <87k1cog250.fsf@concordia.ellerman.id.au> From: Claudio Carvalho Date: Fri, 12 Jul 2019 15:01:56 -0300 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.6.0 MIME-Version: 1.0 In-Reply-To: <87k1cog250.fsf@concordia.ellerman.id.au> Content-Type: multipart/alternative; boundary="------------553B7B98B64F8622D881B133" Content-Language: en-US X-TM-AS-GCONF: 00 x-cbid: 19071218-0060-0000-0000-0000035DD20F X-IBM-SpamModules-Scores: X-IBM-SpamModules-Versions: BY=3.00011416; HX=3.00000242; KW=3.00000007; PH=3.00000004; SC=3.00000286; SDB=6.01231202; UDB=6.00648563; IPR=6.01012486; MB=3.00027694; MTD=3.00000008; XFM=3.00000015; UTC=2019-07-12 18:02:01 X-IBM-AV-DETECTION: SAVI=unused REMOTE=unused XFE=unused x-cbparentid: 19071218-0061-0000-0000-00004A1D7136 Message-Id: <4da093e5-14ea-963b-9e8d-a6ba2aa4678f@linux.ibm.com> X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:, , definitions=2019-07-12_05:, , signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 bulkscore=0 spamscore=0 clxscore=1015 lowpriorityscore=0 mlxscore=0 impostorscore=0 mlxlogscore=999 adultscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.0.1-1810050000 definitions=main-1907120183 X-Mailman-Approved-At: Sat, 13 Jul 2019 18:44:20 +1000 X-BeenThere: linuxppc-dev@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Linux on PowerPC Developers Mail List List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Madhavan Srinivasan , Michael Anderson , Ram Pai , kvm-ppc@vger.kernel.org, Bharata B Rao , Ryan Grimm , Sukadev Bhattiprolu , Thiago Bauermann , Anshuman Khandual Errors-To: linuxppc-dev-bounces+linuxppc-dev=archiver.kernel.org@lists.ozlabs.org Sender: "Linuxppc-dev" This is a multi-part message in MIME format. --------------553B7B98B64F8622D881B133 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit On 7/11/19 9:57 AM, Michael Ellerman wrote: > Claudio Carvalho writes: >> diff --git a/arch/powerpc/include/asm/ultravisor.h b/arch/powerpc/include/asm/ultravisor.h >> new file mode 100644 >> index 000000000000..e5009b0d84ea >> --- /dev/null >> +++ b/arch/powerpc/include/asm/ultravisor.h >> @@ -0,0 +1,15 @@ >> +/* SPDX-License-Identifier: GPL-2.0 */ >> +/* >> + * Ultravisor definitions >> + * >> + * Copyright 2019, IBM Corporation. >> + * >> + */ >> +#ifndef _ASM_POWERPC_ULTRAVISOR_H >> +#define _ASM_POWERPC_ULTRAVISOR_H >> + >> +/* Internal functions */ >> +extern int early_init_dt_scan_ultravisor(unsigned long node, const char *uname, >> + int depth, void *data); > Please don't use extern in new headers. > >> diff --git a/arch/powerpc/kernel/ultravisor.c b/arch/powerpc/kernel/ultravisor.c >> new file mode 100644 >> index 000000000000..dc6021f63c97 >> --- /dev/null >> +++ b/arch/powerpc/kernel/ultravisor.c > Is there a reason this (and other later files) aren't in platforms/powernv ? Yes, there is. https://www.spinics.net/lists/kvm-ppc/msg14998.html We also need to do ucalls from a secure guest and its kernel may not have CONFIG_PPC_POWERNV=y. I can make it clear in the commit message. > >> @@ -0,0 +1,24 @@ >> +// SPDX-License-Identifier: GPL-2.0 >> +/* >> + * Ultravisor high level interfaces >> + * >> + * Copyright 2019, IBM Corporation. >> + * >> + */ >> +#include >> +#include >> +#include >> + >> +#include >> +#include >> + >> +int __init early_init_dt_scan_ultravisor(unsigned long node, const char *uname, >> + int depth, void *data) >> +{ >> + if (depth != 1 || strcmp(uname, "ibm,ultravisor") != 0) >> + return 0; > I know you're following the example of OPAL, but this is not the best > way to search for the ultravisor node. > > It makes the location and name of the node part of the ABI, when there's > no need for it to be. > > If instead you just scan the tree for a node that is *compatible* with > "ibm,ultravisor" (or whatever compatible string) then the node can be > placed any where in the tree and have any name, which gives us the most > flexibility in future to change the location of the device tree node. I will do that in the next version. Thanks, Claudio > > cheers > --------------553B7B98B64F8622D881B133 Content-Type: text/html; charset=utf-8 Content-Transfer-Encoding: 7bit


On 7/11/19 9:57 AM, Michael Ellerman wrote:
Claudio Carvalho <cclaudio@linux.ibm.com> writes:
diff --git a/arch/powerpc/include/asm/ultravisor.h b/arch/powerpc/include/asm/ultravisor.h
new file mode 100644
index 000000000000..e5009b0d84ea
--- /dev/null
+++ b/arch/powerpc/include/asm/ultravisor.h
@@ -0,0 +1,15 @@
+/* SPDX-License-Identifier: GPL-2.0 */
+/*
+ * Ultravisor definitions
+ *
+ * Copyright 2019, IBM Corporation.
+ *
+ */
+#ifndef _ASM_POWERPC_ULTRAVISOR_H
+#define _ASM_POWERPC_ULTRAVISOR_H
+
+/* Internal functions */
+extern int early_init_dt_scan_ultravisor(unsigned long node, const char *uname,
+					 int depth, void *data);
Please don't use extern in new headers.

diff --git a/arch/powerpc/kernel/ultravisor.c b/arch/powerpc/kernel/ultravisor.c
new file mode 100644
index 000000000000..dc6021f63c97
--- /dev/null
+++ b/arch/powerpc/kernel/ultravisor.c
Is there a reason this (and other later files) aren't in platforms/powernv ?
Yes, there is.
https://www.spinics.net/lists/kvm-ppc/msg14998.html

We also need to do ucalls from a secure guest and its kernel may not have CONFIG_PPC_POWERNV=y. I can make it clear in the commit message.



@@ -0,0 +1,24 @@
+// SPDX-License-Identifier: GPL-2.0
+/*
+ * Ultravisor high level interfaces
+ *
+ * Copyright 2019, IBM Corporation.
+ *
+ */
+#include <linux/init.h>
+#include <linux/printk.h>
+#include <linux/string.h>
+
+#include <asm/ultravisor.h>
+#include <asm/firmware.h>
+
+int __init early_init_dt_scan_ultravisor(unsigned long node, const char *uname,
+					 int depth, void *data)
+{
+	if (depth != 1 || strcmp(uname, "ibm,ultravisor") != 0)
+		return 0;
I know you're following the example of OPAL, but this is not the best
way to search for the ultravisor node.

It makes the location and name of the node part of the ABI, when there's
no need for it to be.

If instead you just scan the tree for a node that is *compatible* with
"ibm,ultravisor" (or whatever compatible string) then the node can be
placed any where in the tree and have any name, which gives us the most
flexibility in future to change the location of the device tree node.

I will do that in the next version.

Thanks,
Claudio



cheers

--------------553B7B98B64F8622D881B133--