public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
* dma_mask on scsi_calculate_bounce_limit
@ 2010-11-18  8:50 王神
  2010-11-18 15:21 ` James Bottomley
  0 siblings, 1 reply; 7+ messages in thread
From: 王神 @ 2010-11-18  8:50 UTC (permalink / raw)
  To: linux-scsi

Hi

I have enabled DMA for my host device and when i connect a scsi device
to the host, it crashes in the following code..

Function: scsi_calculate_bounce_limit

 if (host_dev && host_dev->dma_mask)
                bounce_limit = *host_dev->dma_mask;

"*dma_mask" is illegal pointer operation. I would like to understand
is this known and is there reason behind such a code ?

TIA
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: dma_mask on scsi_calculate_bounce_limit
  2010-11-18  8:50 dma_mask on scsi_calculate_bounce_limit 王神
@ 2010-11-18 15:21 ` James Bottomley
  2010-11-18 17:54   ` 王神
  0 siblings, 1 reply; 7+ messages in thread
From: James Bottomley @ 2010-11-18 15:21 UTC (permalink / raw)
  To: 王神; +Cc: linux-scsi

On Thu, 2010-11-18 at 14:20 +0530, 王神 wrote:
> Hi
> 
> I have enabled DMA for my host device and when i connect a scsi device
> to the host, it crashes in the following code..
> 
> Function: scsi_calculate_bounce_limit
> 
>  if (host_dev && host_dev->dma_mask)
>                 bounce_limit = *host_dev->dma_mask;
> 
> "*dma_mask" is illegal pointer operation. I would like to understand
> is this known and is there reason behind such a code ?

It likely means you're operating on a new architecture and its generic
devices haven't been set up correctly.

James


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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: dma_mask on scsi_calculate_bounce_limit
  2010-11-18 15:21 ` James Bottomley
@ 2010-11-18 17:54   ` 王神
  2010-11-19  0:52     ` James Bottomley
  0 siblings, 1 reply; 7+ messages in thread
From: 王神 @ 2010-11-18 17:54 UTC (permalink / raw)
  To: James Bottomley; +Cc: linux-scsi

On Thu, Nov 18, 2010 at 11:21 PM, James Bottomley
<James.Bottomley@suse.de> wrote:
> On Thu, 2010-11-18 at 14:20 +0530, 王神 wrote:
>> Hi
>>
>> I have enabled DMA for my host device and when i connect a scsi device
>> to the host, it crashes in the following code..
>>
>> Function: scsi_calculate_bounce_limit
>>
>>  if (host_dev && host_dev->dma_mask)
>>                 bounce_limit = *host_dev->dma_mask;
>>
>> "*dma_mask" is illegal pointer operation. I would like to understand
>> is this known and is there reason behind such a code ?
>
> It likely means you're operating on a new architecture and its generic
> devices haven't been set up correctly.

Could you please more specific on what is generic devices haven't been
setup properly...

>
> James
>
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: dma_mask on scsi_calculate_bounce_limit
  2010-11-18 17:54   ` 王神
@ 2010-11-19  0:52     ` James Bottomley
  2010-11-19  6:41       ` 王神
  0 siblings, 1 reply; 7+ messages in thread
From: James Bottomley @ 2010-11-19  0:52 UTC (permalink / raw)
  To: 王神; +Cc: linux-scsi

On Fri, 2010-11-19 at 01:54 +0800, 王神 wrote:
> On Thu, Nov 18, 2010 at 11:21 PM, James Bottomley
> <James.Bottomley@suse.de> wrote:
> > On Thu, 2010-11-18 at 14:20 +0530, 王神 wrote:
> >> Hi
> >>
> >> I have enabled DMA for my host device and when i connect a scsi device
> >> to the host, it crashes in the following code..
> >>
> >> Function: scsi_calculate_bounce_limit
> >>
> >>  if (host_dev && host_dev->dma_mask)
> >>                 bounce_limit = *host_dev->dma_mask;
> >>
> >> "*dma_mask" is illegal pointer operation. I would like to understand
> >> is this known and is there reason behind such a code ?
> >
> > It likely means you're operating on a new architecture and its generic
> > devices haven't been set up correctly.
> 
> Could you please more specific on what is generic devices haven't been
> setup properly...

It means the architecture setup code left a NULL pointer in the generic
device which shouldn't be there ... without knowing which architecture
and seeing the code, it's pretty impossible to be more specific.

James


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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: dma_mask on scsi_calculate_bounce_limit
  2010-11-19  0:52     ` James Bottomley
@ 2010-11-19  6:41       ` 王神
  2010-11-19 15:13         ` Douglas Gilbert
  2010-11-19 15:15         ` James Bottomley
  0 siblings, 2 replies; 7+ messages in thread
From: 王神 @ 2010-11-19  6:41 UTC (permalink / raw)
  To: James Bottomley; +Cc: linux-scsi

On Fri, Nov 19, 2010 at 6:22 AM, James Bottomley
<James.Bottomley@suse.de> wrote:
> On Fri, 2010-11-19 at 01:54 +0800, 王神 wrote:
>> On Thu, Nov 18, 2010 at 11:21 PM, James Bottomley
>> <James.Bottomley@suse.de> wrote:
>> > On Thu, 2010-11-18 at 14:20 +0530, 王神 wrote:
>> >> Hi
>> >>
>> >> I have enabled DMA for my host device and when i connect a scsi device
>> >> to the host, it crashes in the following code..
>> >>
>> >> Function: scsi_calculate_bounce_limit
>> >>
>> >>  if (host_dev && host_dev->dma_mask)
>> >>                 bounce_limit = *host_dev->dma_mask;
>> >>
>> >> "*dma_mask" is illegal pointer operation. I would like to understand
>> >> is this known and is there reason behind such a code ?
>> >
>> > It likely means you're operating on a new architecture and its generic
>> > devices haven't been set up correctly.
>>
>> Could you please more specific on what is generic devices haven't been
>> setup properly...
>
> It means the architecture setup code left a NULL pointer in the generic
> device which shouldn't be there ... without knowing which architecture
> and seeing the code, it's pretty impossible to be more specific.

It is for ARM and the error is not due to NULL pointer. The code just
checks if it is host mode + dma enabled and it access a normal
interger variable with indirection causing the crash;

int dma_mask;

and accessing dma_mask as "*dma_mask" ??

Anything I am missing :O

>
> James
>
>
>
--
To unsubscribe from this list: send the line "unsubscribe linux-scsi" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: dma_mask on scsi_calculate_bounce_limit
  2010-11-19  6:41       ` 王神
@ 2010-11-19 15:13         ` Douglas Gilbert
  2010-11-19 15:15         ` James Bottomley
  1 sibling, 0 replies; 7+ messages in thread
From: Douglas Gilbert @ 2010-11-19 15:13 UTC (permalink / raw)
  To: 王神; +Cc: James Bottomley, linux-scsi

On 10-11-19 01:41 AM, 王神 wrote:
> On Fri, Nov 19, 2010 at 6:22 AM, James Bottomley
> <James.Bottomley@suse.de>  wrote:
>> On Fri, 2010-11-19 at 01:54 +0800, 王神 wrote:
>>> On Thu, Nov 18, 2010 at 11:21 PM, James Bottomley
>>> <James.Bottomley@suse.de>  wrote:
>>>> On Thu, 2010-11-18 at 14:20 +0530, 王神 wrote:
>>>>> Hi
>>>>>
>>>>> I have enabled DMA for my host device and when i connect a scsi device
>>>>> to the host, it crashes in the following code..
>>>>>
>>>>> Function: scsi_calculate_bounce_limit
>>>>>
>>>>>   if (host_dev&&  host_dev->dma_mask)
>>>>>                  bounce_limit = *host_dev->dma_mask;
>>>>>
>>>>> "*dma_mask" is illegal pointer operation. I would like to understand
>>>>> is this known and is there reason behind such a code ?
>>>>
>>>> It likely means you're operating on a new architecture and its generic
>>>> devices haven't been set up correctly.
>>>
>>> Could you please more specific on what is generic devices haven't been
>>> setup properly...
>>
>> It means the architecture setup code left a NULL pointer in the generic
>> device which shouldn't be there ... without knowing which architecture
>> and seeing the code, it's pretty impossible to be more specific.
> 
> It is for ARM and the error is not due to NULL pointer. The code just
> checks if it is host mode + dma enabled and it access a normal
> interger variable with indirection causing the crash;
> 
> int dma_mask;
> 
> and accessing dma_mask as "*dma_mask" ??
> 
> Anything I am missing :O

Yes, supplying more information.

I'm familiar with AT91SAM9G20 which is an ARM based
microcontroller. The directory of interest in the kernel
source is arch/arm/mach-at91 and for the G20 the
at91sam9260_devices.c file defines its DMA masks for
its devices. In all cases that I can see the dma_mask is
the address of a u64 holding DMA_BIT_MASK(32) .

There are no real SCSI devices on the G20 but USB
might be regarded as SCSI "once removed". And the
USB devices on the G20 have dma_mask values as
described above.

Doug Gilbert

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

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: dma_mask on scsi_calculate_bounce_limit
  2010-11-19  6:41       ` 王神
  2010-11-19 15:13         ` Douglas Gilbert
@ 2010-11-19 15:15         ` James Bottomley
  1 sibling, 0 replies; 7+ messages in thread
From: James Bottomley @ 2010-11-19 15:15 UTC (permalink / raw)
  To: 王神; +Cc: linux-scsi

On Fri, 2010-11-19 at 12:11 +0530, 王神 wrote:
> On Fri, Nov 19, 2010 at 6:22 AM, James Bottomley
> <James.Bottomley@suse.de> wrote:
> > On Fri, 2010-11-19 at 01:54 +0800, 王神 wrote:
> >> On Thu, Nov 18, 2010 at 11:21 PM, James Bottomley
> >> <James.Bottomley@suse.de> wrote:
> >> > On Thu, 2010-11-18 at 14:20 +0530, 王神 wrote:
> >> >> Hi
> >> >>
> >> >> I have enabled DMA for my host device and when i connect a scsi device
> >> >> to the host, it crashes in the following code..
> >> >>
> >> >> Function: scsi_calculate_bounce_limit
> >> >>
> >> >>  if (host_dev && host_dev->dma_mask)
> >> >>                 bounce_limit = *host_dev->dma_mask;
> >> >>
> >> >> "*dma_mask" is illegal pointer operation. I would like to understand
> >> >> is this known and is there reason behind such a code ?
> >> >
> >> > It likely means you're operating on a new architecture and its generic
> >> > devices haven't been set up correctly.
> >>
> >> Could you please more specific on what is generic devices haven't been
> >> setup properly...
> >
> > It means the architecture setup code left a NULL pointer in the generic
> > device which shouldn't be there ... without knowing which architecture
> > and seeing the code, it's pretty impossible to be more specific.
> 
> It is for ARM and the error is not due to NULL pointer. The code just
> checks if it is host mode + dma enabled and it access a normal
> interger variable with indirection causing the crash;

OK, it's crashing because the pointer isn't set up correctly ... is that
more semantically accurate?

The pointer setup is done in the arch code, so that's where the problem
is.

> int dma_mask;

That's not the definition in struct device; this is:

        u64             *dma_mask;      /* dma mask (if dma'able device) */


> and accessing dma_mask as "*dma_mask" ??
> 
> Anything I am missing :O

Yes, but you supply too little information to know what.  It's
definitely a problem somewhere in the arch setup code.

James


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

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2010-11-19 15:15 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-11-18  8:50 dma_mask on scsi_calculate_bounce_limit 王神
2010-11-18 15:21 ` James Bottomley
2010-11-18 17:54   ` 王神
2010-11-19  0:52     ` James Bottomley
2010-11-19  6:41       ` 王神
2010-11-19 15:13         ` Douglas Gilbert
2010-11-19 15:15         ` James Bottomley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox