Re: [PATCH] lpfc: use __raw_writeX on DPP copies
On Mon, 2018-03-05 at 09:03 -0800, James Smart wrote: > 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: > When 32-bit, use 32-bit accesses. > 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. > > Signed-off-by: Dick Kennedy> Signed-off-by: James Smart > --- > 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..675914cc8ab8 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 CONFIG_64BIT Whether a platform has a functioning writeq isn't related to its 64 bitness, there are a few 32 bit platforms which have it. As long as you don't get an include of the lo-hi helpers which really confused this situation, the define you're looking for is #ifdef __raw_writeq James
[PATCH] lpfc: use __raw_writeX on DPP copies
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: When 32-bit, use 32-bit accesses. 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. Signed-off-by: Dick KennedySigned-off-by: James Smart --- 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..675914cc8ab8 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 CONFIG_64BIT 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(); -- 2.13.1