From patchwork Wed Feb 22 15:33:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jens Wiklander X-Patchwork-Id: 13149300 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 lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (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 37015C6FD1B for ; Wed, 22 Feb 2023 15:34:13 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.499545.770773 (Exim 4.92) (envelope-from ) id 1pUr8A-0002er-8B; Wed, 22 Feb 2023 15:34:06 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 499545.770773; 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 1pUr89-0002c4-Gi; Wed, 22 Feb 2023 15:34:05 +0000 Received: by outflank-mailman (input) for mailman id 499545; Wed, 22 Feb 2023 15:34:03 +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-B7 for xen-devel@lists.xenproject.org; Wed, 22 Feb 2023 15:34:03 +0000 Received: from mail-lf1-x12c.google.com (mail-lf1-x12c.google.com [2a00:1450:4864:20::12c]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 5461d2c2-b2c6-11ed-93b6-47a8fe42b414; Wed, 22 Feb 2023 16:34:00 +0100 (CET) Received: by mail-lf1-x12c.google.com with SMTP id bp25so10676489lfb.0 for ; Wed, 22 Feb 2023 07:34:01 -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.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 Feb 2023 07:34:00 -0800 (PST) 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: 5461d2c2-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=6KguU5fKyIYZ3B6fRSfTmGKEYTHZutvCnKPhrDpB1io=; b=YQ7QaUw2xSr0uhygfwAIAPTnrqAX0QSAeZ638gQy98K6yT9B0ioUdpuyfD/GEtFt34 E/q0d6XP2L3ipHWJwhkjyR7Sfq08lY5CYYj9oLtjj86uVPLOe6wmrFCCUiSmNwMc8d4w bLdQmsYNKgnSuQ1e2GmC2kCPGuLo9KM5IPf/rJ7iNEpy2L7nacLcUPXj4a32DtpSjmqx Ww4Slve+itnWYK3BK8k3cBJhIngJrnUd7FigQzG6zTc6HCeeMRsM8JI3VSUi4p6fVZNs XkNR0Fw0hv1Y4AXvWq+xFYJtG8ujcRIr8RDF9i1z2cgHl81oZColGEa8Nq8oA6Mvj7FI 3ItQ== 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=6KguU5fKyIYZ3B6fRSfTmGKEYTHZutvCnKPhrDpB1io=; b=GS+WVJftdXyfPCPi+XgF5RV0EKWljbVdcTnBM2G3QRRXPRDgsnHNxiso/YGmG9YQuy 0kcdC91wKKXCLXS51eK0fqOChWdinjZvNnAfqe++VPLbu+0aO9nvgCnGrIEenuA0wn6E qiyA3jDOiYJaIvTeuxjFo3lQ/EL7bvP8mg0FkER72xyeLMrWhCFDEhrOgcKt3Cd6ei18 O+v8kbwOtVF67SNXBUXn4dhWF+Rz+S7UsD5Ibuk07TcHAsEnR5X9gAPR53Eu1ItdyMfs QcQxtka34HrCCq/tRobBUSSE+auiNodU/5vF0GOPmG0mm2xlWjFXaU5CskU9LyDgpOgt Jyxw== X-Gm-Message-State: AO0yUKXG2DmIMr0I2QmmJx6AGsf1/RSUTjaJmqUQdYB1ojKSBcKvF30W Ytc1WoOO9wk07qG3KGFgwWFd2Wsaq0scD04Dvwk= X-Google-Smtp-Source: AK7set/xYReyFarccwfkMjZIxvACnhtNCeZqDqdQl+pSNBAcE7+gyQOEvXc3nFfTscS6Ntnj2sDjTw== X-Received: by 2002:ac2:43b3:0:b0:4dc:4b05:485c with SMTP id t19-20020ac243b3000000b004dc4b05485cmr2784611lfl.50.1677080041130; 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 08/20] xen/arm: ffa: note dependency on 4k pages Date: Wed, 22 Feb 2023 16:33:05 +0100 Message-Id: <6c0ef5d2174bfa8c25aeb94395160ab9d863b63a.1677079672.git.jens.wiklander@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: References: MIME-Version: 1.0 Adds a BUILD_BUG_ON() to assert the dependency on 4k pages in the FF-A mediator. Signed-off-by: Jens Wiklander Reviewed-by: Bertrand Marquis --- xen/arch/arm/tee/ffa.c | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/xen/arch/arm/tee/ffa.c b/xen/arch/arm/tee/ffa.c index d04bac9cc47f..8b0b80ce1ff5 100644 --- a/xen/arch/arm/tee/ffa.c +++ b/xen/arch/arm/tee/ffa.c @@ -56,6 +56,16 @@ #define FFA_MY_VERSION MAKE_FFA_VERSION(FFA_MY_VERSION_MAJOR, \ FFA_MY_VERSION_MINOR) +/* + * The FF-A specification explicitly works with 4K pages as a measure of + * memory size, for example, FFA_RXTX_MAP takes one parameter "RX/TX page + * count" which is the number of contiguous 4K pages allocated. Xen may use + * a different page size depending on the configuration to avoid confusion + * with PAGE_SIZE use a special define when it's a page size as in the FF-A + * specification. + */ +#define FFA_PAGE_SIZE SZ_4K + /* Framework direct request/response */ #define FFA_MSG_FLAG_FRAMEWORK BIT(31, U) #define FFA_MSG_TYPE_MASK 0xFFU; @@ -242,6 +252,17 @@ static bool ffa_probe(void) unsigned int major_vers; unsigned int minor_vers; + /* + * FF-A often works in units of 4K pages and currently it's assumed + * that we can map memory using that granularity. See also the comment + * above the FFA_PAGE_SIZE define. + * + * It is possible to support a PAGE_SIZE larger than 4K in Xen, but + * until that is fully handled in this code make sure that we only use + * 4K page sizes. + */ + BUILD_BUG_ON(PAGE_SIZE != FFA_PAGE_SIZE); + /* * psci_init_smccc() updates this value with what's reported by EL-3 * or secure world.