* [PATCH] aic7xxx large integer
@ 2004-12-04 20:49 Miguel Angel Flores
2004-12-04 20:59 ` Dr. David Alan Gilbert
` (2 more replies)
0 siblings, 3 replies; 6+ messages in thread
From: Miguel Angel Flores @ 2004-12-04 20:49 UTC (permalink / raw)
To: linux-kernel
[-- Attachment #1: Type: text/plain, Size: 133 bytes --]
Hi all,
I noticed a large integer warning when compiling 2.6.10rc3 with the SCSI
AIC-7xxx driver.
Here is the patch.
Cheers,
MaF
[-- Attachment #2: patch-aic7xxx --]
[-- Type: text/plain, Size: 553 bytes --]
diff -r -u linux-2.6.10-rc3/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c linux-2.6.10-rc3-maf/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c
--- linux-2.6.10-rc3/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c 2004-12-04 20:48:11.000000000 +0100
+++ linux-2.6.10-rc3-maf/drivers/scsi/aic7xxx/aic7xxx_osm_pci.c 2004-12-04 20:37:54.000000000 +0100
@@ -226,7 +226,7 @@
}
pci_set_master(pdev);
- mask_39bit = 0x7FFFFFFFFFULL;
+ mask_39bit = 0x7FFFFFFF;
if (sizeof(dma_addr_t) > 4
&& ahc_linux_get_memsize() > 0x80000000
&& pci_set_dma_mask(pdev, mask_39bit) == 0) {
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] aic7xxx large integer
2004-12-04 20:49 [PATCH] aic7xxx large integer Miguel Angel Flores
@ 2004-12-04 20:59 ` Dr. David Alan Gilbert
2004-12-04 22:01 ` Robert Love
2004-12-04 23:16 ` Miguel Angel Flores
2 siblings, 0 replies; 6+ messages in thread
From: Dr. David Alan Gilbert @ 2004-12-04 20:59 UTC (permalink / raw)
To: Miguel Angel Flores; +Cc: linux-kernel
* Miguel Angel Flores (maf@sombragris.com) wrote:
> Hi all,
>
> I noticed a large integer warning when compiling 2.6.10rc3 with the SCSI
> AIC-7xxx driver.
>
> - mask_39bit = 0x7FFFFFFFFFULL;
> + mask_39bit = 0x7FFFFFFF;
Hmm - I can't help but think that perhaps
'mask_39bit' was intended to be a 39 bit mask.
Dave
-----Open up your eyes, open up your mind, open up your code -------
/ Dr. David Alan Gilbert | Running GNU/Linux on Alpha,68K| Happy \
\ gro.gilbert @ treblig.org | MIPS,x86,ARM,SPARC,PPC & HPPA | In Hex /
\ _________________________|_____ http://www.treblig.org |_______/
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] aic7xxx large integer
2004-12-04 20:49 [PATCH] aic7xxx large integer Miguel Angel Flores
2004-12-04 20:59 ` Dr. David Alan Gilbert
@ 2004-12-04 22:01 ` Robert Love
2004-12-04 23:16 ` Miguel Angel Flores
2 siblings, 0 replies; 6+ messages in thread
From: Robert Love @ 2004-12-04 22:01 UTC (permalink / raw)
To: Miguel Angel Flores; +Cc: linux-kernel
On Sat, 2004-12-04 at 21:49 +0100, Miguel Angel Flores wrote:
> - mask_39bit = 0x7FFFFFFFFFULL;
> + mask_39bit = 0x7FFFFFFF;
I cannot believe that this is the correct solution and, if it is, the
name of the variable ought to be changed.
More likely, I suspect that the mask wants to be 39-bits, what with its
name and all.
The problem is that DMA addresses come in both 32-bit (generic) and
64-bit (high) forms. mask_39bit is a dma_addr_t so it is 64-bit if
CONFIG_HIGHMEM64G and 32-bit otherwise. Possibly, the right solution is
to make mask_39bit dma64_addr_t. Or, if the mapping needs to be
consistent, assign a different value depending on the value of
CONFIG_HIGHMEM64G.
See Documentation/DMA-*.txt for more information.
Robert Love
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] aic7xxx large integer
2004-12-04 20:49 [PATCH] aic7xxx large integer Miguel Angel Flores
2004-12-04 20:59 ` Dr. David Alan Gilbert
2004-12-04 22:01 ` Robert Love
@ 2004-12-04 23:16 ` Miguel Angel Flores
2004-12-05 1:02 ` Robert Love
2 siblings, 1 reply; 6+ messages in thread
From: Miguel Angel Flores @ 2004-12-04 23:16 UTC (permalink / raw)
To: linux-kernel
Miguel Angel Flores wrote:
> Hi all,
>
> I noticed a large integer warning when compiling 2.6.10rc3 with the
> SCSI AIC-7xxx driver.
>
> Here is the patch.
>
> Cheers,
> MaF
I post the patch very quickly :(. The original code finally seems OK. My
controller is not working with 39 bit addressing, although I can't find
why the compiler warns. Maybe the length of dma_addr_t type, in the
2.6.9 the type of the mask_39bit variable is bus_addr_t.
Forget the patch. I'll continue looking...
Thanks and excuse the inconvenience.
Cheers,
MaF
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] aic7xxx large integer
2004-12-04 23:16 ` Miguel Angel Flores
@ 2004-12-05 1:02 ` Robert Love
2004-12-06 21:35 ` H. Peter Anvin
0 siblings, 1 reply; 6+ messages in thread
From: Robert Love @ 2004-12-05 1:02 UTC (permalink / raw)
To: Miguel Angel Flores; +Cc: linux-kernel
On Sun, 2004-12-05 at 00:16 +0100, Miguel Angel Flores wrote:
> I post the patch very quickly :(. The original code finally seems OK. My
> controller is not working with 39 bit addressing, although I can't find
> why the compiler warns. Maybe the length of dma_addr_t type, in the
> 2.6.9 the type of the mask_39bit variable is bus_addr_t.
The compiler warns because you are putting a 64-bit value (an unsigned
long long) in a 32-bit value (a u32).
There is definitely a problem on non-highmem compiled kernels, there is
no doubt of that. The concern was that your suggested fix is not right.
Assuming that a 39-bit value is really wanted, the type either needs to
be changed to a dma64_addr_t or the value needs to change at
compile-time to a suitable 32-bit variant when !CONFIG_HIGHMEM64G.
Without knowing what the driver is doing, I have no idea.
Robert Love
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] aic7xxx large integer
2004-12-05 1:02 ` Robert Love
@ 2004-12-06 21:35 ` H. Peter Anvin
0 siblings, 0 replies; 6+ messages in thread
From: H. Peter Anvin @ 2004-12-06 21:35 UTC (permalink / raw)
To: linux-kernel
Followup to: <1102208526.6052.87.camel@localhost>
By author: Robert Love <rml@novell.com>
In newsgroup: linux.dev.kernel
>
> On Sun, 2004-12-05 at 00:16 +0100, Miguel Angel Flores wrote:
>
> > I post the patch very quickly :(. The original code finally seems OK. My
> > controller is not working with 39 bit addressing, although I can't find
> > why the compiler warns. Maybe the length of dma_addr_t type, in the
> > 2.6.9 the type of the mask_39bit variable is bus_addr_t.
>
> The compiler warns because you are putting a 64-bit value (an unsigned
> long long) in a 32-bit value (a u32).
>
> There is definitely a problem on non-highmem compiled kernels, there is
> no doubt of that. The concern was that your suggested fix is not right.
>
> Assuming that a 39-bit value is really wanted, the type either needs to
> be changed to a dma64_addr_t or the value needs to change at
> compile-time to a suitable 32-bit variant when !CONFIG_HIGHMEM64G.
>
> Without knowing what the driver is doing, I have no idea.
>
I suspect that what the driver wants is a mask that is a valid DMA
address no wider than 39 bits (because that's all the hardware can
do.)
If so, I would assume (dma_addr_t)0x7FFFFFFFFFULL is probably the
right thing; it will be truncated to a 32-bit mask if only 32-bit
addressing is available.
-hpa
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2004-12-06 21:35 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-12-04 20:49 [PATCH] aic7xxx large integer Miguel Angel Flores
2004-12-04 20:59 ` Dr. David Alan Gilbert
2004-12-04 22:01 ` Robert Love
2004-12-04 23:16 ` Miguel Angel Flores
2004-12-05 1:02 ` Robert Love
2004-12-06 21:35 ` H. Peter Anvin
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox