lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 11 May 2009 16:11:01 +0200
From:	Joerg Roedel <joro@...tes.org>
To:	Jeremy Fitzhardinge <jeremy@...p.org>
Cc:	Ingo Molnar <mingo@...e.hu>,
	FUJITA Tomonori <fujita.tomonori@....ntt.co.jp>,
	the arch/x86 maintainers <x86@...nel.org>,
	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
	Xen-devel <xen-devel@...ts.xensource.com>,
	Ian Campbell <ian.campbell@...rix.com>,
	Jeremy Fitzhardinge <jeremy.fitzhardinge@...rix.com>
Subject: Re: [PATCH 3/9] xen: add hooks for mapping phys<->bus addresses in
	swiotlb

On Thu, May 07, 2009 at 05:17:16PM -0700, Jeremy Fitzhardinge wrote:
> From: Ian Campbell <ian.campbell@...rix.com>
> 
> Impact: Xen support for DMA
> 
> Add hooks to allow Xen to do translation between pfn and mfns for the swiotlb
> layer, so that dma actually ends up going to the proper machine pages.
> 
> Signed-off-by: Ian Campbell <ian.campbell@...rix.com>
> Signed-off-by: Jeremy Fitzhardinge <jeremy.fitzhardinge@...rix.com>
> Reviewed-by: "H. Peter Anvin" <hpa@...or.com>
> Cc: FUJITA Tomonori <fujita.tomonori@....ntt.co.jp>

Acked-by: Joerg Roedel <joerg.roedel@....com>

> ---
>  arch/x86/kernel/pci-swiotlb.c |   10 ----------
>  arch/x86/xen/pci-swiotlb.c    |   18 ++++++++++++++++++
>  drivers/pci/xen-iommu.c       |   11 +++++++++++
>  include/xen/swiotlb.h         |    2 ++
>  4 files changed, 31 insertions(+), 10 deletions(-)
> 
> diff --git a/arch/x86/kernel/pci-swiotlb.c b/arch/x86/kernel/pci-swiotlb.c
> index bc09da7..3216674 100644
> --- a/arch/x86/kernel/pci-swiotlb.c
> +++ b/arch/x86/kernel/pci-swiotlb.c
> @@ -13,16 +13,6 @@
>  
>  int swiotlb __read_mostly;
>  
> -dma_addr_t swiotlb_phys_to_bus(struct device *hwdev, phys_addr_t paddr)
> -{
> -	return paddr;
> -}
> -
> -phys_addr_t swiotlb_bus_to_phys(dma_addr_t baddr)
> -{
> -	return baddr;
> -}
> -
>  int __weak swiotlb_arch_range_needs_mapping(phys_addr_t paddr, size_t size)
>  {
>  	return 0;
> diff --git a/arch/x86/xen/pci-swiotlb.c b/arch/x86/xen/pci-swiotlb.c
> index 25f0365..1d43fde 100644
> --- a/arch/x86/xen/pci-swiotlb.c
> +++ b/arch/x86/xen/pci-swiotlb.c
> @@ -1,5 +1,7 @@
>  #include <linux/bootmem.h>
>  #include <linux/gfp.h>
> +#include <linux/dma-mapping.h>
> +#include <linux/swiotlb.h>
>  
>  #include <xen/swiotlb.h>
>  #include <asm/xen/hypervisor.h>
> @@ -25,3 +27,19 @@ void *swiotlb_alloc(unsigned order, unsigned long nslabs)
>  	WARN_ON(1);
>  	return NULL;
>  }
> +
> +dma_addr_t swiotlb_phys_to_bus(struct device *hwdev, phys_addr_t paddr)
> +{
> +	if (xen_pv_domain())
> +		return xen_phys_to_bus(paddr);
> +
> +	return paddr;
> +}
> +
> +phys_addr_t swiotlb_bus_to_phys(dma_addr_t baddr)
> +{
> +	if (xen_pv_domain())
> +		return xen_bus_to_phys(baddr);
> +
> +	return baddr;
> +}
> diff --git a/drivers/pci/xen-iommu.c b/drivers/pci/xen-iommu.c
> index b9b4620..e3d6ddb 100644
> --- a/drivers/pci/xen-iommu.c
> +++ b/drivers/pci/xen-iommu.c
> @@ -59,6 +59,17 @@ void xen_swiotlb_fixup(void *buf, size_t size, unsigned long nslabs)
>  			panic(KERN_ERR "xen_create_contiguous_region failed\n");
>  	}
>  }
> +
> +dma_addr_t xen_phys_to_bus(phys_addr_t paddr)
> +{
> +	return phys_to_machine(XPADDR(paddr)).maddr;
> +}
> +
> +phys_addr_t xen_bus_to_phys(dma_addr_t daddr)
> +{
> +	return machine_to_phys(XMADDR(daddr)).paddr;
> +}
> +
>  static inline int address_needs_mapping(struct device *hwdev,
>  						dma_addr_t addr)
>  {
> diff --git a/include/xen/swiotlb.h b/include/xen/swiotlb.h
> index 67b7b42..4229f27 100644
> --- a/include/xen/swiotlb.h
> +++ b/include/xen/swiotlb.h
> @@ -2,5 +2,7 @@
>  #define _XEN_SWIOTLB_H
>  
>  extern void xen_swiotlb_fixup(void *buf, size_t size, unsigned long nslabs);
> +extern phys_addr_t xen_bus_to_phys(dma_addr_t daddr);
> +extern dma_addr_t xen_phys_to_bus(phys_addr_t paddr);
>  
>  #endif /* _XEN_SWIOTLB_H */
> -- 
> 1.6.0.6
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
> the body of a message to majordomo@...r.kernel.org
> 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@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ