Received: by 2002:ac0:a5a6:0:0:0:0:0 with SMTP id m35-v6csp7258233imm; Tue, 28 Aug 2018 08:54:23 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZpJ6JN1KMQwWrvXixnAg0Ks0GZPUAkD4o736tq+sWodzoDpWSM8JETaKOfxgA2a8e7k0bz X-Received: by 2002:a63:ed4f:: with SMTP id m15-v6mr2111700pgk.147.1535471663333; Tue, 28 Aug 2018 08:54:23 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1535471663; cv=none; d=google.com; s=arc-20160816; b=XxMPGAsMEqLah5csMh/CqRQmX3CIG5Bce+eT11KjhtjoOBjCpsZbOe3JhkFyBuAJaC z22MNUWvCpe8io94NzeuL9Ctz/ToNdHzquckc3xENlx2ZZWyu1Q9zr505DBf2E0AaSF3 xYMXtORm2ukccdBMYvuk6r4Y++/mwCU87i67a5kRkNekB88C9QgA4eqG/TO1PUlaMepg NAUsKAUpbCoK3CVGBhv6wKWeeKwNvyugSCk39yeTQmot9f/zhYD1I6byQ5gnLWxtaPJd QVb25qBHqZKe6VycA5fbexblfDbaqLtRubmOUWx+QWZeHiORfeDsGET7QHl7bS1EDOB8 fc5Q== 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:arc-authentication-results; bh=SQYppBauOHrFL8IIY5AbfC9MrwHjUtO+d4b5QOdkYUA=; b=DlbWIxDCqUA7LclMyCrFIyAUYTDQ+gaoIk+WbrNGFioJmw3rk4ZL1TqT+2ZCnH3HUY ByQuFQ3zbWe163Rpj+Ap7SbFgM87/UdtcwSbmpcTm+RnwlBnjdJs5Q43s5YogSVlaC0D uzykpL9k116ShzGCjrBUd9mE642QhY1hGaMzomPr10eDvQuoy+yt0vuAhh3vdF67qrMd VsojwUztTmlI9McgFd7gSFwqT5VQ2juXz00FXJ3kDh/F2Eo6ZzXVClGz7IFrfKsCRPMW nHf461U7LPdjX8JQFoYLarnU2tLl4DtA5lTWPaGrklCxrSOfiMrsXNfky48Dd9QUPB37 14Mg== 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 35-v6si1347447pgo.639.2018.08.28.08.54.08; Tue, 28 Aug 2018 08:54:23 -0700 (PDT) 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 S1727627AbeH1Tod (ORCPT + 99 others); Tue, 28 Aug 2018 15:44:33 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:41028 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726383AbeH1Tod (ORCPT ); Tue, 28 Aug 2018 15:44:33 -0400 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 9DC1BED1; Tue, 28 Aug 2018 08:52:16 -0700 (PDT) Received: from e112298-lin.Emea.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 AF97B3F557; Tue, 28 Aug 2018 08:52:14 -0700 (PDT) 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, mark.rutland@arm.com, christoffer.dall@arm.com, james.morse@arm.com, catalin.marinas@arm.com, will.deacon@arm.com, Julien Thierry Subject: [PATCH v5 12/27] arm64: Unmask PMR before going idle Date: Tue, 28 Aug 2018 16:51:22 +0100 Message-Id: <1535471497-38854-13-git-send-email-julien.thierry@arm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1535471497-38854-1-git-send-email-julien.thierry@arm.com> References: <1535471497-38854-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. Tested-by: Daniel Thompson 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 03646e6..cc1caf7 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, #ICC_PMR_EL1_UNMASKED + msr_s SYS_ICC_PMR_EL1, x2 // unmask at 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