Received: by 10.223.185.116 with SMTP id b49csp2617228wrg; Sun, 25 Feb 2018 02:03:21 -0800 (PST) X-Google-Smtp-Source: AG47ELtQhCGHnyC7YhaAnCGV6Oa4W+QwVh6dJoy/109y9X7lee8ai1CUby3wU3/Hx6s4CtKJ8c9m X-Received: by 2002:a17:902:7c03:: with SMTP id x3-v6mr1934187pll.206.1519553001620; Sun, 25 Feb 2018 02:03:21 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519553001; cv=none; d=google.com; s=arc-20160816; b=EJnp0f6uubjxm49YlzUct6TwawTAi2ksYw/+bjrx2gdnzFWNmpQQnnZp8t8Lq/yW13 a9mNl6rf2dTHxLxdIdjgpJbBMqSxAyvjNChXAtGgG/YX21fmBjvYOHcYUzjLxLqWd9V5 aBhDKPmg30G1ZSP1B38Ag6/JlLUeVHss1ZpTZG3T22NM3qlTrrQV36S/86VcdVW81wEN FqcWqYk9Gf28av7KVoZMISS9CpEefc6pzn9AJnPomGiq09XiwcIDmHP5Q1Pi6iPKpntG 9IIn1Jv7tDoTWWZnTOJiIBVbSpQAorbN5TkIbjFP5tMJsrdHliuEr1kBcSQJWpwgA6vc lqdg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:message-id:in-reply-to:date:references:subject:cc:to :from:arc-authentication-results; bh=7R0LPQB38R3DRge7XTqpSpjoQME1V9/mCnQpXGenaKk=; b=PxUEmGfrt1dqefppgh7ai0HA1UIe2UJhgtWmqOBNpW3M4nNSaO2BRFdV+bwSSLh8rI OEkCWj4bYZbC9y/h22mzRdPoUrJXF79OZnGrOHPESGNHDZjQU2UTF7sY425W8LxsNQa7 q6qjTlyI14VpPI/kBm6+IAx+e2MRQDHpyBr9mViP5cf3hk8nPQxhWYXfYhMrPOmC0gUn hipPRH374aIYzM9o4liLUnixzMgCYPGfhg3T12qaRkEM52UhSx9SweSBzxt7sS82Lgub o2Fx3Y9ZBxerBSjo7EkNdb61x3X0yybupgdetb3WPm+9fE8tvLOA9ONQRMjtaFotlyr3 AS+g== 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 q190si4949759pfb.147.2018.02.25.02.03.07; Sun, 25 Feb 2018 02:03:21 -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 S1751646AbeBYKCZ convert rfc822-to-8bit (ORCPT + 99 others); Sun, 25 Feb 2018 05:02:25 -0500 Received: from mx2.suse.de ([195.135.220.15]:41217 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750987AbeBYKCU (ORCPT ); Sun, 25 Feb 2018 05:02:20 -0500 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 84FAAAC21; Sun, 25 Feb 2018 10:02:18 +0000 (UTC) From: Johannes Thumshirn To: Arnd Bergmann Cc: James Smart , Dick Kennedy , "James E.J. Bottomley" , "Martin K. Petersen" , Hannes Reinecke , linux-scsi@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH] scsi: lpfc: use memcpy_toio instead of writeq References: <20180223153700.2186058-1-arnd@arndb.de> Date: Sun, 25 Feb 2018 11:02:16 +0100 In-Reply-To: <20180223153700.2186058-1-arnd@arndb.de> (Arnd Bergmann's message of "Fri, 23 Feb 2018 16:36:49 +0100") Message-ID: User-Agent: Gnus/5.13 (Gnus v5.13) Emacs/24.3 (gnu/linux) MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8BIT Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Arnd Bergmann writes: > 32-bit architectures generally cannot use writeq(), so we now get a build > failure for the lpfc driver: > > drivers/scsi/lpfc/lpfc_sli.c: In function 'lpfc_sli4_wq_put': > drivers/scsi/lpfc/lpfc_sli.c:145:4: error: implicit declaration of function 'writeq'; did you mean 'writeb'? [-Werror=implicit-function-declaration] Hi Arnd, why can't we use the writeq() from 'io-64-nonatomic-lo-hi.h'? I always thought these are compat versions for 32 Bit archs and even asked James to do so, what's why he did the change in the first place. My apologies for this James. Thanks, Johannes > > Another problem here is that writing out actual data (unlike accessing > mmio registers) means we must write the data with the same endianess > that we have read from memory, but writeq() will perform byte swaps > and add barriers inbetween accesses as we do for registers. > > Using memcpy_toio() should do the right thing here, using register > sized stores with correct endianess conversion and barriers (i.e. none), > but on some architectures might fall back to byte-size access. > > Side note: shouldn't the driver use ioremap_wc() instead of ioremap() > to get a write-combining mapping on all architectures that support this? > > Fixes: 1351e69fc6db ("scsi: lpfc: Add push-to-adapter support to sli4") > Signed-off-by: Arnd Bergmann > --- > drivers/scsi/lpfc/lpfc_sli.c | 9 +++------ > 1 file changed, 3 insertions(+), 6 deletions(-) > > diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c > index 4ce3ca6f4b79..6749d41753b4 100644 > --- a/drivers/scsi/lpfc/lpfc_sli.c > +++ b/drivers/scsi/lpfc/lpfc_sli.c > @@ -115,7 +115,6 @@ lpfc_sli4_wq_put(struct lpfc_queue *q, union lpfc_wqe *wqe) > struct lpfc_register doorbell; > uint32_t host_index; > uint32_t idx; > - uint32_t i = 0; > uint8_t *tmp; > > /* sanity check on queue memory */ > @@ -138,12 +137,10 @@ lpfc_sli4_wq_put(struct lpfc_queue *q, union lpfc_wqe *wqe) > if (q->phba->sli3_options & LPFC_SLI4_PHWQ_ENABLED) > bf_set(wqe_wqid, &wqe->generic.wqe_com, q->queue_id); > lpfc_sli_pcimem_bcopy(wqe, temp_wqe, q->entry_size); > - if (q->dpp_enable && q->phba->cfg_enable_dpp) { > + if (q->dpp_enable && q->phba->cfg_enable_dpp) > /* write to DPP aperture taking advatage of Combined Writes */ > - tmp = (uint8_t *)wqe; > - for (i = 0; i < q->entry_size; i += sizeof(uint64_t)) > - writeq(*((uint64_t *)(tmp + i)), q->dpp_regaddr + i); > - } > + memcpy_toio(tmp, q->dpp_regaddr, q->entry_size); > + > /* ensure WQE bcopy and DPP flushed before doorbell write */ > wmb(); -- Johannes Thumshirn Storage jthumshirn@suse.de +49 911 74053 689 SUSE LINUX GmbH, Maxfeldstr. 5, 90409 Nürnberg GF: Felix Imendörffer, Jane Smithard, Graham Norton HRB 21284 (AG Nürnberg) Key fingerprint = EC38 9CAB C2C4 F25D 8600 D0D0 0393 969D 2D76 0850