Received: by 10.213.65.68 with SMTP id h4csp899334imn; Wed, 14 Mar 2018 03:40:13 -0700 (PDT) X-Google-Smtp-Source: AG47ELsloTgotD8H7v/fL0R961j7qEA55X/HBsTI/H2/KuXn9s8A4lUOuJgbLu+urbMteaGUtKMI X-Received: by 2002:a17:902:6c01:: with SMTP id q1-v6mr3732003plk.142.1521024012927; Wed, 14 Mar 2018 03:40:12 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521024012; cv=none; d=google.com; s=arc-20160816; b=KSWX4vrejL+HfiKnV47FVqo8POnmbL8+2yy8hC5nKoLW33vAL5M85BkCQO4kswIx3/ 6rsQ4/toKDAvHepNkfOabqjSJnSLG9GxrNqS1JL7av+fHfZ4B0Ay583rSnoVEHjFiRfv 7lAHkj4igB5ufn6uyAD9cqS4zrf5ctKoo69n2/gE7ntDjXkqgMAkD9AUQHwC4MPKJtyi QG6qQYdsqxQXHhBF60mpqMbnmpRH7cW+SO+25ZW314qbCC98WRWNy893W9km5dtCAiOa YG4qwu4vVbYoAmbEcDkA3PngSDeBfEH9XB5J3TXNOiDjGp8vnL7qxXHthLzG+5xd2NvP SrmA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=jzRZ3jz+g4s1bfoJSW+kcwjh3rhcwEqvSIT3GdNXRdw=; b=OheKkfphzrrM53/jXcrVzFXh9ziPmEUELG+tS6577gzHpWi8yt1o8OHItB/dRNUGM7 yBqzTZBKAl3ChQMXHh+97NYEmNMHqPR9hSwwybumqbOem18/SEOXkyB2zSQ7tl6HHtZ4 FAZlei1sMxhC75IPGexe0yzg3ycyEULsqvMsgbji4+pFk4jGoLEzrFQMbteKEf9HuYDs ObuMa+VA/Q2HGJRSpcvWx5K+NGD+Nq+HHc5shO+oYrVuV1ZPtR9zuUTHPGKAKU9E597c qh35XOOt7JKX5MIIG5hcfRxoJmxTl5nETwjSxVcFazxC7PLgS7c2WTzR1bKDCpEFyn6I cU3g== 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 x5-v6si1815121plm.443.2018.03.14.03.39.54; Wed, 14 Mar 2018 03:40:12 -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 S1751842AbeCNKi3 (ORCPT + 99 others); Wed, 14 Mar 2018 06:38:29 -0400 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:50374 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751502AbeCNKi2 (ORCPT ); Wed, 14 Mar 2018 06:38:28 -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 C699315AB; Wed, 14 Mar 2018 03:38:27 -0700 (PDT) Received: from lakrids.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.72.51.249]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 7037F3F53D; Wed, 14 Mar 2018 03:38:26 -0700 (PDT) Date: Wed, 14 Mar 2018 10:38:23 +0000 From: Mark Rutland To: Shanker Donthineni Cc: Marc Zyngier , linux-kernel , linux-arm-kernel , Thomas Gleixner , Jason Cooper , Vikram Sethi Subject: Re: [PATCH] irqchip/gic-v3: Ensure GICR_CTLR.EnableLPI=0 is observed before enabling Message-ID: <20180314103823.roo7qt7htcr27dkt@lakrids.cambridge.arm.com> References: <1520988601-16705-1-git-send-email-shankerd@codeaurora.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1520988601-16705-1-git-send-email-shankerd@codeaurora.org> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Mar 13, 2018 at 07:50:01PM -0500, Shanker Donthineni wrote: > The definition of the GICR_CTLR.RWP control bit was expanded to indicate > status of changing GICR_CTLR.EnableLPI from 1 to 0 is being in progress > or completed. Software must observe GICR_CTLR.RWP==0 after clearing > GICR_CTLR.EnableLPI from 1 to 0 and before writing GICR_PENDBASER and/or > GICR_PROPBASER, otherwise behavior is UNPREDICTABLE. > + /* Make sure LPIs are disabled before programming PEND/PROP registers */ > + if (val & GICR_CTLR_ENABLE_LPIS) { > + u32 count = 1000000; /* 1s! */ Please use USEC_PER_SEC from . > + /* Wait for GICR_CTLR.RWP==0 or timeout */ > + while (readl_relaxed(rbase + GICR_CTLR) & GICR_CTLR_RWP) { > + if (!count) { > + pr_err("CPU%d: Failed to disable LPIs\n", > + smp_processor_id()); > + return; > + } > + cpu_relax(); > + udelay(1); > + count--; > + }; Please use readl_relaxed_poll_timeout() from . /* Wait for GICR_CTLR.RWP==0 or timeout */ ret = readl_relaxed_poll_timeout(rbase + GICR_CTLR, reg, !(reg & GICR_CTLR_RWP), 1, USEC_PER_SEC); if (ret) { pr_err("CPU%d: Failed to disable LPIs\n", smp_processor_id()); return; } Thanks, Mark.