RE: memblock_end_of_DRAM() return end address + 1

From: Bhushan Bharat-R65777
Date: Thu May 31 2012 - 09:41:34 EST


Adding some more gentlemen's.


> -----Original Message-----
> From: linux-kernel-owner@xxxxxxxxxxxxxxx [mailto:linux-kernel-
> owner@xxxxxxxxxxxxxxx] On Behalf Of Bhushan Bharat-R65777
> Sent: Thursday, May 31, 2012 4:34 PM
> To: linux-mm@xxxxxxxxx; linux-kernel@xxxxxxxxxxxxxxx
> Cc: agraf@xxxxxxx
> Subject: memblock_end_of_DRAM() return end address + 1
>
> Hi All,
>
> memblock_end_of_DRAM() defined in mm/memblock.c returns base_address + size; So
> this is not returning the end_of_DRAM, it is basically returning the end_of_DRAM
> + 1. The name looks to suggest that this returns end address on DRAM.
>
> IIUC, it looks like that some code assumes this returns the end address while
> some assumes this returns end address + 1.
>
> Example:
> 1. arch/powerpc/platforms/85xx/mpc85xx_ds.c
>
>
> <cut>
>
> #ifdef CONFIG_SWIOTLB
> if (memblock_end_of_DRAM() > max) {
> ppc_swiotlb_enable = 1;
> set_pci_dma_ops(&swiotlb_dma_ops);
> ppc_md.pci_dma_dev_setup = pci_dma_dev_setup_swiotlb;
> }
> #endif
>
> <cut>
> <cut>
>
>
> Where max = 0xffffffff; So we assumes that memblock_end_of_DRAM() actually
> returns end address.
>
> ------
> 2.
>
> In arch/powerpc/kernel/dma.c
>
>
> static int dma_direct_dma_supported(struct device *dev, u64 mask) { #ifdef
> CONFIG_PPC64
> /* Could be improved so platforms can set the limit in case
> * they have limited DMA windows
> */
> return mask >= get_dma_offset(dev) + (memblock_end_of_DRAM() - 1);
>
>
> <cut>
>
> It looks to that here we assume base + addr + 1;
>
> -----------
>
>
> Thanks
> -Bharat
>
>
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the
> body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at
> http://vger.kernel.org/majordomo-info.html
> Please read the FAQ at http://www.tux.org/lkml/


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/