From patchwork Mon Mar 5 18:29:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: James Smart X-Patchwork-Id: 10259469 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 4CBC160134 for ; Mon, 5 Mar 2018 18:29:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3C4DE28BBE for ; Mon, 5 Mar 2018 18:29:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 308B128BC0; Mon, 5 Mar 2018 18:29:19 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.0 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID, DKIM_VALID_AU, FREEMAIL_FROM, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id A11B328BBE for ; Mon, 5 Mar 2018 18:29:18 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752096AbeCES3R (ORCPT ); Mon, 5 Mar 2018 13:29:17 -0500 Received: from mail-qt0-f196.google.com ([209.85.216.196]:33780 "EHLO mail-qt0-f196.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751818AbeCES3R (ORCPT ); Mon, 5 Mar 2018 13:29:17 -0500 Received: by mail-qt0-f196.google.com with SMTP id a23so21499094qtn.0 for ; Mon, 05 Mar 2018 10:29:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=7fYS59hB4e+o/mhDhTXfzuiK/O0Q+X6niwCA1MXRNA4=; b=gMt6IAlOnmQQl+EjNJKArTJ4OfuON1MpcedIPWUfMbYUCzgf4PYKgxyVA6dZ6oLNCb 1+HR/fbkz8r3yP+udiB4OlhUNqTJsEDx6q553nnZp7KUJbi1CNITwPRqfXG5D+Voefq+ vXXpNR2VSI+1Gnh8Se/g0Oxyv5upjMR/3MPUHdKjYWwQhZNhN/+Sp/lxQMu90VtWEXg5 YJ1R7HI9xNXDO7E3XTRM+oO35Od0tScSUatxg1/ePRtcC1gh8RLbBTuatmDiMc/hq5En 6++MK8rtADr1aZTH8K9/39XaY7cmXyyv8i7+qBh8i65oI9ywIKja9zJH1dZWs1EEohc7 4DlQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=7fYS59hB4e+o/mhDhTXfzuiK/O0Q+X6niwCA1MXRNA4=; b=Nge/UoYDgVoxYjlzvE1V1xl9ahMOdM0LPKDelakYrdN8Pi/3JmZRKbzrn2hDu3z/Ud oqn3SKdx5gyxa++MlJGAl9BrHSl8dgX9ynEvez8ph4BswQGmzR9qaxa0tzZCikyvqx7l 2H2NJ/atPfcUTexxPRYOULpvwDL34DK1t6QaJKX1msoGp6dnq0tP831CPa6ukhMvpeyL e+hf5RWzAzoFnlXf+v1bo8IjtPLMpAEqUUPJcgGhX+ed2K0u1u2fNihMx0cHhAH5GTkK WkqtMJoyXmXuOTVPNKLlGWtXT63xdtn7dslMbS32o2K32TDi32ggJie8LPpQbqOB7T5C j6Dw== X-Gm-Message-State: AElRT7G6e0S2nSviWEn1s6RIXHPylMOyeXgN1/IvuFFfGOMDNWpp6srw 4+eqkwWbbVfcOtmvMu78aecbzA== X-Google-Smtp-Source: AG47ELtvuj56Oj4MCvI8VPjsaDfcb4dLWktLwXybo2ZNUBbp3G3TqJI1WIgZH86hSc9DtaGkuIroAg== X-Received: by 10.237.42.132 with SMTP id t4mr24343405qtd.297.1520274556143; Mon, 05 Mar 2018 10:29:16 -0800 (PST) Received: from os42.localdomain ([192.19.218.250]) by smtp.gmail.com with ESMTPSA id j7sm8659049qtn.58.2018.03.05.10.29.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Mon, 05 Mar 2018 10:29:15 -0800 (PST) From: James Smart To: linux-scsi@vger.kernel.org, arnd@arndb.de, jejb@linux.vnet.ibm.com, hare@suse.com, jthumshirn@suse.de, martin.petersen@oracle.com Cc: James Smart , Dick Kennedy , James Smart Subject: [PATCH v2] lpfc: use __raw_writeX on DPP copies Date: Mon, 5 Mar 2018 10:29:03 -0800 Message-Id: <20180305182903.21583-1-jsmart2021@gmail.com> X-Mailer: git-send-email 2.13.1 Sender: linux-scsi-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-scsi@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch replaces: https://www.spinics.net/lists/linux-scsi/msg117838.html A prior lpfc patch: scsi: lpfc: Add push-to-adapter support to sli4 commitid=1351e69fc6db30e186295f1c9495d03cef6a01a2 Fails compilation on some 32-bit systems as writeq() is not supported on all architectures. Additionally, it was pointed out that as writeX() does byteswapping if necessary for pci vs the cpu endianness, the code was broken on BE PPC. After discussions with Arnd Bergmann, we've resolved the issue to the following: Instead of writeX(), use __raw_writeX() - which writes to io space while preserving byte order. To use this, the code was changed to use a different buffer that lpfc prepped via sli_pcimem_bcopy() that was set to the bytestream to be written. On platforms with __raw_writeq support, use the routine, otherwise use __raw_writel() Signed-off-by: Dick Kennedy Signed-off-by: James Smart Reviewed-by: Arnd Bergmann --- v2: check for __raw_writeq defined, instead of CONFIG_64bit allows 32bit platforms with support to use it. --- drivers/scsi/lpfc/lpfc_sli.c | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/scsi/lpfc/lpfc_sli.c b/drivers/scsi/lpfc/lpfc_sli.c index 4ce3ca6f4b79..d20cf51ca15d 100644 --- a/drivers/scsi/lpfc/lpfc_sli.c +++ b/drivers/scsi/lpfc/lpfc_sli.c @@ -140,9 +140,16 @@ lpfc_sli4_wq_put(struct lpfc_queue *q, union lpfc_wqe *wqe) lpfc_sli_pcimem_bcopy(wqe, temp_wqe, q->entry_size); if (q->dpp_enable && q->phba->cfg_enable_dpp) { /* write to DPP aperture taking advatage of Combined Writes */ - tmp = (uint8_t *)wqe; + tmp = (uint8_t *)temp_wqe; +#ifdef __raw_writeq for (i = 0; i < q->entry_size; i += sizeof(uint64_t)) - writeq(*((uint64_t *)(tmp + i)), q->dpp_regaddr + i); + __raw_writeq(*((uint64_t *)(tmp + i)), + q->dpp_regaddr + i); +#else + for (i = 0; i < q->entry_size; i += sizeof(uint32_t)) + __raw_writel(*((uint32_t *)(tmp + i)), + q->dpp_regaddr + i); +#endif } /* ensure WQE bcopy and DPP flushed before doorbell write */ wmb();