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 mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 99062C433F5 for ; Mon, 8 Nov 2021 22:09:21 +0000 (UTC) Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 354E461361 for ; Mon, 8 Nov 2021 22:09:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.1 mail.kernel.org 354E461361 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=tribudubois.net Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=nongnu.org Received: from localhost ([::1]:52644 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1mkCpM-0007nc-3o for qemu-devel@archiver.kernel.org; Mon, 08 Nov 2021 17:09:20 -0500 Received: from eggs.gnu.org ([209.51.188.92]:53150) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mkCmi-0005V8-A4; Mon, 08 Nov 2021 17:06:36 -0500 Received: from relay5-d.mail.gandi.net ([217.70.183.197]:57435) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1mkCmf-00020k-Ob; Mon, 08 Nov 2021 17:06:36 -0500 Received: (Authenticated sender: jcd@tribudubois.net) by relay5-d.mail.gandi.net (Postfix) with ESMTPSA id 6859E1C0004; Mon, 8 Nov 2021 22:06:28 +0000 (UTC) Message-ID: <7e8cc67c-2380-e401-ddc7-7dc24df31ede@tribudubois.net> Date: Mon, 8 Nov 2021 23:06:27 +0100 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:91.0) Gecko/20100101 Thunderbird/91.1.2 Subject: Re: Qemu and ARM secure state. Content-Language: en-US To: =?UTF-8?Q?Alex_Benn=c3=a9e?= References: <07e63acb-b756-2586-2ba2-b54b837f7fc8@tribudubois.net> <87k0hik9yc.fsf@linaro.org> From: Jean-Christophe DUBOIS In-Reply-To: <87k0hik9yc.fsf@linaro.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit Received-SPF: pass client-ip=217.70.183.197; envelope-from=jcd@tribudubois.net; helo=relay5-d.mail.gandi.net X-Spam_score_int: -56 X-Spam_score: -5.7 X-Spam_bar: ----- X-Spam_report: (-5.7 / 5.0 requ) BAYES_00=-1.9, NICE_REPLY_A=-3.06, RCVD_IN_DNSWL_LOW=-0.7, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_NONE=0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Peter Maydell , qemu-arm@nongnu.org, QEMU Developers Errors-To: qemu-devel-bounces+qemu-devel=archiver.kernel.org@nongnu.org Sender: "Qemu-devel" Le 08/11/2021 à 15:14, Alex Bennée a écrit : > Jean-Christophe DUBOIS writes: > >> One small question/remark: >> >> According to the the "Arm Power State Coordinate Interface" (DEN0022D.b) document (chapter 5) PSCI calls can only be issued by >> "normal world" (EL1 or EL2). Therefore, should we be adding a test for the current secure state in the arm_is_psci_call() function? This >> would prevent calling the built-in Qemu PSCI function if SMC is issued >> from secure state. > All that should be handled in: > > void HELPER(pre_smc)(CPUARMState *env, uint32_t syndrome) > > which should cause things to be trapped if the CPU is in an invalid > state to execute the SMC instruction. If the exception is a valid SMC we > end up in arm_cpu_do_interrupt where we may divert to > arm_handle_psci_call. The problem I have is that is seems that once the "psci-conduit" is set to SMC, all SMC exception would be handled only by the diverted  arm_handle_psci_call(). It seems there is no way to handle SMC exception in my software once "psci-conduit" is set to SMC on a platform. It used to be that only some PSCI services were diverted and other SMC services were handled by the EL3 software if any (and this split was actually also a bit awkward). >