From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.3 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id EDE1CC32751 for ; Wed, 7 Aug 2019 17:08:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C499B2235C for ; Wed, 7 Aug 2019 17:08:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388814AbfHGRIN (ORCPT ); Wed, 7 Aug 2019 13:08:13 -0400 Received: from foss.arm.com ([217.140.110.172]:52162 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1729278AbfHGRIN (ORCPT ); Wed, 7 Aug 2019 13:08:13 -0400 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 3C10F344; Wed, 7 Aug 2019 10:08:12 -0700 (PDT) Received: from e107155-lin (e107155-lin.cambridge.arm.com [10.1.196.42]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 8AEBD3F575; Wed, 7 Aug 2019 10:08:11 -0700 (PDT) Date: Wed, 7 Aug 2019 18:08:09 +0100 From: Sudeep Holla To: David Laight Cc: "linux-arm-kernel@lists.infradead.org" , "linux-kernel@vger.kernel.org" , Philipp Zabel Subject: Re: [PATCH] firmware: arm_scmi: Use {get,put}_unaligned_le32 accessors Message-ID: <20190807170808.GD27278@e107155-lin> References: <20190807130038.26878-1-sudeep.holla@arm.com> <4102ce79ef7a4f5ba819663d072bccc8@AcuMS.aculab.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <4102ce79ef7a4f5ba819663d072bccc8@AcuMS.aculab.com> User-Agent: Mutt/1.9.4 (2018-02-28) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Aug 07, 2019 at 03:18:59PM +0000, David Laight wrote: > From: Sudeep Holla > > Sent: 07 August 2019 14:01 > > > > Instead of type-casting the {tx,rx}.buf all over the place while > > accessing them to read/write __le32 from/to the firmware, let's use > > the nice existing {get,put}_unaligned_le32 accessors to hide all the > > type cast ugliness. > > Why the 'unaligned' accessors? > Since the firmware run in LE, we do byte-swapping anyways. > > - *(__le32 *)t->tx.buf = cpu_to_le32(id); > > + put_unaligned_le32(id, t->tx.buf); > If you look at the generic definition for put_unaligned_le32, it's exactly the same as what I am replacing with the call. So nothing changes IIUC. In fact, I see that all the helper in unaligned/access_ok.h just do the byte-swapping. > These will be expensive if the cpu doesn't support them. The SCMI is currently used only on ARM platforms which have HAVE_EFFICIENT_UNALIGNED_ACCESS defined. -- Regards, Sudeep From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.3 required=3.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 2C379C32751 for ; Wed, 7 Aug 2019 17:08:20 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id F366A21EF2 for ; Wed, 7 Aug 2019 17:08:19 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="ntwEjWFw" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org F366A21EF2 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:Cc:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References: Message-ID:Subject:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ayz10WY7TlhEjubnhzdcPd8z5LA7HN3osXaCkZAh6ws=; b=ntwEjWFwCVrKbM WN+Hd8auomfMQeeWEGhaM3dfhJSyO7CnxdjkZGk72QMOBNSwET7nwGBU7mGcxadVPYFONQ8Ud7scz 1GU+WQVcw9A3wNDStihEzifCH/Tu2G9inrx2F8HUUERGyaXjw1srWKgABtrFkYRIgp7gfJWuBAcn/ IT+SjiCF9WiqLwyTKWXOKuY9EA7njUZSZK67uPKNS0fqYDCUT2I4FZb4yXMCquT4hd7zKf55AJLM2 CwzcRh0r/Ag/sXLWflv5sWAug/Ze5rWiLL87Mj+6sHOX4T9Oy1UvIj8+C1rqv8qTzhsND7ZauvnS9 O2wvz3a6jw9173+ini8w==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hvPQB-0007si-5E; Wed, 07 Aug 2019 17:08:19 +0000 Received: from foss.arm.com ([217.140.110.172]) by bombadil.infradead.org with esmtp (Exim 4.92 #3 (Red Hat Linux)) id 1hvPQ7-0007s0-60 for linux-arm-kernel@lists.infradead.org; Wed, 07 Aug 2019 17:08:16 +0000 Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id 3C10F344; Wed, 7 Aug 2019 10:08:12 -0700 (PDT) Received: from e107155-lin (e107155-lin.cambridge.arm.com [10.1.196.42]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 8AEBD3F575; Wed, 7 Aug 2019 10:08:11 -0700 (PDT) Date: Wed, 7 Aug 2019 18:08:09 +0100 From: Sudeep Holla To: David Laight Subject: Re: [PATCH] firmware: arm_scmi: Use {get,put}_unaligned_le32 accessors Message-ID: <20190807170808.GD27278@e107155-lin> References: <20190807130038.26878-1-sudeep.holla@arm.com> <4102ce79ef7a4f5ba819663d072bccc8@AcuMS.aculab.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <4102ce79ef7a4f5ba819663d072bccc8@AcuMS.aculab.com> User-Agent: Mutt/1.9.4 (2018-02-28) X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20190807_100815_267360_3C26543E X-CRM114-Status: GOOD ( 14.61 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Philipp Zabel , "linux-kernel@vger.kernel.org" , "linux-arm-kernel@lists.infradead.org" Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+infradead-linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Wed, Aug 07, 2019 at 03:18:59PM +0000, David Laight wrote: > From: Sudeep Holla > > Sent: 07 August 2019 14:01 > > > > Instead of type-casting the {tx,rx}.buf all over the place while > > accessing them to read/write __le32 from/to the firmware, let's use > > the nice existing {get,put}_unaligned_le32 accessors to hide all the > > type cast ugliness. > > Why the 'unaligned' accessors? > Since the firmware run in LE, we do byte-swapping anyways. > > - *(__le32 *)t->tx.buf = cpu_to_le32(id); > > + put_unaligned_le32(id, t->tx.buf); > If you look at the generic definition for put_unaligned_le32, it's exactly the same as what I am replacing with the call. So nothing changes IIUC. In fact, I see that all the helper in unaligned/access_ok.h just do the byte-swapping. > These will be expensive if the cpu doesn't support them. The SCMI is currently used only on ARM platforms which have HAVE_EFFICIENT_UNALIGNED_ACCESS defined. -- Regards, Sudeep _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel