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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9BBDDC7EE2A for ; Mon, 5 Jun 2023 19:47:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S235858AbjFETrg (ORCPT ); Mon, 5 Jun 2023 15:47:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55882 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235845AbjFETr2 (ORCPT ); Mon, 5 Jun 2023 15:47:28 -0400 Received: from mail-il1-x136.google.com (mail-il1-x136.google.com [IPv6:2607:f8b0:4864:20::136]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DE478187 for ; Mon, 5 Jun 2023 12:47:25 -0700 (PDT) Received: by mail-il1-x136.google.com with SMTP id e9e14a558f8ab-33b4552e55cso16128425ab.0 for ; Mon, 05 Jun 2023 12:47:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1685994445; x=1688586445; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:subject:from:user-agent:mime-version:date:message-id:from:to :cc:subject:date:message-id:reply-to; bh=h+VtIQmr/Eeizhg7ZG6ejVJVWApfxToiJ3FEXy8AU9k=; b=sOaoyOIHM4FXhqKBIiG/CIsBhjefYzL1IPfWlM8YtiHfkgHNosl2yanqlPNLsnLH6A j11lr1wnu0TQ39nYOnrrAZEcm+rnawjCFSl41PNYIseKmjkabmDUuI0/Xw0SNs28Y2Tt 9BV5rSkuzTPKQtOuQSoSdRVwPoIR9eniL7YL/brn3Qy3HhMXiXYd/qodKEARxEndxk/i nsnsHYnEln18AZ5x0EpGVwD9fJnWvbhxRg6xm1ny9CznYT98RCXMWGOXY7ZChSUhWYnn 1rWHdtNIhzeaIRvONK528Z0u1owlGxzAwCx6zFEUlzqcEd5BiFgrvIxwLR17jskj2hdY ZjJg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1685994445; x=1688586445; h=content-transfer-encoding:in-reply-to:content-language:references :cc:to:subject:from:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=h+VtIQmr/Eeizhg7ZG6ejVJVWApfxToiJ3FEXy8AU9k=; b=YbL/tcwOcpnx5MD7PlOakhtJ/Gt3zTaHYN9GTdrT/VXHm4l9OBLpnAbmAQltZOwjlq URyOY15VyPaCvB8H8xemLh8dO2uaD7iDzbDsTNDOoL8odo4IG7EB/xNimR3TGIwOb2vj vKhA85zv6+AuceR4H6udRoVEC9nufbOe4/vbadqEZwFoyYNxd7TKUguaudo8n0EZGcUr r9uIH9Cvdgqoa0Pe8B2cckgrVokNHWwZ/z7nfdYCtilVWJQAvSC6Lts+hTyos70gjAhg EFduG7DP3qunKR4aOnBBtjnBemkAwjaOGwfy9oBUyTCKo5mjawEISDHvtMnyZ+CCBM0P R6Yw== X-Gm-Message-State: AC+VfDzDSUsRIi4IexYL6y25JB2ir+MqBqcKKi3T8Pquyzat3XD0VLc2 19CaN7hEf1eWrBFvWjbYWQ7PJQ== X-Google-Smtp-Source: ACHHUZ40pfQLbMRvSs+oQ7vQ5RcmMWCR5fFuOXEI2OnsBSPojFMo4PN2TeNiR0UYiEyNF01UZGFGIQ== X-Received: by 2002:a05:6e02:1a4b:b0:33a:a77d:3072 with SMTP id u11-20020a056e021a4b00b0033aa77d3072mr483235ilv.7.1685994445204; Mon, 05 Jun 2023 12:47:25 -0700 (PDT) Received: from [172.22.22.28] ([98.61.227.136]) by smtp.gmail.com with ESMTPSA id u10-20020a02c04a000000b004167410a9bcsm654180jam.113.2023.06.05.12.47.23 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 05 Jun 2023 12:47:24 -0700 (PDT) Message-ID: <44084cbf-7aaf-3e15-9bef-85f4a84381f0@linaro.org> Date: Mon, 5 Jun 2023 14:47:23 -0500 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.11.0 From: Alex Elder Subject: Re: [PATCH v13 02/24] gunyah: Common types and error codes for Gunyah hypercalls To: Elliot Berman , Srinivas Kandagatla , 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> Content-Language: en-US In-Reply-To: <20230509204801.2824351-3-quic_eberman@quicinc.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Precedence: bulk List-ID: X-Mailing-List: linux-doc@vger.kernel.org On 5/9/23 3:47 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 Looks OK to me. Reviewed-by: Alex Elder > --- > 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, I know you explained it "should be OK" to use a negative value (with unspecified bit width) here. I continue to feel it's not well-enough specified for an external API, but I'm going to try to just let it go. > + 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