Received: by 2002:a05:7412:e794:b0:fa:551:50a7 with SMTP id o20csp548299rdd; Tue, 9 Jan 2024 11:53:04 -0800 (PST) X-Google-Smtp-Source: AGHT+IG6c3JCDMrFwyWKWi2ehDRjxj2AmdAEkXs2GSCaFAes5lriy8ju/u/3UKg+eoYsSpLJMnad X-Received: by 2002:a50:ab5e:0:b0:554:2ade:6bbc with SMTP id t30-20020a50ab5e000000b005542ade6bbcmr3423557edc.31.1704829983905; Tue, 09 Jan 2024 11:53:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1704829983; cv=none; d=google.com; s=arc-20160816; b=LnwQ48uNdoyVCv3lMGYODUs76fAfcQ7qQ1FvTfBIJ5KiYjXkYjli7JS724Jor2V82k 2q72RU0yaKXkq61QZcmiuiFEBUPv+GDnMptREmBI2Z5P3lJAfA5OTKtrB1cjrIpmcUpz iBAQAcZVju9GlB7lTk/mMlF7JdD+3tmixwf3nI8JP2/ha4EFEK416MKAiGfBdCeCthfI InuJfdY5fS7hzp0SA5a5ZjnFoCYcn8ydSYrZ6xEG9oTF3smOoGDnMOFNampKgBaA5eZd Hiu7GKzRxpzrVi7SsbApO/McjkMoB1sZotu+TRE+Nn97loIFm22ZtgpshC/hPNDuMni6 YpcA== ARC-Message-Signature: i=1; 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=O0LTS8afF6938T/lQfplnM+8ELHnWjzwe6A6+1vfdHw=; fh=j53ffieBeHmuArQHAkiXDczYOIriM+Jf92hqYE3BW8U=; b=CwIz95zKhaxSDEFIs3XWhhX77ju/nKFWw/+9KXcsePTuRlL1rqV0IQQ72MaAXv0Jdp WmRGDVFJUiOQxdkfZdPtyqPKs4Z4XLeIlioAkdGlX1ycEJhI08C/JYu79lVsmt/+LTfa E8e+V7f3ePsmBIUQIXQfnL4XxjoYq1eDlCxpg/LIM3oC13r3sWNL1PwFlDnbmMclHNHO Ne3D0p0hPambdH4sSMMWyjRaUbWbdFmvryt0qW5HOOsFxC04LHmEcinwO/YIpHKS/w2e 8lPsM7uP8MGKsgXHus8m7csrHDoCOAUHmKEIuRD6+s5QloAHLpmJiABkX5Ezn+JSsEg2 vIRQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=claOXthq; spf=pass (google.com: domain of linux-kernel+bounces-21346-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-21346-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id y100-20020a50bb6d000000b005579c67fdffsi1005587ede.304.2024.01.09.11.53.03 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 09 Jan 2024 11:53:03 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-21346-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=claOXthq; spf=pass (google.com: domain of linux-kernel+bounces-21346-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-21346-linux.lists.archive=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 am.mirrors.kernel.org (Postfix) with ESMTPS id 52C531F29C3D for ; Tue, 9 Jan 2024 19:44:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id CA0A9481BC; Tue, 9 Jan 2024 19:38:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=quicinc.com header.i=@quicinc.com header.b="claOXthq" Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.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 AB7C54776D; Tue, 9 Jan 2024 19:38:29 +0000 (UTC) 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 (m0279862.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.24/8.17.1.24) with ESMTP id 409Ik2LF020971; Tue, 9 Jan 2024 19:38:09 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=O0LTS8afF6938T/lQfplnM+8ELHnWjzwe6A6+1vfdHw =; b=claOXthqjhDnvl4cB5HE5bAjfN2ymsPboQB9NJGN3MQOcOErbzT1GIMudKB hNfHsz+SVvtgg3h2/7Eie/+9wleuSNBTiQE/pAebqiF1Hq4ZbB7udWqqI/tzg9gr CVcG5Z53O3tiA+E2k+2nK2KwKPP0C96pUkwlsCMMuzdfW9tCUP9E0AexLk5EKn5k jRWhYtIJhwmfmqA/BsWXkGJPbUJpqFYwaQqMW/3xvaaL8fSWabygVNSLRb46bDg/ TzbMjxBlVjsZL2aGHKmAJ0x7ar1iawUEVonUh4BtDLm/aeVEPbcIXfjTV8tOBXas k6+R1O4FGr3KNj7yKRblVaRYcZw== Received: from nasanppmta05.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3vh3me185q-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 09 Jan 2024 19:38:09 +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 409Jc9DV024695 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 9 Jan 2024 19:38:09 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; Tue, 9 Jan 2024 11:38:08 -0800 From: Elliot Berman Date: Tue, 9 Jan 2024 11:38:08 -0800 Subject: [PATCH v16 30/34] virt: gunyah: Add hypercalls for sending doorbell Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit Message-ID: <20240109-gunyah-v16-30-634904bf4ce9@quicinc.com> References: <20240109-gunyah-v16-0-634904bf4ce9@quicinc.com> In-Reply-To: <20240109-gunyah-v16-0-634904bf4ce9@quicinc.com> To: Alex Elder , Srinivas Kandagatla , Murali Nalajal , Trilok Soni , Srivatsa Vaddagiri , Carl van Schaik , Philip Derrin , Prakruthi Deepak Heragu , Jonathan Corbet , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Catalin Marinas , Will Deacon , Konrad Dybcio , Bjorn Andersson , Dmitry Baryshkov , "Fuad Tabba" , Sean Christopherson , "Andrew Morton" CC: , , , , , , Elliot Berman X-Mailer: b4 0.13-dev 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: 6mB1HQ53TyGWybWApgoJAF8XcYPAkg4i X-Proofpoint-GUID: 6mB1HQ53TyGWybWApgoJAF8XcYPAkg4i X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.272,Aquarius:18.0.997,Hydra:6.0.619,FMLib:17.11.176.26 definitions=2023-12-09_01,2023-12-07_01,2023-05-22_02 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 spamscore=0 priorityscore=1501 mlxlogscore=605 lowpriorityscore=0 mlxscore=0 suspectscore=0 impostorscore=0 clxscore=1015 adultscore=0 malwarescore=0 bulkscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.19.0-2311290000 definitions=main-2401090158 Gunyah doorbells allow a virtual machine to signal another using interrupts. Add the hypercalls needed to assert the interrupt. Reviewed-by: Alex Elder Signed-off-by: Elliot Berman --- arch/arm64/gunyah/gunyah_hypercall.c | 38 ++++++++++++++++++++++++++++++++++++ include/linux/gunyah.h | 5 +++++ 2 files changed, 43 insertions(+) diff --git a/arch/arm64/gunyah/gunyah_hypercall.c b/arch/arm64/gunyah/gunyah_hypercall.c index 38403dc28c66..3c2672d683ae 100644 --- a/arch/arm64/gunyah/gunyah_hypercall.c +++ b/arch/arm64/gunyah/gunyah_hypercall.c @@ -37,6 +37,8 @@ EXPORT_SYMBOL_GPL(arch_is_gunyah_guest); /* clang-format off */ #define GUNYAH_HYPERCALL_HYP_IDENTIFY GUNYAH_HYPERCALL(0x8000) +#define GUNYAH_HYPERCALL_BELL_SEND GUNYAH_HYPERCALL(0x8012) +#define GUNYAH_HYPERCALL_BELL_SET_MASK GUNYAH_HYPERCALL(0x8015) #define GUNYAH_HYPERCALL_MSGQ_SEND GUNYAH_HYPERCALL(0x801B) #define GUNYAH_HYPERCALL_MSGQ_RECV GUNYAH_HYPERCALL(0x801C) #define GUNYAH_HYPERCALL_ADDRSPACE_MAP GUNYAH_HYPERCALL(0x802B) @@ -64,6 +66,42 @@ void gunyah_hypercall_hyp_identify( } EXPORT_SYMBOL_GPL(gunyah_hypercall_hyp_identify); +/** + * gunyah_hypercall_bell_send() - Assert a gunyah doorbell + * @capid: capability ID of the doorbell + * @new_flags: bits to set on the doorbell + * @old_flags: Filled with the bits set before the send call if return value is GUNYAH_ERROR_OK + */ +enum gunyah_error gunyah_hypercall_bell_send(u64 capid, u64 new_flags, u64 *old_flags) +{ + struct arm_smccc_res res; + + arm_smccc_1_1_hvc(GUNYAH_HYPERCALL_BELL_SEND, capid, new_flags, 0, &res); + + if (res.a0 == GUNYAH_ERROR_OK && old_flags) + *old_flags = res.a1; + + return res.a0; +} +EXPORT_SYMBOL_GPL(gunyah_hypercall_bell_send); + +/** + * gunyah_hypercall_bell_set_mask() - Set masks on a Gunyah doorbell + * @capid: capability ID of the doorbell + * @enable_mask: which bits trigger the receiver interrupt + * @ack_mask: which bits are automatically acknowledged when the receiver + * interrupt is ack'd + */ +enum gunyah_error gunyah_hypercall_bell_set_mask(u64 capid, u64 enable_mask, u64 ack_mask) +{ + struct arm_smccc_res res; + + arm_smccc_1_1_hvc(GUNYAH_HYPERCALL_BELL_SET_MASK, capid, enable_mask, ack_mask, 0, &res); + + return res.a0; +} +EXPORT_SYMBOL_GPL(gunyah_hypercall_bell_set_mask); + /** * gunyah_hypercall_msgq_send() - Send a buffer on a message queue * @capid: capability ID of the message queue to add message diff --git a/include/linux/gunyah.h b/include/linux/gunyah.h index 32ce578220ca..67cb9350ab9e 100644 --- a/include/linux/gunyah.h +++ b/include/linux/gunyah.h @@ -346,6 +346,11 @@ gunyah_api_version(const struct gunyah_hypercall_hyp_identify_resp *gunyah_api) void gunyah_hypercall_hyp_identify( struct gunyah_hypercall_hyp_identify_resp *hyp_identity); +enum gunyah_error gunyah_hypercall_bell_send(u64 capid, u64 new_flags, + u64 *old_flags); +enum gunyah_error gunyah_hypercall_bell_set_mask(u64 capid, u64 enable_mask, + u64 ack_mask); + /* Immediately raise RX vIRQ on receiver VM */ #define GUNYAH_HYPERCALL_MSGQ_TX_FLAGS_PUSH BIT(0) -- 2.34.1