Commit 4c06619f authored by James Smart's avatar James Smart Committed by Martin K. Petersen

scsi: lpfc: use __raw_writeX on DPP copies

Commit 1351e69f ("scsi: lpfc: Add push-to-adapter support to sli4")
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()

[mkp: checkpatch]

Fixes: 1351e69f ("scsi: lpfc: Add push-to-adapter support to sli4")
Signed-off-by: default avatarDick Kennedy <dick.kennedy@broadcom.com>
Signed-off-by: default avatarJames Smart <james.smart@broadcom.com>
Reviewed-by: default avatarArnd Bergmann <arnd@arndb.de>
Signed-off-by: default avatarMartin K. Petersen <martin.petersen@oracle.com>
parent 2f793a27
...@@ -140,9 +140,16 @@ lpfc_sli4_wq_put(struct lpfc_queue *q, union lpfc_wqe *wqe) ...@@ -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); 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 */ /* 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)) 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 */ /* ensure WQE bcopy and DPP flushed before doorbell write */
wmb(); wmb();
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment