Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp3985547imu; Mon, 12 Nov 2018 04:01:56 -0800 (PST) X-Google-Smtp-Source: AJdET5cPr/zcHxAdrNDkfD9zO4ivoGcOWcZdkY6yRt8d7NwpuFb9yFLmKo50rsNzPhGKRoI/lJaH X-Received: by 2002:a63:2141:: with SMTP id s1mr595642pgm.148.1542024116153; Mon, 12 Nov 2018 04:01:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1542024116; cv=none; d=google.com; s=arc-20160816; b=WGboY/vdv8uHKpf7cpPQ7eb9ITVLdIYG42v5WBSr96/48WBXrb7JPFg2JFx07/wRHZ +pzz7wD/9Kt/ra1gU2q/8w5jMmdwBQFu+i5N0KgpnX+9fuY3q+dn9a1f32Byxf0LIDE9 neWBa9prfD5QAA35/6FBw07xNbL//++arkslCwp7gp8rOzEtHM6/ApQCvOAl5xUA2Lde kyv5gpqfr03x863x/J9pjJXgGV/K4M+eC8qEk4RKr3tVAfC5sUDNt+U72y8ZXkmJX6iq wqi8Kf0kfVG96QezlhLlXJlNkc+z3MNG6oOQ3M95DKhZZEsNcBPSeAe0zQA/trlEuExW P2Qw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from; bh=1SYnmYqJ0TRHG3yfCRctoMIwWNxIONqO466YlZ8eOV8=; b=MOQlqOXNrJm5ZxPj5OIUiippd9P3BiMh0SdZWTMQz+JTzas0G290pW4gJNcUR2pn/s 70bDVryQWxA49ztKPx73XtrgufmF9fv/DX0hrBB8mSslJMxnBnNz0BpSVmQhtiesPzTB 6RM3Owos0xGzLbVnS7QogjWbD3RJZZKDXasDEvSc7Pf05QV5xdsgvKHrOsGorcFu9F9t uJJJ5aKB1uouPExW6mjZWSsRwCaQj/xuivA1VPKxR0WBeWIyNQNoi3R2AZqUjhUzEqlC 4uCHU8wm0Ibyj9qVxrebQIyW/dkPRRt16fz7Hr3t8toSohEeJYzDpaPEsXyyXQwCG+7k +wkA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q24si15739758pgi.334.2018.11.12.04.01.35; Mon, 12 Nov 2018 04:01:56 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1730198AbeKLVwW (ORCPT + 99 others); Mon, 12 Nov 2018 16:52:22 -0500 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:34592 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729744AbeKLVul (ORCPT ); Mon, 12 Nov 2018 16:50:41 -0500 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.72.51.249]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id EE6671650; Mon, 12 Nov 2018 03:57:44 -0800 (PST) Received: from e112298-lin.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 24D4C3F5A0; Mon, 12 Nov 2018 03:57:43 -0800 (PST) From: Julien Thierry To: linux-arm-kernel@lists.infradead.org Cc: linux-kernel@vger.kernel.org, daniel.thompson@linaro.org, joel@joelfernandes.org, marc.zyngier@arm.com, christoffer.dall@arm.com, james.morse@arm.com, catalin.marinas@arm.com, will.deacon@arm.com, Julien Thierry Subject: [PATCH v6 08/24] arm64: Unmask PMR before going idle Date: Mon, 12 Nov 2018 11:56:59 +0000 Message-Id: <1542023835-21446-9-git-send-email-julien.thierry@arm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1542023835-21446-1-git-send-email-julien.thierry@arm.com> References: <1542023835-21446-1-git-send-email-julien.thierry@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org CPU does not received signals for interrupts with a priority masked by ICC_PMR_EL1. This means the CPU might not come back from a WFI instruction. Make sure ICC_PMR_EL1 does not mask interrupts when doing a WFI. Signed-off-by: Julien Thierry Suggested-by: Daniel Thompson Cc: Catalin Marinas Cc: Will Deacon --- arch/arm64/mm/proc.S | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/arch/arm64/mm/proc.S b/arch/arm64/mm/proc.S index 2c75b0b..3c7064c 100644 --- a/arch/arm64/mm/proc.S +++ b/arch/arm64/mm/proc.S @@ -20,6 +20,7 @@ #include #include +#include #include #include #include @@ -53,10 +54,27 @@ * cpu_do_idle() * * Idle the processor (wait for interrupt). + * + * If the CPU supports priority masking we must do additional work to + * ensure that interrupts are not masked at the PMR (because the core will + * not wake up if we block the wake up signal in the interrupt controller). */ ENTRY(cpu_do_idle) +alternative_if_not ARM64_HAS_IRQ_PRIO_MASKING + dsb sy // WFI may enter a low-power mode + wfi + ret +alternative_else + mrs x0, daif // save I bit + msr daifset, #2 // set I bit + mrs_s x1, SYS_ICC_PMR_EL1 // save PMR +alternative_endif + mov x2, #GIC_PRIO_IRQON + msr_s SYS_ICC_PMR_EL1, x2 // unmask PMR dsb sy // WFI may enter a low-power mode wfi + msr_s SYS_ICC_PMR_EL1, x1 // restore PMR + msr daif, x0 // restore I bit ret ENDPROC(cpu_do_idle) -- 1.9.1