Received: by 10.223.185.116 with SMTP id b49csp865784wrg; Fri, 23 Feb 2018 08:02:02 -0800 (PST) X-Google-Smtp-Source: AH8x224CPBadbHpphJWW0fO6ulkNxd4DjB0iHSMhggDUU2q4Z+l/+Psd6Z9Ulkse+nJnTiZX4LFz X-Received: by 10.98.71.3 with SMTP id u3mr2239417pfa.219.1519401721916; Fri, 23 Feb 2018 08:02:01 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519401721; cv=none; d=google.com; s=arc-20160816; b=ltLvDJEm0QWE1r/1mmZDOYXib9VKOcXIcinsmYiTZIXe8xk1NHT8LsB9rgImv9LuhF zAIdPUingFo154kyrvIVuAHNexoDixRTds6UoYMfwb4iU0d3AJlzQqPzaSkg9Pzlibi5 2LtFihmP83QOV5NM6WgmqqoVB23jCbxJLSKN9inawhEA32+aI6j6ApwjrhILshhUFTnl KiLPCX3WI91ig83tPf2g7L0ybOJqBsa1F2AVmIckkVFjkizSQrGetjTXM+W6DPpXAfSP SIMegDzZevSvlD6E9DY5tv7d0v78CKeHiMJZu96QwWlZiJWWQKvuEWGZXOTSdOz7QD0i h/zw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=PfW5tE5Ipgez950q+At7Bc9h7qo2oI+iI0GZKYJFnvs=; b=OaQj/nHFICl65x4tLBumSYQOROObY79uzrg1rcqbADbnzqrBwkedaq9f9Pd3p5c52s DnZ1cbYMaPjLyUNR6pjEkvuJ3kFrNlQ8d7eYGQjsG2NLAVKqQagPjq9RTB9FiqisfoFx PsMk9JtNp0aHWZ07dXyoIi8v5voKib4ezj0ylLwsyiIr+/7DO4jjUdgArIv5oFOP4vOS 2YnG3vWc6m1avtNfijd+yYdKPZOiBsi6OrhA02HsWWGr1tXHg5p8jH2JZ9uXgP9AyybB QfXbOpL/J2S2htqbhl5MV4g8QYc4FtSuxKO6C2aOxqiOuPkd+3tuDBcAhyGR+Fm7Kh1O 1hyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=cHk6E3Jb; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 206si1653798pgb.647.2018.02.23.08.01.34; Fri, 23 Feb 2018 08:02:01 -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=@gmail.com header.s=20161025 header.b=cHk6E3Jb; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751570AbeBWP7q (ORCPT + 99 others); Fri, 23 Feb 2018 10:59:46 -0500 Received: from mail-qt0-f176.google.com ([209.85.216.176]:46869 "EHLO mail-qt0-f176.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751477AbeBWP7K (ORCPT ); Fri, 23 Feb 2018 10:59:10 -0500 Received: by mail-qt0-f176.google.com with SMTP id m13so6335290qtg.13; Fri, 23 Feb 2018 07:59:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=PfW5tE5Ipgez950q+At7Bc9h7qo2oI+iI0GZKYJFnvs=; b=cHk6E3Jbid31zkLzZnfheB+9FfQ0o0JDMue5FX/mPVSI8ITM7qHExuvINldfR4WYme NqwaGSQf9LYp5rvumhrYF7nrwB2ygzdUGFlWU2ekCxpnYubeA/4ItnraiD9ZZnaV1BFh +wur/YIYalyNHvrY+vNxSvuynyHI5MeN1eiassndRASlh3VbTfmRzBkzNEY6X8Tf+uWV c3oqrontgrJ1qcp33gWNTR9Jbbr4XfKmPIGrBOLO51JLiKDlRr0wkFs/jsx0w5/FvQFE IV/+CY28rpTYBfj67ZEdO8YdsWnY37oo1T0V9gWbYmJZni96g/SkvWFbVyIW5cT+zHn5 MjUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=PfW5tE5Ipgez950q+At7Bc9h7qo2oI+iI0GZKYJFnvs=; b=S0DubtaQ3zD5mJt2uAy6qnzclHFPrSv2TEw4up/dY6D6IZL/B0ddMTvCsx1Q17/SxN c6/Ge2HgXS8FpnNrk6uKNAW/1Yd0nVnkmbEu3m99TMCoDGgWzq7LSXnQUdck9hR8ekHK z3D/oGyLMqGrZeBHMRcAdiQ2nDHT+d38/viUjQXeuu/g/8rEi5zFDvqVathZJ79+MFY3 HjBNSPJU9V/eJKzHvGhHnCkYXUkcIqwQ+OtgtGn9NoJSFAlbcZNuIJwJTgskk993pEPL VqLUpCGWxBhgxM+WT7eNlvG26MO/ZJb7KLDKercLazxJQ966uEtslsB5zxilDifGKsFR rvCQ== X-Gm-Message-State: APf1xPBlIuKu6/F/9rChLXvMkBcoFXFjCCkXhLs1l74tiicRocFk3lrq hMtiW5QrYCwmWaRVt9pbv+hbLuB+sblwg/pzgpY= X-Received: by 10.237.61.145 with SMTP id i17mr3154628qtf.293.1519401549699; Fri, 23 Feb 2018 07:59:09 -0800 (PST) MIME-Version: 1.0 Received: by 10.12.195.80 with HTTP; Fri, 23 Feb 2018 07:59:08 -0800 (PST) In-Reply-To: <20180223153700.2186058-1-arnd@arndb.de> References: <20180223153700.2186058-1-arnd@arndb.de> From: Andy Shevchenko Date: Fri, 23 Feb 2018 17:59:08 +0200 Message-ID: Subject: Re: [PATCH] scsi: lpfc: use memcpy_toio instead of writeq To: Arnd Bergmann Cc: James Smart , Dick Kennedy , "James E.J. Bottomley" , "Martin K. Petersen" , Hannes Reinecke , Johannes Thumshirn , linux-scsi , Linux Kernel Mailing List Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Feb 23, 2018 at 5:36 PM, Arnd Bergmann wrote: > 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] > > 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? IIRC memcpy_toio() doesn't increment the destination address. lo_hi or hi_lo helpers sound better. > Fixes: 1351e69fc6db ("scsi: lpfc: Add push-to-adapter support to sli4") > Signed-off-by: Arnd Bergmann > @@ -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(); > > -- > 2.9.0 > -- With Best Regards, Andy Shevchenko