From patchwork Fri Jul 26 10:37:34 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrii Anisov X-Patchwork-Id: 169796 Delivered-To: patch@linaro.org Received: by 2002:a92:4782:0:0:0:0:0 with SMTP id e2csp12855413ilk; Fri, 26 Jul 2019 03:39:18 -0700 (PDT) X-Google-Smtp-Source: APXvYqyk8MMIispI3CH6PE6l0zue0xpZpa9o57ZvAXU4QE2eYRocFWcWACglSiOiFkKSmfdlTP1l X-Received: by 2002:a02:aa8f:: with SMTP id u15mr7268260jai.39.1564137558422; Fri, 26 Jul 2019 03:39:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1564137558; cv=none; d=google.com; s=arc-20160816; b=W8DeF0jISBpe8Kg58CrVUozE7Mvj7SIf6DCj3js3keeij4nXo9qJkKqeKmkvscRCox b2ilb9mOrfJP828V+14LaAgj0AqhXjlza6EH5nZPymQjp3xmk0vyq/cyPnyVsFwj8vey 4epiF6CORWxVs7FYAJYHK2tflizk4Fmn7EU/FUNqVuGYF8w/cljgAVGH6QPI+cOSKkCN b+SieTvCFwSjB/KtJ09jt1vwr4aU0kWIgL5hXnNZaqmNyP1Mm3u8Aa599PG/UWQkgRb6 URpF6C5Zbhv5PuezcQmn993dw+JgG3hEEo8aD4ErNO/RUVWPpong7VvhOUrzxW3F3IqW Elqg== 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=EZ1cBuImb6Ap5fn61HKvU/m2TJ4b1A6M1wj/MLyZfbw=; b=waCB10H4XOMqo6leibw9dMngpwT9k4Q9IwCfSJzPivnpNGfqsEMePgJHdaFLNZ/UCA BzKDzmV1H8477DinBs8+54J8M+UqhrRtQ601rbTt1QSBvopY8JTtlxxNnCLNUAoN5V+l mxv/QkQBuEmrx4JW4AwL09RtS2eJWrr16W+tIinVorF9IxVbUwuvHvr7wbL/RXrRVft7 RcqONPHfRS71V1IcB5Ps3JIvbBHobFo5mjhxJ8epgnAUWe3mrJMHWdTJ4Dt5jkILaqjj yYPTSlXlyXgX8XwUmiLHnMbc5HIqmgAFm9MoZy9xaViwfb8S/L84VzUKIFfql2SOdx2z YIJQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=neutral (body hash did not verify) header.i=@gmail.com header.s=20161025 header.b="u4em/W6j"; 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 j9si11941236iom.41.2019.07.26.03.39.18 (version=TLS1_2 cipher=ECDHE-RSA-CHACHA20-POLY1305 bits=256/256); Fri, 26 Jul 2019 03:39:18 -0700 (PDT) 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="u4em/W6j"; 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 1hqxbg-0006Xt-KY; Fri, 26 Jul 2019 10:37:48 +0000 Received: from us1-rack-dfw2.inumbo.com ([104.130.134.6]) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1hqxbf-0006Xi-LC for xen-devel@lists.xenproject.org; Fri, 26 Jul 2019 10:37:47 +0000 X-Inumbo-ID: 678e6ef2-af91-11e9-8980-bc764e045a96 Received: from mail-lj1-x243.google.com (unknown [2a00:1450:4864:20::243]) by us1-rack-dfw2.inumbo.com (Halon) with ESMTPS id 678e6ef2-af91-11e9-8980-bc764e045a96; Fri, 26 Jul 2019 10:37:46 +0000 (UTC) Received: by mail-lj1-x243.google.com with SMTP id i21so51040302ljj.3 for ; Fri, 26 Jul 2019 03:37:46 -0700 (PDT) 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=+Sj40svUpTZp0FXDzpVnnnckBrBiw8PXNGcGLtUyPKE=; b=u4em/W6jRqWmOf+CYZ3d1Q3rNyyCnhsP4bkIqS0Bc27rpzcgf1ddnkGGBOtTBz/Kwv YnquHzQtRhbVjwZAfe4w6ETGxdR0sS+ZX0tVLMxszwSjoi5z1zAmqH3OOqva8UQBPBbN wgrF62Iun2BLLIVhHOCyhXEL0XMR9dMxe9GCaxELUhZsqeXmoigFCX/UvxTvLaCE9W1i dqf9QNT2TyATgcbCDEik6WMI8NgjyKGsc+/lO2rYCtE2JTytwtWsYKgQe0sFBNiuKpqY dDXVkzC6nE/KeQBVwwT6LXWu+tqPom9mqN6iLSuzagSaIrrmwMGDXZVAg78hpNnx4bJM Qwlg== 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=+Sj40svUpTZp0FXDzpVnnnckBrBiw8PXNGcGLtUyPKE=; b=N30fDrQNwMmFHlLGiG3WTYZOtaZ9oGCCdtweAbAzil8/xc92MEEtsqaHOAXZ/bm3mH Y/MLqKVymChaQM0cmrEVZstlKXTbZDq4ADzDfRyPBgzaRrR0iRLuTmGTxr/VM631c/B3 CM3Z1UYqpCKAC00RNUxzZIkRgV5YYAhWgkz4huWE5k41VDDnf5EATAjDYQsPGcKeZ0yn dXrCwctcef1DZiIM5VXj0Cr7aVDbOfKWSvwnvL+VfUAOa1yqKL4tYkUnKbfAI4IbAPe3 uAiPTeocRoj/1AWnr/15KPi3H44A79zmaRb0niCYVHAYxW+pfjGRz+Zbw3+tgWHrUvm3 4G/A== X-Gm-Message-State: APjAAAXNMbNUfBfv2+NIVHi2gXjbJg9QevElI0Fa3JzISnJ+WTrGw0bi dHXk7EqPh9seDg9ubpFMEaaJWI5Q X-Received: by 2002:a2e:9593:: with SMTP id w19mr1850913ljh.69.1564137464536; Fri, 26 Jul 2019 03:37:44 -0700 (PDT) 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 m4sm9938274ljc.56.2019.07.26.03.37.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 26 Jul 2019 03:37:43 -0700 (PDT) From: Andrii Anisov To: xen-devel@lists.xenproject.org Date: Fri, 26 Jul 2019 13:37:34 +0300 Message-Id: <1564137460-25629-2-git-send-email-andrii.anisov@gmail.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1564137460-25629-1-git-send-email-andrii.anisov@gmail.com> References: <1564137460-25629-1-git-send-email-andrii.anisov@gmail.com> Subject: [Xen-devel] [RFC 1/6] 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: Volodymyr Babchuk , 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. 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 3103620..5a9dc66 100644 --- a/xen/arch/arm/traps.c +++ b/xen/arch/arm/traps.c @@ -2017,6 +2017,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); @@ -2051,6 +2053,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 ) { @@ -2186,6 +2189,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 ) { @@ -2224,6 +2228,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)); } @@ -2231,6 +2236,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); }