From nobody Mon Feb 9 13:58:55 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=none dis=none) header.from=linaro.org ARC-Seal: i=1; a=rsa-sha256; t=1677080066; cv=none; d=zohomail.com; s=zohoarc; b=LbjAeihqUY6iEC51dEAIwJvG65S4AGRzokcxbfHo6oV6KJncRlOF647l5N608MlxwGDRmytLSnjCYYJfzXyAUCSG/4cJjw+5wED0Hihj69Yd0KoRS4DMvfevXRQkkOa0rZVq3Od0CoE3nNShfxL3dHe3hDKOPjf5OhYdYDr6zaY= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1677080066; h=Content-Transfer-Encoding:Cc:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=qlRarVPuGGMxZJ7O9DysTL7l0g/2Vw4D9Z/5pFVB9eY=; b=kOONbyc7zwtbnpI36f/THR9hNpooRleKtMGpJJd8MbtCd7jLSeYH5Ap6CqKQ8SclEfJV3eoGzcgCVaJTVUmB3K2tCdvMdNNw8KGaChBV/nQF4U5Q2intO7Ow2jEpqRRPC0tYNH/u+rCYY9cGMvs2eMuRRf34/VuXeFQffTZfR0w= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=none dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 1677080066885672.6302095381529; Wed, 22 Feb 2023 07:34:26 -0800 (PST) Received: from list by lists.xenproject.org with outflank-mailman.499546.770779 (Exim 4.92) (envelope-from ) id 1pUr8A-0002st-RA; Wed, 22 Feb 2023 15:34:06 +0000 Received: by outflank-mailman (output) from mailman id 499546.770779; Wed, 22 Feb 2023 15:34:06 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pUr8A-0002oX-Aa; Wed, 22 Feb 2023 15:34:06 +0000 Received: by outflank-mailman (input) for mailman id 499546; Wed, 22 Feb 2023 15:34:04 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pUr87-0001MH-TG for xen-devel@lists.xenproject.org; Wed, 22 Feb 2023 15:34:04 +0000 Received: from mail-lf1-x12f.google.com (mail-lf1-x12f.google.com [2a00:1450:4864:20::12f]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 54c90f4c-b2c6-11ed-93b6-47a8fe42b414; Wed, 22 Feb 2023 16:34:01 +0100 (CET) Received: by mail-lf1-x12f.google.com with SMTP id m6so10601812lfq.5 for ; Wed, 22 Feb 2023 07:34:02 -0800 (PST) Received: from localhost.localdomain (h-46-59-78-111.A175.priv.bahnhof.se. [46.59.78.111]) by smtp.gmail.com with ESMTPSA id q9-20020ac25289000000b004db0d26adb4sm927746lfm.182.2023.02.22.07.34.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Feb 2023 07:34:01 -0800 (PST) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 54c90f4c-b2c6-11ed-93b6-47a8fe42b414 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=qlRarVPuGGMxZJ7O9DysTL7l0g/2Vw4D9Z/5pFVB9eY=; b=v6eOR64rfNhuETorAOP32Qsll4kvQB9Dgr24SH4+6NC8LyDPcWLA9Txni/P313Yu84 ijBsLthYJCWX8rLhn0AZ8WgHJiggxz0OGHcnjWi2ELDHpC2tyY5sjFg4SaKglJPE2y1c OobXeDx38ZOfnjIXy+5uSycUzKX7aEJpk3gHYsyDn4ocAJLGOMijC1kkxh69COT7r5Gv lH/yW2Ce/ylH/JdyjppsFcQtZ2pQyVQQXOWN8LdFvaqOMxYOXXRMBcpk3qDA3PhXE5oG Br/N22skns/Tggkr1hYsnjSxVvbB9YQGoa15L0qL5UuQ4A3ZVsDot0SudVgBewchl/1E FeMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=qlRarVPuGGMxZJ7O9DysTL7l0g/2Vw4D9Z/5pFVB9eY=; b=VVLb35Nd3O61M+MnaZxMV+/QwVY+l9eLgyzQNlZ/dIXXC0M52l/uB5QuLDx4+oNOQ7 3/lsmpmmkGsXZEVCCVtKMin+jAr2S+0KCJR+CR8AKjEvcTViYDdH8+oS3Wwfv1ubuBA4 AnLjA/+09bRvtLbcd3v7PpNNlCzhlapqgrLutiNPYbxi83phfw9ZilmoXRhEy5m+N5KZ 5KUi4BhTBxalYNWUk4JfVoGLO2q2xsP3BJ4WWytuRwiqSSZ0w4ZLTIGV6Znv3pk1Wxh6 ji9SM40NrZI8KeugFGMozAzWzDus1KDkqpgVtnlO3LcDpCcH6VFoLjrf1NS4Zp3UUeQu dvJQ== X-Gm-Message-State: AO0yUKVVqPs6MV5+NJfJGrqsnY4wl57gC359P/mF4AOs9faFPcFr3Irm nHwAHwKEXJ6+7l+TNNlTPKMX9QOSpETNd6RxMmQ= X-Google-Smtp-Source: AK7set/IEh/V1KX9mwsFk0gNb3edbAK94pykYyZvOLSlTnGOfCA8Xl0pLjrnvD6r9JW5sb3plOEDfA== X-Received: by 2002:ac2:4893:0:b0:4db:44e1:d8a1 with SMTP id x19-20020ac24893000000b004db44e1d8a1mr3484319lfc.0.1677080041867; Wed, 22 Feb 2023 07:34:01 -0800 (PST) From: Jens Wiklander To: xen-devel@lists.xenproject.org Cc: Bertrand.Marquis@arm.com, Marc Bonnici , Achin Gupta , Jens Wiklander , Volodymyr Babchuk , Stefano Stabellini , Julien Grall , Bertrand Marquis Subject: [XEN PATCH v7 09/20] xen/arm: ffa: add support for FFA_ID_GET Date: Wed, 22 Feb 2023 16:33:06 +0100 Message-Id: <82e4e0c3ac1614822fddd90336c22e6fad5b485e.1677079672.git.jens.wiklander@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @linaro.org) X-ZM-MESSAGEID: 1677080067249100003 Content-Type: text/plain; charset="utf-8" Adds support for the FF-A function FFA_ID_GET to return the ID of the calling client. Signed-off-by: Jens Wiklander --- xen/arch/arm/tee/ffa.c | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/xen/arch/arm/tee/ffa.c b/xen/arch/arm/tee/ffa.c index 8b0b80ce1ff5..463fd7730573 100644 --- a/xen/arch/arm/tee/ffa.c +++ b/xen/arch/arm/tee/ffa.c @@ -167,6 +167,12 @@ static bool ffa_get_version(uint32_t *vers) return true; } =20 +static uint16_t get_vm_id(const struct domain *d) +{ + /* +1 since 0 is reserved for the hypervisor in FF-A */ + return d->domain_id + 1; +} + static void set_regs(struct cpu_user_regs *regs, register_t v0, register_t= v1, register_t v2, register_t v3, register_t v4, register= _t v5, register_t v6, register_t v7) @@ -181,6 +187,12 @@ static void set_regs(struct cpu_user_regs *regs, regis= ter_t v0, register_t v1, set_user_reg(regs, 7, v7); } =20 +static void set_regs_success(struct cpu_user_regs *regs, uint32_t w2, + uint32_t w3) +{ + set_regs(regs, FFA_SUCCESS_32, 0, w2, w3, 0, 0, 0, 0); +} + static void handle_version(struct cpu_user_regs *regs) { struct domain *d =3D current->domain; @@ -210,6 +222,9 @@ static bool ffa_handle_call(struct cpu_user_regs *regs) case FFA_VERSION: handle_version(regs); return true; + case FFA_ID_GET: + set_regs_success(regs, get_vm_id(d), 0); + return true; =20 default: gprintk(XENLOG_ERR, "ffa: unhandled fid 0x%x\n", fid); @@ -221,7 +236,11 @@ static int ffa_domain_init(struct domain *d) { struct ffa_ctx *ctx; =20 - if ( !ffa_version ) + /* + * We can't use that last possible domain ID or get_vm_id() would cau= se + * an overflow. + */ + if ( !ffa_version || d->domain_id =3D=3D UINT16_MAX) return -ENODEV; =20 ctx =3D xzalloc(struct ffa_ctx); --=20 2.34.1