From patchwork Mon Feb 11 17:45:43 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Will Deacon X-Patchwork-Id: 158019 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp2878530jaa; Mon, 11 Feb 2019 09:45:55 -0800 (PST) X-Google-Smtp-Source: AHgI3IZDTmKdMY2oSenh7ZJQ4E7gJmBRCUStV0Gd2bBJpsEgC9cJuhR/KdYhQaakOIwfCZu51Gio X-Received: by 2002:a17:902:5ac9:: with SMTP id g9mr18557813plm.205.1549907155503; Mon, 11 Feb 2019 09:45:55 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549907155; cv=none; d=google.com; s=arc-20160816; b=myhZaaQ8vgKGWxcayX4lUeReAQKorllTQHjjmphKsdK1ZoG7fF7mrhwUvW5bcP7u6R En3XDR+u52d3oqyfLn960sR1hSq4la004LQZt75uN8412mU2zdOxmyUWNgiosGXQ0IOD sWmhHTYkFMstb4DbZl4o8AWDK0OAoxtc6Is7A+HAFxWbryxsWcojH3pye3iqmR4X3x/l 5sYfUCTWkKx0TWzmV9RaD1FjdHBfjrPtL4fvSgTutwuP5C3pwORGhLOnrgvVZBKxqGWW 8RV00emYc/kOYlQhVbq0WGVWy6iYras3GwYuy+gjv2DQOrphJ3+Wd7tIS/C0NaxMYdF6 48JQ== 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=f8lgXyDyzxDO6suoziSGaXJWyasyFHhhuq7mQMbnoJY=; b=tNz2sBMOe62gpeY9pBMu3TfpV5WuX9nGZ5ZKQCcKMnRSHby3+3D0sJHUjYp+c4j1rl tiauqre5X2X6BA0NyamGTMG0BCIShT7a1aExgMLgG8+0gIooclPFOZH8D3pE1IHdtv48 nypJOv2XIWC7viO73RX7k7cA1/rivnVeCyD3toQRzlg2iNVxAW/zj2saPsOAlS4IXcwg S12JSvMT4Tz8GWPsYaqJ8rnd//YH3/wC6BFW+yUzSAobUdhUwGDZQJP+Xbg/w6s59Dge r6CEqRudigX13BvsSkxRuDcmTcwiXKBp9G7RZAds4A5UcfXqVsZUumAAHWBIOzUb7AKT lcyg== 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 gn11si10161576plb.94.2019.02.11.09.45.55; Mon, 11 Feb 2019 09:45:55 -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 S1731372AbfBKRpx (ORCPT + 31 others); Mon, 11 Feb 2019 12:45:53 -0500 Received: from foss.arm.com ([217.140.101.70]:54876 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1730177AbfBKRpw (ORCPT ); Mon, 11 Feb 2019 12:45:52 -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 9C63F15AD; Mon, 11 Feb 2019 09:45:51 -0800 (PST) Received: from fuggles.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 684783F675; Mon, 11 Feb 2019 09:45:50 -0800 (PST) From: Will Deacon To: linux-arch@vger.kernel.org Cc: linux-kernel@vger.kernel.org, andrew.murray@arm.com, arnd@arndb.de, catalin.marinas@arm.com, Will Deacon Subject: [PATCH 1/2] asm-generic/io: Pass result on inX() accessor to __io_par() Date: Mon, 11 Feb 2019 17:45:43 +0000 Message-Id: <20190211174544.4302-2-will.deacon@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190211174544.4302-1-will.deacon@arm.com> References: <20190211174544.4302-1-will.deacon@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The inX() I/O accessors must enforce ordering against subsequent calls to the delay() routines, so that a read-back from a device can be used to postpone a subsequent write to the same device. On some architectures, including arm64, this ordering can only be achieved by creating a dependency on the value returned by the inX() operation, so we need to pass the value we read to the __io_par() macro in this case. Reported-by: Andrew Murray Signed-off-by: Will Deacon --- include/asm-generic/io.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) -- 2.11.0 Acked-by: Arnd Bergmann diff --git a/include/asm-generic/io.h b/include/asm-generic/io.h index d356f802945a..b5737c0d8316 100644 --- a/include/asm-generic/io.h +++ b/include/asm-generic/io.h @@ -65,7 +65,7 @@ #endif #ifndef __io_par -#define __io_par() __io_ar() +#define __io_par(v) __io_ar() #endif @@ -471,7 +471,7 @@ static inline u8 inb(unsigned long addr) __io_pbr(); val = __raw_readb(PCI_IOBASE + addr); - __io_par(); + __io_par(val); return val; } #endif @@ -484,7 +484,7 @@ static inline u16 inw(unsigned long addr) __io_pbr(); val = __le16_to_cpu(__raw_readw(PCI_IOBASE + addr)); - __io_par(); + __io_par(val); return val; } #endif @@ -497,7 +497,7 @@ static inline u32 inl(unsigned long addr) __io_pbr(); val = __le32_to_cpu(__raw_readl(PCI_IOBASE + addr)); - __io_par(); + __io_par(val); return val; } #endif From patchwork Mon Feb 11 17:45:44 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Will Deacon X-Patchwork-Id: 158020 Delivered-To: patch@linaro.org Received: by 2002:a02:48:0:0:0:0:0 with SMTP id 69csp2878608jaa; Mon, 11 Feb 2019 09:46:00 -0800 (PST) X-Google-Smtp-Source: AHgI3IYP4qW5CAESVyzxIiWcC5aNXU2uC9Ee5rb/aeNqK8lmAXBlJf2vfoQglK2hzGLeppm6ENr5 X-Received: by 2002:a17:902:2e03:: with SMTP id q3mr30887250plb.330.1549907160228; Mon, 11 Feb 2019 09:46:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1549907160; cv=none; d=google.com; s=arc-20160816; b=TKaLE5JFjR+p+xyaSk/xTlYsQIiKadgALX6p/5ED+f+batMXN6xQXzvig0M5FKos9F 0fG0OyEDGGdnPR8fHn4RCYTaz8U6Bywf5kPGYyKhhyrutOZaJEJCbWwHmyyOGacWWqi7 efaP4kQ1FqL37znuvjhy6OfyfwEWh/EsXec4WqCar+TQIt4BnRr6XZ9bPMZYrqAVcQRs OMfCs77rNjyx6spJrCMmJoXHAGBSCpsxorn4DqMY/nl3hqxjR2k0Tk1AoxkrQsDo5i8N kuw3MSQICnhad80C2PeXDoHi1M3jWxOLt+i8j5hES4BsG6Y64Tv1De7+5dNq+TDQyJkQ 11wA== 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=5O++PMZpMFSPPx/IhNSuaR1fS0skPDQLFPMsBfQJh4o=; b=wSRK3+RpLHUxcdfUQ83dGamcG+EDhb1L/OHteGYqQtB5f2gDbJ/fb4oYIumcJcgbNn 3u2UTwi6dcLY0niECRrVcrMohs/WxmHS0Mz9kWxm7SudPBF9B76FgZ42Q5LHVj2HDwcF 0t7gQuMyRT32guzUUIIJUK7TM1lB/8kdgODWCtV9fE3FAhnwptEtH9eF5ZMuRiGg25sX WA87nqOCIoNxQaQT2AYMFvxOVSQBjMv62H8lPhxAM6Hd2/0owNMlGht4lkGYgOS37YDI 9bjdsH2uEF4zRjByuenae+AF9Xi/oHnscA+DlprEjoHPoPoBbUUsVhMv9H+Xil2KQKLC Xtsw== 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 i39si6704954plb.256.2019.02.11.09.45.59; Mon, 11 Feb 2019 09:46:00 -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 S1731802AbfBKRp6 (ORCPT + 31 others); Mon, 11 Feb 2019 12:45:58 -0500 Received: from usa-sjc-mx-foss1.foss.arm.com ([217.140.101.70]:54882 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731225AbfBKRpx (ORCPT ); Mon, 11 Feb 2019 12:45:53 -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 21556EBD; Mon, 11 Feb 2019 09:45:53 -0800 (PST) Received: from fuggles.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 D97813F675; Mon, 11 Feb 2019 09:45:51 -0800 (PST) From: Will Deacon To: linux-arch@vger.kernel.org Cc: linux-kernel@vger.kernel.org, andrew.murray@arm.com, arnd@arndb.de, catalin.marinas@arm.com, Will Deacon Subject: [PATCH 2/2] arm64: io: Hook up __io_par() for inX() ordering Date: Mon, 11 Feb 2019 17:45:44 +0000 Message-Id: <20190211174544.4302-3-will.deacon@arm.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20190211174544.4302-1-will.deacon@arm.com> References: <20190211174544.4302-1-will.deacon@arm.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Ensure that inX() provides the same ordering guarantees as readX() by hooking up __io_par() so that it maps directly to __iormb(). Reported-by: Andrew Murray Signed-off-by: Will Deacon --- arch/arm64/include/asm/io.h | 1 + 1 file changed, 1 insertion(+) -- 2.11.0 diff --git a/arch/arm64/include/asm/io.h b/arch/arm64/include/asm/io.h index ee723835c1f4..2985febe63ec 100644 --- a/arch/arm64/include/asm/io.h +++ b/arch/arm64/include/asm/io.h @@ -121,6 +121,7 @@ static inline u64 __raw_readq(const volatile void __iomem *addr) : "memory"); \ }) +#define __io_par __iormb #define __iowmb() wmb() #define mmiowb() do { } while (0)