public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: Michael Schmitz <schmitzmic@gmail.com>
To: Arnd Bergmann <arnd@kernel.org>
Cc: Linux/m68k <linux-m68k@vger.kernel.org>,
	linux-scsi <linux-scsi@vger.kernel.org>,
	Geert Uytterhoeven <geert@linux-m68k.org>
Subject: Re: [PATCH v1 2/3] scsi - a2091.c: convert m68k WD33C93 drivers to DMA API
Date: Wed, 29 Jun 2022 19:26:53 +1200	[thread overview]
Message-ID: <554d6fa7-01b7-d3c8-a72a-6474e9c5038e@gmail.com> (raw)
In-Reply-To: <CAK8P3a2yx7dgU8xnhOLsyeD0eq5q+wSOOzJPmNDdG1kWkiG3-g@mail.gmail.com>

Hi Arnd,

thanks for your review!

Am 29.06.2022 um 18:06 schrieb Arnd Bergmann:
> On Wed, Jun 29, 2022 at 3:16 AM Michael Schmitz <schmitzmic@gmail.com> wrote:
>>
>> Use dma_map_single() for a2091 driver (leave bounce buffer
>> logic unchanged).
>>
>> Use dma_set_mask_and_coherent() to avoid explicit cache
>> flushes.
>>
>> Compile-tested only.
>>
>> CC: linux-scsi@vger.kernel.org
>> Link: https://lore.kernel.org/r/6d1d88ee-1cf6-c735-1e6d-bafd2096e322@gmail.com
>> Signed-off-by: Michael Schmitz <schmitzmic@gmail.com>
>
> Reviewed-by: Arnd Bergmann <arnd@arndb.de>
>
>> +
>> +       addr = dma_map_single(hdata->dev, scsi_pointer->ptr,
>> +                             len, DMA_DIR(dir_in));
>> +       if (dma_mapping_error(hdata->dev, addr)) {
>> +               dev_warn(hdata->dev, "cannot map SCSI data block %p\n",
>> +                        scsi_pointer->ptr);
>> +               return 1;
>> +       }
>> +       scsi_pointer->dma_handle = addr;
>>
>>         /* don't allow DMA if the physical address is bad */
>>         if (addr & A2091_XFER_MASK) {
>> +               /* drop useless mapping */
>> +               dma_unmap_single(hdata->dev, scsi_pointer->dma_handle,
>> +                                scsi_pointer->this_residual,
>> +                                DMA_DIR(dir_in));
>
> I think you could save the extra map/unmap here if you wanted, but that
> would risk introducing bugs since it requires a larger rework.

Not sure how to do that ...

>> +               scsi_pointer->dma_handle = (dma_addr_t) NULL;
>> +
>>                 wh->dma_bounce_len = (scsi_pointer->this_residual + 511) & ~0x1ff;
>>                 wh->dma_bounce_buffer = kmalloc(wh->dma_bounce_len,
>>                                                 GFP_KERNEL);
>
> Not your bug, but if there is memory above the A2091_XFER_MASK limit,
> this would need to use GFP_DMA instead of GFP_KERNEL.

Same argument goes for gvp11 - though last time I checked (and certainly 
at the time these drivers were written), there really was no difference 
between using GFP_DMA and GFP_KERNEL on m68k, hence the need to check 
the allocated buffer is indeed suitable for DMA, and perhaps revert to 
chip RAM (slow, useless for most other purposes but definitely below 16 
MB) if that fails (as the gvp11 driver does).

Most users will opt for loading the kernel to a RAM chunk at a higher 
physical address, making the lower chunk unusable (except as chip RAM), 
meaning allocating a bounce buffer within the first 16 MB will most 
likely fail anyway AIUI (but Geert would know that for sure).

Cheers,

	Michael

>
>          Arnd
>

  reply	other threads:[~2022-06-29  7:27 UTC|newest]

Thread overview: 19+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-29  1:16 [PATCH v1 0/3] Converting m68k WD33C93 drivers to DMA API Michael Schmitz
2022-06-29  1:16 ` [PATCH v1 1/3] scsi - a3000.c: convert " Michael Schmitz
2022-06-29  6:07   ` Arnd Bergmann
2022-06-29  1:16 ` [PATCH v1 2/3] scsi - a2091.c: " Michael Schmitz
2022-06-29  6:06   ` Arnd Bergmann
2022-06-29  7:26     ` Michael Schmitz [this message]
2022-06-29 15:55       ` Geert Uytterhoeven
2022-06-29 20:48         ` Michael Schmitz
2022-06-30  9:27           ` Geert Uytterhoeven
2022-06-30 19:42             ` Michael Schmitz
2022-06-29  1:16 ` [PATCH v1 3/3] scsi - gvp11.c: " Michael Schmitz
2022-06-29  6:02   ` Arnd Bergmann
2022-06-29  6:19 ` [PATCH v1 0/3] Converting " Arnd Bergmann
2022-06-29  7:36   ` Michael Schmitz
2022-06-29  8:20     ` Arnd Bergmann
2022-06-29 15:48       ` Geert Uytterhoeven
2022-06-29 16:44         ` Arnd Bergmann
2022-06-30  2:45           ` Michael Schmitz
2022-06-29 20:28       ` Michael Schmitz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=554d6fa7-01b7-d3c8-a72a-6474e9c5038e@gmail.com \
    --to=schmitzmic@gmail.com \
    --cc=arnd@kernel.org \
    --cc=geert@linux-m68k.org \
    --cc=linux-m68k@vger.kernel.org \
    --cc=linux-scsi@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox