Message ID | 20240222-gunyah-v17-5-1e9da6763d38@quicinc.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel+bounces-77521-ouuuleilei=gmail.com@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp278295dyb; Thu, 22 Feb 2024 15:24:51 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXoQVEaDkGnNC7ybwY3HfY1NBuk/9SXzadBn54MXSuoi55xi75quVylykc+Ykp+QWy0JzvXHhpE7SZzrkAq2Tq0hzhZvQ== X-Google-Smtp-Source: AGHT+IGFW7CJeL8p5p9M7z/KdNT8LJC10Zib9GIehHB9NZoCcBBk4iN44yy3slO/m1p77rCYc1/c X-Received: by 2002:a05:6830:44ac:b0:6dd:e29d:dbf6 with SMTP id r44-20020a05683044ac00b006dde29ddbf6mr632627otv.16.1708644290845; Thu, 22 Feb 2024 15:24:50 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708644290; cv=pass; d=google.com; s=arc-20160816; b=HAzyR66BMHl6PC87tCkdVNaMQHkFPxcUd71XKbxbiA/HwdRn3qnnz9+rOvpOMAuX17 nnTld7WLJ7pHfBraMCPswka3DJ/EOnKDvZTkV5aItFYkv+7FHoJD+gUK8VMF1M5x8lPb 38+yjDkVIi8/qCnmfQbL83kUkxYInQVTmcMGUUHs7XQ79jL8Mbll+062dUna2dgLrMDk lSOULd5k/HnNmSrRBI1CO9uAaSqA5DcGkNpcJx3iO411d7eyXdD0d4BMK6F1qaGsbo7C 5/S6rkhVRgchDmBRa6eczrY7KXDRR+79p1hEXGYP8D0NSzqz69EzFp3WT3A85DUHK0PH Na7w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=zTKiLE99qoQyKhcmKq/otKW5FYYceuLhD8QduGBLZjM=; fh=j53ffieBeHmuArQHAkiXDczYOIriM+Jf92hqYE3BW8U=; b=cyzWiOv0ZQ+eEB1oZ4y+vWJWIwfXOq+pxW4yTACUI1PR8mChZv+JP8ASpdOADPgCv2 wI+oDYBchKZrykHoeE310cpyweTL3QYAKzYfK4SAe9mb/eZtXkwc21FoPs7KCOXsHBfw x7TKgQ7urV1pWBnL+ri4OV4OiHIJ0Hw7vLlPRQBIb+yjQrqjfHEbb1vt5PA3T1hqgHx8 tY0jG3E8eKX2Z7i4MMblTW3oR5645JDEoOxeLoHUaUle3gCmQ4UfKoK0Z6gRwcebFg2z dVlBKXdBHldhAUaeWWylLvsYtvrsticvOuUH/b6UarCkUuR0FNnl02RsRdAYP2kjnngW Ry9w==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=fOFR2rDW; arc=pass (i=1 spf=pass spfdomain=quicinc.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-kernel+bounces-77521-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-77521-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id y187-20020a638ac4000000b005dc905460d2si10755213pgd.233.2024.02.22.15.24.50 for <ouuuleilei@gmail.com> (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 15:24:50 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-77521-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=fOFR2rDW; arc=pass (i=1 spf=pass spfdomain=quicinc.com dkim=pass dkdomain=quicinc.com dmarc=pass fromdomain=quicinc.com); spf=pass (google.com: domain of linux-kernel+bounces-77521-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-77521-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 95F54287E18 for <ouuuleilei@gmail.com>; Thu, 22 Feb 2024 23:24:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 54ABE1586F8; Thu, 22 Feb 2024 23:17:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="fOFR2rDW" Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id F008114F974; Thu, 22 Feb 2024 23:17:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708643843; cv=none; b=ifF7zFeKZ1NIW8s256cJMwpxhYqCEPXuDq7OXv7S2aD6UzgZ7v+0OqhcLKaT0DMS6qRD7s9euqTMaaZMv/qf8xet2RshPKBfxqMxq/Z0yjqXnymvVUiTpfq9i7zihlvjiJOnsjDFKx7E0wijxg1DzCQdG7ES8GmSy8v4DEh1FDY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708643843; c=relaxed/simple; bh=lgxLux/miHdvn/sxNBqmTAmiPacO0LZX2rhzZVRBY08=; h=From:Date:Subject:MIME-Version:Content-Type:Message-ID:References: In-Reply-To:To:CC; b=F2MsL3Ubz+lYnpEZDeesK81cm91vnlNcfAf9057mDc9u0XFrfaNx/9r5Gq7uqJhB8zQkB0e83YOvw5iX6pI7XPNQxAqjLKYzUUn9jBqj67p24IB5MzJaA1R5yOXV3JyUE1fxyyGuxfnx6uU+iVWbmqZ8cvc5VgMn3qSif8dJwQ8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com; spf=pass smtp.mailfrom=quicinc.com; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b=fOFR2rDW; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=quicinc.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=quicinc.com Received: from pps.filterd (m0279869.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 41MLfk2d024250; Thu, 22 Feb 2024 23:16:31 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h= from:date:subject:mime-version:content-type :content-transfer-encoding:message-id:references:in-reply-to:to :cc; s=qcppdkim1; bh=zTKiLE99qoQyKhcmKq/otKW5FYYceuLhD8QduGBLZjM =; b=fOFR2rDWSSrWriwlEV2Og5S38dW0zz5pIta8m/jYNUHxgIZcZQfHJrp2HBU MDVriFOUqEKz4KLM3CGvlHrpGq9D+lulPJ0X5EePnlLSK80OrEJvZqG30y0cTicP T78lGCM9mWtq00Kq96Ljaf35uAknk/odRRfK7diKtFLE0dhb7iuBbW7D9o8m0CId NgkLWyDAv0F7ESFkGxwIs3dLbzYYFFhM1N8GNbHe8w9we3rjlMkEsXVI+ielc4ZG mgAS+at1hVxio9fbXcC+49yIlbVcQi/vxhU6Z+z/a6GR2wdFdfkwsLiyNOPB8WIE 7SOd1/O0O/iwMp9xSb5o62i2cgQ== Received: from nasanppmta05.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3weedkr5eu-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 22 Feb 2024 23:16:31 +0000 (GMT) Received: from nasanex01b.na.qualcomm.com (nasanex01b.na.qualcomm.com [10.46.141.250]) by NASANPPMTA05.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 41MNGUjt025515 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Thu, 22 Feb 2024 23:16:30 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.1118.40; Thu, 22 Feb 2024 15:16:29 -0800 From: Elliot Berman <quic_eberman@quicinc.com> Date: Thu, 22 Feb 2024 15:16:28 -0800 Subject: [PATCH v17 05/35] virt: gunyah: Add hypervisor driver Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: <linux-kernel.vger.kernel.org> List-Subscribe: <mailto:linux-kernel+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-kernel+unsubscribe@vger.kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-ID: <20240222-gunyah-v17-5-1e9da6763d38@quicinc.com> References: <20240222-gunyah-v17-0-1e9da6763d38@quicinc.com> In-Reply-To: <20240222-gunyah-v17-0-1e9da6763d38@quicinc.com> To: Alex Elder <elder@linaro.org>, Srinivas Kandagatla <srinivas.kandagatla@linaro.org>, Murali Nalajal <quic_mnalajal@quicinc.com>, Trilok Soni <quic_tsoni@quicinc.com>, Srivatsa Vaddagiri <quic_svaddagi@quicinc.com>, Carl van Schaik <quic_cvanscha@quicinc.com>, Philip Derrin <quic_pderrin@quicinc.com>, Prakruthi Deepak Heragu <quic_pheragu@quicinc.com>, Jonathan Corbet <corbet@lwn.net>, Rob Herring <robh+dt@kernel.org>, Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>, Conor Dooley <conor+dt@kernel.org>, Catalin Marinas <catalin.marinas@arm.com>, Will Deacon <will@kernel.org>, Konrad Dybcio <konrad.dybcio@linaro.org>, Bjorn Andersson <andersson@kernel.org>, Dmitry Baryshkov <dmitry.baryshkov@linaro.org>, "Fuad Tabba" <tabba@google.com>, Sean Christopherson <seanjc@google.com>, "Andrew Morton" <akpm@linux-foundation.org> CC: <linux-arm-msm@vger.kernel.org>, <linux-doc@vger.kernel.org>, <linux-kernel@vger.kernel.org>, <devicetree@vger.kernel.org>, <linux-arm-kernel@lists.infradead.org>, <linux-mm@kvack.org>, Elliot Berman <quic_eberman@quicinc.com> X-Mailer: b4 0.12.4 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: 3-_c8wKoLLhIAOm41mkJiy4fqOWdXiXm X-Proofpoint-GUID: 3-_c8wKoLLhIAOm41mkJiy4fqOWdXiXm X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.1011,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2024-02-22_15,2024-02-22_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 malwarescore=0 clxscore=1015 lowpriorityscore=0 mlxlogscore=999 phishscore=0 suspectscore=0 spamscore=0 adultscore=0 mlxscore=0 bulkscore=0 priorityscore=1501 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2402120000 definitions=main-2402220178 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791643395871454586 X-GMAIL-MSGID: 1791643395871454586 |
Series |
Drivers for Gunyah hypervisor
|
|
Commit Message
Elliot Berman
Feb. 22, 2024, 11:16 p.m. UTC
Add driver to detect when running under Gunyah. It performs basic
identification hypercall and populates the platform bus for resource
manager to probe.
Signed-off-by: Elliot Berman <quic_eberman@quicinc.com>
---
drivers/virt/Makefile | 1 +
drivers/virt/gunyah/Makefile | 3 +++
drivers/virt/gunyah/gunyah.c | 52 ++++++++++++++++++++++++++++++++++++++++++++
3 files changed, 56 insertions(+)
Comments
On 23.02.2024 00:16, Elliot Berman wrote: > Add driver to detect when running under Gunyah. It performs basic > identification hypercall and populates the platform bus for resource > manager to probe. > > Signed-off-by: Elliot Berman <quic_eberman@quicinc.com> > --- [...] > + > + /* Might move this out to individual drivers if there's ever an API version bump */ > + if (gunyah_api_version(&gunyah_api) != GUNYAH_API_V1) { > + pr_info("Unsupported Gunyah version: %u\n", > + gunyah_api_version(&gunyah_api)); Weird for this not to be an error, but it's probably not worth resending over if it's the only thing Konrad
On Fri, Feb 23, 2024 at 10:10:47PM +0100, Konrad Dybcio wrote: > On 23.02.2024 00:16, Elliot Berman wrote: > > Add driver to detect when running under Gunyah. It performs basic > > identification hypercall and populates the platform bus for resource > > manager to probe. > > > > Signed-off-by: Elliot Berman <quic_eberman@quicinc.com> > > --- > > [...] > > > + > > + /* Might move this out to individual drivers if there's ever an API version bump */ > > + if (gunyah_api_version(&gunyah_api) != GUNYAH_API_V1) { > > + pr_info("Unsupported Gunyah version: %u\n", > > + gunyah_api_version(&gunyah_api)); > > Weird for this not to be an error, but it's probably not worth resending > over if it's the only thing It is an error, but maybe I misunderstood: > > + /* Might move this out to individual drivers if there's ever an API version bump */ > > + if (gunyah_api_version(&gunyah_api) != GUNYAH_API_V1) { > > + pr_info("Unsupported Gunyah version: %u\n", > > + gunyah_api_version(&gunyah_api)); > > + return -ENODEV; > > + }
On 23.02.2024 23:58, Elliot Berman wrote: > On Fri, Feb 23, 2024 at 10:10:47PM +0100, Konrad Dybcio wrote: >> On 23.02.2024 00:16, Elliot Berman wrote: >>> Add driver to detect when running under Gunyah. It performs basic >>> identification hypercall and populates the platform bus for resource >>> manager to probe. >>> >>> Signed-off-by: Elliot Berman <quic_eberman@quicinc.com> >>> --- >> >> [...] >> >>> + >>> + /* Might move this out to individual drivers if there's ever an API version bump */ >>> + if (gunyah_api_version(&gunyah_api) != GUNYAH_API_V1) { >>> + pr_info("Unsupported Gunyah version: %u\n", >>> + gunyah_api_version(&gunyah_api)); >> >> Weird for this not to be an error, but it's probably not worth resending >> over if it's the only thing > > It is an error, but maybe I misunderstood: Sorry, I meant "pr_info might have been pr_err" Konrad > >>> + /* Might move this out to individual drivers if there's ever an API version bump */ >>> + if (gunyah_api_version(&gunyah_api) != GUNYAH_API_V1) { >>> + pr_info("Unsupported Gunyah version: %u\n", >>> + gunyah_api_version(&gunyah_api)); >>> + return -ENODEV; >>> + } >
diff --git a/drivers/virt/Makefile b/drivers/virt/Makefile index f29901bd78205..ef6a3835d078c 100644 --- a/drivers/virt/Makefile +++ b/drivers/virt/Makefile @@ -10,3 +10,4 @@ obj-y += vboxguest/ obj-$(CONFIG_NITRO_ENCLAVES) += nitro_enclaves/ obj-$(CONFIG_ACRN_HSM) += acrn/ obj-y += coco/ +obj-y += gunyah/ diff --git a/drivers/virt/gunyah/Makefile b/drivers/virt/gunyah/Makefile new file mode 100644 index 0000000000000..34f32110faf9a --- /dev/null +++ b/drivers/virt/gunyah/Makefile @@ -0,0 +1,3 @@ +# SPDX-License-Identifier: GPL-2.0 + +obj-$(CONFIG_GUNYAH) += gunyah.o diff --git a/drivers/virt/gunyah/gunyah.c b/drivers/virt/gunyah/gunyah.c new file mode 100644 index 0000000000000..ef8a85f275905 --- /dev/null +++ b/drivers/virt/gunyah/gunyah.c @@ -0,0 +1,52 @@ +// SPDX-License-Identifier: GPL-2.0-only +/* + * Copyright (c) 2023-2024 Qualcomm Innovation Center, Inc. All rights reserved. + */ + +#include <linux/gunyah.h> +#include <linux/module.h> +#include <linux/of_platform.h> +#include <linux/platform_device.h> + +static int gunyah_probe(struct platform_device *pdev) +{ + struct gunyah_hypercall_hyp_identify_resp gunyah_api; + + if (!arch_is_gunyah_guest()) + return -ENODEV; + + gunyah_hypercall_hyp_identify(&gunyah_api); + + pr_info("Running under Gunyah hypervisor %llx/v%u\n", + FIELD_GET(GUNYAH_API_INFO_VARIANT_MASK, gunyah_api.api_info), + gunyah_api_version(&gunyah_api)); + + /* Might move this out to individual drivers if there's ever an API version bump */ + if (gunyah_api_version(&gunyah_api) != GUNYAH_API_V1) { + pr_info("Unsupported Gunyah version: %u\n", + gunyah_api_version(&gunyah_api)); + return -ENODEV; + } + + return devm_of_platform_populate(&pdev->dev); +} + +static const struct of_device_id gunyah_of_match[] = { + { .compatible = "gunyah-hypervisor" }, + {} +}; +MODULE_DEVICE_TABLE(of, gunyah_of_match); + +/* clang-format off */ +static struct platform_driver gunyah_driver = { + .probe = gunyah_probe, + .driver = { + .name = "gunyah", + .of_match_table = gunyah_of_match, + } +}; +/* clang-format on */ +module_platform_driver(gunyah_driver); + +MODULE_LICENSE("GPL"); +MODULE_DESCRIPTION("Gunyah Driver");