Message ID | 20201109113233.9012-10-dbrazdil@google.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show
Return-Path: <SRS0=gdET=EP=lists.infradead.org=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@kernel.org> X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-12.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_ADSP_CUSTOM_MED,DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1919DC2D0A3 for <linux-arm-kernel@archiver.kernel.org>; Mon, 9 Nov 2020 11:37:44 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (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 9A71F206B6 for <linux-arm-kernel@archiver.kernel.org>; Mon, 9 Nov 2020 11:37:41 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="3lRr9kmi"; dkim=fail reason="signature verification failed" (2048-bit key) header.d=google.com header.i=@google.com header.b="Nlkt2NoS" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 9A71F206B6 Authentication-Results: mail.kernel.org; dmarc=fail (p=reject dis=none) header.from=google.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=pdrnVV5ekAj1htq2D/ssxPH6sHgTe7GLGlf4QCWUMig=; b=3lRr9kmiGQitYhyOGIcdY4YEV V6txX2ordcWENlMnlMkOAE04/5JM3xEI7gKpLXQs4drBJBuMwM1Ii/2R4FnPuaVKokYRCB2xJ4iCX 3ASwgRm0OxcBdsciareirt6nV1v6O6foORxNuEaO7PxzYbOV7bSo7aV9wO09Kn8LPbrNiWKCvwjnx PrJ5izADjYF6+mz0Zuxsb8JFL3zKWpYEX8HPPq9MLuk2avjMCvubV3deImQrErgExrji9lWk4ZL6C DrbiOK4WUlQzTLPJdIhdpaNGmukE8mDM0CLMJiy+oM40REKRYYxAC8sO8fmlJRaWPNMd/5n7uSHPF 1d6oxp7Dw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kc5Rx-0005CU-HN; Mon, 09 Nov 2020 11:35:05 +0000 Received: from mail-wr1-x444.google.com ([2a00:1450:4864:20::444]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kc5Pv-0004Pj-Hl for linux-arm-kernel@lists.infradead.org; Mon, 09 Nov 2020 11:33:04 +0000 Received: by mail-wr1-x444.google.com with SMTP id l1so3906894wrb.9 for <linux-arm-kernel@lists.infradead.org>; Mon, 09 Nov 2020 03:32:59 -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=R9d1+peEDKIDAC4BUkJrLbr91HxlsiVlv7gVncj7oJE=; b=Nlkt2NoSN06mNMUiV4czGigWOfDI7alqjAr/VMiKAFi8r6SvbUFmz5qPCSigNbzGOt CcGl9WRnVJZlERP13JXxePqpq+CU1BM2zj7a30/EIygFZ19rzJYInzQrH0Ljz4jw7llX f1jQJ0Kc8LLGgt1H2glCPIT3bTzTawZk3J/ZwhQ/dbCiyJR8NCUeqezVV4pN1JrRhYD+ 1H/QFadgpHUUQqKOgln9mSwviXlgghCm6zoyLHdi32xsm/LfSaHON6HH/BFfBXggztVp Xm6hUSHCwFGge2giBU9ofUcBQTbgyAdWT16BEx2thI/+/obwWbQx/TBHVlTa6aPc4rUM hr6w== 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=R9d1+peEDKIDAC4BUkJrLbr91HxlsiVlv7gVncj7oJE=; b=cGUyZ/aiApGz7BXd0fiM5rj5X/HXOVuPHpR+Bpx3PicBV3lGSW6g88jsD4olTr5cv+ qbCk8o+wBJejwB11z5bm4Je77tFvZFmSLS6lOvr3k5Na+VXOaILkR/w/WWx0Hvx8PJ4v IacnXxmxrMwvjgslREdhkMjlGQMkRlp+uGvwwZgU6TVYn6K2gy81gnDKiK/+iOfHbYV8 2xxFxGZkb97bpewH3oRRpzewA2KAKeNLYMfLxONA6q5hGffEvRG9eWe4ZFPHkqVGHB24 0FDTUBFyBw1Ek5vD+Bs+SCG4OELAq1d8fERM78aXnvmZF8IMe8VLQNpCAmE9hTR+cd6v NDBg== X-Gm-Message-State: AOAM532A0t5lsmpEY7wZPI6RKxS2vsnNwwxw+KipcLGD2FZzN/m5yP0a OpOcXZKqUfIDdVYB9F/1G1KzaC8nxT8nOrGJ X-Google-Smtp-Source: ABdhPJwYuIGUPqMp11VFz88V7y1F5zU6JG+SWQiwKv4yp8uGAfg16WUH01aMz+AxIfZqkyce6q2v2A== X-Received: by 2002:a5d:6452:: with SMTP id d18mr7927464wrw.200.1604921578344; Mon, 09 Nov 2020 03:32:58 -0800 (PST) Received: from localhost ([2a01:4b00:8523:2d03:209d:10b7:c480:3e1f]) by smtp.gmail.com with ESMTPSA id z14sm12812890wmc.15.2020.11.09.03.32.57 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 09 Nov 2020 03:32:57 -0800 (PST) From: David Brazdil <dbrazdil@google.com> To: kvmarm@lists.cs.columbia.edu Subject: [PATCH v1 09/24] kvm: arm64: Refactor handle_trap to use a switch Date: Mon, 9 Nov 2020 11:32:18 +0000 Message-Id: <20201109113233.9012-10-dbrazdil@google.com> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20201109113233.9012-1-dbrazdil@google.com> References: <20201109113233.9012-1-dbrazdil@google.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201109_063259_716600_A639BE0D X-CRM114-Status: GOOD ( 15.31 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: <linux-arm-kernel.lists.infradead.org> List-Unsubscribe: <http://lists.infradead.org/mailman/options/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=unsubscribe> List-Archive: <http://lists.infradead.org/pipermail/linux-arm-kernel/> List-Post: <mailto:linux-arm-kernel@lists.infradead.org> List-Help: <mailto:linux-arm-kernel-request@lists.infradead.org?subject=help> List-Subscribe: <http://lists.infradead.org/mailman/listinfo/linux-arm-kernel>, <mailto:linux-arm-kernel-request@lists.infradead.org?subject=subscribe> Cc: Mark Rutland <mark.rutland@arm.com>, kernel-team@android.com, Lorenzo Pieralisi <lorenzo.pieralisi@arm.com>, Andrew Walbran <qwandor@google.com>, Suzuki K Poulose <suzuki.poulose@arm.com>, Marc Zyngier <maz@kernel.org>, Quentin Perret <qperret@google.com>, linux-kernel@vger.kernel.org, James Morse <james.morse@arm.com>, linux-arm-kernel@lists.infradead.org, Catalin Marinas <catalin.marinas@arm.com>, Tejun Heo <tj@kernel.org>, Dennis Zhou <dennis@kernel.org>, Christoph Lameter <cl@linux.com>, David Brazdil <dbrazdil@google.com>, Will Deacon <will@kernel.org>, Julien Thierry <julien.thierry.kdev@gmail.com>, Andrew Scull <ascull@google.com> Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" <linux-arm-kernel-bounces@lists.infradead.org> Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org |
Series |
Opt-in always-on nVHE hypervisor
|
expand
|
diff --git a/arch/arm64/kvm/hyp/nvhe/hyp-main.c b/arch/arm64/kvm/hyp/nvhe/hyp-main.c index 411b0f652417..19332c20fcde 100644 --- a/arch/arm64/kvm/hyp/nvhe/hyp-main.c +++ b/arch/arm64/kvm/hyp/nvhe/hyp-main.c @@ -16,9 +16,9 @@ DEFINE_PER_CPU(struct kvm_nvhe_init_params, kvm_init_params); -static void handle_host_hcall(unsigned long func_id, - struct kvm_cpu_context *host_ctxt) +static void handle_host_hcall(struct kvm_cpu_context *host_ctxt) { + unsigned long func_id = host_ctxt->regs.regs[0]; unsigned long ret = 0; switch (func_id) { @@ -109,11 +109,12 @@ static void handle_host_hcall(unsigned long func_id, void handle_trap(struct kvm_cpu_context *host_ctxt) { u64 esr = read_sysreg_el2(SYS_ESR); - unsigned long func_id; - if (ESR_ELx_EC(esr) != ESR_ELx_EC_HVC64) + switch (ESR_ELx_EC(esr)) { + case ESR_ELx_EC_HVC64: + handle_host_hcall(host_ctxt); + break; + default: hyp_panic(); - - func_id = host_ctxt->regs.regs[0]; - handle_host_hcall(func_id, host_ctxt); + } }
Small refactor so that nVHE's handle_trap uses a switch on the Exception Class value of ESR_EL2 in preparation for adding a handler of SMC32/64. Signed-off-by: David Brazdil <dbrazdil@google.com> --- arch/arm64/kvm/hyp/nvhe/hyp-main.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-)