From patchwork Wed Dec 26 11:20:20 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrii Anisov X-Patchwork-Id: 154516 Delivered-To: patch@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp5729252ljp; Wed, 26 Dec 2018 03:23:12 -0800 (PST) X-Google-Smtp-Source: ALg8bN6yGXIXSybznrEEkrTlTuFPyGuWYRQD/AvoZHd2yJ0G6qQ0bKjEW4f1U/A2ZvYse9iEmJzz X-Received: by 2002:a25:9942:: with SMTP id n2mr839029ybo.364.1545823392726; Wed, 26 Dec 2018 03:23:12 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1545823392; cv=none; d=google.com; s=arc-20160816; b=SCuDhiwbf4tEGVhkaboWhsqwGDeuFjFFW9HIxx5uRGfsazFFnRH8D0OKcwwQ1b4vRe PBkvVV3S7sT+IHIIn+EcSJ/+k/rNW97WK1Zk0Udha3MzCs4ktiGqwHxXBQxL7tuRmtL7 3G46IfKwoaoLvQZDYwnYonNkLy8/wu3hGAfYWq3jPLvuh0G1I5OPwrbkUYh/CBbijK3o qmvQ9e9zblDh64H0DbQ/fFORv0L9RvzF4VTDy1EE/nqxRXcWhcIxx5Y08kimUV0046sU mX2n6dBti60uJk7F27rdPPgDb05kCmzQGRJngWk6Vf/nKQ+qY8JrUpkhNCrhQvltqyOf S3WA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version:cc :list-subscribe:list-help:list-post:list-unsubscribe:list-id :precedence:subject:references:in-reply-to:message-id:date:to:from :dkim-signature; bh=7Zxlj1a46VxkW551A7llDa8SsMJTA8d98qsaYTqqHj0=; b=DvzfKP10RlY/8FV8Uv3HiWQ7BKkkPFyooGF+tUdJT01lxIzdXnpvAH08RyLBFiE5Ae DhYopPx1I7/QT6cFPGcoc4t3zqjG6fcFvZrj633rMYlhKh4CKOh7Wp8LQM9x1wlB9W0y ZbaQXnAMwRN6Fdd4CQADCk5VkdvKiNZh8wgBCo8b5m2OjQKHR8j8obC0KhIldW6n534z dSgnnQ95x7UJbSYQfy3WB8ue66Uqcc8zB3+tfl9NJBIGyOXGQKFNbhsY/LwoyibFHza7 Jj44vxAofxrtXP+aknOWY9FmeuMFlqh1NE8JjuuvHdIf9hMvs5jNtkH7nXo07L6D2nE0 OonA== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=gQ7s7aPJ; spf=pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from lists.xenproject.org (lists.xenproject.org. [192.237.175.120]) by mx.google.com with ESMTPS id h18si6600976ybs.254.2018.12.26.03.23.12 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Wed, 26 Dec 2018 03:23:12 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; Authentication-Results: mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b=gQ7s7aPJ; spf=pass (google.com: best guess record for domain of xen-devel-bounces@lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=fail (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1gc7F3-000896-6O; Wed, 26 Dec 2018 11:20:49 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1gc7F1-00087S-Cs for xen-devel@lists.xenproject.org; Wed, 26 Dec 2018 11:20:47 +0000 X-Inumbo-ID: 499f9045-0900-11e9-8e1d-bc764e045a96 Received: from mail-lj1-x243.google.com (unknown [2a00:1450:4864:20::243]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id 499f9045-0900-11e9-8e1d-bc764e045a96; Wed, 26 Dec 2018 11:20:46 +0000 (UTC) Received: by mail-lj1-x243.google.com with SMTP id q2-v6so13628182lji.10 for ; Wed, 26 Dec 2018 03:20:45 -0800 (PST) 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=aDSQ+i+PWcXIeoRZOtAjpm/mV+YyQa1fqMBynUNNx1M=; b=gQ7s7aPJDbJeuIT5VD2Y9ILEkhLee708jhvttYrHaSCrA2LdYCk8p9NZ8TIs1e50mC goOQfEI4V8ve7eA8aVgLT2zb/IPjd6vNPs9oxeg3oFjuWM358a/NvUozEi0vPA9M514U aetNcg76B4XBG6LBvQ0xRUIRDg0rgzIynysGY6cJHUUyjLJTYCAvw3AcPjaBcp+ISLO/ L9n/3a3a3gxYmqegMolr6Nsule0z4tLzYghTOT9er4/R/IyvN0mPPdMHxvRh468On/8+ bEdPn8Hbq/oQRfqkY/0ktRFnWWc80knIkSjTaRPY1kYvyoirVw40tHP8IzhHjm6IKCdr AeOA== 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=aDSQ+i+PWcXIeoRZOtAjpm/mV+YyQa1fqMBynUNNx1M=; b=fpVLaizO33Q4C3+wQ1jP51QwaYFrQ/GtHgDzObkhibfLmxGcNRoi888cCQ8cRPv9FF Se0VlVMvVOyJkXJYawiH10LMO7qVhllnmxC7QXma00kdMAjecjLvnA2d2Eo2cX3/vdIs HBZRov9JyP/3NdCRl61OeezqVgBS6sqN01a9jIX6u1RtiGy5TUVE3efUSujhwy09yigH QMvfGE+2XxcoFbSD1E1svrcxeZSWCLZB/OlgnRxoLkWR87E2qKjhjfJ/gGCJYYItPuFe gsUgRlfXWcnvr1T7bE0AgpiPPTyUlOPYzJVFoQQqoIjb7KF+YnOrIid+Xa82vCNnM7ip 9OGQ== X-Gm-Message-State: AJcUukdeGCzfgmBp9smQnDLeEaJpkOEBMyHKHdOTnSC3PPOn9w8zKnYc ++v3u3CoOVvt/qRHHcMsihRJ/6E/ X-Received: by 2002:a2e:81d3:: with SMTP id s19-v6mr1832501ljg.138.1545823244210; Wed, 26 Dec 2018 03:20:44 -0800 (PST) Received: from aanisov-work.kyiv.epam.com (ll-22.209.223.85.sovam.net.ua. [85.223.209.22]) by smtp.gmail.com with ESMTPSA id g4-v6sm7565259lji.17.2018.12.26.03.20.42 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 26 Dec 2018 03:20:43 -0800 (PST) From: Andrii Anisov To: xen-devel@lists.xenproject.org Date: Wed, 26 Dec 2018 13:20:20 +0200 Message-Id: <1545823227-6207-10-git-send-email-andrii.anisov@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1545823227-6207-1-git-send-email-andrii.anisov@gmail.com> References: <1545823227-6207-1-git-send-email-andrii.anisov@gmail.com> Subject: [Xen-devel] [RFC v2 09/16] xen/arm: Re-enable interrupt later in the trap path X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: Andre Przywara , Julien Grall , Stefano Stabellini , Andrii Anisov MIME-Version: 1.0 Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" From: Julien Grall This makes function enter_hypervisor_head() being executed with irqs locked. This also give a fine side effect - it assures that LRs are cleared prior to any IRQs processing, which leads to a better (faster) IRQs processing. Signed-off-by: Julien Grall [Andrii: add a justification commit message] Signed-off-by: Andrii Anisov --- xen/arch/arm/arm64/entry.S | 11 +++++------ xen/arch/arm/traps.c | 6 ++++++ 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/xen/arch/arm/arm64/entry.S b/xen/arch/arm/arm64/entry.S index 97b05f5..8f28789 100644 --- a/xen/arch/arm/arm64/entry.S +++ b/xen/arch/arm/arm64/entry.S @@ -195,7 +195,6 @@ hyp_error_invalid: hyp_error: entry hyp=1 - msr daifclr, #2 mov x0, sp bl do_trap_hyp_serror exit hyp=1 @@ -203,7 +202,7 @@ hyp_error: /* Traps taken in Current EL with SP_ELx */ hyp_sync: entry hyp=1 - msr daifclr, #6 + msr daifclr, #4 mov x0, sp bl do_trap_hyp_sync exit hyp=1 @@ -304,7 +303,7 @@ guest_sync_slowpath: ALTERNATIVE("bl check_pending_vserror; cbnz x0, 1f", "nop; nop", SKIP_SYNCHRONIZE_SERROR_ENTRY_EXIT) - msr daifclr, #6 + msr daifclr, #4 mov x0, sp bl do_trap_guest_sync 1: @@ -332,7 +331,7 @@ guest_fiq_invalid: guest_error: entry hyp=0, compat=0 - msr daifclr, #6 + msr daifclr, #4 mov x0, sp bl do_trap_guest_serror exit hyp=0, compat=0 @@ -347,7 +346,7 @@ guest_sync_compat: ALTERNATIVE("bl check_pending_vserror; cbnz x0, 1f", "nop; nop", SKIP_SYNCHRONIZE_SERROR_ENTRY_EXIT) - msr daifclr, #6 + msr daifclr, #4 mov x0, sp bl do_trap_guest_sync 1: @@ -375,7 +374,7 @@ guest_fiq_invalid_compat: guest_error_compat: entry hyp=0, compat=1 - msr daifclr, #6 + msr daifclr, #4 mov x0, sp bl do_trap_guest_serror exit hyp=0, compat=1 diff --git a/xen/arch/arm/traps.c b/xen/arch/arm/traps.c index 67c08ab..6fa562e 100644 --- a/xen/arch/arm/traps.c +++ b/xen/arch/arm/traps.c @@ -2009,6 +2009,8 @@ static void enter_hypervisor_head(struct cpu_user_regs *regs) { struct vcpu *v = current; + ASSERT(!local_irq_is_enabled()); + /* If the guest has disabled the workaround, bring it back on. */ if ( needs_ssbd_flip(v) ) arm_smccc_1_1_smc(ARM_SMCCC_ARCH_WORKAROUND_2_FID, 1, NULL); @@ -2043,6 +2045,7 @@ void do_trap_guest_sync(struct cpu_user_regs *regs) const union hsr hsr = { .bits = regs->hsr }; enter_hypervisor_head(regs); + local_irq_enable(); switch ( hsr.ec ) { @@ -2174,6 +2177,7 @@ void do_trap_hyp_sync(struct cpu_user_regs *regs) const union hsr hsr = { .bits = regs->hsr }; enter_hypervisor_head(regs); + local_irq_enable(); switch ( hsr.ec ) { @@ -2212,6 +2216,7 @@ void do_trap_hyp_sync(struct cpu_user_regs *regs) void do_trap_hyp_serror(struct cpu_user_regs *regs) { enter_hypervisor_head(regs); + local_irq_enable(); __do_trap_serror(regs, VABORT_GEN_BY_GUEST(regs)); } @@ -2219,6 +2224,7 @@ void do_trap_hyp_serror(struct cpu_user_regs *regs) void do_trap_guest_serror(struct cpu_user_regs *regs) { enter_hypervisor_head(regs); + local_irq_enable(); __do_trap_serror(regs, true); }