Received: by 2002:a25:e74b:0:0:0:0:0 with SMTP id e72csp1847358ybh; Fri, 17 Jul 2020 02:49:36 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzUgV+CMBAx/e5tZok8bBoxiWnEc3EQiJOBnYDKC6NNgxQnR9N6PY1p16WOloJeai/HlcU8 X-Received: by 2002:a17:906:ef2:: with SMTP id x18mr7491979eji.547.1594979376138; Fri, 17 Jul 2020 02:49:36 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1594979376; cv=none; d=google.com; s=arc-20160816; b=eFQmBVaKv2h4UANCFTZMJVQUgUXRJMne5WK+RSOxf8+O+mLJbEp2sf13MsYXEMUA5z MLzl+mXPGpAdjof8KlfvNQlROeh/yWC7cgB9U+UrEiTkt/68yULQZY8KWhE99EJ1EGMh z9gJxj3KeFr78nMXu2v0EVH/zwdKuHNdUR/XNrBdn103ljo55AXnwTb0B1iXWfrgrqPp Ys7N49SAdCX9MRtaMy0x+9pRLt4BBE6MbtJstnQXGCr8uziQrtM/t/gJSJa42aSPATky XEhtVtlS6ybtPtjlHfkb9LrCGQZAp0dQViMbFqYYFmioUV/yfyY2RxJhbqHrfZp5KUK0 XvGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=Y1xPoTbiyRWbZF2uo7xrMghKF5eqH9nm2PByOhn8PKM=; b=bf/soL5c0krJulRGu0VEUpvkwjfxwvs7X4blzwTYLB/OrRyfbn6F5Sv61HR7SsMqwk wQDFFMf5wNQeTesfObw253sABp9q5b3SRv7t695SMl0KG+ofWgRV0772IoOiTQOnMw1B +JArs9a7jwm66Ff78z4+CUuX/Pv3ANVUBvIsu6S9XOC4JueTfx6PZsttipFQBx3HgixS 8hc/Bu3lDOzGUYhMrcEHNiiUCACyEVTurwZkZbdDKKxQ504Abv8I0uUND0xNJ+MuLyq7 pUVXWz/BaGSQALuRkWyLaxPSp1CUX1QoYl5PtpxXEVL1JNc0WfM9EVHWehGdQUbOYBwj j1Rg== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id z5si4636163ejd.322.2020.07.17.02.49.13; Fri, 17 Jul 2020 02:49:36 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726383AbgGQJqF (ORCPT + 99 others); Fri, 17 Jul 2020 05:46:05 -0400 Received: from foss.arm.com ([217.140.110.172]:44868 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725912AbgGQJqF (ORCPT ); Fri, 17 Jul 2020 05:46:05 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 9D10830E; Fri, 17 Jul 2020 02:46:04 -0700 (PDT) Received: from bogus (unknown [10.37.8.134]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 5B39E3F66E; Fri, 17 Jul 2020 02:46:02 -0700 (PDT) Date: Fri, 17 Jul 2020 10:45:55 +0100 From: Sudeep Holla To: Florian Fainelli Cc: Daniele Alessandrelli , linux-arm-kernel@lists.infradead.org, Daniele Alessandrelli , Peng Fan , "Paul J. Murphy" , "Paul J. Murphy" , linux-kernel@vger.kernel.org, Sudeep Holla Subject: Re: [PATCH] firmware: arm_scmi: Pass shmem address to SMCCC call Message-ID: <20200717094555.GA24501@bogus> References: <20200715165518.57558-1-daniele.alessandrelli@linux.intel.com> <5f74221b-aec7-7715-19d1-5cbb406f1bdc@gmail.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <5f74221b-aec7-7715-19d1-5cbb406f1bdc@gmail.com> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 15, 2020 at 03:43:24PM -0700, Florian Fainelli wrote: > > > On 7/15/2020 9:55 AM, Daniele Alessandrelli wrote: > > From: Daniele Alessandrelli > > > > Currently, when SMC/HVC is used as transport, the base address of the > > shared memory used for communication is not passed to the SMCCC call. > > This means that such an address must be hard-coded into the bootloader. > > > > In order to increase flexibility and allow the memory layout to be > > changed without modifying the bootloader, this patch adds the shared > > memory base address to the a1 argument of the SMCCC call. > > > > On the Secure Monitor side, the service call implementation can > > therefore read the a1 argument in order to know the location of the > > shared memory to use. This change is backward compatible to existing > > service call implementations as long as they don't check for a1 to be > > zero. > > resource_size_t being defined after phys_addr_t, its size is different > between 32-bit, 32-bit with PAE and 64-bit so it would probably make > more sense to define an physical address alignment, or maybe an address > that is in multiple of 4KBytes so you can address up to 36-bits of > physical address even on a 32-bit only system? > Good point, I had forgotten about LPAE. Thanks for pointing it out. > What discovery mechanism does the OS have that the specified address > within the SMCCC call has been accepted by the firmware given the return > value of that SMCCC call does not appear to be used or checked? Do we > just expect a timeout initializing the SCMI subsystem? > Agreed, we need to add the check for proper return value then and definitely document it very clearly as we are trying to standardise a call to vendor SiP FID space of SMCCC. > Given that the kernel must somehow reserve this memory as a shared > memory area for obvious reasons, and the trusted firmware must also > ensure it treats this memory region with specific permissions in its > translation regime, does it really make sense to give that much flexibility? > I expect so and this comes as shmem property from DT already. We are just passing the value obtained from there as is. This is just to help TFA or the firmware to identify the specific channel/shmem as SMC/HVC otherwise has no way to do so. > If your boot loader has FDT patching capability, maybe it can also do a > SMC call to provide the address to your trusted firmware, prior to > loading the Linux kernel, and then they both agree, prior to boot about > the shared memory address? > Yes, but we definitely can't rely on such mechanism in the kernel. It is more a platform choice as they run different bootloaders. -- Regards, Sudeep