Received: by 2002:a05:6358:16cc:b0:ea:6187:17c9 with SMTP id r12csp8228917rwl; Tue, 10 Jan 2023 10:33:23 -0800 (PST) X-Google-Smtp-Source: AMrXdXvq6k/JSR6s3Z/IcDxHWJ2PTQvvHjhBEkt+UuVNkgttneM+T04PUFpJyXX3DD9/nlXxZar/ X-Received: by 2002:a05:6402:450f:b0:499:bf1b:5ee with SMTP id ez15-20020a056402450f00b00499bf1b05eemr6112683edb.6.1673375603365; Tue, 10 Jan 2023 10:33:23 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1673375603; cv=none; d=google.com; s=arc-20160816; b=sGb65H6i02tw39pRU0a7dsTIPUGg1fazOB+0FGPxnxvpGnJzm7mpv3EL4+9TMr5Hsb eBUoX+YEz4C7l53F2S2PhhIyDv4yZ96MmXDZPECFXsua568aNCC3TuLg0fi4bcESmegc BBzblBzIPRPJut2T6byGR/BjGnjikV0Fu0nUtNhycUaG9DAa6yhOGINkDxVgwqG+7xkR QWGovM2YNhQy2oFTT7QXtSxhFTVcVRcHKjX7y3Vjeg3W3FI+jqVFrPSu/ga+kCNhNG1W /C1zbSVEwNwkHp3DPeyKNjk4TvarqiQ6if/ZeJtXqXFGHm0gX9cTy3QxWOvj3dcwgWE/ an/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:in-reply-to :content-language:references:cc:to:subject:from:user-agent :mime-version:date:message-id:dkim-signature; bh=bsupJ31BTXkeH2VYmXxsRvepy5ZeRJ9/IKO65yE7UpE=; b=DLWoLOTRwEHn8WcP/R2xfH7PtK+Br7LOeKe6TWBXdGLCZW99kBIezMnyfTs21fB/Nj buIof2lkvq6J5FUJkTVcNj9D//iapPzvc4OpcJhB3QdJ+Edrwgn1lWFo90upnvGSUfnF jqAPUnybXt8kQqOqO1EPllAqKYNAPGVZHnMuqd9Y/JJ2Ao6TQvjpay0NC5Chp6mNCBZO xSQBq+F6P3/1hhlJFa79FW2njonlkMwrXItOeheoWcAPVSW09UZmQ/MaxXnF/klaZqLK 8OOfnzlGesBkg6oxdZoMD1+fzDkKinkJug8lU7isi+PO59IgqGy70/LtCTqMeeFJRTKo i0Wg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=HXoVjoNb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id r8-20020a508d88000000b00489d3d09accsi12401547edh.247.2023.01.10.10.33.10; Tue, 10 Jan 2023 10:33:23 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcppdkim1 header.b=HXoVjoNb; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S238373AbjAJR4N (ORCPT + 53 others); Tue, 10 Jan 2023 12:56:13 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40096 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234149AbjAJRzr (ORCPT ); Tue, 10 Jan 2023 12:55:47 -0500 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BF5907CDD2; Tue, 10 Jan 2023 09:55:25 -0800 (PST) Received: from pps.filterd (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.17.1.19/8.17.1.19) with ESMTP id 30ACiPdM011158; Tue, 10 Jan 2023 17:55:12 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; h=message-id : date : mime-version : from : subject : to : cc : references : in-reply-to : content-type : content-transfer-encoding; s=qcppdkim1; bh=bsupJ31BTXkeH2VYmXxsRvepy5ZeRJ9/IKO65yE7UpE=; b=HXoVjoNbBfKDiDR9WeJswAlmV/IfVjBCUpWk5PeVrOCLPTjtNb3pprUWnMqwVbsYbdta eSaipPBEMniEd1OEoFhDPD8LA6P7sB834rAUk/lwgRvGgWS8V0q2RcsvceZkR3arGPvV wE5FBfjcsjYWisgvZu3cYACHPCALhD2dWk5xZ1Nab7APP8qsIf/8qA+GHjkDky/Y2ofY J1aMXevyjWCl3+mCbxSAPlk7PGc97cFLgrSuoH+tECAOtaUsBZniyIRG2k1n2zYm5Xkg GBiDjJ2paJPAaJiT8gn8Fn1CyJfqxR3L3WI6OkIB3Rhu6gkCR6XMtyC9gnxJUlxN9Cyp qA== Received: from nasanppmta02.qualcomm.com (i-global254.qualcomm.com [199.106.103.254]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 3n0q28jpye-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 10 Jan 2023 17:55:12 +0000 Received: from nasanex01b.na.qualcomm.com (corens_vlan604_snip.qualcomm.com [10.53.140.1]) by NASANPPMTA02.qualcomm.com (8.17.1.5/8.17.1.5) with ESMTPS id 30AHtBvN027679 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 10 Jan 2023 17:55:11 GMT Received: from [10.134.67.48] (10.80.80.8) 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.986.36; Tue, 10 Jan 2023 09:55:10 -0800 Message-ID: <29dc78ee-1eaa-7e3d-f28c-07a6b60ed2b2@quicinc.com> Date: Tue, 10 Jan 2023 09:55:10 -0800 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:102.0) Gecko/20100101 Thunderbird/102.6.0 From: Elliot Berman Subject: Re: [PATCH v8 03/28] gunyah: Common types and error codes for Gunyah hypercalls To: Alex Elder , Bjorn Andersson , Murali Nalajala CC: Trilok Soni , Srivatsa Vaddagiri , Carl van Schaik , Prakruthi Deepak Heragu , Arnd Bergmann , Greg Kroah-Hartman , Rob Herring , Krzysztof Kozlowski , Jonathan Corbet , "Bagas Sanjaya" , Catalin Marinas , Will Deacon , Jassi Brar , "Sudeep Holla" , Mark Rutland , "Lorenzo Pieralisi" , Dmitry Baryshkov , , , , , , References: <20221219225850.2397345-1-quic_eberman@quicinc.com> <20221219225850.2397345-4-quic_eberman@quicinc.com> <14eba2db-6f35-8b29-2b5e-6f1937b4e318@linaro.org> Content-Language: en-US In-Reply-To: <14eba2db-6f35-8b29-2b5e-6f1937b4e318@linaro.org> Content-Type: text/plain; charset="UTF-8"; format=flowed Content-Transfer-Encoding: 8bit X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) 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: gUZNVjMhzUxr0FbWf7flWmBnOhmDvJWQ X-Proofpoint-GUID: gUZNVjMhzUxr0FbWf7flWmBnOhmDvJWQ X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.205,Aquarius:18.0.923,Hydra:6.0.545,FMLib:17.11.122.1 definitions=2023-01-10_07,2023-01-10_03,2022-06-22_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 phishscore=0 bulkscore=0 lowpriorityscore=0 mlxlogscore=921 malwarescore=0 suspectscore=0 adultscore=0 spamscore=0 impostorscore=0 clxscore=1015 priorityscore=1501 mlxscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2212070000 definitions=main-2301100115 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_LOW, SPF_HELO_NONE,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 1/9/2023 1:34 PM, Alex Elder wrote: > On 12/19/22 4:58 PM, Elliot Berman wrote: >> Add architecture-independent standard error codes, types, and macros for >> Gunyah hypercalls. >> >> Reviewed-by: Dmitry Baryshkov >> Signed-off-by: Elliot Berman >> --- >>   MAINTAINERS            |  1 + >>   include/linux/gunyah.h | 74 ++++++++++++++++++++++++++++++++++++++++++ >>   2 files changed, 75 insertions(+) >>   create mode 100644 include/linux/gunyah.h >> >> diff --git a/MAINTAINERS b/MAINTAINERS >> index f32320a9efa4..74e76e0ab14d 100644 >> --- a/MAINTAINERS >> +++ b/MAINTAINERS >> @@ -8941,6 +8941,7 @@ L:    linux-arm-msm@vger.kernel.org >>   S:    Supported >>   F:    Documentation/devicetree/bindings/firmware/gunyah-hypervisor.yaml >>   F:    Documentation/virt/gunyah/ >> +F:    include/linux/gunyah.h >>   HABANALABS PCI DRIVER >>   M:    Oded Gabbay >> diff --git a/include/linux/gunyah.h b/include/linux/gunyah.h >> new file mode 100644 >> index 000000000000..824e20a11d27 >> --- /dev/null >> +++ b/include/linux/gunyah.h >> @@ -0,0 +1,74 @@ >> +/* SPDX-License-Identifier: GPL-2.0-only */ >> +/* >> + * Copyright (c) 2022 Qualcomm Innovation Center, Inc. All rights >> reserved. >> + */ >> + >> +#ifndef _GUNYAH_H > > Maybe use _LINUX_GUNYAH_H? > Ack. >> +#define _GUNYAH_H >> + >> +#include > > Why is types.h included? > > U64_MAX is defined in (in case that's why). Ack. > > Otherwise this just defines a fixed API exposed by Gunyah > so there's not much more for me to comment on. > >                     -Alex > >> +#include >> + >> +/* Common Gunyah macros */ >> +#define GH_CAPID_INVAL    U64_MAX >> +#define GH_VMID_ROOT_VM    0xff >> + >> +#define GH_ERROR_OK            0 >> + >> +#define GH_ERROR_UNIMPLEMENTED        -1 >> +#define GH_ERROR_RETRY            -2 >> + >> +#define GH_ERROR_ARG_INVAL        1 >> +#define GH_ERROR_ARG_SIZE        2 >> +#define GH_ERROR_ARG_ALIGN        3 >> + >> +#define GH_ERROR_NOMEM            10 >> + >> +#define GH_ERROR_ADDR_OVFL        20 >> +#define GH_ERROR_ADDR_UNFL        21 >> +#define GH_ERROR_ADDR_INVAL        22 >> + >> +#define GH_ERROR_DENIED            30 >> +#define GH_ERROR_BUSY            31 >> +#define GH_ERROR_IDLE            32 >> + >> +#define GH_ERROR_IRQ_BOUND        40 >> +#define GH_ERROR_IRQ_UNBOUND        41 >> + >> +#define GH_ERROR_CSPACE_CAP_NULL    50 >> +#define GH_ERROR_CSPACE_CAP_REVOKED    51 >> +#define GH_ERROR_CSPACE_WRONG_OBJ_TYPE    52 >> +#define GH_ERROR_CSPACE_INSUF_RIGHTS    53 >> +#define GH_ERROR_CSPACE_FULL        54 >> + >> +#define GH_ERROR_MSGQUEUE_EMPTY        60 >> +#define GH_ERROR_MSGQUEUE_FULL        61 >> + >> +static inline int gh_remap_error(int gh_error) >> +{ >> +    switch (gh_error) { >> +    case GH_ERROR_OK: >> +        return 0; >> +    case GH_ERROR_NOMEM: >> +        return -ENOMEM; >> +    case GH_ERROR_DENIED: >> +    case GH_ERROR_CSPACE_CAP_NULL: >> +    case GH_ERROR_CSPACE_CAP_REVOKED: >> +    case GH_ERROR_CSPACE_WRONG_OBJ_TYPE: >> +    case GH_ERROR_CSPACE_INSUF_RIGHTS: >> +    case GH_ERROR_CSPACE_FULL: >> +        return -EACCES; >> +    case GH_ERROR_BUSY: >> +    case GH_ERROR_IDLE: >> +        return -EBUSY; >> +    case GH_ERROR_IRQ_BOUND: >> +    case GH_ERROR_IRQ_UNBOUND: >> +    case GH_ERROR_MSGQUEUE_FULL: >> +    case GH_ERROR_MSGQUEUE_EMPTY: >> +        return -EPERM; >> +    default: >> +        return -EINVAL; >> +    } >> +} >> + >> +#endif >