Received: by 2002:a05:6a10:16a7:0:0:0:0 with SMTP id gp39csp1573319pxb; Wed, 4 Nov 2020 12:37:08 -0800 (PST) X-Google-Smtp-Source: ABdhPJyLqM8+ENO+HQ7ECbL+eO/LTTcoq1vFxDbGcB1zOeIu0L3hf9EcKrj0K1mUmcpZhnDOw8BO X-Received: by 2002:a05:6402:144b:: with SMTP id d11mr29313459edx.195.1604522228636; Wed, 04 Nov 2020 12:37:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1604522228; cv=none; d=google.com; s=arc-20160816; b=VG060zpYDxu/bCBR1C1jXkkzKBnxq+VYjpfBWnw6nvqWrgOiicme6kVYNLx+1eeBL8 MpXRY8QbcnoHjU9R6ASPfJOVAw0pTiSrfDPMRXgMRbPEsjjHjDcHvHWGq/PH2YyPN5TH jxSTi/7MmpvPv0jOh0D4gYmGgYbAs9DhkPFV+A3226i1AtKT5Mv+Ah4iFWAq9gbPi/Rw CLK9D/YEG+agNHnv1f7tBH10oQOip+YLeTk6+mOwKrzpgGiF9a/KKQ30+mhDCNDP3nZ5 thVlZaXqq68UwaAZmaKNPFIaOKl16BQJR9Nz2eK1aNpaK3jcQAhtJ3KEBwnv7HT4qBEj T7MA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=D2iY/f0Emp/4ip0BhAwKDaO2Rz6fYg/GzmDoqFEl2bY=; b=P6/hLqdcfncWfGV07hmLIwRa0TCATcu6c9VpsfEnpDzL9GV2ln0685geomwS//hFAP HRbvZkE74lp35kjSdWVfW0uIpICqOsYJtWFTw7ohQFIRnyN+EPgSa4pOWZ8inEMHZHm8 0ggXohpGCaWJSNJpGJ3liJWIqMCZK0sg8+9xmIjSUBvYwkt8xvU04381V8VmhlYd/SI1 Im4TQH4+SjfY5SC6l3Ynp6/y9QUwA9IuFgo0oy54jA9Hhcuk3UXD+z1F+6+HjHGVUo0K ryJz7GeDXYMc8Mt/eGvJtP429E9qyvVZw89rDRF7rFb+HE24j9EiXo9uGB5Sj5/Mr4G0 8wfQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=K5lok9pX; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p14si2082785ejf.554.2020.11.04.12.36.46; Wed, 04 Nov 2020 12:37:08 -0800 (PST) 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; dkim=pass header.i=@google.com header.s=20161025 header.b=K5lok9pX; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732588AbgKDSh2 (ORCPT + 99 others); Wed, 4 Nov 2020 13:37:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56568 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732573AbgKDShZ (ORCPT ); Wed, 4 Nov 2020 13:37:25 -0500 Received: from mail-wm1-x344.google.com (mail-wm1-x344.google.com [IPv6:2a00:1450:4864:20::344]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A6468C0613D3 for ; Wed, 4 Nov 2020 10:37:24 -0800 (PST) Received: by mail-wm1-x344.google.com with SMTP id d142so3351293wmd.4 for ; Wed, 04 Nov 2020 10:37:24 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=D2iY/f0Emp/4ip0BhAwKDaO2Rz6fYg/GzmDoqFEl2bY=; b=K5lok9pXB0Y/9UmYflOIZMDSkGGd3u23Q2HOsAtpB2GQgdWbczb37MrT+zOkXv17wT XLC9vOedqgdzZukxYXUCfWK/KmpoLoHZtcqTjOfbzpJCWVRhTNn0OILGLegfnc3HNByb EiNdcjUUM9WM0ul/8L3ypEWnLJH522G2M/Whv3nq2waX0fzH+tavrd5hfyBwCWZ47rIH M/e50E9Agk8EUpEMjPxiQU7m7K6l6KIaF84T3dfGn48L0baNZQrBvimX4U882V+fCi24 OWGZhINKWlBuvULKaAafjWdNi+d8GRiezt45uezGFm5E9OxwAXUa2w/uxQNhsQbs+D1U 3Czg== 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:mime-version:content-transfer-encoding; bh=D2iY/f0Emp/4ip0BhAwKDaO2Rz6fYg/GzmDoqFEl2bY=; b=FC5cp1fMcw13cLX1nRlqwh6oPzMEXgUxIOGaCvhdGAD1jnKxjbWQji2ohiHe5IYRK3 F/Ut52l0SExIcvFO+sreMarloW1E8mm9ivwduBTXE778yn50Allp0xWJrKfSpEAaKHOf Cvil6rYuHTB4DBLDux07gdwC0yBv64dy23y/MPiilZX1i4ayVNBZf2/ATsFtJf9L6O12 lGu6GhBlUS2QVNCSbesSm5gVlIWdfILtxwyJS29sHKJDdcQUnXOt/CsjgGNdVQPVlIPb KTyCwFFwdY51Q3UmgRWB0/pFrSElwZwO2/4LrzVqdwsxfQEWPFCl+Czcx59EAnHwa0mm XOvw== X-Gm-Message-State: AOAM5332hdu2vVi/C+xnIhhQ799TNFqebb5j43PWL6WWR5WWEZJlLA4g jc+mGTNlIm2SrTs9uRCmlobvLTqU1uavh5cF X-Received: by 2002:a1c:b487:: with SMTP id d129mr6273792wmf.38.1604515043233; Wed, 04 Nov 2020 10:37:23 -0800 (PST) Received: from localhost ([2a01:4b00:8523:2d03:c8d2:30f2:53c6:bc2]) by smtp.gmail.com with ESMTPSA id d3sm1049184wrg.16.2020.11.04.10.37.21 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 04 Nov 2020 10:37:22 -0800 (PST) From: David Brazdil To: kvmarm@lists.cs.columbia.edu Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Marc Zyngier , James Morse , Julien Thierry , Suzuki K Poulose , Catalin Marinas , Will Deacon , Dennis Zhou , Tejun Heo , Christoph Lameter , Mark Rutland , Lorenzo Pieralisi , Quentin Perret , Andrew Scull , kernel-team@android.com, David Brazdil Subject: [RFC PATCH 21/26] kvm: arm64: Add function to enter host from KVM nVHE hyp code Date: Wed, 4 Nov 2020 18:36:25 +0000 Message-Id: <20201104183630.27513-22-dbrazdil@google.com> X-Mailer: git-send-email 2.29.1 In-Reply-To: <20201104183630.27513-1-dbrazdil@google.com> References: <20201104183630.27513-1-dbrazdil@google.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org All nVHE hyp code is currently executed as handlers of host's HVCs. This will change as nVHE starts intercepting host's PSCI CPU_ON SMCs. The newly booted CPU will need to initialize EL2 state and then enter the host. Add __host_enter function that branches into the existing host state-restoring code after the trap handler would have returned. Signed-off-by: David Brazdil --- arch/arm64/kvm/hyp/nvhe/host.S | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/arch/arm64/kvm/hyp/nvhe/host.S b/arch/arm64/kvm/hyp/nvhe/host.S index ed27f06a31ba..ff04d7115eab 100644 --- a/arch/arm64/kvm/hyp/nvhe/host.S +++ b/arch/arm64/kvm/hyp/nvhe/host.S @@ -41,6 +41,7 @@ SYM_FUNC_START(__host_exit) bl handle_trap /* Restore host regs x0-x17 */ +__host_enter_restore_full: ldp x0, x1, [x29, #CPU_XREG_OFFSET(0)] ldp x2, x3, [x29, #CPU_XREG_OFFSET(2)] ldp x4, x5, [x29, #CPU_XREG_OFFSET(4)] @@ -63,6 +64,14 @@ __host_enter_without_restoring: sb SYM_FUNC_END(__host_exit) +/* + * void __noreturn __host_enter(struct kvm_cpu_context *host_ctxt); + */ +SYM_FUNC_START(__host_enter) + mov x29, x0 + b __host_enter_restore_full +SYM_FUNC_END(__host_enter) + /* * void __noreturn __hyp_do_panic(bool restore_host, u64 spsr, u64 elr, u64 par); */ -- 2.29.1.341.ge80a0c044ae-goog