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 X-Spam-Level: X-Spam-Status: No, score=-13.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 AAF81C56202 for ; Mon, 23 Nov 2020 14:32:30 +0000 (UTC) Received: from mm01.cs.columbia.edu (mm01.cs.columbia.edu [128.59.11.253]) by mail.kernel.org (Postfix) with ESMTP id F164D2080A for ; Mon, 23 Nov 2020 14:32:29 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="GpZ/3A6V" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F164D2080A Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: mail.kernel.org; spf=pass smtp.mailfrom=kvmarm-bounces@lists.cs.columbia.edu Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 3D1C14BA38; Mon, 23 Nov 2020 09:32:29 -0500 (EST) X-Virus-Scanned: at lists.cs.columbia.edu Authentication-Results: mm01.cs.columbia.edu (amavisd-new); dkim=softfail (fail, message has been altered) header.i=@kernel.org Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id Qaxs6X1AVjt7; Mon, 23 Nov 2020 09:32:28 -0500 (EST) Received: from mm01.cs.columbia.edu (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id 2CD604BAC1; Mon, 23 Nov 2020 09:32:28 -0500 (EST) Received: from localhost (localhost [127.0.0.1]) by mm01.cs.columbia.edu (Postfix) with ESMTP id F19944BA38 for ; Mon, 23 Nov 2020 09:32:26 -0500 (EST) X-Virus-Scanned: at lists.cs.columbia.edu Received: from mm01.cs.columbia.edu ([127.0.0.1]) by localhost (mm01.cs.columbia.edu [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id WtvB+gZTIuNm for ; Mon, 23 Nov 2020 09:32:24 -0500 (EST) Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by mm01.cs.columbia.edu (Postfix) with ESMTPS id C27CD4BA28 for ; Mon, 23 Nov 2020 09:32:24 -0500 (EST) Received: from disco-boy.misterjones.org (disco-boy.misterjones.org [51.254.78.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7E1292083E; Mon, 23 Nov 2020 14:32:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1606141943; bh=lDofIwi2BtW6n3G9yyz3mKUtQ/dbkrPPmWz16CrGPi0=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=GpZ/3A6VL9vrcXWbAJ7FguzGnep2k7UBr7K5iTyCQKc76oA3A9XrwGdRmKY+lRWuE Xf1jUB6+kgy8MCtw871AyjjXzjtXYFD3ZyRwIx8Y9y4TVuGYloOGFcTcl4dOeevuVd 1wpFK4aJvsTBHW6U3613MGfSfdmVVXrMGx2MUh8I= Received: from 78.163-31-62.static.virginmediabusiness.co.uk ([62.31.163.78] helo=wait-a-minute.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94) (envelope-from ) id 1khCtB-00CyXO-Bu; Mon, 23 Nov 2020 14:32:21 +0000 Date: Mon, 23 Nov 2020 14:32:20 +0000 Message-ID: <87k0uc5ekr.wl-maz@kernel.org> From: Marc Zyngier To: David Brazdil Subject: Re: [PATCH v2 07/24] kvm: arm64: Refactor handle_trap to use a switch In-Reply-To: <20201116204318.63987-8-dbrazdil@google.com> References: <20201116204318.63987-1-dbrazdil@google.com> <20201116204318.63987-8-dbrazdil@google.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 Emacs/27.1 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") X-SA-Exim-Connect-IP: 62.31.163.78 X-SA-Exim-Rcpt-To: dbrazdil@google.com, kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, james.morse@arm.com, julien.thierry.kdev@gmail.com, suzuki.poulose@arm.com, catalin.marinas@arm.com, will@kernel.org, dennis@kernel.org, tj@kernel.org, cl@linux.com, mark.rutland@arm.com, lorenzo.pieralisi@arm.com, qperret@google.com, ascull@google.com, qwandor@google.com, kernel-team@android.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Cc: kernel-team@android.com, Lorenzo Pieralisi , Andrew Walbran , Catalin Marinas , linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Tejun Heo , Dennis Zhou , Christoph Lameter , Will Deacon , kvmarm@lists.cs.columbia.edu X-BeenThere: kvmarm@lists.cs.columbia.edu X-Mailman-Version: 2.1.14 Precedence: list List-Id: Where KVM/ARM decisions are made List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Errors-To: kvmarm-bounces@lists.cs.columbia.edu Sender: kvmarm-bounces@lists.cs.columbia.edu On Mon, 16 Nov 2020 20:43:01 +0000, David Brazdil wrote: > > 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. nit: SMC32 seems to be a leftover from the previous version. > > Signed-off-by: David Brazdil > --- > arch/arm64/kvm/hyp/nvhe/hyp-main.c | 15 ++++++++------- > 1 file changed, 8 insertions(+), 7 deletions(-) > > 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); > + } > } > -- > 2.29.2.299.gdc1121823c-goog > > Thanks, M. -- Without deviation from the norm, progress is not possible. _______________________________________________ kvmarm mailing list kvmarm@lists.cs.columbia.edu https://lists.cs.columbia.edu/mailman/listinfo/kvmarm 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 X-Spam-Level: X-Spam-Status: No, score=-14.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,INCLUDES_CR_TRAILER,INCLUDES_PATCH,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED 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 0C847C2D0E4 for ; Mon, 23 Nov 2020 14:33:16 +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 7F98720773 for ; Mon, 23 Nov 2020 14:33:15 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="qcqrjBe4"; dkim=fail reason="signature verification failed" (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="GpZ/3A6V" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 7F98720773 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org 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:Subject:To:From: Message-ID:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=oB1L/KVuML+Ax/uAoeTT9B5AJKVmbWdhnNNNtqSxLs4=; b=qcqrjBe4OsyXLT+v21jRWEv8+ 86ma0nOxTzwExEdZyEIt6BFqE4YkyxhR7470CmwCUNthMT5B6Yp25k9wauzujs8Zi5Lh+rpnKyd82 W8aDZZ/rMZN7a3fASOdCgXoNq+lAABBkR7v65qj9NuE1nbcqSMzJcW0/j8KtAILa56XBN4HOiLuJv oVGLBQywYFHvxL06wXfsom3PEduyEwgS34GFS8SgL7y22/Y2iv599XDbC9klGLh1eqEaubrCE0yTj IQKItvzsIULqwHDnE94X5M6SeP9mFUYzT1PVTMGtQaHIPNbjfHNzR02t/AHEo/PcUcCW8Qs+OSCYy s6dYdT/Vw==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1khCtd-0007Wg-8O; Mon, 23 Nov 2020 14:32:49 +0000 Received: from mail.kernel.org ([198.145.29.99]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1khCtE-0007Ox-KN for linux-arm-kernel@lists.infradead.org; Mon, 23 Nov 2020 14:32:26 +0000 Received: from disco-boy.misterjones.org (disco-boy.misterjones.org [51.254.78.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7E1292083E; Mon, 23 Nov 2020 14:32:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1606141943; bh=lDofIwi2BtW6n3G9yyz3mKUtQ/dbkrPPmWz16CrGPi0=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=GpZ/3A6VL9vrcXWbAJ7FguzGnep2k7UBr7K5iTyCQKc76oA3A9XrwGdRmKY+lRWuE Xf1jUB6+kgy8MCtw871AyjjXzjtXYFD3ZyRwIx8Y9y4TVuGYloOGFcTcl4dOeevuVd 1wpFK4aJvsTBHW6U3613MGfSfdmVVXrMGx2MUh8I= Received: from 78.163-31-62.static.virginmediabusiness.co.uk ([62.31.163.78] helo=wait-a-minute.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94) (envelope-from ) id 1khCtB-00CyXO-Bu; Mon, 23 Nov 2020 14:32:21 +0000 Date: Mon, 23 Nov 2020 14:32:20 +0000 Message-ID: <87k0uc5ekr.wl-maz@kernel.org> From: Marc Zyngier To: David Brazdil Subject: Re: [PATCH v2 07/24] kvm: arm64: Refactor handle_trap to use a switch In-Reply-To: <20201116204318.63987-8-dbrazdil@google.com> References: <20201116204318.63987-1-dbrazdil@google.com> <20201116204318.63987-8-dbrazdil@google.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 Emacs/27.1 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") X-SA-Exim-Connect-IP: 62.31.163.78 X-SA-Exim-Rcpt-To: dbrazdil@google.com, kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, james.morse@arm.com, julien.thierry.kdev@gmail.com, suzuki.poulose@arm.com, catalin.marinas@arm.com, will@kernel.org, dennis@kernel.org, tj@kernel.org, cl@linux.com, mark.rutland@arm.com, lorenzo.pieralisi@arm.com, qperret@google.com, ascull@google.com, qwandor@google.com, kernel-team@android.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201123_093225_333620_F1236474 X-CRM114-Status: GOOD ( 24.24 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Mark Rutland , kernel-team@android.com, Lorenzo Pieralisi , Andrew Walbran , Suzuki K Poulose , Catalin Marinas , Quentin Perret , linux-kernel@vger.kernel.org, James Morse , linux-arm-kernel@lists.infradead.org, Tejun Heo , Dennis Zhou , Christoph Lameter , Will Deacon , kvmarm@lists.cs.columbia.edu, Julien Thierry , Andrew Scull Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, 16 Nov 2020 20:43:01 +0000, David Brazdil wrote: > > 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. nit: SMC32 seems to be a leftover from the previous version. > > Signed-off-by: David Brazdil > --- > arch/arm64/kvm/hyp/nvhe/hyp-main.c | 15 ++++++++------- > 1 file changed, 8 insertions(+), 7 deletions(-) > > 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); > + } > } > -- > 2.29.2.299.gdc1121823c-goog > > Thanks, M. -- Without deviation from the norm, progress is not possible. _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel 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 X-Spam-Level: X-Spam-Status: No, score=-16.0 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS 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 ED2DEC2D0E4 for ; Mon, 23 Nov 2020 14:32:57 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 90C2320781 for ; Mon, 23 Nov 2020 14:32:57 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (1024-bit key) header.d=kernel.org header.i=@kernel.org header.b="GpZ/3A6V" Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2389240AbgKWOcZ (ORCPT ); Mon, 23 Nov 2020 09:32:25 -0500 Received: from mail.kernel.org ([198.145.29.99]:48368 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729794AbgKWOcY (ORCPT ); Mon, 23 Nov 2020 09:32:24 -0500 Received: from disco-boy.misterjones.org (disco-boy.misterjones.org [51.254.78.96]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 7E1292083E; Mon, 23 Nov 2020 14:32:23 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1606141943; bh=lDofIwi2BtW6n3G9yyz3mKUtQ/dbkrPPmWz16CrGPi0=; h=Date:From:To:Cc:Subject:In-Reply-To:References:From; b=GpZ/3A6VL9vrcXWbAJ7FguzGnep2k7UBr7K5iTyCQKc76oA3A9XrwGdRmKY+lRWuE Xf1jUB6+kgy8MCtw871AyjjXzjtXYFD3ZyRwIx8Y9y4TVuGYloOGFcTcl4dOeevuVd 1wpFK4aJvsTBHW6U3613MGfSfdmVVXrMGx2MUh8I= Received: from 78.163-31-62.static.virginmediabusiness.co.uk ([62.31.163.78] helo=wait-a-minute.misterjones.org) by disco-boy.misterjones.org with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94) (envelope-from ) id 1khCtB-00CyXO-Bu; Mon, 23 Nov 2020 14:32:21 +0000 Date: Mon, 23 Nov 2020 14:32:20 +0000 Message-ID: <87k0uc5ekr.wl-maz@kernel.org> From: Marc Zyngier To: David Brazdil Cc: kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, 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 , Andrew Walbran , kernel-team@android.com Subject: Re: [PATCH v2 07/24] kvm: arm64: Refactor handle_trap to use a switch In-Reply-To: <20201116204318.63987-8-dbrazdil@google.com> References: <20201116204318.63987-1-dbrazdil@google.com> <20201116204318.63987-8-dbrazdil@google.com> User-Agent: Wanderlust/2.15.9 (Almost Unreal) SEMI-EPG/1.14.7 (Harue) FLIM-LB/1.14.9 (=?UTF-8?B?R29qxY0=?=) APEL-LB/10.8 Emacs/27.1 (x86_64-pc-linux-gnu) MULE/6.0 (HANACHIRUSATO) MIME-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset=US-ASCII X-SA-Exim-Connect-IP: 62.31.163.78 X-SA-Exim-Rcpt-To: dbrazdil@google.com, kvmarm@lists.cs.columbia.edu, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, james.morse@arm.com, julien.thierry.kdev@gmail.com, suzuki.poulose@arm.com, catalin.marinas@arm.com, will@kernel.org, dennis@kernel.org, tj@kernel.org, cl@linux.com, mark.rutland@arm.com, lorenzo.pieralisi@arm.com, qperret@google.com, ascull@google.com, qwandor@google.com, kernel-team@android.com X-SA-Exim-Mail-From: maz@kernel.org X-SA-Exim-Scanned: No (on disco-boy.misterjones.org); SAEximRunCond expanded to false Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, 16 Nov 2020 20:43:01 +0000, David Brazdil wrote: > > 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. nit: SMC32 seems to be a leftover from the previous version. > > Signed-off-by: David Brazdil > --- > arch/arm64/kvm/hyp/nvhe/hyp-main.c | 15 ++++++++------- > 1 file changed, 8 insertions(+), 7 deletions(-) > > 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); > + } > } > -- > 2.29.2.299.gdc1121823c-goog > > Thanks, M. -- Without deviation from the norm, progress is not possible.