Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp4129045imu; Fri, 30 Nov 2018 11:30:34 -0800 (PST) X-Google-Smtp-Source: AFSGD/XvJGyYz+1SCoj1UTcJI81LZoihasiWlneYn1R7DkBBN0g8Z23CChG/bj1O8ECJqnXQhjtk X-Received: by 2002:aa7:85d7:: with SMTP id z23mr7092701pfn.205.1543606234370; Fri, 30 Nov 2018 11:30:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543606234; cv=none; d=google.com; s=arc-20160816; b=t6KzfuknBE48uEVMkiFwYLhRkV4VY3QIySAxV50WgaVxLzbcUuGgVX7StwdguxSDTv MqZ0FMUrCoJjFiBBeRz98D0MwcuRG7aip6yT3eZhn8dxoCrdQi9BpOi/S4naGQ4nCmSu q6dnSqOEaZvaXYk+zAzn4168c31At4VF7mdgIxlUzqX0+v3z4bpLg9FYby253Y+FuO9/ BXLt7VTIm3RKVsYGAjodMOsm51vTLMybsr+n9NTSt/5z/s871ps9mWf7NSKx/LDSEj0H Cfww/tFZOIoQLJgpTcpocVmKe0n2om9kVySco3TkQ7GcTe0mfmee5k/YGX805ySgB9p0 uxIg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:content-transfer-encoding :content-language:accept-language:references:message-id:date :thread-index:thread-topic:subject:cc:to:from:dkim-signature; bh=q2GNK6YBsTlz/DUIohoAV0KIDZTNxA7yvSkHVOOTzic=; b=dYCdoC48vSJ6VBwVzlcnzBm3bGM/VMOh4Y7uLFb0uWw3OdZfTesJX9112a04Anzrqp UUtqhfQwAPGO3wf/1T4JmEjo1Cu5svRwXljXqE36XRBDVOLfEQWSxhTXnVg5OU+1NWEL Bh+sEHX8PNJUa8U4uF/7Wz43IGJhb2MpN6swDRfwtp0Idudwb3JY4PBj8rcouDryC6Br kqqGD0w14DBU67Ibn02nAYuSRJvnO4sAJ5B/xC5aT6tpYzkOarbexzv53JSw2T5u05xy 0+3PJy0FX7fAku2ShCMOsQrSH27PHt0bDQAkzcpiiZsXAPsAmc5oUnO+Bu4VwScvheq7 63kw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@synopsys.com header.s=mail header.b=HS0eWDst; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=synopsys.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id z188si5233288pgb.330.2018.11.30.11.30.19; Fri, 30 Nov 2018 11:30:34 -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; dkim=pass header.i=@synopsys.com header.s=mail header.b=HS0eWDst; 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; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=synopsys.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726970AbeLAGkE (ORCPT + 99 others); Sat, 1 Dec 2018 01:40:04 -0500 Received: from us01smtprelay-2.synopsys.com ([198.182.60.111]:53756 "EHLO smtprelay.synopsys.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726057AbeLAGkE (ORCPT ); Sat, 1 Dec 2018 01:40:04 -0500 Received: from mailhost.synopsys.com (mailhost1.synopsys.com [10.12.238.239]) by smtprelay.synopsys.com (Postfix) with ESMTP id 4F2D610C1050; Fri, 30 Nov 2018 11:29:45 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=synopsys.com; s=mail; t=1543606185; bh=q2GNK6YBsTlz/DUIohoAV0KIDZTNxA7yvSkHVOOTzic=; h=From:To:CC:Subject:Date:References:From; b=HS0eWDstR6b+ODPG2eOmxsLocDmmHfCN9wH4rXPlGLrOXjTUZWbANQadp1L4nuORW w4WP74xFzhxikTbteHNQ1XuplJiu01yyJwnevuTT+voNZm1yCGf8RKBWCzMV5+nKR7 SrQI1tqgAW2CqsddHYmzccUIHGz9U4Jqi6x5/1HMY9jHqlahC5Q3dqRMhzGFOEMs+Z JfdjomkYKZEuZ6oUv88p8TBxdLHBmyFtRxXE0/lSSCUx/Me6rdRzBeY17bBlAxS+op WI3JjM/dVaw0nrgLTTq96NwjEahYPJzOPHXHmxhvhv0gQ85sWiocakTr8dSa10e8pr F9Mt0uwXXj/Sw== Received: from us01wehtc1.internal.synopsys.com (us01wehtc1-vip.internal.synopsys.com [10.12.239.236]) by mailhost.synopsys.com (Postfix) with ESMTP id 353235DCC; Fri, 30 Nov 2018 11:29:45 -0800 (PST) Received: from US01WEMBX2.internal.synopsys.com ([fe80::e4b6:5520:9c0d:250b]) by us01wehtc1.internal.synopsys.com ([::1]) with mapi id 14.03.0415.000; Fri, 30 Nov 2018 11:29:45 -0800 From: Vineet Gupta To: Jose Abreu , "linux-snps-arc@lists.infradead.org" , "linux-kernel@vger.kernel.org" CC: Alexey Brodkin , Joao Pinto , Vitor Soares , David Laight Subject: Re: [PATCH v3] ARC: io.h: Implement reads{x}()/writes{x}() Thread-Topic: [PATCH v3] ARC: io.h: Implement reads{x}()/writes{x}() Thread-Index: AQHUiJG/o7fyzIGCckGLnUFm4swJ4g== Date: Fri, 30 Nov 2018 19:29:44 +0000 Message-ID: References: <244eba764469e8493f2d0c85a6d965aad6cd8128.1543571088.git.joabreu@synopsys.com> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.144.199.106] Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On 11/30/18 1:47 AM, Jose Abreu wrote:=0A= > Some ARC CPU's do not support unaligned loads/stores. Currently, generic= =0A= > implementation of reads{b/w/l}()/writes{b/w/l}() is being used with ARC.= =0A= > This can lead to misfunction of some drivers as generic functions do a=0A= > plain dereference of a pointer that can be unaligned.=0A= >=0A= > Let's use {get/put}_unaligned() helpers instead of plain dereference of= =0A= > pointer in order to fix. The helpers allow to get and store data from an= =0A= > unaligned address whilst preserving the CPU internal alignment.=0A= > According to [1], the use of these helpers are costly in terms of=0A= > performance so we added an initial check for a buffer already aligned so= =0A= > that the usage of the helpers can be avoided, when possible.=0A= >=0A= > [1] Documentation/unaligned-memory-access.txt=0A= >=0A= > Changes from v2:=0A= > - Rework commit msg (Vineet)=0A= > - Check if count is 0 and return (Vineet)=0A= > - Use two different loops (Vineet)=0A= >=0A= > Changes from v1:=0A= > - Check if buffer is already aligned (David)=0A= > - Remove 64 bit mention (Alexey)=0A= >=0A= > Signed-off-by: Jose Abreu =0A= > Tested-by: Vitor Soares =0A= > Cc: Vineet Gupta =0A= > Cc: Alexey Brodkin =0A= > Cc: Joao Pinto =0A= > Cc: Vitor Soares =0A= > Cc: David Laight =0A= =0A= Applied to for-curr after some minor chg (added a comment about accessor)= =0A= =0A= Thx,=0A= -Vineet=0A=