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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id D759CC25B78 for ; Wed, 15 May 2024 17:23:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:From:Subject:Message-ID: References:Mime-Version:In-Reply-To:Date:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=rP90K3K/X/ee6prGW8OAiA7QG4MNG6xhdRmZ8tfvI+c=; b=I++HLBz1VN1Vx6Ce37GGljfMm2 1PO3kCm2MZvIxE+FQKusPqEhroGoMZ38+r0bNpMqyRfxvFf6qhfFzmJmznq9uKXcxMcXFJfkbmkqB OELCWdejnH/e0trtovw/nU1CDi3/nMHSTYE9D9nRwsLsmrk3nG3Kz6v96vHDgphQ796j2wizppPAC r/UcQoxqsPFcvQK54jaj0JsiX1qE0WeYhYr1vw7ztXwseguA1wZR/uyD0vLCc27357pkZ0/8UetNK sDvrc2JbKDxcKfs82TTkBzmeSTBPlqXpCvy7jlxVTowiou2TB6pBzuDL+fuKD2KVGyEC4g1VeyYIz lhxYFBDQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1s7ILs-00000002NG7-39EW; Wed, 15 May 2024 17:23:40 +0000 Received: from mail-wm1-f73.google.com ([209.85.128.73]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1s7ILY-00000002N2b-3YvG for linux-arm-kernel@lists.infradead.org; Wed, 15 May 2024 17:23:33 +0000 Received: by mail-wm1-f73.google.com with SMTP id 5b1f17b1804b1-4200ef4fb81so22587825e9.1 for ; Wed, 15 May 2024 10:23:18 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1715793797; x=1716398597; darn=lists.infradead.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=9HVNMjO2akSMcTTiBfbdxnnFw0wMMSm8FW4gVmT1QRI=; b=tvm+wFmI6IUnO2fw0Ef0ri3YnduXrsO0WIvEkx2ivoJzqI7D6d3vqSA4rgk2TQO98Y aUBG3PX7udhhwkksXVMf/laH2/pWH3XQ+eMr6yKi7bqmPDaL4CypeKoUNL1xQxWvq8+M G6xVk+QcsfkbSUpchhNDRzIhioxi9yJl5ZjIkYPIypxyO1d3LtxfPxmzMw3U4RVRKOpd wnxrS8hcA664JQ0u0QoAc3dWEw0f2ECfPh5lE6QOqzVeXauanAf84XuDKni4taBtpZF3 XNLW4YwBq5VTL5sW3vy0ZrzYUn6/gFHIYyDwmFGYDcQdOWPvATFT8/knzy9UsrymJFwD iJVw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1715793797; x=1716398597; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=9HVNMjO2akSMcTTiBfbdxnnFw0wMMSm8FW4gVmT1QRI=; b=CcwVjOTe7rkjZp3+D2/wpTXuztzp/tQYteWwPusSmo2vY2cMqwU41kQXOMtKEnBzvL qKyOwDpDxdeNFPQHnP/px0/cmaiORh+c6ZW23W9+CCOzx4q/c0bslrXW758D9qdk72Rr +biiMJ7MdS0UypJabevA5Yx20JA7d41jM3zR6Jx3g018lELrddkTsfK3nu/RlPI8zOwL Gw00mNTXwINUR84qAmU9idQYRlLs1nQQgK5KIY9DD+CH5o6VATdVdKYzHYfLbyDX8Ud8 bX3bLmka0FprWLxQBriicSjHM/xlowsZ81i83VqFpZ21I21DpaogDFH3AAHENuPqXraF aAeQ== X-Forwarded-Encrypted: i=1; AJvYcCX14wNiFzNORFmnEz8/5RQJBm8eoqg2OUDPzmxSo2uLPjz5t2eoRbjVANlnPVr0KHaZRpehP5fQw7QzgI5om1tid6X1LWgWB44NaVCnvGKtYrPOgWg= X-Gm-Message-State: AOJu0Yx+aDeVrVN4+Iy1Ieb389PiiMb/fToXIzO6qajiLlZqVRH+1Frs xzsg5aBjkplA/WQhHfFNnf0XV0hpIfRLp3AXzkbC1BeADMjzMmzbPH0JQxTqFvzuoIbURruf6Ao q1tJD/ICUMYNNc01H3QmNFfeHCw== X-Google-Smtp-Source: AGHT+IF2+ZdhABrnKPyUROWJCaWhOUajRbqGLHWL21MZQxT/ip0TW6XIGdVRzaMZh4Ur0gPZC6lIS0u4//WU4M/kut0= X-Received: from sebkvm.c.googlers.com ([fda3:e722:ac3:cc00:28:9cb1:c0a8:cd5]) (user=sebastianene job=sendgmr) by 2002:a05:600c:511d:b0:41e:8c00:94a4 with SMTP id 5b1f17b1804b1-41fead6accamr2395155e9.3.1715793797270; Wed, 15 May 2024 10:23:17 -0700 (PDT) Date: Wed, 15 May 2024 17:22:58 +0000 In-Reply-To: <20240515172258.1680881-1-sebastianene@google.com> Mime-Version: 1.0 References: <20240515172258.1680881-1-sebastianene@google.com> X-Mailer: git-send-email 2.45.0.rc1.225.g2a3ae87e7f-goog Message-ID: <20240515172258.1680881-5-sebastianene@google.com> Subject: [PATCH v2 4/4] KVM: arm64: Use FF-A 1.1 with pKVM From: Sebastian Ene To: catalin.marinas@arm.com, james.morse@arm.com, jean-philippe@linaro.org, maz@kernel.org, oliver.upton@linux.dev, qperret@google.com, qwandor@google.com, sudeep.holla@arm.com, suzuki.poulose@arm.com, tabba@google.com, will@kernel.org, yuzenghui@huawei.com, lpieralisi@kernel.org Cc: kvmarm@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, kernel-team@android.com, Sebastian Ene X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240515_102321_129264_5427CC6A X-CRM114-Status: GOOD ( 15.33 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Now that the layout of the structures is compatible with 1.1 it is time to probe the 1.1 version of the FF-A protocol inside the hypervisor. If the TEE doesn't support it, it should return the minimum supported version. Signed-off-by: Sebastian Ene --- arch/arm64/kvm/hyp/nvhe/ffa.c | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/arch/arm64/kvm/hyp/nvhe/ffa.c b/arch/arm64/kvm/hyp/nvhe/ffa.c index f9664c4a348e..bdd70eb4114e 100644 --- a/arch/arm64/kvm/hyp/nvhe/ffa.c +++ b/arch/arm64/kvm/hyp/nvhe/ffa.c @@ -458,7 +458,7 @@ static __always_inline void do_ffa_mem_xfer(const u64 func_id, memcpy(buf, host_buffers.tx, fraglen); ep_mem_access = (void *)buf + - ffa_mem_desc_offset(buf, 0, FFA_VERSION_1_0); + ffa_mem_desc_offset(buf, 0, hyp_ffa_version); offset = ep_mem_access->composite_off; if (!offset || buf->ep_count != 1 || buf->sender_id != HOST_FFA_ID) { ret = FFA_RET_INVALID_PARAMETERS; @@ -537,7 +537,7 @@ static void do_ffa_mem_reclaim(struct arm_smccc_res *res, fraglen = res->a2; ep_mem_access = (void *)buf + - ffa_mem_desc_offset(buf, 0, FFA_VERSION_1_0); + ffa_mem_desc_offset(buf, 0, hyp_ffa_version); offset = ep_mem_access->composite_off; /* * We can trust the SPMD to get this right, but let's at least @@ -846,7 +846,7 @@ int hyp_ffa_init(void *pages) if (kvm_host_psci_config.smccc_version < ARM_SMCCC_VERSION_1_2) return 0; - arm_smccc_1_1_smc(FFA_VERSION, FFA_VERSION_1_0, 0, 0, 0, 0, 0, 0, &res); + arm_smccc_1_1_smc(FFA_VERSION, FFA_VERSION_1_1, 0, 0, 0, 0, 0, 0, &res); if (res.a0 == FFA_RET_NOT_SUPPORTED) return 0; @@ -866,7 +866,11 @@ int hyp_ffa_init(void *pages) if (FFA_MAJOR_VERSION(res.a0) != 1) return -EOPNOTSUPP; - hyp_ffa_version = FFA_VERSION_1_0; + if (FFA_MINOR_VERSION(res.a0) < FFA_MINOR_VERSION(FFA_VERSION_1_1)) + hyp_ffa_version = res.a0; + else + hyp_ffa_version = FFA_VERSION_1_1; + tx = pages; pages += KVM_FFA_MBOX_NR_PAGES * PAGE_SIZE; rx = pages; -- 2.45.0.rc1.225.g2a3ae87e7f-goog _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel