From patchwork Fri Jan 11 03:36:28 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Andrew Jeffery X-Patchwork-Id: 1023363 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@bilbo.ozlabs.org Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by ozlabs.org (Postfix) with ESMTPS id 43bT8s5lfcz9sBQ for ; Fri, 11 Jan 2019 14:38:05 +1100 (AEDT) Authentication-Results: ozlabs.org; dmarc=none (p=none dis=none) header.from=aj.id.au Authentication-Results: ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=aj.id.au header.i=@aj.id.au header.b="oe900o0M"; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="lxfYi/BH"; dkim-atps=neutral Received: from lists.ozlabs.org (lists.ozlabs.org [IPv6:2401:3900:2:1::3]) by lists.ozlabs.org (Postfix) with ESMTP id 43bT8s3pyyzDr1V for ; Fri, 11 Jan 2019 14:38:05 +1100 (AEDT) X-Original-To: openbmc@lists.ozlabs.org Delivered-To: openbmc@lists.ozlabs.org Authentication-Results: lists.ozlabs.org; spf=pass (mailfrom) smtp.mailfrom=aj.id.au (client-ip=64.147.123.25; helo=wout2-smtp.messagingengine.com; envelope-from=andrew@aj.id.au; receiver=) Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=aj.id.au Authentication-Results: lists.ozlabs.org; dkim=pass (2048-bit key; unprotected) header.d=aj.id.au header.i=@aj.id.au header.b="oe900o0M"; dkim=pass (2048-bit key; unprotected) header.d=messagingengine.com header.i=@messagingengine.com header.b="lxfYi/BH"; dkim-atps=neutral Received: from wout2-smtp.messagingengine.com (wout2-smtp.messagingengine.com [64.147.123.25]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by lists.ozlabs.org (Postfix) with ESMTPS id 43bT8H32kyzDqws for ; Fri, 11 Jan 2019 14:37:35 +1100 (AEDT) Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.west.internal (Postfix) with ESMTP id 75DB6157F; Thu, 10 Jan 2019 22:37:32 -0500 (EST) Received: from mailfrontend1 ([10.202.2.162]) by compute4.internal (MEProxy); Thu, 10 Jan 2019 22:37:32 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=aj.id.au; h=from :to:cc:subject:date:message-id:mime-version :content-transfer-encoding; s=fm1; bh=Drlj8XPpA5ps8JCr3XEawOVFps SbvgBMABWHCVuGgzc=; b=oe900o0MlSjzsjaNJ1sIuuBmQXHm4rBjYGakdiZKGW DQja1KJxPELF5WUZNzcXL66URhQ5iIhJ3prk7nUwArSjgP55eSNM9lGtRrrmBh2v MPkIhXLl+tRRiqDWb1AHnZuavyZhpu+rxh49cEdp2qT4AcKSq+l3xmlHFGRvCqmu uyc5MQ1lHSxr+xzuLp/pMbEX17F4HdeQTioI+LlUKx9cD6O3GnfUtfRrvLn4JAZj XOoqDEX2Lven3YHmabuUVVJvuNnW3TyZLtCKD29LKxJFZUDUlFq7cM7nWzjtm8bp Ll0f7OdkxGqRUFgbdBo/4WSZrez8kyX/L8ELlI874dGA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :message-id:mime-version:subject:to:x-me-proxy:x-me-proxy :x-me-sender:x-me-sender:x-sasl-enc; s=fm1; bh=Drlj8XPpA5ps8JCr3 XEawOVFpsSbvgBMABWHCVuGgzc=; b=lxfYi/BH+PFQuPj7e5CROGOnwjP+LLAAk LkQJMhyZWGqaKyyfQejbXDf28F2ZeL7j7vcWZiY3rGONg49p+Eo0KgqjgXBIwaLE cvpv7jRNbgX0mGBDMDBCHn69vF6s4dJR+Jp7192XaaqhY3ihbXC/S5EHM9uicApH LYnXptwrwlrpENqWqGRI6NuQAmpmpIFTm5PG9IqYxy2la3L/pzdSrgoIFWOvArsl yLqmZmk15K3e3nEwkMaNXRsgPzhzbADiG19lVwKFh9AM0aPVVH8wRuiPzZqku1jj dGEqEgtcrcd+CI/YIsQtQeFGiJgiz6Bky/aA/H3j30z6D4Q+7dERA== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedtledrfeeggdehlecutefuodetggdotefrodftvf curfhrohhfihhlvgemucfhrghsthforghilhdpqfhuthenuceurghilhhouhhtmecufedt tdenucenucfjughrpefhvffufffkofgggfestdekredtredttdenucfhrhhomheptehnug hrvgifucflvghffhgvrhihuceorghnughrvgifsegrjhdrihgurdgruheqnecukfhppedv tddvrdekuddrudekrddvkeenucfrrghrrghmpehmrghilhhfrhhomheprghnughrvgifse grjhdrihgurdgruhenucevlhhushhtvghrufhiiigvpedt X-ME-Proxy: Received: from mistburn.bha-au.ibmmobiledemo.com (unknown [202.81.18.28]) by mail.messagingengine.com (Postfix) with ESMTPA id 20670E425A; Thu, 10 Jan 2019 22:37:27 -0500 (EST) From: Andrew Jeffery To: openbmc@lists.ozlabs.org Subject: [RFC linux dev-4.19] clocksource: fttmr010: Detect back-pressure for Aspeed controllers Date: Fri, 11 Jan 2019 14:06:28 +1030 Message-Id: <20190111033628.18677-1-andrew@aj.id.au> X-Mailer: git-send-email 2.19.1 MIME-Version: 1.0 X-BeenThere: openbmc@lists.ozlabs.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Development list for OpenBMC List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Andrew Jeffery , clg@kaod.org Errors-To: openbmc-bounces+incoming=patchwork.ozlabs.org@lists.ozlabs.org Sender: "openbmc" Signed-off-by: Andrew Jeffery --- See the cover letter on the corresponding qemu RFC series, to be sent after this patch. arch/arm/mach-aspeed/Kconfig | 1 + drivers/clocksource/timer-fttmr010.c | 7 +++++++ 2 files changed, 8 insertions(+) diff --git a/arch/arm/mach-aspeed/Kconfig b/arch/arm/mach-aspeed/Kconfig index 2d5570e6e186..6b82d5416cf0 100644 --- a/arch/arm/mach-aspeed/Kconfig +++ b/arch/arm/mach-aspeed/Kconfig @@ -7,6 +7,7 @@ menuconfig ARCH_ASPEED select FTTMR010_TIMER select MFD_SYSCON select PINCTRL + select GENERIC_CLOCKEVENTS_MIN_ADJUST help Say Y here if you want to run your kernel on an ASpeed BMC SoC. diff --git a/drivers/clocksource/timer-fttmr010.c b/drivers/clocksource/timer-fttmr010.c index cf93f6419b51..f15386b98289 100644 --- a/drivers/clocksource/timer-fttmr010.c +++ b/drivers/clocksource/timer-fttmr010.c @@ -124,6 +124,7 @@ static int fttmr010_timer_set_next_event(unsigned long cycles, { struct fttmr010 *fttmr010 = to_fttmr010(evt); u32 cr; + u32 l; /* Stop */ cr = readl(fttmr010->base + TIMER_CR); @@ -136,6 +137,12 @@ static int fttmr010_timer_set_next_event(unsigned long cycles, * into TIMER1_COUNT register when the timer is re-enabled. */ writel(cycles, fttmr010->base + TIMER1_LOAD); +#if CONFIG_GENERIC_CLOCKEVENTS_MIN_ADJUST + /* QEMU model may provide back-pressure on requested period */ + l = readl(fttmr010->base + TIMER1_LOAD); + if (l > cycles) + return -EINVAL; +#endif } else { /* Setup the match register forward in time */ cr = readl(fttmr010->base + TIMER1_COUNT);