Received: by 2002:a05:6a10:f347:0:0:0:0 with SMTP id d7csp643162pxu; Thu, 26 Nov 2020 07:57:57 -0800 (PST) X-Google-Smtp-Source: ABdhPJx/rYG9byTKxgQ4MDep+BD2PSNsUPWyZdOWySWDgrvQGhastx2CeEAEugOrCTAS1wAx+xsW X-Received: by 2002:a50:da08:: with SMTP id z8mr3165651edj.170.1606406277475; Thu, 26 Nov 2020 07:57:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1606406277; cv=none; d=google.com; s=arc-20160816; b=Fk+NTIMzwYVoJiyovrAVIuBrbhBuPxowPPdVJfDMJ/HAw5UcY73yX+aBXBHModv+DG 5a9raDygs3arIFDi0lXInD618oRg+PYvI05wfSrxQTFWKK/lDH2eqOvwqrkI96fp6cj5 mRmbR0BTorQnTo+nEPUfALim1NN5VwHJxj6wHb1/VqRawLMhQmtEueKmZmCGBGyPShE6 ZTtAuExQ5NjQycLs5g56VtDFmKlSRQZqmOkKPdGIJ2WAXhTjq+dNF2IP1b04Xv4htA9w qaIdovfpZuxjFgz5BtKq/WvMCe7ksTn6TZtFyZDbe1AjZrutxbUKHw7saXxaMpZX6n+E ToHQ== 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=yTPqxuNIHyHcxIGVDRFuzMb//a26J9RNoM2ThcyKbSM=; b=l/uKndW2E1FoIygQvi4BPvz3yoo9dg8D1eEP7PrXCcqiMkX5SmyCwJqC9/ownU6605 s2O7K2ZDRIuoXBwg+E3tp7qVSzDc7WCWI3urOP7gkHCBwrD94gMqxnRZOZCH9VM4SrHx lY9PkxPMB8Y4dRl8MN9264o6DxIPXL82BqZw6rnstRSHGPy/BP7AJQPs0J7JpglTrW+Y yeyUALlCfeCSlXdsn9vO+V/Oh4SHOFg4Djb3nhi9p6FkwQeH+QiEdz98RWvxCPZ58CDk YEDhCk9fpSluH5eA1gAN7ouMAZeqPZiRsxaFXwf9pPdDePLKGIre/jHNJVVcylFUes0N lr7g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20161025 header.b=mX8bYR+x; 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 y3si3345067edl.410.2020.11.26.07.57.34; Thu, 26 Nov 2020 07:57:57 -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=mX8bYR+x; 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 S2403829AbgKZPzH (ORCPT + 99 others); Thu, 26 Nov 2020 10:55:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51236 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2403821AbgKZPzH (ORCPT ); Thu, 26 Nov 2020 10:55:07 -0500 Received: from mail-wr1-x443.google.com (mail-wr1-x443.google.com [IPv6:2a00:1450:4864:20::443]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D8445C0613D4 for ; Thu, 26 Nov 2020 07:55:06 -0800 (PST) Received: by mail-wr1-x443.google.com with SMTP id 23so2636471wrc.8 for ; Thu, 26 Nov 2020 07:55:06 -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=yTPqxuNIHyHcxIGVDRFuzMb//a26J9RNoM2ThcyKbSM=; b=mX8bYR+xBsOyOIWEN8DX7gK/3reSGxDblgkVy4BFuCXdMl/4FvAYp/nmuGo1JoWP9P t6aYDDfb/OykyYNtU+YjrQpGHnafiTiCP67R+SMGTyaiF8vjgYt0Fvys9qkoErbLGFR9 we1WLjGlgUNDIDPEBeUD4Alzz5Om/fnxds/Oxp5CzjqLXbiXrL9tA5FQ1fQEZMm617TK IdSpNFJ2H05e+uXFDCHwheCyX3oSyvQ7+b/+18Q/kDteenUlTRRV+WrhBV712PuxD+Kx wmzbfiP7gvyDFfsWCOAGPdMnOJDwhL/l00+ToHh9zpX87qwlANYNEterelAS3s8rUwBU 5CJg== 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=yTPqxuNIHyHcxIGVDRFuzMb//a26J9RNoM2ThcyKbSM=; b=aEqY6zxr7NVUkYE5cC0O78WO+IazZdbE+CEO5EOaotnbbBsMqLpFOAGFZCsJMIkbBQ ZOEKxnrsifdQGxjNxqDUpYFEQr+e3oGgZTQZ+ZqoS8iXpmmt93LXbOzGJIvNy4eBjMlh /p/iM1zYVklRuqCTA6sN7MqJ2LL5PBkgnfKXInTTCv8ZMUovYtmoTp3O0Zp2MXzd3fyG AyAjyzuP2Am4vaoM4oorhXIBtQ9tr6iJZCSS3XLHQ+Q9jlAtoC151clbD1WhbmvcLZBY 2fJA5fRWPdPMnGznlcKD0ew5Eb/3L5jKlIXorWR34w1wBoxjjmycBTYdjZsjp3Q5ktxC imww== X-Gm-Message-State: AOAM531uJf562ws+ppl310mUgYkbcHYKYkPS+oYZJiXMpFkCU4ureoUx VCmz1jmQD4TYPlJ6o2qGw5ghyg== X-Received: by 2002:adf:f888:: with SMTP id u8mr4544222wrp.381.1606406105448; Thu, 26 Nov 2020 07:55:05 -0800 (PST) Received: from localhost ([2a01:4b00:8523:2d03:f008:704d:8d4b:9951]) by smtp.gmail.com with ESMTPSA id s25sm8628255wmh.16.2020.11.26.07.55.04 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 26 Nov 2020 07:55:04 -0800 (PST) From: David Brazdil To: kvmarm@lists.cs.columbia.edu Cc: Jonathan Corbet , Catalin Marinas , Will Deacon , Marc Zyngier , James Morse , Julien Thierry , Suzuki K Poulose , Dennis Zhou , Tejun Heo , Christoph Lameter , Mark Rutland , Lorenzo Pieralisi , Sudeep Holla , linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, kernel-team@android.com, David Brazdil Subject: [PATCH v3 18/23] kvm: arm64: Add function to enter host from KVM nVHE hyp code Date: Thu, 26 Nov 2020 15:54:16 +0000 Message-Id: <20201126155421.14901-19-dbrazdil@google.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201126155421.14901-1-dbrazdil@google.com> References: <20201126155421.14901-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 2b56f0bdf874..a820dfdc9c25 100644 --- a/arch/arm64/kvm/hyp/nvhe/host.S +++ b/arch/arm64/kvm/hyp/nvhe/host.S @@ -39,6 +39,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)] @@ -61,6 +62,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.2.454.gaff20da3a2-goog