Received: by 2002:a05:6a10:9afc:0:0:0:0 with SMTP id t28csp1247078pxm; Wed, 23 Feb 2022 22:21:49 -0800 (PST) X-Google-Smtp-Source: ABdhPJwl9G2SJ1Xfp8QEpNloixRrcu0Ij0+Ccm2oo9YyAxBZhWT+MSu0X8tvbnjHj6ATvixgAFwn X-Received: by 2002:a17:906:9547:b0:6d5:b3de:11e2 with SMTP id g7-20020a170906954700b006d5b3de11e2mr1076761ejy.630.1645683708844; Wed, 23 Feb 2022 22:21:48 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1645683708; cv=none; d=google.com; s=arc-20160816; b=US6LlQTOWKWMyOhb8XG4f4AfUgK2Ieva79ZCBKAx0CIdQlTEc/+rRPd+KPo+TqCLmk NQT3swAO57NOzI3Rw/O+cfTWhsNZp1hb3RSKTCDlHugeW66AqHYhLTa6oqiaRhnVsyqp oNOvTh88pKwJQx+NS65vLOizEOVk5At2PF0gj1BOtV9kK6a+2dBkbJ0etbYhWqK6N9ZD ifFsQbfuQWFpqEFItHAw01Ua1bglaV9D4ArphK6SpjcdBq9bf651dgnkGP1FdVwL2YPu Q7JrWLSC982DtTePi3WNGIafJCgmPqKM3pGbmzqPMSu3Dxp0bXs5KK4kcMvqmIHnneS1 Inhg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=VaArZKOVuXCZjKizWGEFDBQ0tSKeLOEkh0wZIyEkkHo=; b=r5frsnocT8lmH1qHFP2Bl4TQQigBrWWGM4Ta60ukPwKsDhWiqa/eMFhst2CKgjdC0G Oa4emzUzH1yJUS1mPtQ6ua2LxP5WeC9sPYq8pqz5zrpAaG5x55lVkpTAmxosb4oP8ARq C4dstNMgNbRiTYkzKUqdkH5+s3ZdF5Xw33Is60CI/qEyTrSRV0WBNeCjHc+scWk91Qpw DtL5N395PODHLULdVXN/5CKjgE71ujpy5pGlK/v7/NammF7q351+BbpRGg84qPRjc5Jf MzojugVYAhf4Ddi6LBOtJYpuKrkg1VYaqemFv44wsNdMeFFrotCePW7Qj0lTctWhrRL4 ARiQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=Lrf43rAa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id dd4si1217179ejc.647.2022.02.23.22.21.25; Wed, 23 Feb 2022 22:21:48 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@quicinc.com header.s=qcdkim header.b=Lrf43rAa; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=quicinc.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231154AbiBXGIH (ORCPT + 99 others); Thu, 24 Feb 2022 01:08:07 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:56632 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231144AbiBXGIG (ORCPT ); Thu, 24 Feb 2022 01:08:06 -0500 Received: from alexa-out.qualcomm.com (alexa-out.qualcomm.com [129.46.98.28]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id ACB1BB8212; Wed, 23 Feb 2022 22:07:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=quicinc.com; i=@quicinc.com; q=dns/txt; s=qcdkim; t=1645682857; x=1677218857; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=VaArZKOVuXCZjKizWGEFDBQ0tSKeLOEkh0wZIyEkkHo=; b=Lrf43rAaNpkAYaNuI03eLNQ01cgn4tyrXboNtqs2dn/noQjE2Dp4UiBX /PjCh55+xnWx4cjU7RKYNKlpUTyoPLwgOuOInnJUWcsLDI2it50CC51c6 /bPtVxFdGKh4hzOnMfYIQPY5BonQlLs+5kCPP188MYScXh+EiK1B0TPSB 4=; Received: from ironmsg-lv-alpha.qualcomm.com ([10.47.202.13]) by alexa-out.qualcomm.com with ESMTP; 23 Feb 2022 22:07:36 -0800 X-QCInternal: smtphost Received: from nasanex01c.na.qualcomm.com ([10.47.97.222]) by ironmsg-lv-alpha.qualcomm.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Feb 2022 22:07:35 -0800 Received: from nalasex01a.na.qualcomm.com (10.47.209.196) by nasanex01c.na.qualcomm.com (10.47.97.222) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.15; Wed, 23 Feb 2022 22:07:35 -0800 Received: from blr-ubuntu-253.qualcomm.com (10.80.80.8) by nalasex01a.na.qualcomm.com (10.47.209.196) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.2.986.15; Wed, 23 Feb 2022 22:07:31 -0800 From: Sai Prakash Ranjan To: Will Deacon , Catalin Marinas , Arnd Bergmann , Steven Rostedt , "Marc Zyngier" CC: Trilok Soni , , gregkh , , , , "Sai Prakash Ranjan" Subject: [PATCHv10 1/6] arm64: io: Use asm-generic high level MMIO accessors Date: Thu, 24 Feb 2022 11:37:03 +0530 Message-ID: <31f49b98aa921f03d1a9f27af483ac0e5e5bcdb6.1644824638.git.quic_saipraka@quicinc.com> X-Mailer: git-send-email 2.33.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-Originating-IP: [10.80.80.8] X-ClientProxiedBy: nasanex01a.na.qualcomm.com (10.52.223.231) To nalasex01a.na.qualcomm.com (10.47.209.196) X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Remove custom arm64 MMIO accessors read{b,w,l,q} and their relaxed versions in support to use asm-generic defined accessors. Also define one set of IO barriers (ar/bw version) used by asm-generic code to override the arm64 specific variants. Suggested-by: Arnd Bergmann Signed-off-by: Sai Prakash Ranjan Acked-by: Catalin Marinas --- arch/arm64/include/asm/io.h | 41 ++++++++----------------------------- 1 file changed, 8 insertions(+), 33 deletions(-) diff --git a/arch/arm64/include/asm/io.h b/arch/arm64/include/asm/io.h index 7fd836bea7eb..1b436810d779 100644 --- a/arch/arm64/include/asm/io.h +++ b/arch/arm64/include/asm/io.h @@ -91,7 +91,7 @@ static inline u64 __raw_readq(const volatile void __iomem *addr) } /* IO barriers */ -#define __iormb(v) \ +#define __io_ar(v) \ ({ \ unsigned long tmp; \ \ @@ -108,39 +108,14 @@ static inline u64 __raw_readq(const volatile void __iomem *addr) : "memory"); \ }) -#define __io_par(v) __iormb(v) -#define __iowmb() dma_wmb() -#define __iomb() dma_mb() - -/* - * Relaxed I/O memory access primitives. These follow the Device memory - * ordering rules but do not guarantee any ordering relative to Normal memory - * accesses. - */ -#define readb_relaxed(c) ({ u8 __r = __raw_readb(c); __r; }) -#define readw_relaxed(c) ({ u16 __r = le16_to_cpu((__force __le16)__raw_readw(c)); __r; }) -#define readl_relaxed(c) ({ u32 __r = le32_to_cpu((__force __le32)__raw_readl(c)); __r; }) -#define readq_relaxed(c) ({ u64 __r = le64_to_cpu((__force __le64)__raw_readq(c)); __r; }) +#define __io_bw() dma_wmb() +#define __io_br(v) +#define __io_aw(v) -#define writeb_relaxed(v,c) ((void)__raw_writeb((v),(c))) -#define writew_relaxed(v,c) ((void)__raw_writew((__force u16)cpu_to_le16(v),(c))) -#define writel_relaxed(v,c) ((void)__raw_writel((__force u32)cpu_to_le32(v),(c))) -#define writeq_relaxed(v,c) ((void)__raw_writeq((__force u64)cpu_to_le64(v),(c))) - -/* - * I/O memory access primitives. Reads are ordered relative to any - * following Normal memory access. Writes are ordered relative to any prior - * Normal memory access. - */ -#define readb(c) ({ u8 __v = readb_relaxed(c); __iormb(__v); __v; }) -#define readw(c) ({ u16 __v = readw_relaxed(c); __iormb(__v); __v; }) -#define readl(c) ({ u32 __v = readl_relaxed(c); __iormb(__v); __v; }) -#define readq(c) ({ u64 __v = readq_relaxed(c); __iormb(__v); __v; }) - -#define writeb(v,c) ({ __iowmb(); writeb_relaxed((v),(c)); }) -#define writew(v,c) ({ __iowmb(); writew_relaxed((v),(c)); }) -#define writel(v,c) ({ __iowmb(); writel_relaxed((v),(c)); }) -#define writeq(v,c) ({ __iowmb(); writeq_relaxed((v),(c)); }) +/* arm64-specific, don't use in portable drivers */ +#define __iormb(v) __io_ar(v) +#define __iowmb() __io_bw() +#define __iomb() dma_mb() /* * I/O port access primitives. -- 2.33.1