Re: [PATCH 6/9] x86/iommu: change Calgary to use dma_ops register interface
On Tue, Sep 30, 2008 at 01:10:28PM +0200, Ingo Molnar wrote: * Joerg Roedel [EMAIL PROTECTED] wrote: +static int calgary_device_supported(struct device *dev) +{ + struct iommu_table *tbl; + + tbl = find_iommu_table(dev); + + return translation_enabled(tbl); +} i guess this could be written as a simple: +static int calgary_device_supported(struct device *dev) +{ + return translation_enabled(find_iommu_table(dev)); +} ? Yes. I will change it. Joerg -- | AMD Saxony Limited Liability Company Co. KG Operating | Wilschdorfer Landstr. 101, 01109 Dresden, Germany System| Register Court Dresden: HRA 4896 Research | General Partner authorized to represent: Center| AMD Saxony LLC (Wilmington, Delaware, US) | General Manager of AMD Saxony LLC: Dr. Hans-R. Deppe, Thomas McCoy -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 6/9] x86/iommu: change Calgary to use dma_ops register interface
On Tue, Sep 30, 2008 at 01:10:28PM +0200, Ingo Molnar wrote: * Joerg Roedel [EMAIL PROTECTED] wrote: +static int calgary_device_supported(struct device *dev) +{ + struct iommu_table *tbl; + + tbl = find_iommu_table(dev); + + return translation_enabled(tbl); +} i guess this could be written as a simple: +static int calgary_device_supported(struct device *dev) +{ + return translation_enabled(find_iommu_table(dev)); +} Sure, but I prefer the explicit form since it lends itself to easier debugging (oops line numbers, adding printks, etc.). Cheers, Muli -- The First Workshop on I/O Virtualization (WIOV '08) Dec 2008, San Diego, CA, http://www.usenix.org/wiov08/ xxx SYSTOR 2009---The Israeli Experimental Systems Conference http://www.haifa.il.ibm.com/conferences/systor2009/ -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 6/9] x86/iommu: change Calgary to use dma_ops register interface
* Muli Ben-Yehuda [EMAIL PROTECTED] wrote: +static int calgary_device_supported(struct device *dev) +{ + return translation_enabled(find_iommu_table(dev)); +} Sure, but I prefer the explicit form since it lends itself to easier debugging (oops line numbers, adding printks, etc.). we never do that for simple stuff like this. The kernel would be twice as large if we did. An oops is easy enough to decode and an oops does not come with a line number. Ingo -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
Re: [PATCH 6/9] x86/iommu: change Calgary to use dma_ops register interface
On Tue, Sep 30, 2008 at 05:38:15PM +0200, Ingo Molnar wrote: * Muli Ben-Yehuda [EMAIL PROTECTED] wrote: +static int calgary_device_supported(struct device *dev) +{ + return translation_enabled(find_iommu_table(dev)); +} Sure, but I prefer the explicit form since it lends itself to easier debugging (oops line numbers, adding printks, etc.). we never do that for simple stuff like this. The kernel would be twice as large if we did. I assume you are talking about the source size, because the generated code size should be exactly the same. In any case, arguing where to place the semi-colon is a waste of time. Do as you see fit. Cheers, Muli -- The First Workshop on I/O Virtualization (WIOV '08) Dec 2008, San Diego, CA, http://www.usenix.org/wiov08/ xxx SYSTOR 2009---The Israeli Experimental Systems Conference http://www.haifa.il.ibm.com/conferences/systor2009/ -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html
[PATCH 6/9] x86/iommu: change Calgary to use dma_ops register interface
Signed-off-by: Joerg Roedel [EMAIL PROTECTED] --- arch/x86/kernel/pci-calgary_64.c | 21 +++-- 1 files changed, 11 insertions(+), 10 deletions(-) diff --git a/arch/x86/kernel/pci-calgary_64.c b/arch/x86/kernel/pci-calgary_64.c index fe7695e..e2f2f60 100644 --- a/arch/x86/kernel/pci-calgary_64.c +++ b/arch/x86/kernel/pci-calgary_64.c @@ -525,6 +525,15 @@ static void calgary_free_coherent(struct device *dev, size_t size, free_pages((unsigned long)vaddr, get_order(size)); } +static int calgary_device_supported(struct device *dev) +{ + struct iommu_table *tbl; + + tbl = find_iommu_table(dev); + + return translation_enabled(tbl); +} + static struct dma_mapping_ops calgary_dma_ops = { .alloc_coherent = calgary_alloc_coherent, .free_coherent = calgary_free_coherent, @@ -532,6 +541,7 @@ static struct dma_mapping_ops calgary_dma_ops = { .unmap_single = calgary_unmap_single, .map_sg = calgary_map_sg, .unmap_sg = calgary_unmap_sg, + .device_supported = calgary_device_supported, }; static inline void __iomem * busno_to_bbar(unsigned char num) @@ -1223,16 +1233,6 @@ static int __init calgary_init(void) goto error; } while (1); - dev = NULL; - for_each_pci_dev(dev) { - struct iommu_table *tbl; - - tbl = find_iommu_table(dev-dev); - - if (translation_enabled(tbl)) - dev-dev.archdata.dma_ops = calgary_dma_ops; - } - return ret; error: @@ -1535,6 +1535,7 @@ int __init calgary_iommu_init(void) force_iommu = 1; bad_dma_address = 0x0; + x86_register_dma_ops(calgary_dma_ops, DMA_OPS_TYPE_HW); /* dma_ops is set to swiotlb or nommu */ if (!dma_ops) dma_ops = nommu_dma_ops; -- 1.5.6.4 -- To unsubscribe from this list: send the line unsubscribe kvm in the body of a message to [EMAIL PROTECTED] More majordomo info at http://vger.kernel.org/majordomo-info.html