From patchwork Thu Oct 11 02:19:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Edgar E. Iglesias" X-Patchwork-Id: 10635655 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id BF75C15E2 for ; Thu, 11 Oct 2018 02:24:49 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9A7E22A0F6 for ; Thu, 11 Oct 2018 02:24:49 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 8DDE42AEBB; Thu, 11 Oct 2018 02:24:49 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.4 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, DKIM_INVALID,DKIM_SIGNED,FREEMAIL_FROM,FSL_HELO_FAKE,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from lists.gnu.org (lists.gnu.org [208.118.235.17]) (using TLSv1 with cipher AES256-SHA (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 203C829BD0 for ; Thu, 11 Oct 2018 02:24:48 +0000 (UTC) Received: from localhost ([::1]:59985 helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gAQee-00069o-5W for patchwork-qemu-devel@patchwork.kernel.org; Wed, 10 Oct 2018 22:24:48 -0400 Received: from eggs.gnu.org ([2001:4830:134:3::10]:48687) by lists.gnu.org with esmtp (Exim 4.71) (envelope-from ) id 1gAQZs-0002EG-3Q for qemu-devel@nongnu.org; Wed, 10 Oct 2018 22:19:52 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1gAQZp-0004Qf-Bn for qemu-devel@nongnu.org; Wed, 10 Oct 2018 22:19:50 -0400 Received: from mail-lj1-x241.google.com ([2a00:1450:4864:20::241]:46867) by eggs.gnu.org with esmtps (TLS1.0:RSA_AES_128_CBC_SHA1:16) (Exim 4.71) (envelope-from ) id 1gAQZp-0004QD-4T; Wed, 10 Oct 2018 22:19:49 -0400 Received: by mail-lj1-x241.google.com with SMTP id x3-v6so6705921lji.13; Wed, 10 Oct 2018 19:19:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=n4iHFXGonYr7tDAd30fweyW8DUKwSqMMRaT5TOdocK4=; b=jujuEiLpteV/Y08ZEmcBkAvqFQrW/TkmNmi9/PjME1kjB1LyQIIZOOBn/8yhYMkmPi aZbn46sM1xQtDAix4nobrUC+em2jBBJJYfx/gYa0VrSfb/5uehiuSs+apXkP4LX+2tkI 80AIlr6lWuh0/mFN/Gc/qB8G9IsRoIgUIb49i6LhppHpQMmmuu9SLP8xbuoynrI/B1MS mc+I9Xqt7JqTdVjrs4LwSqC5h8gNgCol4Bg6aD4mhH3xziE12BrvSDCpx+jLbD5tPwOy o+qxk5lMlR/lvx9xOdvW2IyOIdx5ZLDScpuzKAVCGZSnin+WFQOovHtUhwUzhoSYhX/9 zvyQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=n4iHFXGonYr7tDAd30fweyW8DUKwSqMMRaT5TOdocK4=; b=ZrG2gkGHoCeGpBCq8AfMcr1Nbr8pN1ec+bfqO4Ru7ka1Eg9kDJljpAbT39BRy20Du2 lP6TkIlXdwjXg8riANHnbDHNY0nL2ENNv/bORmHnNv1p+fxjehuxnWqCJhaKWdPBiAHW gGqddw1RGS3sK4gYSopetHU6Yv1jNsHVgDff82Eo2nJpAM71V2sTePQOo9yx7vIfEnxS Bw+0P0E5LiyTV10ekbiY1ZX92bu1NEEAzFrl+qcD4GeQPGTy5tyBwElQHWKm/IBSEt2I Hk/AAaF/z+MMOuJvD6n1S1fz1nY0y//3wUQ/TPxq2kmqZruKv4xSMrIWqp76NnvzR3T0 XH4A== X-Gm-Message-State: ABuFfoge4QnJheFHDeKiH1XXzSa0xXN0muPB+95aEVONHuhzwa7d1osk cQU9uQ6R1f+gK2/GoDe4iO7dgbE5Xb8= X-Google-Smtp-Source: ACcGV60L8VpuUrVZeBbfTCll2e+swJXzCikumjDwDLpYL20gpURXkwZrEL+X2Inw3GxSI0YaobMB6w== X-Received: by 2002:a2e:591d:: with SMTP id n29-v6mr21784774ljb.70.1539224387657; Wed, 10 Oct 2018 19:19:47 -0700 (PDT) Received: from gmail.com (81-231-232-130-no39.tbcn.telia.com. [81.231.232.130]) by smtp.gmail.com with ESMTPSA id k18-v6sm3528997ljk.58.2018.10.10.19.19.46 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 10 Oct 2018 19:19:46 -0700 (PDT) From: "Edgar E. Iglesias" To: qemu-devel@nongnu.org, qemu-arm@nongnu.org Date: Thu, 11 Oct 2018 04:19:28 +0200 Message-Id: <20181011021931.4249-10-edgar.iglesias@gmail.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181011021931.4249-1-edgar.iglesias@gmail.com> References: <20181011021931.4249-1-edgar.iglesias@gmail.com> X-detected-operating-system: by eggs.gnu.org: Genre and OS details not recognized. X-Received-From: 2a00:1450:4864:20::241 Subject: [Qemu-devel] [PATCH v2 09/12] target-arm: powerctl: Enable HVC when starting CPUs to EL2 X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: figlesia@xilinx.com, peter.maydell@linaro.org, sstabellini@kernel.org, edgar.iglesias@xilinx.com, sai.pavan.boddu@xilinx.com, frasse.iglesias@gmail.com, alistair@alistair23.me, richard.henderson@linaro.org, frederic.konrad@adacore.com, philmd@redhat.com Errors-To: qemu-devel-bounces+patchwork-qemu-devel=patchwork.kernel.org@nongnu.org Sender: "Qemu-devel" X-Virus-Scanned: ClamAV using ClamSMTP From: "Edgar E. Iglesias" When QEMU provides the equivalent of the EL3 firmware, we need to enable HVCs in scr_el3 when turning on CPUs that target EL2. Reviewed-by: Peter Maydell Signed-off-by: Edgar E. Iglesias --- target/arm/arm-powerctl.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/target/arm/arm-powerctl.c b/target/arm/arm-powerctl.c index ce55eeb682..2b856930fb 100644 --- a/target/arm/arm-powerctl.c +++ b/target/arm/arm-powerctl.c @@ -103,6 +103,16 @@ static void arm_set_cpu_on_async_work(CPUState *target_cpu_state, } else { /* Processor is not in secure mode */ target_cpu->env.cp15.scr_el3 |= SCR_NS; + + /* + * If QEMU is providing the equivalent of EL3 firmware, then we need + * to make sure a CPU targeting EL2 comes out of reset with a + * functional HVC insn. + */ + if (arm_feature(&target_cpu->env, ARM_FEATURE_EL3) + && info->target_el == 2) { + target_cpu->env.cp15.scr_el3 |= SCR_HCE; + } } /* We check if the started CPU is now at the correct level */