Received: by 2002:ac0:a594:0:0:0:0:0 with SMTP id m20-v6csp3276078imm; Fri, 25 May 2018 02:55:30 -0700 (PDT) X-Google-Smtp-Source: AB8JxZqFwU95HHoM6rabxex+COc8xXmicYENh9GsFHGrj9ptH8tYqd41/dcZmfvWMqtc9KVd1bdW X-Received: by 2002:a63:583:: with SMTP id 125-v6mr69561pgf.385.1527242130901; Fri, 25 May 2018 02:55:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1527242130; cv=none; d=google.com; s=arc-20160816; b=Eth8dsnpzrYB0u3Q52QZUmRsnKF9EK6V578bVLGvWl6ZRXeUIEB4CIFMKoOgYK2m2o Q8eVvoFHLqt5+WpzOIPCBEfrBnCk6Cf4J7vvbE9PjwowlQNO4qOeU/rxNsYea3DookKq YaqmgiySDzYfu6KkCRMNBlxEzoCRKUCnTeKbLhw0HOK8GVAOrHYyK7g5jn8la18aRd/q I+w8vAa89ZJEbqOnXHxw+VWnVMfZoYxtNQytNbFx+bKWF2PND1DOZA+zwaLX10/bxHqG d6k6PDyeZwj5jWYhZAGzEROMdptotzgIsih/flAe59hvlVmXKIL4+iY+InaNXWhHI7x8 vqXQ== 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=hdNrVNsZlriqjRxj5KO1/KGhrQPkLtWM8sariJgc2xI=; b=oqBEIEhmw8itlAu2a+RXjNGvz4TxZUbAV0v8blJnox8g2sjfpRcLG0TYVVI7yUPDAv JYAi/sxrBlGbsL6e4wp88yoHJEEPFM4D8v6eDyzy4E6m+vA42vlQG1ehUpV+6XIPA5y6 jxALR6uPEQyNonEd0uZER3xZ5KNy3LEf2XOSMDA+nPtSAWRdkYY/osvBHHfi0YZ15uPs chrRmaldMm+Fcn++NVooO8T6Et5brK3LKrFjFLJll0GqLdEjSM38cfolwmiADU05x1jR +FfFS/i2FZ0K2YcaOaFgZ6ESl7MrFUD62wa6KEv3e0iX/Gphj8UO5ktvdGf9tzGgQLln HKoQ== 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 u2-v6si1722890plr.598.2018.05.25.02.55.16; Fri, 25 May 2018 02:55:30 -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 S966072AbeEYJu3 (ORCPT + 99 others); Fri, 25 May 2018 05:50:29 -0400 Received: from foss.arm.com ([217.140.101.70]:57522 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S966029AbeEYJuZ (ORCPT ); Fri, 25 May 2018 05:50:25 -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 0F06B1993; Fri, 25 May 2018 02:50:25 -0700 (PDT) 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 050E53F25D; Fri, 25 May 2018 02:50:22 -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 v4 12/26] arm64: Unmask PMR before going idle Date: Fri, 25 May 2018 10:49:18 +0100 Message-Id: <1527241772-48007-13-git-send-email-julien.thierry@arm.com> X-Mailer: git-send-email 1.9.1 In-Reply-To: <1527241772-48007-1-git-send-email-julien.thierry@arm.com> References: <1527241772-48007-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 5f9a73a..e7cafbf 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