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 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id E2174C25B75 for ; Wed, 15 May 2024 22:04:32 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:CC:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=EqTn4M5MGCf3TIOXXZeE7UYRMxd2Xs/tt3wwtUMs2L0=; b=vP+mR3Mh8ag/88 YPnUwTdEqT3CcbgqeTuLyIj7eefQh0Rp74UCT0A++Ph921aakoGzxL8zA3KTdxfGZS8+JEq8kGf8h DlNQxBiZDufdoMLb4eZO45efD6y/eLAO0aDq7KtjD2KZ2qeGo64pOw5ND77qw3sK+/p8+r+cLUP5Q YV6hJrgiqARq+x2ovEds7EvIGJ/cPRsAFTBygNnOE5GA4hQu/XkQzdGkFGHzgxer0Qm8W7lNtrUsN 2H+GA2QKafBu8ji2Lo/Amn0YxzswaPNHzxy73fLzo4Svw3rG7R0bnQtp8kf/kLA3IToZalntO03sp B9IZ1v1fWLxBiMTqqn5w==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s7MjP-00000002zoV-3vTm; Wed, 15 May 2024 22:04:15 +0000 Received: from mx0a-0031df01.pphosted.com ([205.220.168.131]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s7MjM-00000002znx-0TWM for linux-arm-kernel@lists.infradead.org; Wed, 15 May 2024 22:04:13 +0000 Received: from pps.filterd (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.2/8.18.1.2) with ESMTP id 44FLnG3L014218; Wed, 15 May 2024 22:02:56 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= date:from:to:cc:subject:message-id:references:mime-version :content-type:in-reply-to; s=qcppdkim1; bh=QDBa3xO9SVZC0wA2OjFbS SGVBA+x1q/1DDGJo/BLO2I=; b=MQyPlHhp1n4fCWGyt3zgw7uZYWtpd92rUGJQz 8lkiNoMpg9wNRG1Z4UMGpor453kwHi/95tOXEi9FnpUzhdtYoF5ZBz6MknfKWOqy sRysZ0+7h509TFYw35HozsSeq8qzkZJ1CSzcgZzGBUyKRbYxcQ2/N6kBzGg8bseg ws2hOTF7UNB5kTufM8+RQARntGoyzijoVFuqh5JYSxSIt2hzYUhnOEh7k9UEheLX VCea4kIgNhB9hnzH9/nFRMTusHl3joiCTv5YPVJD9cQBI9BRl8okPKU9wO1/Xhc1 Y2G8g1X8/+Volxv+8CmSN5HhVoOEz9ImAVx2FWB6Ci2lIK3uw== Received: from nasanppmta01.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3y20w224dd-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 May 2024 22:02:56 +0000 (GMT) Received: from nasanex01b.na.qualcomm.com (nasanex01b.na.qualcomm.com [10.46.141.250]) by NASANPPMTA01.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 44FM2tBB015195 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 15 May 2024 22:02:55 GMT Received: from hu-eberman-lv.qualcomm.com (10.49.16.6) by nasanex01b.na.qualcomm.com (10.46.141.250) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.1544.9; Wed, 15 May 2024 15:02:54 -0700 Date: Wed, 15 May 2024 15:02:54 -0700 From: Elliot Berman To: Roman Kisel CC: , , , , , , , , , , , , , , , , , , , , , , , , , , , , Subject: Re: [PATCH v2 1/6] arm64/hyperv: Support DeviceTree Message-ID: <20240515143359142-0700.eberman@hu-eberman-lv.qualcomm.com> References: <20240514224508.212318-1-romank@linux.microsoft.com> <20240514224508.212318-2-romank@linux.microsoft.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20240514224508.212318-2-romank@linux.microsoft.com> X-Originating-IP: [10.49.16.6] X-ClientProxiedBy: nalasex01c.na.qualcomm.com (10.47.97.35) To nasanex01b.na.qualcomm.com (10.46.141.250) X-QCInternal: smtphost X-Proofpoint-Virus-Version: vendor=nai engine=6200 definitions=5800 signatures=585085 X-Proofpoint-ORIG-GUID: DgLWzryxOWhF7b4rEhDpYrNv9kFCQJeQ X-Proofpoint-GUID: DgLWzryxOWhF7b4rEhDpYrNv9kFCQJeQ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1039,Hydra:6.0.650,FMLib:17.11.176.26 definitions=2024-05-15_14,2024-05-15_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 malwarescore=0 mlxlogscore=999 mlxscore=0 phishscore=0 adultscore=0 suspectscore=0 clxscore=1011 priorityscore=1501 bulkscore=0 spamscore=0 lowpriorityscore=0 impostorscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2405010000 definitions=main-2405150158 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240515_150412_198520_267B1F4A X-CRM114-Status: GOOD ( 25.11 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Tue, May 14, 2024 at 03:43:48PM -0700, Roman Kisel wrote: > The Virtual Trust Level platforms rely on DeviceTree, and the > arm64/hyperv code supports ACPI only. Update the logic to > support DeviceTree on boot as well as ACPI. Could you use Call UID query from SMCCC? KVM [1] and Gunyah [2] have been using this to identify if guest is running under those respective hypervisors. This works in both DT and ACPI cases. [1]: https://lore.kernel.org/all/20210330145430.996981-2-maz@kernel.org/ [2]: https://lore.kernel.org/all/20240222-gunyah-v17-4-1e9da6763d38@quicinc.com/ > > Signed-off-by: Roman Kisel > --- > arch/arm64/hyperv/mshyperv.c | 34 +++++++++++++++++++++++++++++----- > 1 file changed, 29 insertions(+), 5 deletions(-) > > diff --git a/arch/arm64/hyperv/mshyperv.c b/arch/arm64/hyperv/mshyperv.c > index b1a4de4eee29..208a3bcb9686 100644 > --- a/arch/arm64/hyperv/mshyperv.c > +++ b/arch/arm64/hyperv/mshyperv.c > @@ -15,6 +15,9 @@ > #include > #include > #include > +#include > +#include > +#include > #include > > static bool hyperv_initialized; > @@ -27,6 +30,29 @@ int hv_get_hypervisor_version(union hv_hypervisor_version_info *info) > return 0; > } > > +static bool hyperv_detect_fdt(void) > +{ > +#ifdef CONFIG_OF > + const unsigned long hyp_node = of_get_flat_dt_subnode_by_name( > + of_get_flat_dt_root(), "hypervisor"); > + > + return (hyp_node != -FDT_ERR_NOTFOUND) && > + of_flat_dt_is_compatible(hyp_node, "microsoft,hyperv"); > +#else > + return false; > +#endif > +} > + > +static bool hyperv_detect_acpi(void) > +{ > +#ifdef CONFIG_ACPI > + return !acpi_disabled && > + !strncmp((char *)&acpi_gbl_FADT.hypervisor_id, "MsHyperV", 8); > +#else > + return false; > +#endif > +} > + > static int __init hyperv_init(void) > { > struct hv_get_vp_registers_output result; > @@ -35,13 +61,11 @@ static int __init hyperv_init(void) > > /* > * Allow for a kernel built with CONFIG_HYPERV to be running in > - * a non-Hyper-V environment, including on DT instead of ACPI. > + * a non-Hyper-V environment. > + * > * In such cases, do nothing and return success. > */ > - if (acpi_disabled) > - return 0; > - > - if (strncmp((char *)&acpi_gbl_FADT.hypervisor_id, "MsHyperV", 8)) > + if (!hyperv_detect_fdt() && !hyperv_detect_acpi()) > return 0; > > /* Setup the guest ID */ > -- > 2.45.0 > > > _______________________________________________ > linux-arm-kernel mailing list > linux-arm-kernel@lists.infradead.org > http://lists.infradead.org/mailman/listinfo/linux-arm-kernel _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel