Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp6192942rwd; Mon, 5 Jun 2023 14:39:53 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ7KwSt25cV+JtXRoGA9JpMHkMtS5btTIIoObdMg8sRERUeOMC7KvgpK1Kibwf1G/DcIBQNM X-Received: by 2002:a05:6358:bba0:b0:129:b9f4:6d43 with SMTP id df32-20020a056358bba000b00129b9f46d43mr259657rwb.30.1686001193153; Mon, 05 Jun 2023 14:39:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1686001193; cv=none; d=google.com; s=arc-20160816; b=Yh70T7PARkGBCaldrQX6miJrfCJYiNo+r7yPjUf/r6uOTfF+bEHRnTSNEFCPK2JmII ppRIe6iKR2P4si+JAI8XdILsCgHsfflO4n82p/8ygCqQcEY7L39WR2z2UkJaAX95Ef7S rMXuBpfALvsgsRrPa/H5p524YWrYbzI5wYuwYyv6DGz6X/VeUfwir/+c7UWS99Kqa8Oy wCYRCKhGYLV1H/QrRqA1//aEr1JOBmbPWsIkUrdLDxJhGpUb8ovFypIItQlhV+fPvD8J ga9+mMX7vtfGBAfSoNOf1eFerCaU4Bxy/I3VaqTQjWJbk+JYDM4VVSAgTruva8yvGybK vFJw== 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:from :references:cc:to:content-language:subject:user-agent:mime-version :date:message-id:dkim-signature; bh=vsMxNf5Vwnvm2j+EraOyZ9qeS4I0RPX8I6SvaUZOdto=; b=qCarQdPxBY+h6T2SIWn51StCJLCcdrt9p8E8ZeuApupZlRhA4HXdqFTyD7ZihxiT8I F4QwhT8cdNxyx+LmL4JcvYTGx/1wVvTyW7kptQb6o/joT2x8zAedNqx3g+Usv/phdNLP NspJxhwazed72hcfkuysKP+qMbJ1Bja2FSBr5QcnrDEl0xV0zfz9E9Ef45/0qaHYgFmt 275GQ31plI33ZRchW1GuuXYJcFSkTpOCDcIiEN12vdNAyXROtj2tV6uY18zVCQ/5cFLh x8W1vjoYSBzs1n70NYV6GzRrsCLMnTbuojj4yS9c1ftohauRo6RSdNXr4bQ/xsAeFpEN SUJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HlPR1u+9; 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=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q7-20020a17090a1b0700b00259224a9d67si3563644pjq.167.2023.06.05.14.39.40; Mon, 05 Jun 2023 14:39:53 -0700 (PDT) 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=@linaro.org header.s=google header.b=HlPR1u+9; 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=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231936AbjFEVcD (ORCPT + 99 others); Mon, 5 Jun 2023 17:32:03 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45564 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231420AbjFEVbw (ORCPT ); Mon, 5 Jun 2023 17:31:52 -0400 Received: from mail-wm1-x333.google.com (mail-wm1-x333.google.com [IPv6:2a00:1450:4864:20::333]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E958DF9 for ; Mon, 5 Jun 2023 14:31:49 -0700 (PDT) Received: by mail-wm1-x333.google.com with SMTP id 5b1f17b1804b1-3f6ffc2b314so46700755e9.0 for ; Mon, 05 Jun 2023 14:31:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1686000708; x=1688592708; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :from:to:cc:subject:date:message-id:reply-to; bh=vsMxNf5Vwnvm2j+EraOyZ9qeS4I0RPX8I6SvaUZOdto=; b=HlPR1u+9slU6Kh0sKqpFxjLqAhj3HVgrM5rhkeVdQzg+ltKR7EjgTtrIsKCe3n9y93 pNyT45KPRtzDHaC4zX4ffuzdhyE0a5W37rBANoOQaFuCeblYnozvrtA2hlUw3PrwNzIf YhIxUIbFtyC92xac1lgdQ0zXVqUCaxOEsX72Tk+O3UsP9sNPUOGzzjVPB2bneZ+UiVob E2pK/G1qKpvsmB4CvO8TvDkP2B53bbi/4AN4dhjFZhnq7T7nOVtt68guUXGQqkvddmDH uYduFaoiEJbzE2y0+ltWXjSIR0gmkws4abvzQ4zzO8nDAIaHD48A3TUZnlMJWbsmoyEZ x5dw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1686000708; x=1688592708; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=vsMxNf5Vwnvm2j+EraOyZ9qeS4I0RPX8I6SvaUZOdto=; b=lcBiGvIWn2Os7OPkGkfNeT98p7sTyjl7bc9aQnUsRBGZ/ICftwnQAU4voQRCmEPeEC IeMDL6nENnO4sAhfwDWYvZuWz3CVtpkZd+Ik6kwQCqvK8617v67LsCJcNTmzMErnyond vBmbD33FzAtBYEdc86MV8eUgviLJkD2+S1bMsQDhOY+mzUmN6oOgBP5XK3BaxySULfl3 vCsBJc6tTYWE7dl9iMq6G1XHBAB1EjazzRpecTbYgFK3OU5fsJoZovgkBjM5gzpNSF6D iFGZKPbWoadQ/ygpB2B7eEGAF4O74ZDtWzD97ZUUgxlw3tA+99rOd7p7vvaVyBhghGHI XCUw== X-Gm-Message-State: AC+VfDyBR2b1cB3vch7jR97O1sTvkrfsV2m+ZxZR1CZWw0QYwKDzyfQx x78ZakHuSIXAZKwzC21H7D9FKA== X-Received: by 2002:a05:600c:1d98:b0:3f7:367a:38cb with SMTP id p24-20020a05600c1d9800b003f7367a38cbmr4859123wms.2.1686000708386; Mon, 05 Jun 2023 14:31:48 -0700 (PDT) Received: from [192.168.1.195] ([5.133.47.210]) by smtp.googlemail.com with ESMTPSA id j27-20020a05600c1c1b00b003f4283f5c1bsm398001wms.2.2023.06.05.14.31.46 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 05 Jun 2023 14:31:47 -0700 (PDT) Message-ID: <29c5ffd5-6300-4fa5-f391-fc0b7ac97831@linaro.org> Date: Mon, 5 Jun 2023 22:31:46 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 Subject: Re: [PATCH v13 02/24] gunyah: Common types and error codes for Gunyah hypercalls Content-Language: en-US To: Elliot Berman , Alex Elder , Prakruthi Deepak Heragu Cc: Murali Nalajala , Trilok Soni , Srivatsa Vaddagiri , Carl van Schaik , Dmitry Baryshkov , Bjorn Andersson , Konrad Dybcio , Arnd Bergmann , Greg Kroah-Hartman , Rob Herring , Krzysztof Kozlowski , Jonathan Corbet , Bagas Sanjaya , Will Deacon , Andy Gross , Catalin Marinas , Jassi Brar , linux-arm-msm@vger.kernel.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, linux-arm-kernel@lists.infradead.org References: <20230509204801.2824351-1-quic_eberman@quicinc.com> <20230509204801.2824351-3-quic_eberman@quicinc.com> From: Srinivas Kandagatla In-Reply-To: <20230509204801.2824351-3-quic_eberman@quicinc.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-2.2 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,NICE_REPLY_A,RCVD_IN_DNSWL_NONE, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=unavailable 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 09/05/2023 21:47, Elliot Berman wrote: > Add architecture-independent standard error codes, types, and macros for > Gunyah hypercalls. > > Reviewed-by: Dmitry Baryshkov > Signed-off-by: Elliot Berman > --- lgtm, Reviewed-by: Srinivas Kandagatla --srini > include/linux/gunyah.h | 83 ++++++++++++++++++++++++++++++++++++++++++ > 1 file changed, 83 insertions(+) > create mode 100644 include/linux/gunyah.h > > diff --git a/include/linux/gunyah.h b/include/linux/gunyah.h > new file mode 100644 > index 000000000000..a4e8ec91961d > --- /dev/null > +++ b/include/linux/gunyah.h > @@ -0,0 +1,83 @@ > +/* SPDX-License-Identifier: GPL-2.0-only */ > +/* > + * Copyright (c) 2022-2023 Qualcomm Innovation Center, Inc. All rights reserved. > + */ > + > +#ifndef _LINUX_GUNYAH_H > +#define _LINUX_GUNYAH_H > + > +#include > +#include > + > +/******************************************************************************/ > +/* Common arch-independent definitions for Gunyah hypercalls */ > +#define GH_CAPID_INVAL U64_MAX > +#define GH_VMID_ROOT_VM 0xff > + > +enum gh_error { > + GH_ERROR_OK = 0, > + GH_ERROR_UNIMPLEMENTED = -1, > + GH_ERROR_RETRY = -2, > + > + GH_ERROR_ARG_INVAL = 1, > + GH_ERROR_ARG_SIZE = 2, > + GH_ERROR_ARG_ALIGN = 3, > + > + GH_ERROR_NOMEM = 10, > + > + GH_ERROR_ADDR_OVFL = 20, > + GH_ERROR_ADDR_UNFL = 21, > + GH_ERROR_ADDR_INVAL = 22, > + > + GH_ERROR_DENIED = 30, > + GH_ERROR_BUSY = 31, > + GH_ERROR_IDLE = 32, > + > + GH_ERROR_IRQ_BOUND = 40, > + GH_ERROR_IRQ_UNBOUND = 41, > + > + GH_ERROR_CSPACE_CAP_NULL = 50, > + GH_ERROR_CSPACE_CAP_REVOKED = 51, > + GH_ERROR_CSPACE_WRONG_OBJ_TYPE = 52, > + GH_ERROR_CSPACE_INSUF_RIGHTS = 53, > + GH_ERROR_CSPACE_FULL = 54, > + > + GH_ERROR_MSGQUEUE_EMPTY = 60, > + GH_ERROR_MSGQUEUE_FULL = 61, > +}; > + > +/** > + * gh_error_remap() - Remap Gunyah hypervisor errors into a Linux error code > + * @gh_error: Gunyah hypercall return value > + */ > +static inline int gh_error_remap(enum gh_error 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 -EIO; > + case GH_ERROR_UNIMPLEMENTED: > + case GH_ERROR_RETRY: > + return -EOPNOTSUPP; > + default: > + return -EINVAL; > + } > +} > + > +#endif