Re: [PATCH v2] m68k/amiga - zorro.c: set up z->dev.dma_mask for the DMA API

2018-03-06 Thread Michael Schmitz
Hi Geert,

thanks. will add the necessary DMA mask fixup to the ESP driver now.

Cheers,

Michael


Am 06.03.2018 um 20:56 schrieb Geert Uytterhoeven:
> Hi Michael,
> 
> On Tue, Mar 6, 2018 at 2:06 AM, Michael Schmitz  wrote:
>> thanks for explaining - I had forgotten that the SCSI adapter in elgar
>> is probably on the CPU accelerator card.
>>
>> 00: Phase 5 Digital Products CyberSCSI/Blizzard 1220
>> Type: Zorro II
>> Address: 00e9 (0001 bytes)
>> Serial number: 
>> Slot address: 00e9
>> Slot size: 0001
>>
>> is the output for that card.
>>
>> The register address space of these cards (except Fastlane) fits into
>> the smaller ZorroII space.
>>
>> Your version of the patch, plus setup of the 32 bit mask in the
>> driver, is the correct solution. Do you want me to submit a corrected
>> patch, or can you do that on the fly?
> 
> I will apply, and queue for v4.16:
> 
> commit 45243ee871a5681042d6fa6e43ddb4f6fe06669d
> Author: Michael Schmitz 
> Date:   Sat Mar 3 12:04:13 2018 +1300
> 
> zorro: Set up z->dev.dma_mask for the DMA API
> 
> The generic DMA API uses dev->dma_mask to check the DMA addressable
> memory bitmask, and warns if no mask is set or even allocated.
> 
> Set z->dev.dma_coherent_mask on Zorro bus scan, and make z->dev.dma_mask
> to point to z->dev.dma_coherent_mask so device drivers that need DMA have
> everything set up to avoid warnings from dma_alloc_coherent(). Drivers can
> still use dma_set_mask_and_coherent() to explicitly set their DMA bit 
> mask.
> 
> Signed-off-by: Michael Schmitz 
> [geert: Handle Zorro II with 24-bit address space]
> Acked-by: Christoph Hellwig 
> Signed-off-by: Geert Uytterhoeven 
> 
> diff --git a/drivers/zorro/zorro.c b/drivers/zorro/zorro.c
> index cc1b1ac57d61e8b7..4a5bccba55548720 100644
> --- a/drivers/zorro/zorro.c
> +++ b/drivers/zorro/zorro.c
> @@ -16,6 +16,7 @@
>  #include 
>  #include 
>  #include 
> +#include 
>  #include 
> 
>  #include 
> @@ -185,6 +186,16 @@ static int __init amiga_zorro_probe(struct
> platform_device *pdev)
> z->dev.parent = >dev;
> z->dev.bus = _bus_type;
> z->dev.id = i;
> +   switch (z->rom.er_Type & ERT_TYPEMASK) {
> +   case ERT_ZORROIII:
> +   z->dev.coherent_dma_mask = DMA_BIT_MASK(32);
> +   break;
> +   case ERT_ZORROII:
> +   default:
> +   z->dev.coherent_dma_mask = DMA_BIT_MASK(24);
> +   break;
> +   }
> +   z->dev.dma_mask = >dev.coherent_dma_mask;
> }
> 
> /* ... then register them */
> 
> Gr{oetje,eeting}s,
> 
> Geert
> 
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- 
> ge...@linux-m68k.org
> 
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like 
> that.
> -- Linus Torvalds
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-m68k" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2] m68k/amiga - zorro.c: set up z->dev.dma_mask for the DMA API

2018-03-05 Thread Geert Uytterhoeven
Hi Michael,

On Tue, Mar 6, 2018 at 2:06 AM, Michael Schmitz  wrote:
> thanks for explaining - I had forgotten that the SCSI adapter in elgar
> is probably on the CPU accelerator card.
>
> 00: Phase 5 Digital Products CyberSCSI/Blizzard 1220
> Type: Zorro II
> Address: 00e9 (0001 bytes)
> Serial number: 
> Slot address: 00e9
> Slot size: 0001
>
> is the output for that card.
>
> The register address space of these cards (except Fastlane) fits into
> the smaller ZorroII space.
>
> Your version of the patch, plus setup of the 32 bit mask in the
> driver, is the correct solution. Do you want me to submit a corrected
> patch, or can you do that on the fly?

I will apply, and queue for v4.16:

commit 45243ee871a5681042d6fa6e43ddb4f6fe06669d
Author: Michael Schmitz 
Date:   Sat Mar 3 12:04:13 2018 +1300

zorro: Set up z->dev.dma_mask for the DMA API

The generic DMA API uses dev->dma_mask to check the DMA addressable
memory bitmask, and warns if no mask is set or even allocated.

Set z->dev.dma_coherent_mask on Zorro bus scan, and make z->dev.dma_mask
to point to z->dev.dma_coherent_mask so device drivers that need DMA have
everything set up to avoid warnings from dma_alloc_coherent(). Drivers can
still use dma_set_mask_and_coherent() to explicitly set their DMA bit mask.

Signed-off-by: Michael Schmitz 
[geert: Handle Zorro II with 24-bit address space]
Acked-by: Christoph Hellwig 
Signed-off-by: Geert Uytterhoeven 

diff --git a/drivers/zorro/zorro.c b/drivers/zorro/zorro.c
index cc1b1ac57d61e8b7..4a5bccba55548720 100644
--- a/drivers/zorro/zorro.c
+++ b/drivers/zorro/zorro.c
@@ -16,6 +16,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 

 #include 
@@ -185,6 +186,16 @@ static int __init amiga_zorro_probe(struct
platform_device *pdev)
z->dev.parent = >dev;
z->dev.bus = _bus_type;
z->dev.id = i;
+   switch (z->rom.er_Type & ERT_TYPEMASK) {
+   case ERT_ZORROIII:
+   z->dev.coherent_dma_mask = DMA_BIT_MASK(32);
+   break;
+   case ERT_ZORROII:
+   default:
+   z->dev.coherent_dma_mask = DMA_BIT_MASK(24);
+   break;
+   }
+   z->dev.dma_mask = >dev.coherent_dma_mask;
}

/* ... then register them */

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe linux-m68k" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2] m68k/amiga - zorro.c: set up z->dev.dma_mask for the DMA API

2018-03-05 Thread Michael Schmitz
Hi Geert,

thanks for explaining - I had forgotten that the SCSI adapter in elgar
is probably on the CPU accelerator card.

00: Phase 5 Digital Products CyberSCSI/Blizzard 1220
Type: Zorro II
Address: 00e9 (0001 bytes)
Serial number: 
Slot address: 00e9
Slot size: 0001

is the output for that card.

The register address space of these cards (except Fastlane) fits into
the smaller ZorroII space.

Your version of the patch, plus setup of the 32 bit mask in the
driver, is the correct solution. Do you want me to submit a corrected
patch, or can you do that on the fly?

Cheers,


On Tue, Mar 6, 2018 at 12:05 AM, Geert Uytterhoeven
 wrote:
> Hi Michael,
>
> On Sun, Mar 4, 2018 at 1:21 AM, Michael Schmitz  wrote:
>> that's odd - the DMA setup code in the old ESP drivers does program the
>> full 32 bit addresses on DMA set-up. No masking off to 24 bit.
>>
>> All boards except for the Fastlane are ZorroII. Writes to the DMA
>> registers are done byte-wise there (only on the Fastlane, the target
>> address is written as one longword), so this suggests there is a limit
>> to the data bus width, but doesn't speak to the address bus width.
>>
>> I'm sure Amigas weren't limited to 16 MB of RAM (pretty certain kullervo
>> had 32 or 64 MB). No evidence of Amiga SCSI ever using a DMA bounce
>> buffer (as we've had to use on Atari). How would the old SCSI drivers
>> have worked, if DMA can't address the full 32 bit space?
>
> The Fastlane is indeed a Zorro III board, that fits into a Zorro III
> expansion slot.
>
> However, the other boards supported by your new zorro_esp driver are not
> Zorro II expansion boards. They fit in the CPU expansion slot, and thus have
> full access to all memory. They just use the Zorro AutoConfig protocol for
> discovery.
>
> I don't know how their expansion ROMs look like. They may identify as either
> a Zorro II or Zorro III board, depending on how much address space they need
> for their registers. Given SCSI doesn't need much, most probably look like a
> Zorro II board.
>
> Google found the following lszorro output:
>
> 00: Phase 5 Blizzard 2060 [Accelerator]
> Type: Zorro II
> Address: 00ea (0002 bytes)
> Serial number: 
> Slot address: 00ea
> Slot size: 0002
>
> elgar:~# lszorro -vv
> 00: Phase 5 Blizzard 1220/CyberStorm [Accelerator and SCSI Host 
> Adapter]
> Type: Zorro II
> Address: 00e9 (0001 bytes)
> Serial number: 
> Slot address: 00e9
> Slot size: 0001
>
> which confirms that they identify as Zorro II boards.
> So the Zorro driver core can set their DMA masks to 24-bit, but the driver can
> safely override it to 32-bit.
>
>> Am 03.03.2018 um 22:31 schrieb Geert Uytterhoeven:
>>> On Sat, Mar 3, 2018 at 12:08 AM, Christoph Hellwig  wrote:
 Assuming all zorro devices can deal fine with a 32-bit dma mask:
>>>
>>> No they don't. Zorro II has a 24-bit bus, Zorro III has a 32-bit bus.
>>> So it should be something like:
>>>
>>> switch (z->rom.er_Type & ERT_TYPEMASK) {
>>> case ERT_ZORROIII:
>>> z->dev.coherent_dma_mask = DMA_BIT_MASK(32);
>>> break;
>>> case ERT_ZORROII:
>>> default:
>>> z->dev.coherent_dma_mask = DMA_BIT_MASK(24);
>>> break;
>>> }
>>>
>>> Other types are not defined, but I have no idea how expansion boards for
>>> the original Amiga 1000 ("Zorro I") are represented. As that one had a 
>>> 24-bit
>>> bus, using 24 for the default should be fine.
>
> Gr{oetje,eeting}s,
>
> Geert
>
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- 
> ge...@linux-m68k.org
>
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like 
> that.
> -- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe linux-m68k" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2] m68k/amiga - zorro.c: set up z->dev.dma_mask for the DMA API

2018-03-05 Thread Geert Uytterhoeven
Hi Michael,

On Sun, Mar 4, 2018 at 1:21 AM, Michael Schmitz  wrote:
> that's odd - the DMA setup code in the old ESP drivers does program the
> full 32 bit addresses on DMA set-up. No masking off to 24 bit.
>
> All boards except for the Fastlane are ZorroII. Writes to the DMA
> registers are done byte-wise there (only on the Fastlane, the target
> address is written as one longword), so this suggests there is a limit
> to the data bus width, but doesn't speak to the address bus width.
>
> I'm sure Amigas weren't limited to 16 MB of RAM (pretty certain kullervo
> had 32 or 64 MB). No evidence of Amiga SCSI ever using a DMA bounce
> buffer (as we've had to use on Atari). How would the old SCSI drivers
> have worked, if DMA can't address the full 32 bit space?

The Fastlane is indeed a Zorro III board, that fits into a Zorro III
expansion slot.

However, the other boards supported by your new zorro_esp driver are not
Zorro II expansion boards. They fit in the CPU expansion slot, and thus have
full access to all memory. They just use the Zorro AutoConfig protocol for
discovery.

I don't know how their expansion ROMs look like. They may identify as either
a Zorro II or Zorro III board, depending on how much address space they need
for their registers. Given SCSI doesn't need much, most probably look like a
Zorro II board.

Google found the following lszorro output:

00: Phase 5 Blizzard 2060 [Accelerator]
Type: Zorro II
Address: 00ea (0002 bytes)
Serial number: 
Slot address: 00ea
Slot size: 0002

elgar:~# lszorro -vv
00: Phase 5 Blizzard 1220/CyberStorm [Accelerator and SCSI Host Adapter]
Type: Zorro II
Address: 00e9 (0001 bytes)
Serial number: 
Slot address: 00e9
Slot size: 0001

which confirms that they identify as Zorro II boards.
So the Zorro driver core can set their DMA masks to 24-bit, but the driver can
safely override it to 32-bit.

> Am 03.03.2018 um 22:31 schrieb Geert Uytterhoeven:
>> On Sat, Mar 3, 2018 at 12:08 AM, Christoph Hellwig  wrote:
>>> Assuming all zorro devices can deal fine with a 32-bit dma mask:
>>
>> No they don't. Zorro II has a 24-bit bus, Zorro III has a 32-bit bus.
>> So it should be something like:
>>
>> switch (z->rom.er_Type & ERT_TYPEMASK) {
>> case ERT_ZORROIII:
>> z->dev.coherent_dma_mask = DMA_BIT_MASK(32);
>> break;
>> case ERT_ZORROII:
>> default:
>> z->dev.coherent_dma_mask = DMA_BIT_MASK(24);
>> break;
>> }
>>
>> Other types are not defined, but I have no idea how expansion boards for
>> the original Amiga 1000 ("Zorro I") are represented. As that one had a 24-bit
>> bus, using 24 for the default should be fine.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe linux-m68k" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2] m68k/amiga - zorro.c: set up z->dev.dma_mask for the DMA API

2018-03-03 Thread Michael Schmitz
Hi Geert,

that's odd - the DMA setup code in the old ESP drivers does program the
full 32 bit addresses on DMA set-up. No masking off to 24 bit.

All boards except for the Fastlane are ZorroII. Writes to the DMA
registers are done byte-wise there (only on the Fastlane, the target
address is written as one longword), so this suggests there is a limit
to the data bus width, but doesn't speak to the address bus width.

I'm sure Amigas weren't limited to 16 MB of RAM (pretty certain kullervo
had 32 or 64 MB). No evidence of Amiga SCSI ever using a DMA bounce
buffer (as we've had to use on Atari). How would the old SCSI drivers
have worked, if DMA can't address the full 32 bit space?

Either way, the SCSI driver works even without DMA mask set up - it only
spits an ugly warning at probe. Might be better to shelve this for now.

Cheers,

Michael

Am 03.03.2018 um 22:31 schrieb Geert Uytterhoeven:
> On Sat, Mar 3, 2018 at 12:08 AM, Christoph Hellwig  wrote:
>> Assuming all zorro devices can deal fine with a 32-bit dma mask:
> 
> No they don't. Zorro II has a 24-bit bus, Zorro III has a 32-bit bus.
> So it should be something like:
> 
> switch (z->rom.er_Type & ERT_TYPEMASK) {
> case ERT_ZORROIII:
> z->dev.coherent_dma_mask = DMA_BIT_MASK(32);
> break;
> case ERT_ZORROII:
> default:
> z->dev.coherent_dma_mask = DMA_BIT_MASK(24);
> break;
> }
> 
> Other types are not defined, but I have no idea how expansion boards for
> the original Amiga 1000 ("Zorro I") are represented. As that one had a 24-bit
> bus, using 24 for the default should be fine.
> 
> Gr{oetje,eeting}s,
> 
> Geert
> 
> --
> Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- 
> ge...@linux-m68k.org
> 
> In personal conversations with technical people, I call myself a hacker. But
> when I'm talking to journalists I just say "programmer" or something like 
> that.
> -- Linus Torvalds
> 
--
To unsubscribe from this list: send the line "unsubscribe linux-m68k" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2] m68k/amiga - zorro.c: set up z->dev.dma_mask for the DMA API

2018-03-03 Thread Geert Uytterhoeven
On Sat, Mar 3, 2018 at 12:08 AM, Christoph Hellwig  wrote:
> Assuming all zorro devices can deal fine with a 32-bit dma mask:

No they don't. Zorro II has a 24-bit bus, Zorro III has a 32-bit bus.
So it should be something like:

switch (z->rom.er_Type & ERT_TYPEMASK) {
case ERT_ZORROIII:
z->dev.coherent_dma_mask = DMA_BIT_MASK(32);
break;
case ERT_ZORROII:
default:
z->dev.coherent_dma_mask = DMA_BIT_MASK(24);
break;
}

Other types are not defined, but I have no idea how expansion boards for
the original Amiga 1000 ("Zorro I") are represented. As that one had a 24-bit
bus, using 24 for the default should be fine.

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- ge...@linux-m68k.org

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds
--
To unsubscribe from this list: send the line "unsubscribe linux-m68k" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH v2] m68k/amiga - zorro.c: set up z->dev.dma_mask for the DMA API

2018-03-02 Thread Christoph Hellwig
Assuming all zorro devices can deal fine with a 32-bit dma mask:

Acked-by: Christoph Hellwig 
--
To unsubscribe from this list: send the line "unsubscribe linux-m68k" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html