Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp6089146rwd; Mon, 5 Jun 2023 12:53:18 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ5NhsjoHbr3e6Ng8UciGyh1lcjOkl+NYQ2LkNklxNgOTUz3dcxfAQ6cNRCm7/vMJqSHn73A X-Received: by 2002:a05:620a:204c:b0:75d:5407:d761 with SMTP id d12-20020a05620a204c00b0075d5407d761mr397304qka.39.1685994797872; Mon, 05 Jun 2023 12:53:17 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1685994797; cv=none; d=google.com; s=arc-20160816; b=RYzQ09dkxvWTMzhRJA/kM8WgT/EhKo7EAn/ZVAU6U9Hx7cTO/84CRXZXu4dgaR+qBj F8ZtwdWiPEnZXrtuJv3tdy+iM3ca5vQynjDA+o6jVACOZBNHWMS8Iwn9V1DLsqZq5zRB 8oNekq6IsfJ3cEi1SwvHZ8wKKEazmCxfq/B72zBWH4oY06r3CNqONP5ogqs1FFPRehwb neORETRwzdY8dFhx3jxKrRJiujrUA1JE4/LtrTmUq/7ztZa2+ym6s3PzLQTuMPN2JrY1 i/nSOIWJAPeAGSX/gr/J4hxJZwwZ7q2ny5M0snr+13DfUttPQ63J+OuDOMLPmQn/JDoQ +gJw== 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=h+VtIQmr/Eeizhg7ZG6ejVJVWApfxToiJ3FEXy8AU9k=; b=PBaMkBXNZ4fmDRO6iqtmMq4YNCGerdM07ZvQkE9Jm/AGooxypi9bFeSS09D1P8KZWj Rb5QC5b0kYOt11Bk4PkmoaC1qywvYNCy1S1dQij9tRXd3LSIK29tEXyCiIjAyKcJK6W7 YUKsc3j/6CPB2qopxmJPtYMrCCC9EoBvn9+l01PW5ZAxTq6RsiNpPFH12v99L2c1A1pJ /NY0Ujy4SMtOJ+bEdXK8cN+k8lRhK0XDF4FBEPMdNeSJYDRV94dQl8kCanWwG3LSQfh1 kEztNLMzfWlndftPChcW6eMX4Bfq9gjGl31Y7KjIgzyFstGoWMTIwvuQirPD3WlNenDF n+mQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=sOaoyOIH; 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 j26-20020a05620a001a00b00759057aa321si4855946qki.530.2023.06.05.12.53.01; Mon, 05 Jun 2023 12:53:17 -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=sOaoyOIH; 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 S235870AbjFETrh (ORCPT + 99 others); Mon, 5 Jun 2023 15:47:37 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55850 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235819AbjFETr2 (ORCPT ); Mon, 5 Jun 2023 15:47:28 -0400 Received: from mail-il1-x12e.google.com (mail-il1-x12e.google.com [IPv6:2607:f8b0:4864:20::12e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DE5E0197 for ; Mon, 5 Jun 2023 12:47:25 -0700 (PDT) Received: by mail-il1-x12e.google.com with SMTP id e9e14a558f8ab-33dae9244a1so4153445ab.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=TydGnJ8653lakpp7SrBZm6EEUienqpxIGX0o5lib/nSGZRpJT63MS6hYsfKd50YH18 foA9R9bTPZJRZFqV2plBmyJr1DQNrViCGYG9dNa24JMQuCYCjSpULvHqtFycpJRMAsFL 9aPQiUUP19BlOiXyOUDPnqwoz+VrJhhPtKy4ZHtRViZ+HmmEZ+yVgqwbZmNLAtR15vg4 ERGYIJomBKPkH3dsnGyqmSj6Wo/rN+hBj3ebVeTe7M3YnWW+yNeaZ9N70MmF4iYTuahI NQngupsmpyvYh/CnJmRZ+Nr9kKDzVyupRiirhhJtb19y2uZj1typOPP6RgvrIeyHaxwn LZyw== X-Gm-Message-State: AC+VfDxED4u+dR6kFcQEPa+mPdTGFOAKmXDLXOKzBiVCoYP+B2COib9Q 8zcWz0xvu/TTxQVW2SK9bwNs8g== 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 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 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