move scatterlist accessors into scatterlist.h on ia64, sh and sh64
PATCH 1/1 move scatterlist accessors into scatterlist.h on ia64, sh and sh64
---
Although this is a simple move, the sh implementation looks bogus. dma_map_sg is this:
static inline int dma_map_sg(struct device *dev, struct scatterlist *sg,
int nents, enum dma_data_direction dir)
{
int i;
for (i = 0; i < nents; i++) {
#if !defined(CONFIG_PCI) || defined(CONFIG_SH_PCIDMA_NONCOHERENT)
dma_cache_sync(page_address(sg[i].page) + sg[i].offset,
sg[i].length, dir);
#endif
sg[i].dma_address = page_to_phys(sg[i].page) + sg[i].offset;
}
return nents;
}which is about right for a simple physical==bus physical implementation. However, your accessor is:
#define sg_dma_address(sg) (virt_to_bus((sg)->dma_address))
so you're calling virt_to_bus() on an already physical address.
James
drivers/net/forcedeth.c +0 -0
drivers/net/pcmcia/axnet_cs.c +0 -0
drivers/net/skge.c +0 -0
drivers/net/sky2.c +0 -0
drivers/net/sky2.h +0 -0
drivers/net/tulip/winbond-840.c +0 -0
drivers/net/via-rhine.c +0 -0
drivers/net/wireless/bcm43xx/bcm43xx_main.c +0 -0
drivers/scsi/libata-core.c +0 -0
drivers/scsi/sata_mv.c +0 -0
include/asm-ia64/pci.h +0 -3
@@ -79,9 +79,6 @@ #define pci_dac_dma_to_offset(dev,dma_ad#define pci_dac_dma_sync_single_for_cpu (dev,dma_addr,len,dir) do { } while (0)#define pci_dac_dma_sync_single_for_device (dev,dma_addr,len,dir) do { mb(); } while (0) -#define sg_dma_len (sg) ((sg)->dma_length) -#define sg_dma_address (sg) ((sg)->dma_address) -#ifdef CONFIG_PCI static inline void pci_dma_burst_advice(struct pci_dev *pdev, enum pci_dma_burst_strategy *strat,
include/asm-ia64/scatterlist.h +3 -0
@@ -25,4 +25,7 @@ struct scatterlist {*/ #define ISA_DMA_THRESHOLD 0xffffffff +#define sg_dma_len (sg) ((sg)->dma_length) +#define sg_dma_address (sg) ((sg)->dma_address) +#endif /* _ASM_IA64_SCATTERLIST_H */
include/asm-sh/pci.h +0 -9
@@ -87,15 +87,6 @@ #endif*/ #define pci_dac_dma_supported (pci_dev, mask) (0) -/* These macros should be used after a pci_map_sg call has been done -* to get bus addresses of each of the SG entries and their lengths. -* You should only work with the number of sg entries pci_map_sg -* returns, or alternatively stop on the first sg_dma_len(sg) which -* is 0. -*/ -#define sg_dma_address (sg) (virt_to_bus((sg)->dma_address)) -#define sg_dma_len (sg) ((sg)->length) -#ifdef CONFIG_PCI static inline void pci_dma_burst_advice(struct pci_dev *pdev, enum pci_dma_burst_strategy *strat,
include/asm-sh/scatterlist.h +9 -0
@@ -10,4 +10,13 @@ struct scatterlist {#define ISA_DMA_THRESHOLD (0x1fffffff) +/* These macros should be used after a pci_map_sg call has been done +* to get bus addresses of each of the SG entries and their lengths. +* You should only work with the number of sg entries pci_map_sg +* returns, or alternatively stop on the first sg_dma_len(sg) which +* is 0. +*/ +#define sg_dma_address (sg) (virt_to_bus((sg)->dma_address)) +#define sg_dma_len (sg) ((sg)->length) +#endif /* !(__ASM_SH_SCATTERLIST_H) */
include/asm-sh64/pci.h +0 -9
@@ -77,15 +77,6 @@ #endif*/ #define pci_dac_dma_supported (pci_dev, mask) (0) -/* These macros should be used after a pci_map_sg call has been done -* to get bus addresses of each of the SG entries and their lengths. -* You should only work with the number of sg entries pci_map_sg -* returns, or alternatively stop on the first sg_dma_len(sg) which -* is 0. -*/ -#define sg_dma_address (sg) ((sg)->dma_address) -#define sg_dma_len (sg) ((sg)->length) -#ifdef CONFIG_PCI static inline void pci_dma_burst_advice(struct pci_dev *pdev, enum pci_dma_burst_strategy *strat,
include/asm-sh64/scatterlist.h +9 -0
@@ -20,4 +20,13 @@ struct scatterlist {#define ISA_DMA_THRESHOLD (0xffffffff) +/* These macros should be used after a pci_map_sg call has been done +* to get bus addresses of each of the SG entries and their lengths. +* You should only work with the number of sg entries pci_map_sg +* returns, or alternatively stop on the first sg_dma_len(sg) which +* is 0. +*/ +#define sg_dma_address (sg) ((sg)->dma_address) +#define sg_dma_len (sg) ((sg)->length) +#endif /* !__ASM_SH64_SCATTERLIST_H */
Quoted 5 lines · James Bottomley
However, your accessor is:
#define
sg_dma_address(sg)(virt_to_bus((sg)->dma_address))so you're calling
virt_to_bus()on an already physical address.
It doesn't matter for kernel addresses on CPUs like SH and MIPS, because it's just a mask anyway. There's a 1:1 mapping from virtual<->physical addresses, and all you have to do to get a physical address is mask out the top bits.
Signature · 1 line
dwmw2
Quoted 6 lines · David Woodhouse
It doesn't matter for kernel addresses on CPUs like SH and MIPS, because
it's just a mask anyway. There's a 1:1 mapping from virtual<->physical addresses, and all you have to do to get a physical address is mask out
the top bits.
I still think it matters from the point of view of logical correctness ... you shouldn't be calling virt_to_bus() on an already physical address, even if the operation happens to be idempotent on the architecture.
James
Quoted 4 lines · James Bottomley
I still think it matters from the point of view of logical correctness ... you shouldn't be calling
virt_to_bus()on an already physical address, even if the operation happens to be idempotent on the architecture.
True.
Signature · 1 line
dwmw2
Quoted 2 lines · David Woodhouse
It doesn't matter for kernel addresses on CPUs like SH and MIPS, because it's just a mask anyway.
On mips KSEG0 only convers lowmem though.
Quoted 6 lines · James Bottomley
Signed-off-by James Bottomley <[email protected]>---
Although this is a simple move, the sh implementation looks bogus.dma_map_sgis this:
[snip]
Quoted 7 lines
which is about right for a simple physical==bus physical implementation. However, your accessor is:
#define
sg_dma_address(sg)(virt_to_bus((sg)->dma_address))so you're calling
virt_to_bus()on an already physical address.
Yes, the virt_to_bus() is bogus, feel free to drop it. The rest looks fine.